plugins/kolab_files

Aleksander Machniak machniak at kolabsys.com
Thu Jun 27 09:59:16 CEST 2013


 plugins/kolab_files/kolab_files.js                 |   15 ++++++-
 plugins/kolab_files/lib/kolab_files_engine.php     |   42 ++++++++++++++-------
 plugins/kolab_files/skins/larry/images/buttons.png |binary
 plugins/kolab_files/skins/larry/style.css          |   10 +++--
 4 files changed, 46 insertions(+), 21 deletions(-)

New commits:
commit fa922dd9d31078f4acbf3f52de94ea94f5e9dbd3
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Thu Jun 27 09:58:52 2013 +0200

    Added "Save" button in attachment preview window

diff --git a/plugins/kolab_files/kolab_files.js b/plugins/kolab_files/kolab_files.js
index f7593d4..ed7a7fa 100644
--- a/plugins/kolab_files/kolab_files.js
+++ b/plugins/kolab_files/kolab_files.js
@@ -137,10 +137,11 @@ function kolab_files_token()
 // folder selection dialog
 function kolab_directory_selector_dialog(id)
 {
-  var dialog = $('#files-dialog'), buttons = {},
+  var dialog = $('#files-dialog'),
     input = $('#file-save-as-input'),
     form = $('#file-save-as'),
-    list = $('#folderlistbox');
+    list = $('#folderlistbox'),
+    buttons = {}, label = 'saveto';
 
   // attachment is specified
   if (id) {
@@ -149,9 +150,17 @@ function kolab_directory_selector_dialog(id)
     dialog.addClass('saveas');
     input.val(filename);
   }
+  // attachment preview page
+  else if (rcmail.env.action == 'get') {
+    id = rcmail.env.part;
+    form.show();
+    dialog.addClass('saveas');
+    input.val(rcmail.env.filename);
+  }
   else {
     form.hide();
     dialog.removeClass('saveas');
+    label = 'saveall';
   }
 
   buttons[rcmail.gettext('kolab_files.save')] = function () {
@@ -177,7 +186,7 @@ function kolab_directory_selector_dialog(id)
 
   // show dialog window
   kolab_dialog_show(dialog, {
-    title: rcmail.gettext('kolab_files.' + (id ? 'saveto' : 'saveall')),
+    title: rcmail.gettext('kolab_files.' + label),
     buttons: buttons,
     minWidth: 250,
     minHeight: 300,
diff --git a/plugins/kolab_files/lib/kolab_files_engine.php b/plugins/kolab_files/lib/kolab_files_engine.php
index 0401eea..610579d 100644
--- a/plugins/kolab_files/lib/kolab_files_engine.php
+++ b/plugins/kolab_files/lib/kolab_files_engine.php
@@ -51,24 +51,38 @@ class kolab_files_engine
             if ($this->rc->action == 'compose') {
                 $template = 'compose_plugin';
             }
-            else if ($this->rc->action == 'show' || $this->rc->action == 'preview') {
+            else if (in_array($this->rc->action, array('show', 'preview', 'get'))) {
                 $template = 'message_plugin';
 
-                // add "Save as" button into attachment menu
-                $this->plugin->add_button(array(
-                    'id'         => 'attachmenusaveas',
-                    'name'       => 'attachmenusaveas',
-                    'type'       => 'link',
-                    'wrapper'    => 'li',
-                    'onclick'    => 'return false',
-                    'class'      => 'icon active saveas',
-                    'classact'   => 'icon active saveas',
-                    'innerclass' => 'icon active saveas',
-                    'label'      => 'kolab_files.saveto',
-                    ), 'attachmentmenu');
+                if ($this->rc->action == 'get') {
+                    // add "Save as" button into attachment toolbar
+                    $this->plugin->add_button(array(
+                        'id'         => 'saveas',
+                        'name'       => 'saveas',
+                        'type'       => 'link',
+                        'onclick'    => 'kolab_directory_selector_dialog()',
+                        'class'      => 'button buttonPas saveas',
+                        'classact'   => 'button saveas',
+                        'label'      => 'kolab_files.save',
+                        ), 'toolbar');
+                }
+                else {
+                    // add "Save as" button into attachment menu
+                    $this->plugin->add_button(array(
+                        'id'         => 'attachmenusaveas',
+                        'name'       => 'attachmenusaveas',
+                        'type'       => 'link',
+                        'wrapper'    => 'li',
+                        'onclick'    => 'return false',
+                        'class'      => 'icon active saveas',
+                        'classact'   => 'icon active saveas',
+                        'innerclass' => 'icon active saveas',
+                        'label'      => 'kolab_files.saveto',
+                        ), 'attachmentmenu');
+                }
             }
 
-            $this->plugin->add_label('save', 'cancel',
+            $this->plugin->add_label('save', 'cancel', 'saveto',
                 'saveall', 'fromcloud', 'attachsel', 'selectfiles', 'attaching',
                 'collection_audio', 'collection_video', 'collection_image', 'collection_document'
             );
diff --git a/plugins/kolab_files/skins/larry/images/buttons.png b/plugins/kolab_files/skins/larry/images/buttons.png
index 6c83cf7..db75468 100644
Binary files a/plugins/kolab_files/skins/larry/images/buttons.png and b/plugins/kolab_files/skins/larry/images/buttons.png differ
diff --git a/plugins/kolab_files/skins/larry/style.css b/plugins/kolab_files/skins/larry/style.css
index 6277eb2..8821794 100644
--- a/plugins/kolab_files/skins/larry/style.css
+++ b/plugins/kolab_files/skins/larry/style.css
@@ -1,17 +1,19 @@
 /* Taskbar button */
-#taskbar a.button-files span.button-inner
-{
+#taskbar a.button-files span.button-inner {
   background: url(images/buttons.png) 0 0 no-repeat;
   height: 22px;
 }
 
 #taskbar a.button-files:hover span.button-inner,
-#taskbar a.button-files.button-selected span.button-inner
-{
+#taskbar a.button-files.button-selected span.button-inner {
   background: url(images/buttons.png) 0 -26px no-repeat;
   height: 22px;
 }
 
+/* Attachment toolbar button */
+.toolbar a.button.saveas {
+  background: url(images/buttons.png) center -277px no-repeat;
+}
 
 /* Files main interface */
 #filestoolbar {





More information about the commits mailing list