jenkins-bot has submitted this change and it was merged.

Change subject: Jenkins requirements
......................................................................


Jenkins requirements

Added files from master branch that are required by the tests performed by
jenkins

Change-Id: If9eea1b116aeed96d500e6612daecf9c132bd64d
---
A .jshintignore
A .jshintrc
A Gruntfile.js
A composer.json
A package.json
M resources/bluespice.extjs/BS/CRUDPanel.js
M resources/bluespice.extjs/BS/form/CategoryBoxSelect.js
M resources/bluespice.extjs/BS/form/CategoryTree.js
M resources/bluespice.extjs/BS/form/UploadPanel.js
M resources/bluespice.extjs/BS/portal/ChartPortlet.js
M resources/bluespice.extjs/BS/portal/GridPortlet.js
M resources/bluespice.extjs/BS/portal/PortalDropZone.js
M resources/bluespice.extjs/BS/portal/PortalPanel.js
M resources/bluespice.extjs/BS/portal/Portlet.js
M resources/bluespice/bluespice.js
M resources/bluespice/bluespice.string.js
M resources/bluespice/bluespice.util.js
M resources/bluespice/bluespice.wikiText.js
18 files changed, 235 insertions(+), 111 deletions(-)

Approvals:
  Robert Vogel: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.jshintignore b/.jshintignore
new file mode 100644
index 0000000..eef0e20
--- /dev/null
+++ b/.jshintignore
@@ -0,0 +1,2 @@
+resources/extjs
+resources/bluespice.extjs/Ext.ux
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..d39be9a
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,26 @@
+{
+       // Enforcing
+       "bitwise": false,
+       "eqeqeq": false,
+       "freeze": false,
+       "latedef": true,
+       "noarg": true,
+       "nonew": true,
+       "undef": false,
+       "unused": false,
+       "strict": false,
+
+       // Relaxing
+       "es5": false,
+
+       // Environment
+       "browser": true,
+       "jquery": true,
+
+       "globals": {
+               "mediaWiki": false,
+               "mw": false,
+               "blueSpice": false,
+               "$": false
+       }
+}
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 0000000..bbc8978
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,43 @@
+/*jshint node:true */
+module.exports = function ( grunt ) {
+       grunt.loadNpmTasks( 'grunt-contrib-jshint' );
+       grunt.loadNpmTasks( 'grunt-jsonlint' );
+       grunt.loadNpmTasks( 'grunt-banana-checker' );
+
+       grunt.initConfig( {
+               jshint: {
+                       options: {
+                               jshintrc: true
+                       },
+                       all: [
+                               '**/*.js',
+                               '!node_modules/**',
+                               '!resources/bluespice.extjs/Ext.ux/**',
+                               '!resources/extjs/**'
+                       ]
+               },
+               banana: {
+                       all: [
+                               'i18n/core/',
+                               'i18n/credits/',
+                               'i18n/diferred/',
+                               'i18n/diagnostics/',
+                               'i18n/extjs/',
+                               'i18n/extjs-portal/',
+                               'i18n/installer/',
+                               'i18n/notifications/',
+                               'i18n/validator/'
+                       ]
+               },
+               jsonlint: {
+                       all: [
+                               '*.json',
+                               '**/*.json',
+                               '!node_modules/**'
+                       ]
+               }
+       } );
+
+       grunt.registerTask( 'test', [ 'jshint', 'jsonlint', 'banana' ] );
+       grunt.registerTask( 'default', 'test' );
+};
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..fa64b11
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,30 @@
+{
+       "name": "hallowelt/bluespice-foundation",
+       "description": "This package contains basic classes/functions/resources 
of BlueSpice for MediaWiki",
+       "keywords": [
+               "mediawiki",
+               "wiki"
+       ],
+       "license": "GPL-2.0+",
+       "type": "mediawiki-extension",
+       "homepage": "https://www.bluespice.com";,
+       "authors": [
+               {
+                       "name": "Hallo Welt! Medienwerkstatt GmbH",
+                       "email": "[email protected]",
+                       "homepage": "http://www.hallowelt.com";
+               }
+       ],
+       "require-dev": {
+               "jakub-onderka/php-parallel-lint": "0.9.2"
+       },
+       "scripts": {
+               "test": [
+                       "parallel-lint . --exclude vendor"
+               ]
+       },
+       "support": {
+               "issues": "https://sourceforge.net/projects/bluespice/support";,
+               "wiki": "https://help.bluespice.com";
+       }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..ebf5796
--- /dev/null
+++ b/package.json
@@ -0,0 +1,12 @@
+{
+  "scripts": {
+    "test": "grunt test"
+  },
+  "devDependencies": {
+    "grunt": "0.4.5",
+    "grunt-cli": "0.1.13",
+    "grunt-contrib-jshint": "0.11.3",
+    "grunt-banana-checker": "0.4.0",
+    "grunt-jsonlint": "1.0.7"
+  }
+}
diff --git a/resources/bluespice.extjs/BS/CRUDPanel.js 
b/resources/bluespice.extjs/BS/CRUDPanel.js
index c44d5c7..54a4675 100644
--- a/resources/bluespice.extjs/BS/CRUDPanel.js
+++ b/resources/bluespice.extjs/BS/CRUDPanel.js
@@ -11,6 +11,7 @@
  * @license    http://www.gnu.org/copyleft/gpl.html GNU Public License v2 or 
later
  * @filesource
  */
+/*jshint -W024 */
 
 Ext.define( 'BS.CRUDPanel', {
        extend: 'Ext.Panel',
diff --git a/resources/bluespice.extjs/BS/form/CategoryBoxSelect.js 
b/resources/bluespice.extjs/BS/form/CategoryBoxSelect.js
index 4eda7b2..b5be4dd 100644
--- a/resources/bluespice.extjs/BS/form/CategoryBoxSelect.js
+++ b/resources/bluespice.extjs/BS/form/CategoryBoxSelect.js
@@ -56,8 +56,7 @@
        },
        setValueByNames: function( names ) {
                this.setValue( names );
-               return;
-               if( this.store.isLoading() ) {
+               /*if( this.store.isLoading() ) {
                        this.deferSetValue( this.setValueByNames, names );
                        return;
                }
@@ -68,8 +67,7 @@
                        indexes.push( record.get( 'cat_id' ) );
                }, this );
 
-               this.setValue( indexes.join(',') + "" );
-
+               this.setValue( indexes.join(',') + "" );*/
        },
        deferSetValue: function( callback, value ) {
                this.deferredSetValueConf = {
diff --git a/resources/bluespice.extjs/BS/form/CategoryTree.js 
b/resources/bluespice.extjs/BS/form/CategoryTree.js
index 3486051..28f5b37 100644
--- a/resources/bluespice.extjs/BS/form/CategoryTree.js
+++ b/resources/bluespice.extjs/BS/form/CategoryTree.js
@@ -145,9 +145,9 @@
        
        btnAddCategoryClicked: function( btn, event ) {
                var textValue = this.tfNewCategory.getValue().replace(' ', '_');
-               if( textValue == '' ) return;
+               if( textValue === '' ) return;
                var existingIndex = this.chosenCategoriesStore.findExact( 
'text', textValue );
-               if(existingIndex != -1){
+               if ( existingIndex !== -1 ) {
                        this.tfNewCategory.setValue('');
                        return; //Prevent duplicates
                }
@@ -169,7 +169,9 @@
                var existingIndex = this.chosenCategoriesStore.findExact( 
                        'text', node.attributes.text.replace('_', ' ')
                );
-               if(existingIndex != -1) return; //Prevent duplicates
+               if ( existingIndex !== -1 ) {
+                       return; //Prevent duplicates
+               }
 
                var newIndex = this.chosenCategoriesStore.getCount();
                var newRecordData = { 
diff --git a/resources/bluespice.extjs/BS/form/UploadPanel.js 
b/resources/bluespice.extjs/BS/form/UploadPanel.js
index 7e05fd6..72cc619 100644
--- a/resources/bluespice.extjs/BS/form/UploadPanel.js
+++ b/resources/bluespice.extjs/BS/form/UploadPanel.js
@@ -74,10 +74,10 @@
                this.addEvents('reset', 'upload');
                this.callParent(arguments);
        },
-       onBtnResetClick: function() {
+       onBtnResetClick: function( btn, e ) {
                this.fireEvent('reset', this);
        },
-       onBtnUploadClick: function(form) {
+       onBtnUploadClick: function( btn, e ) {
                var form = this.getForm();
                this.fireEvent('upload', this, form);
        }
diff --git a/resources/bluespice.extjs/BS/portal/ChartPortlet.js 
b/resources/bluespice.extjs/BS/portal/ChartPortlet.js
index 88e25cb..c596b8b 100644
--- a/resources/bluespice.extjs/BS/portal/ChartPortlet.js
+++ b/resources/bluespice.extjs/BS/portal/ChartPortlet.js
@@ -89,7 +89,7 @@
                
                this.items = [
                        this.ctMain
-               ]
+               ];
 
                this.callParent(arguments);
        }
diff --git a/resources/bluespice.extjs/BS/portal/GridPortlet.js 
b/resources/bluespice.extjs/BS/portal/GridPortlet.js
index dbea058..c7b33cb 100644
--- a/resources/bluespice.extjs/BS/portal/GridPortlet.js
+++ b/resources/bluespice.extjs/BS/portal/GridPortlet.js
@@ -3,7 +3,7 @@
        height: 300,
 
        initComponent: function(){
-               
+
                //Some simple fixtures
                this.gdMainConfig = {
                        store: Ext.create('Ext.data.ArrayStore', {
@@ -34,11 +34,10 @@
                                },
                                dataIndex: 'change'
                        }]
-               }
-               
+               };
+
                this.beforeInitComponent();
 
-               
                this.gdMain = Ext.create('Ext.grid.Panel', {
                        height: this.height,
                        store: this.gdMainConfig.store,
@@ -46,11 +45,11 @@
                        columnLines: true,
                        columns: this.gdMainConfig.columns
                });
-               
+
                this.items = [
                        this.gdMain
                ];
-               
+
                this.afterInitComponent();
 
                this.callParent(arguments);
diff --git a/resources/bluespice.extjs/BS/portal/PortalDropZone.js 
b/resources/bluespice.extjs/BS/portal/PortalDropZone.js
index 6319c7a..5202d70 100644
--- a/resources/bluespice.extjs/BS/portal/PortalDropZone.js
+++ b/resources/bluespice.extjs/BS/portal/PortalDropZone.js
@@ -46,10 +46,10 @@
 
                // handle case scroll where scrollbars appear during drag
                var cw = portal.body.dom.clientWidth;
-               if (!this.lastCW) {
+               if ( !this.lastCW ) {
                        // set initial client width
                        this.lastCW = cw;
-               } else if (this.lastCW != cw) {
+               } else if ( this.lastCW !== cw ) {
                        // client width has changed, so refresh layout & grid 
calcs
                        this.lastCW = cw;
                        //portal.doLayout();
diff --git a/resources/bluespice.extjs/BS/portal/PortalPanel.js 
b/resources/bluespice.extjs/BS/portal/PortalPanel.js
index 6503938..b953148 100644
--- a/resources/bluespice.extjs/BS/portal/PortalPanel.js
+++ b/resources/bluespice.extjs/BS/portal/PortalPanel.js
@@ -50,10 +50,10 @@
                for (i = 0; i < len; i++) {
                        item = items[i];
                        item.columnWidth = 1 / len;
-                       last = (i == len-1);
+                       last = (i === len-1);
 
-                       if (!i) { // if (first)
-                               if (last) {
+                       if ( !i ) { // if (first)
+                               if ( last ) {
                                        item.addCls(firstAndLast);
                                } else {
                                        item.addCls('x-portal-column-first');
diff --git a/resources/bluespice.extjs/BS/portal/Portlet.js 
b/resources/bluespice.extjs/BS/portal/Portlet.js
index a547f1d..3ec1f28 100644
--- a/resources/bluespice.extjs/BS/portal/Portlet.js
+++ b/resources/bluespice.extjs/BS/portal/Portlet.js
@@ -84,7 +84,7 @@
                                        this.closing = false;
                                        this.fireEvent('close', this);
                                        this[closeAction]();
-                                       if (closeAction == 'hide') {
+                                       if (closeAction === 'hide') {
                                                this.el.setOpacity(1);
                                        }
                                },
diff --git a/resources/bluespice/bluespice.js b/resources/bluespice/bluespice.js
index 21c70cf..1e56c05 100644
--- a/resources/bluespice/bluespice.js
+++ b/resources/bluespice/bluespice.js
@@ -19,7 +19,7 @@
 
                var namespaceId = namespaceIds[lcNamespaceName];
                var ucNamespaceName = lcNamespaceName.toUpperCase();
-               if( namespaceId == 0 ) {
+               if( namespaceId === 0 ) {
                        ucNamespaceName = 'MAIN';
                }
                bs.ns['NS_'+ucNamespaceName] = namespaceId;
@@ -29,7 +29,7 @@
                        bs.ns.filter.ONLY_CONTENT_NS.push( namespaceId );
                }
 
-               if( namespaceId > 0 && namespaceId % 2 != 0 ) {
+               if( namespaceId > 0 && namespaceId % 2 !== 0 ) {
                        bs.ns.filter.NO_TALK.push( namespaceId );
                }
 
diff --git a/resources/bluespice/bluespice.string.js 
b/resources/bluespice/bluespice.string.js
index b11e306..edf5bfb 100644
--- a/resources/bluespice/bluespice.string.js
+++ b/resources/bluespice/bluespice.string.js
@@ -1,30 +1,31 @@
 //String functions
-String.prototype.ellipse = function( maxLength ) {
+String.prototype.ellipse = function ( maxLength ) {
        if ( this.length > maxLength ) {
                return this.substr( 0, maxLength-3 ) + '...';
        }
        return this;
 };
 
-String.prototype.trim = function() {
+String.prototype.trim = function () {
        // TODO MRG (21.09.10 16:29): warum \xA0? könnte man auch einen u-flag 
verwenden?
        var newString = this.replace(/^[\s\xA0]+/, "");
        newString = this.replace(/[\s\xA0]+$/, "");
        return newString;
 };
 
-String.prototype.startsWith = function( startString ) {
-       return ( this.match( "^" + startString ) == startString );
+// taken from 
http://stackoverflow.com/questions/646628/how-to-check-if-a-string-startswith-another-string
+String.prototype.startsWith = function ( startString ) {
+       return this.slice( 0, startString.length ) === startString;
 };
 
-String.prototype.endsWith = function( endString ) {
-       return ( this.match( endString + "$" ) == endString );
+String.prototype.endsWith = function ( endString ) {
+       return endString === '' || this.slice( -endString.length ) === 
endString;
 };
 
-String.prototype.format = function() {
+String.prototype.format = function () {
        var args = arguments;
        return this.replace(/{(\d+)}/g, function(match, number) {
-               return typeof args[number] != 'undefined' ? args[number] : 
match;
+               return typeof args[ number ] !== 'undefined' ? args[number] : 
match;
        });
 };
 //hint: 
http://stackoverflow.com/questions/3629183/why-doesnt-indexof-work-on-an-array-ie8/3629211#3629211
@@ -33,18 +34,17 @@
        {
                var len = this.length >>> 0;
 
-               var from = Number( arguments[1] ) || 0;
-               from = ( from < 0 )
-                               ? Math.ceil( from )
-                               : Math.floor( from );
-               if ( from < 0 )
+               var from = Number( arguments[ 1 ] ) || 0;
+               from = ( from < 0 ) ? Math.ceil( from ) : Math.floor( from );
+               if ( from < 0 ) {
                        from += len;
+               }
 
-               for ( ; from < len; from++ )
-               {
+               for ( ; from < len; from++ ) {
                        if ( from in this &&
-                                       this[from] === elt )
+                                       this[from] === elt ) {
                                return from;
+                       }
                }
                return -1;
        };
diff --git a/resources/bluespice/bluespice.util.js 
b/resources/bluespice/bluespice.util.js
index 3bb5c16..3433ca9 100644
--- a/resources/bluespice/bluespice.util.js
+++ b/resources/bluespice/bluespice.util.js
@@ -26,14 +26,16 @@
 
        /**
         * Shows an ExtJS 4 alert window to the user
+        *
         * @param {String} idPrefix: A {String} that allowes to identify the 
dialogs controls
         * @param {Object} windowCfg: Allowes parameters "title" and "text" 
with type {String}
         * @param {Object} callbackCfg: Allowes parameters "ok" with type 
{Function}
         * @return {BS.AlertDialog}: The BS.AlertDialog instance
         */
        function _alert( idPrefix, windowCfg, callbackCfg ) {
-               if (alerts[idPrefix])
-                       return alerts[idPrefix];
+               if (alerts[idPrefix]) {
+                       return alerts[ idPrefix ];
+               }
 
                if (!windowCfg.title && !windowCfg.titleMsg ) {
                        windowCfg.titleMsg = 'bs-extjs-hint';
@@ -111,16 +113,16 @@
        }
 
        function _getRemoteHandlerUrl( extension, method, params ) {
-               if (typeof(params) == 'undefined') {
+               if ( typeof( params ) === 'undefined' ) {
                        params = {};
                }
                var obj = {};
-               if (typeof(params) == 'object') {
+               if ( typeof( params ) === 'object' ) {
                        obj = params;
                } else {
-                       obj = {};
-                       for (i in params) {
-                               obj[i] = params[i];
+                       var i;
+                       for ( i in params ) {
+                               obj[ i ] = params[ i ];
                        }
                }
                obj.action = 'remote';
@@ -223,9 +225,9 @@
 
                                _selectedText = 
_textbox.value.substring(_startPos, endPos);
                                tempText = _textbox.value;
-                               _textbox.value = _textbox.value.substring(0, 
_startPos)
-                                       + 'bs_selection'
-                                       + _textbox.value.substring(endPos, 
_textbox.value.length);
+                               _textbox.value = _textbox.value.substring(0, 
_startPos) +
+                                       'bs_selection' +
+                                       _textbox.value.substring(endPos, 
_textbox.value.length);
 
                                _origText = _textbox.value;
                                _textbox.value = tempText;
@@ -314,7 +316,7 @@
                else if (iHrs > 0) sDateTimeOut = sMins ? mw.message( 
'bs-two-units-ago', sHrs, sMins).plain() : mw.message( 'bs-one-unit-ago', 
sHrs).plain();
                else if (iMins > 0) sDateTimeOut = sSecs ? mw.message( 
'bs-two-units-ago', sMins, sSecs).plain() : mw.message( 'bs-one-unit-ago', 
sMins).plain();
                else if (iSecs > 0) sDateTimeOut = mw.message( 
'bs-one-unit-ago', sSecs).plain();
-               else if (iSecs == 0) sDateTimeOut = mw.message( 'bs-now' 
).plain();
+               else if (iSecs === 0) sDateTimeOut = mw.message( 'bs-now' 
).plain();
 
                return sDateTimeOut;
        }
@@ -357,6 +359,7 @@
         * Creates a new value object with all the properties of "obj" but 
without
         * "data-bs-" prefixes. Leaves unprefixed properties untouched. May
         * override unprefixed doublets.
+        *
         * @param {Object} obj
         * @return {Object}
         */
@@ -374,6 +377,7 @@
 
        /**
         * Creates a new value object from a DOMNode object.
+        *
         * @param {Object} node
         * @return {Object}
         */
@@ -387,8 +391,10 @@
        }
 
        var _tempAnchor = null;
+
        /**
         * Gets all GET parameters from an url.
+        *
         * @param {Mixed} param [optional] The url to parse. May be a string, a 
anchor DOMElement or undefined. Default uses window.location.
         * @return {Object}
         */
@@ -432,6 +438,7 @@
 
        /**
         * Gets a GET parameter from an url.
+        *
         * @param {String} sParamName The requested parameters name
         * @param {String} sDefaultValue [optional] A default value if the 
param is not available. Default ist an empty string.
         * @param {Mixed} url [optional] The url to parse. May be a string, a 
anchor DOMElement or undefined. Default uses window.location.
@@ -440,17 +447,20 @@
        function _getUrlParam( sParamName, sDefaultValue, url ) {
                var sValue = sDefaultValue || '';
                var oParams = _getUrlParams( url );
+               var key;
 
-               for( var key in oParams ) {
-                       if( key == sParamName ) sValue = oParams[key];
+               for( key in oParams ) {
+                       if( key === sParamName ) {
+                               sValue = oParams[ key ];
+                       }
                }
                return sValue;
        }
 
        /**
         * Shows an input dialog and adds provided value to an ExtJS 
MulitSelect field
-        * @param {object} oSrc The ExtJS MulitSelect field
-        * @return {Void}
+        *
+        * @param {Object} oSrc The ExtJS MulitSelect field
         */
        function _addEntryToMultiSelect( oSrc ) {
                var sFieldName = oSrc.getAttribute( 'targetfield' 
).substring(2);
@@ -470,8 +480,8 @@
 
        /**
         * Removes an entry from an ExtJS MulitSelect field
-        * @param {object} oSrc The ExtJS MulitSelect field
-        * @return {Void}
+        *
+        * @param {Object} oSrc The ExtJS MulitSelect field
         */
        function _deleteEntryFromMultiSelect( oSrc ) {
                var sFieldName = oSrc.getAttribute( 'targetfield' 
).substring(2);
@@ -489,7 +499,7 @@
 
        function _wikiGetlink( params, str ) {
                var pageName = str || mw.config.get( 'wgPageName' );
-               var params = params || {};
+               params = params || {};
                params.title = pageName;
 
                var url = mw.util.wikiScript() + '?' + $.param(params);
@@ -570,4 +580,4 @@
 
        bs.util = util;
 
-}(mediaWiki, blueSpice, jQuery));
+}( mediaWiki, blueSpice, jQuery ) );
diff --git a/resources/bluespice/bluespice.wikiText.js 
b/resources/bluespice/bluespice.wikiText.js
index c4f4c88..a71ec17 100644
--- a/resources/bluespice/bluespice.wikiText.js
+++ b/resources/bluespice/bluespice.wikiText.js
@@ -11,21 +11,17 @@
                        protocol: '//'
                };
 
-               if ( typeof(cfg) === 'object' ) {
-                       this.properties = $.extend( this.properties, cfg );
-               } else{
-                       parsePropertiesFromString(cfg);
-               }
-
                function parsePropertiesFromString( wikiText ) {
-                       if ( wikiText === '' ) return;
+                       if ( wikiText === '' ) {
+                               return;
+                       }
 
                        //Trim left and right everything (including linebreaks) 
that is not a starting or ending link code
                        wikiText = 
wikiText.replace(/(^.*?\[|\].*?$|\r\n|\r|\n)/gm,'');
                        //wikiText = wikiText.substring(2, wikiText.length -2 
); //trim "[[" and "]]"
 
-                       var parts = wikiText.split(" ");
-                       me.properties.target = parts[0];
+                       var parts = wikiText.split( " " );
+                       me.properties.target = parts[ 0 ];
                        if( parts.length > 1 ) {
                                parts.shift();
                                me.properties.displayText = parts.join(' ');
@@ -39,8 +35,8 @@
                                '//'
                        ];
 
-                       for ( var i = 0; i < protocols.length; i++) {
-                               if( me.properties.target.indexOf(protocols[i]) 
=== 0 ) {
+                       for ( var i = 0; i < protocols.length; i++ ) {
+                               if( me.properties.target.indexOf( protocols[ i 
] ) === 0 ) {
                                        me.properties.protocol = protocols[i];
                                        me.properties.target = 
me.properties.target.substring(
                                                protocols[i].length
@@ -48,6 +44,12 @@
                                        break;
                                }
                        }
+               }
+
+               if ( typeof(cfg) === 'object' ) {
+                       this.properties = $.extend( this.properties, cfg );
+               } else{
+                       parsePropertiesFromString(cfg);
                }
 
                this.toString = function() {
@@ -129,39 +131,12 @@
                        nolink: false
                };
 
-               if ( typeof(cfg) === 'object' ) {
-                       this.properties = $.extend( this.properties, cfg );
-                       if ( this.properties.title === '' && 
this.properties.prefixedTitle !== '' ) {
-                               parseTitle( this.properties.prefixedTitle );
-                       }
-               } else{
-                       parsePropertiesFromString(cfg);
-               }
-
-               function parseTitle( title ) {
-                       if ( title.charAt( 0 ) === ':' ) {
-                               me.properties.escaped = true;
-                               title = title.substring( 1, title.length ); 
//remove leading ":""
-                       }
-
-                       me.properties.title = title;
-
-                       var titleParts = title.split( ':' );
-                       if ( titleParts.length > 1 ) {
-                               me.properties.nsText = titleParts.shift();
-                               me.properties.title = titleParts.join(':');
-
-                               var namespaceIds = mw.config.get( 
'wgNamespaceIds' );
-                               me.properties.nsId = 
namespaceIds[me.properties.nsText.toLocaleLowerCase()];
-                       }
-               }
-
                function parsePropertiesFromString( wikiText ) {
                        //Trim left and right everything (including linebreaks) 
that is not a starting or ending link code
                        wikiText = 
wikiText.replace(/(^.*?\[\[|\]\].*?$|\r\n|\r|\n)/gm,'');
 
                        var parts = wikiText.split( "|" );
-                       parseTitle( parts[0] ); //First token is prefixed title
+                       parseTitle( parts[ 0 ] ); //First token is prefixed 
title
 
                        //Process the rest
                        for ( var i = 1; i < parts.length; i++ ) {
@@ -225,13 +200,12 @@
                                        continue;
                                }
 
-                               var key = kvpair[0], value = kvpair[1];
+                               var key = kvpair[ 0 ], value = kvpair[ 1 ];
 
-                               if( $.inArray( key, ['link', 'verweis'] ) !== 
-1 ) {
-                                       if (value === ""){
+                               if ( $.inArray( key, [ 'link', 'verweis' ] ) 
!== -1 ) {
+                                       if ( value === "" ){
                                                me.properties.nolink = true;
-                                       }
-                                       else{
+                                       } else{
                                                me.properties.link = value;
                                        }
                                        continue;
@@ -247,6 +221,33 @@
                                        continue;
                                }
                        }
+               }
+
+               function parseTitle( title ) {
+                       if ( title.charAt( 0 ) === ':' ) {
+                               me.properties.escaped = true;
+                               title = title.substring( 1, title.length ); 
//remove leading ":""
+                       }
+
+                       me.properties.title = title;
+
+                       var titleParts = title.split( ':' );
+                       if ( titleParts.length > 1 ) {
+                               me.properties.nsText = titleParts.shift();
+                               me.properties.title = titleParts.join(':');
+
+                               var namespaceIds = mw.config.get( 
'wgNamespaceIds' );
+                               me.properties.nsId = 
namespaceIds[me.properties.nsText.toLocaleLowerCase()];
+                       }
+               }
+
+               if ( typeof( cfg ) === 'object' ) {
+                       this.properties = $.extend( this.properties, cfg );
+                       if ( this.properties.title === '' && 
this.properties.prefixedTitle !== '' ) {
+                               parseTitle( this.properties.prefixedTitle );
+                       }
+               } else{
+                       parsePropertiesFromString(cfg);
                }
 
                this.toString = function() {
@@ -275,7 +276,7 @@
                                if ( property === 'link' && ( value !== null &&
                                        value !== 'false' && value !== false &&
                                        typeof value !== "undefined" && value 
!== "" &&
-                                       this.properties['nolink'] === false) ) {
+                                       this.properties.nolink === false) ) {
                                        wikiText.push(property + '=' + value);
                                        continue;
                                }
@@ -445,13 +446,6 @@
                this.params = {};
                this.title = '';
 
-               if ( typeof(cfg) === 'object' ) { //"{ with: 'param' }"
-                       this.title = title; //"Some Template"
-                       this.params = $.extend( this.params, cfg );
-               } else{ //WikiText "{{Some Template|with=param}}"
-                       parseParamsFromString(cfg);
-               }
-
                function parseParamsFromString( wikiText ) {
                        //Trim left and right everything that is not a starting 
or ending template code
                        wikiText = wikiText.replace(/(^.*?\{\{|\}\}.*?$)/gm,'');
@@ -466,6 +460,13 @@
                        }
                }
 
+               if ( typeof(cfg) === 'object' ) { //"{ with: 'param' }"
+                       this.title = title; //"Some Template"
+                       this.params = $.extend( this.params, cfg );
+               } else{ //WikiText "{{Some Template|with=param}}"
+                       parseParamsFromString(cfg);
+               }
+
                this.toString = function() {
                        //Build wikitext
                        var wikiText = [];

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If9eea1b116aeed96d500e6612daecf9c132bd64d
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: REL1_23
Gerrit-Owner: Robert Vogel <[email protected]>
Gerrit-Reviewer: Dvogel hallowelt <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Ljonka <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Pwirth <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to