From b01d84d0f7c8b29c9dc52c717708f28a72ecf08e Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 11 Dec 2012 12:02:45 +0100 Subject: Extend just_parse() method with conditions parsing --- program/include/rcmail_output_html.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'program/include/rcmail_output_html.php') diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index 1290e173e..76342c245 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -670,7 +670,10 @@ class rcmail_output_html extends rcmail_output */ public function just_parse($input) { - return $this->parse_xml($input); + $input = $this->parse_conditions($input); + $input = $this->parse_xml($input); + + return $input; } -- cgit v1.2.3 From 44e3bf1e2c18d0fae066e6c4e9a19a4c9bee12aa Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Wed, 9 Jan 2013 16:23:44 +0100 Subject: Fix /this/ paths from plugin templates in extended skins --- program/include/rcmail_output_html.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'program/include/rcmail_output_html.php') diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index 76342c245..d4a1654f1 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -462,6 +462,7 @@ class rcmail_output_html extends rcmail_output if (is_readable($path)) { $this->config->set('skin_path', $skin_path); $this->base_path = preg_replace('!plugins/\w+/!', '', $skin_path); // set base_path to core skin directory (not plugin's skin) + $skin_dir = preg_replace('!^plugins/!', '', $skin_path); break; } else { @@ -643,6 +644,7 @@ class rcmail_output_html extends rcmail_output protected function file_callback($matches) { $file = $matches[3]; + $file[0] = preg_replace('!^/this/!', '/', $file[0]); // correct absolute paths if ($file[0] == '/') { -- cgit v1.2.3 From 6ff0c30f191a2df7b93882a1fdfd2b64828e8ed4 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 24 Jan 2013 12:20:43 +0100 Subject: Fix login in case when default_host is an array with one element (#1488928) --- CHANGELOG | 1 + program/include/rcmail_output_html.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'program/include/rcmail_output_html.php') diff --git a/CHANGELOG b/CHANGELOG index ee57c3704..bd0e7c8df 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Fix login in case when default_host is an array with one element (#1488928) - Use LDAP fallback hosts on connect + bind instead of ldap_connect() only. - Add config option for LDAP bind timeout (sets LDAP_OPT_NETWORK_TIMEOUT option) - Submit Addressbook advanced search form with Enter key (#1488568) diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index d4a1654f1..cd5f4dddc6 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -1550,10 +1550,10 @@ class rcmail_output_html extends rcmail_output } } } - else if (is_array($default_host) && ($host = array_pop($default_host))) { + else if (is_array($default_host) && ($host = key($default_host)) !== null) { $hide_host = true; $input_host = new html_hiddenfield(array( - 'name' => '_host', 'id' => 'rcmloginhost', 'value' => $host) + $attrib); + 'name' => '_host', 'id' => 'rcmloginhost', 'value' => is_numeric($host) ? $default_host[$host] : $host) + $attrib); } else if (empty($default_host)) { $input_host = new html_inputfield(array('name' => '_host', 'id' => 'rcmloginhost') -- cgit v1.2.3 From 1730cf8d7b59c04e3db0b5425c5cd9401bfc1c43 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Thu, 24 Jan 2013 15:32:24 +0100 Subject: Load a default stylesheet (embed.css) from skin in plain html pages (e.g. attachment warnings and html messages) --- program/include/rcmail_html_page.php | 16 ++++++++++++++-- program/include/rcmail_output_html.php | 1 + program/steps/mail/get.inc | 12 ++++-------- skins/larry/embed.css | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 skins/larry/embed.css (limited to 'program/include/rcmail_output_html.php') diff --git a/program/include/rcmail_html_page.php b/program/include/rcmail_html_page.php index 2624d590a..1d8391580 100644 --- a/program/include/rcmail_html_page.php +++ b/program/include/rcmail_html_page.php @@ -5,7 +5,7 @@ | program/include/rcmail_html_page.php | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2006-2012, The Roundcube Dev Team | + | Copyright (C) 2006-2013, The Roundcube Dev Team | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | @@ -21,7 +21,7 @@ /** - * Class to create HTML page output using a skin template + * Class to create an empty HTML page with some default styles * * @package Core * @subpackage View @@ -31,6 +31,18 @@ class rcmail_html_page extends rcmail_output_html public function write($contents = '') { self::reset(); + + // load embed.css from skin folder (if exists) + if ($embed_css = $this->get_skin_file('/embed.css')) { + $this->include_css($embed_css); + } + else { // set default styles for warning blocks inside the attachment part frame + $this->add_header(html::tag('style', array('type' => 'text/css'), + ".rcmail-inline-message { font-family: sans-serif; border:2px solid #ffdf0e; background:#fef893; padding:0.6em 1em; margin-bottom:0.6em }\n" . + ".rcmail-inline-buttons { margin-bottom:0 }" + )); + } + parent::write($contents); } } \ No newline at end of file diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index cd5f4dddc6..f753bf8e1 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -164,6 +164,7 @@ class rcmail_output_html extends rcmail_output } $this->config->set('skin_path', $skin_path); + $this->base_path = $skin_path; // register skin path(s) $this->skin_paths = array(); diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc index 6cda4e81d..fddb40ae8 100644 --- a/program/steps/mail/get.inc +++ b/program/steps/mail/get.inc @@ -36,10 +36,6 @@ if (!empty($_GET['_preload'])) { ob_end_clean(); -// define global style for warning blocks inside the attachment part frame -// TODO: get styles for this from skin (but we don't have a skin template here...) -$warning_css_style = 'border:2px solid #ffdf0e; background:#fef893; padding:0.6em 1em'; - // similar code as in program/steps/mail/show.inc if (!empty($_GET['_uid'])) { $RCMAIL->config->set('prefer_html', true); @@ -158,13 +154,13 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) { // show warning if validity checks failed if (!$valid) { $OUTPUT = new rcmail_html_page(); - $OUTPUT->write(html::tag('html', null, html::tag('body', array('style' => 'font-family:sans-serif; margin:1em'), - html::div(array('class' => 'warning', 'style' => $warning_css_style), + $OUTPUT->write(html::tag('html', null, html::tag('body', 'embed', + html::div(array('class' => 'rcmail-inline-message rcmail-inline-warning'), rcube_label(array( 'name' => 'attachmentvalidationerror', 'vars' => array('expected' => "$mimetype (.$file_extension)", 'detected' => "$real_mimetype (.$extensions[0])") )) . - html::p(array('class' => 'buttons', 'style' => 'margin-bottom:0'), + html::p(array('class' => 'rcmail-inline-buttons'), html::tag('button', array('onclick' => "location.href='" . $RCMAIL->url(array_merge($_GET, array('_nocheck' => 1))) . "'"), rcube_label('showanyway'))) @@ -232,7 +228,7 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) { $body_start = strpos($out, '>', $body_pos) + 1; } $out = substr($out, 0, $body_start) . - html::div(array('class' => 'warning', 'style' => $warning_css_style), + html::div(array('class' => 'rcmail-inline-message rcmail-inline-warning'), Q(rcube_label('blockedimages')) . ' ' . html::tag('button', array('onclick' => "location.href='" . $RCMAIL->url(array_merge($_GET, array('_safe' => 1))) . "'"), diff --git a/skins/larry/embed.css b/skins/larry/embed.css new file mode 100644 index 000000000..8c4e95d42 --- /dev/null +++ b/skins/larry/embed.css @@ -0,0 +1,34 @@ +/** + * Roundcube webmail "embedded" stylesheets + * + * Copyright (c) 2012, The Roundcube Dev Team + * + * The contents are subject to the Creative Commons Attribution-ShareAlike + * License. It is allowed to copy, distribute, transmit and to adapt the work + * by keeping credits to the original autors in the README file. + * See http://creativecommons.org/licenses/by-sa/3.0/ for details. + */ + +.rcmail-inline-message { + font-family: sans-serif; + font-size: 14px; + color: #333; + border: 1px solid #ffdf0e; + background-color: #fef893; + padding: 0.6em 1em; + margin-bottom: 0.8em; +} + +.rcmail-inline-message > button { + margin-left: 1em; + vertical-align: baseline; +} + +.rcmail-inline-message em { + font-size: 90%; + color: #666; +} + +.rcmail-inline-buttons { + margin-bottom: 0; +} -- cgit v1.2.3 From bc53e22440b78ebc47f490ac2f549f193b99d1f8 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sun, 27 Jan 2013 13:27:22 +0100 Subject: Fix PHP Warning: Missing argument 2 for rcmail_output_html::get_skin_file() --- program/include/rcmail_output_html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'program/include/rcmail_output_html.php') diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index f753bf8e1..05904e58b 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -215,7 +215,7 @@ class rcmail_output_html extends rcmail_output * @param string Additional path to search in * @return mixed Relative path to the requested file or False if not found */ - public function get_skin_file($file, &$skin_path, $add_path = null) + public function get_skin_file($file, &$skin_path = null, $add_path = null) { $skin_paths = $this->skin_paths; if ($add_path) -- cgit v1.2.3 From 72e24b7a632b7f713082d9100176064814cf2f61 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Mon, 28 Jan 2013 20:24:59 +0100 Subject: Catch connection timeouts on message sending form submissions --- program/include/rcmail_output_html.php | 2 +- program/js/app.js | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'program/include/rcmail_output_html.php') diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index 05904e58b..88af550ed 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -380,7 +380,7 @@ class rcmail_output_html extends rcmail_output // unlock interface after iframe load $unlock = preg_replace('/[^a-z0-9]/i', '', $_REQUEST['_unlock']); if ($this->framed) { - array_unshift($this->js_commands, array('set_busy', false, null, $unlock)); + array_unshift($this->js_commands, array('iframe_loaded', $unlock)); } else if ($unlock) { array_unshift($this->js_commands, array('hide_message', $unlock)); diff --git a/program/js/app.js b/program/js/app.js index c2456ac4f..6d5bdfe74 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3119,6 +3119,13 @@ function rcube_webmail() form._draft.value = draft ? '1' : ''; form.action = this.add_url(form.action, '_unlock', msgid); form.action = this.add_url(form.action, '_lang', lang); + + // register timer to notify about connection timeout + this.submit_timer = setTimeout(function(){ + ref.set_busy(false, null, msgid); + ref.display_message(ref.get_label('requesttimedout'), 'error'); + }, this.env.request_timeout * 1000); + form.submit(); }; @@ -6345,7 +6352,7 @@ function rcube_webmail() // redirect to url specified in location header if not empty var location_url = request.getResponseHeader("Location"); - if (location_url) + if (location_url && this.env.action != 'compose') // don't redirect on compose screen, contents might get lost (#1488926) this.redirect(location_url); // re-send keep-alive requests after 30 seconds @@ -6353,6 +6360,15 @@ function rcube_webmail() setTimeout(function(){ ref.keep_alive(); ref.start_keepalive(); }, 30000); }; + // callback when an iframe finished loading + this.iframe_loaded = function(unlock) + { + this.set_busy(false, null, unlock); + + if (this.submit_timer) + clearTimeout(this.submit_timer); + }; + // post the given form to a hidden iframe this.async_upload_form = function(form, action, onload) { -- cgit v1.2.3 From a7e8ebc50962d72fe3df9b8cfdd8f2e537fbf04e Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 8 Feb 2013 08:18:34 +0100 Subject: Fix reference to non-existing class rcube_output_html (#1488948) --- plugins/newmail_notifier/newmail_notifier.php | 2 +- program/include/rcmail_output_html.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'program/include/rcmail_output_html.php') diff --git a/plugins/newmail_notifier/newmail_notifier.php b/plugins/newmail_notifier/newmail_notifier.php index a45eeaedb..e985c8b49 100644 --- a/plugins/newmail_notifier/newmail_notifier.php +++ b/plugins/newmail_notifier/newmail_notifier.php @@ -51,7 +51,7 @@ class newmail_notifier extends rcube_plugin else { // if ($this->rc->task == 'mail') { $this->add_hook('new_messages', array($this, 'notify')); // add script when not in ajax and not in frame - if (is_a($this->rc->output, 'rcube_output_html') && empty($_REQUEST['_framed'])) { + if ($this->rc->output->type == 'html' && empty($_REQUEST['_framed'])) { $this->add_texts('localization/'); $this->rc->output->add_label('newmail_notifier.title', 'newmail_notifier.body'); $this->include_script('newmail_notifier.js'); diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index 88af550ed..f6c5d919d 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -668,7 +668,7 @@ class rcmail_output_html extends rcmail_output * * @param string $input * @return string - * @uses rcube_output_html::parse_xml() + * @uses rcmail_output_html::parse_xml() * @since 0.1-rc1 */ public function just_parse($input) -- cgit v1.2.3 From d30460ad2fc0f78ce44d474fa2c466d660596d27 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Sun, 10 Feb 2013 15:31:39 +0100 Subject: Let some env variables survive reset(); don't show taskbar and top line in framed error pages (#1488938) --- program/include/rcmail_output_html.php | 8 +++++++- skins/larry/includes/header.html | 6 +++--- skins/larry/styles.css | 4 ++++ skins/larry/templates/error.html | 7 +++++-- 4 files changed, 19 insertions(+), 6 deletions(-) (limited to 'program/include/rcmail_output_html.php') diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index f6c5d919d..2babe1cbb 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -80,6 +80,8 @@ class rcmail_output_html extends rcmail_output if (!empty($_REQUEST['_extwin'])) $this->set_env('extwin', 1); + if ($this->framed || !empty($_REQUEST['_framed'])) + $this->set_env('framed', 1); // add common javascripts $this->add_script('var '.self::JS_OBJECT_NAME.' = new rcube_webmail();', 'head_top'); @@ -308,8 +310,12 @@ class rcmail_output_html extends rcmail_output */ public function reset() { + $env = array_intersect_key($this->env, array('extwin'=>1, 'framed'=>1)); + parent::reset(); - $this->js_env = array(); + + // let some env variables survive + $this->env = $this->js_env = $env; $this->js_labels = array(); $this->js_commands = array(); $this->script_files = array(); diff --git a/skins/larry/includes/header.html b/skins/larry/includes/header.html index 5a30020f3..f2efb8e06 100644 --- a/skins/larry/includes/header.html +++ b/skins/larry/includes/header.html @@ -10,16 +10,16 @@
- + - +
- +
diff --git a/skins/larry/styles.css b/skins/larry/styles.css index 613a08aa1..044a09e05 100644 --- a/skins/larry/styles.css +++ b/skins/larry/styles.css @@ -1276,6 +1276,10 @@ body.iframe { margin: 38px 0 10px 0; } +body.iframe.error { + background: #ededed; +} + body.iframe.floatingbuttons { margin-bottom: 40px; } diff --git a/skins/larry/templates/error.html b/skins/larry/templates/error.html index cd0fc9656..a65733eb0 100644 --- a/skins/larry/templates/error.html +++ b/skins/larry/templates/error.html @@ -4,9 +4,12 @@ <roundcube:object name="pagetitle" /> - - + + + + +
$__page_content -- cgit v1.2.3 From bc2c4380b5b754a3b13cc7d6663b2b81d2577e2e Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 6 Mar 2013 11:11:37 +0100 Subject: Add attachment menu with Open and Download options (#1488975) --- CHANGELOG | 1 + program/include/rcmail_output_html.php | 4 +++ program/js/app.js | 21 +++++++---- program/localization/en_US/labels.inc | 1 + program/steps/mail/show.inc | 23 ++++++------ skins/classic/functions.js | 53 +++++++++++++++++++++++----- skins/classic/mail.css | 20 +++++++++-- skins/classic/templates/message.html | 8 +++++ skins/classic/templates/messagepreview.html | 12 ++++++- skins/larry/images/buttons.gif | Bin 13054 -> 14997 bytes skins/larry/images/buttons.png | Bin 36693 -> 48308 bytes skins/larry/mail.css | 2 +- skins/larry/styles.css | 13 ++++++- skins/larry/templates/message.html | 8 +++++ skins/larry/templates/messagepreview.html | 8 +++++ skins/larry/ui.js | 42 +++++++++++++++++++--- 16 files changed, 181 insertions(+), 35 deletions(-) (limited to 'program/include/rcmail_output_html.php') diff --git a/CHANGELOG b/CHANGELOG index c5d8c7687..fa5fb8e24 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Add attachment menu with Open and Download options (#1488975) - Fix thumbnail size when GD extension is used for image resize (#1488985) - Display user-friendly message on IMAP "over quota" errors (#1484164) - Display notice that message is encrypted also for application/pkcs7-mime messages (#1488526) diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index 2babe1cbb..ade2bd4a4 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -1175,6 +1175,10 @@ class rcmail_output_html extends rcmail_output $out = sprintf('%s', $attrib_str, $btn_content); } + if ($attrib['wrapper']) { + $out = html::tag($attrib['wrapper'], null, $out); + } + return $out; } diff --git a/program/js/app.js b/program/js/app.js index 4011fa593..55c71d776 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -179,7 +179,8 @@ function rcube_webmail() } // enable general commands - this.enable_command('close', 'logout', 'mail', 'addressbook', 'settings', 'save-pref', 'compose', 'undo', 'about', 'switch-task', true); + this.enable_command('close', 'logout', 'mail', 'addressbook', 'settings', 'save-pref', + 'compose', 'undo', 'about', 'switch-task', 'menu-open', 'menu-save', true); if (this.env.permaurl) this.enable_command('permaurl', 'extwin', true); @@ -211,7 +212,7 @@ function rcube_webmail() this.gui_objects.messagelist.parentNode.onmousedown = function(e){ return p.click_on_list(e); }; this.message_list.init(); - this.enable_command('toggle_status', 'toggle_flag', 'menu-open', 'menu-save', 'sort', true); + this.enable_command('toggle_status', 'toggle_flag', 'sort', true); // load messages this.command('list'); @@ -227,7 +228,7 @@ function rcube_webmail() this.env.message_commands = ['show', 'reply', 'reply-all', 'reply-list', 'moveto', 'copy', 'delete', 'open', 'mark', 'edit', 'viewsource', - 'print', 'load-attachment', 'show-headers', 'hide-headers', 'download', + 'print', 'load-attachment', 'download-attachment', 'show-headers', 'hide-headers', 'download', 'forward', 'forward-inline', 'forward-attachment']; if (this.env.action == 'show' || this.env.action == 'preview') { @@ -608,6 +609,11 @@ function rcube_webmail() break; case 'menu-open': + if (props && props.menu == 'attachmentmenu') { + var mimetype = this.env.attachments[props.id]; + this.enable_command('open-attachment', mimetype && this.env.mimetypes && $.inArray(mimetype, this.env.mimetypes) >= 0); + } + case 'menu-save': this.triggerEvent(command, {props:props}); return false; @@ -833,11 +839,14 @@ function rcube_webmail() break; case 'load-attachment': - var qstring = '_mbox='+urlencode(this.env.mailbox)+'&_uid='+this.env.uid+'&_part='+props.part; + case 'open-attachment': + case 'download-attachment': + var qstring = '_mbox='+urlencode(this.env.mailbox)+'&_uid='+this.env.uid+'&_part='+props, + mimetype = this.env.attachments[props]; // open attachment in frame if it's of a supported mimetype - if (this.env.uid && props.mimetype && this.env.mimetypes && $.inArray(props.mimetype, this.env.mimetypes) >= 0) { - var attachment_win = window.open(this.env.comm_path+'&_action=get&'+qstring+'&_frame=1', 'rcubemailattachment'+this.env.uid+props.part); + if (command != 'download-attachment' && mimetype && this.env.mimetypes && $.inArray(mimetype, this.env.mimetypes) >= 0) { + var attachment_win = window.open(this.env.comm_path+'&_action=get&'+qstring+'&_frame=1', 'rcubemailattachment'+this.env.uid+props); if (attachment_win) { setTimeout(function(){ attachment_win.focus(); }, 10); break; diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc index 0750e7848..61a13e9ab 100644 --- a/program/localization/en_US/labels.inc +++ b/program/localization/en_US/labels.inc @@ -64,6 +64,7 @@ $labels['copy'] = 'Copy'; $labels['move'] = 'Move'; $labels['moveto'] = 'Move to...'; $labels['download'] = 'Download'; +$labels['open'] = 'Open'; $labels['showattachment'] = 'Show'; $labels['showanyway'] = 'Show it anyway'; diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index 437dbaafa..87555cbbe 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -147,6 +147,7 @@ function rcmail_message_attachments($attrib) global $PRINT_MODE, $MESSAGE, $RCMAIL; $out = $ol = ''; + $attachments = array(); if (sizeof($MESSAGE->attachments)) { foreach ($MESSAGE->attachments as $attach_prop) { @@ -165,21 +166,23 @@ function rcmail_message_attachments($attrib) $title = ''; } - $ol .= html::tag('li', rcmail_filetype2classname($attach_prop->mimetype, $filename), - html::a(array( + $mimetype = rcmail_fix_mimetype($attach_prop->mimetype); + $class = rcmail_filetype2classname($mimetype, $filename); + $id = 'attach' . $attach_prop->mime_id; + $link = html::a(array( 'href' => $MESSAGE->get_part_url($attach_prop->mime_id, false), - 'onclick' => sprintf( - 'return %s.command(\'load-attachment\',{part:\'%s\', mimetype:\'%s\'},this)', - JS_OBJECT_NAME, - $attach_prop->mime_id, - rcmail_fix_mimetype($attach_prop->mimetype)), - 'title' => Q($title), - ), - Q($filename))); + 'onclick' => sprintf('return %s.command(\'load-attachment\',\'%s\',this)', + JS_OBJECT_NAME, $attach_prop->mime_id), + 'title' => Q($title), + ), Q($filename)); + $ol .= html::tag('li', array('class' => $class, 'id' => $id), $link); + + $attachments[$attach_prop->mime_id] = $mimetype; } } $out = html::tag('ul', $attrib, $ol, html::$common_attrib); + $RCMAIL->output->set_env('attachments', $attachments); } return $out; diff --git a/skins/classic/functions.js b/skins/classic/functions.js index c59ea9bf8..499783b3f 100644 --- a/skins/classic/functions.js +++ b/skins/classic/functions.js @@ -92,6 +92,7 @@ function rcube_mail_ui() forwardmenu: {id:'forwardmenu', editable:1}, searchmenu: {id:'searchmenu', editable:1}, messagemenu: {id:'messagemenu'}, + attachmentmenu: {id:'attachmentmenu'}, listmenu: {id:'listmenu', editable:1}, dragmessagemenu:{id:'dragmessagemenu', sticky:1}, groupmenu: {id:'groupoptionsmenu', above:1}, @@ -133,24 +134,24 @@ show_popupmenu: function(popup, show) { var obj = this.popups[popup].obj, above = this.popups[popup].above, - ref = rcube_find_object(popup+'link'); + ref = $(this.popups[popup].link ? this.popups[popup].link : rcube_find_object(popup+'link')); if (typeof show == 'undefined') show = obj.is(':visible') ? false : true; else if (this.popups[popup].toggle && show && this.popups[popup].obj.is(':visible') ) show = false; - if (show && ref) { - var parent = $(ref).parent(), + if (show && ref.length) { + var parent = ref.parent(), win = $(window), - pos = parent.hasClass('dropbutton') ? parent.offset() : $(ref).offset(); + pos = parent.hasClass('dropbutton') ? parent.offset() : ref.offset(); - if (!above && pos.top + ref.offsetHeight + obj.height() > win.height()) + if (!above && pos.top + ref.height() + obj.height() > win.height()) above = true; if (pos.left + obj.width() > win.width()) pos.left = win.width() - obj.width() - 30; - obj.css({ left:pos.left, top:(pos.top + (above ? -obj.height() : ref.offsetHeight)) }); + obj.css({ left:pos.left, top:(pos.top + (above ? -obj.height() : ref.height())) }); } obj[show?'show':'hide'](); @@ -325,7 +326,7 @@ listmenu: function(show) }; }, -open_listmenu: function(e) +open_listmenu: function() { this.listmenu(); }, @@ -380,6 +381,35 @@ spellmenu: function(show) this.show_popupmenu('spellmenu', show); }, +show_attachmentmenu: function(elem) +{ + var id = elem.parentNode.id.replace(/^attach/, ''); + + $('#attachmenuopen').unbind('click').attr('onclick', '').click(function(e) { + return rcmail.command('open-attachment', id, this); + }); + + $('#attachmenudownload').unbind('click').attr('onclick', '').click(function() { + rcmail.command('download-attachment', id, this); + }); + + this.popups.attachmentmenu.link = elem; + rcmail.command('menu-open', {menu: 'attachmentmenu', id: id}); +}, + +menu_open: function(p) +{ + if (p && p.props && p.props.menu == 'attachmentmenu') + this.show_popup('attachmentmenu'); + else + this.open_listmenu(); +}, + +menu_save: function(prop) +{ + this.save_listmenu(); +}, + body_mouseup: function(evt, p) { var i, target = rcube_event.get_target(evt); @@ -800,8 +830,8 @@ function rcube_init_mail_ui() .contents().mouseup(function(e){rcmail_ui.body_mouseup(e)}); if (rcmail.env.task == 'mail') { - rcmail.addEventListener('menu-open', 'open_listmenu', rcmail_ui); - rcmail.addEventListener('menu-save', 'save_listmenu', rcmail_ui); + rcmail.addEventListener('menu-open', 'menu_open', rcmail_ui); + rcmail.addEventListener('menu-save', 'menu_save', rcmail_ui); rcmail.addEventListener('aftersend-attachment', 'uploadmenu', rcmail_ui); rcmail.addEventListener('aftertoggle-editor', 'resize_compose_body_ev', rcmail_ui); rcmail.gui_object('message_dragmenu', 'dragmessagemenu'); @@ -817,6 +847,11 @@ function rcube_init_mail_ui() if (rcmail.env.action == 'compose') rcmail_ui.init_compose_form(); + else if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') + // add menu link for each attachment + $('#attachment-list > li[id^="attach"]').each(function() { + $(this).append($('').click(function() { rcmail_ui.show_attachmentmenu(this); })); + }); } else if (rcmail.env.task == 'addressbook') { rcmail.addEventListener('afterupload-photo', function(){ rcmail_ui.show_popup('uploadform', false); }); diff --git a/skins/classic/mail.css b/skins/classic/mail.css index 8be35aaa6..4d42d98ff 100644 --- a/skins/classic/mail.css +++ b/skins/classic/mail.css @@ -173,13 +173,15 @@ } #messagemenu li a.active:hover, +#attachmentmenu li a.active:hover, #markmessagemenu li a.active:hover { color: #fff; background-color: #c00; } -#messagemenu li a +#messagemenu li a, +#attachmentmenu li a { background: url(images/messageactions.png) no-repeat 7px 0; background-position: 7px 20px; @@ -190,7 +192,8 @@ background-position: 7px 1px; } -#messagemenu li a.downloadlink +#messagemenu li a.downloadlink, +#attachmentmenu li a.downloadlink { background-position: 7px -17px; } @@ -200,7 +203,8 @@ background-position: 7px -35px; } -#messagemenu li a.openlink +#messagemenu li a.openlink, +#attachmentmenu li a.openlink { background-position: 7px -53px; } @@ -1135,6 +1139,16 @@ table.headers-table tr td.header span text-decoration: underline; } +#attachment-list li a.drop { + background: url(images/icons/down_small.gif) no-repeat center 6px; + width: 12px; + height: 7px; + cursor: pointer; + padding: 5px 0 0; + margin-left: 3px; + display: inline-block; +} + #messagebody { position:relative; diff --git a/skins/classic/templates/message.html b/skins/classic/templates/message.html index d1594ea28..73dfcb976 100644 --- a/skins/classic/templates/message.html +++ b/skins/classic/templates/message.html @@ -65,5 +65,13 @@ +
+
    +
  • +
  • + +
+
+ diff --git a/skins/classic/templates/messagepreview.html b/skins/classic/templates/messagepreview.html index 78b2306f6..935238edf 100644 --- a/skins/classic/templates/messagepreview.html +++ b/skins/classic/templates/messagepreview.html @@ -3,8 +3,10 @@ <roundcube:object name="pagetitle" /> + + - +
@@ -16,5 +18,13 @@ +
+
    +
  • +
  • + +
+
+ diff --git a/skins/larry/images/buttons.gif b/skins/larry/images/buttons.gif index d8a33d6b2..8a4a78ee4 100644 Binary files a/skins/larry/images/buttons.gif and b/skins/larry/images/buttons.gif differ diff --git a/skins/larry/images/buttons.png b/skins/larry/images/buttons.png index 4438d9cbc..0ec061a78 100644 Binary files a/skins/larry/images/buttons.png and b/skins/larry/images/buttons.png differ diff --git a/skins/larry/mail.css b/skins/larry/mail.css index c99370830..e6529d118 100644 --- a/skins/larry/mail.css +++ b/skins/larry/mail.css @@ -868,7 +868,7 @@ div.more-headers { } div.hide-headers { - background-position: center -1589px; + background-position: center -1600px; } #all-headers { diff --git a/skins/larry/styles.css b/skins/larry/styles.css index 044a09e05..1e3e6f7d5 100644 --- a/skins/larry/styles.css +++ b/skins/larry/styles.css @@ -2219,7 +2219,7 @@ ul.toolbarmenu li span.conversation { display: block; color: #333; font-weight: bold; - padding: 8px 4px 3px 30px; + padding: 8px 15px 3px 30px; text-shadow: 0px 1px 1px #fff; text-decoration: none; white-space: nowrap; @@ -2227,6 +2227,17 @@ ul.toolbarmenu li span.conversation { text-overflow: ellipsis; } +.attachmentslist li a.drop { + background: url(images/buttons.png) no-repeat scroll center -1570px; + width: 14px; + height: 26px; + cursor: pointer; + position: absolute; + right: 0; + top: 0; + padding: 0; +} + #compose-attachments ul li { padding-right: 28px; } diff --git a/skins/larry/templates/message.html b/skins/larry/templates/message.html index b4ceb6a6c..36e0efa0a 100644 --- a/skins/larry/templates/message.html +++ b/skins/larry/templates/message.html @@ -73,6 +73,14 @@
+ + diff --git a/skins/larry/templates/messagepreview.html b/skins/larry/templates/messagepreview.html index aef282ac9..dbfe2dc7b 100644 --- a/skins/larry/templates/messagepreview.html +++ b/skins/larry/templates/messagepreview.html @@ -51,6 +51,14 @@
+ + diff --git a/skins/larry/ui.js b/skins/larry/ui.js index d2638bbca..6b2a5c7d0 100644 --- a/skins/larry/ui.js +++ b/skins/larry/ui.js @@ -17,6 +17,7 @@ function rcube_mail_ui() var popupconfig = { forwardmenu: { editable:1 }, searchmenu: { editable:1, callback:searchmenu }, + attachmentmenu: { }, listoptions: { editable:1 }, dragmessagemenu: { sticky:1 }, groupmenu: { above:1 }, @@ -81,8 +82,8 @@ function rcube_mail_ui() /*** mail task ***/ if (rcmail.env.task == 'mail') { - rcmail.addEventListener('menu-open', show_listoptions); - rcmail.addEventListener('menu-save', save_listoptions); + rcmail.addEventListener('menu-open', menu_open); + rcmail.addEventListener('menu-save', menu_save); rcmail.addEventListener('responseafterlist', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list') }); var dragmenu = $('#dragmessagemenu'); @@ -95,6 +96,11 @@ function rcube_mail_ui() rcmail.addEventListener('aftershow-headers', function() { layout_messageview(); }); rcmail.addEventListener('afterhide-headers', function() { layout_messageview(); }); $('#previewheaderstoggle').click(function(e){ toggle_preview_headers(this); return false }); + + // add menu link for each attachment + $('#attachment-list > li').each(function() { + $(this).append($('').click(function() { attachmentmenu(this); })); + }); } else if (rcmail.env.action == 'compose') { rcmail.addEventListener('aftertoggle-editor', function(){ window.setTimeout(function(){ layout_composeview() }, 200); }); @@ -436,7 +442,7 @@ function rcube_mail_ui() { var obj = popups[popup], config = popupconfig[popup], - ref = $('#'+popup+'link'), + ref = $(config.link ? config.link : '#'+popup+'link'), above = config.above; if (!obj) { @@ -452,7 +458,7 @@ function rcube_mail_ui() else if (config.toggle && show && obj.is(':visible')) show = false; - if (show && ref) { + if (show && ref.length) { var parent = ref.parent(), win = $(window), pos; @@ -575,6 +581,19 @@ function rcube_mail_ui() /**** popup callbacks ****/ + function menu_open(p) + { + if (p && p.props && p.props.menu == 'attachmentmenu') + show_popupmenu('attachmentmenu'); + else + show_listoptions(); + } + + function menu_save(prop) + { + save_listoptions(); + } + function searchmenu(show) { if (show && rcmail.env.search_mods) { @@ -605,6 +624,21 @@ function rcube_mail_ui() } } + function attachmentmenu(elem) + { + var id = elem.parentNode.id.replace(/^attach/, ''); + + $('#attachmenuopen').unbind('click').attr('onclick', '').click(function(e) { + return rcmail.command('open-attachment', id, this); + }); + + $('#attachmenudownload').unbind('click').attr('onclick', '').click(function() { + rcmail.command('download-attachment', id, this); + }); + + popupconfig.attachmentmenu.link = elem; + rcmail.command('menu-open', {menu: 'attachmentmenu', id: id}); + } function spellmenu(show) { -- cgit v1.2.3 From 4d1fe2d230c4194aa99111c5f63dfb33ad35ab83 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sun, 17 Mar 2013 09:59:48 +0100 Subject: Fix "rcmail is undefined" error in HTML attachment preview - regression from commit d30460ad2fc0f78ce44d474fa2c466d660596d27, small improvements --- program/include/rcmail_html_page.php | 2 +- program/include/rcmail_output_html.php | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'program/include/rcmail_output_html.php') diff --git a/program/include/rcmail_html_page.php b/program/include/rcmail_html_page.php index 1d8391580..5d07b8d04 100644 --- a/program/include/rcmail_html_page.php +++ b/program/include/rcmail_html_page.php @@ -30,7 +30,7 @@ class rcmail_html_page extends rcmail_output_html { public function write($contents = '') { - self::reset(); + self::reset(true); // load embed.css from skin folder (if exists) if ($embed_css = $this->get_skin_file('/embed.css')) { diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index ade2bd4a4..6100269b9 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -307,17 +307,19 @@ class rcmail_output_html extends rcmail_output /** * Delete all stored env variables and commands + * + * @param bool $all Reset all env variables (including internal) */ - public function reset() + public function reset($all = false) { - $env = array_intersect_key($this->env, array('extwin'=>1, 'framed'=>1)); + $env = $all ? null : array_intersect_key($this->env, array('extwin'=>1, 'framed'=>1)); parent::reset(); // let some env variables survive $this->env = $this->js_env = $env; - $this->js_labels = array(); - $this->js_commands = array(); + $this->js_labels = array(); + $this->js_commands = array(); $this->script_files = array(); $this->scripts = array(); $this->header = ''; @@ -362,7 +364,7 @@ class rcmail_output_html extends rcmail_output $this->parse($templ, false); } else { - $this->framed = $templ == 'iframe' ? true : $this->framed; + $this->framed = true; $this->write(); } @@ -396,9 +398,11 @@ class rcmail_output_html extends rcmail_output $this->set_env('request_token', $this->app->get_request_token()); // write all env variables to client - $js = $this->framed ? "if(window.parent) {\n" : ''; - $js .= $this->get_js_commands() . ($this->framed ? ' }' : ''); - $this->add_script($js, 'head_top'); + if ($commands = $this->get_js_commands()) { + $js = $this->framed ? "if (window.parent) {\n" : ''; + $js .= $commands . ($this->framed ? ' }' : ''); + $this->add_script($js, 'head_top'); + } // send clickjacking protection headers $iframe = $this->framed || !empty($_REQUEST['_framed']); -- cgit v1.2.3 From 17573916bcb4281b15f1acb27e4fae782ad52d2a Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Sun, 24 Mar 2013 11:52:55 +0100 Subject: Ensure backwards compatibility by considering old-style skin_path attribute for tags --- program/include/rcmail_output_html.php | 1 + 1 file changed, 1 insertion(+) (limited to 'program/include/rcmail_output_html.php') diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index 6100269b9..d8996edbf 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -873,6 +873,7 @@ class rcmail_output_html extends rcmail_output // include a file case 'include': $old_base_path = $this->base_path; + if (!empty($attrib['skin_path'])) $attrib['skinpath'] = $attrib['skin_path']; if ($path = $this->get_skin_file($attrib['file'], $skin_path, $attrib['skinpath'])) { $this->base_path = preg_replace('!plugins/\w+/!', '', $skin_path); // set base_path to core skin directory (not plugin's skin) $path = realpath($path); -- cgit v1.2.3