Canadian Musician Robert Aitken:Tech Notes—Structure and Content editing

From Canadian Musician Robert Aitken
Jump to: navigation, search

Templates and Forms

Pages of a particular category may be edited using a form; furthermore, if that form is changed, then the changes are reflected in the editing pages of the given category. The same applies for the underlying template that the form uses.

The source code of a template for a Cargo table has several parts. The first main section typically contains text that is displayed on the template page only, followed by a clause that declares the table, specifying its fields and their data types. The second main section contains instructions for storing data in the table and details on what will be displayed on a page created when the form is used.

The source code of a form used for entering data into a table and the associated pages contains code identifying the template that it uses. It also contains code for what will be displayed when the form is invoked, including places to enter data.

The corresponding category page has code that specifies the default_form used in editing pages within that category; e.g. {{#default_form:Piece}} goes in the Category page Category:Piece.

Use the appropriate tab on a template page to populate ("generate pages") or repopulate ("recreate data") the Cargo table with which the template is associated.

What would happen if a page had two categories, each specifying a default_form? (multiple templates for storing data are allowed)

Cargo

Cargo browsing mechanisms: Drill-down (displays table with automatically chosen filters based on type of field); simple query form (on Special:ViewData; viewing entire table contents from the table page Cargo Querying; HOLDS and HOLDS LIKE are useful SQL sugar commands for dealing with fields that have lists as values; native SQL commands may also be used.

This database uses the one-step process for pages whose names are calculated. See Semantic Forms. The "create title" parameter of the info tag (see Defining forms) is set to give the correct calculated value.

Call [Special:FormEdit/Formname], where Formname is the form to be used.

One can use a data input field for the name of the page created when a form is submitted, but one cannot use a field whose value is obtained from the values input to two other fields.

  • note that field description can include additional parameters including "hidden" so the field won't be listed in Special:ViewTable or Special:Drilldown
  • fields _pageName, _pageTitile, _pageNamespace, _pageID, and _ID are all created automatically.
  • can have multiple templates storing data to the same Cargo table. Use #cargo_attach
  • when the "Create data" or "Recreate data" tab is activated on a template page that defined the table, other templates adding to the table will also have their #cargo_store call(s) "activated."