r44207 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44206‎ | r44207 | r44208 >
Date:00:42, 4 December 2008
Author:yaron
Status:deferred
Tags:
Comment:
Added handling for new 'Has input type' property
Modified paths:
  • /trunk/extensions/SemanticDrilldown/specials/SD_CreateFilter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticDrilldown/specials/SD_CreateFilter.php
@@ -24,12 +24,11 @@
2525 }
2626 }
2727
28 -function createFilterText($property_string, $values_source, $category_used, $time_period, $filter_values, $required_filter, $filter_label) {
 28+function createFilterText($property_string, $values_source, $category_used, $time_period, $filter_values, $input_type, $required_filter, $filter_label) {
2929 global $sdgContLang;
3030
3131 list($namespace, $property_name) = explode(",", $property_string, 2);
3232 $sd_props = $sdgContLang->getSpecialPropertiesArray();
33 - $smw_version = SMW_VERSION;
3433 $property_tag = "[[" . $sd_props[SD_SP_COVERS_PROPERTY] .
3534 "::$namespace:$property_name|$property_name]]";
3635 $text = wfMsgForContent('sd_filter_coversproperty', $property_tag);
@@ -62,6 +61,10 @@
6362 }
6463 $text .= " " . wfMsgForContent('sd_filter_hasvalues', $filter_values_tag);
6564 }
 65+ if ($input_type != '') {
 66+ $input_type_tag = "[[" . $sd_props[SD_SP_HAS_INPUT_TYPE] . "::$input_type]]";
 67+ $text .= " " . wfMsgForContent('sd_filter_hasinputtype', "\"$input_type_tag\"");
 68+ }
6669 if ($required_filter != '') {
6770 $sd_namespace_labels = $sdgContLang->getNamespaces();
6871 $filter_namespace = $sd_namespace_labels[SD_NS_FILTER];
@@ -85,6 +88,7 @@
8689 $category_name = $wgRequest->getVal('category_name');
8790 $time_period = $wgRequest->getVal('time_period');
8891 $filter_values = $wgRequest->getVal('filter_values');
 92+ $input_type = $wgRequest->getVal('input_type');
8993 $required_filter = $wgRequest->getVal('required_filter');
9094 $filter_label = $wgRequest->getVal('filter_label');
9195
@@ -101,7 +105,7 @@
102106 # redirect to wiki interface
103107 $namespace = SD_NS_FILTER;
104108 $title = Title::newFromText($filter_name, $namespace);
105 - $full_text = createFilterText($property_name, $values_source, $category_name, $time_period, $filter_values, $required_filter, $filter_label);
 109+ $full_text = createFilterText($property_name, $values_source, $category_name, $time_period, $filter_values, $input_type, $required_filter, $filter_label);
106110 // HTML-encode
107111 $full_text = str_replace('"', '"', $full_text);
108112 $text = sdfPrintRedirectForm($title, $full_text, "", $save_page, $preview_page, false, false, false);
@@ -142,6 +146,13 @@
143147 $year_value = wfMsgForContent('sd_filter_year');
144148 $month_label = wfMsg('sd_filter_month');
145149 $month_value = wfMsgForContent('sd_filter_month');
 150+ $input_type_label = wfMsg('sd_createfilter_inputtype');
 151+ $values_list_label = wfMsg('sd_createfilter_listofvalues');
 152+ // same as for time values
 153+ $free_text_label = wfMsg('sd_filter_freetext');
 154+ $free_text_value = wfMsgForContent('sd_filter_freetext');
 155+ $date_range_label = wfMsg('sd_filter_daterange');
 156+ $date_range_value = wfMsgForContent('sd_filter_daterange');
146157 $require_filter_label = wfMsg('sd_createfilter_requirefilter');
147158 $text .=<<<END
148159 </select>
@@ -172,6 +183,13 @@
173184 <p><input type="radio" name="values_source" value="manual">
174185 $enter_values_label <input size="40" name="filter_values" value="">
175186 </p>
 187+ <p>$input_type_label
 188+ <select id="input_type_dropdown" name="input_type">
 189+ <option value="">$values_list_label</option>
 190+ <option value="$free_text_value">$free_text_label</option>
 191+ <option value="$date_range_value">$date_range_label</option>
 192+ </select>
 193+ </p>
176194 <p>$require_filter_label
177195 <select id="required_filter_dropdown" name="required_filter">
178196 <option />

Status & tagging log