Revision: 48621
Author:   nad
Date:     2009-03-20 03:32:12 +0000 (Fri, 20 Mar 2009)

Log Message:
-----------
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
    trunk/extensions/RecordAdmin/RecordAdmin_body.php

Modified: trunk/extensions/RecordAdmin/RecordAdmin.php
===================================================================
--- trunk/extensions/RecordAdmin/RecordAdmin.php        2009-03-20 03:12:51 UTC 
(rev 48620)
+++ trunk/extensions/RecordAdmin/RecordAdmin.php        2009-03-20 03:32:12 UTC 
(rev 48621)
@@ -11,7 +11,7 @@
  * @licence GNU General Public Licence 2.0 or later
  */
 
-define( 'RECORDADMIN_VERSION', '0.5.9, 2009-03-19' );
+define( 'RECORDADMIN_VERSION', '0.5.10, 2009-03-20' );
 
 $wgRecordAdminUseNamespaces = false;     # Whether record articles should be 
in a namespace of the same name as their type
 $wgRecordAdminCategory      = 'Records'; # Category containing record types

Modified: trunk/extensions/RecordAdmin/RecordAdmin_body.php
===================================================================
--- trunk/extensions/RecordAdmin/RecordAdmin_body.php   2009-03-20 03:12:51 UTC 
(rev 48620)
+++ trunk/extensions/RecordAdmin/RecordAdmin_body.php   2009-03-20 03:32:12 UTC 
(rev 48621)
@@ -8,6 +8,7 @@
        var $formClass = '';
        var $formAtts  = '';
        var $type      = '';
+       var $record    = '';
        var $types     = array();
        var $orderBy   = '';
        var $desc      = false;
@@ -29,8 +30,8 @@
                $this->setHeaders();
                $type     = $wgRequest->getText( 'wpType' ) or $type = $param;
                $newtype  = $wgRequest->getText( 'wpNewType' );
-               $record   = $wgRequest->getText( 'wpRecord' );
                $invert   = $wgRequest->getText( 'wpInvert' );
+               $record   = $this->record = $wgRequest->getText( 'wpRecord' );
                $title    = $this->title = Title::makeTitle( NS_SPECIAL, 
'RecordAdmin' );
                $action   = $title->getLocalURL( 'action=submit' );
                $wpTitle  = trim( $wgRequest->getText( 'wpTitle' ) );
@@ -53,9 +54,6 @@
                # Extract the input names and types used in the form
                $this->examineForm();
 
-               # Clear any default values
-               $this->populateForm( array() );
-
                # Process Create New Type form if submitted and user permitted
                if ( $newtype ) {
                        $this->createRecordType( $newtype );
@@ -435,9 +433,9 @@
                                        if ( $v ) $html = preg_replace( 
"|(/?>)$|", " checked $1", $html );
                                break;
                                case 'list':
-                                       $html = 
preg_replace_callback("|\{\{.+\}\}|s", array($this, 'parsePart'), $html); # 
parse any braces
+                                       $html = 
preg_replace_callback("|\{\{.+\}\}|s", array($this, 'parsePart'), $html);  # 
parse any braces
+                                       if ( empty( $this->record ) ) $html = 
preg_replace( "|(<option[^<>]*) selected|", "$1", $html ); # remove the 
currently selected option
                                        if ( $v ) {
-                                               $html = preg_replace( 
"|(<option[^<>]*) selected|", "$1", $html ); # remove the currently selected 
option
                                                $html = preg_match( 
"|<option[^>]+value\s*=|s", $html )
                                                        ? preg_replace( 
"|(<option)([^>]+value\s*=\s*[\"']{$v}['\"])|s", "$1 selected$2", $html )
                                                        : preg_replace( 
"|(<option[^>]*)(?=>$v</option>)|s", "$1 selected", $html );



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to