Index: trunk/extensions/SemanticFormsInputs/SemanticFormsInputs.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | * @author Jeroen de Dauw |
11 | 11 | * @author Sanyam Goyal |
12 | 12 | * |
13 | | - * @version 0.5 |
| 13 | + * @version 0.6 alpha |
14 | 14 | */ |
15 | 15 | |
16 | 16 | /** |
— | — | @@ -23,15 +23,19 @@ |
24 | 24 | die( 'This file is part of a MediaWiki extension, it is not a valid entry point.' ); |
25 | 25 | } |
26 | 26 | |
| 27 | +if ( version_compare( $wgVersion, '1.17', 'lt' ) ) { |
| 28 | + die( '<b>Error:</b> This version of <a href="https://www.mediawiki.org/wiki/Extension:Semantic_Forms_Inputs">Semantic Forms Inputs</a> is only compatible with MediaWiki 1.17 or above. You need to upgrade MediaWiki first.' ); |
| 29 | +} |
| 30 | + |
27 | 31 | if ( !defined( 'SF_VERSION' ) ) { |
28 | 32 | die( '<b>Error:</b> <a href="https://www.mediawiki.org/wiki/Extension:Semantic_Forms_Inputs">Semantic Forms Inputs</a> is a Semantic Forms extension. You need to install <a href="https://www.mediawiki.org/wiki/Extension:Semantic_Forms">Semantic Forms</a> first.' ); |
29 | 33 | } |
30 | 34 | |
31 | | -if ( version_compare( SF_VERSION, '2.3.1', 'lt' ) ) { |
32 | | - die( '<b>Error:</b> This version of <a href="https://www.mediawiki.org/wiki/Extension:Semantic_Forms_Inputs">Semantic Forms Inputs</a> is only compatible with Semantic Forms 2.3.1 or above. You need to upgrade <a href="https://www.mediawiki.org/wiki/Extension:Semantic_Forms">Semantic Forms</a> first.' ); |
| 35 | +if ( version_compare( SF_VERSION, '2.4.1-alpha', 'lt' ) ) { |
| 36 | + die( '<b>Error:</b> This version of <a href="https://www.mediawiki.org/wiki/Extension:Semantic_Forms_Inputs">Semantic Forms Inputs</a> is only compatible with Semantic Forms 2.4.1 or above. You need to upgrade <a href="https://www.mediawiki.org/wiki/Extension:Semantic_Forms">Semantic Forms</a> first.' ); |
33 | 37 | } |
34 | 38 | |
35 | | -define( 'SFI_VERSION', '0.5' ); |
| 39 | +define( 'SFI_VERSION', '0.6 alpha' ); |
36 | 40 | |
37 | 41 | // create and initialize settings |
38 | 42 | $sfigSettings = new SFISettings(); |
— | — | @@ -61,6 +65,55 @@ |
62 | 66 | $wgAutoloadClasses['SFIMenuSelect'] = $dir . '/includes/SFI_MenuSelect.php'; |
63 | 67 | $wgAutoloadClasses['SFIRegExp'] = $dir . '/includes/SFI_RegExp.php'; |
64 | 68 | |
| 69 | +$wgResourceModules['ext.semanticformsinputs.datepicker'] = array( |
| 70 | + 'localBasePath' => $dir, |
| 71 | + 'remoteExtPath' => 'SemanticFormsInputs', |
| 72 | + 'scripts' => 'libs/datepicker.js', |
| 73 | + 'dependencies' => array( |
| 74 | + 'jquery.ui.datepicker', |
| 75 | + 'ext.semanticforms.main' |
| 76 | + ), |
| 77 | +); |
| 78 | + |
| 79 | +$wgResourceModules['ext.semanticformsinputs.timepicker'] = array( |
| 80 | + 'localBasePath' => $dir, |
| 81 | + 'remoteExtPath' => 'SemanticFormsInputs', |
| 82 | + 'scripts' => 'libs/timepicker.js', |
| 83 | + 'styles' => 'skins/SFI_Timepicker.css', |
| 84 | + 'dependencies' => array( |
| 85 | + 'ext.semanticforms.main' |
| 86 | + ), |
| 87 | +); |
| 88 | + |
| 89 | +$wgResourceModules['ext.semanticformsinputs.datetimepicker'] = array( |
| 90 | + 'localBasePath' => $dir, |
| 91 | + 'remoteExtPath' => 'SemanticFormsInputs', |
| 92 | + 'scripts' => 'libs/datetimepicker.js', |
| 93 | + 'dependencies' => array( |
| 94 | + 'ext.semanticformsinputs.timepicker', |
| 95 | + 'ext.semanticformsinputs.datepicker' |
| 96 | + ), |
| 97 | +); |
| 98 | + |
| 99 | +$wgResourceModules['ext.semanticformsinputs.menuselect'] = array( |
| 100 | + 'localBasePath' => $dir, |
| 101 | + 'remoteExtPath' => 'SemanticFormsInputs', |
| 102 | + 'scripts' => 'libs/menuselect.js', |
| 103 | + 'styles' => 'skins/SFI_Menuselect.css', |
| 104 | + 'dependencies' => array( |
| 105 | + 'ext.semanticforms.main' |
| 106 | + ), |
| 107 | +); |
| 108 | + |
| 109 | +$wgResourceModules['ext.semanticformsinputs.regexp'] = array( |
| 110 | + 'localBasePath' => $dir, |
| 111 | + 'remoteExtPath' => 'SemanticFormsInputs', |
| 112 | + 'scripts' => 'libs/regexp.js', |
| 113 | + 'dependencies' => array( |
| 114 | + 'ext.semanticforms.main' |
| 115 | + ), |
| 116 | +); |
| 117 | + |
65 | 118 | /** |
66 | 119 | * Class to encapsulate all settings |
67 | 120 | */ |
Index: trunk/extensions/SemanticFormsInputs/includes/SFI_DateTimePicker.php |
— | — | @@ -40,8 +40,6 @@ |
41 | 41 | |
42 | 42 | parent::__construct( $input_number, $cur_value, $input_name, $disabled, $other_args ); |
43 | 43 | |
44 | | - self::setup(); |
45 | | - |
46 | 44 | // prepare sub-inputs |
47 | 45 | |
48 | 46 | $this->mOtherArgs["part of dtp"] = true; |
— | — | @@ -97,26 +95,6 @@ |
98 | 96 | return 'datetimepicker'; |
99 | 97 | } |
100 | 98 | |
101 | | - /** |
102 | | - * Static setup method for input type "menuselect". |
103 | | - * Adds the Javascript code and css used by all menuselects. |
104 | | - */ |
105 | | - static private function setup() { |
106 | | - |
107 | | - global $wgOut; |
108 | | - global $sfigSettings; |
109 | | - |
110 | | - static $hasRun = false; |
111 | | - |
112 | | - if ( !$hasRun ) { |
113 | | - $hasRun = true; |
114 | | - |
115 | | - $wgOut->addScript( '<script type="text/javascript" src="' . $sfigSettings->scriptPath . '/libs/datetimepicker.js"></script> ' ); |
116 | | - |
117 | | - } |
118 | | - |
119 | | - } |
120 | | - |
121 | 99 | protected function setupJsInitAttribs() { |
122 | 100 | |
123 | 101 | global $sfigSettings; |
— | — | @@ -194,24 +172,13 @@ |
195 | 173 | |
196 | 174 | /** |
197 | 175 | * Returns the set of parameters for this form input. |
198 | | - * |
199 | | - * TODO: Specify parameters specific for menuselect. |
200 | 176 | */ |
201 | 177 | public static function getParameters() { |
202 | | - $params = parent::getParameters(); |
203 | | - |
204 | | - $params[] = array( |
205 | | - 'name' => 'structure', |
206 | | - 'type' => 'text', |
207 | | - 'description' => wfMsg( 'semanticformsinputs-menuselect-structure' ), |
208 | | - 'default' => "* item 1\n** item 11\n** item 12\n* item 2\n** item 21\n** item 22" |
| 178 | + return array_merge( |
| 179 | + parent::getParameters(), |
| 180 | + SFIDatePicker::getParameters(), |
| 181 | + SFITimePicker::getParameters() |
209 | 182 | ); |
210 | | - $params[] = array( |
211 | | - 'name' => $sfigSettings->menuSelectDisableInputField?'enable input field':'disable input field', |
212 | | - 'type' => 'boolean', |
213 | | - 'description' => wfMsg( 'semanticformsinputs-menuselect-enableinputfield' ), |
214 | | - ); |
215 | | - return $params; |
216 | 183 | } |
217 | 184 | |
218 | 185 | /** |
— | — | @@ -227,4 +194,16 @@ |
228 | 195 | |
229 | 196 | } |
230 | 197 | |
| 198 | + /** |
| 199 | + * Returns the names of the resource modules this input type uses. |
| 200 | + * |
| 201 | + * Returns the names of the modules as an array or - if there is only one |
| 202 | + * module - as a string. |
| 203 | + * |
| 204 | + * @return null|string|array |
| 205 | + */ |
| 206 | + public function getResourceModuleNames() { |
| 207 | + return 'ext.semanticformsinputs.datetimepicker'; |
| 208 | + } |
| 209 | + |
231 | 210 | } |
Index: trunk/extensions/SemanticFormsInputs/includes/SFI_RegExp.php |
— | — | @@ -42,9 +42,6 @@ |
43 | 43 | |
44 | 44 | parent::__construct( $input_number, $cur_value, $input_name, $disabled, $other_args ); |
45 | 45 | |
46 | | - // call static setup |
47 | | - self::setup(); |
48 | | - |
49 | 46 | // set OR character |
50 | 47 | if ( array_key_exists( 'or char', $this->mOtherArgs ) ) { |
51 | 48 | $orChar = trim( $this->mOtherArgs['or char'] ); |
— | — | @@ -53,7 +50,6 @@ |
54 | 51 | $orChar = '!'; |
55 | 52 | } |
56 | 53 | |
57 | | - |
58 | 54 | // set regexp string |
59 | 55 | if ( array_key_exists( 'regexp', $this->mOtherArgs ) ) { |
60 | 56 | |
— | — | @@ -151,20 +147,23 @@ |
152 | 148 | } |
153 | 149 | |
154 | 150 | /** |
155 | | - * Static setup method for input type "menuselect". |
156 | | - * Adds the Javascript code and css used by all menuselects. |
| 151 | + * Returns the names of the resource modules this input type uses. |
| 152 | + * |
| 153 | + * Returns the names of the modules as an array or - if there is only one |
| 154 | + * module - as a string. |
| 155 | + * |
| 156 | + * @return null|string|array |
157 | 157 | */ |
158 | | - static private function setup() { |
159 | | - |
160 | | - global $wgOut; |
161 | | - global $sfigSettings; |
162 | | - |
163 | | - static $hasRun = false; |
164 | | - |
165 | | - if ( !$hasRun ) { |
166 | | - $hasRun = true; |
167 | | - $wgOut->addScript( '<script type="text/javascript" src="' . $sfigSettings->scriptPath . '/libs/regexp.js"></script> ' ); |
| 158 | + public function getResourceModuleNames() { |
| 159 | + $modules = $this->mBaseInput->getResourceModuleNames(); |
| 160 | + if ( is_array( $modules ) ) { |
| 161 | + return array_merge( $modules, array( 'ext.semanticformsinputs.regexp' )); |
| 162 | + } elseif ( is_string( $modules ) ) { |
| 163 | + return array( $modules, 'ext.semanticformsinputs.regexp' ); |
| 164 | + } else { |
| 165 | + return 'ext.semanticformsinputs.regexp'; |
168 | 166 | } |
| 167 | + |
169 | 168 | } |
170 | 169 | |
171 | 170 | /** |
— | — | @@ -172,38 +171,37 @@ |
173 | 172 | */ |
174 | 173 | public static function getParameters() { |
175 | 174 | $params = parent::getParameters(); |
176 | | - $params[] = array( |
| 175 | + $params['regexp'] = array( |
177 | 176 | 'name' => 'regexp', |
178 | 177 | 'type' => 'string', |
179 | 178 | 'description' => wfMsg( 'semanticformsinputs-regexp-regexp' ) |
180 | 179 | ); |
181 | | - $params[] = array( |
| 180 | + $params['base type'] = array( |
182 | 181 | 'name' => 'base type', |
183 | 182 | 'type' => 'string', |
184 | 183 | 'description' => wfMsg( 'semanticformsinputs-regexp-basetype' ) |
185 | 184 | ); |
186 | | - $params[] = array( |
| 185 | + $params['base prefix'] = array( |
187 | 186 | 'name' => 'base prefix', |
188 | 187 | 'type' => 'string', |
189 | 188 | 'description' => wfMsg( 'semanticformsinputs-regexp-baseprefix' ) |
190 | 189 | ); |
191 | | - $params[] = array( |
| 190 | + $params['or char'] = array( |
192 | 191 | 'name' => 'or char', |
193 | 192 | 'type' => 'string', |
194 | 193 | 'description' => wfMsg( 'semanticformsinputs-regexp-orchar' ) |
195 | 194 | ); |
196 | | - $params[] = array( |
| 195 | + $params['inverse'] = array( |
197 | 196 | 'name' => 'inverse', |
198 | 197 | 'type' => 'string', |
199 | 198 | 'description' => wfMsg( 'semanticformsinputs-regexp-inverse' ) |
200 | 199 | ); |
201 | | - $params[] = array( |
| 200 | + $params['message'] = array( |
202 | 201 | 'name' => 'message', |
203 | 202 | 'type' => 'string', |
204 | 203 | 'description' => wfMsg( 'semanticformsinputs-regexp-message' ) |
205 | 204 | ); |
206 | 205 | |
207 | | - |
208 | 206 | return $params; |
209 | 207 | } |
210 | 208 | |
Index: trunk/extensions/SemanticFormsInputs/includes/SFI_DatePicker.php |
— | — | @@ -56,28 +56,40 @@ |
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
| 60 | + * Returns the names of the resource modules this input type uses. |
| 61 | + * |
| 62 | + * Returns the names of the modules as an array or - if there is only one |
| 63 | + * module - as a string. |
| 64 | + * |
| 65 | + * @return null|string|array |
| 66 | + */ |
| 67 | + public function getResourceModuleNames() { |
| 68 | + return 'ext.semanticformsinputs.datepicker'; |
| 69 | + } |
| 70 | + |
| 71 | + /** |
60 | 72 | * Static setup method for input type "menuselect". |
61 | 73 | * Adds the Javascript code and css used by all menuselects. |
62 | 74 | */ |
63 | 75 | static private function setup() { |
64 | 76 | |
65 | 77 | global $wgOut, $wgLang; |
66 | | - global $sfgScriptPath, $sfigSettings; |
| 78 | +// global $sfgScriptPath, $sfigSettings; |
67 | 79 | |
68 | 80 | static $hasRun = false; |
69 | 81 | |
70 | 82 | if ( !$hasRun ) { |
71 | 83 | $hasRun = true; |
72 | 84 | |
73 | | - $wgOut->addExtensionStyle( $sfgScriptPath . '/skins/jquery-ui/base/jquery.ui.datepicker.css' ); |
74 | | - $wgOut->addExtensionStyle( $sfgScriptPath . '/skins/jquery-ui/base/jquery.ui.theme.css' ); |
75 | | - $wgOut->addScript( '<script type="text/javascript" src="' . $sfgScriptPath . '/libs/jquery-ui/jquery.ui.datepicker.min.js"></script> ' ); |
76 | | - $wgOut->addScript( '<script type="text/javascript" src="' . $sfigSettings->scriptPath . '/libs/datepicker.js"></script> ' ); |
| 85 | +// $wgOut->addExtensionStyle( $sfgScriptPath . '/skins/jquery-ui/base/jquery.ui.datepicker.css' ); |
| 86 | +// $wgOut->addExtensionStyle( $sfgScriptPath . '/skins/jquery-ui/base/jquery.ui.theme.css' ); |
| 87 | +// $wgOut->addScript( '<script type="text/javascript" src="' . $sfgScriptPath . '/libs/jquery-ui/jquery.ui.datepicker.min.js"></script> ' ); |
| 88 | +// $wgOut->addScript( '<script type="text/javascript" src="' . $sfigSettings->scriptPath . '/libs/datepicker.js"></script> ' ); |
77 | 89 | |
78 | 90 | // set localized messages (use MW i18n, not jQuery i18n) |
79 | 91 | $jstext = |
80 | | - "jQuery(function(){\n" |
81 | | - . " jQuery.datepicker.regional['wiki'] = {\n" |
| 92 | +// "mw.loader.using('ext.semanticformsinputs.datepicker', function(){\n" . |
| 93 | + " jQuery.datepicker.regional['wiki'] = {\n" |
82 | 94 | . " closeText: '" . Xml::escapeJsString( wfMsg( 'semanticformsinputs-close' ) ) . "',\n" |
83 | 95 | . " prevText: '" . Xml::escapeJsString( wfMsg( 'semanticformsinputs-prev' ) ) . "',\n" |
84 | 96 | . " nextText: '" . Xml::escapeJsString( wfMsg( 'semanticformsinputs-next' ) ) . "',\n" |
— | — | @@ -138,8 +150,8 @@ |
139 | 151 | . " isRTL: " . ( $wgLang->isRTL() ? "true" : "false" ) . ",\n" |
140 | 152 | . " showMonthAfterYear: false,\n" |
141 | 153 | . " yearSuffix: ''};\n" |
142 | | - . " jQuery.datepicker.setDefaults(jQuery.datepicker.regional['wiki']);\n" |
143 | | - . "});\n"; |
| 154 | + . " jQuery.datepicker.setDefaults(jQuery.datepicker.regional['wiki']);\n"; |
| 155 | +// . "});\n"; |
144 | 156 | |
145 | 157 | $wgOut->addScript( Html::inlineScript( $jstext ) ); |
146 | 158 | |
— | — | @@ -607,57 +619,57 @@ |
608 | 620 | global $sfigSettings; |
609 | 621 | |
610 | 622 | $params = parent::getParameters(); |
611 | | - $params[] = array( |
| 623 | + $params['date format'] = array( |
612 | 624 | 'name' => 'date format', |
613 | 625 | 'type' => 'string', |
614 | 626 | 'description' => wfMsg( 'semanticformsinputs-datepicker-dateformat' ) |
615 | 627 | ); |
616 | | - $params[] = array( |
| 628 | + $params['week start'] = array( |
617 | 629 | 'name' => 'week start', |
618 | 630 | 'type' => 'int', |
619 | 631 | 'description' => wfMsg( 'semanticformsinputs-datepicker-weekstart' ) |
620 | 632 | ); |
621 | | - $params[] = array( |
| 633 | + $params['first date'] = array( |
622 | 634 | 'name' => 'first date', |
623 | 635 | 'type' => 'string', |
624 | 636 | 'description' => wfMsg( 'semanticformsinputs-datepicker-firstdate' ) |
625 | 637 | ); |
626 | | - $params[] = array( |
| 638 | + $params['last date'] = array( |
627 | 639 | 'name' => 'last date', |
628 | 640 | 'type' => 'string', |
629 | 641 | 'description' => wfMsg( 'semanticformsinputs-datepicker-lastdate' ) |
630 | 642 | ); |
631 | | - $params[] = array( |
| 643 | + $params['disable days of week'] = array( |
632 | 644 | 'name' => 'disable days of week', |
633 | 645 | 'type' => 'string', |
634 | 646 | 'description' => wfMsg( 'semanticformsinputs-datepicker-disabledaysofweek' ) |
635 | 647 | ); |
636 | | - $params[] = array( |
| 648 | + $params['highlight days of week'] = array( |
637 | 649 | 'name' => 'highlight days of week', |
638 | 650 | 'type' => 'string', |
639 | 651 | 'description' => wfMsg( 'semanticformsinputs-datepicker-highlightdaysofweek' ) |
640 | 652 | ); |
641 | | - $params[] = array( |
| 653 | + $params['disable dates'] = array( |
642 | 654 | 'name' => 'disable dates', |
643 | 655 | 'type' => 'string', |
644 | 656 | 'description' => wfMsg( 'semanticformsinputs-datepicker-disabledates' ) |
645 | 657 | ); |
646 | | - $params[] = array( |
| 658 | + $params['highlight days of week'] = array( |
647 | 659 | 'name' => 'highlight days of week', |
648 | 660 | 'type' => 'string', |
649 | 661 | 'description' => wfMsg( 'semanticformsinputs-datepicker-highlightdates' ) |
650 | 662 | ); |
651 | | - $params[] = array( |
| 663 | + $params[$sfigSettings->datePickerShowWeekNumbers?'hide week numbers':'show week numbers'] = array( |
652 | 664 | 'name' => $sfigSettings->datePickerShowWeekNumbers?'hide week numbers':'show week numbers', |
653 | 665 | 'type' => 'boolean', |
654 | 666 | 'description' => wfMsg( 'semanticformsinputs-datepicker-showweeknumbers' ) |
655 | 667 | ); |
656 | | - $params[] = array( |
| 668 | + $params[$sfigSettings->datePickerDisableInputField?'enable input field':'disable input field'] = array( |
657 | 669 | 'name' => $sfigSettings->datePickerDisableInputField?'enable input field':'disable input field', |
658 | 670 | 'type' => 'boolean', |
659 | 671 | 'description' => wfMsg( 'semanticformsinputs-datepicker-enableinputfield' ) |
660 | 672 | ); |
661 | | - $params[] = array( |
| 673 | + $params[$sfigSettings->datePickerShowResetButton?'hide reset button':'show reset button'] = array( |
662 | 674 | 'name' => $sfigSettings->datePickerShowResetButton?'hide reset button':'show reset button', |
663 | 675 | 'type' => 'boolean', |
664 | 676 | 'description' => wfMsg( 'semanticformsinputs-datepicker-showresetbutton' ) |
Index: trunk/extensions/SemanticFormsInputs/includes/SFI_TimePicker.php |
— | — | @@ -37,12 +37,6 @@ |
38 | 38 | |
39 | 39 | parent::__construct( $input_number, $cur_value, $input_name, $disabled, $other_args ); |
40 | 40 | |
41 | | - // third: if the timepicker is not disabled set up JS attributes ans assemble JS call |
42 | | - if ( !$this->mIsDisabled ) { |
43 | | - |
44 | | - self::setup(); |
45 | | - } |
46 | | - |
47 | 41 | $this->addJsInitFunctionData( 'SFI_TP_init', $this->setupJsInitAttribs() ); |
48 | 42 | |
49 | 43 | } |
— | — | @@ -60,27 +54,6 @@ |
61 | 55 | } |
62 | 56 | |
63 | 57 | /** |
64 | | - * Static setup method for input type "menuselect". |
65 | | - * Adds the Javascript code and css used by all menuselects. |
66 | | - */ |
67 | | - static private function setup() { |
68 | | - |
69 | | - global $wgOut; |
70 | | - global $sfigSettings; |
71 | | - |
72 | | - static $hasRun = false; |
73 | | - |
74 | | - if ( !$hasRun ) { |
75 | | - $hasRun = true; |
76 | | - |
77 | | - $wgOut->addScript( '<script type="text/javascript" src="' . $sfigSettings->scriptPath . '/libs/timepicker.js"></script> ' ); |
78 | | - $wgOut->addExtensionStyle( $sfigSettings->scriptPath . '/skins/SFI_Timepicker.css' ); |
79 | | - |
80 | | - } |
81 | | - |
82 | | - } |
83 | | - |
84 | | - /** |
85 | 58 | * Set up JS attributes |
86 | 59 | * |
87 | 60 | * @return String |
— | — | @@ -174,12 +147,7 @@ |
175 | 148 | |
176 | 149 | global $sfigSettings; |
177 | 150 | |
178 | | - // The timepicker is created in four steps: |
179 | 151 | // first: set up HTML attributes |
180 | | - // second: assemble HTML |
181 | | - |
182 | | - |
183 | | - // first: set up HTML attributes |
184 | 152 | $inputFieldDisabled = |
185 | 153 | array_key_exists( 'disable input field', $this->mOtherArgs ) |
186 | 154 | || ( !array_key_exists( 'enable input field', $this->mOtherArgs ) && $sfigSettings->timePickerDisableInputField ) |
— | — | @@ -215,27 +183,27 @@ |
216 | 184 | global $sfigSettings; |
217 | 185 | |
218 | 186 | $params = parent::getParameters(); |
219 | | - $params[] = array( |
| 187 | + $params['mintime'] = array( |
220 | 188 | 'name' => 'mintime', |
221 | 189 | 'type' => 'string', |
222 | 190 | 'description' => wfMsg( 'semanticformsinputs-timepicker-mintime' ), |
223 | 191 | ); |
224 | | - $params[] = array( |
| 192 | + $params['maxtime'] = array( |
225 | 193 | 'name' => 'maxtime', |
226 | 194 | 'type' => 'string', |
227 | 195 | 'description' => wfMsg( 'semanticformsinputs-timepicker-maxtime' ), |
228 | 196 | ); |
229 | | - $params[] = array( |
| 197 | + $params['interval'] = array( |
230 | 198 | 'name' => 'interval', |
231 | 199 | 'type' => 'int', |
232 | 200 | 'description' => wfMsg( 'semanticformsinputs-timepicker-interval' ), |
233 | 201 | ); |
234 | | - $params[] = array( |
| 202 | + $params[$sfigSettings->timePickerDisableInputField?'enable input field':'disable input field'] = array( |
235 | 203 | 'name' => $sfigSettings->timePickerDisableInputField?'enable input field':'disable input field', |
236 | 204 | 'type' => 'boolean', |
237 | 205 | 'description' => wfMsg( 'semanticformsinputs-timepicker-enableinputfield' ), |
238 | 206 | ); |
239 | | - $params[] = array( |
| 207 | + $params[$sfigSettings->timePickerShowResetButton?'hide reset button':'show reset button'] = array( |
240 | 208 | 'name' => $sfigSettings->timePickerShowResetButton?'hide reset button':'show reset button', |
241 | 209 | 'type' => 'boolean', |
242 | 210 | 'description' => wfMsg( 'semanticformsinputs-timepicker-showresetbutton' ), |
— | — | @@ -243,4 +211,16 @@ |
244 | 212 | |
245 | 213 | return $params; |
246 | 214 | } |
| 215 | + |
| 216 | + /** |
| 217 | + * Returns the names of the resource modules this input type uses. |
| 218 | + * |
| 219 | + * Returns the names of the modules as an array or - if there is only one |
| 220 | + * module - as a string. |
| 221 | + * |
| 222 | + * @return null|string|array |
| 223 | + */ |
| 224 | + public function getResourceModuleNames() { |
| 225 | + return 'ext.semanticformsinputs.timepicker'; |
| 226 | + } |
247 | 227 | } |
Index: trunk/extensions/SemanticFormsInputs/includes/SFI_MenuSelect.php |
— | — | @@ -64,20 +64,25 @@ |
65 | 65 | */ |
66 | 66 | static private function setup() { |
67 | 67 | |
68 | | - global $wgOut; |
69 | | - global $sfigSettings; |
| 68 | + global $wgHooks; |
70 | 69 | |
71 | 70 | static $hasRun = false; |
72 | 71 | |
73 | 72 | if ( !$hasRun ) { |
74 | 73 | $hasRun = true; |
75 | | - $wgOut->addScript( '<script type="text/javascript">sfigScriptPath="' . $sfigSettings->scriptPath . '";</script> ' ); |
76 | | - $wgOut->addScript( '<script type="text/javascript" src="' . $sfigSettings->scriptPath . '/libs/menuselect.js"></script> ' ); |
77 | | - $wgOut->addExtensionStyle( $sfigSettings->scriptPath . '/skins/SFI_Menuselect.css' ); |
| 74 | + |
| 75 | + $wgHooks['MakeGlobalVariablesScript'][] = 'SFIMenuSelect::setGlobalVariables'; |
| 76 | + |
78 | 77 | } |
79 | 78 | |
80 | 79 | } |
81 | 80 | |
| 81 | + static public function setGlobalVariables( &$vars ) { |
| 82 | + global $sfigSettings; |
| 83 | + $vars['sfigScriptPath'] = $sfigSettings->scriptPath; |
| 84 | + return true; |
| 85 | + } |
| 86 | + |
82 | 87 | /** |
83 | 88 | * Returns the HTML code to be included in the output page for this input. |
84 | 89 | * |
— | — | @@ -142,22 +147,33 @@ |
143 | 148 | |
144 | 149 | /** |
145 | 150 | * Returns the set of parameters for this form input. |
146 | | - * |
147 | | - * TODO: Specify parameters specific for menuselect. |
148 | 151 | */ |
149 | 152 | public static function getParameters() { |
150 | 153 | $params = parent::getParameters(); |
151 | | - $params[] = array( |
| 154 | + $params['structure'] = array( |
152 | 155 | 'name' => 'structure', |
153 | 156 | 'type' => 'text', |
154 | 157 | 'description' => wfMsg( 'semanticformsinputs-menuselect-structure' ), |
155 | 158 | 'default' => "* item 1\n** item 11\n** item 12\n* item 2\n** item 21\n** item 22" |
156 | 159 | ); |
157 | | - $params[] = array( |
| 160 | + $params[$sfigSettings->menuSelectDisableInputField?'enable input field':'disable input field'] = array( |
158 | 161 | 'name' => $sfigSettings->menuSelectDisableInputField?'enable input field':'disable input field', |
159 | 162 | 'type' => 'boolean', |
160 | 163 | 'description' => wfMsg( 'semanticformsinputs-menuselect-enableinputfield' ), |
161 | 164 | ); |
162 | 165 | return $params; |
163 | 166 | } |
| 167 | + |
| 168 | + /** |
| 169 | + * Returns the names of the resource modules this input type uses. |
| 170 | + * |
| 171 | + * Returns the names of the modules as an array or - if there is only one |
| 172 | + * module - as a string. |
| 173 | + * |
| 174 | + * @return null|string|array |
| 175 | + */ |
| 176 | + public function getResourceModuleNames() { |
| 177 | + return 'ext.semanticformsinputs.menuselect'; |
| 178 | + } |
| 179 | + |
164 | 180 | } |
Index: trunk/extensions/SemanticFormsInputs/libs/menuselect.js |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | * |
12 | 12 | * @param inputID ( String ) the id of the input to initialize |
13 | 13 | */ |
14 | | -function SFI_MS_init( inputID, params ) { |
| 14 | +window.SFI_MS_init = function( inputID, params ) { |
15 | 15 | |
16 | 16 | var inputShow = jQuery('#' + inputID + "_show"); |
17 | 17 | |
Index: trunk/extensions/SemanticFormsInputs/libs/datetimepicker.js |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | */ |
8 | 8 | |
9 | 9 | |
10 | | -function SFI_DTP_init ( inputId, params ) { |
| 10 | +window.SFI_DTP_init = function( inputId, params ) { |
11 | 11 | |
12 | 12 | var input = jQuery( '#' + inputId ); |
13 | 13 | |
Index: trunk/extensions/SemanticFormsInputs/libs/regexp.js |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | * @return (Boolean) true, if the input's value matches the regular expression in |
18 | 18 | * retext, false otherwise; the value is inverted if inverse is true |
19 | 19 | */ |
20 | | -function SFI_RE_validate ( input_id, params ) { //input_number, retext, inverse, message, multiple |
| 20 | +window.SFI_RE_validate = function( input_id, params ) { //input_number, retext, inverse, message, multiple |
21 | 21 | |
22 | 22 | var match; |
23 | 23 | var message; |
Index: trunk/extensions/SemanticFormsInputs/libs/datepicker.js |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | * |
7 | 7 | */ |
8 | 8 | |
9 | | -function SFI_DP_init ( input_id, params ) { |
| 9 | +window.SFI_DP_init = function ( input_id, params ) { |
10 | 10 | |
11 | 11 | var inputShow = jQuery( '#' + input_id ); |
12 | 12 | inputShow.attr( 'id', input_id + '_show' ); |
Index: trunk/extensions/SemanticFormsInputs/libs/timepicker.js |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | * format: (String) a format string (unused) (do we even need it?) |
18 | 18 | * |
19 | 19 | */ |
20 | | -function SFI_TP_init( inputID, params ) { // minTime, maxTime, interval, format |
| 20 | +window.SFI_TP_init = function( inputID, params ) { // minTime, maxTime, interval, format |
21 | 21 | |
22 | 22 | var inputIDshow = inputID + '_show'; |
23 | 23 | |