http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73483

Revision: 73483
Author:   nad
Date:     2010-09-21 20:29:36 +0000 (Tue, 21 Sep 2010)

Log Message:
-----------
ensure $form title is an object before checking if it exists, and add prefs.js 
ready for wrapping forms in a tabset

Modified Paths:
--------------
    trunk/extensions/RecordAdmin/RecordAdmin_body.php

Modified: trunk/extensions/RecordAdmin/RecordAdmin_body.php
===================================================================
--- trunk/extensions/RecordAdmin/RecordAdmin_body.php   2010-09-21 20:26:19 UTC 
(rev 73482)
+++ trunk/extensions/RecordAdmin/RecordAdmin_body.php   2010-09-21 20:29:36 UTC 
(rev 73483)
@@ -52,7 +52,7 @@
         * Add record forms to page edit view
         */
        function onEditPage( $editPage ) {
-               global $wgOut, $wgJsMimeType;
+               global $wgOut, $wgJsMimeType, $wgStylePath;
 
                # Extract each of the top-level template calls in the content 
that have associated forms
                # - note multiple records are now allowed in an article, but 
only one of each type
@@ -62,7 +62,7 @@
                        if( $brace['DEPTH'] == 2 ) {
                                $name = $brace['NAME'];
                                $form = Title::newFromText( $name, NS_FORM );
-                               if( $form->exists() ) {
+                               if( is_object( $form ) && $form->exists() ) {
                                        $offset = $brace['OFFSET'];
                                        $length = $brace['LENGTH'];
                                        $records[$name] = substr( $content, 
$offset, $length );
@@ -75,6 +75,9 @@
                # If any were found, remove them from the textbox and render 
their forms instead
                if( $count > 0 ) {
 
+                       # Add the prefs JS for the tabset
+                       $wgOut->addScript( "<script 
src=\"$wgStylePath/common/prefs.js?269\"></script>" );
+
                        $editPage->textbox1 = str_replace( "\x07", "", $content 
);
 
                        $jsFormsList = array();



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

Reply via email to