Revision [15744]

This is an old revision of StructDataActionInfo made by DomBonj on 2006-12-03 08:54:42.

 

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 of 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
printstringoptionalThe display mode for the data item. Predefined types are false (no display), basic (inline of the type name), table (one-row table with one column per field) and list (table with one row per field)

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
helpstringoptionalIf this parameter is present, a one line description of the request and its parameters is displayed

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 invisible; 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


Example 1: To-Do list structured data item
Definition of two 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-4' date_due='2006-12-2' "}}

Comments:
  1. four fields are mandatory: owner, desc (description of the task), date_open and date_due. Dates shall follow the 'yyyy-mm-dd' format.
  1. date existence check is performed for date_open and date_due.
  1. no specific visual rendering has been defined. print='table' usually gives good results:
date_openownerstatusdate_duedesc
2006-10-3jdoeopen2007/11/13Complete logo design

Predefined requests
A request called ToDos 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 selected. If parameter p2 is present, only data items whose status is equal to p2 are selected. With the two To-do list items defined above, {{structdata req="ToDos"}} would display the following:
ownerdescriptiondue datepage link
kbillBook flight to Lake Tahoe2006-12-2StructDataActionInfo
jdoeComplete logo design2007/11/13StructDataActionInfo


Example 2: Contact card structured data item
Definition of a contact card
{{structdata type="Card" data="n='DOE;John' email='jdoe@his_organization.org' fax='(123) 654-898 tel='(+41) 123 4567' org='His_org'"}}

Comments:
  1. one field is mandatory: n, containing the name of the contact, formatted as 'last_name[;given_name[;middle_name[;title]]]')
  1. optional fields are: org (organization), email, tel and fax.
  1. no data validation is performed.
  1. a contact card is rendered by default as an inline text diplaying the contact's name and (if any) organization, with a 'mailto' hyperlink to the contact's email address and a tooltip showing his/her phone and fax numbers. Example: John Doe (His_org).
Predefined requests
A request called Cards is predefined. It displays all contact cards in a table, sorted by name. If parameter p1 is present, only contacts whose organization equals p1 are selected. If parameter p2 is present, its value is used as the name of the field to sort on.

To-do, bugs and limitations


Other considerations


Author
DomBonj


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