Re: Formulator with lookup windows
Marc Petitmermet <[email protected]>
| Newsgroups | gmane.comp.web.zope.silva.devel |
|---|---|
| Message-ID | <[email protected]> |
[snip] > Maybe someone has already faced similar problems, and knows a nice > workaround? > +1 on an enhancing the asset lookup window to allow custom > callbacks. I would > find this very useful too ;-) i agree. in the meantime i have solved this by automatically populating a list field of a code source with the appropriate data. e.g. i have a list field with size 1 and in the tales of items i have python:form.get_forms() get_forms() is a python script in the content of the code source with the content container = context.aq_parent return [(item.getId(),item.getId()) for item in container.objectValues(['Formulator Form'])] this returns a list field where the user can choose form all formulator forms stored within the code source. another example is python:form.get_folders() and tree = context.get_container_tree() return [(item[1].absolute_url(),item[1].getId()) for item in tree] this returns a list of all folders in the context of the silva document where the source code has been placed. now, what keeps you from collecting all assests (get_assets()) and filter out your desired assets according to their mime type (get_mime_type()). but keep in mind that images have no mime type, you need to take care of them. granted this is not as nice as a lookup window but it is more convenient for the user anyway ;-) regards, marc