r44949 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44948‎ | r44949 | r44950 >
Date:16:22, 23 December 2008
Author:yaron
Status:deferred
Tags:
Comment:
Added 'year' input type and 'values from category' and 'values from concept'
field parameters; fixed handling of field names with spaces in them
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc
@@ -58,6 +58,7 @@
5959 $this->setInputTypeHook('date', array('SFFormInputs', 'dateEntryHTML'), array());
6060 $this->setInputTypeHook('datetime', array('SFFormInputs', 'dateTimeEntryHTML'), array('include_timezone' => false));
6161 $this->setInputTypeHook('datetime with timezone', array('SFFormInputs', 'dateTimeEntryHTML'), array('include_timezone' => true));
 62+ $this->setInputTypeHook('year', array('SFFormInputs', 'textEntryHTML'), array('size' => 4));
6263 $this->setInputTypeHook('checkbox', array('SFFormInputs', 'checkboxHTML'), array());
6364 $this->setInputTypeHook('radiobutton', array('SFFormInputs', 'radioButtonHTML'), array());
6465 $this->setInputTypeHook('checkboxes', array('SFFormInputs', 'checkboxesHTML'), array());
@@ -453,6 +454,10 @@
454455 }
455456 } elseif ($sub_components[0] == 'values') {
456457 $possible_values = explode(',', $sub_components[1]);
 458+ } elseif ($sub_components[0] == 'values from category') {
 459+ $possible_values = SFAutocompleteUtils::getAllPagesForCategory($sub_components[1], 10);
 460+ } elseif ($sub_components[0] == 'values from concept') {
 461+ $possible_values = SFAutocompleteUtils::getAllPagesForConcept($sub_components[1]);
457462 } else {
458463 $field_args[$sub_components[0]] = $sub_components[1];
459464 }
@@ -635,7 +640,8 @@
636641 if ($form_submitted && $generated_page_name != '') {
637642 $generated_page_name = str_replace('.', '_', $generated_page_name);
638643 $generated_page_name = str_replace(' ', '_', $generated_page_name);
639 - $generated_page_name = str_ireplace("<$input_name>", $cur_value_in_template, $generated_page_name);
 644+ $escaped_input_name = str_replace(' ', '_', $input_name);
 645+ $generated_page_name = str_ireplace("<$escaped_input_name>", $cur_value_in_template, $generated_page_name);
640646 // once the substitution is done, replace underlines back
641647 // with spaces
642648 $generated_page_name = str_replace('_', ' ', $generated_page_name);
@@ -672,7 +678,7 @@
673679 $day = date("j", $cur_time);
674680 global $wgAmericanDates, $sfg24HourTime;
675681 if ($wgAmericanDates == true) {
676 - $month_names = sffGetMonthNames();
 682+ $month_names = SFFormUtils::getMonthNames();
677683 $month_name = $month_names[$month - 1];
678684 $cur_value_in_template = "$month_name $day, $year";
679685 } else {

Status & tagging log