Jdlrobson has uploaded a new change for review.

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


Change subject: Allow MFResourceLoaderModule to handle files
......................................................................

Allow MFResourceLoaderModule to handle files

Sadly this means in debug mode you cannot access the exact file
(although you will get the correct line).
Can we deal with this trade off?
Without it there is no way to merge these modules

Change-Id: If3100ef40969dfcf824a8867cfd9db6a75ba35f9
---
M includes/Resources.php
M includes/modules/MFResourceLoaderModule.php
2 files changed, 91 insertions(+), 94 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/84/74684/1

diff --git a/includes/Resources.php b/includes/Resources.php
index 2aed95a..b82339b 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -152,85 +152,7 @@
                'position' => 'bottom',
        ),
 
-       'mobile.stable.plumbing' => array(
-               'messages' => array(
-                       // NagOverlay.js
-                       'mobile-frontend-photo-license' => array( 'parse' ),
-                       'mobile-frontend-photo-nag-1-bullet-1-heading',
-                       'mobile-frontend-photo-nag-1-bullet-1-text' => array( 
'parse' ),
-                       'mobile-frontend-photo-nag-1-bullet-2-heading',
-                       'mobile-frontend-photo-nag-1-bullet-2-text',
-                       'mobile-frontend-photo-nag-2-bullet-1-heading',
-                       'mobile-frontend-photo-nag-3-bullet-1-heading',
-                       'parentheses',
-                       'mobile-frontend-learn-more',
-                       'mobile-frontend-photo-nag-learn-more-heading',
-                       'mobile-frontend-photo-nag-learn-more-1' => array( 
'parse' ),
-                       'mobile-frontend-photo-nag-learn-more-2' => array( 
'parse' ),
-                       'mobile-frontend-photo-nag-learn-more-3' => array( 
'parse' ),
-                       // page.js
-                       'mobile-frontend-talk-overlay-header',
-                       'mobile-frontend-language-article-heading',
-                       // editor.js
-                       'mobile-frontend-editor-disabled',
-                       'mobile-frontend-editor-cta',
-                       'mobile-frontend-editor-edit',
-                       // modules/editor/EditorOverlay.js
-                       'mobile-frontend-editor-continue',
-                       'mobile-frontend-editor-cancel',
-                       'mobile-frontend-editor-keep-editing',
-                       'mobile-frontend-editor-license' => array( 'parse' ),
-                       'mobile-frontend-editor-placeholder',
-                       'mobile-frontend-editor-summary-placeholder',
-                       'mobile-frontend-editor-cancel-confirm',
-                       'mobile-frontend-editor-wait',
-                       'mobile-frontend-editor-guider',
-                       'mobile-frontend-editor-success',
-                       'mobile-frontend-editor-success-landmark-1' => array( 
'parse' ),
-                       'mobile-frontend-editor-refresh',
-                       'mobile-frontend-editor-error',
-                       'mobile-frontend-editor-error-conflict',
-                       'mobile-frontend-editor-error-loading',
-                       'mobile-frontend-editor-preview-header',
-                       'mobile-frontend-editor-error-preview',
-                       // modules/editor/EditorOverlay.js and modules/talk.js
-                       'mobile-frontend-editor-save',
-               ),
-               'localBasePath' => $localBasePath,
-               'localTemplateBasePath' => $localBasePath . '/templates',
-               'templates' => array(
-                       'overlays/editor',
-                       'section',
-                       'wikitext/commons-upload',
-                       // LanguageOverlay.js
-                       'overlays/languages',
-                       // leadphoto.js
-                       'leadPhoto',
-                       'overlay',
-                       'overlays/cleanup',
-                       'overlays/learnMore',
-                       // search-2.js
-                       'articleList',
-                       'overlays/search/search',
-                       // page.js
-                       'page',
-                       'languageSection',
-                       // PhotoUploader.js
-                       // For new page action menu
-                       'photoUploadAction',
-                       'photoUploader',
-                       // PhotoUploaderPreview.js
-                       'photoUploadPreview',
-                       // NagOverlay.js
-                       'photoNag',
-                       'ctaDrawer',
-               ),
-               'class' => 'MFResourceLoaderModule',
-       ),
-
-       'mobile.beta.plumbing' => array(
-               'localBasePath' => $localBasePath,
-               'localTemplateBasePath' => $localBasePath . '/templates',
+       'mobile.beta.common' => $wgMFMobileResourceTemplateBoilerplate + array(
                'templates' => array(
                        // talk.js
                        'overlays/talk',
@@ -239,12 +161,7 @@
                        // page.js
                        'pageActionTutorial',
                ),
-               'class' => 'MFResourceLoaderModule',
-       ),
-
-       'mobile.beta.common' => $wgMFMobileResourceBoilerplate + array(
                'dependencies' => array(
-                       'mobile.beta.plumbing',
                        'mobile.stable.common',
                ),
                'scripts' => array(
@@ -254,7 +171,6 @@
                        // LanguageOverlay.js
                        'mobile-frontend-language-header',
                        'mobile-frontend-language-site-choose',
-                       'mobile-frontend-language-footer',
                ),
        ),
 
@@ -320,17 +236,18 @@
                ),
        ),
 
-       'mobile.alpha.plumbing' => $wgMFMobileResourceTemplateBoilerplate + 
array(
+       'mobile.alpha.common' => $wgMFMobileResourceTemplateBoilerplate + array(
                'templates' => array(
                        'overlays/nearby',
                ),
        ),
+
        'mobile.alpha' => $wgMFMobileResourceBoilerplate + array(
                'dependencies' => array(
                        'mobile.stable',
                        'mobile.beta',
+                       'mobile.alpha.common',
                        'mobile.history',
-                       'mobile.alpha.plumbing',
                        'mobile.nearby',
                ),
                'messages' => array(
@@ -378,12 +295,38 @@
        ),
 
        // Important: This module is loaded on both mobile and desktop skin
-       'mobile.stable.common' => $wgMFMobileResourceBoilerplate + array(
+       'mobile.stable.common' => $wgMFMobileResourceTemplateBoilerplate + 
array(
                'dependencies' => array(
                        'mobile.startup',
-                       'mobile.stable.plumbing',
                        'mobile.toast.styles',
                        'mediawiki.jqueryMsg',
+               ),
+               'templates' => array(
+                       'overlays/editor',
+                       'section',
+                       'wikitext/commons-upload',
+                       // LanguageOverlay.js
+                       'overlays/languages',
+                       // leadphoto.js
+                       'leadPhoto',
+                       'overlay',
+                       'overlays/cleanup',
+                       'overlays/learnMore',
+                       // search-2.js
+                       'articleList',
+                       'overlays/search/search',
+                       // page.js
+                       'page',
+                       'languageSection',
+                       // PhotoUploader.js
+                       // For new page action menu
+                       'photoUploadAction',
+                       'photoUploader',
+                       // PhotoUploaderPreview.js
+                       'photoUploadPreview',
+                       // NagOverlay.js
+                       'photoNag',
+                       'ctaDrawer',
                ),
                'scripts' => array(
                        'javascripts/common/mf-view.js',
@@ -394,6 +337,7 @@
                        'javascripts/common/mf-navigation.js',
                        'javascripts/common/mf-notification.js',
                        'javascripts/views/page.js',
+
                        // Upload specific code
                        'javascripts/modules/uploads/LearnMoreOverlay.js',
                        'javascripts/modules/uploads/PhotoApi.js',
@@ -406,6 +350,48 @@
                        'javascripts/common/languages/LanguageOverlay.js',
                ),
                'messages' => array(
+                       // NagOverlay.js
+                       'mobile-frontend-photo-license' => array( 'parse' ),
+                       'mobile-frontend-photo-nag-1-bullet-1-heading',
+                       'mobile-frontend-photo-nag-1-bullet-1-text' => array( 
'parse' ),
+                       'mobile-frontend-photo-nag-1-bullet-2-heading',
+                       'mobile-frontend-photo-nag-1-bullet-2-text',
+                       'mobile-frontend-photo-nag-2-bullet-1-heading',
+                       'mobile-frontend-photo-nag-3-bullet-1-heading',
+                       'parentheses',
+                       'mobile-frontend-learn-more',
+                       'mobile-frontend-photo-nag-learn-more-heading',
+                       'mobile-frontend-photo-nag-learn-more-1' => array( 
'parse' ),
+                       'mobile-frontend-photo-nag-learn-more-2' => array( 
'parse' ),
+                       'mobile-frontend-photo-nag-learn-more-3' => array( 
'parse' ),
+                       // page.js
+                       'mobile-frontend-talk-overlay-header',
+                       'mobile-frontend-language-article-heading',
+                       // editor.js
+                       'mobile-frontend-editor-disabled',
+                       'mobile-frontend-editor-cta',
+                       'mobile-frontend-editor-edit',
+                       // modules/editor/EditorOverlay.js
+                       'mobile-frontend-editor-continue',
+                       'mobile-frontend-editor-cancel',
+                       'mobile-frontend-editor-keep-editing',
+                       'mobile-frontend-editor-license' => array( 'parse' ),
+                       'mobile-frontend-editor-placeholder',
+                       'mobile-frontend-editor-summary-placeholder',
+                       'mobile-frontend-editor-cancel-confirm',
+                       'mobile-frontend-editor-wait',
+                       'mobile-frontend-editor-guider',
+                       'mobile-frontend-editor-success',
+                       'mobile-frontend-editor-success-landmark-1' => array( 
'parse' ),
+                       'mobile-frontend-editor-refresh',
+                       'mobile-frontend-editor-error',
+                       'mobile-frontend-editor-error-conflict',
+                       'mobile-frontend-editor-error-loading',
+                       'mobile-frontend-editor-preview-header',
+                       'mobile-frontend-editor-error-preview',
+                       // modules/editor/EditorOverlay.js and modules/talk.js
+                       'mobile-frontend-editor-save',
+
                        // mf-navigation.js
                        'mobile-frontend-watchlist-cta-button-signup',
                        'mobile-frontend-watchlist-cta-button-login',
@@ -445,7 +431,7 @@
                        // LanguageOverlay.js
                        'mobile-frontend-language-header',
                        'mobile-frontend-language-site-choose',
-                       'mobile-frontend-language-footer',
+                       'mobile-frontend-language-footer' => array( 'parse' ),
                ),
        ),
 
diff --git a/includes/modules/MFResourceLoaderModule.php 
b/includes/modules/MFResourceLoaderModule.php
index 5961827..8444295 100644
--- a/includes/modules/MFResourceLoaderModule.php
+++ b/includes/modules/MFResourceLoaderModule.php
@@ -3,7 +3,7 @@
  * ResourceLoaderModule subclass for mobile
  * Allows basic parsing of messages without arguments
  */
-class MFResourceLoaderModule extends ResourceLoaderModule {
+class MFResourceLoaderModule extends ResourceLoaderFileModule {
        protected $dependencies = array();
        protected $parsedMessages = array();
        protected $messages = array();
@@ -13,6 +13,15 @@
        /** String: The local path to where templates are located, see 
__construct() */
        protected $localTemplateBasePath = '';
 
+
+       /**
+        * FIXME: Remove when templates and parsed messages in core
+        * @return bool
+        */
+       public function supportsURLLoading() {
+               return false;
+       }
+
        /**
         * Registers core modules and runs registration hooks.
         */
@@ -20,15 +29,15 @@
                foreach ( $options as $member => $option ) {
                        switch ( $member ) {
                                case 'localTemplateBasePath':
-                               case 'localBasePath':
                                        $this->{$member} = (string) $option;
                                        break;
                                case 'templates':
-                               case 'dependencies':
                                        $this->{$member} = (array) $option;
                                        break;
                                case 'messages':
                                        $this->processMessages( $option );
+                                       // Prevent them being reinitialised 
when parent construct is called.
+                                       unset( $options[$member] );
                                        break;
                        }
                }
@@ -38,6 +47,7 @@
                if ( !in_array( 'mobile.startup', $this->dependencies ) ) {
                        $this->dependencies[] = 'mobile.startup';
                }
+                parent::__construct( $options );
        }
 
        /**
@@ -136,7 +146,8 @@
         * @return String: JavaScript code for $context
         */
        public function getScript( ResourceLoaderContext $context ) {
-               return $this->addParsedMessages() . $this->getTemplateScript();
+               $script = parent::getScript( $context );
+               return $this->addParsedMessages() . $this->getTemplateScript() 
. $script;
        }
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If3100ef40969dfcf824a8867cfd9db6a75ba35f9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

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

Reply via email to