We discussed this briefly on the talk page (April 2017). I think that it could work in the following way.
- The user can create a page in the format Template:Cargo Drilldown <tablename>, e.g. Template:Cargo Drilldown Address.
- This template can (but need not) contain a Cargo query.
- If such a page exists, then Cargo will send to it a comma-separated list of the result pages, by adding {{Cargo Drilldown <tablename>|<comma-separated list>}} to the bottom of Special:Drilldown
- The Cargo query in the template page can access this list using |where= _pageName IN ({{{1}}}). This requires $wgCargoAllowedSQLFunctions[] = 'IN'; to be added to PageSettings.php (or to Cargo itself).
I think that this approach provides more flexibility to the user than the planned feature which you mentioned ("Better automatic display of data...").
I guess that the idea could be developed further in order to provide automatic display of data in some cases if the user wants this - e.g. by automatically creating a template page where none exists, which could then be edited/improved by the user.
diff --git a/drilldown/CargoSpecialDrilldown.php b/drilldown/CargoSpecialDrilldown.php index 9e887fa..6e61823 100644 --- a/drilldown/CargoSpecialDrilldown.php +++ b/drilldown/CargoSpecialDrilldown.php @@ -1366,6 +1366,21 @@ END; $formatter = $queryDisplayer->getFormatter( $out ); $html = $queryDisplayer->displayQueryResults( $formatter, $valuesTable ); $out->addHTML( $html ); + + // Check whether user has created a Drilldown template page for this table + $drilldownTemplateTitle = 'Template:Cargo Drilldown ' . $this->tableName; + if ( Title::newFromText($drilldownTemplateTitle)->exists() ) { + // Create a comma-separated list of Drilldown result pages for sending to user's template + foreach ( $valuesTable as $valuesTableRow ) { + $valuesTableList .= '"'; + if ( $valuesTableRow['namespace'] ) { + $valuesTableList .= $valuesTableRow['namespace'] . ':'; + } + $valuesTableList .= $valuesTableRow['title'] . '", '; + } + $valuesTableList = rtrim ($valuesTableList, ', '); + $out->addWikiText( '{{' . $drilldownTemplateTitle . '|' . $valuesTableList . '}}' ); + } } function openList( $offset ) {