[Zope-dev] [Mini-HowTo]: Multiple Selects in ZClass Edit Forms

2001-03-31 Thread Michael R. Bernstein

Problem:
---

You want your ZClass instance edit form to correctly display
the currently selected values for a multiple selection
property.

Assumptions:
---
You have a ZClass that has a multiple select property named
'format' with a value set to 'format_list'.

You have a 'format_list' lines property set where the ZClass
*instances* can acquire it.

You generated an 'Edit' type 'Property Sheet Interface' that
contains the following code:

  trth align=left valign=topformat/th
  td align=left valign=top/td
  /tr

Solution:

Replace the above code with the following:

  trth align=left valign=topformat/th
  td align=left valign=top
select name="format:list" multiple size="4"
  dtml-in format_list
  option
  dtml-if "_['sequence-item'] in _['format']"
  SELECTED/dtml-if 
  dtml-var sequence-item/option
  /dtml-in
/select
  /td
  /tr

This will correctly display the currently selected values
for your ZClass instance in the edit form, and capture the
changed values when the form is submitted, casting even
single selections to a list.

Note: If the 'format_list' lines property is set where the
Zclass instances can acquire it, but not where the ZClass
definition can acquire it, then the Property Sheet
management screen will *not* display the values. If you want
to provide a default set of values that the ZClass
definition can acquire as well as the ZClass instances (of
course you can also override this locally), set the
format_list property on the root folder.

HTH,

Michael Bernstein.

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] ANN: mxDateTime 0.1

2001-03-31 Thread Juan David Ibáñez Palomar


Hi all,

Download mxDateTime 0.1 from 

  http://sourceforge.net/projects/lleu


README.txt
--

Introduction

  This product makes easier to use the mxDateTime python module
  from Zope. It allows to use it from Python Products and external
  methods using for example::

from Products.mxDateTime import DateTime

  It's also accessible from restricted code (DTML methods, Scripts,
  etc..) using the '_' variable, for example::

dtml-var "_.mxDateTime.today()"


How it works (read this if youd don't use a Unix like OS!!)

  When the product is initialized for the first time a symlink is
  created to the DateTime directory. If symlinks are not available
  (for example in Windows) you have to copy the whole DateTime
  directory instead.

  To make the module accessible from restricted code it has been
  needed to wrap it so it plays nice with the Zope security machinery.





Best regards,
jdavid

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )