MMBase Editwizard Documentation

Version 1.0 is released with MMBase 1.6.


Table of Contents

1. Introduction
2. Installation
2.1. Requirements and Assumptions
2.2. Assumptions
2.3. Are the editwizards up and running?
3. Getting Started
3.1. Step 1. Deciding what to do
3.2. Step 2. Create a basic wizard
3.3. Step 3. Get it working
4. Wizard Basics
4.1. Create action
4.2. Load action
4.3. Delete action
4.4. Field format types
4.5. Validation
5. Using lists
5.1. Create a new wizard
5.2. Test the wizard

The editwizards allow designers to easily create wizard-like web-entry forms for content entry and maintenance.

The wizards are not intended to edit all possible relations and fields of an object; they are more suitable for special content tasks, such as editing a news item or adding a user to the system and placing images and organizational information along with it. A wizard with more than 3 steps is generally over the top.

In this document you will learn how to install the editwizards on your MMBase release, and how to create your own wizards. First the basics are explained, and how the most simple wizards should be set up. Then, you'll see how more complex wizards can be created.

If you install and run an 1.6 or higher release of MMBase, the editwizards will be included.

To let the editwizards run properly, the /mmapps/editwizard directory must be in place (default installed). This directory contains the JSP pages, the wizards, images, XSL's and CSS stylesheets and client-side Javascript code - in shirt, all the fields needed to run the wizards.

For all practical purposes, you only need to remember the location of the fields wizard.jsp (which you call to edit a specific object or create a new one), and list.jsp (which you use to list objects which you can then select for edit).

You are free to move the /mmapps/editwizard directory somewhere else. If you do, you need to change the calls in the examples below so they point to the right directory.

In this section we will make a simple wizard to learn the basics about the wizards. Let's try to build up a simple wizard.

Check if your newly created wizard works.

Open your webbrowser and type in the url to the editwizards list.jsp page, as follows (replace with the correct domain name if your site does not run at localhost:4242) :

http://localhost:4242/mmapps/editwizard/list.jsp?wizard=practice/simple&nodepath=people&fields=firstname

The list.jsp page is one of two pages you can call to start the wizards. List.jsp reads the xml you provide as the 'wizard' parameter, and creates a list of items to pick from - either to edit or to delete. It may also provide a button with which you can add new people.

You should see a login screen first. Login as you would with the MMEditors or the MMBase admin. After you logged in, you're screen may look like this:


There is one person ('Rob') entered in the list example above (this may be different in your case). It has a delete button (the minus-sign) with which you can remove the person. Clicking on the name 'Rob' will allow you to edit the person name. The 'plus' sign in the bottom-right screen allows you to add new people.

Let's create a new person. Click on the plus-icon. If you filled in the editwizard correctly, you should see the following page:


Here you can see your first wizard in action! Two fields are visible (as defined in the simple.xml file). Fill in the two fields and press save. You are returned to the list, which should now contain your newly added person.

You can image you can change the fieldnames, titles and object-types in the wizard so that you can edit different objects in the system. But wizards can do a lot more. We'll get to that in the following section.

You can already make and run a simple wizard. In this section, we go deeper into the features of the wizards. We will take the simple wizard from the practice example in the former section, and expand this simple example with new elements.

A quite important feature of the editwizard are the "lists". With lists, you can show, edit, delete and create objects related to the object you are working on.

For this example you'll need the people and the news objects in MMBase.

In the practice directory, create a new file named people.xml. Enter the following xml:

			
<wizard-schema id="people">
	<title>People</title>

	<!-- Action to create a new people object -->
	<action type="create">
		<object type="people">
			<field name="firstname">Enter firstname HERE</field>
		</object>
	</action>

	<!-- Action to delete a people object -->
	<action type="delete" />

	<!-- Action to load a people object, including all posrel relations to news  -->
	<action type="load">
		<relation destinationtype="news" role="posrel" />
	</action>

	<form-schema id="step1">
		<title>People</title>
		<!-- Show people object -->
		<field name="firstname" >
			<prompt>Firstname</prompt>
		</field>
		<field name="lastname">
			<prompt>Lastname</prompt>
		</field>

		<!-- List all news items related with role posrel
				 This list can have a minimum of 0 and a maximum of infinite ("*") items.
				 This is also the default for a list
		-->
		<list role="posrel" destination="news" minoccurs="0" maxoccurs="*">
			<title>Related newsitems</title>
			<!-- Show the 'item' in a list (the object) -->
			<item>
				<field name="title" ftype="data">
					<prompt>Newsitem</prompt>
					<description>Here you can see the name of the related newsitem</description>
				</field>
			</item>

			<!-- defines a search command.
					 This creates a search box that allows you to search for objects
					 using a specified nodepath.
					 In this case, the searchs ercahes for news items, using the fields
					 'title' and 'subtitle' to show the results of the search in the list.
			-->
			<command name="search" nodepath="news" fields="title,subtitle" age="-1">
				<prompt>Search newsitems</prompt>
				<!-- Search filters determine what you can search on (in this case, on title
						 or both title and subtitle)
						 If you do not specify a search filter, the default is to search on the
						 'title' field.
				-->
				<!-- Search on title -->
				<search-filter>
					<name>subtitle contains</name>
					<search-fields>subtitle</search-fields>
				</search-filter>
				<!-- Search on title and subtitle
						 not the notation in the search-fields for more than one field
				-->
				<search-filter>
					<name>title or subtitle contains</name>
					<search-fields>title|subtitle</search-fields>
				</search-filter>
			</command>
			<!-- Action to create a relation, used by the search command to create
					 the relation once it is found and chosen.
			-->
			<action type="create">
				<relation destinationtype="news" role="related" />
			</action>
		</list>
	</form-schema>
</wizard-schema>
			

This is part of the MMBase documentation.

For questions and remarks about this documentation mail to: [email protected]