Index: trunk/extensions/SemanticDrilldown/specials/SD_Filters.php |
— | — | @@ -7,32 +7,22 @@ |
8 | 8 | |
9 | 9 | if (!defined('MEDIAWIKI')) die(); |
10 | 10 | |
11 | | -global $IP; |
12 | | -require_once( "$IP/includes/SpecialPage.php" ); |
| 11 | +class SDFilters extends SpecialPage { |
13 | 12 | |
14 | | -global $sdgSpecialPagesSpecialInit; |
15 | | -if ($sdgSpecialPagesSpecialInit) { |
16 | | - global $wgSpecialPages; |
17 | | - $wgSpecialPages['Filters'] = 'SDFilters'; |
| 13 | + /** |
| 14 | + * Constructor |
| 15 | + */ |
| 16 | + function SDFilters() { |
| 17 | + SpecialPage::SpecialPage('Filters'); |
| 18 | + wfLoadExtensionMessages('SemanticDrilldown'); |
| 19 | + } |
18 | 20 | |
19 | | - class SDFilters extends SpecialPage { |
20 | | - |
21 | | - /** |
22 | | - * Constructor |
23 | | - */ |
24 | | - public function __construct() { |
25 | | - smwfInitUserMessages(); |
26 | | - parent::__construct('Filters', '', true); |
27 | | - } |
28 | | - |
29 | | - function execute() { |
30 | | - list( $limit, $offset ) = wfCheckLimits(); |
31 | | - $rep = new FiltersPage(); |
32 | | - return $rep->doQuery( $offset, $limit ); |
33 | | - } |
| 21 | + function execute() { |
| 22 | + $this->setHeaders(); |
| 23 | + list( $limit, $offset ) = wfCheckLimits(); |
| 24 | + $rep = new FiltersPage(); |
| 25 | + return $rep->doQuery( $offset, $limit ); |
34 | 26 | } |
35 | | -} else { |
36 | | - SpecialPage::addPage( new SpecialPage('Filters','',true,'doSpecialFilters',false) ); |
37 | 27 | } |
38 | 28 | |
39 | 29 | class FiltersPage extends QueryPage { |
— | — | @@ -75,9 +65,3 @@ |
76 | 66 | return $text; |
77 | 67 | } |
78 | 68 | } |
79 | | - |
80 | | -function doSpecialFilters() { |
81 | | - list( $limit, $offset ) = wfCheckLimits(); |
82 | | - $rep = new FiltersPage(); |
83 | | - return $rep->doQuery( $offset, $limit ); |
84 | | -} |
Index: trunk/extensions/SemanticDrilldown/specials/SD_BrowseData.php |
— | — | @@ -9,11 +9,22 @@ |
10 | 10 | |
11 | 11 | if (!defined('MEDIAWIKI')) die(); |
12 | 12 | |
13 | | -global $IP; |
14 | | -require_once( "$IP/includes/SpecialPage.php" ); |
| 13 | +class SDBrowseData extends SpecialPage { |
15 | 14 | |
16 | | -SpecialPage::addPage( new SpecialPage('BrowseData','',true,'doSpecialBrowseData',false) ); |
| 15 | + /** |
| 16 | + * Constructor |
| 17 | + */ |
| 18 | + public function SDBrowseData() { |
| 19 | + SpecialPage::SpecialPage('BrowseData'); |
| 20 | + wfLoadExtensionMessages('SemanticDrilldown'); |
| 21 | + } |
17 | 22 | |
| 23 | + function execute() { |
| 24 | + $this->setHeaders(); |
| 25 | + doSpecialBrowseData(); |
| 26 | + } |
| 27 | +} |
| 28 | + |
18 | 29 | class BrowseDataPage extends QueryPage { |
19 | 30 | var $category = ""; |
20 | 31 | var $subcategory = ""; |
— | — | @@ -524,7 +535,7 @@ |
525 | 536 | $property_field = 'attribute_title'; |
526 | 537 | $value_field = 'value_xsd'; |
527 | 538 | } |
528 | | - if ($applied_filter->filter->time_period != NULL) { |
| 539 | + if ($applied_filter->filter->time_period != NULL) { |
529 | 540 | if ($applied_filter->filter->time_period == wfMsg('sd_filter_month')) { |
530 | 541 | $value_field = "YEAR(value_xsd), MONTH(value_xsd)"; |
531 | 542 | } else { |
— | — | @@ -566,7 +577,7 @@ |
567 | 578 | $property_table_nickname = "a"; |
568 | 579 | $value_field = 'value_xsd'; |
569 | 580 | } |
570 | | - if ($applied_filter->filter->time_period != NULL) { |
| 581 | + if ($applied_filter->filter->time_period != NULL) { |
571 | 582 | if ($applied_filter->filter->time_period == wfMsg('sd_filter_month')) { |
572 | 583 | $value_field = "YEAR(value_xsd), MONTH(value_xsd)"; |
573 | 584 | } else { |
— | — | @@ -977,9 +988,9 @@ |
978 | 989 | return $sql; |
979 | 990 | } |
980 | 991 | |
981 | | - function getOrder() { |
982 | | - return ' ORDER BY sortkey '; |
983 | | - } |
| 992 | + function getOrder() { |
| 993 | + return ' ORDER BY sortkey '; |
| 994 | + } |
984 | 995 | |
985 | 996 | function formatResult($skin, $result) { |
986 | 997 | $title = Title::makeTitle( $result->namespace, $result->value ); |
— | — | @@ -1097,7 +1108,7 @@ |
1098 | 1109 | } |
1099 | 1110 | |
1100 | 1111 | END; |
1101 | | - $wgOut->addScript(' <script type="text/javascript">' . "\n" . $javascript_text . '</script>' . "\n"); |
| 1112 | + $wgOut->addScript(' <script type="text/javascript">' . "\n" . $javascript_text . '</script>' . "\n"); |
1102 | 1113 | |
1103 | 1114 | // set default |
1104 | 1115 | if ($sdgNumResultsPerPage == null) |
— | — | @@ -1108,12 +1119,12 @@ |
1109 | 1120 | // get information on current category, subcategory and filters that |
1110 | 1121 | // have already been applied from the query string |
1111 | 1122 | $category = str_replace('_', ' ', $wgRequest->getVal('_cat')); |
1112 | | - // if query string did not contain this variables, try the URL |
1113 | | - if (! $category) { |
1114 | | - $queryparts = explode('/', $query, 1); |
1115 | | - $category = isset($queryparts[0]) ? $queryparts[0] : ''; |
1116 | | - } |
| 1123 | + // if query string did not contain this variables, try the URL |
1117 | 1124 | if (! $category) { |
| 1125 | + $queryparts = explode('/', $query, 1); |
| 1126 | + $category = isset($queryparts[0]) ? $queryparts[0] : ''; |
| 1127 | + } |
| 1128 | + if (! $category) { |
1118 | 1129 | $category_title = wfMsg('browsedata'); |
1119 | 1130 | } else { |
1120 | 1131 | $titles_for_category = sdfGetValuesForProperty($category, NS_CATEGORY, SD_SP_HAS_DRILLDOWN_TITLE, false, NS_MAIN); |