0013376: allow to download nodes in MailFiler
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 8 Aug 2017 15:40:11 +0000 (17:40 +0200)
committerMichael Spahn <m.spahn@metaways.de>
Wed, 9 Aug 2017 11:54:23 +0000 (13:54 +0200)
https://forge.tine20.org/view.php?id=13376

Change-Id: Ia9bb4c632d03d4e693a168d49732d373e2345e33
Reviewed-on: http://gerrit.tine20.com/customers/5426
Tested-by: Philipp Schüle <p.schuele@metaways.de>
Reviewed-by: Michael Spahn <m.spahn@metaways.de>
tine20/Filemanager/js/Filemanager.js
tine20/MailFiler/js/GridContextMenu.js
tine20/MailFiler/js/NodeEditDialog.js
tine20/MailFiler/js/nodeActions.js

index 4659e8f..b49a8c7 100644 (file)
@@ -96,18 +96,23 @@ Tine.Filemanager.MainScreen = Ext.extend(Tine.widgets.MainScreen, {
  *
  * @param {String|Tine.Filemanager.Model.Node}
  * @param revision
+ * @param appName
  * @returns {Ext.ux.file.Download}
+ *
+ * @todo move to Tine.Filemanager.FileRecordBackend
  */
-Tine.Filemanager.downloadFile = function(path, revision) {
-    path = lodash.get(path, 'data.path') || lodash.get(path, 'path') || path;
+Tine.Filemanager.downloadFile = function(path, revision, appName) {
+    var _ = window.lodash;
+    appName = appName || 'Filemanager';
+    path = _.get(path, 'data.path') || _.get(path, 'path') || path;
 
     return new Ext.ux.file.Download({
         params: {
-            method: 'Filemanager.downloadFile',
+            method: appName + '.downloadFile',
             requestType: 'HTTP',
             id: '',
             path: path,
             revision: revision
         }
     }).start();
-};
\ No newline at end of file
+};
index 51091cb..4cae358 100644 (file)
@@ -253,6 +253,8 @@ Tine.MailFiler.GridContextMenu = {
      * 
      * @param {} button
      * @param {} event
+     *
+     * @todo use Tine.Filemanager.downloadFile
      */
     downloadFile: function(button, event) {
         
index 4a53cd4..74e91c9 100644 (file)
@@ -153,14 +153,7 @@ Tine.MailFiler.NodeEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
      * download file
      */
     onDownload: function () {
-        var downloader = new Ext.ux.file.Download({
-            params: {
-                method: 'MailFiler.downloadFile',
-                requestType: 'HTTP',
-                path: '',
-                id: this.record.get('id')
-            }
-        }).start();
+        Tine.Filemanager.downloadFile(this.record, null, 'MailFiler');
     },
 
     /**
index 167bc03..46e1782 100644 (file)
@@ -248,7 +248,7 @@ Tine.MailFiler.nodeActions.Download = {
     disabled: true,
     scope: this,
     handler: function() {
-        Tine.MailFiler.downloadFile(this.initialConfig.selections[0]);
+        Tine.Filemanager.downloadFile(this.initialConfig.selections[0], null, 'MailFiler');
     },
     actionUpdater: function(action, grants, records, isFilterSelect) {
         var enabled = !isFilterSelect