Questions about architecture

Encolpe Degoute <[email protected]> Thu, 08 Jun 2006 11:43:07 +0200
Newsgroups gmane.comp.web.zope.plone.archetypes.devel
Message-ID <[email protected]>
Hi,
Yesterday I was reading generator/widget.py and some questions raised.

We have:
widget => macrowidget => TypesWidget => MostOfTheWidgets

1/
The widget class defines 'label' and 'description' properties and their access
methods.
It defines too 'visible' and 'condition' properties for which access methods are
defined in TypesWidget.
Why this difference ?

2/
The 'visible' property defined several states of visibility but 'condition'
property just give true or false.
If 'condition' return a visibility state we can overload the 'visible' property
instead of adding just one more switch to manage.
Then the 'invisible' state replace the false and others states replace a true value.
Can we rename 'condition' in 'visible_expr' ?

3/
The condition expression use folder, portal and template context.
It doesn't give us any clue on mode (view, edit or search ?) or on field/widget
parameter.
I propose to create a new expression context based on object, field and widget
instead of unsing CMFCore Expression.

4/
Come back on visibility. What's visibility for a widget ?
A widget rendering can be written in the output or not. => invisible state
With MasterSelectWidget we can see another need: putting a css class and a
javascript code to manage another visibility type.
Then 'visible' option can be divide in four properties:
- hidden_if: do we write then code
- widget_mode: view, edit, search, but not invisible or hidden
- css_class: hidden value or not
- javascript: use to switch css_class for this widget or another widget

You can see here an example of the point 4/:
http://svn.nuxeo.org/trac/pub/browser/CPS3/products/CPSSchemas/trunk/Widget.py

Regards,
-- 
Encolpe DEGOUTE
http://encolpe.degoute.free.fr/
Logiciels libres, hockey sur glace et autres activités cérébrales