Added "Save" button in attachment preview window

This commit is contained in:
Aleksander Machniak 2013-06-27 09:58:52 +02:00
parent 0d692b1774
commit fa922dd9d3
4 changed files with 46 additions and 21 deletions

View file

@ -137,10 +137,11 @@ function kolab_files_token()
// folder selection dialog // folder selection dialog
function kolab_directory_selector_dialog(id) function kolab_directory_selector_dialog(id)
{ {
var dialog = $('#files-dialog'), buttons = {}, var dialog = $('#files-dialog'),
input = $('#file-save-as-input'), input = $('#file-save-as-input'),
form = $('#file-save-as'), form = $('#file-save-as'),
list = $('#folderlistbox'); list = $('#folderlistbox'),
buttons = {}, label = 'saveto';
// attachment is specified // attachment is specified
if (id) { if (id) {
@ -149,9 +150,17 @@ function kolab_directory_selector_dialog(id)
dialog.addClass('saveas'); dialog.addClass('saveas');
input.val(filename); 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 { else {
form.hide(); form.hide();
dialog.removeClass('saveas'); dialog.removeClass('saveas');
label = 'saveall';
} }
buttons[rcmail.gettext('kolab_files.save')] = function () { buttons[rcmail.gettext('kolab_files.save')] = function () {
@ -177,7 +186,7 @@ function kolab_directory_selector_dialog(id)
// show dialog window // show dialog window
kolab_dialog_show(dialog, { kolab_dialog_show(dialog, {
title: rcmail.gettext('kolab_files.' + (id ? 'saveto' : 'saveall')), title: rcmail.gettext('kolab_files.' + label),
buttons: buttons, buttons: buttons,
minWidth: 250, minWidth: 250,
minHeight: 300, minHeight: 300,

View file

@ -51,24 +51,38 @@ class kolab_files_engine
if ($this->rc->action == 'compose') { if ($this->rc->action == 'compose') {
$template = 'compose_plugin'; $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'; $template = 'message_plugin';
// add "Save as" button into attachment menu if ($this->rc->action == 'get') {
$this->plugin->add_button(array( // add "Save as" button into attachment toolbar
'id' => 'attachmenusaveas', $this->plugin->add_button(array(
'name' => 'attachmenusaveas', 'id' => 'saveas',
'type' => 'link', 'name' => 'saveas',
'wrapper' => 'li', 'type' => 'link',
'onclick' => 'return false', 'onclick' => 'kolab_directory_selector_dialog()',
'class' => 'icon active saveas', 'class' => 'button buttonPas saveas',
'classact' => 'icon active saveas', 'classact' => 'button saveas',
'innerclass' => 'icon active saveas', 'label' => 'kolab_files.save',
'label' => 'kolab_files.saveto', ), 'toolbar');
), 'attachmentmenu'); }
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', 'saveall', 'fromcloud', 'attachsel', 'selectfiles', 'attaching',
'collection_audio', 'collection_video', 'collection_image', 'collection_document' 'collection_audio', 'collection_video', 'collection_image', 'collection_document'
); );

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View file

@ -1,17 +1,19 @@
/* Taskbar button */ /* 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; background: url(images/buttons.png) 0 0 no-repeat;
height: 22px; height: 22px;
} }
#taskbar a.button-files:hover span.button-inner, #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; background: url(images/buttons.png) 0 -26px no-repeat;
height: 22px; height: 22px;
} }
/* Attachment toolbar button */
.toolbar a.button.saveas {
background: url(images/buttons.png) center -277px no-repeat;
}
/* Files main interface */ /* Files main interface */
#filestoolbar { #filestoolbar {