Sebschlicht2 has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/340736 )

Change subject: Bugfix: PHP 5.6 feature in MoocContentRenderer
......................................................................


Bugfix: PHP 5.6 feature in MoocContentRenderer

MoocContentRenderer.loadMessage used the PHP 5.6 syntax '...'.
It has been replaced by constructs supported in PHP 5.5.9 to match
the system dependencies of MediaWiki core.

Change-Id: Iddbf7310ea91958a863565a94541697596cb80e0
---
M includes/rendering/MoocContentRenderer.php
1 file changed, 16 insertions(+), 10 deletions(-)



diff --git a/includes/rendering/MoocContentRenderer.php 
b/includes/rendering/MoocContentRenderer.php
index 51a052a..81adb38 100644
--- a/includes/rendering/MoocContentRenderer.php
+++ b/includes/rendering/MoocContentRenderer.php
@@ -188,7 +188,8 @@
             $this->out->addWikiText('{{:' . $this->item->scriptTitle . '}}');
         } else {
             // show info box if script not created yet
-            $this->addEmptySectionBox(self::SECTION_KEY_SCRIPT, 
$this->item->scriptTitle);
+            // TODO pass link to edit script resource page
+            $this->addEmptySectionBox( self::SECTION_KEY_SCRIPT );
         }
         
         $this->endSection();
@@ -202,7 +203,8 @@
             $this->out->addWikiText('{{:' . $this->item->quizTitle . '}}');
         } else {
             // show info box if quiz not created yet
-            $this->addEmptySectionBox(self::SECTION_KEY_QUIZ, 
$this->item->quizTitle);
+            // TODO pass link to edit quiz resource page
+            $this->addEmptySectionBox( self::SECTION_KEY_QUIZ );
         }
         
         $this->endSection();
@@ -230,16 +232,18 @@
      * Adds an info box emphasising users to contribute to a currently empty 
section to the output.
      *
      * @param string $sectionKey key of the empty section
-     * @param array ...$params additional parameters passed to the message 
loading of the info box description
+     * @param string $editHref edit link
      */
-    protected function addEmptySectionBox($sectionKey, ...$params) {
+    protected function addEmptySectionBox( $sectionKey, $editHref = null ) {
         // TODO can we automatically prefix classes/ids? at least in LESS?
         $this->out->addHTML('<div class="section-empty-box">');
-        
+
         $this->out->addHTML('<span class="description">');
-        $this->out->addHTML($this->loadMessage('section-' . $sectionKey . 
'-empty-description', $params));
+        $this->out->addHTML( $this->loadMessage( 'section-' . $sectionKey . 
'-empty-description' ) );
         $this->out->addHTML('</span> ');
-        $this->out->addHTML('<a class="edit-link">');
+
+        $editHrefAttr = ( $editHref === null ) ? '' : 'href="' . $editHref . 
'"';
+        $this->out->addHTML( '<a class="edit-link"' . $editHrefAttr . '>' );
         $this->out->addHTML($this->loadMessage('section-' . $sectionKey . 
'-empty-edit-link'));
         $this->out->addHTML('</a>');
         // TODO do we need an additional text to point at external resources 
such as /script or general hints?
@@ -509,12 +513,14 @@
      * Loads a message in context of the MOOC extension.
      *
      * @param string $key message key
-     * @param array ...$params message parameters
+     * @param mixed $params,... additional message parameters
      * @return string internationalized message built
      */
-    protected function loadMessage($key, ...$params) {
+    protected function loadMessage( $key /*...*/ ) {
+        $params = func_get_args();
+        array_shift( $params );
         $key = 'mooc-' . $key;
-        $wfMessage = wfMessage($key, $params);
+        $wfMessage = wfMessage( $key, $params );
         return $wfMessage->text();
     }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iddbf7310ea91958a863565a94541697596cb80e0
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MOOC
Gerrit-Branch: master
Gerrit-Owner: Sebschlicht2 <sebschli...@uni-koblenz.de>
Gerrit-Reviewer: Sebschlicht2 <sebschli...@uni-koblenz.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to