Op 23 jan 2008, om 11:39 heeft Ted Vinke het volgende geschreven:
What I'd like is to prepopulate a certain field of a node with a
dynamic value.
e.g. I've added an 'author' field to the attachment builder and I'd
like to have the current user's username prepopulated in the
'author' field when starting the editwizard for a new attachment.
The user can then decide to clear this field and/or modify the field
with another value.
I've looked at get-, set- and commitprocessors, but it seems that
the getprocessor I've written only is fired on an existing
attachment. I somehow can't get it to work to return the current
username with a new attachment.
I am not sure if I would use my own processor for this, since there is
already some functionality in datatypes that has the same effect:
<field name="editor" readonly="true">
<descriptions>
<description xml:lang="nl">Automatisch gevuld veld met auteur</
description>
</descriptions>
<gui>
<guiname xml:lang="nl">Auteur</guiname>
</gui>
<datatype base="lastmodifier" xmlns="http://www.mmbase.org/xmlns/datatypes
" >
<maxLength value="32" enforce="never" />
</datatype>
</field>
I've also looked putting this logic in the editwizard, but seems to
me only _hardcoded_ values can be prepopulated in a field, instead
of a variabele cloud.user.identifier or something. I also can't pass
the username as a variabele since the attachment wizard is only
called from within other wizards.
I believe it is possible to pas a variable to all wizards, also to the
ones called by others. A wizard url could contain a variable, for
example 'pool':
http://localhost/mmbase/edit/wizard/jsp/wizard.jsp?objectnumber=1735628&wizard=page%2Fpage%2Fpage&pool=173567
You can then reference it like this:
<command name="search" nodepath="pools,article" startnodes="{$pool}"
fields="article.title,article.body" orderby="article.title" age="-1">
<prompt>Zoek naar artikelen</prompt>
<search-filter>
<name>Titel</name>
<search-fields>title</search-fields>
</search-filter>
<search-filter>
<name>Tekst</name>
<search-fields>body</search-fields>
</search-filter>
</command>
<command name="startwizard" inline="true" wizardname="all/article/
article" objectnumber="new" />
In article.xml you would write:
<action type="create">
<object type="article">
<relation destination="{$pool}" role="related" />
</object>
</action>
To relate it automatically to the pool.
I'm using 1.8.4. Has someone developed a solution for this issue:
either by get/setprocessors or editwizards themselves or something
else?
I hope I understood your question correctly.
---André
Regards,
Ted
_______________________________________________
Developers mailing list
Developers@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/developers
--
André van Toly
MMBase development & Userfriendly webdesign
W: http://www.toly.nl
M: +31(0)627233562
------------------------------------------------------------------
~~<<>>~~
_______________________________________________
Developers mailing list
Developers@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/developers