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
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,

View file

@ -51,9 +51,22 @@ 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';
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',
@ -67,8 +80,9 @@ class kolab_files_engine
'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'
);

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 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 {