Drupal idea

Some time ago I wrote a patch for img_assist to include acidfree images (http://drupal.org/node/37154)
Someone asked if I was going to port it to drupal 4.7.

I thought of a better way to do what img_assist does. There could be a generic interface and API to add any type of node through a popup-window like img_assist does.

Img_assist is easy to understand in principal: When you click on the "add image" icon next to a text-box, it pops up a window. In that window you select an image by looking at thumbnails. When you click on it a line of text is inserted into the textbox and the popup closes.
The inserted line of text is specially formatted so that a parser can process it before the node is rendered and displayed to the visitor.

Suppose I want to create a generic popup. When a user clicks on "add something", the popup pops up.
He can then chose what kind of node he wants to insert. Like "image","acidfree","node", ...
Depending on his choice, a different list of candidates is presented in the form of icons. When he clicks it, a line is inserted into the textbox. The line should mention the type of object being inserted aswell as some index.
The filter detected the line of text, parser it and returns the correct HTML code.

Now I want to work with hooks so that the entire thing is modular. First of all, a module needs to tell the assist module that it can offer content for the popup window. Next, it has to offer a list of things to include. This list should have icons, ID's of objects and maybe some more info.
When its time to render the object inside a node, the module should have a function (=filter callback) to generate HTML code for this specific object.

All of this looks pretty easy :)

I didn't mention that I would like a tree-structure for nodes though. Like I have for acidfree objects in img_assist... The module should probably have a function to list all branches of a tree aswell. That way, when the user requests to add an acidfree object, he is presented with a tree of subdirectories to chose from. When one is selected, the interface calls the function to get a list of objects for that specific subtree.

Now I just need to work out if I can maybe pass object-specific variables through the interface, like img_assist does. It has the option to select whether you want to include the original image or a thumbnail, you can set the size of the image to show, you can choose to insert a filter-tag or actual HTML code etc.
Maybe there could be a hook for this aswell...

Enough food for thought. If I ever implement this, it would be nice if it was included into drupal by default :)