Hi all!

  The problem: dinamic html. People wants to edit html pages, but also 
display dinamic data (from query, collections and so on). What to do?

  Actually: EasyTemplate, zpt templates. The first need support for our 
own need (eg: display a table with some data that cames from a query, 
display some content view, etc, and the user have to code by hand, using 
a particular syntax. The second can be uneasy for users and gives too 
"power" to them.

  The idea: Let we have the Document type. What is missing? Just a 
dropdown with "what we want there", that will be inserted in the html 
when shown.

  How: Extend the Document type with another schemata, called 
"variables", editable only by the Site Admin or Manager role. In this 
schema (maybe with z3c.form?) we can add a new "variable" (and one more 
and so on), give it a name, and write a python call. When the user in 
the Document edit, select a variable from the dropdown, a special marker 
is inserted in the html. Then, when the RichField is shown (view), a 
transform is called (as it already does to filter html) and the variable 
value is replaced with the python call. The python call can be a browser 
view or an object method with parameters, which returns a piece of html.

  Want to show a map in the html? Just drop down, choose map, and you're 
done. The "map" variable could take the coordinates from a Location 
field or from the context or whatever else (ask for parameters?). Or 
fail, log in the error_log, and show nothing. Want to show folder 
contents? Just drop down, choose "folder contents", and it is done. 
Which folder? The context one, maybe, or what the coder choose.

  What do you think of this approach?

  Pros: the use just insert "there" what it want, the site developer 
don't have to teach a language or a new approach to the user.
  Cons: another transformation is added, which is uncached. A dropdown 
has to be added to Kupu/TinyMCE/ckEditor. A central library of variables 
should be created to reuse them (it could be a panel similar to content 
rules, where instead of rules you choose variables available to the 
Document)
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to