r48621 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48620‎ | r48621 | r48622 >
Date:03:32, 20 March 2009
Author:nad
Status:deferred
Tags:
Comment:
if defaults are supplied in forms, use then if values aren't supplied in record when updating but not when searching
Modified paths:
  • /trunk/extensions/RecordAdmin/RecordAdmin.php (modified) (history)
  • /trunk/extensions/RecordAdmin/RecordAdmin_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php
@@ -8,6 +8,7 @@
99 var $formClass = '';
1010 var $formAtts = '';
1111 var $type = '';
 12+ var $record = '';
1213 var $types = array();
1314 var $orderBy = '';
1415 var $desc = false;
@@ -29,8 +30,8 @@
3031 $this->setHeaders();
3132 $type = $wgRequest->getText( 'wpType' ) or $type = $param;
3233 $newtype = $wgRequest->getText( 'wpNewType' );
33 - $record = $wgRequest->getText( 'wpRecord' );
3434 $invert = $wgRequest->getText( 'wpInvert' );
 35+ $record = $this->record = $wgRequest->getText( 'wpRecord' );
3536 $title = $this->title = Title::makeTitle( NS_SPECIAL, 'RecordAdmin' );
3637 $action = $title->getLocalURL( 'action=submit' );
3738 $wpTitle = trim( $wgRequest->getText( 'wpTitle' ) );
@@ -53,9 +54,6 @@
5455 # Extract the input names and types used in the form
5556 $this->examineForm();
5657
57 - # Clear any default values
58 - $this->populateForm( array() );
59 -
6058 # Process Create New Type form if submitted and user permitted
6159 if ( $newtype ) {
6260 $this->createRecordType( $newtype );
@@ -435,9 +433,9 @@
436434 if ( $v ) $html = preg_replace( "|(/?>)$|", " checked $1", $html );
437435 break;
438436 case 'list':
439 - $html = preg_replace_callback("|\{\{.+\}\}|s", array($this, 'parsePart'), $html); # parse any braces
 437+ $html = preg_replace_callback("|\{\{.+\}\}|s", array($this, 'parsePart'), $html); # parse any braces
 438+ if ( empty( $this->record ) ) $html = preg_replace( "|(<option[^<>]*) selected|", "$1", $html ); # remove the currently selected option
440439 if ( $v ) {
441 - $html = preg_replace( "|(<option[^<>]*) selected|", "$1", $html ); # remove the currently selected option
442440 $html = preg_match( "|<option[^>]+value\s*=|s", $html )
443441 ? preg_replace( "|(<option)([^>]+value\s*=\s*[\"']{$v}['\"])|s", "$1 selected$2", $html )
444442 : preg_replace( "|(<option[^>]*)(?=>$v</option>)|s", "$1 selected", $html );
Index: trunk/extensions/RecordAdmin/RecordAdmin.php
@@ -11,7 +11,7 @@
1212 * @licence GNU General Public Licence 2.0 or later
1313 */
1414
15 -define( 'RECORDADMIN_VERSION', '0.5.9, 2009-03-19' );
 15+define( 'RECORDADMIN_VERSION', '0.5.10, 2009-03-20' );
1616
1717 $wgRecordAdminUseNamespaces = false; # Whether record articles should be in a namespace of the same name as their type
1818 $wgRecordAdminCategory = 'Records'; # Category containing record types

Status & tagging log