Fixed bug #16646: help_aboutmoules hardcoded as start up module - returns error if...
authorSteffen Kamper <info@sk-typo3.de>
Mon, 6 Dec 2010 22:37:44 +0000 (22:37 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Mon, 6 Dec 2010 22:37:44 +0000 (22:37 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9764 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/js/modulemenu.js

index 88741b5..d8ba2a1 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2010-12-06  Steffen Kamper  <steffen@typo3.org>
 
+       * Fixed bug #16646: help_aboutmoules hardcoded as start up module - returns error if uninstalled
        * Fixed bug #16644: Ext Direct error as popup appears after BE login
        * Update #16695: Update ExtJS to version 3.3.1
 
index c5583ce..65bf78a 100644 (file)
@@ -101,7 +101,9 @@ TYPO3.ModuleMenu.App = {
                        callback: function(records, options) {
                                this.renderMenu(records);
                                if (top.startInModule) {
-                                       this.showModule(top.startInModule[0],top.startInModule[1]);
+                                       this.showModule(top.startInModule[0], top.startInModule[1]);
+                               } else {
+                                       this.loadFirstAvailableModule();
                                }
                        }
                });
@@ -196,17 +198,32 @@ TYPO3.ModuleMenu.App = {
        showModule: function(mod, params) {
                params = params || '';
                this.selecteModule = mod;
+
+               params = this.includeId(mod, params);
                var record = this.getRecordFromName(mod);
 
                if (record) {
+                       this.loadModuleComponents(record, params);
+               } else {
+                               //defined startup module is not present, use the first available instead
+                       this.loadFirstAvailableModule(params);
+               }
+       },
 
-                       //get id
-                       var section = mod.split('_')[0];
-                       if (top.fsMod.recentIds[section]) {
-                               params = 'id=' + top.fsMod.recentIds[section] + '&' + params;
-                       }
+       loadFirstAvailableModule: function(params) {
+               params = params || '';
+               if (TYPO3.ModuleMenu.Store.getCount() === 0) {
+                               // Store is empty, something went wrong
+                       TYPO3.Flashmessage.display(TYPO3.Severity.error, 'Module loader', 'No module found. If this is a temporary error, please reload the Backend!', 50000);
+               } else {
+                       mod = TYPO3.ModuleMenu.Store.getAt(0).data.sub[0];
+                       this.loadModuleComponents(mod, params);
+               }
+       },
 
-                       if (record.navigationComponentId) {
+       loadModuleComponents: function(record, params) {
+               var mod = record.name;
+               if (record.navigationComponentId) {
                                this.loadNavigationComponent(record.navigationComponentId);
                                TYPO3.Backend.NavigationIframe.getEl().parent().setStyle('overflow', 'auto');
                        } else if (record.navframe) {
@@ -220,14 +237,21 @@ TYPO3.ModuleMenu.App = {
                        this.loadedModule = mod;
                        this.highlightModuleMenuItem(mod);
 
-                       // compatibility
+                               // compatibility
                        top.currentSubScript = record.originalLink;
                        top.currentModuleLoaded = mod;
 
                        TYPO3.Backend.doLayout();
-               } else {
-                       console.log(mod + ' was not found in modules');
+       },
+
+       includeId: function(mod, params) {
+                       //get id
+               var section = mod.split('_')[0];
+               if (top.fsMod.recentIds[section]) {
+                       params = 'id=' + top.fsMod.recentIds[section] + '&' + params;
                }
+
+               return params;
        },
 
        loadNavigationComponent: function(navigationComponentId) {