[Zope] Populating selection-style property with list of folders

Jonathan Hobbs toolkit at magma.ca
Wed Jul 7 21:48:19 EDT 2004


From: "Gary Duke Speer" <zope at cortech.org>
> What dtml method produces a list of folders that is compatible with the
> 'selection' property type?
>
> My goal is to add a proprty to the ZMI property sheet for a folder that is
> a drop-down listing of available subfolders.
>
> I have no problem creating a property called ThemeFolder of type
> 'selection' that points to another property called FolderList of type
> 'lines' that has the names of the folders.
>
> The documentation says the selection can come from either a property or a
> method.
>
> When the selection property it is pointed to a DTML Method called
> DTMLFolderList with the code:
> _dtml-in "objectValues(['Folder'])"_ _dtml-var id_
> _/dtml-in_
>
> It reports an error.
> I have tried _dtml-var objectItems_ and several other variations with
> similar results.
> What dtml method produces a list that is compatible with the 'selection'
> property type?

I am not quite sure what you are trying to accomplish...

(1) create a form with a drop-down list of folders that are contained within
the current folder:

<form>
<select name="xxx">
<dtml-in "objectValues('Folder')">
  <option value="<dtml-var id>"> <dtml-var id>
</dtml-in>
</select>
</form>

(2) create a property field on the current folder which contains a list of
the subfolders contained within the folder

<dtml-call "REQUEST.set('flist', [])">
<dtml-in "objectValues('Folder')">
  <dtml-call "flist.append(id)">
</dtml-in>
<dtml-call "manage_addProperty('ThemeFolder', flist, 'lines')">

(3) display a drop-down list which contains the contents of a property field
of a folder (the property field has previously been created and contains a
list of the subfolders - see item 2 above)

<form>
<select name="xxx">
<dtml-in "getProperty('ThemeFolder')">
  <option value="<dtml-var sequence-item>"> <dtml-var sequence-item>
</dtml-in>
</select>
</form>

(4) something else?


Jonathan




More information about the Zope mailing list