summaryrefslogtreecommitdiff
path: root/plugins/libcalendaring
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-01-21 09:29:50 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2015-01-21 09:29:50 (GMT)
commitafa4133177ce369736237029d742890f162360ed (patch)
tree6658fa45fb6bd5ef52b1d970612600794b4c6e28 /plugins/libcalendaring
parent7b9d36b039b6be57bdef8631dc38470bb57f44ba (diff)
downloadroundcubemail-plugins-kolab-afa4133177ce369736237029d742890f162360ed.tar.gz
Align the event/task attachment viewer with the attachment view from mail view
Diffstat (limited to 'plugins/libcalendaring')
-rw-r--r--plugins/libcalendaring/libcalendaring.js14
-rw-r--r--plugins/libcalendaring/libcalendaring.php19
2 files changed, 31 insertions, 2 deletions
diff --git a/plugins/libcalendaring/libcalendaring.js b/plugins/libcalendaring/libcalendaring.js
index f8f2a55..a959b9a 100644
--- a/plugins/libcalendaring/libcalendaring.js
+++ b/plugins/libcalendaring/libcalendaring.js
@@ -1140,4 +1140,18 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
$('.rsvp-buttons').on('click', 'a.reply-comment-toggle', function(e){
$(this).hide().parent().find('textarea').show().focus();
});
+
+ if (rcmail.env.action == 'get-attachment' && rcmail.gui_objects['attachmentframe']) {
+ rcmail.register_command('print-attachment', function() {
+ var frame = rcmail.get_frame_window(rcmail.gui_objects['attachmentframe'].id);
+ if (frame) frame.print();
+ }, true);
+ }
+
+ if (rcmail.env.action == 'get-attachment' && rcmail.env.attachment_download_url) {
+ rcmail.register_command('download-attachment', function() {
+ rcmail.location_href(rcmail.env.attachment_download_url, window);
+ }, true);
+ }
+
});
diff --git a/plugins/libcalendaring/libcalendaring.php b/plugins/libcalendaring/libcalendaring.php
index 49ef40a..0384ba0 100644
--- a/plugins/libcalendaring/libcalendaring.php
+++ b/plugins/libcalendaring/libcalendaring.php
@@ -1217,6 +1217,8 @@ class libcalendaring extends rcube_plugin
$attrib['src'] = './?' . str_replace('_frame=', ($ctype_primary == 'text' ? '_show=' : '_preload='), $_SERVER['QUERY_STRING']);
+ $this->rc->output->add_gui_object('attachmentframe', $attrib['id']);
+
return html::iframe($attrib);
}
@@ -1225,12 +1227,23 @@ class libcalendaring extends rcube_plugin
*/
public function attachment_header($attrib = array())
{
- $table = new html_table(array('cols' => 3));
+ $rcmail = rcmail::get_instance();
+ $dl_link = strtolower($attrib['downloadlink']) == 'true';
+ $dl_url = $this->rc->url(array('_frame' => null, '_download' => 1) + $_GET);
+
+ $table = new html_table(array('cols' => $dl_link ? 3 : 2));
if (!empty($this->attachment['name'])) {
$table->add('title', Q($this->rc->gettext('filename')));
$table->add('header', Q($this->attachment['name']));
- $table->add('download-link', html::a('?'.str_replace('_frame=', '_download=', $_SERVER['QUERY_STRING']), Q($this->rc->gettext('download'))));
+ if ($dl_link) {
+ $table->add('download-link', html::a($dl_url, Q($this->rc->gettext('download'))));
+ }
+ }
+
+ if (!empty($this->attachment['mimetype'])) {
+ $table->add('title', Q($this->rc->gettext('type')));
+ $table->add('header', Q($this->attachment['mimetype']));
}
if (!empty($this->attachment['size'])) {
@@ -1238,6 +1251,8 @@ class libcalendaring extends rcube_plugin
$table->add('header', Q(show_bytes($this->attachment['size'])));
}
+ $this->rc->output->set_env('attachment_download_url', $dl_url);
+
return $table->show($attrib);
}