Prevent file grid panel from crashing without filemanager enabled
authorMichael Spahn <m.spahn@metaways.de>
Wed, 12 Apr 2017 14:09:40 +0000 (16:09 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 12 Apr 2017 14:10:38 +0000 (16:10 +0200)
Change-Id: I51e51e4cd58f1d81f795c727549b7f3058626c50
Reviewed-on: http://gerrit.tine20.com/customers/4547
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Filemanager/js/FilePicker.js
tine20/Tinebase/js/widgets/grid/FileUploadGrid.js

index b3c2563..b3b179d 100644 (file)
@@ -106,6 +106,7 @@ Tine.Filemanager.FilePicker = Ext.extend(Ext.Container, {
                 border: false,
                 split: true,
                 collapsible: true,
+                header: false,
                 collapseMode: 'mini',
                 items: [
                     this.treePanel
index 69bd051..6ac8ceb 100644 (file)
@@ -190,24 +190,29 @@ Tine.widgets.grid.FileUploadGrid = Ext.extend(Ext.grid.GridPanel, {
         var me = this;
 
         this.action_add = new Ext.Action(this.getAddAction());
-        this.action_add_from_filemanager = new Ext.Action({
-            text: String.format(i18n._('Add {0} from Filemanager'), this.i18nFileString),
-            iconCls: 'action_add',
-            scope: this,
-            handler: function () {
-                var filePickerDialog = new Tine.Filemanager.FilePickerDialog({
-                    title: this.app.i18n._('Select a file'),
-                    singleSelect: true,
-                    constraint: 'file'
-                });
 
-                filePickerDialog.openWindow();
+        if (Tine.Tinebase.appMgr.isEnabled('Filemanager')) {
+            var filemanager = Tine.Tinebase.appMgr.get('Filemanager');
+
+            this.action_add_from_filemanager = new Ext.Action({
+                text: String.format(filemanager.i18n._('Add {0} from Filemanager'), this.i18nFileString),
+                iconCls: 'action_add',
+                scope: this,
+                handler: function () {
+                    var filePickerDialog = new Tine.Filemanager.FilePickerDialog({
+                        title: filemanager.i18n._('Select a file'),
+                        singleSelect: true,
+                        constraint: 'file'
+                    });
 
-                filePickerDialog.on('selected', function(node) {
-                    me.onFileSelectFromFilemanager.call(me, node);
-                });
-            }
-        });
+                    filePickerDialog.openWindow();
+
+                    filePickerDialog.on('selected', function(node) {
+                        me.onFileSelectFromFilemanager.call(me, node);
+                    });
+                }
+            });
+        }
 
         this.action_remove = new Ext.Action({
             text: String.format(i18n._('Remove {0}'), this.i18nFileString),
@@ -234,10 +239,14 @@ Tine.widgets.grid.FileUploadGrid = Ext.extend(Ext.grid.GridPanel, {
         });
         
         this.tbar = [
-            this.action_add,
-            this.action_add_from_filemanager,
-            this.action_remove
+            this.action_add
         ];
+
+        if (Tine.Tinebase.appMgr.isEnabled('Filemanager')) {
+            this.tbar.push(this.action_add_from_filemanager)
+        }
+
+        this.tbar.push(this.action_remove);
         
         this.contextMenu = new Ext.menu.Menu({
             plugins: [{