[BUGFIX] Problems with Cardlayout
authorKay Strobach <typo3@kay-strobach.de>
Mon, 8 Aug 2011 20:13:14 +0000 (22:13 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 21 Aug 2011 15:45:28 +0000 (17:45 +0200)
This fix contains several parts:

1. alt_file_navframe.php
   changed top.TYPO3.Backend.ContentContainer.setUrl()
   to new function
   top.TYPO3.ModuleMenu.App.openInContentFrame()

   This fix solves the problem in the filemodule

2. iframepanel.js
   added small delay to ensure, that the panel is rendered with correct
   size before applying the mask (force centering of loading indicator)

3. modulemenu.js
   make tree detect changed ids

4. modulemenu.js
   refactoring of the following functions:
   - loadModuleComponents
   - openInContentFrame
   this has been done to reduce redundant code

Change-Id: Ibccd5d6880e1e957d5de232fdc8f4ad168cd16ab
Resolves: #28851
Releases: 4.6
Reviewed-on: http://review.typo3.org/4299
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/alt_file_navframe.php
typo3/js/extjs/iframepanel.js
typo3/js/modulemenu.js

index d3ce033..6d04c1f 100644 (file)
@@ -173,7 +173,7 @@ class SC_alt_file_navframe {
                                theUrl += "?id=" + id
                        }
                        top.fsMod.currentBank = bank;
-                       top.TYPO3.Backend.ContentContainer.setUrl(theUrl);
+                       top.TYPO3.ModuleMenu.App.openInContentFrame(theUrl);
 
                        '.($this->doHighlight ? 'Tree.highlightActiveItem("file", highlightID + "_" + bank);' : '').'
                        '.(!$GLOBALS['CLIENT']['FORMSTYLE'] ? '' : 'if (linkObj) linkObj.blur(); ').'
index ab517aa..bc05c6d 100644 (file)
@@ -132,17 +132,24 @@ TYPO3.iframePanel = Ext.extend(Ext.Panel, {
        /** @private */
        setMask: function() {
                if (this.doMask) {
-                       this.el.mask(this.maskMessage, 'x-mask-loading-message');
-                       this.el.addClass('t3-mask-loading');
-                               // add an onClick handler to remove the mask while clicking on the loading message
-                               // useful if user cancels loading and wants to access the content again
-                       this.el.child('.x-mask-loading-message').on(
-                               'click',
+                               //make sure, that the mask is rendered after the container and
+                               //fits the full dimensions
+                       new Ext.util.DelayedTask(
                                function() {
-                                       this.el.unmask();
+                                       this.el.mask(this.maskMessage, 'x-mask-loading-message');
+                                       this.el.addClass('t3-mask-loading');
+                                               // add an onClick handler to remove the mask while clicking on the loading message
+                                               // useful if user cancels loading and wants to access the content again
+                                       this.el.child('.x-mask-loading-message').on(
+                                               'click',
+                                               function() {
+                                                       this.el.unmask();
+                                               },
+                                               this
+                                       );
                                },
                                this
-                       );
+                       ).delay(200);
                }
        },
 
index 6d7d845..48a921c 100644 (file)
@@ -227,43 +227,33 @@ TYPO3.ModuleMenu.App = {
                var mod = record.name;
                var relatedCard;
                if (record.navigationComponentId) {
-                               this.loadNavigationComponent(record.navigationComponentId);
-                               TYPO3.Backend.NavigationDummy.hide();
-                               TYPO3.Backend.NavigationIframe.getEl().parent().setStyle('overflow', 'auto');
-                       } else if (record.navframe || record.navigationFrameScript) {
-                               TYPO3.Backend.NavigationDummy.hide();
-                               TYPO3.Backend.NavigationContainer.show();
-                               this.loadNavigationComponent('typo3-navigationIframe');
-                               this.openInNavFrame(record.navigationFrameScript || record.navframe, record.navigationFrameScriptParam);
-                               TYPO3.Backend.NavigationIframe.getEl().parent().setStyle('overflow', 'hidden');
-                       } else {
-                               TYPO3.Backend.NavigationContainer.hide();
-                               TYPO3.Backend.NavigationDummy.show();
-                       }
-                       relatedCard = Ext.getCmp('typo3-card-' + record.name);
-                       if (relatedCard) {
-                                       // Check wether the panel is an iframe or not - if it is try to set the uri
-                               if (relatedCard.getXType() == 'iframePanel') {
-                                               // Handle click on already opened module and evt. force reload
-                                       if ((Ext.getCmp('typo3-contentContainerWrapper').layout.activeItem.id == 'typo3-card-' + record.name)
-                                               || (relatedCard.getUrl() == 'about:blank')) {
-                                               url = record.originalLink;
-                                               Ext.getCmp('typo3-card-'+record.name).setUrl(url + (params ? (url.indexOf('?') !== -1 ? '&' : '?') + params : ''));
-                                       }
-                               }
-                                       // Independed of the xtype activate the module
-                               Ext.getCmp('typo3-contentContainerWrapper').layout.setActiveItem('typo3-card-' + record.name);
-                       } else {
-                               this.openInContentFrame(record.originalLink, params);
-                       }
-                       this.loadedModule = mod;
-                       this.highlightModuleMenuItem(mod);
-
-                               // compatibility
-                       top.currentSubScript = record.originalLink;
-                       top.currentModuleLoaded = mod;
+                       this.loadNavigationComponent(record.navigationComponentId);
+                       TYPO3.Backend.NavigationDummy.hide();
+                       TYPO3.Backend.NavigationIframe.getEl().parent().setStyle('overflow', 'auto');
+               } else if (record.navframe || record.navigationFrameScript) {
+                       TYPO3.Backend.NavigationDummy.hide();
+                       TYPO3.Backend.NavigationContainer.show();
+                       this.loadNavigationComponent('typo3-navigationIframe');
+                       this.openInNavFrame(record.navigationFrameScript || record.navframe, record.navigationFrameScriptParam);
+                       TYPO3.Backend.NavigationIframe.getEl().parent().setStyle('overflow', 'hidden');
+               } else {
+                       TYPO3.Backend.NavigationContainer.hide();
+                       TYPO3.Backend.NavigationDummy.show();
+               }
+                       //set internal state
+               this.loadedModule = mod;
+               this.highlightModuleMenuItem(mod);
+                       //load uri, either force if module is alread opened or lazy
+               if (Ext.getCmp('typo3-contentContainerWrapper').layout.activeItem.id == 'typo3-card-' + record.name) {
+                       this.openInContentFrame(record.originalLink, params, true);
+               } else {
+                       this.openInContentFrame(record.originalLink, params);
+               }
+                       // compatibility
+               top.currentSubScript = record.originalLink;
+               top.currentModuleLoaded = mod;
 
-                       TYPO3.Backend.doLayout();
+               TYPO3.Backend.doLayout();
        },
 
        includeId: function(mod, params) {
@@ -321,7 +311,7 @@ TYPO3.ModuleMenu.App = {
                }
        },
 
-       openInContentFrame: function(url, params) {
+       openInContentFrame: function(url, params, forceLoad) {
                var urlToLoad, relatedCard;
 
                if (top.nextLoadModuleUrl) {
@@ -335,7 +325,11 @@ TYPO3.ModuleMenu.App = {
                        // Decide where to load module, either in card or compatibility card
                if (relatedCard) {
                        if (relatedCard.getXType() == 'iframePanel') {
-                               relatedCard.setUrlIfChanged(urlToLoad);
+                               if(forceLoad == true) {
+                                       relatedCard.setUrl(urlToLoad);
+                               } else {
+                                       relatedCard.setUrlIfChanged(urlToLoad);
+                               }
                        }
                        Ext.getCmp('typo3-contentContainerWrapper').layout.setActiveItem('typo3-card-' + this.loadedModule);
                } else {