From a235002ca1b3a4fd7e9f264479e4064f30599825 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 22 May 2018 08:49:55 +0200 Subject: [PATCH 01/11] Elastic: Unify min width for iframe'd dialogs Make sure dialog is min 576px on desktop so the form inside also uses desktop layout. --- skins/elastic/ui.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/skins/elastic/ui.js b/skins/elastic/ui.js index e8a5676be..c39676e73 100644 --- a/skins/elastic/ui.js +++ b/skins/elastic/ui.js @@ -113,6 +113,10 @@ function rcube_elastic_ui() // Intercept jQuery-UI dialogs... $.ui && $.widget('ui.dialog', $.ui.dialog, { open: function() { + // .. to unify min width for iframe'd dialogs + if ($(this.element).is('.iframe')) { + this.options.width = Math.max(576, this.options.width); + } this._super(); // ... to re-style them on dialog open dialog_open(this); From b08a5e7873c41cae77183a02ab5bcb5ed04967c8 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 22 May 2018 08:51:19 +0200 Subject: [PATCH 02/11] Display a hint about max file size for contacts import --- program/steps/addressbook/import.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/program/steps/addressbook/import.inc b/program/steps/addressbook/import.inc index 34928f795..7ada22142 100644 --- a/program/steps/addressbook/import.inc +++ b/program/steps/addressbook/import.inc @@ -203,6 +203,7 @@ function rcmail_import_form($attrib) $attrib += array('id' => "rcmImportForm"); $writable_books = $RCMAIL->get_address_sources(true, true); + $max_filesize = $RCMAIL->upload_init(); $form = ''; $table = new html_table(array('cols' => 2)); @@ -216,7 +217,9 @@ function rcmail_import_form($attrib) )); $table->add('title', html::label('rcmimportfile', $RCMAIL->gettext('importfromfile'))); - $table->add(null, $upload->show()); + $table->add(null, $upload->show() + . html::div('hint', $RCMAIL->gettext(array('id' => 'importfile', 'name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) + ); // addressbook selector if (count($writable_books) > 1) { From 1e9d262bbc61e769c2dcab11a26e27edd85f0904 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 22 May 2018 10:08:16 +0200 Subject: [PATCH 03/11] Elastic: Fix page scrolling when using keyboard in menus --- skins/elastic/ui.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/skins/elastic/ui.js b/skins/elastic/ui.js index c39676e73..e38735334 100644 --- a/skins/elastic/ui.js +++ b/skins/elastic/ui.js @@ -1947,6 +1947,7 @@ function rcube_elastic_ui() break; } } + return false; // prevents from scrolling the whole page } }); @@ -2965,6 +2966,7 @@ function rcube_elastic_ui() break; } } + return false; // prevents from scrolling the whole page } }); From c4e65a61fe0f5da7261a0d9336019bef025dfeb5 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 22 May 2018 10:11:24 +0200 Subject: [PATCH 04/11] Fix empty 'for' attribute --- plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php index a1850704b..6b6a6b90b 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php @@ -1508,8 +1508,10 @@ class rcube_sieve_engine $out .= sprintf("\n" . '
' . '' . '
%s
', - $field_id, rcube::Q($this->plugin->gettext('filterset')), - $this->filtersets_list(array('id' => 'sievescriptname'), true)); + 'sievescriptname', + rcube::Q($this->plugin->gettext('filterset')), + $this->filtersets_list(array('id' => 'sievescriptname'), true) + ); } else if ($compact) { $out .= sprintf("\n" . '
' From 253fb9bbd7060bd0a5ebaa5622b80cdcb9b3d1b9 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 22 May 2018 10:37:42 +0200 Subject: [PATCH 05/11] Elastic: Fix width of some select fields in sieve filter form Not working properly since we use .custom-select without .form-control --- skins/elastic/styles/widgets/forms.less | 1 + 1 file changed, 1 insertion(+) diff --git a/skins/elastic/styles/widgets/forms.less b/skins/elastic/styles/widgets/forms.less index a04defa5f..2f9d32b0e 100644 --- a/skins/elastic/styles/widgets/forms.less +++ b/skins/elastic/styles/widgets/forms.less @@ -92,6 +92,7 @@ input.smart-upload { td.rowactions { width: 1%; + .custom-select, .form-control { width: auto; } From d0205f613de15f8c1f483f86fa8c08ac054b0b41 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 22 May 2018 10:40:37 +0200 Subject: [PATCH 06/11] Fix redundant empty option in mailbox selector --- plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php index 6b6a6b90b..6ae4690b1 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php @@ -2398,9 +2398,10 @@ class rcube_sieve_engine // mailbox select if ($action['type'] == 'fileinto') { - $mailbox = $this->mod_mailbox($action['target'], 'out'); // make sure non-existing (or unsubscribed) mailbox is listed (#1489956) - $additional = array($mailbox); + if ($mailbox = $this->mod_mailbox($action['target'], 'out')) { + $additional = array($mailbox); + } } else { $mailbox = ''; From 4b97f40af90057ff8b06c5f7caf0b4c208a949c7 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 22 May 2018 11:12:24 +0200 Subject: [PATCH 07/11] Get rid of debug_level (#6298) --- CHANGELOG | 1 + INSTALL | 4 +- config/defaults.inc.php | 3 -- installer/config.php | 16 ------- program/include/rcmail_install.php | 11 +---- program/lib/Roundcube/rcube.php | 61 +++++++------------------- program/lib/Roundcube/rcube_config.php | 14 ++---- program/steps/utils/error.inc | 9 +--- 8 files changed, 27 insertions(+), 92 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 6d9b02b7e..e0c916b0f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -66,6 +66,7 @@ CHANGELOG Roundcube Webmail - Plugin API: Added 'show_bytes' hook (#5001) - Add option to not indent quoted text on top-posting reply (#5105) - Removed global $CONFIG variable +- Removed debug_level setting - Support AUTHENTICATE LOGIN for IMAP connections (#5563) - Support LDAP GSSAPI authentication (#5703) - Localized timezone selector (#4983) diff --git a/INSTALL b/INSTALL index 7971bcf8a..940415444 100644 --- a/INSTALL +++ b/INSTALL @@ -76,7 +76,9 @@ and configure your installation to be not surprised by default behaviour. Roundcube writes internal errors to the 'errors' log file located in the logs directory which can be configured in config/config.inc.php. If you want ordinary -PHP errors to be logged there as well, set error_log php.ini or .htaccess file. +PHP errors to be logged there as well, set error_log in php.ini or .htaccess file. + +Roundcube forces display_errors=Off and log_errors=On. By default the session cookie settings of PHP are not modified by Roundcube. However if you want to limit the session cookies to the directory where diff --git a/config/defaults.inc.php b/config/defaults.inc.php index 988a35f41..b00ac76a7 100644 --- a/config/defaults.inc.php +++ b/config/defaults.inc.php @@ -63,9 +63,6 @@ $config['db_max_allowed_packet'] = null; // LOGGING/DEBUGGING // ---------------------------------- -// system error reporting, sum of: 1 = log; 4 = show -$config['debug_level'] = 1; - // log driver: 'syslog', 'stdout' or 'file'. $config['log_driver'] = 'file'; diff --git a/installer/config.php b/installer/config.php index dd14c24cb..90fa9929c 100644 --- a/installer/config.php +++ b/installer/config.php @@ -11,7 +11,6 @@ $RCI->bool_config_props = array( 'auto_create_user' => 1, 'smtp_log' => 1, 'prefer_html' => 1, - 'debug_level' => 1, ); // allow the current user to get to the next step @@ -196,21 +195,6 @@ echo $input_ilevel->show($RCI->getprop('identities_level'), 0); Logging & Debugging
-
debug_level
-
-getprop('debug_level'); -$check_debug = new html_checkbox(array('name' => '_debug_level[]')); -echo $check_debug->show(($value & 1) ? 1 : 0 , array('value' => 1, 'id' => 'cfgdebug1')); -echo '
'; - -echo $check_debug->show(($value & 4) ? 4 : 0, array('value' => 4, 'id' => 'cfgdebug4')); -echo '
'; - -?> -
-
log_driver
config->get('debug_level'); - - // disable errors for ajax requests, write to log instead (#1487831) - if (($level & 4) && !empty($_REQUEST['_remote'])) { - $level = ($level ^ 4) | 1; - } // write error to local log file - if (($level & 1) || !empty($arg_arr['fatal'])) { - if ($_SERVER['REQUEST_METHOD'] == 'POST') { - foreach (array('_task', '_action') as $arg) { - if ($_POST[$arg] && !$_GET[$arg]) { - $post_query[$arg] = $_POST[$arg]; - } - } - - if (!empty($post_query)) { - $post_query = (strpos($_SERVER['REQUEST_URI'], '?') != false ? '&' : '?') - . http_build_query($post_query, '', '&'); + if ($_SERVER['REQUEST_METHOD'] == 'POST') { + foreach (array('_task', '_action') as $arg) { + if ($_POST[$arg] && !$_GET[$arg]) { + $post_query[$arg] = $_POST[$arg]; } } - $log_entry = sprintf("%s Error: %s%s (%s %s)", - $program, - $arg_arr['message'], - $arg_arr['file'] ? sprintf(' in %s on line %d', $arg_arr['file'], $arg_arr['line']) : '', - $_SERVER['REQUEST_METHOD'], - $_SERVER['REQUEST_URI'] . $post_query); - - if (!self::write_log('errors', $log_entry)) { - // send error to PHPs error handler if write_log didn't succeed - trigger_error($arg_arr['message'], E_USER_WARNING); + if (!empty($post_query)) { + $post_query = (strpos($_SERVER['REQUEST_URI'], '?') != false ? '&' : '?') + . http_build_query($post_query, '', '&'); } } - // report the bug to the global bug reporting system - if ($level & 2) { - // TODO: Send error via HTTP - } - - // show error if debug_mode is on - if ($level & 4) { - print "$program Error"; - - if (!empty($arg_arr['file']) && !empty($arg_arr['line'])) { - print " in $arg_arr[file] ($arg_arr[line])"; - } + $log_entry = sprintf("%s Error: %s%s (%s %s)", + $program, + $arg_arr['message'], + $arg_arr['file'] ? sprintf(' in %s on line %d', $arg_arr['file'], $arg_arr['line']) : '', + $_SERVER['REQUEST_METHOD'], + $_SERVER['REQUEST_URI'] . $post_query); - print ': '; - print nl2br($arg_arr['message']); - print '
'; - flush(); + if (!self::write_log('errors', $log_entry)) { + // send error to PHPs error handler if write_log didn't succeed + trigger_error($arg_arr['message'], E_USER_WARNING); } } diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php index 300337ae7..73e7738a6 100644 --- a/program/lib/Roundcube/rcube_config.php +++ b/program/lib/Roundcube/rcube_config.php @@ -245,20 +245,14 @@ class rcube_config } // set PHP error logging according to config - if ($this->prop['debug_level'] & 1) { - $error_log = $this->prop['log_driver']; - if ($error_log != 'syslog') { - $error_log = $this->prop['log_dir'] . '/errors'; - $error_log .= isset($this->prop['log_file_ext']) ? $this->prop['log_file_ext'] : '.log'; - } + $error_log = $this->prop['log_driver']; + if ($error_log != 'syslog') { + $error_log = $this->prop['log_dir'] . '/errors'; + $error_log .= isset($this->prop['log_file_ext']) ? $this->prop['log_file_ext'] : '.log'; ini_set('error_log', $error_log); - ini_set('log_errors', 1); } - // enable display_errors in 'show' level, but not for ajax requests - ini_set('display_errors', intval(empty($_REQUEST['_remote']) && ($this->prop['debug_level'] & 4))); - // remove deprecated properties unset($this->prop['dst_active']); } diff --git a/program/steps/utils/error.inc b/program/steps/utils/error.inc index 9e134fb7a..773fe71fe 100644 --- a/program/steps/utils/error.inc +++ b/program/steps/utils/error.inc @@ -96,14 +96,7 @@ else if ($ERROR_CODE == 603) { // system error else { $__error_title = "SERVICE CURRENTLY NOT AVAILABLE!"; - $__error_text = "Please contact your server-administrator."; - - if (($rcmail->config->get('debug_level') & 4) && $ERROR_MESSAGE) { - $__error_text = $ERROR_MESSAGE; - } - else { - $__error_text = sprintf('Error No. [%s]', $ERROR_CODE); - } + $__error_text = sprintf('Error No. [%s]', $ERROR_CODE); } // inform plugins From 130b70e464c3a5253935f9198a0640efd691d02b Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 22 May 2018 15:36:23 +0200 Subject: [PATCH 08/11] Use array() instead of [] --- plugins/zipdownload/zipdownload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/zipdownload/zipdownload.php b/plugins/zipdownload/zipdownload.php index e5eacd6df..2763228fa 100644 --- a/plugins/zipdownload/zipdownload.php +++ b/plugins/zipdownload/zipdownload.php @@ -17,7 +17,7 @@ class zipdownload extends rcube_plugin public $task = 'mail'; private $charset = 'ASCII'; - private $names = []; + private $names = array(); private $default_limit = '50MB'; // RFC4155: mbox date format From 43fcf5bce7fb17976496fcaa127b0cada904e529 Mon Sep 17 00:00:00 2001 From: Caio Nardi Date: Tue, 22 May 2018 10:37:15 -0300 Subject: [PATCH 09/11] Fix checking duplicated names in the zip file (#6302) --- plugins/zipdownload/zipdownload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/zipdownload/zipdownload.php b/plugins/zipdownload/zipdownload.php index 2763228fa..d6fbefefd 100644 --- a/plugins/zipdownload/zipdownload.php +++ b/plugins/zipdownload/zipdownload.php @@ -213,7 +213,7 @@ class zipdownload extends rcube_plugin * Adding a number before dot of extension on a name of file with same name on zip * Ext: attach(1).txt on attach filename that has a attach.txt filename on same zip */ - if (isset($this->name[$displayname])) { + if (isset($this->names[$displayname])) { list($filename, $ext) = preg_split("/\.(?=[^\.]*$)/", $displayname); $displayname = $filename . '(' . ($this->names[$displayname]++) . ').' . $ext; $this->names[$displayname] = 1; From 594d33588c72a536dc9cfc2d555314b3ddf11dfc Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 22 May 2018 15:42:52 +0200 Subject: [PATCH 10/11] Update changelog --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index e0c916b0f..7c8a6e042 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -89,6 +89,7 @@ CHANGELOG Roundcube Webmail - Fix bug where some parts of quota information could have been ignored (#6280) - Fix bug where some escape sequences in html styles could bypass security checks - Fix bug where some forbidden characters on Cyrus-IMAP were not prevented from use in folder names +- Fix bug where only attachments with the same name would be ignored on zip download (#6301) RELEASE 1.3.6 ------------- From 9d3d600a2557608824cacfdbf4055bca9985f026 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 23 May 2018 09:49:31 +0200 Subject: [PATCH 11/11] Display a dialog for mail import with supported format description and upload size hint --- CHANGELOG | 1 + program/js/app.js | 8 +- program/localization/en_US/labels.inc | 4 +- program/steps/mail/func.inc | 15 +++- .../elastic/templates/includes/mail-menu.html | 7 +- skins/elastic/templates/mail.html | 2 - skins/elastic/ui.js | 24 +++++- skins/larry/templates/mail.html | 4 +- skins/larry/ui.js | 74 ++++--------------- 9 files changed, 66 insertions(+), 73 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7c8a6e042..1f96ad79d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -57,6 +57,7 @@ CHANGELOG Roundcube Webmail - Reset onerror on images if placeholder does not exist to prevent from requests storm - Unified and simplified code for loading content frame for responses and identities - Display contact import and advanced search in popup dialogs +- Display a dialog for mail import with supported format description and upload size hint - Make possible to set (some) config options from a skin - Added optional checkbox selection for the list widget - Make 'compose' command always enabled diff --git a/program/js/app.js b/program/js/app.js index 69f9bbcf3..f96c1bec4 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -1430,7 +1430,13 @@ function rcube_webmail() ret = false; this.triggerEvent('actionafter', { props:props, action:command, aborted:aborted, ret:ret, originalEvent:event}); - return ret === false ? false : obj ? false : true; + if (ret === false) + return false; + + if (obj || aborted === true) + return false; + + return true; }; // set command(s) enabled or disabled diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc index 3638b5332..7238b7dcf 100644 --- a/program/localization/en_US/labels.inc +++ b/program/localization/en_US/labels.inc @@ -223,6 +223,8 @@ $labels['folderactions'] = 'Folder actions...'; $labels['compact'] = 'Compact'; $labels['empty'] = 'Empty'; $labels['importmessages'] = 'Import messages'; +$labels['mailimportdesc'] = 'You can upload mail using files in MIME or Mbox format.'; +$labels['mailimportzip'] = 'Multiple files can be compressed into zip archives.'; $labels['quota'] = 'Disk usage'; $labels['unknown'] = 'unknown'; @@ -479,7 +481,7 @@ $labels['importreplace'] = 'Replace the entire address book'; $labels['importgroups'] = 'Import group assignments'; $labels['importgroupsall'] = 'All (create groups if necessary)'; $labels['importgroupsexisting'] = 'Only for existing groups'; -$labels['importdesc'] = 'You can upload contacts from an existing address book.
We currently support importing addresses from the vCard or CSV (comma-separated) data format.'; +$labels['importdesc'] = 'You can upload contacts from an existing address book.
We currently support importing addresses from the vCard or CSV (comma-separated) data format.'; $labels['done'] = 'Done'; // settings diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 36b3ec218..0ab2dba0f 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -1687,16 +1687,23 @@ function rcmail_message_import_form($attrib = array()) { global $RCMAIL; - $RCMAIL->output->add_label('selectimportfile','importwait'); + $RCMAIL->output->add_label('selectimportfile', 'importwait', 'importmessages'); - $input_attr = array( + $description = $RCMAIL->gettext('mailimportdesc'); + $input_attr = array( 'multiple' => true, 'name' => '_file[]', - 'accept' => ".eml, .mbox, message/rfc822, text/*", + 'accept' => '.eml, .mbox, .msg, message/rfc822, text/*', ); + if (class_exists('ZipArchive', false)) { + $input_attr['accept'] .= '.zip, application/zip, application/x-zip'; + $description .= ' ' . $RCMAIL->gettext('mailimportzip'); + } + $attrib['prefix'] = html::tag('input', array('type' => 'hidden', 'name' => '_unlock', 'value' => '')) - . html::tag('input', array('type' => 'hidden', 'name' => '_framed', 'value' => '1')); + . html::tag('input', array('type' => 'hidden', 'name' => '_framed', 'value' => '1')) + . html::p(null, $description); return $RCMAIL->upload_form($attrib, 'importform', 'import-messages', $input_attr); } diff --git a/skins/elastic/templates/includes/mail-menu.html b/skins/elastic/templates/includes/mail-menu.html index 302f4e734..f6eb35562 100644 --- a/skins/elastic/templates/includes/mail-menu.html +++ b/skins/elastic/templates/includes/mail-menu.html @@ -61,7 +61,8 @@
+ + + + diff --git a/skins/elastic/templates/mail.html b/skins/elastic/templates/mail.html index 99ad32d7c..3ffcc1124 100644 --- a/skins/elastic/templates/mail.html +++ b/skins/elastic/templates/mail.html @@ -184,6 +184,4 @@ - - diff --git a/skins/elastic/ui.js b/skins/elastic/ui.js index e38735334..a89bb54aa 100644 --- a/skins/elastic/ui.js +++ b/skins/elastic/ui.js @@ -59,6 +59,7 @@ function rcube_elastic_ui() this.popup_init = popup_init; this.about_dialog = about_dialog; this.headers_dialog = headers_dialog; + this.import_dialog = import_dialog; this.headers_show = headers_show; this.spellmenu = spellmenu; this.searchmenu = searchmenu; @@ -2238,8 +2239,7 @@ function rcube_elastic_ui() dialog = rcmail.simple_dialog(dialog, rcmail.gettext('listoptionstitle'), save_func, { closeOnEscape: true, - minWidth: 400, - width: width + minWidth: 400 }); }; @@ -2261,7 +2261,6 @@ function rcube_elastic_ui() button: support_button, button_class: 'help', cancel_button: 'close', - width: 600, height: 400 }); }; @@ -2285,11 +2284,28 @@ function rcube_elastic_ui() rcmail.simple_dialog(dialog, rcmail.gettext('arialabelmessageheaders'), null, { cancel_button: 'close', - width: 600, height: 400 }); }; + /** + * Mail import dialog + */ + function import_dialog() + { + var content = $('#uploadform'), + dialog = content.clone(); + + var save_func = function(e) { + return rcmail.command('import-messages', $(dialog.find('form')[0])); + }; + + rcmail.simple_dialog(dialog, rcmail.gettext('importmessages'), save_func, { + closeOnEscape: true, + minWidth: 400 + }); + }; + /** * Search options menu popup */ diff --git a/skins/larry/templates/mail.html b/skins/larry/templates/mail.html index 1c853fe88..72c28697c 100644 --- a/skins/larry/templates/mail.html +++ b/skins/larry/templates/mail.html @@ -171,7 +171,7 @@ - + @@ -262,7 +262,7 @@ - + diff --git a/skins/larry/ui.js b/skins/larry/ui.js index 10b03c078..a5f9c9083 100644 --- a/skins/larry/ui.js +++ b/skins/larry/ui.js @@ -40,9 +40,9 @@ function rcube_mail_ui() this.show_popup = show_popup; this.toggle_popup = toggle_popup; this.add_popup = add_popup; + this.import_dialog = import_dialog; this.set_searchmod = set_searchmod; this.set_searchscope = set_searchscope; - this.show_uploadform = show_uploadform; this.show_header_row = show_header_row; this.hide_header_row = hide_header_row; this.update_quota = update_quota; @@ -181,8 +181,7 @@ function rcube_mail_ui() } } else if (rcmail.env.action == 'compose') { - rcmail.addEventListener('aftersend-attachment', show_uploadform) - .addEventListener('fileappended', function(e) { if (e.attachment.complete) attachmentmenu_append(e.item); }) + rcmail.addEventListener('fileappended', function(e) { if (e.attachment.complete) attachmentmenu_append(e.item); }) .addEventListener('aftertoggle-editor', function(e) { window.setTimeout(function() { layout_composeview() }, 200); if (e && e.mode) @@ -235,8 +234,7 @@ function rcube_mail_ui() rcmail.init_pagejumper('#pagejumper'); rcmail.addEventListener('setquota', update_quota) - .addEventListener('layout-change', mail_layout) - .addEventListener('afterimport-messages', show_uploadform); + .addEventListener('layout-change', mail_layout); } else if (rcmail.env.action == 'get') { new rcube_splitter({ id:'mailpartsplitterv', p1:'#messagepartheader', p2:'#messagepartcontainer', @@ -300,8 +298,7 @@ function rcube_mail_ui() } /*** addressbook task ***/ else if (rcmail.env.task == 'addressbook') { - rcmail.addEventListener('afterupload-photo', show_uploadform) - .addEventListener('beforepushgroup', push_contactgroup) + rcmail.addEventListener('beforepushgroup', push_contactgroup) .addEventListener('beforepopgroup', pop_contactgroup) .addEventListener('menu-open', menu_toggle) .addEventListener('menu-close', menu_toggle); @@ -1078,63 +1075,24 @@ function rcube_mail_ui() }); } - function show_uploadform(e) + /** + * Mail import dialog + */ + function import_dialog() { - var $dialog = $('#upload-dialog'); + var content = $('#uploadform'), + dialog = content.clone().removeClass('popupdialog'); - // close the dialog - if ($dialog.is(':visible')) { - $dialog.dialog('close'); - return; - } + var save_func = function(e) { + return rcmail.command('import-messages', $(dialog.find('form')[0])); + }; - // do nothing if mailvelope editor is active - if (rcmail.mailvelope_editor) - return; - - // add icons to clone file input field - if (rcmail.env.action == 'compose' && !$dialog.data('extended')) { - $('') - .addClass('iconlink add') - .attr('href', '#add') - .html('Add') - .appendTo($('input[type="file"]', $dialog).parent()) - .click(add_uploadfile); - $dialog.data('extended', true); - } - - $dialog.dialog({ - modal: true, - resizable: false, + rcmail.simple_dialog(dialog, rcmail.gettext('importmessages'), save_func, { closeOnEscape: true, - title: $dialog.attr('title'), - open: function(e) { - if (!document.all) - $('input[type=file]', $dialog).first().click(); - }, - close: function() { - try { $('#upload-dialog form').get(0).reset(); } - catch(e){ } // ignore errors - - $dialog.dialog('destroy').hide(); - $('div.addline', $dialog).remove(); - }, - width: 480 - }).show(); - } - - function add_uploadfile(e) - { - var div = $(this).parent(); - var clone = div.clone().addClass('addline').insertAfter(div); - clone.children('.iconlink').click(add_uploadfile); - clone.children('input').val(''); - - if (!document.all) - $('input[type=file]', clone).click(); + minWidth: 400 + }); } - /** * */