Revision [15732]

This is an old revision of StructDataActionInfo made by DomBonj on 2006-12-02 07:17:14.

 

StructData Action Documentation

Not Included in official Wikka version

This is the documentation page for the structdata action.
 

Documentation


Short description
Enables to embed structured (or "semantically tagged", somehow like a database record) data items in a page. You can then:
This is by essence not a turnkey tool, as you have to define your data items and the request to be performed upon them.

Two examples are provided :

Parameters
Parameters shall be either of two (exclusive) types:
nametyperequired?defaultdescription
typestringrequiredThe data item type. Predefined types are ToDo and Card (see explanation in 'Long description' paragraph below)
datastringrequiredfield1='value1' field2='value2' etc. Optionnality and allowed values depend on value of the 'type' parameter

nametyperequired?defaultdescription
reqstringrequiredThe request id. Predefined types are ItemTable, ToDos and Cards (see explanation in 'Long description' paragraph below)
p1stringoptionalThe request's first parameter.Typically used to filter or sort, but actual semantics are request-specific
p2stringoptionalThe request's second parameter.Typically used to filter or sort, but actual semantics are request-specific
p3stringoptionalThe request's third parameter.Typically used to filter or sort, but actual semantics are request-specific

Notes:

Long description
Didn't you ever think: "these wiki are great, but if only I had a way to tag a chunk of page as containing the data for a contact card, a customer call or a calendar entry, in order to perform some database-style request on these data items?"

Well, here is a solution. With the structdata action you can do four things:
  1. embed in any page a "structured data item" which is defiined by a type (e.g. a To-Do list entry) and a list of parameters (or fields, in the database language). Note that fields are not typed;
  1. validate the list of parameters. You can:
- check for the presence of a mandatory parameter; and
- perform any data validation desired.
An error message will indicate failure to validate a given data item. Note that this requires you to provide the corresponding code;
  1. control the visual rendering of each data item. You can choose:
- to make it visible or not; or
- to display is as a list, a table or an inline text by using predefined display modes; or
- to display it in any custom way you may provide code for.
  1. perform any selection, processing and aggregation request you wish (example: display all the 'open' To-Do list entries with priority levels of 1 or 2). Of course, here again you have to provide some code.

Usage:
{{structdata (type="datatype" data="fieldslist" [print="printmode"] | req="reqname" [p1="val1"][p2="val2"][p3="val3"] [help]) }}


Examples:
Definition of To-Do list items. The second one will not be displayed
{{structdata type="ToDo" print="table" data="date_open='2006-10-3'  owner='jdoe' status='open' date_due='2007/11/13'  desc='Complete logo design'"}}

{{structdata type="ToDo" print="false" data="owner='kbill' status='open' desc='Book flight to Lake Tahoe' priority='2' date_open='2006-10-3' "}}

Comments on the four functions listed above
  1. three fields are mandatory: owner, desc (description of the task), date_open and date_due. Dates shall follow the 'yyyy-mm-dd' format.
  1. date validation is performed
  1. no specific visual rendering has been defined. print='table' usually give good results.
  1. a request called "ToDo" is predefined. It displays all To-Do list items in a table, sorted in reverse order of date_open. If parameter p1 is present, only data items whose owner equals p1 are displayed. If parameter p2 is passed, only data items whose status is equal to p2 are displayed.

Definition of a contact card
{{{{structdata type="Card" data="n='DOE;John' email='jdoe@himself.org' fax='(+1) 415 696 123' tel='212-898-31321' org='himself'"}}
}}


Design considerations
Full SQL-style request language with parser
XML
microformats
structured wikis: xwiki and twiki


Author
DomBonj



CategoryDocumentation
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki