Salutations!
I am planning to add a feature for my own sake to phpMyAdmin. The reason is, I have created an application for one of my customers and gave him phpMyAdmin-access on his database. For me this is a good solution because I down have to fiddle with a reduced backend, and he scores because I won't charge him for that. ;)
Well, but then one major problem occured to us: He is administrating data containing html-code (here: an image). He wants to see those images inside of phpMyAdmin or at least having a link in a row where he can click on.
Currently libarires/display_tbl.lib.php3 encodes all data with htmlspecialchars(). I want to let certain html-entities pass as such and be rendered by the browser. First I just wanted to hack the code away, bypassing the htmlspecialchars()-Function if a certain config-variable is set.
But I think this can be done with more grace, and may come to be integrated in upcoming phpMyAdmin-releases; if there is a need for, I would be gratefully willing to code the required snippets.
Until now I am not fully advanced regarding how I could put the feature inside the user interface. First on, I want the solution to be as flexible as possible. Best way would be, that a user could choose among a set of functions treating a table. So it would not only be possible to render HTML-Code, but maybe to transform certain characters to other ones. Maybe a function turning all ":-)" into smilie-GIFs.
I thought of extending the SQL-parser to support SQL-Comments which then turn on my celldata-reparsing. I then dropped this idea, because I think it is too hard to use for the novice user.
Currently I am thinking about the following implementations. I would really appreciate your feedback on this, and what you think of it:
1. Add another row below the header-row of the data. It should contain a checkbox and a pulldown for each header. So I can check each checkbox, if I want that field to be HTML-enabled, and choose a value in the pulldown- field, which function I want the field to be used with. I think of a set of predefined PHP-Functions, and the ability to insert 'plugins' in the config.inc.php3 file. Like, I add a "smilie_to_html" function, a "html_img" function, a "html_table" function and so on. This new row could either be shown all the time, or only made accessible by clicking on a link like "Enhance Display" or "Convert fields" or such.
Advantages: Full, flexible control over the desired fields. Customizable, which field I want to have converted. Maybe I only want one single row HTML-enabled, not all of them.
Dis-advantages: Many, many Variables to be propagated throughout the page. Maybe too much to fit in GET-Vars. Many checkboxes/pulldowns to render for the browser (slowdown)
2. Add a persistent table-property field. There I can define, much like the 'edit table properties' which fields I later want to be treated with certain functions.
Advantages: Clean integration without much variable-propagation hassle.
Dis-Advantages: We have to store this data somewhere, which is harder to user for the novice user because he has to create tables like the bookmark-table. Parsing would be a lot harder to do, because one has to take ALIAS-Rows into consideration. You can't do 'on-the-fly'-alteration of a single cell to be HTML-enabled.
3. Add a full-page alternative Display much like the current 'print view'. Call it 'html view' and parse every single data as HTML.
Advantages: Most easy to code
Dis-Advanteges: Ugly implementation, no customization.
4. Expand the SQL-language with phpMyAdmin-parseable comments. Like: SELECT field_img, field_href, field_plain FROM table /* pma_parse:field_img:html_img, pma_parse:field_href:html_href, pma_parse:field_plain:htmlspecialchars */
And then add a nice Interface to that like the "insert field-name" dropdown above the SQL Query-Textarea.
Advantages: Perfect way for a 'pro'-user. Easy to code, very flexible, no variable-propagation hassle.
Dis-Advantages: Hard to get for novice users to be usable, unless a good point-an-click editing system is etablished.
Maybe the last suggestions, if done properly, could be enhanced for all kind of native phpMyAdmin-functions. Even though I can't think of any other right now.
So...oppinions please? :-)
-- Bye, ...[ icq #21392242 | Garvin ...[ www.supergarv.de |
... *Wenn Du im Zweifel bist, hoere auf den Mann mit der blutigeren Waffe.*