Index: trunk/extensions/SemanticForms/specials/SF_CreateForm.php |
— | — | @@ -239,33 +239,34 @@ |
240 | 240 | // disable 'save' and 'preview' buttons if user has not yet added any |
241 | 241 | // templates |
242 | 242 | $disabled_text = ( count( $form_templates ) == 0 ) ? "disabled" : ""; |
243 | | - $save_button_text = wfMsg( 'savearticle' ); |
244 | | - $preview_button_text = wfMsg( 'preview' ); |
245 | 243 | $add_button_text = wfMsg( 'sf_createform_add' ); |
246 | 244 | $sk = $wgUser->getSkin(); |
247 | 245 | $create_template_link = SFUtils::linkForSpecialPage( $sk, 'CreateTemplate' ); |
| 246 | + $text .= "\t" . Xml::element( 'input', array( 'type' => 'submit', 'name' => 'add_field', 'value' => $add_button_text ) ); |
248 | 247 | $text .= <<<END |
249 | | - <input type="submit" name="add_field" value="$add_button_text" /></p> |
| 248 | +</p> |
250 | 249 | <br /> |
251 | | - <div class="editButtons"> |
252 | | - <p> |
253 | | - <input type="submit" id="wpSave" name="wpSave" value="$save_button_text" $disabled_text /> |
254 | | - <input type="submit" id="wpPreview" name="wpPreview" value="$preview_button_text" $disabled_text /> |
255 | | - </p> |
256 | | - </div> |
257 | 250 | |
258 | 251 | END; |
| 252 | + $saveAttrs = array( 'type' => 'submit', 'id' => 'wpSave', 'name' => 'wpSave', 'value' => wfMsg( 'savearticle' ) ); |
| 253 | + if ( count( $form_templates ) == 0 ) { $saveAttrs['disabled'] = 'disabled'; } |
| 254 | + $editButtonsText .= "\t" . Xml::element( 'input', $saveAttrs ) . "\n"; |
| 255 | + $previewAttrs = array( 'type' => 'submit', 'id' => 'wpPreview', 'name' => 'wpPreview', 'value' => wfMsg( 'preview' ) ); |
| 256 | + if ( count( $form_templates ) == 0 ) { $previewAttrs['disabled'] = 'disabled'; } |
| 257 | + $editButtonsText .= "\t" . Xml::element( 'input', $previewAttrs ) . "\n"; |
| 258 | + $text .= "\t" . Xml::tags( 'div', array( 'class' => 'editButtons' ), |
| 259 | + Xml::tags( 'p', array(), $editButtonsText ) . "\n" ) . "\n"; |
259 | 260 | // explanatory message if buttons are disabled because no templates |
260 | 261 | // have been added |
261 | 262 | if ( count( $form_templates ) == 0 ) { |
262 | | - $text .= " " . Xml::element( 'p', null, "(" . wfMsg( 'sf_createtemplate_addtemplatebeforesave' ) . ")" ); |
| 263 | + $text .= "\t" . Xml::element( 'p', null, "(" . wfMsg( 'sf_createtemplate_addtemplatebeforesave' ) . ")" ); |
263 | 264 | } |
264 | 265 | $text .= <<<END |
265 | 266 | </form> |
266 | 267 | <hr /><br /> |
267 | 268 | |
268 | 269 | END; |
269 | | - $text .= " " . Xml::tags( 'p', null, $create_template_link . '.' ); |
| 270 | + $text .= "\t" . Xml::tags( 'p', null, $create_template_link . '.' ); |
270 | 271 | |
271 | 272 | $wgOut->addExtensionStyle( $sfgScriptPath . "/skins/SemanticForms.css" ); |
272 | 273 | $wgOut->addHTML( $text ); |
— | — | @@ -278,23 +279,19 @@ |
279 | 280 | */ |
280 | 281 | public static function inputTypeParamInput( $type, $param_name, $cur_value, array $param, array $paramValues, $fieldFormText ) { |
281 | 282 | if ( $type == 'int' ) { |
282 | | - return Html::input( |
283 | | - $param_name . '_' . $fieldFormText, |
284 | | - $cur_value, |
285 | | - 'text', |
286 | | - array( |
287 | | - 'size' => 6 |
288 | | - ) |
289 | | - ); |
| 283 | + return Xml::element( 'input', array( |
| 284 | + 'type' => 'text', |
| 285 | + 'name' => $param_name . '_' . $fieldFormText, |
| 286 | + 'value' => $cur_value, |
| 287 | + 'size' => 6 |
| 288 | + ) ); |
290 | 289 | } elseif ( $type == 'string' ) { |
291 | | - return Html::input( |
292 | | - $param_name . '_' . $fieldFormText, |
293 | | - $cur_value, |
294 | | - 'text', |
295 | | - array( |
296 | | - 'size' => 32 |
297 | | - ) |
298 | | - ); |
| 290 | + return Xml::element( 'input', array( |
| 291 | + 'type' => 'text', |
| 292 | + 'name' => $param_name . '_' . $fieldFormText, |
| 293 | + 'value' => $cur_value, |
| 294 | + 'size' => 32 |
| 295 | + ) ); |
299 | 296 | } elseif ( $type == 'enumeration' ) { |
300 | 297 | $text = '<select name="p[' . htmlspecialchars( $param_name ) . ']">'; |
301 | 298 | $text .= "\n <option value=''></option>\n"; |
— | — | @@ -317,11 +314,12 @@ |
318 | 315 | } |
319 | 316 | return $text; |
320 | 317 | } elseif ( $type == 'boolean' ) { |
321 | | - return Html::input( |
322 | | - $param_name . '_' . $fieldFormText, |
323 | | - null, |
324 | | - 'checkbox' |
| 318 | + $checkboxAttrs = array( |
| 319 | + 'type' => 'checkbox', |
| 320 | + 'name' => $param_name . '_' . $fieldFormText |
325 | 321 | ); |
| 322 | + if ( $cur_value) { $checkboxAttrs['checked'] = 'checked'; } |
| 323 | + return Xml::element( 'input', $checkboxAttrs ); |
326 | 324 | } |
327 | 325 | } |
328 | 326 | |
— | — | @@ -365,7 +363,7 @@ |
366 | 364 | $text .= "<div style=\"width: 30%; padding: 5px; float: left;\">$param_name:\n"; |
367 | 365 | |
368 | 366 | $text .= self::inputTypeParamInput( $type, $param_name, $cur_value, $param, array(), $fieldFormText ); |
369 | | - $text .= "\n <br /><em>$desc</em>\n</div>\n"; |
| 367 | + $text .= "\n<br />" . Xml::element( 'em', null, $desc ) . "\n</div>\n"; |
370 | 368 | |
371 | 369 | if ( $i % 3 == 2 || $i == count( $params ) - 1 ) { |
372 | 370 | $text .= "<div style=\"clear: both\";></div></div>\n"; |