Example Usage:
```
{{#drilldowninfo:filters=
{{int:SA Address Locality}} (property=Locality),
{{int:SA Country Country}} (property=Country),
{{int:SA Tag Tags}} (property=Tag),
|display parameters=?Organization Code;?Street;?Postal Code;?Locality;?Country;format=broadtable;
|header=Template:S Organization Drilldown Intro
|footer=Template:Welcome
}}
```
```
Index: includes/SD_ParserFunctions.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- includes/SD_ParserFunctions.php (revision 5e142c6c4e584721a187e51fe880c7f3db29b3dc)
+++ includes/SD_ParserFunctions.php (revision )
@@ -37,6 +37,8 @@
array_shift( $params );
$filtersStr = $titleStr = $displayParametersStr = "";
+ $header = '';
+ $footer = '';
// Parameters
foreach ( $params as $i => $param ) {
@@ -58,6 +60,10 @@
$titleStr = $value;
} elseif ( $param_name == 'display parameters' ) {
$displayParametersStr = $value;
+ } elseif ( $param_name === 'header' ) { // Header
+ $header = $value;
+ } elseif ( $param_name === 'footer' ) { // Footer
+ $footer = $value;
}
}
@@ -104,6 +110,12 @@
}
if ( $displayParametersStr != '' ) {
$parserOutput->setProperty( 'SDDisplayParams', $displayParametersStr );
+ }
+ if ( $header !== '' ) {
+ $parserOutput->setProperty( 'SDHeader', $header );
+ }
+ if ( $footer !== '' ) {
+ $parserOutput->setProperty( 'SDFooter', $footer );
}
$parserOutput->addModules( 'ext.semanticdrilldown.info' );
Index: includes/SD_Utils.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- includes/SD_Utils.php (revision 5e142c6c4e584721a187e51fe880c7f3db29b3dc)
+++ includes/SD_Utils.php (revision )
@@ -325,6 +325,54 @@
return $pages;
}
+ /**
+ * Gets the custom drilldown title for a category, if there is one.
+ */
+ static function getDrilldownHeader( $category ) {
+ $title = Title::newFromText( $category, NS_CATEGORY );
+ $pageID = $title->getArticleID();
+ $dbr = wfGetDB( DB_SLAVE );
+ $res = $dbr->select( 'page_props',
+ array(
+ 'pp_value'
+ ),
+ array(
+ 'pp_page' => $pageID,
+ 'pp_propname' => 'SDHeader'
+ )
+ );
+
+ if ( $row = $dbr->fetchRow( $res ) ) {
+ return $row['pp_value'];
+ } else {
+ return '';
+ }
+ }
+
+ /**
+ * Gets the custom drilldown title for a category, if there is one.
+ */
+ static function getDrilldownFooter( $category ) {
+ $title = Title::newFromText( $category, NS_CATEGORY );
+ $pageID = $title->getArticleID();
+ $dbr = wfGetDB( DB_SLAVE );
+ $res = $dbr->select( 'page_props',
+ array(
+ 'pp_value'
+ ),
+ array(
+ 'pp_page' => $pageID,
+ 'pp_propname' => 'SDFooter'
+ )
+ );
+
+ if ( $row = $dbr->fetchRow( $res ) ) {
+ return $row['pp_value'];
+ } else {
+ return '';
+ }
+ }
+
static function monthToString( $month ) {
if ( $month == 1 ) {
return wfMessage( 'january' )->text();
Index: specials/SD_BrowseData.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- specials/SD_BrowseData.php (revision 5e142c6c4e584721a187e51fe880c7f3db29b3dc)
+++ specials/SD_BrowseData.php (revision )
@@ -216,6 +216,9 @@
*/
function createTempTable( $category, $subcategory, $subcategories, $applied_filters ) {
$dbr = wfGetDB( DB_SLAVE );
+
+ // Ensure that temporary table has been properly deleted
+ $dbr->query( "DROP TABLE IF EXISTS semantic_drilldown_values;" );
$sql1 = "CREATE TEMPORARY TABLE semantic_drilldown_values ( id INT NOT NULL )";
$dbr->query( $sql1 );
$sql2 = "CREATE INDEX id_index ON semantic_drilldown_values ( id )";
@@ -1036,6 +1039,20 @@
$subcategory_text = wfMessage( 'sd_browsedata_subcategory' )->text();
$header = "";
+
+ // Add intro template
+ $headerPage = SDUtils::getDrilldownHeader( $this->category );
+ if ($headerPage !== '') {
+ $title = Title::newFromText($headerPage);
+ $page = WikiPage::factory($title);
+ if ($page->exists()) {
+ $content = $page->getContent();
+ $pageContent = $content->serialize();
+ $out = $this->getOutput();
+ $header .= $out->parseInline($pageContent);
+ }
+ }
+
$this->show_single_cat = $this->getRequest()->getCheck( '_single' );
if ( ! $this->show_single_cat ) {
$header .= $this->printCategoriesList( $categories );
@@ -1252,6 +1269,7 @@
protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
global $wgContLang;
+ // Add Drilldown Results
$all_display_params = SDUtils::getDisplayParamsForCategory( $this->category );
$querystring = null;
$printouts = $params = array();
@@ -1320,6 +1338,22 @@
: implode( '', $html );
$out->addHTML( $html );
+
+ // Add outro template
+ $footerPage = SDUtils::getDrilldownFooter( $this->category );
+
+ if ($footerPage !== '') {
+
+ $title = Title::newFromText('Template:' . $footerPage);
+ $page = WikiPage::factory($title);
+
+ if ($page->exists()) {
+ $content = $page->getContent();
+ $pageContent = $content->serialize();
+ $out->addWikiText($pageContent);
+ }
+ }
+
}
// Take non-semantic result set returned by Database->query() method,
```