2 commits - plugins/kolab_files

Aleksander Machniak machniak at kolabsys.com
Thu Feb 28 17:26:53 CET 2013


 plugins/kolab_files/kolab_files.js    |   28 +++++++++++++++++++++++++---
 plugins/kolab_files/skins/larry/ui.js |    5 +++--
 2 files changed, 28 insertions(+), 5 deletions(-)

New commits:
commit b0f05f52afe0d0b9a1bbb40562ca93ceffd97fb9
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Thu Feb 28 17:26:33 2013 +0100

    Implemented Download button action

diff --git a/plugins/kolab_files/kolab_files.js b/plugins/kolab_files/kolab_files.js
index 677731f..ded719a 100644
--- a/plugins/kolab_files/kolab_files.js
+++ b/plugins/kolab_files/kolab_files.js
@@ -81,6 +81,8 @@ window.rcmail && rcmail.addEventListener('init', function() {
       kolab_files_list_coltypes();
     }
 
+    rcmail.env.file_commands = ['files-get'];
+
     kolab_files_init();
     file_api.folder_list();
   }
@@ -308,10 +310,8 @@ kolab_files_click_on_list = function(e)
 kolab_files_list_select = function(list)
 {
   var selected = list.selection.length;
-//  this.enable_command(this.env.message_commands, selected != null);
 
-    // Multi-message commands
-//    this.enable_command('delete', 'moveto', 'copy', list.selection.length > 0);
+  rcmail.enable_command(rcmail.env.file_commands, selected == 1);
 
     // reset all-pages-selection
 //  if (list.selection.length && list.selection.length != list.rowcount)
@@ -377,6 +377,15 @@ rcube_webmail.prototype.files_list_update = function(head)
   file_api.file_list();
 };
 
+rcube_webmail.prototype.files_get = function()
+{
+  var id = this.file_list.get_selection();
+
+  if (id = $('#rcmrow'+id).data('file')) {
+    file_api.file_get(id, {'force-download': true});
+  }
+};
+
 
 /**********************************************************/
 /*********          Files API handler            **********/
@@ -501,6 +510,7 @@ function kolab_files_ui()
 
     this.req = this.set_busy(true, 'loading');
 
+    rcmail.enable_command(rcmail.env.file_commands, false);
     rcmail.file_list.clear();
 
     this.get('file_list', params, 'file_list_response');
@@ -614,6 +624,18 @@ function kolab_files_ui()
     }
   };
 
+  this.file_get = function(file, params)
+  {
+    if (!params)
+      params = {};
+
+    params.folder = this.env.folder;
+    params.token = this.env.token;
+    params.file = file;
+
+    rcmail.redirect(this.env.url + this.url('file_get', params));
+  };
+
   // file upload request
   this.file_upload = function(form)
   {


commit 2ac433b37584cfdc870f2659e49d2ee600dfaf9e
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Thu Feb 28 17:26:02 2013 +0100

    Fix upload button

diff --git a/plugins/kolab_files/skins/larry/ui.js b/plugins/kolab_files/skins/larry/ui.js
index 75199ce..a0a3c49 100644
--- a/plugins/kolab_files/skins/larry/ui.js
+++ b/plugins/kolab_files/skins/larry/ui.js
@@ -103,7 +103,7 @@ function kolab_files_upload_input(button)
   file.attr({name: 'file[]', type: 'file', multiple: 'multiple', size: 5})
     .change(function() { rcmail.files_upload('#filesuploadform'); })
     // opacity:0 does the trick, display/visibility doesn't work
-    .css({opacity: 0, cursor: 'pointer', position: 'absolute'});
+    .css({opacity: 0, cursor: 'pointer', position: 'absolute', top: '10000px', left: '10000px'});
 
   // In FF we need to move the browser file-input's button under the cursor
   // Thanks to the size attribute above we know the length of the input field
@@ -118,8 +118,9 @@ function kolab_files_upload_input(button)
         file.css({top: (e.pageY - offset.top - 10) + 'px', left: (e.pageX - offset.left - 10) + 'px'});
       // move the input away if button is disabled
       else
-        file.css({top: '1000px', left: '1000px'});
+        $(this).mouseleave();
     })
+    .mouseleave(function() { file.css({top: '10000px', left: '10000px'}); })
     .attr('onclick', '') // remove default button action
     .append(file);
 };





More information about the commits mailing list