Generated forms (was: [Zope] Mixing of ZPT and DTML)

Carsten Gehling carsten@gehling.dk
Thu, 31 Jul 2003 10:09:38 +0200


Ahh nice. :-)

This reminds me of another thing, that I wanted to ask the Zope community:

Do you always create your management forms "by hand"? eg. like this:

<form action="manage_editThingy">
    <input name="title" />
    <input type="submit" value="Change" />
</form>

When working in PHP I made a class hierarchy for generating web user
interfaces programatically, thus saving a lot of work when trying to make
all my interfaces look alike.

Basically this went along the lines of (mind you - it's PHP):
--------------------------------------------------------------------
// Create html page for edit window
$dlg = new UI_TabDialog("Edit article");
$dlg->form_action = "article_update.php?action=new";

// Create 1st tabbed page
$page = new UI_TabPage("Main text");

// Create layout manager for page
$layout = new UI_Layout_row(array(
	array(100)
));

$c = new UI_Control_textarea("body", "Article body", "", "100%");
$layout->add_control($c);

$page->add_control($layout);

$dlg->add_page($page);

// Create 2nd tabbed page
$page = new UI_TabPage("Article properties");
$layout = new UI_Layout_row(array(
	array(100),
	array(100),
	array(100),
	array(50, 50),
	array(100)
));

$c = new UI_Control_input("header", "Article header", "");
$layout->add_control($c);

$c = new UI_Control_date("releasedate", "Releasedate", date("Y-m-d"));
$layout->add_control($c);

$c = new UI_Control_date("expiredate", "Expiredate", date("Y-m-d"));
$layout->add_control($c);

$c = new UI_Control_image("image_id", "Image for the article", "");
$c->url_template = "image_%d.jpg";
$layout->add_control($c);

$page->add_control($layout);

$dlg->add_page($page);

// Generate the html page
$dlg->draw();
----------------------------------------------------------------

Has anybody done anything remotely like this in Zope? And if no: Would there
be any interest  in such a module?

The good thing about this class library is the ability to change the outlook
of all your user interface pages just one place. At the same time, the
layout managers give you some control over the... well - layout of all form
elements. :-)

- Carsten

> -----Oprindelig meddelelse-----
> Fra: zope-admin@zope.org [mailto:zope-admin@zope.org]Pa vegne af Jamie
> Heilman
> Sendt: 30. juli 2003 23:48
> Til: Zope@Zope.Org
> Emne: Re: [Zope] Mixing of ZPT and DTML
>
>
> > What do people generally do when using ZPT? Do you create separate
> > editforms/display files for both ZPT (for use in you own
> application) and
> > DTML (for use in ZMI)? Or have I missed some vital point?
>
> page templates work fine in the zmi[1]
> http://www.zope.org/Members/Zen/howto/ZPT_management