r93464 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93463‎ | r93464 | r93465 >
Date:16:13, 29 July 2011
Author:ankitgarg833
Status:deferred
Tags:
Comment:
adding function getHtmlTextForPS, which returns filter creation html code to PageSchema extension.
Modified paths:
  • /trunk/extensions/SemanticDrilldown/includes/SD_Utils.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticDrilldown/includes/SD_Utils.php
@@ -35,7 +35,80 @@
3636 }
3737 return true;
3838 }
 39+
 40+ public static function getHtmlTextForPS( &$js_extensions ,&$text_extensions ) {
 41+ global $wgContLang;
 42+
 43+ $text = "";
 44+ $text .= '<p><legend>semanticDrillDown:Filter</legend> </p>';
 45+ $name_label = wfMsg( 'sd_createfilter_name' );
 46+ $property_label = wfMsg( 'sd_createfilter_property' );
 47+ $label_label = wfMsg( 'sd_createfilter_label' );
 48+ $text .= <<<END
 49+ <p>$name_label <input size="25" name="sd_filter_name_starter" value=""></p>
 50+END;
3951
 52+ $values_from_property_label = wfMsg( 'sd_createfilter_usepropertyvalues' );
 53+ $values_from_category_label = wfMsg( 'sd_createfilter_usecategoryvalues' );
 54+ $date_values_label = wfMsg( 'sd_createfilter_usedatevalues' );
 55+ $enter_values_label = wfMsg( 'sd_createfilter_entervalues' );
 56+ // need both label and value, in case user's language is different
 57+ // from wiki's
 58+ $year_label = wfMsg( 'sd_filter_year' );
 59+ $year_value = wfMsgForContent( 'sd_filter_year' );
 60+ $month_label = wfMsg( 'sd_filter_month' );
 61+ $month_value = wfMsgForContent( 'sd_filter_month' );
 62+ $input_type_label = wfMsg( 'sd_createfilter_inputtype' );
 63+ $values_list_label = wfMsg( 'sd_createfilter_listofvalues' );
 64+ // same as for time values
 65+ $combo_box_label = wfMsg( 'sd_filter_combobox' );
 66+ $combo_box_value = wfMsgForContent( 'sd_filter_combobox' );
 67+ $date_range_label = wfMsg( 'sd_filter_daterange' );
 68+ $date_range_value = wfMsgForContent( 'sd_filter_daterange' );
 69+ $require_filter_label = wfMsg( 'sd_createfilter_requirefilter' );
 70+ $text .= <<<END
 71+
 72+ <p><input type="radio" name="sd_values_source_starter" checked value="property">
 73+ $values_from_property_label
 74+ </p>
 75+ <p><input type="radio" name="sd_values_source_starter" value="category">
 76+ $values_from_category_label
 77+ <select id="category_dropdown" name="sd_category_name_starter">
 78+
 79+END;
 80+
 81+ $categories = SDUtils::getTopLevelCategories();
 82+ foreach ( $categories as $category ) {
 83+ $category = str_replace( '_', ' ', $category );
 84+ $text .= " <option>$category</option>\n";
 85+ }
 86+ $text .= <<<END
 87+ </select>
 88+ </p>
 89+ <p><input type="radio" name="sd_values_source_starter" value="dates">
 90+ $date_values_label
 91+ <select id="time_period_dropdown" name="sd_time_period_starter">
 92+ <option value="$year_value">$year_label</option>
 93+ <option value="$month_value">$month_label</option>
 94+ </select>
 95+ </p>
 96+ <p><input type="radio" name="sd_values_source_starter" value="manual">
 97+ $enter_values_label <input size="40" name="sd_filter_values_starter" value="">
 98+ </p>
 99+ <p>$input_type_label
 100+ <select id="input_type_dropdown" name="sd_input_type_starter">
 101+ <option value="">$values_list_label</option>
 102+ <option value="$combo_box_value">$combo_box_label</option>
 103+ <option value="$date_range_value">$date_range_label</option>
 104+ </select>
 105+ </p>
 106+
 107+
 108+END;
 109+
 110+ $text_extensions['sd'] = $text;
 111+ return true;
 112+ }
40113 /**
41114 *Thi Function parses the Field elements in the xml of the pages. Hooks for PageSchemas extension
42115 */