From 46f7b7096450939fe03c95aa81ce06ae4bfca89d Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Mon, 28 Mar 2016 06:51:43 -0400 Subject: [PATCH] Enable reply/reply-all/forward buttons also in preview frame of message/rfc822 --- program/steps/settings/func.inc | 146 ++++++++++++++++++++++++++++++++++-------------- 1 files changed, 104 insertions(+), 42 deletions(-) diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 418f8b0..087b70b 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -1,6 +1,6 @@ <?php -/* +/** +-----------------------------------------------------------------------+ | program/steps/settings/func.inc | | | @@ -44,6 +44,8 @@ 'add-response' => 'edit_response.inc', 'save-response' => 'edit_response.inc', 'delete-response' => 'responses.inc', + 'delete-identity' => 'identities.inc', + 'upload-display' => 'upload.inc', )); @@ -92,9 +94,9 @@ } // get identities list and define 'mail' column - $list = $RCMAIL->user->list_identities(); + $list = $RCMAIL->user->list_emails(); foreach ($list as $idx => $row) { - $list[$idx]['mail'] = trim($row['name'] . ' <' . rcube_utils::idn_to_utf8($row['email']) .'>'); + $list[$idx]['mail'] = trim($row['name'] . ' <' . rcube_utils::idn_to_utf8($row['email']) . '>'); } // get all identites from DB and define list of cols to be displayed @@ -218,7 +220,7 @@ foreach (DateTimeZone::listIdentifiers() as $i => $tzs) { try { $tz = new DateTimeZone($tzs); - $date = new DateTime('2012-12-21', $tz); + $date = new DateTime(date('Y') . '-12-21', $tz); $offset = $date->format('Z') + 45000; $sortkey = sprintf('%06d.%s', $offset, $tzs); $zones[$sortkey] = array($tzs, $date->format('P')); @@ -332,28 +334,36 @@ $input = new html_radiobutton(array('name'=>'_skin')); foreach ($skins as $skin) { - $thumbnail = "./skins/$skin/thumbnail.png"; - if (!is_file($thumbnail)) - $thumbnail = './program/resources/blank.gif'; - + $thumbnail = "skins/$skin/thumbnail.png"; $skinname = ucfirst($skin); $author_link = $license_link = ''; - $meta = @json_decode(@file_get_contents("./skins/$skin/meta.json"), true); + $meta = @json_decode(@file_get_contents(INSTALL_PATH . "skins/$skin/meta.json"), true); if (is_array($meta) && $meta['name']) { $skinname = $meta['name']; $author_link = $meta['url'] ? html::a(array('href' => $meta['url'], 'target' => '_blank'), rcube::Q($meta['author'])) : rcube::Q($meta['author']); - $license_link = $meta['license-url'] ? html::a(array('href' => $meta['license-url'], 'target' => '_blank'), rcube::Q($meta['license'])) : rcube::Q($meta['license']); + $license_link = $meta['license-url'] ? html::a(array('href' => $meta['license-url'], 'target' => '_blank', 'tabindex' => '-1'), rcube::Q($meta['license'])) : rcube::Q($meta['license']); } + $img = html::img(array( + 'src' => $thumbnail, + 'class' => 'skinthumbnail', + 'alt' => $skin, + 'width' => 64, + 'height' => 64, + 'onerror' => "this.src = rcmail.assets_path('program/resources/blank.gif')", + )); + + $skinnames[] = mb_strtolower($skinname); $blocks['skin']['options'][$skin]['content'] = html::label(array('class' => 'skinselection'), html::span('skinitem', $input->show($config['skin'], array('value' => $skin, 'id' => $field_id.$skin))) . - html::span('skinitem', html::img(array('src' => $thumbnail, 'class' => 'skinthumbnail', 'alt' => $skin, 'width' => 64, 'height' => 64))) . + html::span('skinitem', $img) . html::span('skinitem', html::span('skinname', rcube::Q($skinname)) . html::br() . html::span('skinauthor', $author_link ? 'by ' . $author_link : '') . html::br() . html::span('skinlicense', $license_link ? $RCMAIL->gettext('license').': ' . $license_link : '')) ); } + array_multisort($blocks['skin']['options'], SORT_ASC, SORT_STRING, $skinnames); } } @@ -376,13 +386,16 @@ if ($current) { $product_name = $RCMAIL->config->get('product_name', 'Roundcube Webmail'); $RCMAIL->output->add_script(sprintf("%s.check_protocol_handler('%s', '#mailtoprotohandler');", - rcmail_output::JS_OBJECT_NAME, rcube::JQ($product_name)), 'foot'); + rcmail_output::JS_OBJECT_NAME, rcube::JQ($product_name)), 'docready'); } $blocks['browser']['options']['mailtoprotohandler'] = array( 'content' => html::a(array( - 'href' => '#', - 'id' => 'mailtoprotohandler'), rcube::Q($RCMAIL->gettext('mailtoprotohandler'))), + 'href' => '#', + 'id' => 'mailtoprotohandler' + ), + rcube::Q($RCMAIL->gettext('mailtoprotohandler'))) . + html::span('mailtoprotohandler-status', ''), ); break; @@ -449,7 +462,7 @@ $select->add($RCMAIL->gettext('autosend'), 1); $select->add($RCMAIL->gettext('autosendknown'), 3); $select->add($RCMAIL->gettext('autosendknownignore'), 4); - $select->add($RCMAIL->gettext('ignore'), 2); + $select->add($RCMAIL->gettext('ignorerequest'), 2); $blocks['main']['options']['mdn_requests'] = array( 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('mdnrequests'))), @@ -487,11 +500,11 @@ $field_id = 'rcmfd_mail_pagesize'; $input = new html_inputfield(array('name' => '_mail_pagesize', 'id' => $field_id, 'size' => 5)); - $size = intval($config['mail_pagesize'] ? $config['mail_pagesize'] : $config['pagesize']); + $size = intval($config['mail_pagesize'] ?: $config['pagesize']); $blocks['main']['options']['pagesize'] = array( 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('pagesize'))), - 'content' => $input->show($size ? $size : 50), + 'content' => $input->show($size ?: 50), ); } @@ -659,9 +672,10 @@ $select = new html_select(array('name' => '_htmleditor', 'id' => $field_id)); $select->add($RCMAIL->gettext('never'), 0); - $select->add($RCMAIL->gettext('always'), 1); $select->add($RCMAIL->gettext('htmlonreply'), 2); $select->add($RCMAIL->gettext('htmlonreplyandforward'), 3); + $select->add($RCMAIL->gettext('always'), 1); + $select->add($RCMAIL->gettext('alwaysbutplain'), 4); $blocks['main']['options']['htmleditor'] = array( 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('htmleditor'))), @@ -735,7 +749,7 @@ ); } - if (!isset($no_override['dsn_default'])) { + if (!isset($no_override['dsn_default']) && $RCMAIL->config->get('smtp_server')) { if (!$current) { continue 2; } @@ -832,6 +846,20 @@ ); } + if (!isset($no_override['sig_below'])) { + if (!$current) { + continue 2; + } + + $field_id = 'rcmfd_sig_below'; + $input = new html_checkbox(array('name' => '_sig_below', 'id' => $field_id, 'value' => 1)); + + $blocks['sig']['options']['sig_below'] = array( + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('sigbelow'))), + 'content' => $input->show($RCMAIL->config->get('sig_below') ? 1 : 0), + ); + } + if (!isset($no_override['strip_existing_sig'])) { if (!$current) { continue 2; @@ -843,6 +871,20 @@ $blocks['sig']['options']['strip_existing_sig'] = array( 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('replyremovesignature'))), 'content' => $input->show($config['strip_existing_sig']?1:0), + ); + } + + if (!isset($no_override['sig_separator'])) { + if (!$current) { + continue 2; + } + + $field_id = 'rcmfd_sig_separator'; + $input = new html_checkbox(array('name' => '_sig_separator', 'id' => $field_id, 'value' => 1)); + + $blocks['sig']['options']['sig_separator'] = array( + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('sigseparator'))), + 'content' => $input->show($RCMAIL->config->get('sig_separator') ? 1 : 0), ); } @@ -883,7 +925,7 @@ $select_default_font->add('', ''); $fonts = rcmail::font_defs(); - foreach ($fonts as $fname => $font) { + foreach (array_keys($fonts) as $fname) { $select_default_font->add($fname, $fname); } @@ -908,6 +950,20 @@ $blocks['main']['options']['reply_all_mode'] = array( 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('replyallmode'))), 'content' => $select->show(intval($config['reply_all_mode'])), + ); + } + + if (!isset($no_override['compose_save_localstorage'])) { + if (!$current) { + continue 2; + } + + $field_id = 'rcmfd_compose_save_localstorage'; + $input = new html_checkbox(array('name' => '_compose_save_localstorage', 'id' => $field_id, 'value' => 1)); + + $blocks['advanced']['options']['compose_save_localstorage'] = array( + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('savelocalstorage'))), + 'content' => $input->show($config['compose_save_localstorage']?1:0), ); } @@ -987,11 +1043,11 @@ $field_id = 'rcmfd_addressbook_pagesize'; $input = new html_inputfield(array('name' => '_addressbook_pagesize', 'id' => $field_id, 'size' => 5)); - $size = intval($config['addressbook_pagesize'] ? $config['addressbook_pagesize'] : $config['pagesize']); + $size = intval($config['addressbook_pagesize'] ?: $config['pagesize']); $blocks['main']['options']['pagesize'] = array( 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('pagesize'))), - 'content' => $input->show($size ? $size : 50), + 'content' => $input->show($size ?: 50), ); } @@ -1032,7 +1088,8 @@ } // Configure special folders - if (!isset($no_override['default_folders']) && $current) { + $set = array('drafts_mbox', 'sent_mbox', 'junk_mbox', 'trash_mbox'); + if ($current && count(array_intersect($no_override, $set)) < 4) { $select = $RCMAIL->folder_selector(array( 'noselection' => '---', 'realnames' => true, @@ -1040,10 +1097,10 @@ 'folder_filter' => 'mail', 'folder_rights' => 'w', )); - } - // #1486114, #1488279, #1489219 - $onchange = "if ($(this).val() == 'INBOX') $(this).val('')"; + // #1486114, #1488279, #1489219 + $onchange = "if ($(this).val() == 'INBOX') $(this).val('')"; + } if (!isset($no_override['drafts_mbox'])) { if (!$current) { @@ -1204,7 +1261,7 @@ $data = $RCMAIL->plugins->exec_hook('preferences_list', array('section' => $sect['id'], 'blocks' => $blocks, 'current' => $current)); - $advanced_prefs = $config['advanced_prefs']; + $advanced_prefs = (array) $RCMAIL->config->get('advanced_prefs'); // create output foreach ($data['blocks'] as $key => $block) { @@ -1233,6 +1290,14 @@ unset($sections[$idx]); else $sections[$idx]['blocks'] = $data['blocks']; + + // allow plugins to add a header to each section + $data = $RCMAIL->plugins->exec_hook('preferences_section_header', + array('section' => $sect['id'], 'header' => '', 'current' => $current)); + + if (!empty($data['header'])) { + $sections[$idx]['header'] = $data['header']; + } } return array($sections, $plugin['cols']); @@ -1284,26 +1349,23 @@ { global $RCMAIL, $OUTPUT; - $default_folders = (array) $RCMAIL->config->get('default_folders'); $protect_folders = $RCMAIL->config->get('protect_default_folders'); + $storage = $RCMAIL->get_storage(); + $delimiter = $storage->get_hierarchy_delimiter(); - $storage = $RCMAIL->get_storage(); - $delimiter = $storage->get_hierarchy_delimiter(); $name_utf8 = rcube_charset::convert($name, 'UTF7-IMAP'); - $protected = $protect_folders && in_array($name, $default_folders); - + $protected = $protect_folders && $storage->is_special_folder($name); $foldersplit = explode($delimiter, $storage->mod_folder($name)); $level = count($foldersplit) - 1; - $display_name = str_repeat(' ', $level) - . rcube::Q($protected ? $RCMAIL->localize_foldername($name) : rcube_charset::convert($foldersplit[$level], 'UTF7-IMAP')); + $display_name = $protected ? $RCMAIL->localize_foldername($name) : rcube_charset::convert($foldersplit[$level], 'UTF7-IMAP'); + $class_name = trim($class_name . ' mailbox'); if ($oldname === null) { - $OUTPUT->command('add_folder_row', $name_utf8, $display_name, $protected, $subscribe, - false, $class_name); + $OUTPUT->command('add_folder_row', $name, $name_utf8, $display_name, $protected, $subscribe, + $class_name); } else { - $OUTPUT->command('replace_folder_row', rcube_charset::convert($oldname, 'UTF7-IMAP'), - $name_utf8, $display_name, $protected, $class_name); + $OUTPUT->command('replace_folder_row', $oldname, $name, $name_utf8, $display_name, $protected, $class_name); } } @@ -1321,7 +1383,7 @@ array('command' => 'preferences', 'type' => 'link', 'label' => 'preferences', 'title' => 'editpreferences'), array('command' => 'folders', 'type' => 'link', 'label' => 'folders', 'title' => 'managefolders'), array('command' => 'identities', 'type' => 'link', 'label' => 'identities', 'title' => 'manageidentities'), - array('command' => 'responses', 'type' => 'link', 'label' => 'responses', 'title' => 'editresponses'), + array('command' => 'responses', 'type' => 'link', 'label' => 'responses', 'title' => 'manageresponses'), ); // get all identites from DB and define list of cols to be displayed @@ -1334,7 +1396,7 @@ $tagname = $attrib['tagname']; $tabs = array(); - foreach ($plugin['actions'] as $k => $action) { + foreach ($plugin['actions'] as $action) { if (!$action['command'] && !$action['href'] && $action['action']) { $action['href'] = $RCMAIL->url(array('_action' => $action['action'])); } @@ -1342,8 +1404,8 @@ $button = $OUTPUT->button($action); $attr = $attrib; - $cmd = $action['action'] ? $action['action'] : $action['command']; - $id = $action['id'] ? $action['id'] : $cmd; + $cmd = $action['action'] ?: $action['command']; + $id = $action['id'] ?: $cmd; if (!empty($id)) { $attr['id'] = preg_replace('/[^a-z0-9]/i', '', $attrib['idprefix'] . $id); -- Gitblit v1.9.1