[TASK] Reduce JavaScript dependency in workspace module 32/28632/2
authorOliver Hader <oliver@typo3.org>
Sat, 22 Mar 2014 10:39:10 +0000 (11:39 +0100)
committerOliver Hader <oliver.hader@typo3.org>
Mon, 24 Mar 2014 13:46:23 +0000 (14:46 +0100)
The workspace module in the backend has a check and dependency to
the page module in the top frame. To ease debugging of this
backend module in a separate browser process, this dependency is
encapsulated since JavaScript errors are thrown.

Resolves: #57176
Releases: 6.2
Change-Id: I79b4d79ad23d89a70014602d4a04360f709fcab5
Reviewed-on: https://review.typo3.org/28632
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/sysext/workspaces/Resources/Public/JavaScript/configuration.js
typo3/sysext/workspaces/Resources/Public/JavaScript/helpers.js

index 10ce619..8e52fbf 100644 (file)
@@ -303,7 +303,7 @@ TYPO3.Workspaces.Configuration.RowButtons = {
                                }
                        },
                        getClass: function(v, meta, rec) {
-                               if(!rec.json.allowedAction_editVersionedPage || !top.TYPO3.configuration.pageModule) {
+                               if(!rec.json.allowedAction_editVersionedPage || !TYPO3.Workspaces.Helpers.isDefined('top.TYPO3.configuration.pageModule') || !top.TYPO3.configuration.pageModule) {
                                        return 'icon-hidden';
                                } else {
                                        return '';
index 1a3678c..1733640 100644 (file)
@@ -186,5 +186,18 @@ TYPO3.Workspaces.Helpers = {
                        handlers.push(eval(objectName));
                });
                return handlers;
+       },
+
+       isDefined: function(propertyName) {
+               var result = true;
+               var pointer = window;
+               Ext.each(propertyName.split('.'), function(item) {
+                       if (typeof pointer[item] === 'undefined') {
+                               result = false;
+                               return false;
+                       }
+                       pointer = pointer[item];
+               });
+               return result;
        }
 };
\ No newline at end of file