Changeset 50f56d2 in github
- Timestamp:
- Nov 2, 2009 3:31:29 AM (4 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 31ddb5e
- Parents:
- 5852de64
- Files:
-
- 9 edited
-
CHANGELOG (modified) (1 diff)
-
config/main.inc.php.dist (modified) (1 diff)
-
program/js/app.js (modified) (4 diffs)
-
program/localization/en_US/labels.inc (modified) (1 diff)
-
program/localization/pl_PL/labels.inc (modified) (1 diff)
-
program/steps/mail/compose.inc (modified) (5 diffs)
-
program/steps/settings/func.inc (modified) (1 diff)
-
program/steps/settings/save_prefs.inc (modified) (1 diff)
-
skins/default/templates/compose.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
rac67db1 r50f56d2 2 2 =========================== 3 3 4 - Allow inserting signatures above replied message body (#1484272) 4 5 - Managesieve 2.0: multi-script support 5 6 - Fix imap_auth_type regression (#1486263) -
config/main.inc.php.dist
rf5d61d84 r50f56d2 451 451 $rcmail_config['index_sort'] = TRUE; 452 452 453 // When replying place cursor above original message (top posting) 454 $rcmail_config['top_posting'] = FALSE; 455 456 // Show signature: 457 // 0 - Always 458 // 1 - Never 459 // 2 - New messages only 460 // 3 - Forwards, Edits and Replies only 461 $rcmail_config['show_sig'] = 0; 462 453 463 // end of config file 454 464 ?> -
program/js/app.js
r06e0757 r50f56d2 473 473 this.init_address_input_events($("[name='_cc']")); 474 474 this.init_address_input_events($("[name='_bcc']")); 475 476 if (!html_mode) 477 this.set_caret_pos(input_message, this.env.top_posting ? 0 : $(input_message).val().length); 475 478 476 479 // add signature according to selected identity … … 973 976 break; 974 977 978 case 'insert-sig': 979 this.change_identity($("[name='_from']")[0], true); 980 break; 981 975 982 case 'add-attachment': 976 983 this.show_attachment_form(true); … … 2296 2303 }; 2297 2304 2298 this.change_identity = function(obj )2305 this.change_identity = function(obj, show_sig) 2299 2306 { 2300 2307 if (!obj || !obj.options) 2301 2308 return false; 2302 2309 2310 if (!show_sig) 2311 show_sig = this.env.show_sig; 2312 2303 2313 var id = obj.options[obj.selectedIndex].value; 2304 var input_message = $("[name='_message']");2305 var message = input_message.val();2306 2314 var is_html = ($("input[name='_is_html']").val() == '1'); 2307 var sig, p, len; 2315 var sig; 2316 2317 // enable manual signature insert 2318 if (this.env.signatures && this.env.signatures[id]) 2319 this.enable_command('insert-sig', true); 2320 else { 2321 this.enable_command('insert-sig', false); 2322 if (!this.env.signatures) 2323 return true; 2324 } 2308 2325 2309 2326 if (!this.env.identity) 2310 2327 this.env.identity = id 2328 2329 if (!show_sig) 2330 return false; 2311 2331 2312 2332 if (!is_html) 2313 2333 { 2334 var input_message = $("[name='_message']"); 2335 var message = input_message.val(); 2336 var pos, cursor_pos, p = -1; 2337 2314 2338 // remove the 'old' signature 2315 if (this.env.identity && this.env.signatures && this.env.signatures[this.env.identity])2339 if (this.env.identity && this.env.signatures[this.env.identity]) 2316 2340 { 2317 2341 if (this.env.signatures[this.env.identity]['is_html']) … … 2319 2343 else 2320 2344 sig = this.env.signatures[this.env.identity]['text']; 2345 2346 if (this.env.top_posting) 2347 p = message.indexOf(sig); 2348 else { 2349 if (sig.indexOf('-- ')!=0) 2350 sig = '-- \n'+sig; 2351 p = message.lastIndexOf(sig); 2352 } 2353 2354 if (p>=0) 2355 message = message.substring(0, p) + message.substring(p+sig.length, message.length); 2356 } 2357 2358 input_message.get(0).focus(); 2359 2360 // add the new signature string 2361 if (this.env.signatures[id]) 2362 { 2363 if (this.env.signatures[id]['is_html']) 2364 sig = this.env.signatures[id]['plain_text']; 2365 else 2366 sig = this.env.signatures[id]['text']; 2367 2368 if (this.env.top_posting) { 2369 if (p>=0) { // in place of removed signature 2370 message = message.substring(0, p) + sig + message.substring(p, message.length); 2371 cursor_pos = p - 1; 2372 } 2373 else if (pos = this.get_caret_pos(input_message.get(0))) { // at cursor position 2374 message = message.substring(0, pos) + '\n' + sig + '\n' + message.substring(pos, message.length); 2375 cursor_pos = pos; 2376 } 2377 else { // on top 2378 cursor_pos = 0; 2379 message = '\n\n' + sig + '\n' + message; 2380 } 2381 } 2382 else { 2383 message = message.replace(/[\r\n]+$/, ''); 2384 2385 if (sig.indexOf('-- ')!=0) 2386 sig = '-- \n'+sig; 2387 cursor_pos = message.length ? message.length+1 : 0; 2388 message += '\n\n' + sig; 2389 } 2390 } 2391 2392 input_message.val(message); 2393 2394 // move cursor before the signature 2395 if (typeof(cursor_pos) != 'undefined') 2396 this.set_caret_pos(input_message.get(0), cursor_pos); 2397 } 2398 // html 2399 else 2400 { 2401 var editor = tinyMCE.get(this.env.composebody); 2402 var sigElem = editor.dom.get('_rc_sig'); 2403 2404 // Append the signature as a div within the body 2405 if (!sigElem) { 2406 var body = editor.getBody(); 2407 var doc = editor.getDoc(); 2321 2408 2322 if (sig.indexOf('-- ')!=0) 2323 sig = '-- \n'+sig; 2324 2325 p = message.lastIndexOf(sig); 2326 if (p>=0) 2327 message = message.substring(0, p-1) + message.substring(p+sig.length, message.length); 2328 } 2329 2330 message = message.replace(/[\r\n]+$/, ''); 2331 len = message.length; 2332 2333 // add the new signature string 2334 if (this.env.signatures && this.env.signatures[id]) 2409 sigElem = doc.createElement('div'); 2410 sigElem.setAttribute('id', '_rc_sig'); 2411 2412 if (this.env.top_posting) { 2413 // if no existing sig and top posting then insert at caret pos 2414 editor.getWin().focus(); // correct focus in IE 2415 2416 var node = editor.selection.getNode(); 2417 2418 if (node.nodeName == 'BODY') { 2419 // no real focus, insert at start 2420 body.insertBefore(sigElem, body.firstChild); 2421 body.insertBefore(doc.createElement('br'), body.firstChild); 2422 } 2423 else { 2424 body.insertBefore(sigElem, node.nextSibling); 2425 body.insertBefore(doc.createElement('br'), node.nextSibling); 2426 } 2427 } 2428 else { 2429 if (bw.ie) 2430 // add empty line before signature on IE 2431 body.appendChild(doc.createElement('br')); 2432 2433 body.appendChild(sigElem); 2434 } 2435 } 2436 2437 if (this.env.signatures[id]) 2335 2438 { 2336 sig = this.env.signatures[id]['text']; 2337 if (this.env.signatures[id]['is_html']) 2338 { 2339 sig = this.env.signatures[id]['plain_text']; 2439 if (this.env.signatures[id]['is_html']) { 2440 sig = this.env.signatures[id]['text']; 2441 if (!this.env.top_posting && this.env.signatures[id]['plain_text'].indexOf('-- ')!=0) 2442 sig = '-- <br />' + sig; 2443 } 2444 else { 2445 sig = this.env.signatures[id]['text']; 2446 if (!this.env.top_posting && sig.indexOf('-- ')!=0) 2447 sig = '-- \n' + sig; 2448 sig = '<pre>' + sig + '</pre>'; 2340 2449 } 2341 if (sig.indexOf('-- ')!=0) 2342 sig = '-- \n'+sig; 2343 message += '\n\n'+sig; 2344 if (len) len += 1; 2345 } 2346 } 2347 else 2348 { 2349 var editor = tinyMCE.get(this.env.composebody); 2350 2351 if (this.env.signatures) 2352 { 2353 // Append the signature as a div within the body 2354 var sigElem = editor.dom.get('_rc_sig'); 2355 var newsig = ''; 2356 var htmlsig = true; 2357 2358 if (!sigElem) 2359 { 2360 // add empty line before signature on IE 2361 if (bw.ie) 2362 editor.getBody().appendChild(editor.getDoc().createElement('br')); 2363 2364 sigElem = editor.getDoc().createElement('div'); 2365 sigElem.setAttribute('id', '_rc_sig'); 2366 editor.getBody().appendChild(sigElem); 2367 } 2368 2369 if (this.env.signatures[id]) 2370 { 2371 newsig = this.env.signatures[id]['text']; 2372 htmlsig = this.env.signatures[id]['is_html']; 2373 2374 if (newsig) { 2375 if (htmlsig && this.env.signatures[id]['plain_text'].indexOf('-- ')!=0) 2376 newsig = '<p>-- </p>' + newsig; 2377 else if (!htmlsig && newsig.indexOf('-- ')!=0) 2378 newsig = '-- \n' + newsig; 2379 } 2380 } 2381 2382 if (htmlsig) 2383 sigElem.innerHTML = newsig; 2384 else 2385 sigElem.innerHTML = '<pre>' + newsig + '</pre>'; 2386 } 2387 } 2388 2389 input_message.val(message); 2390 2391 // move cursor before the signature 2392 if (!is_html) 2393 this.set_caret_pos(input_message.get(0), len); 2450 2451 sigElem.innerHTML = sig; 2452 } 2453 } 2394 2454 2395 2455 this.env.identity = id; -
program/localization/en_US/labels.inc
r1cead0c r50f56d2 308 308 $labels['displaynext'] = 'After message delete/move display the next message'; 309 309 $labels['indexsort'] = 'Use message index for sorting by date'; 310 $labels['top_posting'] = 'Start reply on top of the replied message body (not recommended)'; 311 $labels['auto_add_sig'] = 'Automatically add signature'; 312 $labels['new_msg_only'] = 'new messages only'; 313 $labels['reply_forward_only'] = 'edits, replies and forwards only'; 314 $labels['insertsig'] = 'Insert signature'; 310 315 $labels['mainoptions'] = 'Main Options'; 311 316 $labels['section'] = 'Section'; -
program/localization/pl_PL/labels.inc
r1cead0c r50f56d2 318 318 $labels['newmessage'] = 'Nowa wiadomoÅÄ'; 319 319 $labels['listoptions'] = 'Opcje list'; 320 $labels['top_posting'] = 'Odpowiadaj powyÅŒej treÅci wiadomoÅci (niezalecane)'; 321 $labels['auto_add_sig'] = 'Automatycznie wstaw podpis'; 322 $labels['new_msg_only'] = 'tylko nowe wiadomoÅci'; 323 $labels['reply_forward_only'] = 'tylko dla edycji, przekazywania i odpowiedzi'; 324 $labels['insertsig'] = 'Wstaw podpis'; 320 325 321 326 ?> -
program/steps/mail/compose.inc
r01ffe03 r50f56d2 104 104 // set current mailbox in client environment 105 105 $OUTPUT->set_env('mailbox', $IMAP->get_mailbox_name()); 106 $OUTPUT->set_env('top_posting', $CONFIG['top_posting']); 106 107 107 108 // get reference message and set compose mode … … 116 117 $compose_mode = RCUBE_COMPOSE_DRAFT; 117 118 } 119 120 if (!$CONFIG['show_sig']) 121 $OUTPUT->set_env('show_sig', true); 122 else if ($CONFIG['show_sig'] == 2 && empty($compose_mode)) 123 $OUTPUT->set_env('show_sig', true); 124 else if ($CONFIG['show_sig'] == 3 && ($compose_mode == RCUBE_COMPOSE_REPLY || $compose_mode == RCUBE_COMPOSE_FORWARD)) 125 $OUTPUT->set_env('show_sig', true); 118 126 119 127 if (!empty($msg_uid)) … … 511 519 function rcmail_create_reply_body($body, $bodyIsHtml) 512 520 { 513 global $IMAP, $MESSAGE, $OUTPUT; 521 global $MESSAGE; 522 523 $rcmail = rcmail::get_instance(); 514 524 515 525 if (! $bodyIsHtml) 516 526 { 517 527 // try to remove the signature 518 if ( ($sp = strrpos($body, '-- ')) !== false && ($sp == 0 || $body{$sp-1} == "\n"))528 if (!$rcmail->config->get('top_posting') && ($sp = strrpos($body, '-- ')) !== false && ($sp == 0 || $body{$sp-1} == "\n")) 519 529 { 520 530 if ($body{$sp+3}==' ' || $body{$sp+3}=="\n" || $body{$sp+3}=="\r") … … 548 558 549 559 $suffix = ''; 560 561 if ($rcmail->config->get('top_posting')) 562 $prefix = "\n\n\n" . $prefix; 550 563 } 551 564 else … … 561 574 $prefix = sprintf("On %s, %s wrote:<br />\n", 562 575 $MESSAGE->headers->date, 563 htmlspecialchars(Q($MESSAGE->get_header('from'), 'replace'), ENT_COMPAT, $ OUTPUT->get_charset()));576 htmlspecialchars(Q($MESSAGE->get_header('from'), 'replace'), ENT_COMPAT, $rcmail->output->get_charset())); 564 577 $prefix .= '<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%">'; 565 $suffix = "</blockquote><p></p>"; 578 579 if ($rcmail->config->get('top_posting')) { 580 $prefix = "<p></p>" . $prefix; 581 $suffix = "</blockquote>"; 582 } 583 else { 584 $suffix = "</blockquote><p></p>"; 585 } 566 586 } 567 587 -
program/steps/settings/func.inc
r49771b1 r50f56d2 449 449 ); 450 450 } 451 452 if (!isset($no_override['top_posting'])) { 453 $field_id = 'rcmfd_top_posting'; 454 $input_topposting = new html_checkbox(array('name' => '_top_posting', 'id' => $field_id, 'value' => 1)); 455 456 $blocks['main']['options']['top_posting'] = array( 457 'title' => html::label($field_id, Q(rcube_label('top_posting'))), 458 'content' => $input_topposting->show($config['top_posting']?1:0), 459 ); 460 } 461 462 if (!isset($no_override['show_sig'])) { 463 $field_id = 'rcmfd_show_sig'; 464 $select_show_sig = new html_select(array('name' => '_show_sig', 'id' => $field_id)); 465 $select_show_sig->add(rcube_label('always'), 0); 466 $select_show_sig->add(rcube_label('never'), 1); 467 $select_show_sig->add(rcube_label('new_msg_only'), 2); 468 $select_show_sig->add(rcube_label('reply_forward_only'), 3); 469 470 $blocks['main']['options']['show_sig'] = array( 471 'title' => html::label($field_id, Q(rcube_label('auto_add_sig'))), 472 'content' => $select_show_sig->show(intval($config['show_sig'])), 473 ); 474 } 451 475 452 476 break; -
program/steps/settings/save_prefs.inc
r1cead0c r50f56d2 63 63 'draft_autosave' => isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0, 64 64 'mime_param_folding' => isset($_POST['_mime_param_folding']) ? intval($_POST['_mime_param_folding']) : 0, 65 'show_sig' => isset($_POST['_show_sig']) ? intval($_POST['_show_sig']) : 0, 66 'top_posting' => isset($_POST['_top_posting']) ? TRUE : FALSE, 65 67 ); 66 68 -
skins/default/templates/compose.html
r09915f1 r50f56d2 21 21 <roundcube:button command="spellcheck" type="link" class="buttonPas spellcheck" classAct="button spellcheck" classSel="button spellcheckSel" title="checkspelling" content=" " /> 22 22 <roundcube:button command="add-attachment" type="link" class="buttonPas attach" classAct="button attach" classSel="button attachSel" title="addattachment" content=" " /> 23 <roundcube:button command="insert-sig" type="link" class="buttonPas insertsig" classAct="button insertsig" classSel="button insertsigSel" title="insertsig" content=" " /> 23 24 <roundcube:button command="savedraft" type="link" class="buttonPas savedraft" classAct="button savedraft" classSel="button savedraftSel" title="savemessage" content=" " /> 24 25 <roundcube:container name="toolbar" id="compose-toolbar" />
Note: See TracChangeset
for help on using the changeset viewer.
