Index: /branches/2.2/expressoMail1_2/js/main.js
===================================================================
--- /branches/2.2/expressoMail1_2/js/main.js (revision 3032)
+++ /branches/2.2/expressoMail1_2/js/main.js (revision 3035)
@@ -8,21 +8,21 @@
if (!is_ie)
Element('tableDivAppbox').width = '100%';
-
+
var save_contacts = function(data){
contacts = data;
- if (preferences.use_local_messages == 1 && window.google && google.gears)
- if (expresso_local_messages.is_offline_installed())
+ if (preferences.use_local_messages == 1 && window.google && google.gears)
+ if (expresso_local_messages.is_offline_installed())
expresso_local_messages.capt_url('controller.php?action=$this.db_functions.get_dropdown_contacts_to_cache');
}
var save_preferences = function(data){
-
+
preferences = data;
if(preferences.hide_folders == "1")
Element('divAppboxHeader').innerHTML = title_app_menu;
-
+
if (preferences.delete_trash_messages_after_n_days != 0)
cExecute ("$this.imap_functions.automatic_trash_cleanness&before_date="+preferences.delete_trash_messages_after_n_days+"&cyrus_delimiter="+cyrus_delimiter, handler_automatic_trash_cleanness);
-
+
if(preferences.outoffice == "1")
write_msg(get_lang("Attention, you are in out of office mode."), true);
@@ -38,5 +38,5 @@
}
}
-
+
ConstructMenuTools();
@@ -51,14 +51,14 @@
}
- // Insere a applet de criptografia
- if (preferences.use_signature_digital_cripto == '1'){
- loadApplet();
- }
- // Fim da inserção da applet
+ // Insere a applet de criptografia
+ if (preferences.use_signature_digital_cripto == '1'){
+ loadApplet();
+ }
+ // Fim da inserção da applet
cExecute ("$this.db_functions.get_dropdown_contacts", save_contacts); //Save contacts needs preferences.
cExecute ("$this.imap_functions.get_folders_list&onload=true", update_menu);
cExecute ("$this.imap_functions.get_range_msgs2&folder=INBOX&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type=SORTARRIVAL&search_box_type=ALL&sort_box_reverse=1", handler_draw_box);
-
+
}
var handler_automatic_trash_cleanness = function(data){
@@ -67,8 +67,8 @@
}
}
-
+
// Versão
Element('divAppboxHeader').innerHTML = title_app;
-
+
// Get cyrus delimiter
cyrus_delimiter = Element('cyrus_delimiter').value;
@@ -81,5 +81,5 @@
function init_offline(){
if (account_id != null) {
- if (!is_ie)
+ if (!is_ie)
Element('tableDivAppbox').width = '100%';
else
@@ -92,16 +92,16 @@
'
' +
'';
-
+
ConstructMenuTools();
draw_tree_folders();
-
+
proxy_mensagens.messages_list('local_Inbox', 1, preferences.max_email_per_page, 'SORTARRIVAL', null, 1,1,1, function handler(data){
draw_box(data, 'local_Inbox');
})
-
+
// Get cyrus delimiter
cyrus_delimiter = Element('cyrus_delimiter').value;
-
+
cExecute ("$this.db_functions.get_dropdown_contacts_to_cache", function(data) {contacts = data;});
//cExecute ("$this.functions.get_preferences", save_preferences);
@@ -115,66 +115,59 @@
function loadApplet(){
- var search_div = Element('search_div');
- var applet = null;
- if (navigator.userAgent.match('MSIE')){
- applet = document.createElement('');
-
- //applet = document.createElement('object');
- //var attributes = {
- // style:'display:yes;width:0;height:0;vertical-align:bottom;',
- // id:'cert_applet',
- // classid:'clsid:8AD9C840-044E-11D1-B3E9-00805F499D93'
- //}
-
- var parameters = {
- type:'application/x-java-applet;version=1.5',
- code:'ExpressoSmimeApplet',
- codebase:'/security/',
- mayscript:'true',
- token: token_param,
- locale: locale,
- archive:'ExpressoCertMail.jar,' +
- 'ExpressoCert.jar,' +
- 'bcmail-jdk15-142.jar,' +
- 'mail.jar,' +
- 'activation.jar,' +
- 'bcprov-jdk15-142.jar,' +
- 'commons-codec-1.3.jar,' +
- 'commons-httpclient-3.1.jar,' +
- 'commons-logging-1.1.1.jar'
- //debug:'true'
- }
-
- //for (var attribute in attributes){
- // applet.setAttribute(attribute, attributes[attribute]);
- //}
-
- if (parameters != 'undefined' && parameters != null){
- for (var parameter in parameters) {
- var param = document.createElement("PARAM");
- param.setAttribute("name",parameter);
- param.setAttribute("value",parameters[parameter]);
- applet.appendChild(param);
- }
- }
- search_div.appendChild(applet);
- //alert(search_div.innerHTML);
- //alert(window.);
- }
- else {
- applet = document.createElement('embed');
- applet.innerHTML = ' ';
- search_div.appendChild(applet);
- }
+ var search_div = Element('search_div');
+ var applet = null;
+ if (navigator.userAgent.match('MSIE')){
+ applet = document.createElement('');
+
+ var parameters = {
+ type:'application/x-java-applet;version=1.5',
+ code:'ExpressoSmimeApplet',
+ codebase:'/security/',
+ mayscript:'true',
+ token: token_param,
+ locale: locale,
+ archive:'ExpressoCertMail.jar,' +
+ 'ExpressoCert.jar,' +
+ 'bcmail-jdk15-142.jar,' +
+ 'mail.jar,' +
+ 'activation.jar,' +
+ 'bcprov-jdk15-142.jar,' +
+ 'commons-codec-1.3.jar,' +
+ 'commons-httpclient-3.1.jar,' +
+ 'commons-logging-1.1.1.jar'
+ //debug:'true'
+ }
+
+ //for (var attribute in attributes){
+ // applet.setAttribute(attribute, attributes[attribute]);
+ //}
+
+ if (parameters != 'undefined' && parameters != null){
+ for (var parameter in parameters) {
+ var param = document.createElement("PARAM");
+ param.setAttribute("name",parameter);
+ param.setAttribute("value",parameters[parameter]);
+ applet.appendChild(param);
+ }
+ }
+ search_div.appendChild(applet);
+ //alert(search_div.innerHTML);
+ //alert(window.);
+ }
+ else {
+ applet = document.createElement('embed');
+ applet.innerHTML = ' ';
+ search_div.appendChild(applet);
+ }
}
@@ -207,5 +200,5 @@
{
if (document.getElementById('border_id_'+border_id))
- {
+ {
function keypress_handler ()
{
@@ -215,5 +208,5 @@
save_link.className = 'message_options';
};
-
+
var obj = document.getElementById('body_'+border_id).contentWindow.document;
if ( obj.addEventListener )
@@ -221,5 +214,5 @@
else if ( obj.attachEvent )
obj.attachEvent('onkeypress', keypress_handler);
-
+
var subject_obj = document.getElementById('subject_'+border_id);
if ( subject_obj.addEventListener )
@@ -227,5 +220,5 @@
else if ( subject_obj.attachEvent )
subject_obj.attachEvent('onkeypress', keypress_handler);
-
+
var to_obj = document.getElementById('to_'+border_id);
if ( to_obj.addEventListener )
@@ -233,20 +226,20 @@
else if ( to_obj.attachEvent )
to_obj.attachEvent('onkeypress', keypress_handler);
-
+
}
}
function show_msg_img(msg_number,folder){
- var call_back = function(data){
- data.showImg = true;
- if (!Element(data.msg_number)){
- trElement = document.createElement('DIV');
- trElement.id = data.msg_number;
- Element("tbody_box").appendChild(trElement);
- }
- show_msg(data);
- }
-
- proxy_mensagens.msg_img(msg_number,folder,call_back);
+ var call_back = function(data){
+ data.showImg = true;
+ if (!Element(data.msg_number)){
+ trElement = document.createElement('DIV');
+ trElement.id = data.msg_number;
+ Element("tbody_box").appendChild(trElement);
+ }
+ show_msg(data);
+ }
+
+ proxy_mensagens.msg_img(msg_number,folder,call_back);
}
@@ -257,5 +250,5 @@
if (typeof(msg_info) != 'object')
alert(get_lang("Error in show_msg param is not object"));
-
+
if (msg_info.status_get_msg_info == 'false')
{
@@ -263,5 +256,5 @@
return;
}
-
+
var handler_sendNotification = function(data){
if (data)
@@ -270,29 +263,29 @@
write_msg(get_lang("Error in SMTP sending read confirmation."));
}
-
+
if(msg_info.source)
{
- // Abrindo um e-mail criptografado
- // Verifica se existe o objeto applet
- if (!Element('cert_applet')){
- // se não existir, mostra mensagem de erro.
- write_msg(get_lang('The preference "%1" isn\'t enabled.', get_lang('Enable digitally sign/cipher the message?')));
- } else {
- // se existir prepara os dados para serem enviados e chama a
- // operação na applet
-
- connector.showProgressBar();
-
- // if ((msg_info.DispositionNotificationTo) && ((msg_info.Unseen == 'U') || (msg_info.Recent == 'N'))){
- /* var confNotification = confirm(get_lang("The sender waits your notification of reading. Do you want to confirm this?"), "");
- if (confNotification)*/
- // cExecute ("$this.imap_functions.send_notification¬ificationto="+msg_info.DispositionNotificationTo+"&subject="+url_encode(msg_info.subject), handler_sendNotification);
- // }
-
- Element('cert_applet').doButtonClickAction('decript',
- msg_info.msg_number,
- msg_info.source,
- msg_info.msg_folder); // Passa os dados para a applet
- }
+ // Abrindo um e-mail criptografado
+ // Verifica se existe o objeto applet
+ if (!Element('cert_applet')){
+ // se não existir, mostra mensagem de erro.
+ write_msg(get_lang('The preference "%1" isn\'t enabled.', get_lang('Enable digitally sign/cipher the message?')));
+ } else {
+ // se existir prepara os dados para serem enviados e chama a
+ // operação na applet
+
+ connector.showProgressBar();
+
+ // if ((msg_info.DispositionNotificationTo) && ((msg_info.Unseen == 'U') || (msg_info.Recent == 'N'))){
+ /* var confNotification = confirm(get_lang("The sender waits your notification of reading. Do you want to confirm this?"), "");
+ if (confNotification)*/
+ // cExecute ("$this.imap_functions.send_notification¬ificationto="+msg_info.DispositionNotificationTo+"&subject="+url_encode(msg_info.subject), handler_sendNotification);
+ // }
+
+ Element('cert_applet').doButtonClickAction('decript',
+ msg_info.msg_number,
+ msg_info.source,
+ msg_info.msg_folder); // Passa os dados para a applet
+ }
return;
@@ -310,6 +303,6 @@
}
else{
- var ID = msg_info.original_ID ? msg_info.original_ID : msg_info.msg_number;
- var id_msg_read = ID+"_r";
+ var ID = msg_info.original_ID ? msg_info.original_ID : msg_info.msg_number;
+ var id_msg_read = ID+"_r";
if (preferences.use_shortcuts == '1')
@@ -320,8 +313,8 @@
delete_border(currentTab,'false');
-
+
if(Element("border_id_" + id_msg_read)) {
- alternate_border(id_msg_read);
- resizeWindow();
+ alternate_border(id_msg_read);
+ resizeWindow();
}
else {
@@ -346,11 +339,11 @@
var domains = "";
if ((msg_info.DispositionNotificationTo) && (!msg_is_read(ID) || (msg_info.Recent == 'N')))
- {
+ {
if (preferences.notification_domains != undefined && preferences.notification_domains != "")
- {
+ {
domains = preferences.notification_domains.split(',');
- }
+ }
else
- {
+ {
var confNotification = true;
}
@@ -370,10 +363,10 @@
if (!msg_is_read(ID))
{
- set_msg_as_read(ID, true);
+ set_msg_as_read(ID, true);
if (msg_info.cacheHit || (!proxy_mensagens.is_local_folder(get_current_folder()) && msg_info.original_ID))
- {
+ {
set_message_flag(ID, "seen"); // avoid caducous (lazy) data
- }
- }
+ }
+ }
}
}
@@ -396,15 +389,15 @@
if (box.childNodes.length == 0)
{
- var tr_info = document.createElement("TR");
- var td_info = document.createElement("TD");
- td_info.setAttribute("colspan", "10");
+ var tr_info = document.createElement("TR");
+ var td_info = document.createElement("TD");
+ td_info.setAttribute("colspan", "10");
td_info.setAttribute("background", "#FFF");
tr_info.setAttribute("id", "msg_info");
td_info.align = "center";
- td_info.style.padding = "25px";
- td_info.style.fontWeight = "bold";
- td_info.style.fontSize = "11pt";
+ td_info.style.padding = "25px";
+ td_info.style.fontWeight = "bold";
+ td_info.style.fontSize = "11pt";
td_info.innerHTML = get_lang("This mail box is empty");i
- tr_info.appendChild(td_info);
+ tr_info.appendChild(td_info);
box.appendChild(td_info);
}
@@ -418,15 +411,15 @@
var box = Element("tbody_box");
table_element.appendChild(box);
- if (data[0].msg_folder != current_folder) // Bad request
- return false;
+ if (data[0].msg_folder != current_folder) // Bad request
+ return false;
for (var i=0; i 0 || data.msgs_to_delete.length > 0)
- // purgeCache();
+ // purgeCache();
}
// Update Box BgColor
@@ -457,10 +450,10 @@
msg_range_end = (current_page*preferences.max_email_per_page);
msg_range_begin = (msg_range_end-(preferences.max_email_per_page)+1);
-
-
+
+
//Get element tBody.
main = Element("tbody_box");
if(!main)
- return;
+ return;
// Get all TR (messages) in tBody.
@@ -469,8 +462,8 @@
var string_msgs_in_main = '';
- var len = main_list.length;
+ var len = main_list.length;
for (var j=0; j < len; j++)
tmp += main_list[j].id + ',';
-
+
string_msgs_in_main = tmp.substring(0,(tmp.length-1));
if(!expresso_offline)
@@ -498,7 +491,7 @@
return;
}
-
+
var handler_delete_msgs = function(data){
-
+
Element('chk_box_select_all_messages').checked = false;
if (currentTab)
@@ -506,5 +499,5 @@
else
mail_msg = Element("tbody_box");
-
+
if ( preferences.use_shortcuts == '1') {
//Last msg is selected
@@ -518,5 +511,5 @@
}
}
-
+
if (show_success_msg) {
if (data.msgs_number.length == 1)
@@ -529,7 +522,7 @@
if (parseInt(preferences.delete_and_show_previous_message) && msg_to_delete) {
if (msg_to_delete.previousSibling){
- var previous_msg = msg_to_delete.previousSibling.id;
- cExecute("$this.imap_functions.get_info_msg&msg_number="+previous_msg+"&msg_folder=" + url_encode(current_folder), show_msg);
- }
+ var previous_msg = msg_to_delete.previousSibling.id;
+ cExecute("$this.imap_functions.get_info_msg&msg_number="+previous_msg+"&msg_folder=" + url_encode(current_folder), show_msg);
+ }
else
delete_border(currentTab,'false');
@@ -538,12 +531,12 @@
delete_border(currentTab,'false');
}
- for (var i=0; i 0 || id_msgs.length > 0)
- expresso_mail_sync.archive_msgs(folder,folder_dest,id_msgs);
+ expresso_mail_sync.archive_msgs(folder,folder_dest,id_msgs);
//cExecute("$this.imap_functions.get_info_msgs&folder=" + folder + "&msgs_number=" + id_msgs , handler_arquivar_mensagens);
- else
+ else
write_msg(get_lang('No selected message.'));
- /*var has_local_messages_before = expresso_local_messages.has_local_mails(); //vejo se já tinha mensagens locais
- var handler_arquivar_mensagens = function(data) {
- var sucess = true;
- var temp;
- var msgs_to_remove = new Array();
- var update_tree;
- for (var i = 0; i < data.length; i++) {
- msg_info = connector.unserialize(data[i]);
- if ( folder == 'INBOX/Lixeira/tmpMoveToLocal' ){
- msg_info.msg_folder += (Date.parse(new Date));
- }
- temp = expresso_local_messages.insert_mail(msg_info, msg_info['header'],msg_info['array_attach'],folder_dest );
- if ( Element("check_box_message_" + msg_info.msg_number) )
- Element("check_box_message_" + msg_info.msg_number).checked = false;
-
- if(!temp)
- sucess = false;
- else
- msgs_to_remove.push(msg_info.msg_number);//As mensagens arquivadas devem ser removidas, caso o usuario tenha isso configurado.
-
- if ( Element(msg_info.msg_number) )
- remove_className(Element(msg_info.msg_number), 'selected_msg');
- if ( tree_folders._selected.id.indexOf( 'local_' ) == 0 || folder.indexOf( 'INBOX/Lixeira/tmpMoveToLocal' ) == 0 )
- {
- openTab.imapBox[0] = '';
- tree_folders.getNodeById( 'local_Inbox' )._select( );
- change_folder('local_Inbox','Inbox')
- }
-
- }
-
- if (preferences.keep_archived_messages == 0) { //Remove as mensagens
- delete_msgs(folder,msgs_to_remove,'null',false,true);
- }
- update_tree=(!has_local_messages_before) && expresso_local_messages.has_local_mails();
-
- Element('chk_box_select_all_messages').checked = false;
- if(update_tree)
- ttreeBox.update_folder();
- else
- update_menu();
- if(sucess)
- write_msg(get_lang("selected messages have been archived"));
- else
- write_msg(get_lang("at least, one of selected mails is already archived, expresso tried to archive the others, check them later"));
-
- }
- if(!id_msgs)
- id_msgs = get_selected_messages();
- if (parseInt(id_msgs) > 0 || id_msgs.length > 0)
- cExecute("$this.imap_functions.get_info_msgs&folder=" + folder + "&msgs_number=" + id_msgs , handler_arquivar_mensagens);
- else
- write_msg(get_lang('No selected message.'));*/
-
+
}
@@ -875,5 +815,5 @@
if ( (check_box) && (check_box.checked) )
selected_messages += main_list[j].id + ',';
-
+
if (preferences.use_shortcuts == '1')
{
@@ -885,12 +825,12 @@
}
selected_messages = selected_messages.substring(0,(selected_messages.length-1));
-
+
if (preferences.use_shortcuts == '1')
{
selected_messages_by_shortcuts = selected_messages_by_shortcuts.substring(0,(selected_messages_by_shortcuts.length-1));
-
+
var array_selected_messages_by_shortcuts = selected_messages_by_shortcuts.split(",");
var array_selected_messages = selected_messages.split(",");
-
+
if ((array_selected_messages.length <= 1) && (array_selected_messages_by_shortcuts.length > 1))
{
@@ -898,5 +838,5 @@
}
}
-
+
if (selected_messages == '')
return false;
@@ -918,17 +858,17 @@
function new_message(type, border_ID){
- if (Element('show_img_link_'+border_ID))
- {
- show_msg_img(border_ID.match(/^\d*/)[0], Element('input_folder_'+border_ID).value);
- }
+ if (Element('show_img_link_'+border_ID))
+ {
+ show_msg_img(border_ID.match(/^\d*/)[0], Element('input_folder_'+border_ID).value);
+ }
var new_border_ID = draw_new_message(parseInt(border_ID));
if (new_border_ID == false)
- return false;
- openTab.type[new_border_ID] = tabTypes[type];
+ return false;
+ openTab.type[new_border_ID] = tabTypes[type];
// Salva a pasta da mensagem respondida ou encaminhada:
var folder_message = Element("input_folder_"+border_ID);
if(folder_message) {
- var input_current_folder = document.createElement('input');
+ var input_current_folder = document.createElement('input');
input_current_folder.id = "new_input_folder_"+border_ID;
input_current_folder.name = "input_folder";
@@ -952,15 +892,15 @@
data.to = data.to.replace(/>/gi,">");
}
- }
-
+ }
+
if (document.getElementById("to_values_" + border_ID)){
data.to_all = document.getElementById("to_values_" + border_ID).value;
- data.to_all = data.to_all.replace(/\n/gi," ");
+ data.to_all = data.to_all.replace(/\n/gi," ");
data.to_all = data.to_all.replace(/</gi,"<");
data.to_all = data.to_all.replace(/>/gi,">");
var _array_to_all = data.to_all.split(",");
- }
- }
-
+ }
+ }
+
if (document.getElementById("cc_" + border_ID)){
data.cc = document.getElementById("cc_values_" + border_ID).value;
@@ -977,9 +917,9 @@
if (document.getElementById("body_" + border_ID))
data.body = document.getElementById("body_" + border_ID).innerHTML;
-
+
if (Element('date_' + border_ID)){
data.date = Element('date_' + border_ID).innerHTML;
}
-
+
if (Element('date_day_' + border_ID)){
data.date_day = Element('date_day_' + border_ID).value;
@@ -992,16 +932,16 @@
var signature = preferences.type_signature == 'html' ? preferences.signature : preferences.signature.replace(/\n/g, "
");
switch(type){
- case "reply_without_history":
+ case "reply_without_history":
Element("to_" + new_border_ID).value = data.to;
title = "Re: " + data.subject;
- Element("subject_" + new_border_ID).value = "Re: " + data.subject;
+ Element("subject_" + new_border_ID).value = "Re: " + data.subject;
useOriginalAttachments(new_border_ID,border_ID);
var body = Element("body_" + new_border_ID);
body.contentWindow.document.open();
// Insert the signature automaticaly at message body if use_signature preference is set
- if (preferences.use_signature == "1"){
+ if (preferences.use_signature == "1"){
body.contentWindow.document.write("" + "
" + signature + "");
}
- else{
+ else{
body.contentWindow.document.write("");
}
@@ -1069,5 +1009,5 @@
data.to_all = new Array();
var j = 0;
- for(i = 0; i < _array_to_all.length; i++) {
+ for(i = 0; i < _array_to_all.length; i++) {
if(_array_to_all[i].lastIndexOf(Element("user_email").value) == "-1"){
data.to_all[j++] = _array_to_all[i];
@@ -1122,5 +1062,5 @@
data.to_all = new Array();
var j = 0;
- for(i = 0; i < _array_to_all.length; i++) {
+ for(i = 0; i < _array_to_all.length; i++) {
if(_array_to_all[i].lastIndexOf(Element("user_email").value) == "-1"){
data.to_all[j++] = _array_to_all[i];
@@ -1177,5 +1117,5 @@
msg_forward_from.type = "hidden";
msg_forward_from.value = Element("msg_number_" + border_ID).value;
- Element("content_id_" + new_border_ID).appendChild(msg_forward_from);
+ Element("content_id_" + new_border_ID).appendChild(msg_forward_from);
title = "Fw: " + data.subject;
document.getElementById("subject_" + new_border_ID).value = "Fw: " + data.subject;
@@ -1187,5 +1127,5 @@
if((attachments[i].tagName=="SPAN") || (attachments[i].tagName=="IMG") ||
((attachments[i].href.indexOf("javascript:download_local_attachment")==-1)&&(attachments[i].href.indexOf("javascript:download_attachments")==-1)))
- continue;
+ continue;
var link_attachment = document.createElement("A");
link_attachment.setAttribute("href", attachments[i].href);
@@ -1204,5 +1144,5 @@
else //To offline, you just set the url on value of a hidden input.
campo_arquivo.value = tmp;
-
+
}
else {
@@ -1245,5 +1185,5 @@
if(Element('msg_number').value) {
var _to = Element('msg_number').value;
- var reEmail = /^[A-Za-z\d_-]+(\.[A-Za-z\d_-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
+ var reEmail = /^[A-Za-z\d_-]+(\.[A-Za-z\d_-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
if(!reEmail.test(_to)){
var array_contacts = contacts.split(',');
@@ -1290,5 +1230,5 @@
data.to = data.to.replace(/>/gi,">");
title = "Edição: "+data.subject;
-
+
Element("to_" + new_border_ID).value = data.to;
if (data.cc){
@@ -1305,5 +1245,5 @@
}
Element("subject_" + new_border_ID).value = data.subject;
-
+
var divFiles = Element("divFiles_"+new_border_ID);
if (Element("attachments_" + border_ID)){
@@ -1346,7 +1286,7 @@
// IM Module Enabled
- if( window.parent.loadscript && loadscript.autoStatusIM )
+ if( window.parent.loadscript && loadscript.autoStatusIM )
{
- config_events( body.contentWindow.document, "onkeypress", loadscript.autoStatusIM );
+ config_events( body.contentWindow.document, "onkeypress", loadscript.autoStatusIM );
}
@@ -1356,5 +1296,5 @@
var save_link = document.getElementById("save_message_options"+new_border_ID);
- function auto_sav()
+ function auto_sav()
{
if (openTab.autosave_timer[new_border_ID])
@@ -1363,6 +1303,6 @@
openTab.autosave_timer[new_border_ID] = setTimeout("save_msg("+new_border_ID+")", autosave_time);
}
- config_events(body.contentWindow.document,'keypress', auto_sav);
- }
+ config_events(body.contentWindow.document,'keypress', auto_sav);
+ }
//BEGIN Tab event
@@ -1379,8 +1319,8 @@
}
// END Tab event
-
+
var offWidth = Element('border_blank').offsetWidth ? Element('border_blank').offsetWidth : Element('border_blank').clientWidth;
var resize = false;
-
+
if (offWidth < 200) {
resize = Element("border_id_" + new_border_ID).style.width;
@@ -1390,5 +1330,5 @@
title = title.substring(0,21) + "...";
}
-
+
if(resize)
title = title.substring(0, parseInt(resize)*0.08);
@@ -1441,9 +1381,9 @@
function send_message_return(data, ID){
- watch_changes_in_msg(ID);
-
- var sign = false;
+ watch_changes_in_msg(ID);
+
+ var sign = false;
var crypt = false;
- if ((preferences.use_assinar_criptografar != '0') && (preferences.use_signature_digital_cripto != '0')){
+ if ((preferences.use_assinar_criptografar != '0') && (preferences.use_signature_digital_cripto != '0')){
var checkSign = document.getElementById('return_digital_'+ID)
if (checkSign.checked){
@@ -1457,29 +1397,29 @@
}
- if (typeof(data) == 'object' && !data.success)
+ if (typeof(data) == 'object' && !data.success)
{
- connector = new cConnector();
- connector.showProgressBar();
-
- if (sign || crypt){
- var operation = '';
+ connector = new cConnector();
+ connector.showProgressBar();
+
+ if (sign || crypt){
+ var operation = '';
if (sign){
operation = 'sign';
}
else { // crypt
- //TODO: Colocar mensagem de erro, e finalizar o método.
+ //TODO: Colocar mensagem de erro, e finalizar o método.
operation = 'nop';
}
- }
-
- if (data.body){
- Element('cert_applet').doButtonClickAction(operation, ID, data.body);
- }
- else {
+ }
+
+ if (data.body){
+ Element('cert_applet').doButtonClickAction(operation, ID, data.body);
+ }
+ else {
alert(data.error);
}
return;
- }
+ }
if(data && data.success == true ){
// if send ok, set a flag as answered or forwarded
@@ -1541,9 +1481,9 @@
function appletReturn(smime, ID, operation, folder){
- if (!smime){ // Erro aconteceu ao assinar ou decifrar e-mail
- connector = new cConnector();
- connector.hideProgressBar();
- return;
- }
+ if (!smime){ // Erro aconteceu ao assinar ou decifrar e-mail
+ connector = new cConnector();
+ connector.hideProgressBar();
+ return;
+ }
if(operation=='decript')
@@ -1553,5 +1493,5 @@
if(data.msg_day == '')
{
- header=expresso_local_messages.get_msg_date(data.original_ID, proxy_mensagens.is_local_folder(get_current_folder()));
+ header=expresso_local_messages.get_msg_date(data.original_ID, proxy_mensagens.is_local_folder(get_current_folder()));
data.fulldate=header.fulldate;
@@ -1567,44 +1507,44 @@
}else
{
- ID_tmp = ID;
- // Lê a variável e chama a nova função cExecuteForm
- // Processa e envia para o servidor web
- // Faz o request do connector novamente. Talvez implementar no connector
- // para manter coerência.
-
- var handler_send_smime = function(data){
- send_message_return(data, this.ID_tmp); // this is a hack to escape quotation form connector bug
- };
-
- var textArea = document.createElement("TEXTAREA");
- textArea.style.display='none';
- textArea.id = 'smime';
- textArea.name = "smime";
- textArea.value += smime;
-
- // Lê a variável e chama a nova função cExecuteForm
- // Processa e envia para o servidor web
- // Faz o request do connector novamente. Talvez implementar no connector
- // para manter coerência.
- if (is_ie){
- var i = 0;
- while (document.forms(i).name != "form_message_"+ID){i++}
- form = document.forms(i);
- }
- else
- form = document.forms["form_message_"+ID];
-
- form.appendChild(textArea);
-
- cExecuteForm ("$this.imap_functions.send_mail", form, handler_send_smime, ID);
- }
+ ID_tmp = ID;
+ // Lê a variável e chama a nova função cExecuteForm
+ // Processa e envia para o servidor web
+ // Faz o request do connector novamente. Talvez implementar no connector
+ // para manter coerência.
+
+ var handler_send_smime = function(data){
+ send_message_return(data, this.ID_tmp); // this is a hack to escape quotation form connector bug
+ };
+
+ var textArea = document.createElement("TEXTAREA");
+ textArea.style.display='none';
+ textArea.id = 'smime';
+ textArea.name = "smime";
+ textArea.value += smime;
+
+ // Lê a variável e chama a nova função cExecuteForm
+ // Processa e envia para o servidor web
+ // Faz o request do connector novamente. Talvez implementar no connector
+ // para manter coerência.
+ if (is_ie){
+ var i = 0;
+ while (document.forms(i).name != "form_message_"+ID){i++}
+ form = document.forms(i);
+ }
+ else
+ form = document.forms["form_message_"+ID];
+
+ form.appendChild(textArea);
+
+ cExecuteForm ("$this.imap_functions.send_mail", form, handler_send_smime, ID);
+ }
}
function send_message(ID, folder, folder_name){
-
+
//limpa autosave_timer[ID]; havia conflito quando uma mensagem ia ser enviada e nesse exato momento o autosave
- //entrava em execucao (a aba de edicao da mensagem continuava aberta e a mensagem exibida era a de que a mensagem foi
- //salva na pasta Rascunhos e nao que tinha sido enviada, como deveria);
- if (preferences.auto_save_draft == 1)
+ //entrava em execucao (a aba de edicao da mensagem continuava aberta e a mensagem exibida era a de que a mensagem foi
+ //salva na pasta Rascunhos e nao que tinha sido enviada, como deveria);
+ if (preferences.auto_save_draft == 1)
{
if (openTab.autosave_timer[ID])
@@ -1620,5 +1560,5 @@
save_link.onclick = '';
save_link.className = 'message_options_inactive';
-
+
ID_tmp = ID;
@@ -1626,5 +1566,5 @@
send_message_return(data, this.ID_tmp); // this is a hack to escape quotation form connector bug
};
-
+
var textArea = document.createElement("TEXTAREA");
textArea.style.display='none';
@@ -1642,5 +1582,5 @@
msg_id.name = "msg_id";
msg_id.value = openTab.imapUid[ID];
-
+
if (is_ie){
var i = 0;
@@ -1651,16 +1591,16 @@
form = document.forms["form_message_"+ID];
- // Evita que e-mails assinados sejam enviados quando o usuário tenta enviar um e-mail
- // não assinado (desmarcou a opção) após tentar enviar um e-mail assinado que não passou
- // no teste de validação.
- var checkSign = document.getElementById('return_digital_'+ID);
- if (checkSign && !checkSign.checked){
- var smime = Element('smime');
- if (smime)
- {
- var parent = smime.parentNode;
- parent.removeChild(smime);
- }
- }
+ // Evita que e-mails assinados sejam enviados quando o usuário tenta enviar um e-mail
+ // não assinado (desmarcou a opção) após tentar enviar um e-mail assinado que não passou
+ // no teste de validação.
+ var checkSign = document.getElementById('return_digital_'+ID);
+ if (checkSign && !checkSign.checked){
+ var smime = Element('smime');
+ if (smime)
+ {
+ var parent = smime.parentNode;
+ parent.removeChild(smime);
+ }
+ }
form.appendChild(textArea);
@@ -1673,10 +1613,10 @@
return;
}
-
- if (expresso_offline) {
+
+ if (expresso_offline) {
stringEmail = Element("to_"+ID).value;
stringEmail += Element("cco_"+ID).value =='' ? "":", "+Element("cco_"+ID).value;
stringEmail += Element("cc_"+ID).value =='' ? "":", "+Element("cc_"+ID).value;
- var invalidEmail = validateEmail(stringEmail);
+ var invalidEmail = validateEmail(stringEmail);
if(Element("to_"+ID).value=="" && Element("cco_"+ID).value=="" && Element("cc_"+ID).value=="") {
write_msg(get_lang("message without receiver."));
@@ -1692,5 +1632,5 @@
handler_send_message(data_return,ID);
}
- else
+ else
cExecuteForm("$this.imap_functions.send_mail", form, handler_send_message, ID);
}
@@ -1715,5 +1655,5 @@
function return_save(data,border_id,folder_name,folder_id,message_id)
{
- Element("send_button_"+border_id).style.visibility="visible";
+ Element("send_button_"+border_id).style.visibility="visible";
var handler_delete_msg = function(data){ refresh(preferences.alert_new_msg); };
@@ -1743,5 +1683,5 @@
openTab.imapUid[border_id] = data.msg_no;
openTab.imapBox[border_id] = data.folder_id;
-
+
var newTitle = document.getElementById('subject_'+border_id).value;
if (newTitle.length > 18)
@@ -1750,5 +1690,5 @@
newTitle = get_lang("No subject");
document.getElementById('font_border_id_'+border_id).innerHTML = newTitle;
-
+
// Replace the embedded images for new uids
var mainField = document.getElementById('body_'+border_id).contentWindow;
@@ -1764,5 +1704,5 @@
var j=-1;
for (var i in images_part){
-
+
if (is_ie)
if (i == 0)
@@ -1772,5 +1712,5 @@
else
var image_number = parseInt(images_part[i].substr(9));
-
+
if (! isNaN(image_number))
{
@@ -1778,5 +1718,5 @@
{
allImgs[image_number] = true;
- j--;
+ j--;
}
content_body = content_body.replace(images_part[i],'msg_part='+j);
@@ -1784,8 +1724,8 @@
}
content_body = content_body.replace(/msg_part=-/g,'msg_part=');
-
+
mainField.document.getElementsByTagName('body').item(0).innerHTML = content_body;
- }
-
+ }
+
//Replace all files to new files
var divFiles = Element("divFiles_"+border_id);
@@ -1795,5 +1735,5 @@
if(elFiles[i].value !=""){
if (elFiles[i].type == "checkbox") {
- countCheck++;
+ countCheck++;
}
else {
@@ -1803,8 +1743,8 @@
i--;
}
-
- }
- };
-
+
+ }
+ };
+
var attach_files = connector.unserialize(data.files);
if (attach_files != null) {
@@ -1812,5 +1752,5 @@
att_index = countCheck;
for (att_index; att_index < attach_files.length; att_index++){
-
+
var link_attachment = document.createElement("A");
var fileName = attach_files[att_index].substr(0,attach_files[att_index].indexOf('_SIZE_'));
@@ -1825,5 +1765,5 @@
a_tmp[2] = fileName;
s_tmp = escape(connector.serialize(a_tmp));
-
+
var check_attachment = document.createElement("INPUT");
check_attachment.type = 'CHECKBOX';
@@ -1831,5 +1771,5 @@
check_attachment.value = s_tmp;
- divFiles.insertBefore(document.createElement("BR"),divFiles.childNodes[0]);
+ divFiles.insertBefore(document.createElement("BR"),divFiles.childNodes[0]);
divFiles.insertBefore(link_attachment,divFiles.childNodes[0]);
divFiles.insertBefore(check_attachment,divFiles.childNodes[0]);
@@ -1844,8 +1784,8 @@
{
//Update mailbox
- var tr_msg = document.getElementById(message_id);
+ var tr_msg = document.getElementById(message_id);
change_tr_properties(tr_msg, data.msg_no, data.subject);
}
-
+
}
var save_link = Element("save_message_options_"+border_id);
@@ -1854,5 +1794,5 @@
watch_changes_in_msg(border_id);
write_msg(get_lang('Your message was save as draft in folder %1.', lang_folder(folder_name)));
- }
+ }
}
@@ -1871,5 +1811,5 @@
sendButton.style.visibility="hidden";
- if (openTab.imapBox[border_id] && openTab.type[border_id] != 6 && openTab.type[border_id] != 7) //Gets the imap folder
+ if (openTab.imapBox[border_id] && openTab.type[border_id] != 6 && openTab.type[border_id] != 7) //Gets the imap folder
var folder_id = openTab.imapBox[border_id];
else
@@ -1880,5 +1820,5 @@
else
var folder_name = folder_id.substr(6);
-
+
// hack to avoid form connector bug, escapes quotation. Please see #179
tmp_border_id=border_id;
@@ -1910,5 +1850,5 @@
input_insertImg.value = withImage;
-
+
if (is_ie){
var i = 0;
@@ -1923,5 +1863,5 @@
form.appendChild(input_insertImg);
- cExecuteForm ("$this.imap_functions.save_msg", form, handler_save_msg,border_id);
+ cExecuteForm ("$this.imap_functions.save_msg", form, handler_save_msg,border_id);
}
@@ -1936,5 +1876,5 @@
}
else
- write_msg('ERROR saving your message.');
+ write_msg('ERROR saving your message.');
}
@@ -1944,5 +1884,5 @@
tmp_border_id=border_id;
tmp_folder_name=folder_name;
- var handler_save_msg = function(data){ return_saveas(data,this.tmp_border_id,this.tmp_folder_name); }
+ var handler_save_msg = function(data){ return_saveas(data,this.tmp_border_id,this.tmp_folder_name); }
var textArea = document.createElement("TEXTAREA");
textArea.style.display='none';
@@ -1952,10 +1892,10 @@
textArea.value += body.contentWindow.document.body.innerHTML;
textArea.value += '\r\n