Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php |
— | — | @@ -8,6 +8,7 @@ |
9 | 9 | var $formClass = ''; |
10 | 10 | var $formAtts = ''; |
11 | 11 | var $type = ''; |
| 12 | + var $record = ''; |
12 | 13 | var $types = array(); |
13 | 14 | var $orderBy = ''; |
14 | 15 | var $desc = false; |
— | — | @@ -29,8 +30,8 @@ |
30 | 31 | $this->setHeaders(); |
31 | 32 | $type = $wgRequest->getText( 'wpType' ) or $type = $param; |
32 | 33 | $newtype = $wgRequest->getText( 'wpNewType' ); |
33 | | - $record = $wgRequest->getText( 'wpRecord' ); |
34 | 34 | $invert = $wgRequest->getText( 'wpInvert' ); |
| 35 | + $record = $this->record = $wgRequest->getText( 'wpRecord' ); |
35 | 36 | $title = $this->title = Title::makeTitle( NS_SPECIAL, 'RecordAdmin' ); |
36 | 37 | $action = $title->getLocalURL( 'action=submit' ); |
37 | 38 | $wpTitle = trim( $wgRequest->getText( 'wpTitle' ) ); |
— | — | @@ -53,9 +54,6 @@ |
54 | 55 | # Extract the input names and types used in the form |
55 | 56 | $this->examineForm(); |
56 | 57 | |
57 | | - # Clear any default values |
58 | | - $this->populateForm( array() ); |
59 | | - |
60 | 58 | # Process Create New Type form if submitted and user permitted |
61 | 59 | if ( $newtype ) { |
62 | 60 | $this->createRecordType( $newtype ); |
— | — | @@ -435,9 +433,9 @@ |
436 | 434 | if ( $v ) $html = preg_replace( "|(/?>)$|", " checked $1", $html ); |
437 | 435 | break; |
438 | 436 | 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 |
440 | 439 | if ( $v ) { |
441 | | - $html = preg_replace( "|(<option[^<>]*) selected|", "$1", $html ); # remove the currently selected option |
442 | 440 | $html = preg_match( "|<option[^>]+value\s*=|s", $html ) |
443 | 441 | ? preg_replace( "|(<option)([^>]+value\s*=\s*[\"']{$v}['\"])|s", "$1 selected$2", $html ) |
444 | 442 | : preg_replace( "|(<option[^>]*)(?=>$v</option>)|s", "$1 selected", $html ); |
Index: trunk/extensions/RecordAdmin/RecordAdmin.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | * @licence GNU General Public Licence 2.0 or later |
13 | 13 | */ |
14 | 14 | |
15 | | -define( 'RECORDADMIN_VERSION', '0.5.9, 2009-03-19' ); |
| 15 | +define( 'RECORDADMIN_VERSION', '0.5.10, 2009-03-20' ); |
16 | 16 | |
17 | 17 | $wgRecordAdminUseNamespaces = false; # Whether record articles should be in a namespace of the same name as their type |
18 | 18 | $wgRecordAdminCategory = 'Records'; # Category containing record types |