Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF

Formlib implementation for folder contents

 

 

Zope cmf RSS feed   Index | Next | Previous | View Threaded


charlie at begeistert

Jun 22, 2008, 11:29 AM

Post #1 of 4 (424 views)
Permalink
Formlib implementation for folder contents

Hi,

now that I've had a couple of months practice with browser views in
general and formlib in particular and also because I've got a
particular itch to scratch I've started on a formlib version of
folder_contents and I've now got a skeleton version of the form. Well,
I've got the form at least!

What I've done so far:

* a view based on EditForm (haven't quite mastered redirects in
PageForm) but not using setUpEditWidgets - I pass the field values in
as 'data'. Fields are distinguished from each other using the prefix
argument

field = form.FormField(f, n, item.id) # using an interface
self.form_fields += form.FormFields(field)

* turned the buttons into actions - probably the easiest part :-)

* generate fields (Boolean for the checkboxes)

* use a custom template to iterate through the folder items and call
the appropriate widgets. Although this works it's a bit clumsy. This
is the rather stripped-down HTML and I'm anticipating renaming on the
form.

<form class="form" action="." method="post" enctype="multipart/form-
data"
tal:attributes="action request/ACTUAL_URL">
<table>
<tr>
<th>Select</th>
<th>Name</th>
<th>Last Modified</th>
<th>Position</th>
</tr>
<tr tal:repeat="item context/contentValues">
<td tal:content="structure python: view.widgets['%s.select'
%item.id]()">Checkbox</td>
<td tal:content="structure python: view.widgets['%s.name'
%item.id]()"></td>
<td tal:content="item/ModificationDate"></td>
<td tal:content="repeat/item/number"></td>
</tr>
</table>
<div class="buttons">
<tal:loop tal:repeat="action view/actions"
tal:replace="structure action/render" />
</div>
</form>

While I can probably tidy this up to use a method in the view I'm not
convinced it's entirely the right way to do this. But it works!

I'll continue working - the actions themselves should be most
straightforward on this but would appreciate any comments.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


gmane at dylanjay

Jun 24, 2008, 7:10 PM

Post #2 of 4 (384 views)
Permalink
Re: Formlib implementation for folder contents [In reply to]

Have you thought about making contents a widget rather than a form? Then
it would be easy combine with other forms on folderish items.

Charlie Clark wrote:
> Hi,
>
> now that I've had a couple of months practice with browser views in
> general and formlib in particular and also because I've got a particular
> itch to scratch I've started on a formlib version of folder_contents and
> I've now got a skeleton version of the form. Well, I've got the form at
> least!
>
> What I've done so far:
>
> * a view based on EditForm (haven't quite mastered redirects in
> PageForm) but not using setUpEditWidgets - I pass the field values in as
> 'data'. Fields are distinguished from each other using the prefix argument
>
> field = form.FormField(f, n, item.id) # using an interface
> self.form_fields += form.FormFields(field)
>
> * turned the buttons into actions - probably the easiest part :-)
>
> * generate fields (Boolean for the checkboxes)
>
> * use a custom template to iterate through the folder items and call the
> appropriate widgets. Although this works it's a bit clumsy. This is the
> rather stripped-down HTML and I'm anticipating renaming on the form.
>
> <form class="form" action="." method="post" enctype="multipart/form-data"
> tal:attributes="action request/ACTUAL_URL">
> <table>
> <tr>
> <th>Select</th>
> <th>Name</th>
> <th>Last Modified</th>
> <th>Position</th>
> </tr>
> <tr tal:repeat="item context/contentValues">
> <td tal:content="structure python: view.widgets['%s.select'
> %item.id]()">Checkbox</td>
> <td tal:content="structure python: view.widgets['%s.name'
> %item.id]()"></td>
> <td tal:content="item/ModificationDate"></td>
> <td tal:content="repeat/item/number"></td>
> </tr>
> </table>
> <div class="buttons">
> <tal:loop tal:repeat="action view/actions"
> tal:replace="structure action/render" />
> </div>
> </form>
>
> While I can probably tidy this up to use a method in the view I'm not
> convinced it's entirely the right way to do this. But it works!
>
> I'll continue working - the actions themselves should be most
> straightforward on this but would appreciate any comments.
>
> Charlie
> --
> Charlie Clark
> Helmholtzstr. 20
> Düsseldorf
> D- 40215
> Tel: +49-211-938-5360
> GSM: +49-178-782-6226
>
>
>
> _______________________________________________
> Zope-CMF maillist - Zope-CMF[at]lists.zope.org
> http://mail.zope.org/mailman/listinfo/zope-cmf
>
> See http://collector.zope.org/CMF for bug reports and feature requests
>



_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


charlie at begeistert

Jun 25, 2008, 1:05 AM

Post #3 of 4 (385 views)
Permalink
Re: Re: Formlib implementation for folder contents [In reply to]

Am 25.06.2008 um 04:10 schrieb Dylan Jay:

> Have you thought about making contents a widget rather than a form?
> Then it would be easy combine with other forms on folderish items.


No, I hadn't. But I will now.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


charlie at begeistert

Jun 30, 2008, 4:11 AM

Post #4 of 4 (361 views)
Permalink
Re: Re: Formlib implementation for folder contents [In reply to]

Am 25.06.2008 um 10:05 schrieb Charlie Clark:

>
> Am 25.06.2008 um 04:10 schrieb Dylan Jay:
>
>> Have you thought about making contents a widget rather than a form?
>> Then it would be easy combine with other forms on folderish items.
>
>
> No, I hadn't. But I will now.


Okay, I did some thinking about this and while it will probably work
for the folder_contents view doesn't this mean there can only be one
field in the widget? This would be fine for a 1:1 implementation of
the current view but I thought it would be nice to be able to edit
subobjects id's in situ, ie. checkbox plus textfield which I think is
a little more complex.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests

Zope cmf RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.