r109076 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109075‎ | r109076 | r109077 >
Date:23:12, 16 January 2012
Author:yaron
Status:deferred
Tags:
Comment:
Overhaul of HTML: replaced most calls to methods in Xml class with calls to Html class, and replaced calls to element() with input() and hidden() where appropriate
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormEditTab.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_FormField.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_FormUtils.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_TemplateInForm.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_Utils.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_CategoriesInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_CategoryInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxesInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_ComboBoxInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_DateInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_DropdownInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_ListBoxInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_RadioButtonInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaWithAutocompleteInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_TextInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_TextWithAutocompleteInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateCategory.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateClass.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateForm.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateProperty.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateTemplate.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_FormEdit.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_FormStart.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_RunQuery.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_CreateCategory.php
@@ -80,26 +80,23 @@
8181 END;
8282 $text .= SFFormUtils::hiddenFieldHTML( 'title', "$special_namespace:CreateCategory" );
8383 $firstRow = wfMsg( 'sf_createcategory_name' ) . ' ' .
84 - Xml::element( 'input',
85 - array(
86 - 'size' => 25,
87 - 'name' => 'category_name',
88 - ), null ) . "\n";
 84+ Html::input( 'category_name', null, 'text',
 85+ array( 'size' => 25 ) ) . "\n";
8986 if ( !is_null( $category_name_error_str ) ) {
90 - $firstRow .= Xml::element( 'span',
 87+ $firstRow .= Html::element( 'span',
9188 array( 'style' => 'color: red;' ),
9289 $category_name_error_str ) . "\n";
9390 }
9491 $firstRow .= "\t" . wfMsg( 'sf_createcategory_defaultform' ) . "\n";
95 - $formSelector = "\t" . Xml::element( 'option', null, null ). "\n";
 92+ $formSelector = "\t" . Html::element( 'option', null, null ). "\n";
9693 foreach ( $all_forms as $form ) {
97 - $formSelector .= "\t" . Xml::element( 'option', null, $form ) . "\n";
 94+ $formSelector .= "\t" . Html::element( 'option', null, $form ) . "\n";
9895 }
9996
100 - $firstRow .= Xml::tags( 'select',
 97+ $firstRow .= Html::rawElement( 'select',
10198 array( 'id' => 'form_dropdown', 'name' => 'default_form' ),
10299 $formSelector );
103 - $text .= Xml::tags( 'p', null, $firstRow );
 100+ $text .= Html::rawElement( 'p', null, $firstRow );
104101 $subcategory_label = wfMsg( 'sf_createcategory_makesubcategory' );
105102 $text .= <<<END
106103 <p>$subcategory_label
@@ -110,12 +107,12 @@
111108 $categories = SFUtils::getCategoriesForPage();
112109 foreach ( $categories as $category ) {
113110 $category = str_replace( '_', ' ', $category );
114 - $text .= "\t" . Xml::element( 'option', null, $category ) . "\n";
 111+ $text .= "\t" . Html::element( 'option', null, $category ) . "\n";
115112 }
116113 $text .= "\t</select>\n";
117 - $editButtonsText = "\t" . Xml::element( 'input', array( 'type' => 'submit', 'id' => 'wpSave', 'name' => 'wpSave', 'value' => wfMsg( 'savearticle' ) ) ) . "\n";
118 - $editButtonsText .= "\t" . Xml::element( 'input', array( 'type' => 'submit', 'id' => 'wpPreview', 'name' => 'wpPreview', 'value' => wfMsg( 'preview' ) ) ) . "\n";
119 - $text .= "\t" . Xml::tags( 'div', array( 'class' => 'editButtons' ), $editButtonsText ) . "\n";
 114+ $editButtonsText = "\t" . Html::input( 'wpSave', wfMsg( 'savearticle' ), 'submit', array( 'id' => 'wpSave' ) ) . "\n";
 115+ $editButtonsText .= "\t" . Html::input( 'wpPreview', wfMsg( 'preview' ), 'submit', array( 'id' => 'wpPreview' ) ) . "\n";
 116+ $text .= "\t" . Html::rawElement( 'div', array( 'class' => 'editButtons' ), $editButtonsText ) . "\n";
120117 $text .= <<<END
121118 <br /><hr /<br />
122119
@@ -123,7 +120,7 @@
124121
125122 $sk = $wgUser->getSkin();
126123 $create_form_link = SFUtils::linkForSpecialPage( $sk, 'CreateForm' );
127 - $text .= "\t" . Xml::tags( 'p', null, $create_form_link . '.' ) . "\n";
 124+ $text .= "\t" . Html::rawElement( 'p', null, $create_form_link . '.' ) . "\n";
128125 $text .= "\t</form>\n";
129126
130127 $wgOut->addExtensionStyle( $sfgScriptPath . "/skins/SemanticForms.css" );
Index: trunk/extensions/SemanticForms/specials/SF_FormStart.php
@@ -87,7 +87,7 @@
8888 }
8989
9090 if ( ( !$form_title || !$form_title->exists() ) && ( $form_name !== '' ) ) {
91 - $text = Xml::tags( 'p', array( 'class' => 'error' ), wfMsgExt( 'sf_formstart_badform', 'parseinline', SFUtils::linkText( SF_NS_FORM, $form_name ) ) ) . "\n";
 91+ $text = Html::rawElement( 'p', array( 'class' => 'error' ), wfMsgExt( 'sf_formstart_badform', 'parseinline', SFUtils::linkText( SF_NS_FORM, $form_name ) ) ) . "\n";
9292 } else {
9393 if ( $form_name === '' ) {
9494 $description = htmlspecialchars( wfMsg( 'sf_formstart_noform_docu', $form_name ) );
@@ -111,7 +111,7 @@
112112 $text .= SFFormUtils::hiddenFieldHTML( 'namespace', $target_namespace );
113113 $text .= SFFormUtils::hiddenFieldHTML( 'super_page', $super_page );
114114 $text .= SFFormUtils::hiddenFieldHTML( 'params', $params );
115 - $text .= "\t" . Xml::element( 'input', array( 'type' => 'submit', 'value' => wfMsg( 'sf_formstart_createoredit' ) ) ) . "\n";
 115+ $text .= "\t" . Html::input( null, wfMsg( 'sf_formstart_createoredit' ), 'submit' ) . "\n";
116116 $text .= "\t</form>\n";
117117 }
118118 $wgOut->addHTML( $text );
Index: trunk/extensions/SemanticForms/specials/SF_CreateForm.php
@@ -221,7 +221,7 @@
222222 $text .= SFFormUtils::hiddenFieldHTML( 'title', $this->getTitle()->getPrefixedText() );
223223 $text .= "\t<p>" . wfMsg( 'sf_createform_nameinput' ) . ' ' . wfMsg( 'sf_createform_nameinputdesc' ) . ' <input size=25 name="form_name" value="' . $form_name . '" />';
224224 if ( ! empty( $form_name_error_str ) )
225 - $text .= "\t" . Xml::element( 'font', array( 'color' => 'red' ), $form_name_error_str );
 225+ $text .= "\t" . Html::element( 'font', array( 'color' => 'red' ), $form_name_error_str );
226226 $text .= "</p>\n";
227227
228228 $text .= $form->creationHTML();
@@ -230,9 +230,9 @@
231231
232232 $select_body = "";
233233 foreach ( $all_templates as $template ) {
234 - $select_body .= " " . Xml::element( 'option', array( 'value' => $template ), $template ) . "\n";
 234+ $select_body .= " " . Html::element( 'option', array( 'value' => $template ), $template ) . "\n";
235235 }
236 - $text .= "\t" . Xml::tags( 'select', array( 'name' => 'new_template' ), $select_body ) . "\n";
 236+ $text .= "\t" . Html::rawElement( 'select', array( 'name' => 'new_template' ), $select_body ) . "\n";
237237 // If a template has already been added, show a dropdown letting
238238 // the user choose where in the list to add a new dropdown.
239239 if ( count( $form_templates ) > 0 ) {
@@ -240,12 +240,12 @@
241241 $text .= $before_template_msg;
242242 $select_body = "";
243243 foreach ( $form_templates as $i => $ft ) {
244 - $select_body .= "\t" . Xml::element( 'option', array( 'value' => $i ), $ft->getTemplateName() ) . "\n";
 244+ $select_body .= "\t" . Html::element( 'option', array( 'value' => $i ), $ft->getTemplateName() ) . "\n";
245245 }
246246 $final_index = count( $form_templates );
247247 $at_end_msg = wfMsg( 'sf_createform_atend' );
248 - $select_body .= "\t" . Xml::element( 'option', array( 'value' => $final_index, 'selected' => 'selected' ), $at_end_msg );
249 - $text .= Xml::tags( 'select', array( 'name' => 'before_template' ), $select_body ) . "\n";
 248+ $select_body .= "\t" . Html::element( 'option', array( 'value' => $final_index, 'selected' => 'selected' ), $at_end_msg );
 249+ $text .= Html::rawElement( 'select', array( 'name' => 'before_template' ), $select_body ) . "\n";
250250 }
251251
252252 // Disable 'save' and 'preview' buttons if user has not yet
@@ -254,31 +254,35 @@
255255 $add_button_text = wfMsg( 'sf_createform_add' );
256256 $sk = $wgUser->getSkin();
257257 $create_template_link = SFUtils::linkForSpecialPage( $sk, 'CreateTemplate' );
258 - $text .= "\t" . Xml::element( 'input', array( 'type' => 'submit', 'name' => 'add_field', 'value' => $add_button_text ) );
 258+ $text .= "\t" . Html::input( 'add_field', $add_button_text, 'submit' );
259259 $text .= <<<END
260260 </p>
261261 <br />
262262
263263 END;
264 - $saveAttrs = array( 'type' => 'submit', 'id' => 'wpSave', 'name' => 'wpSave', 'value' => wfMsg( 'savearticle' ) );
265 - if ( count( $form_templates ) == 0 ) { $saveAttrs['disabled'] = 'disabled'; }
266 - $editButtonsText = "\t" . Xml::element( 'input', $saveAttrs ) . "\n";
267 - $previewAttrs = array( 'type' => 'submit', 'id' => 'wpPreview', 'name' => 'wpPreview', 'value' => wfMsg( 'preview' ) );
268 - if ( count( $form_templates ) == 0 ) { $previewAttrs['disabled'] = 'disabled'; }
269 - $editButtonsText .= "\t" . Xml::element( 'input', $previewAttrs ) . "\n";
270 - $text .= "\t" . Xml::tags( 'div', array( 'class' => 'editButtons' ),
271 - Xml::tags( 'p', array(), $editButtonsText ) . "\n" ) . "\n";
 264+ $saveAttrs = array( 'id' => 'wpSave' );
 265+ if ( count( $form_templates ) == 0 ) {
 266+ $saveAttrs['disabled'] = true;
 267+ }
 268+ $editButtonsText = "\t" . Html::input( 'wpSave', wfMsg( 'savearticle' ), 'submit', $saveAttrs ) . "\n";
 269+ $previewAttrs = array( 'id' => 'wpPreview' );
 270+ if ( count( $form_templates ) == 0 ) {
 271+ $previewAttrs['disabled'] = true;
 272+ }
 273+ $editButtonsText .= "\t" . Html::input( 'wpPreview', wfMsg( 'preview' ), 'submit', $previewAttrs ) . "\n";
 274+ $text .= "\t" . Html::rawElement( 'div', array( 'class' => 'editButtons' ),
 275+ Html::rawElement( 'p', array(), $editButtonsText ) . "\n" ) . "\n";
272276 // Explanatory message if buttons are disabled because no
273277 // templates have been added.
274278 if ( count( $form_templates ) == 0 ) {
275 - $text .= "\t" . Xml::element( 'p', null, "(" . wfMsg( 'sf_createtemplate_addtemplatebeforesave' ) . ")" );
 279+ $text .= "\t" . Html::element( 'p', null, "(" . wfMsg( 'sf_createtemplate_addtemplatebeforesave' ) . ")" );
276280 }
277281 $text .= <<<END
278282 </form>
279283 <hr /><br />
280284
281285 END;
282 - $text .= "\t" . Xml::tags( 'p', null, $create_template_link . '.' );
 286+ $text .= "\t" . Html::rawElement( 'p', null, $create_template_link . '.' );
283287
284288 $wgOut->addExtensionStyle( $sfgScriptPath . "/skins/SemanticForms.css" );
285289 $wgOut->addHTML( $text );
@@ -286,26 +290,26 @@
287291
288292 /**
289293 * Prints an input for a form-field parameter.
290 - * Code borrowed heavily from Semantic MediaWiki's
 294+ * Code borrowed from Semantic MediaWiki's
291295 * SMWAskPage::addOptionInput().
292296 */
293297 public static function inputTypeParamInput( $type, $paramName, $cur_value, array $param, array $paramValues, $fieldFormText ) {
294298 if ( $type == 'int' ) {
295 - return Xml::element( 'input', array(
296 - 'type' => 'text',
297 - 'name' => $paramName . '_' . $fieldFormText,
298 - 'value' => $cur_value,
299 - 'size' => 6
300 - ) );
 299+ return Html::input(
 300+ $paramName . '_' . $fieldFormText,
 301+ $cur_value,
 302+ 'text',
 303+ array( 'size' => 6 )
 304+ );
301305 } elseif ( $type == 'string' ) {
302 - return Xml::element( 'input', array(
303 - 'type' => 'text',
304 - 'name' => $paramName . '_' . $fieldFormText,
305 - 'value' => $cur_value,
306 - 'size' => 32
307 - ) );
 306+ return Html::input(
 307+ $paramName . '_' . $fieldFormText,
 308+ $cur_value,
 309+ 'text',
 310+ array( 'size' => 32 )
 311+ );
308312 } elseif ( $type == 'text' ) {
309 - return Xml::element( 'textarea', array(
 313+ return Html::element( 'textarea', array(
310314 'name' => $paramName . '_' . $fieldFormText,
311315 'rows' => 4
312316 ), $cur_value );
@@ -331,12 +335,9 @@
332336 }
333337 return $text;
334338 } elseif ( $type == 'boolean' ) {
335 - $checkboxAttrs = array(
336 - 'type' => 'checkbox',
337 - 'name' => $paramName . '_' . $fieldFormText
338 - );
339 - if ( $cur_value) { $checkboxAttrs['checked'] = 'checked'; }
340 - return Xml::element( 'input', $checkboxAttrs );
 339+ $checkboxAttrs = array();
 340+ if ( $cur_value) { $checkboxAttrs['checked'] = true; }
 341+ return Html::input( $paramName . '_' . $fieldFormText, null, 'checkbox', $checkboxAttrs );
341342 }
342343 }
343344
@@ -387,7 +388,7 @@
388389 $text .= "<div style=\"width: 30%; padding: 5px; float: left;\">$paramName:\n";
389390
390391 $text .= self::inputTypeParamInput( $type, $paramName, $cur_value, $param, array(), $fieldFormText );
391 - $text .= "\n<br />" . Xml::tags( 'em', null, $desc ) . "\n</div>\n";
 392+ $text .= "\n<br />" . Html::rawElement( 'em', null, $desc ) . "\n</div>\n";
392393
393394 if ( $i % 3 == 2 || $i == count( $params ) - 1 ) {
394395 $text .= "<div style=\"clear: both\";></div></div>\n";
Index: trunk/extensions/SemanticForms/specials/SF_CreateProperty.php
@@ -127,9 +127,9 @@
128128 END;
129129 $select_body = "";
130130 foreach ( $datatype_labels as $label ) {
131 - $select_body .= " " . Xml::element( 'option', null, $label ) . "\n";
 131+ $select_body .= " " . Html::element( 'option', null, $label ) . "\n";
132132 }
133 - $text .= Xml::tags( 'select', array( 'id' => 'property_dropdown', 'name' => 'property_type', 'onChange' => 'toggleDefaultForm(this.value); toggleAllowedValues(this.value);' ), $select_body ) . "\n";
 133+ $text .= Html::rawElement( 'select', array( 'id' => 'property_dropdown', 'name' => 'property_type', 'onChange' => 'toggleDefaultForm(this.value); toggleAllowedValues(this.value);' ), $select_body ) . "\n";
134134
135135 $default_form_input = wfMsg( 'sf_createproperty_linktoform' );
136136 $values_input = wfMsg( 'sf_createproperty_allowedvalsinput' );
@@ -144,9 +144,9 @@
145145 </div>
146146
147147 END;
148 - $edit_buttons = "\t" . Xml::element( 'input', array( 'id' => 'wpSave', 'type' => 'submit', 'name' => 'wpSave', 'value' => $save_button_text ) );
149 - $edit_buttons .= "\t" . Xml::element( 'input', array( 'id' => 'wpPreview', 'type' => 'submit', 'name' => 'wpPreview', 'value' => $preview_button_text ) );
150 - $text .= "\t" . Xml::tags( 'div', array( 'class' => 'editButtons' ), $edit_buttons ) . "\n";
 148+ $edit_buttons = "\t" . Html::input( 'wpSave', $save_button_text, 'submit', array( 'id' => 'wpSave' ) );
 149+ $edit_buttons .= "\t" . Html::input( 'wpPreview', $preview_button_text, 'submit', array( 'id' => 'wpPreview' ) );
 150+ $text .= "\t" . Html::rawElement( 'div', array( 'class' => 'editButtons' ), $edit_buttons ) . "\n";
151151 $text .= "\t</form>\n";
152152
153153 $wgOut->addExtensionStyle( $sfgScriptPath . "/skins/SemanticForms.css" );
Index: trunk/extensions/SemanticForms/specials/SF_CreateClass.php
@@ -204,18 +204,18 @@
205205 </div>
206206
207207 END;
208 - $add_another_button = Xml::element( 'input',
 208+ $add_another_button = Html::element( 'input',
209209 array(
210210 'type' => 'button',
211211 'value' => wfMsg( 'sf_formedit_addanother' ),
212212 'onclick' => "createClassAddRow()"
213213 )
214214 );
215 - $text .= Xml::tags( 'p', null, $add_another_button ) . "\n";
 215+ $text .= Html::rawElement( 'p', null, $add_another_button ) . "\n";
216216 // Set 'title' as hidden field, in case there's no URL niceness
217217 $cc = $this->getTitle();
218218 $text .= SFFormUtils::hiddenFieldHTML( 'title', SFUtils::titleURLString( $cc ) );
219 - $text .= Xml::element( 'input',
 219+ $text .= Html::element( 'input',
220220 array(
221221 'type' => 'submit',
222222 'name' => 'save',
Index: trunk/extensions/SemanticForms/specials/SF_FormEdit.php
@@ -59,7 +59,7 @@
6060
6161 $this->mError = wfMsg( $msg, $msgdata );
6262
63 - $wgOut->addHTML( Xml::element( 'p', array( 'class' => 'error' ), $this->mError ) );
 63+ $wgOut->addHTML( Html::element( 'p', array( 'class' => 'error' ), $this->mError ) );
6464
6565 } else {
6666 $this->mError = null;
@@ -145,10 +145,10 @@
146146 . "</div>\n";
147147
148148 } else {
149 - $text = Xml::tags( 'p', array( 'class' => 'error' ), wfMsgExt( 'sf_formstart_badform', 'parseinline', SFUtils::linkText( SF_NS_FORM, $form_name ) ) ) . "\n";
 149+ $text = Html::rawElement( 'p', array( 'class' => 'error' ), wfMsgExt( 'sf_formstart_badform', 'parseinline', SFUtils::linkText( SF_NS_FORM, $form_name ) ) ) . "\n";
150150 }
151151 } elseif ( $target_name === '' && $page_name_formula === '' ) {
152 - $text = Xml::element( 'p', array( 'class' => 'error' ), wfMsg( 'sf_formedit_badurl' ) ) . "\n";
 152+ $text = Html::element( 'p', array( 'class' => 'error' ), wfMsg( 'sf_formedit_badurl' ) ) . "\n";
153153 } else {
154154
155155 $save_page = $wgRequest->getCheck( 'wpSave' );
Index: trunk/extensions/SemanticForms/specials/SF_RunQuery.php
@@ -38,9 +38,9 @@
3939
4040 if ( !$form_title || !$form_title->exists() ) {
4141 if ( $form_name === '' ) {
42 - $text = Xml::element( 'p', array( 'class' => 'error' ), wfMsg( 'sf_runquery_badurl' ) ) . "\n";
 42+ $text = Html::element( 'p', array( 'class' => 'error' ), wfMsg( 'sf_runquery_badurl' ) ) . "\n";
4343 } else {
44 - $text = Xml::tags( 'p', array( 'class' => 'error' ),
 44+ $text = Html::rawElement( 'p', array( 'class' => 'error' ),
4545 wfMsgExt( 'sf_formstart_badform', 'parseinline', SFUtils::linkText( SF_NS_FORM, $form_name ) ) ) . "\n";
4646 }
4747 $wgOut->addHTML( $text );
@@ -111,7 +111,7 @@
112112 // the query form is at the top or bottom) is displayed
113113 // if the form has already been submitted.
114114 if ( $form_submitted ) {
115 - $additionalQueryHeader = "\n" . Xml::element( 'h2', null, wfMsg( 'sf_runquery_additionalquery' ) ) . "\n";
 115+ $additionalQueryHeader = "\n" . Html::element( 'h2', null, wfMsg( 'sf_runquery_additionalquery' ) ) . "\n";
116116 $dividerText = "\n<hr style=\"margin: 15px 0;\" />\n";
117117 }
118118 $action = htmlspecialchars( $this->getTitle( $form_name )->getLocalURL() );
@@ -156,7 +156,7 @@
157157 }
158158 }
159159
160 - // Finally, set the page title - for MW <= 1.16, this has to be
 160+ // Finally, set the page title - for MW 1.16, this has to be
161161 // called after addParserOutputNoText() for it to take effect.
162162 if ( !$embedded ) {
163163 if ( $form_page_title != null ) {
Index: trunk/extensions/SemanticForms/specials/SF_CreateTemplate.php
@@ -66,21 +66,21 @@
6767 foreach ( $all_properties as $prop_name ) {
6868 $optionAttrs = array( 'value' => $prop_name );
6969 if ( $selected_property == $prop_name ) { $optionAttrs['selected'] = 'selected'; }
70 - $selectBody .= Xml::element( 'option', $optionAttrs, $prop_name ) . "\n";
 70+ $selectBody .= Html::element( 'option', $optionAttrs, $prop_name ) . "\n";
7171 }
72 - return Xml::tags( 'select', array( 'name' => "semantic_property_$id" ), $selectBody ) . "\n";
 72+ return Html::rawElement( 'select', array( 'name' => "semantic_property_$id" ), $selectBody ) . "\n";
7373 }
7474
7575 public static function printFieldEntryBox( $id, $all_properties, $display = true ) {
7676 $fieldString = $display ? '' : 'id="starterField" style="display: none"';
7777 $text = "\t<div class=\"fieldBox\" $fieldString>\n";
7878 $text .= "\t<p>" . wfMsg( 'sf_createtemplate_fieldname' ) . ' ' .
79 - Xml::element( 'input',
80 - array( 'size' => '15', 'name' => 'name_' . $id ), null
 79+ Html::input( 'name_' . $id, null, 'text',
 80+ array( 'size' => '15' )
8181 ) . "\n";
8282 $text .= "\t" . wfMsg( 'sf_createtemplate_displaylabel' ) . ' ' .
83 - Xml::element( 'input',
84 - array( 'size' => '15', 'name' => 'label_' . $id ), null
 83+ Html::input( 'label_' . $id, null, 'text',
 84+ array( 'size' => '15' )
8585 ) . "\n";
8686
8787 $dropdown_html = self::printPropertiesDropdown( $all_properties, $id );
@@ -189,8 +189,8 @@
190190 $text .= "\t<p id=\"template_name_p\">" . wfMsg( 'sf_createtemplate_namelabel' ) . ' <input size="25" id="template_name" name="template_name" /></p>' . "\n";
191191 $text .= "\t<p>" . wfMsg( 'sf_createtemplate_categorylabel' ) . ' <input size="25" name="category" /></p>' . "\n";
192192 $text .= "\t<fieldset>\n";
193 - $text .= "\t" . Xml::element( 'legend', null, wfMsg( 'sf_createtemplate_templatefields' ) ) . "\n";
194 - $text .= "\t" . Xml::element( 'p', null, wfMsg( 'sf_createtemplate_fieldsdesc' ) ) . "\n";
 193+ $text .= "\t" . Html::element( 'legend', null, wfMsg( 'sf_createtemplate_templatefields' ) ) . "\n";
 194+ $text .= "\t" . Html::element( 'p', null, wfMsg( 'sf_createtemplate_fieldsdesc' ) ) . "\n";
195195
196196 $all_properties = self::getAllPropertyNames();
197197 $text .= '<div id="fieldsList">' . "\n";
@@ -198,34 +198,29 @@
199199 $text .= self::printFieldEntryBox( "starter", $all_properties, false );
200200 $text .= "</div>\n";
201201
202 - $add_field_button = Xml::element( 'input',
203 - array(
204 - 'type' => 'button',
205 - 'value' => wfMsg( 'sf_createtemplate_addfield' ),
206 - 'onclick' => "createTemplateAddField()"
207 - )
 202+ $add_field_button = Html::input(
 203+ null,
 204+ wfMsg( 'sf_createtemplate_addfield' ),
 205+ 'button',
 206+ array( 'onclick' => "createTemplateAddField()" )
208207 );
209 - $text .= Xml::tags( 'p', null, $add_field_button ) . "\n";
 208+ $text .= Html::rawElement( 'p', null, $add_field_button ) . "\n";
210209 $text .= "\t</fieldset>\n";
211210 $text .= "\t<fieldset>\n";
212 - $text .= "\t" . Xml::element( 'legend', null, wfMsg( 'sf_createtemplate_aggregation' ) ) . "\n";
213 - $text .= "\t" . Xml::element( 'p', null, wfMsg( 'sf_createtemplate_aggregationdesc' ) ) . "\n";
 211+ $text .= "\t" . Html::element( 'legend', null, wfMsg( 'sf_createtemplate_aggregation' ) ) . "\n";
 212+ $text .= "\t" . Html::element( 'p', null, wfMsg( 'sf_createtemplate_aggregationdesc' ) ) . "\n";
214213 $text .= "\t<p>" . wfMsg( 'sf_createtemplate_semanticproperty' ) . ' ' .
215214 self::printPropertiesDropdown( $all_properties, "aggregation" ) . "</p>\n";
216215 $text .= "\t<p>" . wfMsg( 'sf_createtemplate_aggregationlabel' ) . ' ' .
217 - Xml::element( 'input',
218 - array( 'size' => '25', 'name' => 'aggregation_label' ), null ) .
 216+ Html::input( 'aggregation_label', null, 'text',
 217+ array( 'size' => '25' ) ) .
219218 "</p>\n";
220219 $text .= "\t</fieldset>\n";
221220 $text .= "\t<p>" . wfMsg( 'sf_createtemplate_outputformat' ) . "\n";
222 - $text .= "\t" . Xml::element( 'input', array(
223 - 'type' => 'radio',
224 - 'name' => 'template_format',
225 - 'checked' => 'checked',
226 - 'value' => 'standard'
 221+ $text .= "\t" . Html::input( 'template_format', 'standard', 'radio', array(
 222+ 'checked' => true,
227223 ), null ) . ' ' . wfMsg( 'sf_createtemplate_standardformat' ) . "\n";
228 - $text .= "\t" . Xml::element( 'input',
229 - array( 'type' => 'radio', 'name' => 'template_format', 'value' => 'infobox'), null ) .
 224+ $text .= "\t" . Html::input( 'template_format', 'infobox', 'radio', null ) .
230225 ' ' . wfMsg( 'sf_createtemplate_infoboxformat' ) . "</p>\n";
231226 $save_button_text = wfMsg( 'savearticle' );
232227 $preview_button_text = wfMsg( 'preview' );
@@ -240,7 +235,7 @@
241236 $sk = $wgUser->getSkin();
242237 $create_property_link = SFUtils::linkForSpecialPage( $sk, 'CreateProperty' );
243238 $text .= "\t<br /><hr /><br />\n";
244 - $text .= "\t" . Xml::tags( 'p', null, $create_property_link . '.' ) . "\n";
 239+ $text .= "\t" . Html::rawElement( 'p', null, $create_property_link . '.' ) . "\n";
245240
246241 $wgOut->addExtensionStyle( $sfgScriptPath . "/skins/SemanticForms.css" );
247242 $wgOut->addHTML( $text );
Index: trunk/extensions/SemanticForms/includes/SF_FormField.php
@@ -83,6 +83,7 @@
8484 $f->mInputName = $inputName;
8585 $f->mIsDisabled = $isDisabled;
8686 $f->mIsList = $isList;
 87+ $f->mAllFields = $allFields;
8788 return $f;
8889 }
8990
@@ -156,7 +157,7 @@
157158 $hidden_text = wfMsg( 'sf_createform_hidden' );
158159 $selected_str = ( $cur_input_type == 'hidden' ) ? "selected" : "";
159160 $dropdownHTML .= " <option value=\"hidden\" $selected_str>($hidden_text)</option>\n";
160 - $text = "\t" . Xml::tags( 'select',
 161+ $text = "\t" . Html::rawElement( 'select',
161162 array(
162163 'class' => 'inputTypeSelector',
163164 'name' => 'input_type_' . $field_form_text,
@@ -197,17 +198,16 @@
198199 $propertyTypeStr = SFUtils::linkText( SMW_NS_TYPE, $propertyTypeLabel );
199200 }
200201 }
201 - $text .= Xml::tags( 'p', null, wfMsgExt( $propDisplayMsg, 'parseinline', $prop_link_text, $propertyTypeStr ) ) . "\n";
 202+ $text .= Html::rawElement( 'p', null, wfMsgExt( $propDisplayMsg, 'parseinline', $prop_link_text, $propertyTypeStr ) ) . "\n";
202203 }
203204 // If it's not a semantic field - don't add any text.
204205 $form_label_text = wfMsg( 'sf_createform_formlabel' );
205 - $form_label_input = Xml::element( 'input',
206 - array(
207 - 'type' => 'text',
208 - 'name' => 'label_' . $field_form_text,
209 - 'size' => 20,
210 - 'value' => $template_field->getLabel(),
211 - ), null );
 206+ $form_label_input = Html::input(
 207+ 'label_' . $field_form_text,
 208+ $template_field->getLabel(),
 209+ 'text',
 210+ array( 'size' => 20 )
 211+ );
212212 $input_type_text = wfMsg( 'sf_createform_inputtype' );
213213 $text .= <<<END
214214 <div class="formField">
@@ -246,7 +246,7 @@
247247 }
248248
249249 $text .= "<fieldset class=\"sfCollapsibleFieldset\"><legend>Other parameters</legend>\n";
250 - $text .= Xml::tags( 'div', array( 'class' => 'otherInputParams' ),
 250+ $text .= Html::rawElement( 'div', array( 'class' => 'otherInputParams' ),
251251 SFCreateForm::showInputTypeOptions( $cur_input_type, $field_form_text, $paramValues ) ) . "\n";
252252 $text .= "</fieldset>\n";
253253 $text .= <<<END
Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -235,8 +235,6 @@
236236 global $sfgTabIndex, $sfgScriptPath;
237237
238238 $attributes = array(
239 - 'type' => 'button',
240 - 'value' => wfMsg( 'sf_formedit_remove' ),
241239 'tabindex' => $sfgTabIndex,
242240 'class' => 'remover',
243241 );
@@ -248,7 +246,7 @@
249247 $rearranger = '';
250248 }
251249
252 - $removeButton = Xml::element( 'input', $attributes );
 250+ $removeButton = Html::input( null, wfMsg( 'sf_formedit_remove' ), 'button', $attributes );
253251
254252 $text = <<<END
255253 <table>
@@ -278,7 +276,7 @@
279277 // with from any inputs added by the Javascript.
280278 $section = str_replace( '[num]', "[{$instance_num}a]", $section );
281279
282 - $text = "\t\t" . Xml::tags( 'div',
 280+ $text = "\t\t" . Html::rawElement( 'div',
283281 array(
284282 // The "multipleTemplate" class is there for
285283 // backwards-compatibility with any custom CSS on people's
@@ -293,7 +291,7 @@
294292 // template - print all the sections
295293 // necessary for adding additional
296294 // instances.
297 - $text = "\t\t" . Xml::tags( 'div',
 295+ $text = "\t\t" . Html::rawElement( 'div',
298296 array(
299297 'class' => "multipleTemplateStarter",
300298 'style' => "display: none",
@@ -302,13 +300,11 @@
303301 ) . "\n";
304302
305303 $attributes = array(
306 - 'type' => 'button',
307 - 'value' => Sanitizer::decodeCharReferences( $add_button_text ),
308304 'tabindex' => $sfgTabIndex,
309305 'class' => 'multipleTemplateAdder',
310306 );
311 - if ( $form_is_disabled ) $attributes['disabled'] = 'disabled';
312 - $button = Xml::element( 'input', $attributes );
 307+ if ( $form_is_disabled ) $attributes['disabled'] = true;
 308+ $button = Html::input( null, Sanitizer::decodeCharReferences( $add_button_text ), 'button', $attributes );
313309 $text .= <<<END
314310 </div><!-- multipleTemplateList -->
315311 <p>$button</p>
Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.php
@@ -86,7 +86,7 @@
8787 if ( $label == null )
8888 $label = wfMsg( 'summary' );
8989 $disabled_text = ( $is_disabled ) ? " disabled" : "";
90 - $attr = Xml::expandAttributes( $attr );
 90+ $attr = Html::expandAttributes( $attr );
9191 $text = <<<END
9292 <span id='wpSummaryLabel'><label for='wpSummary'>$label</label></span>
9393 <input tabindex="$sfgTabIndex" type='text' value="" name='wpSummary' id='wpSummary' maxlength='200' size='60'$disabled_text$attr/>
@@ -109,10 +109,10 @@
110110 'tabindex' => $sfgTabIndex,
111111 );
112112 if ( $is_disabled ) {
113 - $attrs['disabled'] = 'disabled';
 113+ $attrs['disabled'] = true;
114114 }
115115 $text = "\t" . Xml::check( 'wpMinoredit', $checked, $attrs ) . "\n";
116 - $text .= "\t" . Xml::element( 'label', array(
 116+ $text .= "\t" . Html::element( 'label', array(
117117 'for' => 'wpMinoredit',
118118 'title' => $tooltip
119119 ), $label ) . "\n";
@@ -145,11 +145,11 @@
146146 'tabindex' => $sfgTabIndex,
147147 );
148148 if ( $is_disabled ) {
149 - $attrs['disabled'] = 'disabled';
 149+ $attrs['disabled'] = true;
150150 }
151151 $text = "\t" . Xml::check( 'wpWatchthis', $checked, $attrs ) . "\n";
152152 $tooltip = htmlspecialchars( wfMsg( 'tooltip-watch' ) );
153 - $text .= "\t" . Xml::element( 'label', array(
 153+ $text .= "\t" . Html::element( 'label', array(
154154 'for' => 'wpWatchthis',
155155 'title' => $tooltip
156156 ), $label ) . "\n";
@@ -160,29 +160,27 @@
161161 /**
162162 * Helper function to display a simple button
163163 */
164 - static function buttonHTML( $values ) {
165 - return "\t\t" . Xml::element( 'input', $values, '' ) . "\n";
 164+ static function buttonHTML( $name, $value, $type, $attrs ) {
 165+ return "\t\t" . Html::input( $name, $value, $type, $attrs ) . "\n";
166166 }
167167
168168 static function saveButtonHTML( $is_disabled, $label = null, $attr = array() ) {
169169 global $sfgTabIndex;
170170
171171 $sfgTabIndex++;
172 - if ( $label == null )
 172+ if ( $label == null ) {
173173 $label = wfMsg( 'savearticle' );
 174+ }
174175 $temp = $attr + array(
175176 'id' => 'wpSave',
176 - 'name' => 'wpSave',
177 - 'type' => 'submit',
178177 'tabindex' => $sfgTabIndex,
179 - 'value' => $label,
180178 'accesskey' => wfMsg( 'accesskey-save' ),
181179 'title' => wfMsg( 'tooltip-save' ),
182180 );
183181 if ( $is_disabled ) {
184 - $temp['disabled'] = '';
 182+ $temp['disabled'] = true;
185183 }
186 - return self::buttonHTML( $temp );
 184+ return self::buttonHTML( 'wpSave', $label, 'submit', $temp );
187185 }
188186
189187 static function saveAndContinueButtonHTML( $is_disabled, $label = null, $attr = array() ) {
@@ -196,11 +194,8 @@
197195
198196 $temp = $attr + array(
199197 'id' => 'wpSaveAndContinue',
200 - 'name' => 'wpSaveAndContinue',
201 - 'type' => 'button',
202198 'tabindex' => $sfgTabIndex,
203 - 'value' => $label,
204 - 'disabled' => 'disabled',
 199+ 'disabled' => true,
205200 'accesskey' => wfMsg( 'sf_formedit_accesskey_saveandcontinueediting' ),
206201 'title' => wfMsg( 'sf_formedit_tooltip_saveandcontinueediting' ),
207202 );
@@ -211,49 +206,45 @@
212207 $temp['class'] = 'sf-save_and_continue';
213208 }
214209
215 - return self::buttonHTML( $temp );
 210+ return self::buttonHTML( 'wpSaveAndContinue', $label, 'button', $temp );
216211 }
217212
218213 static function showPreviewButtonHTML( $is_disabled, $label = null, $attr = array() ) {
219214 global $sfgTabIndex;
220215
221216 $sfgTabIndex++;
222 - if ( $label == null )
 217+ if ( $label == null ) {
223218 $label = wfMsg( 'showpreview' );
 219+ }
224220 $temp = $attr + array(
225221 'id' => 'wpPreview',
226 - 'name' => 'wpPreview',
227 - 'type' => 'submit',
228222 'tabindex' => $sfgTabIndex,
229 - 'value' => $label,
230223 'accesskey' => wfMsg( 'accesskey-preview' ),
231224 'title' => wfMsg( 'tooltip-preview' ),
232225 );
233226 if ( $is_disabled ) {
234 - $temp['disabled'] = '';
 227+ $temp['disabled'] = true;
235228 }
236 - return self::buttonHTML( $temp );
 229+ return self::buttonHTML( 'wpPreview', $label, 'submit', $temp );
237230 }
238231
239232 static function showChangesButtonHTML( $is_disabled, $label = null, $attr = array() ) {
240233 global $sfgTabIndex;
241234
242235 $sfgTabIndex++;
243 - if ( $label == null )
 236+ if ( $label == null ) {
244237 $label = wfMsg( 'showdiff' );
 238+ }
245239 $temp = $attr + array(
246240 'id' => 'wpDiff',
247 - 'name' => 'wpDiff',
248 - 'type' => 'submit',
249241 'tabindex' => $sfgTabIndex,
250 - 'value' => $label,
251242 'accesskey' => wfMsg( 'accesskey-diff' ),
252243 'title' => wfMsg( 'tooltip-diff' ),
253244 );
254245 if ( $is_disabled ) {
255 - $temp['disabled'] = '';
 246+ $temp['disabled'] = true;
256247 }
257 - return self::buttonHTML( $temp );
 248+ return self::buttonHTML( 'wpDiff', $label, 'submit', $temp );
258249 }
259250
260251 static function cancelLinkHTML( $is_disabled, $label = null, $attr = array() ) {
@@ -284,12 +275,10 @@
285276 if ( $label == null ) {
286277 $label = wfMsg( 'runquery' );
287278 }
288 - return self::buttonHTML( $attr + array(
 279+ return self::buttonHTML( 'wpRunQuery', $label, 'submit',
 280+ $attr + array(
289281 'id' => 'wpRunQuery',
290 - 'name' => 'wpRunQuery',
291 - 'type' => 'submit',
292282 'tabindex' => $sfgTabIndex,
293 - 'value' => $label,
294283 'title' => $label,
295284 ) );
296285 }
Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php
@@ -246,14 +246,14 @@
247247 }
248248 if ( $inLinkType == 'button' ) {
249249 $str =
250 - Xml::tags( 'form', array( 'action' => $link_url, 'method' => 'get', 'class' => $classStr ),
251 - Xml::tags( 'button', array( 'type' => 'submit', 'value' => $inLinkStr ), $inLinkStr ) .
 250+ Html::rawElement( 'form', array( 'action' => $link_url, 'method' => 'get', 'class' => $classStr ),
 251+ Html::rawElement( 'button', array( 'type' => 'submit', 'value' => $inLinkStr ), $inLinkStr ) .
252252 $hidden_inputs
253253 );
254254 } elseif ( $inLinkType == 'post button' ) {
255255 $str =
256 - Xml::tags( 'form', array( 'action' => $link_url, 'method' => 'post', 'class' => $classStr ),
257 - Xml::tags( 'button', array( 'type' => 'submit', 'value' => $inLinkStr ), $inLinkStr ) .
 256+ Html::rawElement( 'form', array( 'action' => $link_url, 'method' => 'post', 'class' => $classStr ),
 257+ Html::rawElement( 'button', array( 'type' => 'submit', 'value' => $inLinkStr ), $inLinkStr ) .
258258 $hidden_inputs
259259 );
260260 } else {
@@ -265,7 +265,7 @@
266266 $classStr .= " new";
267267 }
268268 }
269 - $str = Xml::tags( 'a', array( 'href' => $link_url, 'class' => $classStr, 'title' => $inTooltip ), $inLinkStr );
 269+ $str = Html::rawElement( 'a', array( 'href' => $link_url, 'class' => $classStr, 'title' => $inTooltip ), $inLinkStr );
270270 }
271271 // hack to remove newline from beginning of output, thanks to
272272 // http://jimbojw.com/wiki/index.php?title=Raw_HTML_Output_from_a_MediaWiki_Parser_Function
@@ -334,12 +334,7 @@
335335 <p>
336336
337337 END;
338 - $formInputAttrs = array(
339 - 'type' => 'text',
340 - 'name' => 'page_name',
341 - 'size' => $inSize,
342 - 'value' => $inValue,
343 - );
 338+ $formInputAttrs = array( 'size' => $inSize );
344339
345340 // Now apply the necessary settings and Javascript, depending
346341 // on whether or not there's autocompletion (and whether the
@@ -373,7 +368,7 @@
374369 }
375370 }
376371
377 - $str .= "\t" . Xml::element( 'input', $formInputAttrs ) . "\n";
 372+ $str .= "\t" . Html::input( 'page_name', $inValue, 'text', $formInputAttrs ) . "\n";
378373
379374 // if the form start URL looks like "index.php?title=Special:FormStart"
380375 // (i.e., it's in the default URL style), add in the title as a
@@ -399,14 +394,7 @@
400395 $key = ( isset( $subcomponents[0] ) ) ? $subcomponents[0] : '';
401396 $val = ( isset( $subcomponents[1] ) ) ? $subcomponents[1] : '';
402397 if ( ! empty( $key ) ) {
403 - $str .= ' ' .
404 - Xml::element( 'input',
405 - array(
406 - 'type' => 'hidden',
407 - 'name' => $key,
408 - 'value' => $val,
409 - )
410 - ) . "\n";
 398+ $str .= '\t\t\t' . Html::hidden( $key, $val ) . "\n";
411399 }
412400 }
413401 $button_str = ( $inButtonStr != '' ) ? $inButtonStr : wfMsg( 'sf_formstart_createoredit' );
@@ -416,8 +404,8 @@
417405
418406 END;
419407 if ( ! empty( $inAutocompletionSource ) ) {
420 - $str .= ' ' .
421 - Xml::element( 'div',
 408+ $str .= "\t\t\t" .
 409+ Html::element( 'div',
422410 array(
423411 'class' => 'page_name_auto_complete',
424412 'id' => "div_$input_num",
@@ -611,35 +599,34 @@
612600 // To do that they need to use htmlentities instead of
613601 // braces and brackets
614602 $formcontent .=
615 - Xml::input( $key, false, Sanitizer::decodeCharReferences( $value ) , array( 'type' => 'hidden' ) );
 603+ Html::hidden( $key, Sanitizer::decodeCharReferences( $value ) );
616604 }
617605 }
618606
619607 if ( $linkString == null ) return null;
620608
621609 if ( $linkType == 'button' ) {
622 - $linkElement = Xml::tags( "button", array( 'class' => $classString ), $linkString );
 610+ $linkElement = Html::rawElement( 'button', array( 'class' => $classString ), $linkString );
623611 } elseif ( $linkType == 'link' ) {
624 - $linkElement = Xml::tags( "a", array( 'class' => $classString, 'href' => "#" ), $linkString );
 612+ $linkElement = Html::rawElement( 'a', array( 'class' => $classString, 'href' => "#" ), $linkString );
625613 } else {
626 - $linkElement = Xml::tags( "span", array( 'class' => $classString ), $linkString );
 614+ $linkElement = Html::rawElement( 'span', array( 'class' => $classString ), $linkString );
627615 }
628616
629617 if ( $summary == null ) {
630618 $summary = wfMsg( 'sf_autoedit_summary', "[[$wgTitle]]" );
631619 }
632620
633 - $formcontent .=
634 - Xml::input( 'wpSummary', false, $summary, array( 'type' => 'hidden' ) );
 621+ $formcontent .= Html::hidden( 'wpSummary', $summary );
635622
636 - $form = Xml::tags( 'form', array( 'class' => 'autoedit-data' ), $formcontent );
 623+ $form = Html::rawElement( 'form', array( 'class' => 'autoedit-data' ), $formcontent );
637624
638625 // ensure loading of jQuery and style sheets
639626 self::loadScriptsForAutoEdit( $parser );
640627
641 - $output = Xml::tags( "div", array( 'class' => "autoedit" ),
 628+ $output = Html::rawElement( 'div', array( 'class' => 'autoedit' ),
642629 $linkElement .
643 - Xml::tags( "span", array( 'class' => "autoedit-result" ), null ) .
 630+ Html::rawElement( 'span', array( 'class' => "autoedit-result" ), null ) .
644631 $form
645632 );
646633
Index: trunk/extensions/SemanticForms/includes/SF_TemplateInForm.php
@@ -174,12 +174,12 @@
175175 foreach ( $this->mFields as $field ) {
176176 $text .= $field->creationHTML( $template_num );
177177 }
178 - $removeTemplateButton = Xml::element( 'input', array(
179 - 'type' => 'submit',
180 - 'name' => 'del_' . $template_num,
181 - 'value' => wfMsg( 'sf_createform_removetemplate' )
182 - ) );
183 - $text .= "\t" . Xml::tags( 'p', null, $removeTemplateButton ) . "\n";
 178+ $removeTemplateButton = Html::input(
 179+ 'del_' . $template_num,
 180+ wfMsg( 'sf_createform_removetemplate' ),
 181+ 'submit'
 182+ );
 183+ $text .= "\t" . Html::rawElement( 'p', null, $removeTemplateButton ) . "\n";
184184 $text .= " </div>\n";
185185 return $text;
186186 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_ListBoxInput.php
@@ -53,7 +53,7 @@
5454 if ( in_array( $possible_value, $cur_values ) ) {
5555 $optionAttrs['selected'] = 'selected';
5656 }
57 - $optionsText .= Xml::element( 'option', $optionAttrs, $optionLabel );
 57+ $optionsText .= Html::element( 'option', $optionAttrs, $optionLabel );
5858 }
5959 $selectAttrs = array(
6060 'id' => $input_id,
@@ -68,10 +68,10 @@
6969 if ( $is_disabled ) {
7070 $selectAttrs['disabled'] = 'disabled';
7171 }
72 - $text = Xml::tags( 'select', $selectAttrs, $optionsText );
 72+ $text = Html::rawElement( 'select', $selectAttrs, $optionsText );
7373 $text .= SFFormUtils::hiddenFieldHTML( $input_name . '[is_list]', 1 );
7474 if ( $is_mandatory ) {
75 - $text = Xml::tags( 'span', array( 'class' => 'inputSpan mandatoryFieldSpan' ), $text );
 75+ $text = Html::rawElement( 'span', array( 'class' => 'inputSpan mandatoryFieldSpan' ), $text );
7676 }
7777
7878 if ( array_key_exists( 'show on select', $other_args ) ) {
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextInput.php
@@ -127,7 +127,7 @@
128128 'data-input-id' => $input_id
129129 );
130130
131 - $text = "\t" . Xml::element( 'a', $linkAttrs, $upload_label ) . "\n";
 131+ $text = "\t" . Html::element( 'a', $linkAttrs, $upload_label ) . "\n";
132132
133133 if ( $showPreview ) {
134134 $text .= Html::rawElement(
@@ -182,12 +182,9 @@
183183 }
184184
185185 $inputAttrs = array(
186 - 'type' => 'text',
187186 'id' => $input_id,
188187 'tabindex' => $sfgTabIndex,
189188 'class' => $className,
190 - 'name' => $input_name,
191 - 'value' => $cur_value,
192189 'size' => $size
193190 );
194191 if ( $is_disabled ) {
@@ -199,7 +196,7 @@
200197 if ( array_key_exists( 'placeholder', $other_args ) ) {
201198 $inputAttrs['placeholder'] = $other_args['placeholder'];
202199 }
203 - $text = Xml::element( 'input', $inputAttrs );
 200+ $text = Html::input( $input_name, $cur_value, 'text', $inputAttrs );
204201
205202 if ( array_key_exists( 'uploadable', $other_args ) && $other_args['uploadable'] == true ) {
206203 if ( array_key_exists( 'is_list', $other_args ) && $other_args['is_list'] == true ) {
@@ -226,7 +223,7 @@
227224 if ( $is_mandatory ) {
228225 $spanClass .= ' mandatoryFieldSpan';
229226 }
230 - $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text );
 227+ $text = Html::rawElement( 'span', array( 'class' => $spanClass ), $text );
231228 return $text;
232229 }
233230
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_CategoriesInput.php
@@ -111,7 +111,7 @@
112112 if ( $is_mandatory ) {
113113 $spanClass .= ' mandatoryFieldSpan';
114114 }
115 - $text = "\n" . Xml::tags( 'span', array( 'class' => $spanClass ), $text ) . "\n";
 115+ $text = "\n" . Html::rawElement( 'span', array( 'class' => $spanClass ), $text ) . "\n";
116116
117117 return $text;
118118 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_RadioButtonInput.php
@@ -70,17 +70,14 @@
7171 $input_id = "input_$sfgFieldNum";
7272
7373 $radiobutton_attrs = array(
74 - 'type' => 'radio',
7574 'id' => $input_id,
7675 'tabindex' => $sfgTabIndex,
77 - 'name' => $input_name,
78 - 'value' => $possible_value,
7976 );
8077 if ( $cur_value == $possible_value ) {
81 - $radiobutton_attrs['checked'] = 'checked';
 78+ $radiobutton_attrs['checked'] = true;
8279 }
8380 if ( $is_disabled ) {
84 - $radiobutton_attrs['disabled'] = 'disabled';
 81+ $radiobutton_attrs['disabled'] = true;
8582 }
8683 if ( $possible_value === '' ) { // blank/"None" value
8784 $label = wfMsg( 'sf_formedit_none' );
@@ -95,9 +92,9 @@
9693 $label = $possible_value;
9794 }
9895
99 - $text .= "\t" . Xml::openElement( 'span', $itemAttrs ) .
100 - Xml::element( 'input', $radiobutton_attrs ) . " $label\n" .
101 - Xml::closeElement( 'span' );
 96+ $text .= "\t" . Html::openElement( 'span', $itemAttrs ) .
 97+ Html::input( $input_name, $possible_value, 'radio', $radiobutton_attrs ) . " $label\n" .
 98+ Html::closeElement( 'span' );
10299 }
103100
104101 $spanClass = 'radioButtonSpan';
@@ -125,7 +122,7 @@
126123 'id' => $spanID,
127124 'class' => $spanClass
128125 );
129 - $text = Xml::tags( 'span', $spanAttrs, $text );
 126+ $text = Html::rawElement( 'span', $spanAttrs, $text );
130127
131128 return $text;
132129 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaWithAutocompleteInput.php
@@ -139,12 +139,7 @@
140140 $textarea_attrs = $other_args['placeholder'];
141141 }
142142
143 - // Bug in Xml::element()? It doesn't close the textarea tag
144 - // properly if the text inside is null - set it to '' instead.
145 - if ( is_null( $cur_value ) ) {
146 - $cur_value = '';
147 - }
148 - $textarea_input = Xml::element( 'textarea', $textarea_attrs, $cur_value, false );
 143+ $textarea_input = Html::element( 'textarea', $textarea_attrs, $cur_value );
149144 $text .= $textarea_input;
150145
151146 if ( array_key_exists( 'uploadable', $other_args ) && $other_args['uploadable'] == true ) {
@@ -160,7 +155,7 @@
161156 if ( $is_mandatory ) {
162157 $spanClass .= ' mandatoryFieldSpan';
163158 }
164 - $text = "\n" . Xml::tags( 'span', array( 'class' => $spanClass ), $text );
 159+ $text = "\n" . Html::rawElement( 'span', array( 'class' => $spanClass ), $text );
165160
166161 return $text;
167162 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_DropdownInput.php
@@ -82,7 +82,7 @@
8383 } else {
8484 $label = $possible_value;
8585 }
86 - $innerDropdown .= Xml::element( 'option', $optionAttrs, $label );
 86+ $innerDropdown .= Html::element( 'option', $optionAttrs, $label );
8787 }
8888 $selectAttrs = array(
8989 'id' => $input_id,
@@ -93,12 +93,12 @@
9494 if ( $is_disabled ) {
9595 $selectAttrs['disabled'] = 'disabled';
9696 }
97 - $text = Xml::tags( 'select', $selectAttrs, $innerDropdown );
 97+ $text = Html::rawElement( 'select', $selectAttrs, $innerDropdown );
9898 $spanClass = 'inputSpan';
9999 if ( $is_mandatory ) {
100100 $spanClass .= ' mandatoryFieldSpan';
101101 }
102 - $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text );
 102+ $text = Html::rawElement( 'span', array( 'class' => $spanClass ), $text );
103103 return $text;
104104 }
105105
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextWithAutocompleteInput.php
@@ -145,10 +145,7 @@
146146 }
147147
148148 $inputAttrs = array(
149 - 'type' => 'text',
150149 'id' => $input_id,
151 - 'name' => $input_name,
152 - 'value' => $cur_value,
153150 'size' => $size,
154151 'class' => $className,
155152 'tabindex' => $sfgTabIndex,
@@ -161,7 +158,7 @@
162159 $inputAttrs['autocompletedatatype'] = $remoteDataType;
163160 }
164161 if ( $is_disabled ) {
165 - $inputAttrs['disabled'] = 'disabled';
 162+ $inputAttrs['disabled'] = true;
166163 }
167164 if ( array_key_exists( 'maxlength', $other_args ) ) {
168165 $inputAttrs['maxlength'] = $other_args['maxlength'];
@@ -169,7 +166,7 @@
170167 if ( array_key_exists( 'placeholder', $other_args ) ) {
171168 $inputAttrs['placeholder'] = $other_args['placeholder'];
172169 }
173 - $text = "\n\t" . Xml::element( 'input', $inputAttrs ) . "\n";
 170+ $text = "\n\t" . Html::input( $input_name, $cur_value, 'text', $inputAttrs ) . "\n";
174171
175172 if ( array_key_exists( 'uploadable', $other_args ) && $other_args['uploadable'] == true ) {
176173 if ( array_key_exists( 'default filename', $other_args ) ) {
@@ -184,7 +181,7 @@
185182 if ( $is_mandatory ) {
186183 $spanClass .= ' mandatoryFieldSpan';
187184 }
188 - $text = "\n" . Xml::tags( 'span', array( 'class' => $spanClass ), $text );
 185+ $text = "\n" . Html::rawElement( 'span', array( 'class' => $spanClass ), $text );
189186
190187 return $text;
191188 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_ComboBoxInput.php
@@ -63,9 +63,9 @@
6464 }
6565 $autocompletionSource = str_replace( "'", "\'", $autocompletionSource );
6666
67 - $optionsText = Xml::element( 'option', array( 'value' => $cur_value ), null, false ) . "\n";
 67+ $optionsText = Html::element( 'option', array( 'value' => $cur_value ), null, false ) . "\n";
6868 foreach ( $values as $value ) {
69 - $optionsText .= Xml::element( 'option', array( 'value' => $value ), $value ) . "\n";
 69+ $optionsText .= Html::element( 'option', array( 'value' => $value ), $value ) . "\n";
7070 }
7171
7272 $selectAttrs = array(
@@ -82,13 +82,13 @@
8383 if ( array_key_exists( 'existing values only', $other_args ) ) {
8484 $selectAttrs['existingvaluesonly'] = 'true';
8585 }
86 - $selectText = Xml::tags( 'select', $selectAttrs, $optionsText );
 86+ $selectText = Html::rawElement( 'select', $selectAttrs, $optionsText );
8787
8888 $divClass = 'ui-widget';
8989 if ( $is_mandatory ) {
9090 $divClass .= ' mandatory';
9191 }
92 - $text = Xml::tags( 'div', array( 'class' => $divClass ), $selectText );
 92+ $text = Html::rawElement( 'div', array( 'class' => $divClass ), $selectText );
9393 return $text;
9494 }
9595
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_CategoryInput.php
@@ -106,7 +106,7 @@
107107 if ( $is_mandatory ) {
108108 $spanClass .= ' mandatoryFieldSpan';
109109 }
110 - $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text );
 110+ $text = Html::rawElement( 'span', array( 'class' => $spanClass ), $text );
111111
112112 return $text;
113113 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_DateInput.php
@@ -32,7 +32,7 @@
3333 if ( $name == $cur_month || ( $i + 1 ) == $cur_month ) {
3434 $optionAttrs['selected'] = 'selected';
3535 }
36 - $optionsText .= Xml::element( 'option', $optionAttrs, $name );
 36+ $optionsText .= Html::element( 'option', $optionAttrs, $name );
3737 }
3838 $selectAttrs = array(
3939 'class' => 'monthInput',
@@ -42,7 +42,7 @@
4343 if ( $is_disabled ) {
4444 $selectAttrs['disabled'] = 'disabled';
4545 }
46 - $text = Xml::tags( 'select', $selectAttrs, $optionsText );
 46+ $text = Html::rawElement( 'select', $selectAttrs, $optionsText );
4747 return $text;
4848 }
4949
@@ -106,7 +106,7 @@
107107 if ( $is_mandatory ) {
108108 $spanClass .= ' mandatoryFieldSpan';
109109 }
110 - $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text );
 110+ $text = Html::rawElement( 'span', array( 'class' => $spanClass ), $text );
111111 return $text;
112112 }
113113
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaInput.php
@@ -122,17 +122,12 @@
123123 $textarea_attrs['placeholder'] = $other_args['placeholder'];
124124 }
125125
126 - // Bug in Xml::element()? It doesn't close the textarea tag
127 - // properly if the text inside is null - set it to '' instead.
128 - if ( is_null( $cur_value ) ) {
129 - $cur_value = '';
130 - }
131 - $text = Xml::element( 'textarea', $textarea_attrs, $cur_value, false );
 126+ $text = Html::element( 'textarea', $textarea_attrs, $cur_value );
132127 $spanClass = 'inputSpan';
133128 if ( $is_mandatory ) {
134129 $spanClass .= ' mandatoryFieldSpan';
135130 }
136 - $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text );
 131+ $text = Html::rawElement( 'span', array( 'class' => $spanClass ), $text );
137132
138133 return $text;
139134 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxesInput.php
@@ -63,11 +63,8 @@
6464 }
6565
6666 $checkbox_attrs = array(
67 - 'type' => 'checkbox',
6867 'id' => $input_id,
6968 'tabindex' => $sfgTabIndex,
70 - 'name' => $cur_input_name,
71 - 'value' => $possible_value,
7269 'class' => $checkbox_class,
7370 );
7471 if ( in_array( $possible_value, $cur_values ) ) {
@@ -76,10 +73,10 @@
7774 if ( $is_disabled ) {
7875 $checkbox_attrs['disabled'] = 'disabled';
7976 }
80 - $checkbox_input = Xml::element( 'input', $checkbox_attrs );
 77+ $checkbox_input = Html::element( $cur_input_name, $possible_value, 'checkbox', $checkbox_attrs );
8178
8279 // Make a span around each checkbox, for CSS purposes.
83 - $text .= ' ' . Xml::tags( 'span',
 80+ $text .= "\t" . Html::rawElement( 'span',
8481 array( 'class' => $span_class ),
8582 $checkbox_input . ' ' . $label
8683 ) . "\n";
@@ -106,7 +103,7 @@
107104
108105 $text .= SFFormUtils::hiddenFieldHTML( $input_name . '[is_list]', 1 );
109106 $outerSpanAttrs = array( 'id' => $outerSpanID, 'class' => $outerSpanClass );
110 - $text = "\t" . Xml::tags( 'span', $outerSpanAttrs, $text ) . "\n";
 107+ $text = "\t" . Html::rawElement( 'span', $outerSpanAttrs, $text ) . "\n";
111108
112109 return $text;
113110 }
Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -230,7 +230,7 @@
231231 if ( $watch_this ) {
232232 $form_body .= SFFormUtils::hiddenFieldHTML( 'wpWatchthis', null );
233233 }
234 - $text .= Xml::tags(
 234+ $text .= Html::rawElement(
235235 'form',
236236 array(
237237 'id' => 'editform',
@@ -346,7 +346,7 @@
347347 'href' => $css_file
348348 );
349349 if ( !is_null( $parser ) ) {
350 - $parser->getOutput()->addHeadItem( Xml::element( 'link', $link ) );
 350+ $parser->getOutput()->addHeadItem( Html::element( 'link', $link ) );
351351 } else {
352352 $wgOut->addLink( $link );
353353 }
@@ -423,9 +423,9 @@
424424 $form_names = SFUtils::getAllForms();
425425 $select_body = "\n";
426426 foreach ( $form_names as $form_name ) {
427 - $select_body .= "\t" . Xml::element( 'option', null, $form_name ) . "\n";
 427+ $select_body .= "\t" . Html::element( 'option', null, $form_name ) . "\n";
428428 }
429 - return "\t" . Xml::tags( 'label', array( 'for' => 'formSelector' ), $form_label . wfMsg( 'colon-separator' ) ) . "\n" . Xml::tags( 'select', array( 'id' => 'formSelector', 'name' => 'form' ), $select_body ) . "\n";
 429+ return "\t" . Html::rawElement( 'label', array( 'for' => 'formSelector' ), $form_label . wfMsg( 'colon-separator' ) ) . "\n" . Html::rawElement( 'select', array( 'id' => 'formSelector', 'name' => 'form' ), $select_body ) . "\n";
430430 }
431431
432432 /**
Index: trunk/extensions/SemanticForms/includes/SF_FormEditTab.php
@@ -169,7 +169,7 @@
170170 $msg = $msg[0];
171171 }
172172
173 - $wgOut->addHTML( Xml::element( 'p', array( 'class' => 'error' ), wfMsg( $msg, $msgdata ) ) );
 173+ $wgOut->addHTML( Html::element( 'p', array( 'class' => 'error' ), wfMsg( $msg, $msgdata ) ) );
174174
175175 }
176176

Follow-up revisions

RevisionCommit summaryAuthorDate
r109105Fix for r109076yaron04:15, 17 January 2012
r109363Follow-up to r109076 - replaced openElement() and closeElement() with rawElem...yaron13:56, 18 January 2012
r109381Fix for r109076 - literal '\t' should have been "\t"yaron16:03, 18 January 2012
r115097Follow-up to r109076 - replaced Html::input() call with Xml::radio(), because...yaron21:57, 30 April 2012