diff options
Diffstat (limited to 'program')
-rw-r--r-- | program/include/rcmail_output_html.php | 17 | ||||
-rw-r--r-- | program/include/rcmail_output_json.php | 7 | ||||
-rw-r--r-- | program/js/app.js | 36 | ||||
-rw-r--r-- | program/js/editor.js | 3 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_config.php | 2 | ||||
-rw-r--r-- | program/steps/mail/attachments.inc | 5 | ||||
-rw-r--r-- | program/steps/mail/compose.inc | 27 | ||||
-rw-r--r-- | program/steps/mail/sendmail.inc | 5 | ||||
-rw-r--r-- | program/steps/mail/show.inc | 5 | ||||
-rw-r--r-- | program/steps/settings/edit_prefs.inc | 9 | ||||
-rw-r--r-- | program/steps/settings/func.inc | 44 | ||||
-rw-r--r-- | program/steps/settings/save_prefs.inc | 1 |
12 files changed, 110 insertions, 51 deletions
diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index a2ec29ca3..6db559358 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -924,8 +924,21 @@ class rcmail_output_html extends rcmail_output } else if ($object == 'logo') { $attrib += array('alt' => $this->xml_command(array('', 'object', 'name="productname"'))); - if ($logo = $this->config->get('skin_logo')) - $attrib['src'] = $logo; + + if ($logo = $this->config->get('skin_logo')) { + if (is_array($logo)) { + if ($template_logo = $logo[$this->template_name]) { + $attrib['src'] = $template_logo; + } + elseif ($template_logo = $logo['*']) { + $attrib['src'] = $template_logo; + } + } + else { + $attrib['src'] = $logo; + } + } + $content = html::img($attrib); } else if ($object == 'productname') { diff --git a/program/include/rcmail_output_json.php b/program/include/rcmail_output_json.php index def6ee42c..d0e1eec64 100644 --- a/program/include/rcmail_output_json.php +++ b/program/include/rcmail_output_json.php @@ -227,6 +227,13 @@ class rcmail_output_json extends rcmail_output if (!empty($this->callbacks)) $response['callbacks'] = $this->callbacks; + // trigger generic hook where plugins can put additional content to the response + $hook = $this->app->plugins->exec_hook("render_response", array('response' => $response)); + + // save some memory + $response = $hook['response']; + unset($hook['response']); + echo self::json_serialize($response); } diff --git a/program/js/app.js b/program/js/app.js index 42c661144..337a12156 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -1881,7 +1881,7 @@ function rcube_webmail() html = expando; else if (c == 'subject') { if (bw.ie) { - col.onmouseover = function() { rcube_webmail.long_subject_title_ie(this, message.depth+1); }; + col.onmouseover = function() { rcube_webmail.long_subject_title_ex(this, message.depth+1); }; if (bw.ie8) tree = '<span></span>' + tree; // #1487821 } @@ -3427,7 +3427,8 @@ function rcube_webmail() message = input_message.val(), is_html = ($("input[name='_is_html']").val() == '1'), sig = this.env.identity, - delim = this.env.recipients_delimiter, + delim = this.env.recipients_separator, + rx_delim = RegExp.escape(delim), headers = ['replyto', 'bcc']; // update reply-to/bcc fields with addresses defined in identities @@ -3444,16 +3445,18 @@ function rcube_webmail() } // cleanup - rx = new RegExp(RegExp.escape(delim) + '\\s*' + RegExp(delim), 'g'); - input_val = input_val.replace(rx, delim) - rx = new RegExp('^\\s*' + RegExp.escape(delim) + '\\s*$'); - input_val = input_val.replace(rx, '') + rx = new RegExp(rx_delim + '\\s*' + rx_delim, 'g'); + input_val = input_val.replace(rx, delim); + rx = new RegExp('^[\\s' + rx_delim + ']+'); + input_val = input_val.replace(rx, ''); // add new address(es) - if (new_val) { - rx = new RegExp(RegExp.escape(delim) + '\\s*$'); - if (input_val && !rx.test(input_val)) - input_val += delim + ' '; + if (new_val && input_val.indexOf(new_val) == -1 && input_val.indexOf(new_val.replace(/"/g, '')) == -1) { + if (input_val) { + rx = new RegExp('[' + rx_delim + '\\s]+$') + input_val = input_val.replace(rx, '') + delim + ' '; + } + input_val += new_val + delim + ' '; } @@ -3639,7 +3642,12 @@ function rcube_webmail() att.html = '<a title="'+this.get_label('cancel')+'" onclick="return rcmail.cancel_attachment_upload(\''+name+'\', \''+att.frame+'\');" href="#cancelupload" class="cancelupload">' + (this.env.cancelicon ? '<img src="'+this.env.cancelicon+'" alt="" />' : this.get_label('cancel')) + '</a>' + att.html; - var indicator, li = $('<li>').attr('id', name).addClass(att.classname).html(att.html); + var indicator, li = $('<li>'); + + li.attr('id', name) + .addClass(att.classname) + .html(att.html) + .on('mouseover', function() { rcube_webmail.long_subject_title_ex(this, 0); }); // replace indicator's li if (upload_id && (indicator = document.getElementById(upload_id))) { @@ -4345,7 +4353,7 @@ function rcube_webmail() boxtitle.append(' » '); } - boxtitle.append($('<span>'+prop.name+'</span>')); + boxtitle.append($('<span>').text(prop.name)); } this.triggerEvent('groupupdate', prop); @@ -6986,11 +6994,11 @@ rcube_webmail.long_subject_title = function(elem, indent) if (!elem.title) { var $elem = $(elem); if ($elem.width() + indent * 15 > $elem.parent().width()) - elem.title = $elem.html(); + elem.title = $elem.text(); } }; -rcube_webmail.long_subject_title_ie = function(elem, indent) +rcube_webmail.long_subject_title_ex = function(elem, indent) { if (!elem.title) { var $elem = $(elem), diff --git a/program/js/editor.js b/program/js/editor.js index e403d1f63..e1ef36835 100644 --- a/program/js/editor.js +++ b/program/js/editor.js @@ -80,6 +80,9 @@ function rcmail_editor_callback() if (rcmail.env.default_font) $(tinyMCE.get(rcmail.env.composebody).getBody()).css('font-family', rcmail.env.default_font); + if (rcmail.env.default_font_size) + $(tinyMCE.get(rcmail.env.composebody).getBody()).css('font-size', rcmail.env.default_font_size); + if (elem && elem.type == 'select-one') { rcmail.change_identity(elem); // Focus previously focused element diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php index ac3ea678c..a3741758f 100644 --- a/program/lib/Roundcube/rcube_config.php +++ b/program/lib/Roundcube/rcube_config.php @@ -214,7 +214,7 @@ class rcube_config $success = true; } // deprecated name of config variable - else if (is_array($rcmail_config)) { + if (is_array($rcmail_config)) { $this->merge($rcmail_config); $success = true; } diff --git a/program/steps/mail/attachments.inc b/program/steps/mail/attachments.inc index f83f6892e..85aa9542b 100644 --- a/program/steps/mail/attachments.inc +++ b/program/steps/mail/attachments.inc @@ -118,9 +118,12 @@ if (is_array($_FILES['_attachments']['tmp_name'])) { 'alt' => rcube_label('delete') )); } - else { + else if ($COMPOSE['textbuttons']) { $button = Q(rcube_label('delete')); } + else { + $button = ''; + } $content = html::a(array( 'href' => "#delete", diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index e9f638cb1..30c9f79fb 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -148,6 +148,9 @@ if ($font && !is_array($font)) { $OUTPUT->set_env('default_font', $font); } +// default font size for HTML editor +$OUTPUT->set_env('default_font_size', $RCMAIL->config->get('default_font_size')); + // get reference message and set compose mode if ($msg_uid = $COMPOSE['param']['draft_uid']) { $compose_mode = RCUBE_COMPOSE_DRAFT; @@ -1370,8 +1373,9 @@ function rcmail_compose_attachment_list($attrib) if (!$attrib['id']) $attrib['id'] = 'rcmAttachmentList'; - $out = "\n"; + $out = "\n"; $jslist = array(); + $button = ''; if (is_array($COMPOSE['attachments'])) { if ($attrib['deleteicon']) { @@ -1380,27 +1384,38 @@ function rcmail_compose_attachment_list($attrib) 'alt' => rcube_label('delete') )); } - else + else if (rcube_utils::get_boolean($attrib['textbuttons'])) { $button = Q(rcube_label('delete')); + } foreach ($COMPOSE['attachments'] as $id => $a_prop) { if (empty($a_prop)) continue; - $out .= html::tag('li', array('id' => 'rcmfile'.$id, 'class' => rcmail_filetype2classname($a_prop['mimetype'], $a_prop['name'])), + $out .= html::tag('li', + array( + 'id' => 'rcmfile'.$id, + 'class' => rcmail_filetype2classname($a_prop['mimetype'], $a_prop['name']), + 'onmouseover' => "rcube_webmail.long_subject_title_ex(this, 0)", + ), html::a(array( 'href' => "#delete", 'title' => rcube_label('delete'), 'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%s', this)", JS_OBJECT_NAME, $id), - 'class' => 'delete'), - $button) . Q($a_prop['name'])); + 'class' => 'delete' + ), + $button + ) . Q($a_prop['name']) + ); - $jslist['rcmfile'.$id] = array('name' => $a_prop['name'], 'complete' => true, 'mimetype' => $a_prop['mimetype']); + $jslist['rcmfile'.$id] = array('name' => $a_prop['name'], 'complete' => true, 'mimetype' => $a_prop['mimetype']); } } if ($attrib['deleteicon']) $COMPOSE['deleteicon'] = $CONFIG['skin_path'] . $attrib['deleteicon']; + else if (rcube_utils::get_boolean($attrib['textbuttons'])) + $COMPOSE['textbuttons'] = true; if ($attrib['cancelicon']) $OUTPUT->set_env('cancelicon', $CONFIG['skin_path'] . $attrib['cancelicon']); if ($attrib['loadingicon']) diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 779fb87cd..3f4475e46 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -473,8 +473,9 @@ $isHtml = (bool) get_input_value('_is_html', RCUBE_INPUT_POST); $message_body = get_input_value('_message', RCUBE_INPUT_POST, TRUE, $message_charset); if ($isHtml) { - $font = rcube_fontdefs($RCMAIL->config->get('default_font')); - $bstyle = $font && is_string($font) ? " style='font-family: $font'" : ''; + $font_family = rcube_fontdefs($RCMAIL->config->get('default_font', 'Arial')); + $font_size = $RCMAIL->config->get('default_font_size'); + $bstyle = ' style="font:' . $font_size . ' ' . $font_family . ';"'; // append doctype and html/body wrappers $message_body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">' . diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index 59f4d55e1..9d85f9c8f 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -175,9 +175,9 @@ function rcmail_message_attachments($attrib) $ol .= html::tag('li', null, Q(sprintf("%s (%s)", $filename, $size))); } else { - if (mb_strlen($filename) > 50) { + if ($attrib['maxlength'] && mb_strlen($filename) > $attrib['maxlength']) { $title = $filename; - $filename = abbreviate_string($filename, 50); + $filename = abbreviate_string($filename, $attrib['maxlength']); } else { $title = ''; @@ -190,6 +190,7 @@ function rcmail_message_attachments($attrib) 'href' => $MESSAGE->get_part_url($attach_prop->mime_id, false), 'onclick' => sprintf('return %s.command(\'load-attachment\',\'%s\',this)', JS_OBJECT_NAME, $attach_prop->mime_id), + 'onmouseover' => $title ? '' : 'rcube_webmail.long_subject_title_ex(this, 0)', 'title' => Q($title), ), Q($filename)); $ol .= html::tag('li', array('class' => $class, 'id' => $id), $link); diff --git a/program/steps/settings/edit_prefs.inc b/program/steps/settings/edit_prefs.inc index 468e4994d..adf6b1623 100644 --- a/program/steps/settings/edit_prefs.inc +++ b/program/steps/settings/edit_prefs.inc @@ -40,24 +40,21 @@ function rcmail_user_prefs_form($attrib) $out = $form_start; - foreach ($SECTIONS[$CURR_SECTION]['blocks'] as $block) { + foreach ($SECTIONS[$CURR_SECTION]['blocks'] as $class => $block) { if (!empty($block['options'])) { $table = new html_table(array('cols' => 2)); foreach ($block['options'] as $option) { - if ($option['advanced']) - $table->set_row_attribs('advanced'); - if (isset($option['title'])) { $table->add('title', $option['title']); - $table->add(null, $option['content']); + $table->add(null, $option['content']); } else { $table->add(array('colspan' => 2), $option['content']); } } - $out .= html::tag('fieldset', null, html::tag('legend', null, $block['name']) . $table->show($attrib)); + $out .= html::tag('fieldset', $class, html::tag('legend', null, $block['name']) . $table->show($attrib)); } else if (!empty($block['content'])) { $out .= html::tag('fieldset', null, html::tag('legend', null, $block['name']) . $block['content']); diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index fdc07be9e..53c98eddf 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -158,6 +158,7 @@ function rcmail_user_prefs($current = null) 'main' => array('name' => Q(rcube_label('mainoptions'))), 'skin' => array('name' => Q(rcube_label('skin'))), 'browser' => array('name' => Q(rcube_label('browseroptions'))), + 'advanced'=> array('name' => Q(rcube_label('advancedoptions'))), ); // language selection @@ -367,6 +368,7 @@ function rcmail_user_prefs($current = null) $blocks = array( 'main' => array('name' => Q(rcube_label('mainoptions'))), 'new_message' => array('name' => Q(rcube_label('newmessage'))), + 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), ); // show config parameter for preview pane @@ -488,6 +490,7 @@ function rcmail_user_prefs($current = null) case 'mailview': $blocks = array( 'main' => array('name' => Q(rcube_label('mainoptions'))), + 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), ); // show checkbox to open message view in new window @@ -543,7 +546,7 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_default_charset'; - $blocks['main']['options']['default_charset'] = array( + $blocks['advanced']['options']['default_charset'] = array( 'title' => html::label($field_id, Q(rcube_label('defaultcharset'))), 'content' => $RCMAIL->output->charset_selector(array( 'id' => $field_id, 'name' => '_default_charset', 'selected' => $config['default_charset'] @@ -605,6 +608,7 @@ function rcmail_user_prefs($current = null) 'main' => array('name' => Q(rcube_label('mainoptions'))), 'sig' => array('name' => Q(rcube_label('signatureoptions'))), 'spellcheck' => array('name' => Q(rcube_label('spellcheckoptions'))), + 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), ); // show checkbox to compose messages in a new window @@ -673,8 +677,7 @@ function rcmail_user_prefs($current = null) $select->add(rcube_label('miscfolding'), 1); $select->add(rcube_label('2047folding'), 2); - $blocks['main']['options']['mime_param_folding'] = array( - 'advanced' => true, + $blocks['advanced']['options']['mime_param_folding'] = array( 'title' => html::label($field_id, Q(rcube_label('mimeparamfolding'))), 'content' => $select->show($config['mime_param_folding']), ); @@ -688,8 +691,7 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_force_7bit'; $input = new html_checkbox(array('name' => '_force_7bit', 'id' => $field_id, 'value' => 1)); - $blocks['main']['options']['force_7bit'] = array( - 'advanced' => true, + $blocks['advanced']['options']['force_7bit'] = array( 'title' => html::label($field_id, Q(rcube_label('force7bit'))), 'content' => $input->show($config['force_7bit']?1:0), ); @@ -842,23 +844,28 @@ function rcmail_user_prefs($current = null) continue 2; } + // Default font size + $field_id = 'rcmfd_default_font_size'; + $select_default_font_size = new html_select(array('name' => '_default_font_size', 'id' => $field_id)); + + $fontsizes = array('8pt', '10pt', '12pt', '14pt', '18pt', '24pt', '36pt'); + foreach ($fontsizes as $size) { + $select_default_font_size->add($size, $size); + } + + // Default font $field_id = 'rcmfd_default_font'; - $fonts = rcube_fontdefs(); - $selected = $config['default_font']; + $select_default_font = new html_select(array('name' => '_default_font', 'id' => $field_id)); - $select = '<select name="_default_font" id="'.$field_id.'">'; - $select .= '<option value=""' . (!$selected ? ' selected="selected"' : '') . '>---</option>'; + $fonts = rcube_fontdefs(); foreach ($fonts as $fname => $font) { - $select .= '<option value="'.$fname.'"' - . ($fname == $selected ? ' selected="selected"' : '') - . ' style=\'font-family: ' . $font . '\'>' - . Q($fname) . '</option>'; + $select_default_font->add($fname, $fname); } - $select .= '</select>'; $blocks['main']['options']['default_font'] = array( 'title' => html::label($field_id, Q(rcube_label('defaultfont'))), - 'content' => $select + 'content' => $select_default_font->show($RCMAIL->config->get('default_font', 1)) . + $select_default_font_size->show($RCMAIL->config->get('default_font_size', 1)) ); } break; @@ -866,7 +873,8 @@ function rcmail_user_prefs($current = null) // Addressbook config case 'addressbook': $blocks = array( - 'main' => array('name' => Q(rcube_label('mainoptions'))), + 'main' => array('name' => Q(rcube_label('mainoptions'))), + 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), ); if (!isset($no_override['default_addressbook']) @@ -962,7 +970,8 @@ function rcmail_user_prefs($current = null) // Special IMAP folders case 'folders': $blocks = array( - 'main' => array('name' => Q(rcube_label('mainoptions'))), + 'main' => array('name' => Q(rcube_label('mainoptions'))), + 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), ); if (!isset($no_override['show_real_foldernames'])) { @@ -1043,6 +1052,7 @@ function rcmail_user_prefs($current = null) $blocks = array( 'main' => array('name' => Q(rcube_label('mainoptions'))), 'maintenance' => array('name' => Q(rcube_label('maintenance'))), + 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), ); if (!isset($no_override['read_when_deleted'])) { diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index 3e8b1d17e..717c7ad8c 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -89,6 +89,7 @@ switch ($CURR_SECTION) 'reply_mode' => isset($_POST['_reply_mode']) ? intval($_POST['_reply_mode']) : 0, 'strip_existing_sig' => isset($_POST['_strip_existing_sig']), 'default_font' => get_input_value('_default_font', RCUBE_INPUT_POST), + 'default_font_size' => get_input_value('_default_font_size', RCUBE_INPUT_POST), 'forward_attachment' => !empty($_POST['_forward_attachment']), ); |