Index: trunk/extensions/SemanticForms/SemanticForms.php |
— | — | @@ -208,6 +208,8 @@ |
209 | 209 | 'jquery.ui.button', |
210 | 210 | 'jquery.ui.sortable', |
211 | 211 | 'jquery.ui.widget', |
| 212 | + 'ext.semanticforms.fancybox', |
| 213 | + 'ext.semanticforms.autogrow', |
212 | 214 | ), |
213 | 215 | ), |
214 | 216 | 'ext.semanticforms.fancybox' => $sfgResourceTemplate + array( |
— | — | @@ -240,7 +242,11 @@ |
241 | 243 | 'ext.semanticforms.wikieditor' => $sfgResourceTemplate + array( |
242 | 244 | 'scripts' => 'libs/SF_wikieditor.js', |
243 | 245 | 'styles' => 'skins/SF_wikieditor.css', |
| 246 | + 'dependencies' => array( |
| 247 | + 'ext.semanticforms.main', |
| 248 | + 'jquery.wikiEditor', |
244 | 249 | ), |
| 250 | + ), |
245 | 251 | 'ext.semanticforms.imagepreview' => $sfgResourceTemplate + array( |
246 | 252 | 'scripts' => 'libs/SF_imagePreview.js', |
247 | 253 | ), |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaWithAutocompleteInput.php |
— | — | @@ -16,167 +16,32 @@ |
17 | 17 | return 'textarea with autocomplete'; |
18 | 18 | } |
19 | 19 | |
20 | | - public static function getDefaultPropTypes() { |
21 | | - return array(); |
| 20 | + public static function getParameters() { |
| 21 | + $params = parent::getParameters(); |
| 22 | + $params = array_merge( $params, SFTextWithAutocompleteInput::getAutocompletionParameters() ); |
| 23 | + return $params; |
22 | 24 | } |
23 | 25 | |
24 | | - public static function getOtherPropTypesHandled() { |
25 | | - return array( '_wpg', '_str' ); |
26 | | - } |
| 26 | + protected function getTextAreaAttributes() { |
27 | 27 | |
28 | | - public static function getOtherPropTypeListsHandled() { |
29 | | - return array( '_wpg', '_str' ); |
30 | | - } |
| 28 | + $textarea_attrs = parent::getTextAreaAttributes(); |
31 | 29 | |
32 | | - public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
33 | | - |
34 | | - // TODO: Lots of duplication of code in the parent class. Needs refactoring! |
35 | | - |
36 | | - global $wgOut; |
37 | | - |
38 | 30 | // If 'no autocomplete' was specified, print a regular |
39 | 31 | // textarea instead. |
40 | | - if ( array_key_exists( 'no autocomplete', $other_args ) && |
41 | | - $other_args['no autocomplete'] == true ) { |
42 | | - unset( $other_args['autocompletion source'] ); |
43 | | - return SFTextAreaInput::getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ); |
44 | | - } |
| 32 | + if ( !array_key_exists( 'no autocomplete', $this->mOtherArgs ) || |
| 33 | + $this->mOtherArgs['no autocomplete'] == false ) { |
45 | 34 | |
46 | | - global $sfgTabIndex, $sfgFieldNum; |
| 35 | + list( $autocompleteSettings, $remoteDataType, $delimiter ) = SFTextWithAutocompleteInput::setAutocompleteValues( $this->mOtherArgs ); |
47 | 36 | |
48 | | - list( $autocompleteSettings, $remoteDataType, $delimiter ) = SFTextWithAutocompleteInput::setAutocompleteValues( $other_args ); |
49 | | - |
50 | | - $input_id = 'input_' . $sfgFieldNum; |
51 | | - |
52 | | - if ( array_key_exists( 'editor', $other_args ) && |
53 | | - $other_args['editor'] == 'wikieditor' && |
54 | | - |
55 | | - method_exists( $wgOut, 'getResourceLoader' ) && |
56 | | - in_array( 'jquery.wikiEditor', $wgOut->getResourceLoader()->getModuleNames() ) && |
57 | | - |
58 | | - class_exists( 'WikiEditorHooks' ) ) { |
59 | | - |
60 | | - // load modules for all enabled features |
61 | | - WikiEditorHooks::editPageShowEditFormInitial( $this ); |
62 | | - |
63 | | - $wgOut->addModules( 'ext.semanticforms.wikieditor' ); |
64 | | - |
65 | | - $jstext = <<<JAVASCRIPT |
66 | | - jQuery( jQuery('#$input_id').SemanticForms_registerInputInit( ext.wikieditor.init, null ) ); |
67 | | -JAVASCRIPT; |
68 | | - |
69 | | - // write JS code directly to the page's code |
70 | | - $wgOut->addScript( Html::inlineScript( $jstext ) ); |
71 | | - |
72 | | - $className = "wikieditor "; |
73 | | - } else { |
74 | | - $className = ""; |
75 | | - } |
76 | | - |
77 | | - $className .= ( $is_mandatory ) ? 'autocompleteInput mandatoryField' : 'autocompleteInput createboxInput'; |
78 | | - if ( array_key_exists( 'class', $other_args ) ) { |
79 | | - $className .= ' ' . $other_args['class']; |
80 | | - } |
81 | | - |
82 | | - if ( array_key_exists( 'rows', $other_args ) ) { |
83 | | - $rows = $other_args['rows']; |
84 | | - } else { |
85 | | - $rows = 5; |
86 | | - } |
87 | | - $text = ''; |
88 | | - if ( array_key_exists( 'autogrow', $other_args ) ) { |
89 | | - $className .= ' autoGrow'; |
90 | | - } |
91 | | - |
92 | | - $textarea_attrs = array( |
93 | | - 'tabindex' => $sfgTabIndex, |
94 | | - 'id' => $input_id, |
95 | | - 'name' => $input_name, |
96 | | - 'rows' => $rows, |
97 | | - 'class' => $className, |
98 | | - 'autocompletesettings' => $autocompleteSettings, |
99 | | - ); |
100 | | - |
101 | | - if ( array_key_exists( 'cols', $other_args ) ) { |
102 | | - $textarea_attrs['cols'] = $other_args['cols']; |
103 | | - // Needed to prevent CSS from overriding the manually- |
104 | | - // set width. |
105 | | - $textarea_attrs['style'] = 'width: auto'; |
106 | | - } elseif ( array_key_exists( 'autogrow', $other_args ) ) { |
107 | | - // If 'autogrow' has been set, automatically set |
108 | | - // the number of columns - otherwise, the Javascript |
109 | | - // won't be able to know how many characters there |
110 | | - // are per line, and thus won't work. |
111 | | - $textarea_attrs['cols'] = 90; |
112 | | - $textarea_attrs['style'] = 'width: auto'; |
113 | | - } else { |
114 | | - $textarea_attrs['cols'] = 90; |
115 | | - $textarea_attrs['style'] = 'width: 100%'; |
116 | | - } |
117 | | - |
118 | | - if ( array_key_exists( 'origName', $other_args ) ) { |
119 | | - $inputAttrs['origName'] = $other_args['origName']; |
120 | | - } |
121 | 37 | if ( !is_null( $remoteDataType ) ) { |
122 | 38 | $textarea_attrs['autocompletedatatype'] = $remoteDataType; |
123 | 39 | } |
124 | | - if ( $is_disabled ) { |
125 | | - $textarea_attrs['disabled'] = 'disabled'; |
126 | | - } |
127 | | - if ( array_key_exists( 'maxlength', $other_args ) ) { |
128 | | - $maxlength = $other_args['maxlength']; |
129 | | - // For every actual character pressed (i.e., excluding |
130 | | - // things like the Shift key), reduce the string to |
131 | | - // its allowed length if it's exceeded that. |
132 | | - // This JS code is complicated so that it'll work |
133 | | - // correctly in IE - IE moves the cursor to the end |
134 | | - // whenever this.value is reset, so we'll make sure |
135 | | - // to do that only when we need to. |
136 | | - $maxLengthJSCheck = "if (window.event && window.event.keyCode < 48 && window.event.keyCode != 13) return; if (this.value.length > $maxlength) { this.value = this.value.substring(0, $maxlength); }"; |
137 | | - $textarea_attrs['onKeyDown'] = $maxLengthJSCheck; |
138 | | - $textarea_attrs['onKeyUp'] = $maxLengthJSCheck; |
139 | | - } |
140 | | - if ( array_key_exists( 'placeholder', $other_args ) ) { |
141 | | - $textarea_attrs = $other_args['placeholder']; |
142 | | - } |
143 | 40 | |
144 | | - $textarea_input = Html::element( 'textarea', $textarea_attrs, $cur_value ); |
145 | | - $text .= $textarea_input; |
| 41 | + $textarea_attrs['autocompletesettings'] = $autocompleteSettings; |
146 | 42 | |
147 | | - if ( array_key_exists( 'uploadable', $other_args ) && $other_args['uploadable'] == true ) { |
148 | | - if ( array_key_exists( 'default filename', $other_args ) ) { |
149 | | - $default_filename = $other_args['default filename']; |
150 | | - } else { |
151 | | - $default_filename = ''; |
| 43 | + $textarea_attrs['class'] .= ' autocompleteInput'; |
152 | 44 | } |
153 | | - $text .= self::uploadableHTML( $input_id, $delimiter, $default_filename, $cur_value, $other_args ); |
154 | | - } |
155 | 45 | |
156 | | - $spanClass = 'inputSpan'; |
157 | | - if ( $is_mandatory ) { |
158 | | - $spanClass .= ' mandatoryFieldSpan'; |
| 46 | + return $textarea_attrs; |
159 | 47 | } |
160 | | - $text = "\n" . Html::rawElement( 'span', array( 'class' => $spanClass ), $text ); |
161 | | - |
162 | | - return $text; |
163 | 48 | } |
164 | | - |
165 | | - public static function getParameters() { |
166 | | - $params = parent::getParameters(); |
167 | | - $params = array_merge( $params, SFTextWithAutocompleteInput::getAutocompletionParameters() ); |
168 | | - return $params; |
169 | | - } |
170 | | - |
171 | | - /** |
172 | | - * Returns the HTML code to be included in the output page for this input. |
173 | | - */ |
174 | | - public function getHtmlText() { |
175 | | - return self::getHTML( |
176 | | - $this->mCurrentValue, |
177 | | - $this->mInputName, |
178 | | - $this->mIsMandatory, |
179 | | - $this->mIsDisabled, |
180 | | - $this->mOtherArgs |
181 | | - ); |
182 | | - } |
183 | | -} |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_FormInput.php |
— | — | @@ -320,17 +320,20 @@ |
321 | 321 | if ( $input->getJsInitFunctionData() || $input->getJsValidationFunctionData() ) { |
322 | 322 | |
323 | 323 | $jstext = ''; |
| 324 | + $input_id = $input_name == 'sf_free_text' ? 'sf_free_text' : "input_$sfgFieldNum"; |
324 | 325 | |
325 | 326 | foreach ( $input->getJsInitFunctionData() as $jsInitFunctionData ) { |
326 | | - $jstext .= "jQuery('#input_$sfgFieldNum').SemanticForms_registerInputInit({$jsInitFunctionData['name']}, {$jsInitFunctionData['param']} );"; |
| 327 | + $jstext .= "jQuery('#$input_id').SemanticForms_registerInputInit({$jsInitFunctionData['name']}, {$jsInitFunctionData['param']} );"; |
327 | 328 | } |
328 | 329 | |
329 | 330 | foreach ( $input->getJsValidationFunctionData() as $jsValidationFunctionData ) { |
330 | | - $jstext .= "jQuery('#input_$sfgFieldNum').SemanticForms_registerInputValidation( {$jsValidationFunctionData['name']}, {$jsValidationFunctionData['param']});"; |
| 331 | + $jstext .= "jQuery('#$input_id').SemanticForms_registerInputValidation( {$jsValidationFunctionData['name']}, {$jsValidationFunctionData['param']});"; |
331 | 332 | } |
332 | 333 | |
333 | 334 | if ( $modules !== null ) { |
334 | | - $jstext = 'mw.loader.using(' . json_encode( $modules ) . ', function(){' . $jstext . '});'; |
| 335 | + $jstext = 'mw.loader.using(' . json_encode( $modules ) |
| 336 | + . ',function(){' . $jstext |
| 337 | + . '},function(e,module){alert(module+": "+e);});'; |
335 | 338 | } |
336 | 339 | |
337 | 340 | $jstext = 'jQuery(function(){' . $jstext . '});'; |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaInput.php |
— | — | @@ -14,6 +14,45 @@ |
15 | 15 | */ |
16 | 16 | class SFTextAreaInput extends SFFormInput { |
17 | 17 | |
| 18 | + protected $mUseWikieditor = false; |
| 19 | + |
| 20 | + /** |
| 21 | + * Constructor for the SFTextAreaInput class. |
| 22 | + * |
| 23 | + * @param String $input_number |
| 24 | + * The number of the input in the form. For a simple HTML input element |
| 25 | + * this should end up in the id attribute in the format 'input_<number>'. |
| 26 | + * @param String $cur_value |
| 27 | + * The current value of the input field. For a simple HTML input |
| 28 | + * element this should end up in the value attribute. |
| 29 | + * @param String $input_name |
| 30 | + * The name of the input. For a simple HTML input element this should |
| 31 | + * end up in the name attribute. |
| 32 | + * @param Array $other_args |
| 33 | + * An associative array of other parameters that were present in the |
| 34 | + * input definition. |
| 35 | + */ |
| 36 | + public function __construct( $input_number, $cur_value, $input_name, $disabled, $other_args ) { |
| 37 | + |
| 38 | + global $wgOut; |
| 39 | + |
| 40 | + parent::__construct( $input_number, $cur_value, $input_name, $disabled, $other_args ); |
| 41 | + |
| 42 | + if ( |
| 43 | + array_key_exists( 'editor', $this->mOtherArgs ) && |
| 44 | + $this->mOtherArgs['editor'] == 'wikieditor' && |
| 45 | + |
| 46 | + method_exists( $wgOut, 'getResourceLoader' ) && |
| 47 | + in_array( 'jquery.wikiEditor', $wgOut->getResourceLoader()->getModuleNames() ) && |
| 48 | + |
| 49 | + class_exists( 'WikiEditorHooks' ) |
| 50 | + ) { |
| 51 | + $this->mUseWikieditor = true; |
| 52 | + $this->addJsInitFunctionData( 'window.ext.wikieditor.init' ); |
| 53 | + } |
| 54 | + } |
| 55 | + |
| 56 | + |
18 | 57 | public static function getName() { |
19 | 58 | return 'textarea'; |
20 | 59 | } |
— | — | @@ -30,68 +69,100 @@ |
31 | 70 | return array( '_wpg', '_str' ); |
32 | 71 | } |
33 | 72 | |
34 | | - public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
| 73 | + public static function getParameters() { |
| 74 | + $params = parent::getParameters(); |
35 | 75 | |
36 | | - global $wgOut; |
| 76 | + $params['preload'] = array( |
| 77 | + 'name' => 'preload', |
| 78 | + 'type' => 'string', |
| 79 | + 'description' => wfMsg( 'sf_forminputs_preload' ) |
| 80 | + ); |
| 81 | + $params['rows'] = array( |
| 82 | + 'name' => 'rows', |
| 83 | + 'type' => 'int', |
| 84 | + 'description' => wfMsg( 'sf_forminputs_rows' ) |
| 85 | + ); |
| 86 | + $params['cols'] = array( |
| 87 | + 'name' => 'cols', |
| 88 | + 'type' => 'int', |
| 89 | + 'description' => wfMsg( 'sf_forminputs_cols' ) |
| 90 | + ); |
| 91 | + $params['maxlength'] = array( |
| 92 | + 'name' => 'maxlength', |
| 93 | + 'type' => 'int', |
| 94 | + 'description' => wfMsg( 'sf_forminputs_maxlength' ) |
| 95 | + ); |
| 96 | + $params['placeholder'] = array( |
| 97 | + 'name' => 'placeholder', |
| 98 | + 'type' => 'string', |
| 99 | + 'description' => wfMsg( 'sf_forminputs_placeholder' ) |
| 100 | + ); |
| 101 | + $params['autogrow'] = array( |
| 102 | + 'name' => 'autogrow', |
| 103 | + 'type' => 'boolean', |
| 104 | + 'description' => wfMsg( 'sf_forminputs_autogrow' ) |
| 105 | + ); |
| 106 | + return $params; |
| 107 | + } |
| 108 | + |
| 109 | + /** |
| 110 | + * Returns the names of the resource modules this input type uses. |
| 111 | + * |
| 112 | + * Returns the names of the modules as an array or - if there is only one |
| 113 | + * module - as a string. |
| 114 | + * |
| 115 | + * @return null|string|array |
| 116 | + */ |
| 117 | + public function getResourceModuleNames() { |
| 118 | + return $this->mUseWikieditor?'ext.semanticforms.wikieditor':null; |
| 119 | + } |
| 120 | + |
| 121 | + protected function getTextAreaAttributes() { |
| 122 | + |
37 | 123 | global $sfgTabIndex, $sfgFieldNum; |
38 | 124 | |
39 | 125 | // Use a special ID for the free text field, for FCK's needs. |
40 | | - $input_id = $input_name == 'sf_free_text' ? 'sf_free_text' : "input_$sfgFieldNum"; |
| 126 | + $input_id = $this->mInputName == 'sf_free_text' ? 'sf_free_text' : "input_$sfgFieldNum"; |
41 | 127 | |
42 | | - if ( array_key_exists( 'editor', $other_args ) && |
43 | | - $other_args['editor'] == 'wikieditor' && |
| 128 | + if ( $this->mUseWikieditor ) { |
44 | 129 | |
45 | | - method_exists( $wgOut, 'getResourceLoader' ) && |
46 | | - in_array( 'jquery.wikiEditor', $wgOut->getResourceLoader()->getModuleNames() ) && |
47 | | - |
48 | | - class_exists( 'WikiEditorHooks' ) ) { |
49 | | - |
50 | 130 | // load modules for all enabled features |
51 | 131 | WikiEditorHooks::editPageShowEditFormInitial( $this ); |
| 132 | + $className = 'wikieditor '; |
| 133 | + } else { |
| 134 | + $className = ''; |
| 135 | + } |
52 | 136 | |
53 | | - $wgOut->addModules( 'ext.semanticforms.wikieditor' ); |
| 137 | + $className .= ( $this->mIsMandatory ) ? 'mandatoryField' : 'createboxInput'; |
54 | 138 | |
55 | | - $jstext = <<<JAVASCRIPT |
56 | | - jQuery( jQuery('#$input_id').SemanticForms_registerInputInit( ext.wikieditor.init, null ) ); |
57 | | -JAVASCRIPT; |
58 | | - |
59 | | - // write JS code directly to the page's code |
60 | | - $wgOut->addScript( Html::inlineScript( $jstext ) ); |
61 | | - |
62 | | - $className = "wikieditor "; |
63 | | - } else { |
64 | | - $className = ""; |
| 139 | + if ( array_key_exists( 'class', $this->mOtherArgs ) ) { |
| 140 | + $className .= ' ' . $this->mOtherArgs['class']; |
65 | 141 | } |
66 | 142 | |
67 | | - $className .= ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput'; |
68 | | - if ( array_key_exists( 'class', $other_args ) ) { |
69 | | - $className .= " " . $other_args['class']; |
| 143 | + if ( array_key_exists( 'autogrow', $this->mOtherArgs ) ) { |
| 144 | + $className .= ' autoGrow'; |
70 | 145 | } |
71 | 146 | |
72 | | - if ( array_key_exists( 'rows', $other_args ) ) { |
73 | | - $rows = $other_args['rows']; |
| 147 | + if ( array_key_exists( 'rows', $this->mOtherArgs ) ) { |
| 148 | + $rows = $this->mOtherArgs['rows']; |
74 | 149 | } else { |
75 | 150 | $rows = 5; |
76 | 151 | } |
77 | 152 | |
78 | | - if ( array_key_exists( 'autogrow', $other_args ) ) { |
79 | | - $className .= ' autoGrow'; |
80 | | - } |
81 | | - |
82 | 153 | $textarea_attrs = array( |
83 | 154 | 'tabindex' => $sfgTabIndex, |
| 155 | + 'name' => $this->mInputName, |
84 | 156 | 'id' => $input_id, |
85 | | - 'name' => $input_name, |
| 157 | + 'class' => $className, |
86 | 158 | 'rows' => $rows, |
87 | | - 'class' => $className, |
88 | 159 | ); |
89 | 160 | |
90 | | - if ( array_key_exists( 'cols', $other_args ) ) { |
91 | | - $textarea_attrs['cols'] = $other_args['cols']; |
| 161 | + if ( array_key_exists( 'cols', $this->mOtherArgs ) ) { |
| 162 | + $textarea_attrs['cols'] = $this->mOtherArgs['cols']; |
92 | 163 | // Needed to prevent CSS from overriding the manually- |
93 | 164 | // set width. |
94 | 165 | $textarea_attrs['style'] = 'width: auto'; |
95 | | - } elseif ( array_key_exists( 'autogrow', $other_args ) ) { |
| 166 | + } elseif ( array_key_exists( 'autogrow', $this->mOtherArgs ) ) { |
96 | 167 | // If 'autogrow' has been set, automatically set |
97 | 168 | // the number of columns - otherwise, the Javascript |
98 | 169 | // won't be able to know how many characters there |
— | — | @@ -103,11 +174,12 @@ |
104 | 175 | $textarea_attrs['style'] = 'width: 100%'; |
105 | 176 | } |
106 | 177 | |
107 | | - if ( $is_disabled ) { |
| 178 | + if ( $this->mIsDisabled ) { |
108 | 179 | $textarea_attrs['disabled'] = 'disabled'; |
109 | 180 | } |
110 | | - if ( array_key_exists( 'maxlength', $other_args ) ) { |
111 | | - $maxlength = $other_args['maxlength']; |
| 181 | + |
| 182 | + if ( array_key_exists( 'maxlength', $this->mOtherArgs ) ) { |
| 183 | + $maxlength = $this->mOtherArgs['maxlength']; |
112 | 184 | // For every actual character pressed (i.e., excluding |
113 | 185 | // things like the Shift key), reduce the string to its |
114 | 186 | // allowed length if it's exceeded that. |
— | — | @@ -119,63 +191,29 @@ |
120 | 192 | $textarea_attrs['onKeyDown'] = $maxLengthJSCheck; |
121 | 193 | $textarea_attrs['onKeyUp'] = $maxLengthJSCheck; |
122 | 194 | } |
123 | | - if ( array_key_exists( 'placeholder', $other_args ) ) { |
124 | | - $textarea_attrs['placeholder'] = $other_args['placeholder']; |
125 | | - } |
126 | 195 | |
127 | | - $text = Html::element( 'textarea', $textarea_attrs, $cur_value ); |
128 | | - $spanClass = 'inputSpan'; |
129 | | - if ( $is_mandatory ) { |
130 | | - $spanClass .= ' mandatoryFieldSpan'; |
| 196 | + if ( array_key_exists( 'placeholder', $this->mOtherArgs ) ) { |
| 197 | + $textarea_attrs['placeholder'] = $this->mOtherArgs['placeholder']; |
131 | 198 | } |
132 | | - $text = Html::rawElement( 'span', array( 'class' => $spanClass ), $text ); |
133 | 199 | |
134 | | - return $text; |
| 200 | + return $textarea_attrs; |
135 | 201 | } |
136 | 202 | |
137 | | - public static function getParameters() { |
138 | | - $params = parent::getParameters(); |
139 | | - $params[] = array( |
140 | | - 'name' => 'preload', |
141 | | - 'type' => 'string', |
142 | | - 'description' => wfMsg( 'sf_forminputs_preload' ) |
143 | | - ); |
144 | | - $params[] = array( |
145 | | - 'name' => 'rows', |
146 | | - 'type' => 'int', |
147 | | - 'description' => wfMsg( 'sf_forminputs_rows' ) |
148 | | - ); |
149 | | - $params[] = array( |
150 | | - 'name' => 'cols', |
151 | | - 'type' => 'int', |
152 | | - 'description' => wfMsg( 'sf_forminputs_cols' ) |
153 | | - ); |
154 | | - $params[] = array( |
155 | | - 'name' => 'maxlength', |
156 | | - 'type' => 'int', |
157 | | - 'description' => wfMsg( 'sf_forminputs_maxlength' ) |
158 | | - ); |
159 | | - $params[] = array( |
160 | | - 'name' => 'placeholder', |
161 | | - 'type' => 'string', |
162 | | - 'description' => wfMsg( 'sf_forminputs_placeholder' ) |
163 | | - ); |
164 | | - $params[] = array( |
165 | | - 'name' => 'autogrow', |
166 | | - 'type' => 'boolean', |
167 | | - 'description' => wfMsg( 'sf_forminputs_autogrow' ) |
168 | | - ); |
169 | | - return $params; |
170 | | - } |
171 | | - |
172 | 203 | /** |
173 | 204 | * Returns the HTML code to be included in the output page for this input. |
174 | 205 | */ |
175 | 206 | public function getHtmlText() { |
176 | 207 | |
177 | | - return self::getHTML( |
178 | | - $this->mCurrentValue, $this->mInputName, $this->mIsMandatory, $this->mIsDisabled, $this->mOtherArgs |
179 | | - ); |
| 208 | + $textarea_attrs = $this->getTextAreaAttributes(); |
| 209 | + |
| 210 | + $text = Html::element( 'textarea', $textarea_attrs, $this->mCurrentValue ); |
| 211 | + $spanClass = 'inputSpan'; |
| 212 | + if ( $this->mIsMandatory ) { |
| 213 | + $spanClass .= ' mandatoryFieldSpan'; |
180 | 214 | } |
| 215 | + $text = Html::rawElement( 'span', array( 'class' => $spanClass ), $text ); |
181 | 216 | |
| 217 | + return $text; |
182 | 218 | } |
| 219 | + |
| 220 | +} |
Index: trunk/extensions/SemanticForms/libs/SF_wikieditor.js |
— | — | @@ -3,13 +3,13 @@ |
4 | 4 | window.ext = {}; |
5 | 5 | } |
6 | 6 | |
7 | | -window.ext.wikieditor = new function(){ |
| 7 | +window.ext.wikieditor = { |
8 | 8 | |
9 | 9 | // initialize the wikieditor on the specified element |
10 | | - this.init = function init ( input_id, params ) { |
| 10 | + init : function init ( input_id, params ) { |
11 | 11 | |
| 12 | + jQuery( function() { |
12 | 13 | if ( window.mediaWiki ) { |
13 | | - mediaWiki.loader.using( 'ext.semanticforms.wikieditor', function(){ |
14 | 14 | |
15 | 15 | var input = jQuery( '#' + input_id ); |
16 | 16 | |
— | — | @@ -41,20 +41,8 @@ |
42 | 42 | } |
43 | 43 | }); |
44 | 44 | |
45 | | - // load toc |
46 | | - // TODO: Can this be enabled? Should it? |
47 | | -// mediaWiki.loader.using( ['jquery.wikiEditor.toc' ] , function(){ |
48 | | -// if ( jQuery.wikiEditor.isSupported( jQuery.wikiEditor.modules.toc ) ) { |
49 | | -// |
50 | | -// input.wikiEditor( 'addModule', 'toc' ); |
51 | | -// |
52 | | -// } |
53 | | -// }); |
54 | | - |
55 | | - |
56 | | - |
57 | | - } ); |
58 | 45 | } |
59 | | - } |
60 | 46 | |
| 47 | + }); |
| 48 | + } |
61 | 49 | }; |