Extension:Cargo/Display formats

From MediaWiki.org
Jump to: navigation, search
Cargo - navigation
Basics Main pageExtension:Cargo (talk) · Download and installationExtension:Cargo/Download and installation · Quick start guideExtension:Cargo/Quick start guide · Other documentationExtension:Cargo/Other documentation · SMW migration guideExtension:Cargo/SMW migration guide
Using Cargo Storing dataExtension:Cargo/Storing data · Querying dataExtension:Cargo/Querying data (Display formatsExtension:Cargo/Display formats) · Browsing dataExtension:Cargo/Browsing data · Exporting dataExtension:Cargo/Exporting data · Other featuresExtension:Cargo/Other features
Resources for help Common problemsExtension:Cargo/Common problems · Known bugs and planned featuresExtension:Cargo/Known bugs and planned features · Getting supportExtension:Cargo/Getting support
About Cargo Authors and creditsExtension:Cargo/Authors and credits · Version historyExtension:Cargo/Version history · Sites that use CargoExtension:Cargo/Sites that use Cargo · Cargo and Semantic MediaWikiExtension:Cargo/Cargo and Semantic MediaWiki · FAQExtension:Cargo/FAQ

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

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

The Cargo extension supports the following formats:

Lists[edit]

list[edit]

Displays results in a delimited list.

Parameters:

  • delimiter - sets the separator character (default is comma)

ul[edit]

Displays results in a bulleted list.

Parameters:

  • columns - sets the number of columns (default is 1)

Examples: Discourse DB latest items, Inventing Aviation patents listing

ol[edit]

Displays results in a numbered list.

Parameters:

  • columns - sets the number of columns (default is 1)

category[edit]

Displays results in the style of MediaWiki categories.

Parameters:

  • columns - sets the number of columns (default is 3)

More complex text displays[edit]

template[edit]

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 {{{1|}}}, {{{2|}}} etc.

Parameters:

  • template - specifies the name of the template to use (mandatory)
  • named args - 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

Examples: Discourse DB "position" page (queries here, template here), Funtoo Linux organizations list (see bottom of page; template here)

embedded[edit]

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

outline[edit]

Shows results in an outline format.

Parameters:

  • outline fields - holds a comma-separated list of the query's fields; these fields are used to define the outline, by which the results are grouped together (mandatory)

Example: Discourse DB opinion items outline

tree[edit]

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

Parameters:

  • parent field - holds the name of this connector field (mandatory)

table[edit]

Displays results in a table. (No parameters.)

dynamic table[edit]

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

Parameters:

  • rows per page - sets the number of rows that are initially shown on every "page" of the table (default is 10)

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

tag cloud[edit]

Shows results in a "tag cloud" format, where the number corresponding to each string value dictates the font size for that string.

Parameters:

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

Image displays[edit]

gallery[edit]

Displays a gallery of images, in the style of the MediaWiki <gallery> 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:

  • mode - sets the display mode of the gallery; can be traditional (the default), nolines, packed, packed-overlay or packed-hover. See here for a demonstration of these options.
  • show bytes - if set to "0", hides the size of each image (it is shown by default)
  • show filename - if set to "0", hides the name of each image (it is shown by default)
  • per row - specifies the number of images displayed on each row
  • image width - specifies the width, in pixels, at which to display each image
  • image height - specifies the height, in pixels, at which to display each image
  • caption field - specifies the name of a query field whose value should be used for each image caption
  • alt field - specifies the name of a query field whose value should be used as the "alt text" for each image
  • link field - 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

Time-based displays[edit]

calendar[edit]

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 _pageName field (with no alias), or another field with the "=name" alias.

Parameters:

  • width - sets the width of the calendar (default is 100%)
  • height - sets the height of the calendar (default is for the height to fit the content to be displayed)
  • start date - sets the date at which to display the calendar (default is the current date)
  • view - sets the starting display of the calendar - options are 'day', 'week', or 'month' (default is month)
  • color - sets the color for the bubble around names of events; useful within #compound_query (default is set by the FullCalendar library)
  • text color - 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.
  • name - sets the name of the event
  • description - sets an event description, displayed when the event is hovered over
  • color - same behavior as the "color" parameter
  • text color - same behavior as the "text color" parameter
  • start - used for multi-day events; sets the start date
  • end - used for multi-day events; sets the end date

Example: Discourse DB opinion calendar

timeline[edit]

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

Parameters:

  • height - sets the height of the timeline (default is 350px)
  • width - sets the width of the timeline (default is 100%)

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

Numerical displays[edit]

bar chart[edit]

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

Parameters:

  • height - sets the height of the bar chart (default is based on the number of bars)
  • width - 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)

Maps[edit]

googlemaps[edit]

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

Parameters:

  • height - sets the height of the map (default is 400px)
  • width - sets the width of the map (default is 700px)
  • icon - 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.
  • zoom - 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

openlayers[edit]

Displays results in a map, using the OpenLayers service.

Parameters: same as for googlemaps.

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

More complex displays[edit]

exhibit[edit]

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

Parameters:

  • view - sets the view(s) that will be displayed, separated by comma if more than one. Valid values are map, tabular and timeline. If not set, the view(s) will be set based on the types of the fields in the query.
  • facets - 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.
  • datalabel - sets the label that refers to the data. Default is "Item".`
for the "timeline" view:
  • end - sets the name of the field holding the end time for each event (if any)
  • color - sets the name of the field used to color-code the markers (if any)
  • topunit - sets the unit for the top band: millisecond, second, minute, hour, day, week, month, year, decade, century, millennium
  • toppx - sets the width, in pixels, for each interval in the top band
  • bottompx - sets the width, in pixels, for each interval in the bottom band

Export[edit]

Three export-based display formats are defined: csv, json and excel. 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.