FormTemplateSystem-Documentation
<< | Cookbook-V1 | >>
Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.
Parameters for a form are set using the $TemplateFormAttributes array contained in the PHP template file. Parameter Value Effect okdetach 1 Includes a option for the user to detach the current template from the pagename files. Default is 0. okreset 1 Includes an option for the user to clear all fields in the current form and return them to their default values. Default is 0. okcancel 1 Includes an option for the user to cancel the current editing of a form and return to to browse mode. Default is 1. okpost 1 Includes an option for the user to post, i.e., record, the content of the current form. Default is 1. auth required value Sets the value that is required to change the group default template. Default is yes. Usage: ?auth=requiredvalue at end of URL brchar some char string Sets the value for the break character that is used with keys to indicate a break in either the form layout or the wiki page layout. Maybe applied to head, cue, value, and tail depending upon the field type. Default is - Usage: '-head' generates <br />head_content cue generates <br />cue_content<br /> 'tail-' generates tail_content<br /> in the form. Works with head, cue, and tail keys. '-inwiki' generates $newline inwiki_content in the PmWiki page. Also, 'inwiki-' and inwiki. extract requires term only Sets an action to extract the wiki markup created by the form and place it in a regular, template free edit window. The action will detach any current template. The URL form is as follows: -- with a group default template -- ?action=extract&template=none&auth=requiredvalue -- without a group default template -- ?action=extract&template=none export requires &select= Sets an action to export the current wiki page and process it if the following function exists: HandleExportContent($pagename
,$page). The URL form is as follows: -- with a group default template -- ?action=export&auth=authvalue -- without a group default template -- ?action=export (NOTE: for values of all page fields add &select=page for values of all form fields add &select=values for keynames of all fields add &select=keys $EnableXHTMLinFTS Set equal to 0 local.php file to disable DOCTYPE XHTML 1.0 Transitional.$DiffKeepDays
Sets number of days to keep diff records. Default is 7 days. Set in local.php file. Fields are defined via the $TemplateFieldAttributes array. NOTE: the that the operator += is used for the assignment The keys can appear in any order within an array. Available keys include "field-name", for example, "note1". The "field-name" is chosen by the form template designer. (NOTE: templates containing the same "field-name" will display the same form content when applied to a particular PmWiki page.) Within a "field-name" definition array the following keys are possible but some apply to only certain "field" types. keys: type, inwiki, head, cue, value, tail, size, rows, cols types: text, textbox, radio, checkbox, select (and for use with select -- option and /option), formnote, and wikinote. A note for the wiki page. Cannot be changed via the form. Content of "value" key can contain embedded PmWiki markup. A note for the form page. Cannot be changed via the form. Content of "value" key can contain embedded html markup. Key content display order in form: head, value, tail. Text and Textarea types have "head", "cue", and "tail" keys that can contain embedded html markup. These are used within the form. The "inwiki" and "value" keys can contain PmWiki markup. These are used within the PmWiki page. The keys "size", "rows" and "cols" apply only to "text" and "textbox" types. Key content display order in form: head, cue, value, tail. Radio button types are defined like "text" and "textbox" types. To show the button as "selected" use "@value" instead of "value" for the key. This also applies to the "checkbox" and "select" types. Using an approach of fieldname.extension it is possible to define a set of radio buttons that work together with the option of selecting only one of the radio buttons. The extension can be chosen as desired by the form designer. However, the portion of the name before the "period" MUST be the same in each. Key content display order in form: head, value, cue, tail. The type "select" uses the same approach of fieldname.extension and the unique structure illustrated below. The sequence MUST be as follows: "type" => "select" "type" => "option" . . . "type" => "/option" Key content display order in form: head, value, cue, tail. Other template files may be included in a template file. They must be usable as an independent template file, i.e., they must be a valid template file. and should NOT contain an addition reference to the $TemplateFormAttributes array.
$TemplateFormAttributes = array('okdetach'=>1, 'okreset'=>1);
$TemplateFieldAttributes += array(
'note1' => array('type'=>'wikinote', 'value'=>"''this is a note for the wiki page''[[<<]]"), 'pagenote1' => array('type'=>'formnote', 'value'=>'Notes can be helpful for instructions, etc.')
);
$TemplateFieldAttributes += array(
'field1' => array('type'=>'text', 'inwiki'=>":'''Title''':", 'head'=>'<table width="90%"><tr><td><center>', '-cue'=>"<strong>He's got a Title </strong>", 'tail'=>'</center></td></tr></table>', 'size'=>50, 'value'=>'this is my Title & subject.'), 'field2' => array('inwiki'=> ':Description:', 'cue'=>'Description ' , '-head'=>'<center>This is a section head</center>', 'type'=>'textarea', 'rows'=>5, 'cols'=>80 ), 'field3.big' => array('type'=>'radio', 'inwiki-'=>'Q:Status', '-head'=>'head marker', 'tail'=>' tail marker', 'cue'=>'Ok, InProcess', '@value'=>'A:In Process'), 'field3.little'=> array('type'=>'radio', 'cue'=>'Clear', 'value'=>'',), 'field4.0' => array('type'=>'radio', 'inwiki'=>":'''2nd Status''':", 'head'=>'<center><table><tr><td align="left">', 'cue-'=>'Ok, InProcess', 'value'=>'In Process now'), 'field4.1' => array('type'=>'radio', 'cue-'=>'Clear', '@value'=>''), 'field4.last'=> array('type'=>'radio', 'cue-'=>'Last Choice', 'value'=>'Last Chance!', 'tail'=>'</td></tr></table></center>'), 'field5a'=> array('type'=>'checkbox', '-inwiki'=>':3rd Status:', 'cue'=>'test it', 'value'=>"'''In more Process now'''"), 'field5b'=> array('type'=>'checkbox', 'cue'=>'Clear', 'value'=>'y'), 'field6a'=> array('type'=>'checkbox', 'inwiki-'=>':4th Status:', 'cue'=>'Ok, InProcess', '@value'=>'!!Ultimate In Process now'), 'field6b'=> array('type'=>'checkbox', 'cue-'=>'Clear', '@value'=>'x'), 'field7.0'=>array('type'=>'select', inwiki=>'Q:Abstract' , 'head'=>'<br />'), 'field7.1'=>array('type'=>'option', 'value'=>'', 'cue'=>'<strong>clear item</strong>'), 'field7.2'=>array('type'=>'option', '@value'=>'A:[+single+]', 'cue'=>'<em>single balloon</em>'), 'field7.3'=>array('type'=>'option', 'value'=>"A:''multiple balloons''"), 'field7.4'=>array('type'=>'</option>', 'value'=>'A:just use the hose.'),
);
if (file_exists($TemplateDir . '/Description.php'))
{include_once($TemplateDir . '/Description.php');
if (file_exists($TemplateDir . '/PHPCode.php'))
{ include_once($TemplateDir . '/PHPCode.php');
if (file_exists($TemplateDir . '/ReleaseNotes.php'))
{ include_once($TemplateDir . '/ReleaseNotes.php');
pmwiki-2.3.38 -- Last modified by {{}}?