Extension:Cargo/Display formats

The "format=" parameter lets you set in which format to display the results.

If no format is specified,  is the default format if there is only a single field being displayed in the results, while   is the default format if there is more than one field.

The Cargo extension supports the following formats:

list
Displays results in a delimited list.

Parameters:
 * - sets the separator character (default is comma). "\n" placed within this value will get translated into a newline.

ul
Displays results in a bulleted list.

Parameters:
 * - sets the number of columns (default is 1)

Examples: Discourse DB latest items, Inventing Aviation patents listing

ol
Displays results in a numbered list.

Parameters:
 * - sets the number of columns (default is 1)

category
Displays results in the style of MediaWiki categories.

Parameters:
 * - sets the number of columns (default is 3)

template
Displays results using a MediaWiki template that formats each row of results. By default, the template in question should use unnamed parameters, i.e. it should refer to its parameters as, etc.

Parameters:
 * - specifies the name of the template to use (mandatory)
 * - if set to "yes", specifies that the template should instead have named parameters, where the parameter names are the names (or aliases, if they are set) of the query fields
 * - sets the separator string (default is no separator). "\n" placed within this value will get translated into a newline.

Examples: Discourse DB "position" page (queries here, template here), Another Eden Wiki > Chronos' Umbra (template here)

embedded
Shows the full text of each queried page (only the first field of the query is used). (No parameters.)

outline
Shows results in an outline format.

Parameters:
 * - holds a comma-separated list of the query's fields (without the table name part); these fields are used to define the outline, by which the results are grouped together (mandatory)

Example: Discourse DB opinion items outline

tree
Shows results in a tree format, in which a single field defines all the relationships between "child" pages and "parent" pages.

Parameters:
 * - holds the name of this connector field (mandatory)

table
Displays results in a table.

Parameters:
 * - if set to "yes", causes adjacent cells in the same column that hold the same value to be merged together, to make for easier reading.

dynamic table
Displays results in a "dynamic" table that includes sorting, pagination and searching, using the DataTables JavaScript library.

Parameters:
 * - sets the number of rows that are initially shown on every "page" of the table (default is 10)
 * - specifies the fields that should have a special search input above their columns
 * - specifies the fields should not have a column but rather should be included in a special "details section" under each row.  The field must also be listed in the   parameter as well (details   does not add the field to the query, only sets it to "hidden").
 * - specifies the fields that should not be included in the table by default but can be added in by the user via a "Toggle columns" link. The field must also be listed in the   parameter as well (  does not add the field to the query, only sets it to "hidden").

Examples: Traveller Wiki - list of sophonts, HUES list of technology entries

tag cloud
Shows results in a "tag cloud" format, where the number corresponding to each string value dictates the font size for that string. At least one of the queried fields must be an Integer value, used to determine the font size for that entry. "tag cloud" is commonly used with the "group by" parameter for queries, with the two displayed fields being the grouped-by parameter and "COUNT(*)".

Parameters:
 * - the percentage of normal font size that the smallest text displays will have (default is 80)
 * - the percentage of normal font size that the largest text displays will have (default is 200)
 * - specifies the name of a template to use to display each result

Example: Sample query on Discourse DB

gallery
Displays a gallery of images, in the style of the MediaWiki &lt;gallery&gt; tag. The images must be files that were uploaded to the wiki; they can either be the pages that are directly queried (if the image pages call a Cargo-based template), or fields, of type "File", of other pages.

Parameters:
 * - sets the display mode of the gallery; can be  (the default), ,  ,   or  . See here for a demonstration of these options.
 * - if set to "0", hides the file size of each image (it is shown by default)
 * - if set to "0", hides the dimensions of each image (they are shown by default)
 * - if set to "0", hides the name of each image (it is shown by default)
 * - specifies the number of images displayed on each row
 * - specifies the width, in pixels, at which to display each image
 * - specifies the height, in pixels, at which to display each image
 * - specifies the name of a query field whose value should be used for each image caption
 * - specifies the name of a query field whose value should be used as the "alt text" for each image
 * - specifies the name of a query field whose value should be used as the name of the page that the image links to

Example: Absit Omen Lexicon user page

slideshow
Displays a "slideshow" of images on the page.

Parameters:
 * - sets the number of side-by-side images to show on the screen at once (default is 1)
 * - the number of seconds to wait before advancing to the next slide(s) (by default, the slideshow does not autoplay at all, and the user must advance it manually)
 * - specifies the name of a query field whose value should be used for each image caption
 * - specifies the name of a query field whose value should be used as the name of the page that the image links to

calendar
Displays results in a calendar, using the FullCalendar JavaScript library.

For this format to work, the query must contain at least one field of type Date or Datetime, as well as the  field (with no alias), or another field with the "=name" alias.

Parameters:
 * - sets the width of the calendar (default is 100%)
 * - sets the height of the calendar (default is for the height to fit the content to be displayed)
 * - sets the date at which to display the calendar (default is the current date)
 * - sets the starting display of the calendar - options are 'day', 'week', or 'month' (default is month)
 * - sets the color for the bubble around names of events; useful within #compound_query (default is set by the FullCalendar library)
 * - sets the color of the text of event names (default is white)

Special aliases:
 * These are specific field aliases that can be set, so that that field's values become attributes of each corresponding event. For instance, having a component like "EventName=name" in the "fields" parameter in #cargo_query will let you use a field other than the page name to set the name of each event.


 * - sets the name of the event
 * - sets an event description, displayed when the event is hovered over
 * - same behavior as the "color" parameter
 * - same behavior as the "text color" parameter
 * - used for multi-day events; sets the start date
 * - used for multi-day events; sets the end date

Example: Discourse DB opinion calendar, ICANNWiki IG Hub Calendar

timeline
Displays results in a timeline, using the SIMILE Timeline library.

Parameters:
 * - sets the height of the timeline (default is 350px)
 * - sets the width of the timeline (default is 100%)

Examples: Discourse DB topic (see bottom of page), MHLO events timeline

bar chart
Displays results in a bar chart (with horizontal bars), using the NVD3 JavaScript library.

Parameters:
 * - sets the height of the bar chart (default is based on the number of bars)
 * - sets the width of the bar chart (default is 100%)

Examples: Discourse DB most popular authors, HUES technology database contents analysis (see bottom of page)

pie chart
Displays results in a pie chart, using the NVD3 JavaScript library.

Parameters:


 * - sets the height of the pie chart
 * - sets the width of the pie chart (default is 100%)
 * - a comma-separated list of colors fort the pie chart "slices"
 * - if set to "yes", removes the chart legend that shows up

Example: For a Cargo table names 'Test' with fields 'Names', and 'Number_of_things' the following query would create a pie chart grouped by Names.

googlemaps
Displays results in a map, using the Google Maps service.

Parameters:
 * - sets the height of the map (default is 400px)
 * - sets the width of the map (default is 700px)
 * - sets a custom icon to be used to display points; value must be the name of a file that has been uploaded to the wiki. This is especially useful within #compound_query.
 * - sets the zoom level, i.e. an integer value from around 0 to around 20, with higher numbers being more zoomed in (default is based on the area of the set of points being displayed).

You may need to get an API key for Google Maps to work - once you get an API key, you should set it in LocalSettings.php via the "$wgCargoGoogleMapsKey" variable.

Examples: Funtoo UserMap, Discourse DB map test

leaflet
Displays results in a map, using the Leaflet JS library.

Parameters: same as for, plus one additional parameter:
 * - sets an image to be the background for the map display, instead of a standard geographical map; specified image must be an image that has been uploaded to the wiki.

openlayers
Displays results in a map, using the OpenLayers service.

Parameters: same as for.

Example: Discourse DB map test (see bottom of page)

map
Displays result in a map, using the default map service (It can be set by adding  setting to LocalSettings.php. It sets the default map service to Google Maps, if set to 'googlemaps', to Leaflet if set to 'leaflet', and to OpenLayers if set to 'openlayers' (default is 'openlayers'))

Parameters: same as for.

exhibit
Displays results in a browsable interface, using the SIMILE Exhibit library/service.

Parameters:
 * - sets the view(s) that will be displayed, separated by comma if more than one. Valid values are,   and  . If not set, the view(s) will be set based on the types of the fields in the query.
 * - sets the fields to be used for the facets/filters, separated by comma if more than one. A maximum of three are allowed. If not set, the first three fields of the result are used.
 * - sets the label that refers to the data. Default is "Item".`


 * for the "timeline" view:


 * - sets the name of the field holding the end time for each event (if any)
 * - sets the name of the field used to color-code the markers (if any)
 * - sets the unit for the top band:,  ,  ,  ,  ,  ,  ,  ,  ,  ,
 * - sets the width, in pixels, for each interval in the top band
 * - sets the width, in pixels, for each interval in the bottom band

Export
Five export-based display formats are defined:  ,  ,  ,   and  . See Exporting data for documentation on these. In addition, the "exhibit" format displays an orange toolbox that lets you download the current data in various export formats: BibTex, RDF/XML, JSON, Semantic Wikitext and TSV.