r103787 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103786‎ | r103787 | r103788 >
Date:21:30, 20 November 2011
Author:foxtrott
Status:deferred
Tags:
Comment:
improvements to input type options
Modified paths:
  • /trunk/extensions/SemanticForms/specials/SF_CreateForm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_CreateForm.php
@@ -307,6 +307,11 @@
308308 'value' => $cur_value,
309309 'size' => 32
310310 ) );
 311+ } elseif ( $type == 'text' ) {
 312+ return Xml::element( 'textarea', array(
 313+ 'name' => $paramName . '_' . $fieldFormText,
 314+ 'rows' => 4
 315+ ), $cur_value );
311316 } elseif ( $type == 'enumeration' ) {
312317 $text = '<select name="p[' . htmlspecialchars( $paramName ) . ']">';
313318 $text .= "\n <option value=''></option>\n";
@@ -349,6 +354,7 @@
350355 */
351356 public static function showInputTypeOptions( $inputType, $fieldFormText, $paramValues ) {
352357 global $sfgFormPrinter;
 358+ global $wgParser;
353359
354360 $text = '';
355361
@@ -365,9 +371,15 @@
366372 foreach ( $params as $i => $param ) {
367373 $paramName = $param['name'];
368374 $type = $param['type'];
369 - $desc = $param['description'];
 375+ $desc = $wgParser->parse( $param['description'], new Title(), new ParserOptions() )->getText();
370376
371 - $cur_value = ( array_key_exists( $paramName, $paramValues ) ) ? $paramValues[$paramName] : '';
 377+ if ( array_key_exists( $paramName, $paramValues ) ) {
 378+ $cur_value = $paramValues[$paramName];
 379+ } else if ( array_key_exists( 'default', $param ) ) {
 380+ $cur_value = $param['default'];
 381+ } else {
 382+ $cur_value = '';
 383+ }
372384
373385 // 3 values per row, with alternating colors for rows
374386 if ( $i % 3 == 0 ) {
@@ -378,7 +390,7 @@
379391 $text .= "<div style=\"width: 30%; padding: 5px; float: left;\">$paramName:\n";
380392
381393 $text .= self::inputTypeParamInput( $type, $paramName, $cur_value, $param, array(), $fieldFormText );
382 - $text .= "\n<br />" . Xml::element( 'em', null, $desc ) . "\n</div>\n";
 394+ $text .= "\n<br />" . Xml::tags( 'em', null, $desc ) . "\n</div>\n";
383395
384396 if ( $i % 3 == 2 || $i == count( $params ) - 1 ) {
385397 $text .= "<div style=\"clear: both\";></div></div>\n";