org.ceryle.wiki.plugin.form
Class MetaFormPlugin

java.lang.Object
  extended by com.ecyrd.jspwiki.forms.FormElement
      extended by org.ceryle.wiki.plugin.form.MetaFormPlugin
All Implemented Interfaces:
WikiPlugin, PluginConstants
Direct Known Subclasses:
MetaForm

public class MetaFormPlugin
extends FormElement
implements WikiPlugin, PluginConstants

MetaFormPlugin extends FormElement in the same manner as FormPlugin, except that it reads from and writes to the metadata of a wiki page backed by an XNodeProvider (from an XNodeStore).

Parameters

Page Locks

Currently, the plugin will actually fail to create edit session if unable to obtain a page lock. This may be extreme, given that normally the wiki permits over-edits, but given this is a form interface it is more likely to lose content in the event of a failure. Maybe not? This is something to check out in practice...

Potential Security Issues

This permits modification of internal XNodeStore database metadata from an external, web-based form. While no security implications are immediately obvious, modification of the internal database by an external party may have unknown results.

Author:
Murray Altheim

Field Summary
protected static org.apache.log4j.Logger log
           
protected  boolean m_checkAboutPage
           
protected  boolean m_checkPermissions
           
protected  WikiEngine m_engine
           
protected  String m_pluginName
          This is the common plugin invocation name, and should match a wiki page name for documentation.
static int MAX_FIELD_LENGTH
          The maximum field content length before the form will use a textarea rather than an input field.
static int MODE_CANCEL
          Constant indicating Cancel button activated mode.
static int MODE_EDIT
          Constant indicating Edit mode.
static int MODE_INIT
          Constant indicating initial mode.
static int MODE_SAVE
          Constant indicating Save button activated mode.
static int MODE_SELECT
          Constant indicating Select button activated mode.
static int MODE_VIEW
          Constant indicating form view mode.
static String PARAM_CID
          The cid parameter name.
static String PARAM_NID
          The nid parameter name.
static String PARAM_VERBOSE
          The verbose parameter name.
static String PARAM_XID
          The xid parameter name.
static boolean TEXT_WRAP_PRE
          When true, text documents are wrapped with a <pre> element.
protected static String unknownUser
           
 
Fields inherited from class com.ecyrd.jspwiki.forms.FormElement
FORM_VALUES_CARRIER, HANDLERPARAM_PREFIX, HIDE_SUCCESS, PARAM_ELEMENT, PARAM_FORM, PARAM_FORMNAMEHIDDEN, PARAM_HANDLER, PARAM_HIDEFORM, PARAM_INPUTNAME, PARAM_POPULATE, PARAM_SUBMITHANDLER, PARAM_VALUE
 
Fields inherited from interface com.ecyrd.jspwiki.plugin.WikiPlugin
CORE_PLUGINS_RESOURCEBUNDLE
 
Fields inherited from interface org.ceryle.wiki.plugin.util.PluginConstants
ACL, AOP, APOS_ENT, ASTERISK, BCL, BOP, BR, CAPCL, CAPOP, CLATT, COLON, COMMA, DIV_class, DIV_style, DIVCL, DOT, EQ, EQQUO, EQSQUO, FALSE, FORMCL, FORMOP, GET, ICL, INPUTOP, IOP, LABELCL, LABELFOR, LABELOP, LCURL, LICL, LIOP, LPAR, LSBR, MT, NBSP, NL, OLCL, OLOP, P_class, PCL, PLUGCL, PLUGO, POP, POST, QUO, QUOCL, QUOETCL, RCURL, RPAR, RSBR, SEMI, SP, SPAN_class, SPANCL, SPANOP, SQUO, TABLECL, TABLEOP, TDCL, TDOP, THCL, THOP, TRCL, TROP, TRUE, TTCL, TTOP, ULCL, ULOP, UNDER
 
Constructor Summary
MetaFormPlugin()
          Default constructor.
 
Method Summary
 String execute(WikiContext context, Map params)
          Execute the plugin, processing accordingly, returning XHTML-compatible markup.
 int getMode()
          Return the current plugin mode.
 String getModeName()
          Return the name of the current mode.
 String getXID()
          Return the value of the xid parameter, null if undefined.
protected  void printTest(Map map, StringBuffer out, String title, String color)
          Print out the name-value pairs of the Map map to the StringBuffer, using the title and color spec.
protected  void writeFormOutput(WikiContext context, List controls, StringBuffer out)
          Writes the form output provided by the List of FormControls to the StringBuffer out.
 
Methods inherited from class com.ecyrd.jspwiki.forms.FormElement
getFormInfo, storeFormInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.log4j.Logger log

m_pluginName

protected String m_pluginName
This is the common plugin invocation name, and should match a wiki page name for documentation. This must be set by the in the constructor for all subclasses.


TEXT_WRAP_PRE

public static boolean TEXT_WRAP_PRE
When true, text documents are wrapped with a <pre> element.


MODE_INIT

public static final int MODE_INIT
Constant indicating initial mode.

See Also:
Constant Field Values

MODE_VIEW

public static final int MODE_VIEW
Constant indicating form view mode.

See Also:
Constant Field Values

MODE_CANCEL

public static final int MODE_CANCEL
Constant indicating Cancel button activated mode.

See Also:
Constant Field Values

MODE_EDIT

public static final int MODE_EDIT
Constant indicating Edit mode.

See Also:
Constant Field Values

MODE_SELECT

public static final int MODE_SELECT
Constant indicating Select button activated mode. Currently unused.

See Also:
Constant Field Values

MODE_SAVE

public static final int MODE_SAVE
Constant indicating Save button activated mode.

See Also:
Constant Field Values

PARAM_XID

public static final String PARAM_XID
The xid parameter name.

See Also:
Constant Field Values

PARAM_CID

public static final String PARAM_CID
The cid parameter name.

See Also:
Constant Field Values

PARAM_NID

public static final String PARAM_NID
The nid parameter name.

See Also:
Constant Field Values

PARAM_VERBOSE

public static final String PARAM_VERBOSE
The verbose parameter name.

See Also:
Constant Field Values

MAX_FIELD_LENGTH

public static int MAX_FIELD_LENGTH
The maximum field content length before the form will use a textarea rather than an input field. The default value is 60 characters.


unknownUser

protected static String unknownUser

m_checkPermissions

protected boolean m_checkPermissions

m_checkAboutPage

protected boolean m_checkAboutPage

m_engine

protected WikiEngine m_engine
Constructor Detail

MetaFormPlugin

public MetaFormPlugin()
Default constructor.

Method Detail

execute

public String execute(WikiContext context,
                      Map params)
Execute the plugin, processing accordingly, returning XHTML-compatible markup.

Specified by:
execute in interface WikiPlugin
Parameters:
context -
params -
Returns:
the generated output to be displayed on the wiki page.
See Also:
WikiPlugin.execute(com.ecyrd.jspwiki.WikiContext,java.util.Map)

getXID

public String getXID()
Return the value of the xid parameter, null if undefined.

Returns:
the value of the 'xid' parameter.

writeFormOutput

protected void writeFormOutput(WikiContext context,
                               List controls,
                               StringBuffer out)
Writes the form output provided by the List of FormControls to the StringBuffer out. This is dependent upon the plugin mode. This should write something intelligent even if the List is empty.

Parameters:
context - the WikiContext of the form session
controls - the List of FormControls
out - the output buffer

printTest

protected void printTest(Map map,
                         StringBuffer out,
                         String title,
                         String color)
Print out the name-value pairs of the Map map to the StringBuffer, using the title and color spec.


getMode

public int getMode()
Return the current plugin mode. Values include:


getModeName

public final String getModeName()
Return the name of the current mode.



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.