Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | $code_type = 'code'; |
36 | 36 | $url_type = $datatypeLabels['_uri']; |
37 | 37 | $email_type = $datatypeLabels['_ema']; |
38 | | - $float_type = $datatypeLabels['_num']; |
| 38 | + $number_type = $datatypeLabels['_num']; |
39 | 39 | $bool_type = $datatypeLabels['_boo']; |
40 | 40 | $date_type = $datatypeLabels['_dat']; |
41 | 41 | $enum_type = 'enumeration'; // not a real type |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | $this->setSemanticTypeHook($code_type, false, array('SFFormInputs', 'textAreaHTML'), array()); |
47 | 47 | $this->setSemanticTypeHook($url_type, false, array('SFFormInputs', 'textEntryHTML'), array('field_type' => 'URL')); |
48 | 48 | $this->setSemanticTypeHook($email_type, false, array('SFFormInputs', 'textEntryHTML'), array('field_type' => 'email')); |
49 | | - $this->setSemanticTypeHook($float_type, false, array('SFFormInputs', 'textEntryHTML'), array('field_type' => 'float')); |
| 49 | + $this->setSemanticTypeHook($number_type, false, array('SFFormInputs', 'textEntryHTML'), array('field_type' => 'number')); |
50 | 50 | $this->setSemanticTypeHook($bool_type, false, array('SFFormInputs', 'checkboxHTML'), array()); |
51 | 51 | $this->setSemanticTypeHook($date_type, false, array('SFFormInputs', 'dateEntryHTML'), array()); |
52 | 52 | $this->setSemanticTypeHook($enum_type, false, array('SFFormInputs', 'dropdownHTML'), array()); |
— | — | @@ -611,7 +611,7 @@ |
612 | 612 | // the page, using <free_text> tags - once all the free text |
613 | 613 | // is known (at the end), it will get substituted in |
614 | 614 | if ($is_hidden) { |
615 | | - $new_text = SFFormUtils::hiddenFieldHTML('free_text', '<free_text>'); |
| 615 | + $new_text = SFFormUtils::hiddenFieldHTML('free_text', '!free_text!'); |
616 | 616 | } else { |
617 | 617 | if (! array_key_exists('rows', $field_args)) |
618 | 618 | $field_args['rows'] = 5; |
— | — | @@ -619,7 +619,7 @@ |
620 | 620 | $field_args['cols'] = 80; |
621 | 621 | $sfgTabIndex++; |
622 | 622 | $sfgFieldNum++; |
623 | | - list($new_text, $new_javascript_text) = SFFormInputs::textAreaHTML('<free_text>', 'free_text', false, ($form_is_disabled || $is_restricted), $field_args); |
| 623 | + list($new_text, $new_javascript_text) = SFFormInputs::textAreaHTML('!free_text!', 'free_text', false, ($form_is_disabled || $is_restricted), $field_args); |
624 | 624 | if (in_array('edittools', $free_text_components)) { |
625 | 625 | // borrowed from EditPage::showEditTools() |
626 | 626 | $options[] = 'parse'; |
— | — | @@ -636,7 +636,7 @@ |
637 | 637 | } |
638 | 638 | $free_text_was_included = true; |
639 | 639 | // add a similar placeholder to the data text |
640 | | - $data_text .= "<free_text>\n"; |
| 640 | + $data_text .= "!free_text!\n"; |
641 | 641 | } |
642 | 642 | |
643 | 643 | if ($template_name == '' || $field_name == '<freetext>') { |
— | — | @@ -709,6 +709,7 @@ |
710 | 710 | } |
711 | 711 | } |
712 | 712 | $year = $cur_value['year']; |
| 713 | + $hour = $minute = $second = $ampm24h = $timezone = null; |
713 | 714 | if (isset($cur_value['hour'])) $hour = $cur_value['hour']; |
714 | 715 | if (isset($cur_value['minute'])) $minute = $cur_value['minute']; |
715 | 716 | if (isset($cur_value['second'])) $second = $cur_value['second']; |
— | — | @@ -724,10 +725,14 @@ |
725 | 726 | $cur_value_in_template = "$year/$month/$day"; |
726 | 727 | } |
727 | 728 | // include whatever time information we have |
728 | | - if(isset($hour)) $cur_value_in_template .= " " . str_pad(intval(substr($hour,0,2)),2,'0',STR_PAD_LEFT) . ":" . str_pad(intval(substr($minute,0,2)),2,'0',STR_PAD_LEFT); |
729 | | - if(isset($second)) $cur_value_in_template .= ":" . str_pad(intval(substr($second,0,2)),2,'0',STR_PAD_LEFT); |
730 | | - if(isset($ampm24h)) $cur_value_in_template .= " $ampm24h"; |
731 | | - if(isset($timezone)) $cur_value_in_template .= " $timezone"; |
| 729 | + if (! is_null($hour)) |
| 730 | + $cur_value_in_template .= " " . str_pad(intval(substr($hour,0,2)),2,'0',STR_PAD_LEFT) . ":" . str_pad(intval(substr($minute,0,2)),2,'0',STR_PAD_LEFT); |
| 731 | + if (! is_null($second)) |
| 732 | + $cur_value_in_template .= ":" . str_pad(intval(substr($second,0,2)),2,'0',STR_PAD_LEFT); |
| 733 | + if (! is_null($ampm24h)) |
| 734 | + $cur_value_in_template .= " $ampm24h"; |
| 735 | + if (! is_null($timezone)) |
| 736 | + $cur_value_in_template .= " $timezone"; |
732 | 737 | } else { |
733 | 738 | $cur_value_in_template = ""; |
734 | 739 | } |
— | — | @@ -849,7 +854,7 @@ |
850 | 855 | // disabled inputs for some reason don't submit their value |
851 | 856 | if ($is_restricted && ! $wgUser->isAllowed('editrestrictedfields')) { |
852 | 857 | if ($field_name == 'free text' || $field_name == '<freetext>') { |
853 | | - $new_text .= SFFormUtils::hiddenFieldHTML('free_text', '<free_text>'); |
| 858 | + $new_text .= SFFormUtils::hiddenFieldHTML('free_text', '!free_text!'); |
854 | 859 | } else { |
855 | 860 | $new_text .= SFFormUtils::hiddenFieldHTML($input_name, $cur_value); |
856 | 861 | } |
— | — | @@ -1074,7 +1079,7 @@ |
1075 | 1080 | // if it wasn't included in the form definition, add the |
1076 | 1081 | // 'free text' input as a hidden field at the bottom |
1077 | 1082 | if (! $free_text_was_included) { |
1078 | | - $form_text .= SFFormUtils::hiddenFieldHTML('free_text', '<free_text>'); |
| 1083 | + $form_text .= SFFormUtils::hiddenFieldHTML('free_text', '!free_text!'); |
1079 | 1084 | } |
1080 | 1085 | // get free text, and add to page data, as well as retroactively |
1081 | 1086 | // inserting it into the form |
— | — | @@ -1100,7 +1105,7 @@ |
1101 | 1106 | } elseif ($wgRequest->getCheck('free_text')) { |
1102 | 1107 | $free_text = $wgRequest->getVal('free_text'); |
1103 | 1108 | if (! $free_text_was_included) { |
1104 | | - $data_text .= "<free_text>"; |
| 1109 | + $data_text .= "!free_text!"; |
1105 | 1110 | } |
1106 | 1111 | // or get it from the form definition |
1107 | 1112 | } elseif ($free_text_preload_page != null) { |
— | — | @@ -1113,7 +1118,7 @@ |
1114 | 1119 | $free_text = str_replace("<onlyinclude>",'', $free_text); |
1115 | 1120 | $free_text = str_replace("</onlyinclude>",'', $free_text); |
1116 | 1121 | $free_text = trim($free_text); |
1117 | | - $data_text = str_replace('<free_text>','<onlyinclude><free_text></onlyinclude>', $data_text); |
| 1122 | + $data_text = str_replace('!free_text!','<onlyinclude>!free_text!</onlyinclude>', $data_text); |
1118 | 1123 | } |
1119 | 1124 | // if the FCKeditor extension is installed, use that for the free text input |
1120 | 1125 | global $wgFCKEditorDir; |
— | — | @@ -1128,8 +1133,8 @@ |
1129 | 1134 | $free_text = Sanitizer::safeEncodeAttribute($free_text); |
1130 | 1135 | } |
1131 | 1136 | // now that we have it, substitute free text into the form and page |
1132 | | - $form_text = str_replace('<free_text>', $free_text, $form_text); |
1133 | | - $data_text = str_replace('<free_text>', $free_text, $data_text); |
| 1137 | + $form_text = str_replace('!free_text!', $free_text, $form_text); |
| 1138 | + $data_text = str_replace('!free_text!', $free_text, $data_text); |
1134 | 1139 | |
1135 | 1140 | // add a warning in, if we're editing an existing page and that page |
1136 | 1141 | // appears to not have been created with this form |