WikiHyperForms

From HypertWiki
Jump to navigation Jump to search

Tired of not finding extensions to do what I wanted, and having a paying gig to produce something which did do some of them, I'm going to see if I can quickly whip this up...

Syntax

...for expressions

"expressions" are used in all of the following areas (defining forms, processing form data, and generating reports).

An expression is one or more variable references concatenated together, like {{{var1}}} or {{{var1}}}{{{var2}}}. The ParserFunctions extension should work for using more complex expressions.

...for defining forms

<form

target=page:expr | url:expr | new:expr_tem:expr_targ
method=get | post
>

<input

type=line|text|choice|option|check
list=cat:category name|text:.demarcated.list
width=columns
/>
  • "list" only applies to "choice" or "option" types
  • "width" only applies to "line" or "text" types
  • "height" only applies to "text" type

target values:

  • page:expr - targets the internal page whose name is expr, and passes the form data
  • url:expr - targets the external web page whose URL is expr
  • new:
    • expr_tem is the template to use for creating the new page (see syntax for processing form data)
    • expr_targ is the name of the new page to create
    • By default, a new page will be shown as a preview for the user to confirm. Maybe later we could have an option to just create it.

...for processing form data

The syntax is basically the same for an existing page which processes form input as it is for creating a new page from a template; the only difference is that the former only shows the results, while the latter creates a new page containing the results.

...and really, at the moment I can't think of anything about this which needs to be more complicated than the "expression" syntax above, possibly combined with the report generation syntax.

...for report generation (looping, possibly based on wiki contents)

<foreach

list=cat:category name|text:.demarcated.list
>

</foreach>

Inside this tag pair, the following variables are available

  • {{#for.string}} - current value (either page name or list item)
  • {{#for.count}} - number of items in the for loop
  • if "list" is a "cat:":
    • {{#for.page.title}}
    • {{#for.page.hits}}
    • {{#for.page.length}}
    • {{#for.page.when.edited}}
    • {{#for.page.when.created}}
    • {{#for.page.categories}}
    • ...and of course you can transclude from each page by using {{:{{#for.page.title}}}} or even {{#lst...}}

Later on we might want more complicated selection criteria as in DPL, but this will do for now.

The following tags are also available:

  • <first>This text is only processed during the first cycle.</first>
  • <final>This text is only processed during the last cycle.</final>