Index: trunk/extensions/SemanticDrilldown/specials/SD_CreateFilter.php |
— | — | @@ -8,30 +8,20 @@ |
9 | 9 | |
10 | 10 | if (!defined('MEDIAWIKI')) die(); |
11 | 11 | |
12 | | -global $IP; |
13 | | -require_once( "$IP/includes/SpecialPage.php" ); |
| 12 | +class SDCreateFilter extends SpecialPage { |
14 | 13 | |
15 | | -global $sdgSpecialPagesSpecialInit; |
16 | | -if ($sdgSpecialPagesSpecialInit) { |
17 | | - global $wgSpecialPages; |
18 | | - $wgSpecialPages['CreateFilter'] = 'SDCreateFilter'; |
| 14 | + /** |
| 15 | + * Constructor |
| 16 | + */ |
| 17 | + public function SDCreateFilter() { |
| 18 | + SpecialPage::SpecialPage('CreateFilter'); |
| 19 | + wfLoadExtensionMessages('SemanticDrilldown'); |
| 20 | + } |
19 | 21 | |
20 | | - class SDCreateFilter extends SpecialPage { |
21 | | - |
22 | | - /** |
23 | | - * Constructor |
24 | | - */ |
25 | | - public function __construct() { |
26 | | - smwfInitUserMessages(); |
27 | | - parent::__construct('CreateFilter', '', true); |
28 | | - } |
29 | | - |
30 | | - function execute() { |
31 | | - doSpecialCreateFilter(); |
32 | | - } |
| 22 | + function execute() { |
| 23 | + $this->setHeaders(); |
| 24 | + doSpecialCreateFilter(); |
33 | 25 | } |
34 | | -} else { |
35 | | - SpecialPage::addPage( new SpecialPage('CreateFilter','',true,'doSpecialCreateFilter',false) ); |
36 | 26 | } |
37 | 27 | |
38 | 28 | function createFilterText($property_string, $values_source, $category_used, $time_period, $filter_values, $required_filter, $filter_label) { |
— | — | @@ -42,18 +32,18 @@ |
43 | 33 | $smw_version = SMW_VERSION; |
44 | 34 | $property_tag = "[[" . $sd_props[SD_SP_COVERS_PROPERTY] . |
45 | 35 | "::$namespace:$property_name|$property_name]]"; |
46 | | - $text = wfMsg('sd_filter_coversproperty', $property_tag); |
| 36 | + $text = wfMsgForContent('sd_filter_coversproperty', $property_tag); |
47 | 37 | if ($values_source == 'category') { |
48 | 38 | global $wgContLang; |
49 | 39 | $namespace_labels = $wgContLang->getNamespaces(); |
50 | 40 | $category_namespace = $namespace_labels[NS_CATEGORY]; |
51 | 41 | $category_tag = "[[" . $sd_props[SD_SP_GETS_VALUES_FROM_CATEGORY] . "::$category_namespace:$category_used|$category_used]]"; |
52 | | - $text .= " " . wfMsg('sd_filter_getsvaluesfromcategory', $category_tag); |
| 42 | + $text .= " " . wfMsgForContent('sd_filter_getsvaluesfromcategory', $category_tag); |
53 | 43 | } elseif ($values_source == 'property') { |
54 | 44 | // do nothing |
55 | 45 | } elseif ($values_source == 'dates') { |
56 | 46 | $time_period_tag = "[[" . $sd_props[SD_SP_USES_TIME_PERIOD] . ":=$time_period]]"; |
57 | | - $text .= " " . wfMsg('sd_filter_usestimeperiod', $time_period_tag); |
| 47 | + $text .= " " . wfMsgForContent('sd_filter_usestimeperiod', $time_period_tag); |
58 | 48 | } elseif ($values_source == 'manual') { |
59 | 49 | // replace the comma substitution character that has no |
60 | 50 | // chance of being included in the values list - namely, |
— | — | @@ -70,17 +60,17 @@ |
71 | 61 | $filter_value = str_replace("\a", $sdgListSeparator, trim($filter_value)); |
72 | 62 | $filter_values_tag .= "[[" . $sd_props[SD_SP_HAS_VALUE] . ":=$filter_value]]"; |
73 | 63 | } |
74 | | - $text .= " " . wfMsg('sd_filter_hasvalues', $filter_values_tag); |
| 64 | + $text .= " " . wfMsgForContent('sd_filter_hasvalues', $filter_values_tag); |
75 | 65 | } |
76 | 66 | if ($required_filter != '') { |
77 | 67 | $sd_namespace_labels = $sdgContLang->getNamespaces(); |
78 | 68 | $filter_namespace = $sd_namespace_labels[SD_NS_FILTER]; |
79 | 69 | $filter_tag = "[[" . $sd_props[SD_SP_REQUIRES_FILTER] . "::$filter_namespace:$required_filter|$required_filter]]"; |
80 | | - $text .= " " . wfMsg('sd_filter_requiresfilter', $filter_tag); |
| 70 | + $text .= " " . wfMsgForContent('sd_filter_requiresfilter', $filter_tag); |
81 | 71 | } |
82 | 72 | if ($filter_label != '') { |
83 | 73 | $filter_label_tag = "[[" . $sd_props[SD_SP_HAS_LABEL] . ":=$filter_label]]"; |
84 | | - $text .= " " . wfMsg('sd_filter_haslabel', $filter_label_tag); |
| 74 | + $text .= " " . wfMsgForContent('sd_filter_haslabel', $filter_label_tag); |
85 | 75 | } |
86 | 76 | return $text; |
87 | 77 | } |
— | — | @@ -146,8 +136,12 @@ |
147 | 137 | $values_from_category_label = wfMsg('sd_createfilter_usecategoryvalues'); |
148 | 138 | $date_values_label = wfMsg('sd_createfilter_usedatevalues'); |
149 | 139 | $enter_values_label = wfMsg('sd_createfilter_entervalues'); |
| 140 | + // need both label and value, in case user's language is different |
| 141 | + // from wiki's |
150 | 142 | $year_label = wfMsg('sd_filter_year'); |
| 143 | + $year_value = wfMsgForContent('sd_filter_year'); |
151 | 144 | $month_label = wfMsg('sd_filter_month'); |
| 145 | + $month_value = wfMsgForContent('sd_filter_month'); |
152 | 146 | $require_filter_label = wfMsg('sd_createfilter_requirefilter'); |
153 | 147 | $text .=<<<END |
154 | 148 | </select> |
— | — | @@ -171,8 +165,8 @@ |
172 | 166 | <p><input type="radio" name="values_source" value="dates"> |
173 | 167 | $date_values_label |
174 | 168 | <select id="time_period_dropdown" name="time_period"> |
175 | | - <option>$year_label</option> |
176 | | - <option>$month_label</option> |
| 169 | + <option value="$year_value">$year_label</option> |
| 170 | + <option value="$month_value">$month_label</option> |
177 | 171 | </select> |
178 | 172 | </p> |
179 | 173 | <p><input type="radio" name="values_source" value="manual"> |