Revision: 48556
Author:   nad
Date:     2009-03-19 00:19:05 +0000 (Thu, 19 Mar 2009)

Log Message:
-----------
add support for value attributes in select lists

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-19 00:19:03 UTC 
(rev 48555)
+++ trunk/extensions/RecordAdmin/RecordAdmin.php        2009-03-19 00:19:05 UTC 
(rev 48556)
@@ -11,7 +11,7 @@
  * @licence GNU General Public Licence 2.0 or later
  */
 
-define( 'RECORDADMIN_VERSION', '0.5.7, 2009-03-11' );
+define( 'RECORDADMIN_VERSION', '0.5.8, 2009-03-19' );
 
 $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-19 00:19:03 UTC 
(rev 48555)
+++ trunk/extensions/RecordAdmin/RecordAdmin_body.php   2009-03-19 00:19:05 UTC 
(rev 48556)
@@ -414,9 +414,13 @@
                                        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( "|(<option[^<>]*) 
selected|", "$1", $html );
-                                       if ( $v ) $html = preg_replace( 
"|(<option[^>]*)(?=>$v</option>)|s", "$1 selected", $html );
+                                       $html = 
preg_replace_callback("|\{\{.+\}\}|s", array($this, 'parsePart'), $html); # 
parse any braces
+                                       $html = preg_replace( "|(<option[^<>]*) 
selected|", "$1", $html ); # remove the currently selected option
+                                       if ( $v ) { print "\"$v\"";
+                                               $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 );
+                                       }
                                break;
                                case 'blob':
                                        $html = preg_replace( 
"|>.*?(?=</textarea>)|s", ">$v", $html );



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

Reply via email to