MMBase Editwizard Reference Manual

Version 1.0 is released with MMBase 1.6.


Table of Contents

1. Introduction
2. Calling the Wizard Pages
2.1. General - wizard definition schemas
2.2. list.jsp
2.3. wizard.jsp
2.4. debug.jsp
3. Basic Concepts
3.1. Object structures (Dove)
3.2. XPath Expressions and Wizard variables
3.3. Including xml fragments
3.4. Extending using xml fragments
4. Syntax Reference
4.1. action type="unlink"
5. Syntax reference

This reference describes the syntax of the wizards and how to access them using a browser.

This reference describes the wizard pages and how to call them from a html or jsp page.

The editwizards need a xml file with a definition of the wizard to operate. By default, those are found in the subdirectory /editwizard/data/, but it is possible to place your definitions, as well as the wizard stylesheets (which define layout) elsewhere.

When the wizards search for a requested file (a wizard xsl stylesheet or a wizard xml schema), they look for the referenced file in the following order:

To run a wizard, you'll need to call either list.jsp or wizard.jsp. These scripts are located in the jsp subdirectory of the editwizard home directory. In the standard distribution, this is mmapps/editwizard/jsp/.

List.jsp starts with running a search query on MMBase to create a list of items to search from. It shows a list of all found nodes and allows you to select one of these items to edit, to remove an item, or to add a new item. The actual options given depend on the security settings (if you are allowed to do this by MMBase), and the possibilities offered by the wizard. Note that the list.jsp does NOT run an editwizard itself, it is just a 'starter'. It eventually calls wizard.jsp (see below) to actually edit or create an item.

You need to specify a number of parameters to tell the list.jsp what wizard should be used, and what nodes and fields should be shown in the list.

In addition, by specifying the searchfields parameter, you can let the wizards generate a searchbox, allowing you to narrow the list of nodes to edit.

The following parameters MAY be specified:

fields

The fields to show in the list. If you query only one nodetype (see nodepath), you can use simple field names. Otherwise, you need to preface the fieldnames with the name of the objecttype they belong to. If the first field listed is a number field, the objecttype of that field is used as the objecttype to edit in the wizard (instead of the last object type in the nodepath list). This parameter is similar to the fields attribute of the taglib's <mm:list> tag.

fields=news.title,people.firstname,people.lastname
templates

The directory where xsl templates and editwizard task xml's can be found. Use this to specify an alternate directory for xsl templates and wizard xml's. The other directories (current directory, default directory) remain working too, but this 'templates' is added between them in the resolve path.

templates=data/my_xsl
main

The name of the main node type in a node path. The main node type designates the element in a list that you want to edit. By default, the wizard takes the last name in a node path as the main node type.

For instance, in the node path 'mags,news,publishtimes', the main node type recognized automatically will be 'publishtimes' - but it is more likely that we desire to edit the news element in this list. In this case, you can point out to the wizard to use the 'news' element of the list instead.

main=news
sessionkey

A key that identifies the 'session' of this wizard. Normally, you cannot run two separate editwizards concurrently from the same browser. If you want to allow this for your users for some reason, you can provide a 'sessionkey' to identify separate sessions: a wizard with one sessionkey runs independent from those who use a different one. The default session key is 'editwizard'. Note that allowing more wizards to be opened from one browser consumes more resources and is therefor not recommended.

sessionkey=my_key
context

The security context to assign to new objects and relations created by the editwizard. By default, objects are created using a default context defined by the security system (often depending on the logged on user). By explicitly specifying this default context. Not that specifying a context different from the default may result in objects that, once created, cannot be changed by the user due to security restrictions. A user needs to be able to change the context on objects he creates, or the parameter cause security errors.

context=default
maxsize

The maximum size of a file to upload. The default maximum size for files is 4MB.

maxsize=8000000
orderby

A list of fieldnames used to order the returning list. This parameter is similar to the orderby attribute of the taglib's <mm:list> tag.

orderby=people.lastname,news.title
directions

A list of one or more UP/DOWN keywords. Each keyword determines whether the order of a matching field specified in the orderby parameter is ascending (UP) or descending (DOWN). This parameter is similar to the directions attribute of the taglib's <mm:list> tag.

directions=UP
searchdirs

The direction in which relations between nodemanagers should be followed. This parameter is similar to the searchdirs attribute of the taglib's <mm:listcontainer> tag. It can be a list, in which case the first is for use between the first and second nodemanager, the second is for use between second and third nodemanager. If there are more steps in the nodemanager path then searchdirs, then the searchdir will default to the previous searchdir in the 'searchdirs' list.

searchdirs=source,destination
constraints

A SQL-like constraint, used to filter the list. If you use fieldnames in a constraint, surround it with brackets ([]). This allows MMBase to recognize the fields and optimize the query. This parameter is similar to the constraints attribute of the taglib's <mm:list> tag.

constraints=[news.title] like '%Brasil%'
distinct

If true, double entries in a list are returned only once.

distinct=true
language

The preferred language for display. The language is specified by the ISO standardized 2-letter lowercase languagecode. The effects are dependent on whether alterenate langauge elemenst are availabel for the specified language. If not, the default language settings are used instead.

language=nl
pagelength

The maximum number of entries shown on one list page. Default value is 50.

pagelength=50
maxpagecount

The maximum number of pages available to browse through. Default value is 10.

maxpagecount=10
start

The number of the item in the list where to start listing. This value is used to skip to a certain page when browsing a large list. Default is 0.

start=0
age

The maximum age (in days) of the objects to list. Default is no age restriction.

age=31
searchfields

The field(s) on which to make a search, using the value specified in the search parameter and the type of comparison specified in the search type.

You can specify more than one field (separated by commas). if you do, a search matches if one or more of the specified fields matches.

searchfields=news.title,news.subtitle
realsearchfield

The actual field on which to search. Normally, searches are done on the fields mentioned in the searchfields parameter (used to create the search box in a list page). Sometimes, you want to search on a field other than those listed in searchfield (such as 'number' or 'owner'). In that case, use this parameter to specify the field.

realsearchfield=news.title,news.subtitle
searchvalue

The term or value to search for. This is only valid if you also specify the searchfields parameter.

searchvalue=Brasil
searchtype

Determines what type of search is used to filter on the searchfields, using the specified search value. This is only valid if you also specify the searchfields parameter.

Allowed values are 'string', 'like', 'equalto', 'greaterthan', 'lessthan', 'notgreaterthan', and 'notlessthan'. use 'string' to compare the search value to the field using an exact match. Use 'like' to make a pattern search using the specified searchvalue. Use the other values to compare the field to numeric values or dates. I.e. using 'greaterthan' selects all fields whose (numeric) value is greater than the specified (numeric) value.

searchtype=like
search

The search parameter specified when the list should show a search box, and whether searching is mandatory. There are four possible values:

no turns searching off. If other parameters such as searchfields and searchvalue are given, the search is performed using those parameters but a searchbox is not displayed.

yes turns searching on, displaying a searchbox on top of the list, using defaults for parameters such as searchfields, if these are not specified.

force is like YES, but searching (and showing a resultlist) is not performed until a searchvalue is specified. If no searchvalue is given, only the searchbox is displayed - no results are shown.

auto makes searching dependent on the presence of the searchfields parameter. If the searchfields parameter is given, a searchbox is shown. Otherwise, it is not. AUTO is the default value

search=yes
origin

A node alias or number, which will be passed to the underlying editwizard. the value can then be referenced in the editwizard schema using the {$origin} variable. This can be used to create relations to nodes whose 'origin' is determined outside the wizard (i.e. in a complex search or determined through user preferences).

origin=my_start_node
title

An optional title to use by the list. In general, you should specify this in the editwizard schema.

title=News of The Week
proceed

System parameter, see the description at the wizard.jsp reference page for more info

replace

System parameter, see the description at the wizard.jsp reference page for more info

remove

System parameter, see the description at the wizard.jsp reference page for more info

relationOriginNode

If this option is given, then you can besides searching in the given list, also search in the complete cloud. This can be useful if the presented list has an orgin. In this way you can add new entries to this list, without needing a wizard.

relationOriginNode=<origin>[&relationRole=<role>][&relationCreateDir=<dir>]

Where <origin> it the nodenumber to which a relation must be created, <role> is the role of that relation.

(See also: the <action type="unlink" />


You can use wizard.jsp to directly start a wizard. Like list.jsp, you will need to supply the correct parameters in order to let the wizard run correctly. If you call the wizard.jsp page, a wizard will be loaded and started. The proper html will be rendered and shown in the browser. The syntax of wizard.jsp to create a new object looks like this:

wizard.jsp?wizard=practice/simple&objectnumber=new

To create a wizard and use an existing mmbase object as source:

wizard.jsp?wizard=practice/simple&objectnumber=[objectnumber]

The following parameters MAY be specified:

templates

A directory where xsl templates and wizard xml could be found. See also the description of the same parameter for list.jsp

templates=data/my_xsl
sessionkey

A key that identifies the 'session' of this wizard. Normally, you cannot run two separate editwizards concurrently from the same browser. If you want to allow this for your users for some reason, you can provide a 'sessionkey' to identify separate sessions: a wizard with one sessionkey runs independent from those who use a different one. The default session key is 'editwizard'. Note that allowing more wizards to be opened from one browser consumes more resources and is therefor not recommended.

sessionkey=my_key
context

The security context to assign to new objects and relations created by the editwizard. By default, objects are created using a default context defined by the security system (often depending on the logged on user). By explicitly specifying this default context. Not that specifying a context different from the default may result in objects that, once created, cannot be changed by the user due to security restrictions. A user needs to be able to change the context on objects he creates, or the parameter cause security errors.

context=default
language

The preferred language for display. The language is specified by the ISO standardized 2-letter lowercase languagecode. The effects are dependent on whether alterenate langauge elemenst are availabel for the specified language. If not, the default language settings are used instead.

language=nl
debug

If debug=true, the wizard will place additional information in the wizard page that allows for debugging of the application. This includes a link to a debug page that allows you to view the loaded object data and the wizard schema. This link specifies parameters such as sessionkey and popupid as required.

debug=true
maxsize

The maximum size of a file to upload. The default maximum size for files is 4MB.

maxsize=8000000
origin

A node alias or number. This value can be referenced in the editwizard schema using the {$origin} variable. This can be used to create relations to nodes whose 'origin' is determined outside the wizard (i.e. in a complex search or determined through user preferences).

origin=my_start_node
popupid

This parameter is passed by the system, you never pass it yourself. It is used to identify a 'popup' wizard. A popup wizard is a sub-wizard for the main wizard that, unlike an 'inline' sub-wizard, opens in a separate browser window. Because of this, it needs to separately maintain its status (identified by the popupid). Once the task of a popup wizard ends, it's window is closed, and the parent wizard is refreshed.

popupid=my_id
proceed

This is a parameter passed by the system. It is used to indicate that the current wizard is still being processed, and therefor its data (stored in the user's session) should be kept an re-used by this call. Omitting this parameter (or passing it with the value false) causes all processed data to be removed, and replaced by a new wizard.

popupid=my_id
replace

System parameter

remove

System parameter


TODO

field (general)

Syntax

<field />

Usage

Field nodes define what form-elements will be placed in the wizard. This fieldnodes in the xml are an important part of the wizard's definition. For detailed information on what fieldtypes need what kind of settings, see the other fielddefinitions in the reference. Note: the field nodes that can be placed inside a relation or object node have different syntax! (See also: <object type="create" />)

Needed attributes

name="[fieldname]" fdatapath, ftype, dttype, dtrequired, dtminlength, dtmaxlength are automatically retrieved from mmbase. Overriding is always possible, however.

or (advanced users:) fdatapath="[xpath]" and ftype="[fieldtype]"

Possible attributes

ftype="[fieldtype]" (line|text|enum|date|int)

dttype="[datatype]" (string|int|date|datetime|time|html)

dtminlength="[minlength]"

dtmaxlength="[maxlength]"

dtrequired="[true|false]"

rows="[rowcount]"

Needed childnodes

None

Possible childnodes

<prompt /> For every field, a prompt-text can be given. If defined, the prompt text will be visible in front of the field in the wizard.

<description /> For every field, a description can be given. If defined, the description will be shown "onmouseover". If the user move the mouse over the field, the description will be shown in a hint.

Possible parents

<form-schema />

<item />

Example
<form-schema id="step1">
  <title>Example form</title>
  <field name="title" dtminlength="1" ftype="line">
    <prompt>News Title</prompt>
    <description>You can enter the news-title here</description>
  </field>
</form-schema>
            

optionlist

Syntax

<optionlist />

Usage

Use this node to define an optionlist. It can be either a static list of options, or a list filled using an MMBase query.

Needed attributes

None

Possible attributes

name="[optionlistname]" This optional attribute can be used if an optionlist is defined in a <lists /> node. To reference to the defined optionlist, you will need the optionlistname. Eg.: <optionlist select="earlier_defined_optionlist" />

optionid="field[@name='fieldname']" This optional attribute can be used if an underlying 'query' node is present. Of all matching nodes, the field with name given in 'optionid' will be used as the 'id' part of the option.

optioncontent="field[@name='fieldname']" This optional attribute can be used if an underlying 'query' node is present. Of all matching nodes, the field with name given in 'optioncontent' will be used as the content part of the option.

Needed childnodes

<option id="[optionid]">[optionvalue_to_be_shown_in_wizard]</option>

Possible childnodes

<query> This childnode can be used instead of <option> childnodes to fill the optionlist with options. The query has three attributes: optional 'where' and 'orderby' clauses and a required 'xpath' clause. The xpath can have the following syntax:

Possible parents

<wizard-schema />

<field ftype="enum" />

Example
<optionlist name="role"
            optionid="field[@name='role.role']"
            optioncontent="field[@name='role.name']">
    <query xpath="/*@companies,roles" where="company.number = {$origin}">
        <object>
            <field name="role.role" />
            <field name="role.name" />
        </object>
    </query>
</optionlist>

command (name="search")

Syntax

<command name="search" />

Usage

Use this command inside a list node to define how a user can search for objects and add them to a list.

Attributes (general)

See for detailed information how to use nodepath, startnodes, fields, constraints, orderby the documentation of the MMBase taglib.

Needed attributes

name="search"

nodepath="[buildername_to_start_with]"

fields="[fieldnames of fields to show]"

Possible attributes

startnodes="[objectnumber]"

age="[default age to show in search-field]" use -1 to set it to "any age", use 1,7,31,365 for day, week, month, year ages.

constraints="[mmbase where part]"

Needed childnodes

None

Possible childnodes

<prompt /> Place the text to be shown in front of the searchfield here.

<search-filter /> Defines what extra searchfields should be shown and used in the query. See also: search-filter.

Possible parents

<list />

Example
<list destination="people" minoccurs="0" maxoccurs="*">
  <command name="search" nodepath="people" fields="firstname,lastname" orderby="lastname" age="-1">
    <prompt>#Search command prompt</prompt>
    <search-filter>
      <name>firstname contains</name>
      <search-fields>firstname</search-fields>
    </search-filter>
    <search-filter>
      <name>lastname contains</name>
      <search-fields>lastname</search-fields>
    </search-filter>
  </command>
  <item>
    <field name="firstname" >
      <prompt>Field prompt</prompt>
      <description>Field Description</description>
    </field>
  </item>
  <action type="create">
    <relation destinationtype="people" role="related" />
  </action>
</list>
            

This is part of the MMBase documentation.

For questions and remarks about this documentation mail to: documentation@mmbase.org