Extension:Cargo/Browsing data

Cargo provides a number of ways to generically view stored data; these are all publicly-available, but some are intended for regular users, some for administrators, and some for both.

Drill-down interface
The main mechanism that Cargo provides for browsing data is the page Special:Drilldown, which shows a listing of each table and its contents, and a set of filters for drilling down on that information. Its interface is derived from, and almost identical to, that of the extension Semantic Drilldown. The main difference is that, unlike with Semantic Drilldown, filters do not have to be defined; instead, Cargo sets the filters automatically, based on the types of the fields for each table. Fields of type String, Page, Integer, Float, Date and Datetime are turned into filters, with the input type used dependent on the field type; while fields of type Text, File, Coordinates, URL, Email, Wikitext and Searchtext are not. (Any fields marked as "hidden" similarly will not be shown as filters.)

The following settings can be applied for Special:Drilldown, in LocalSettings.php:
 * - display set of table names as tabs at the top instead of a vertical list on the side (default is true)
 * - if set to a positive number, sets the smallest font size, in pixels, for a tag-cloud-style display of filter values (default is -1)
 * - if set to a positive number, sets the largest font size, in pixels, for a tag-cloud-style display of filter values (default is -1)
 * - sets the minimum number of values before values are displayed in a combo box instead of as individual links (default is 40)
 * - for fields/filters of type "Integer" or "Float", specifies the number of "buckets" into which values are divided (default is 5)
 * - if set to a positive integer, specifies the maximum number of values that can be shown at a time for any "hierarchy" field. (All the top-level values are always shown irrespective of the value of this variable.) The values are hidden beyond a certain depth of the hierarchy such that the count of total visible values is at most this number (default is 30).

By default, the Special:Drilldown page adds some tabs for displaying/viewing the results (according to the type of fields present in the table being browsed) in following formats:  
 * Timeline format if any field of date/datetime type is present
 * Calendar format if any field of date/datetime type is present and also data is not too sparse (on an average, there should be around 4 events present per month).
 * Map format if any coordinates type field is present
 * Gallery format if any file type field is present

But if you want to customise your tabs even more, then you can add  parameter to #cargo_declare call (explained here). It gives you complete freedom to customise your tabs. You can add any no. of tabs, any field you want to include in the results and even display the results in any format supported in Cargo.

Full-text search
You can see in the example image that, in addition to the data filters, there is also a text search input at the top, which can be used in conjunction with the filters. This search input shows up if either of the following are true:
 * Storage of page text is enabled; see Storing page data.
 * The table being browsed has one or more fields of type "File", and storage of file text is enabled; see Storing file data.

If both are true, then the text search will search on the contents of both pages and files, and will display both.

Simple query form
If you go to the page Special:ViewData, you can see a simple form that allows for running a query (like #cargo_query does) by filling out the form fields.

Viewing tables
The page Special:CargoTables shows a listing of all tables in the wiki, and some helpful links for each one. The page does double duty: for users and administrators, it's a convenient way of seeing the overall layout of the data; while for administrators, it's also a sort of dashboard for maintaining all the tables. For users, Special:CargoTables shows, for each Cargo table, links to "view" and "drilldown" for each table. The "view" links will go to the page "Special:CargoTables/tableName". Clicking on any of the "view" links will show a table displaying the full contents (again, with the exception of "hidden" fields), as well as a listing of all the fields and their types. For administrators, each table also gets "recreate data" and "delete" links, making it easier to manage all the data from a single location.

Values for a single page
Cargo provides a new MediaWiki action, "action=pagevalues", that shows the set of table rows defined for any specific page. This action is accessible from the "Page values" link at the bottom of the sidebar. The "page values" display can show rows from multiple tables, if more than one type of Cargo-based template is called on a page.