Jason.ji has uploaded a new change for review.

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

Change subject: Fixed error message titles in VIKI.js.
......................................................................

Fixed error message titles in VIKI.js.

Change-Id: I94b6e0d4f54c95a429ea3c7b1a09ab7b1aa6f700

Bump version number

Change-Id: I8daa22c2625a89fec09a565a9d7bf60ddc3655a3

Parser function fixes

* Avoid PHP Notice for unset parameters
* Default pageTitles to current page
* Add ability to set delimiter for pageTitles

Change-Id: I5f8e0f4df39238b424bc8131f7dcc858fc8dc03d

Bump version number to 1.0.4

Change-Id: Ia842874f7bd43707994b5f7ae7bb66ce2ae11db3
---
M VIKI.js
M VIKI.php
M VikiJS.class.php
3 files changed, 21 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VIKI 
refs/changes/15/185215/1

diff --git a/VIKI.js b/VIKI.js
index dcdbd80..b0e72af 100644
--- a/VIKI.js
+++ b/VIKI.js
@@ -127,7 +127,7 @@
                        this.initialPageTitles = jQuery.parseJSON( pageTitles );
 
                        if ( this.initialPageTitles === null ) {
-                               self.showError( mw.message( 
'vikijs-error-missing-pageTitle' )
+                               self.showError( mw.message( 
'viki-error-missing-pageTitle' )
                                        .text() );
                                return;
                        }
@@ -215,7 +215,7 @@
                 */
                my.VikiJS.prototype.initializeErrorDiv = function() {
                        $( "#" + self.ErrorsDiv )
-                               .append( "<p><strong>" + mw.message( 
'vikijs-error-title' )
+                               .append( "<p><strong>" + mw.message( 
'viki-error-title' )
                                        .text() + "</strong></p>" );
                };
 
@@ -634,10 +634,10 @@
                                        if ( errorThrown === 'timeout' ) {
                                                // do something about this 
error, but then increment contentNamespacesFetched so it can continue to work.
                                                // default to just NS 0 (main).
-                                               self.showError( mw.message( 
'vikijs-timeout-content-namespace', wikiTitle )
+                                               self.showError( mw.message( 
'viki-timeout-content-namespace', wikiTitle )
                                                        .text() );
                                        } else {
-                                               self.showError( mw.message( 
'vikijs-error-content-namespace', wikiTitle )
+                                               self.showError( mw.message( 
'viki-error-content-namespace', wikiTitle )
                                                        .text() );
                                        }
                                        actuallySearchableWikis[ index 
].contentNamespaces = [ 0 ];
@@ -1296,7 +1296,7 @@
                                        wikiPageCheckSuccessHandler( data, 
textStatus, jqXHR, intraNode );
                                },
                                error: function() {
-                                       self.showError( mw.message( 
'vikijs-error-visit-node', intraNode.pageTitle )
+                                       self.showError( mw.message( 
'viki-error-visit-node', intraNode.pageTitle )
                                                .text() );
                                }
                        } );
@@ -1702,7 +1702,7 @@
                                        externalLinksSuccessHandler( data, 
textStatus, jqXHR, node );
                                },
                                error: function() {
-                                       self.showError( mw.message( 
'vikijs-error-external-links', node.pageTitle )
+                                       self.showError( mw.message( 
'viki-error-external-links', node.pageTitle )
                                                .text() );
                                }
                        } );
@@ -1723,7 +1723,7 @@
                                        intraWikiOutSuccessHandler( data, 
textStatus, jqXHR, node );
                                },
                                error: function() {
-                                       self.showError( mw.message( 
'vikijs-error-intrawiki-out', node.pageTitle )
+                                       self.showError( mw.message( 
'viki-error-intrawiki-out', node.pageTitle )
                                                .text() );
                                }
                        } );
@@ -1743,7 +1743,7 @@
                                        intraWikiInSuccessHandler( data, 
textStatus, jqXHR, node );
                                },
                                error: function() {
-                                       self.showError( mw.message( 
'vikijs-error-intrawiki-in', node.pageTitle )
+                                       self.showError( mw.message( 
'viki-error-intrawiki-in', node.pageTitle )
                                                .text() );
                                }
                        } );
@@ -1753,7 +1753,7 @@
                        function externalLinksSuccessHandler( data, textStatus, 
jqXHR, originNode ) {
 
                                if ( data.error ) {
-                                       self.showError( mw.message( 
'vikijs-error-external-links', node.pageTitle )
+                                       self.showError( mw.message( 
'viki-error-external-links', node.pageTitle )
                                                .text() );
                                        return;
                                }
@@ -1835,7 +1835,7 @@
                        function intraWikiOutSuccessHandler( data, textStatus, 
jqXHR, originNode ) {
 
                                if ( data.error ) {
-                                       self.showError( mw.message( 
'vikijs-error-intrawiki-out', node.pageTitle )
+                                       self.showError( mw.message( 
'viki-error-intrawiki-out', node.pageTitle )
                                                .text() );
                                        return;
                                }
@@ -1890,7 +1890,7 @@
                        function intraWikiInSuccessHandler( data, textStatus, 
jqXHR, originNode ) {
 
                                if ( data.error ) {
-                                       self.showError( mw.message( 
'vikijs-error-intrawiki-in', node.pageTitle )
+                                       self.showError( mw.message( 
'viki-error-intrawiki-in', node.pageTitle )
                                                .text() );
                                        return;
                                }
diff --git a/VIKI.php b/VIKI.php
index 1fc6d65..6541a6b 100644
--- a/VIKI.php
+++ b/VIKI.php
@@ -31,7 +31,7 @@
 * refreshLinks.php after setting this flag.
 */
 
-define( 'VIKIJS_VERSION', '1.0.2' );
+define( 'VIKIJS_VERSION', '1.0.4' );
 
 if ( !defined( 'MEDIAWIKI' ) ) {
        die( '<b>Error:</b> This file is part of a MediaWiki extension and 
cannot be run standalone.' );
@@ -109,23 +109,19 @@
        return true;
 }
 
-function viki( $parser, $pageTitles, $width, $height ) {
+function viki( Parser $parser ) {
        $myparams = func_get_args();
        array_shift( $myparams );
 
        $paramDictionary = vikiJS_parseParameters( $myparams );
 
-       $pageTitles = $paramDictionary["pageTitles"];
-       $width = $paramDictionary["width"];
-       $height = $paramDictionary["height"];
+       $width = isset( $paramDictionary['width'] ) ? (int) 
$paramDictionary['width'] : 1200;
+       $height = isset( $paramDictionary['height'] ) ? (int) 
$paramDictionary['height'] : 600;
+       $delimiter = isset( $paramDictionary['delimiter'] ) ? 
$paramDictionary['delimiter'] : ',';
+       $pageTitles = isset( $paramDictionary['pageTitles'] ) ? explode( 
$delimiter,
+                       $paramDictionary['pageTitles'] ) : array( 
$parser->getTitle()->getText() );
 
        $vikiJS = new VikiJS;
-
-       if ( !$width )
-               $width = 1200;
-       if ( !$height )
-               $height = 600;
-
        $output = $vikiJS->display( $parser, $pageTitles, $width, $height );
        $parser->disableCache();
        return array( $parser->insertStripItem( $output, $parser->mStripState ),
diff --git a/VikiJS.class.php b/VikiJS.class.php
index 1636f4c..57c5033 100644
--- a/VikiJS.class.php
+++ b/VikiJS.class.php
@@ -41,7 +41,7 @@
        /**
         * Adds a VIKI plugin ResourceLoader resource module to be loaded.
         *
-        * @param string $moduleName the name of the resource module to be 
loaded, 
+        * @param string $moduleName the name of the resource module to be 
loaded,
         * e.g. "ext.VikiSemanticTitle"
         */
 
@@ -112,7 +112,7 @@
                        $index++;
                }
 
-               $pageTitles_json = addslashes( json_encode( array_map( 'trim', 
explode( ',', $pageTitles ) ) ) );
+               $pageTitles_json = addslashes( json_encode( array_map( 'trim', 
$pageTitles ) ) );
                $modules_json = addslashes( json_encode( self::$modules ) );
                $divs_json = addslashes( json_encode( array( $graphdiv, 
$subdetailsdiv,
                        $sliderdiv, $errorsdiv ) ) );
@@ -149,4 +149,4 @@
 
                return $output;
        }
-}
\ No newline at end of file
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia842874f7bd43707994b5f7ae7bb66ce2ae11db3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VIKI
Gerrit-Branch: master
Gerrit-Owner: Jason.ji <[email protected]>

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

Reply via email to