Monthly Archives: January 2013

Modes WordPress plugin documentation

The Modes plugin framework consists of a number of WordPress shortcodes. These work together to deliver the required content to the current page.  The control framework is Ajax-based.

On first loading the page, each Modes data source will use the active page parameters to frame an HTTP request, and will get back an XML response.  The response handler will in turn trigger each shortcode which uses that data source, passing the XML response DOM as a parameter. Each shortcode will use the information in the XML response to update its HTML contents, typically by applying an XSLT transform to it.

Thus, when the page is first loaded, each Modes shortcode function will simply write an empty named <div> element to the page, to act as the root for the content which will eventually be placed there.

The approach adopted will be based on the Culture Grid explorer (cg-search.htm), and it should be possible to put much of the functionality into Javascript libraries.  This will limit the amount of “Javascript written by PHP” code which is required.

Modes datasource

Every page requires a Modes datasource. This is a “non-visual” shortcode, whose purpose is to define the interface to a Modes data file.  When the datasource is initialised, it will build an array of the Modes components which make use of it.

Modes summary/data

A paged view of a set of Modes records.  If there is no query specified, this can default to a Modes browser control, which displays a fixed set of records/searches.

Modes detail

Like Modes summary (maybe not a separate component?); shows a single record, with controls to navigate forward and backwards through the result set.

Modes navigator

A component which allows the user to move through a Modes summary/data result set.  Needs to specify the name of the control which it applies to.

Modes facets

A component which displays terms which are relevant to the current search result, relating to one or more facets. Selecting a term will add that term to the current search, thus refining it.

Modes search terms

This control displays each active search term, and provides a means to deselect any term.

Modes lightbox

Displays a result set as a grid of images, using a simple XPath expression to get the image filenames.

Modes map

Displays a (Google) map, with selected items marked.

Modes timeline

Displays a (Simile) timeline, with selected items marked.

Modes and WordPress

We are working to produce a WordPress plugin for the Modes software family. This WordPress site will document our progress, and will also act as a test-bed to demonstrate what we have managed to achieve so far. If you have any thoughts or comments on this, you can leave them as comments on these articles, or send an email to me at richard at light.demon.co.uk.

The approach we are adopting is to support one or more WordPress “shortcodes”, which are codes enclosed in square brackets.  These shortcodes will be replaced by suitable Modes data and associated controls. (For example there will be a “navigator”, which allows users to browse through a set of results from a search.) The first round of work produced a “Modes data” plugin, which was demonstrated at the Modes Workshop in September 2012. This supported searches on Modes indexes, and the display of specific records (or sets of records).  It is AJAX-based, meaning that the results are updated without needing to refresh the complete page.

For the production-level plugin, we need to make it easy for the public to see what is in a Modes collection without having to run a search.  Therefore we want to develop a “Modes browser” which offers a number of pre-designed searches or subsets of the data, so that with a single click users can see a set of records, and with a second click they can be looking at the detail of one specific object.

Apart from the shortcode to support browsing and searching, we are interested in developing a plugin to support the production of user-generated content and the uploading of such data to a Modes data file.  This may range from a simple “comment” box through to complex structured data entry.  It could be used equally for public participation and for inhouse collections management support.