Hi,

 

Our cms application makes heavily use of the mmbase editwizards. I've made some extensions to be able to do a little bit more with the wizards which might also be useful to some of you.

 

I’ve included two _javascript_ files and a wizard.xsl that extends the original one. A new dtd is also included.

 

Note that for all of these extensions to work the dtd in the configuration files have to be commented out:

<!-- <!DOCTYPE form-schema PUBLIC "-//MMBase/DTD editwizard 1.0//EN" "http://www.mmbase.org/dtd/wizard-schema_1_0.dtd"> -->
 

 

The extensions are:

 

1. Two extra field types; radio buttons and checkbox

 

The checkbox expects and returns values of 0 and 1. As an example of how this would look like in a configuration file:

<field name="toontitel" ftype="checkbox" dtrequired="false"><prompt>Titel tonen?</prompt></field>

 

The radio button works similar as the enum type:

<field name="popup" ftype="radio">

  <prompt>Openen in</prompt>

  <optionlist select="vensterkeuze"></optionlist>

/field>

 

 

2. Field/list dependencies

 

Often fields and or lists are depended of the input of other fields. For example if you have a checkbox that specifies if an email should be sent, another field with the email address should become required.

 

In the configuration files this would look something like this:

<field name="boolean1" ftype="checkbox" dtrequired="false" dtdepends="email"><prompt>Email?</prompt></field>

     

<field name="email_adres" ftype="line" dtunless="email" dtaction="require" dthasvalues="{1}">

   <prompt>Email adres</prompt>

</field>

 

So the first field has a dependency id called email (dtdpends=”email”). The second field is depended on this field if it contains the value 1 (dthasvalues=”{1}”) and will than become required (dtaction=”require”). The action “hide” is also possible which makes the field invisible (and not required). More values can be added like this: dthasvalues=”{value1}{value2}{value3}”.

 

A list can also be depended on another field in the same way, but fields and/or lists cannot (yet) be depended on other lists.

 

 

3. Dynamic wizardnames in lists

 

In a list you can only specify one type of editwizard which should be used to edit a node. In certain situations it can be handy to be able to use more than 1 type of editwizards. With the extension this requires a virtual field and a node builder that contains some logic about what type of wizard to use.

 

In the configuration files this virtual field has to be identified with wizard=’true’. With dymanic=”true” the wizardname can than be left out and the content of the virtual field is used as the name of the wizard:

 

   <item>

      <title>Links, Attachments</title>

 

      <field name="naam" ftype="data">

         <prompt>Naam</prompt>

      </field>                              

      <field name="editwizard" ftype="data" wizard="true">

         <prompt>Wizard</prompt>

      </field>               

 

      <field ftype="startwizard" dynamic="true" inline="true" wizardname="" />

   </item>

 

 

Robin van Meteren

Kennisnet


-----------------------Disclaimer-------------------------
Dit bericht (met bijlagen) is met grote zorgvuldigheid samengesteld. Voor mogelijke onjuistheid en/of onvolledigheid van de hierin verstrekte informatie kan Kennisnet geen aansprakelijkheid aanvaarden, evenmin kunnen aan de inhoud van dit bericht (met bijlagen) rechten worden ontleend. De inhoud van dit bericht (met bijlagen) kan vertrouwelijke informatie bevatten en is uitsluitend bestemd voor de geadresseerde van dit bericht. Indien u niet de beoogde ontvanger van dit bericht bent, verzoekt Kennisnet u dit bericht te verwijderen, eventuele bijlagen niet te openen en wijst Kennisnet u op de onrechtmatigheid van het gebruiken, kopiëren of verspreiden van de inhoud van dit bericht (met bijlagen).

This message (with attachments) is given in good faith. Kennisnet cannot assume any responsibility for the accuracy or reliability of the information contained in this message (with attachments), nor shall the information be construed as constituting any obligation on the part of Kennisnet. The information contained in this message (with attachments) may be confidential or privileged and is only intended for the use of the named addressee. If you are not the intended recipient, you are requested by Kennisnet to delete this message (with attachments) without opening it and you are notified by Kennisnet that any disclosure, copying or distribution of the information contained in this message (with attachments) is strictly prohibited and unlawful.
----------------------------------------------------------

Attachment: wizard-schema_1_1.dtd
Description: wizard-schema_1_1.dtd

Attachment: actions.js
Description: actions.js

Attachment: override.js
Description: override.js

Attachment: wizard.xsl
Description: wizard.xsl

Reply via email to