Yaron Koren has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/264985

Change subject: Fix for 705c4dc - call RL::makeInlineScript() only for MW 1.25+
......................................................................

Fix for 705c4dc - call RL::makeInlineScript() only for MW 1.25+

Change-Id: I4768ae15e951a8a8fa1011838c6b8d244d733b9e
---
M specials/SF_FormEdit.php
M specials/SF_RunQuery.php
2 files changed, 19 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/85/264985/1

diff --git a/specials/SF_FormEdit.php b/specials/SF_FormEdit.php
index ff4dec8..c1e2467 100644
--- a/specials/SF_FormEdit.php
+++ b/specials/SF_FormEdit.php
@@ -177,7 +177,12 @@
                SFUtils::addFormRLModules();
 
                if ( isset( $result[ 'formJS' ] ) ) {
-                       $out->addScript( ResourceLoader::makeInlineScript( 
$result['formJS'] ) );
+                       if ( method_exists( 'ResourceLoader', 
'makeInlineScript' ) ) {
+                               // MW 1.25+
+                               $out->addScript( 
ResourceLoader::makeInlineScript( $result['formJS'] ) );
+                       } else {
+                               $out->addScript( '              <script 
type="text/javascript">' . "\n$result[formJS]\n" . '</script>' . "\n" );
+                       }
                }
 
                $out->addHTML( $text );
diff --git a/specials/SF_RunQuery.php b/specials/SF_RunQuery.php
index 5e96cbd..393b8b5 100644
--- a/specials/SF_RunQuery.php
+++ b/specials/SF_RunQuery.php
@@ -150,10 +150,21 @@
                // Now write everything to the screen.
                $wgOut->addHTML( $text );
                SFUtils::addFormRLModules( $embedded ? $wgParser : null );
+               $script = "\t\t" . '<script type="text/javascript">' . "\n" . 
$javascript_text . '</script>' . "\n";
                if ( $embedded ) {
-                       $wgParser->getOutput()->addHeadItem( 
ResourceLoader::makeInlineScript( $javascript_text ) );
+                       if ( method_exists( 'ResourceLoader', 
'makeInlineScript' ) ) {
+                               // MW 1.25+
+                               $wgParser->getOutput()->addHeadItem( 
ResourceLoader::makeInlineScript( $javascript_text ) );
+                       } else {
+                               $wgParser->getOutput()->addHeadItem( $script );
+                       }
                } else {
-                       $wgOut->addScript( ResourceLoader::makeInlineScript( 
$javascript_text ) );
+                       if ( method_exists( 'ResourceLoader', 
'makeInlineScript' ) ) {
+                               // MW 1.25+
+                               $wgOut->addScript( 
ResourceLoader::makeInlineScript( $javascript_text ) );
+                       } else {
+                               $wgOut->addScript( $script );
+                       }
                        $po = $wgParser->getOutput();
                        if ( $po ) {
                                // addParserOutputMetadata was introduced in 
1.24 when addParserOutputNoText was deprecated

-- 
To view, visit https://gerrit.wikimedia.org/r/264985
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4768ae15e951a8a8fa1011838c6b8d244d733b9e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>

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

Reply via email to