[2] | 1 | // Tempo do auto refresh (em milisegundos) |
---|
| 2 | var time_refresh = 300000; |
---|
[320] | 3 | // tempo do auto save (em milisegundos) |
---|
| 4 | // 20000 = 20 segundos |
---|
| 5 | var autosave_time = 20000; |
---|
[271] | 6 | |
---|
[2] | 7 | function init(){ |
---|
| 8 | if (!is_ie) |
---|
| 9 | Element('tableDivAppbox').width = '100%'; |
---|
[3035] | 10 | |
---|
[2] | 11 | var save_contacts = function(data){ |
---|
| 12 | contacts = data; |
---|
[3035] | 13 | if (preferences.use_local_messages == 1 && window.google && google.gears) |
---|
| 14 | if (expresso_local_messages.is_offline_installed()) |
---|
[1982] | 15 | expresso_local_messages.capt_url('controller.php?action=$this.db_functions.get_dropdown_contacts_to_cache'); |
---|
| 16 | |
---|
[2] | 17 | } |
---|
| 18 | var save_preferences = function(data){ |
---|
[3035] | 19 | |
---|
[3405] | 20 | |
---|
[2] | 21 | preferences = data; |
---|
[3098] | 22 | current_folder="INBOX"; |
---|
[3730] | 23 | |
---|
[3417] | 24 | if( (window.google && google.gears) && !google.gears.factory.getPermission()) |
---|
[3405] | 25 | preferences.use_local_messages=0; |
---|
| 26 | |
---|
| 27 | if ((preferences.use_local_messages==1) && (!window.google || !google.gears)) { |
---|
| 28 | temp = confirm(get_lang("To use local messages you have to install google gears. Would you like to be redirected to gears installation page?")); |
---|
| 29 | if (temp) { |
---|
| 30 | location.href = "http://gears.google.com/?action=install&message="+ |
---|
| 31 | "Para utilizar o recurso de mensagens locais, instale o google gears&return=" + document.location.href; |
---|
| 32 | } |
---|
| 33 | else { |
---|
| 34 | preferences.use_local_messages=0; |
---|
| 35 | } |
---|
| 36 | } |
---|
[3730] | 37 | if (preferences.use_local_messages==1) { //O I.E 7 estava se atrapalhando caso esses loads fossem feitos após as chamadas ajax. Antes não apresentou problemas... |
---|
| 38 | connector.loadScript('mail_sync'); |
---|
| 39 | if (is_ie) |
---|
| 40 | connector.loadScript('TreeShow'); |
---|
| 41 | setTimeout('auto_archiving()', 30000); |
---|
| 42 | |
---|
| 43 | } |
---|
[3066] | 44 | 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); |
---|
| 45 | cExecute ("$this.imap_functions.get_folders_list&onload=true", update_menu); |
---|
| 46 | cExecute ("$this.db_functions.get_dropdown_contacts", save_contacts); //Save contacts needs preferences. |
---|
[2] | 47 | if(preferences.hide_folders == "1") |
---|
| 48 | Element('divAppboxHeader').innerHTML = title_app_menu; |
---|
[3035] | 49 | |
---|
[2] | 50 | if (preferences.delete_trash_messages_after_n_days != 0) |
---|
| 51 | cExecute ("$this.imap_functions.automatic_trash_cleanness&before_date="+preferences.delete_trash_messages_after_n_days+"&cyrus_delimiter="+cyrus_delimiter, handler_automatic_trash_cleanness); |
---|
[3035] | 52 | |
---|
[336] | 53 | if(preferences.outoffice == "1") |
---|
[206] | 54 | write_msg(get_lang("Attention, you are in out of office mode."), true); |
---|
[1035] | 55 | |
---|
[1615] | 56 | ConstructMenuTools(); |
---|
[3730] | 57 | |
---|
| 58 | if ( (preferences.use_local_messages==1) && (expresso_local_messages.is_offline_installed()) ) //Precisa ser feito após a renderização da caixa de emails |
---|
| 59 | check_mail_in_queue(); |
---|
| 60 | |
---|
[3035] | 61 | // Insere a applet de criptografia |
---|
| 62 | if (preferences.use_signature_digital_cripto == '1'){ |
---|
| 63 | loadApplet(); |
---|
| 64 | } |
---|
| 65 | // Fim da inserção da applet |
---|
[1035] | 66 | |
---|
[2] | 67 | } |
---|
| 68 | var handler_automatic_trash_cleanness = function(data){ |
---|
| 69 | if (data != false){ |
---|
| 70 | write_msg(data.length +' '+ Element('txt_clear_trash').value); |
---|
| 71 | } |
---|
| 72 | } |
---|
[3035] | 73 | |
---|
[2] | 74 | // Versão |
---|
| 75 | Element('divAppboxHeader').innerHTML = title_app; |
---|
[3035] | 76 | |
---|
[2] | 77 | // Get cyrus delimiter |
---|
| 78 | cyrus_delimiter = Element('cyrus_delimiter').value; |
---|
[1035] | 79 | |
---|
[51] | 80 | cExecute ("$this.functions.get_preferences", save_preferences); |
---|
[4366] | 81 | cExecute ("phpgwapi.browser.isMobile", function( data ) |
---|
| 82 | { |
---|
| 83 | mobile_device = ( ( data.constructor == Boolean ) ? data : ( data === 'true' ) ); |
---|
| 84 | } ); |
---|
[2] | 85 | setTimeout('auto_refresh()', time_refresh); |
---|
[1615] | 86 | |
---|
[2] | 87 | } |
---|
[1035] | 88 | |
---|
[1121] | 89 | function init_offline(){ |
---|
[3570] | 90 | current_folder = 'local_Inbox'; |
---|
[1121] | 91 | if (account_id != null) { |
---|
[3035] | 92 | if (!is_ie) |
---|
[1121] | 93 | Element('tableDivAppbox').width = '100%'; |
---|
| 94 | else |
---|
| 95 | connector.createXMLHTTP(); |
---|
| 96 | Element('divStatusBar').innerHTML = '<table height="16px" border=0 width=100% cellspacing=0 cellpadding=2>' + |
---|
| 97 | '<tr>' + |
---|
| 98 | '<td style="padding-left:17px" width=33% id="content_quota" align=left></td>' + |
---|
| 99 | '<td width=33% height=16px align=center nowrap><font face=Verdana, Arial, Helvetica, sans-serif color=#000066 size=2>' + |
---|
| 100 | '<b>ExpressoMail Offline</b><font size=1><b> - Versão 1.0</b></font></td>' + |
---|
| 101 | '<td width=33% id="div_menu_c3" align=right></td>' + |
---|
| 102 | '</tr></table>'; |
---|
[3035] | 103 | |
---|
[1121] | 104 | ConstructMenuTools(); |
---|
| 105 | |
---|
| 106 | draw_tree_folders(); |
---|
[3035] | 107 | |
---|
[1814] | 108 | proxy_mensagens.messages_list('local_Inbox', 1, preferences.max_email_per_page, 'SORTARRIVAL', null, 1,1,1, function handler(data){ |
---|
[1121] | 109 | draw_box(data, 'local_Inbox'); |
---|
| 110 | }) |
---|
[3035] | 111 | |
---|
[1121] | 112 | // Get cyrus delimiter |
---|
| 113 | cyrus_delimiter = Element('cyrus_delimiter').value; |
---|
[3035] | 114 | |
---|
[1939] | 115 | cExecute ("$this.db_functions.get_dropdown_contacts_to_cache", function(data) {contacts = data;}); |
---|
[1121] | 116 | //cExecute ("$this.functions.get_preferences", save_preferences); |
---|
| 117 | } |
---|
| 118 | } |
---|
[1035] | 119 | /** |
---|
| 120 | * Carrega a applet java no objeto search_div |
---|
| 121 | * @author Mário César Kolling <mario.kolling@serpro.gov.br> |
---|
| 122 | */ |
---|
| 123 | |
---|
| 124 | function loadApplet(){ |
---|
| 125 | |
---|
[3035] | 126 | var search_div = Element('search_div'); |
---|
| 127 | var applet = null; |
---|
| 128 | if (navigator.userAgent.match('MSIE')){ |
---|
| 129 | applet = document.createElement('<object style="display:yes;width:0;height:0;vertical-align:bottom;" id="cert_applet" ' + |
---|
| 130 | 'classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"></object>'); |
---|
[1035] | 131 | |
---|
[3035] | 132 | var parameters = { |
---|
| 133 | type:'application/x-java-applet;version=1.5', |
---|
| 134 | code:'ExpressoSmimeApplet', |
---|
| 135 | codebase:'/security/', |
---|
| 136 | mayscript:'true', |
---|
| 137 | token: token_param, |
---|
| 138 | locale: locale, |
---|
| 139 | archive:'ExpressoCertMail.jar,' + |
---|
| 140 | 'ExpressoCert.jar,' + |
---|
| 141 | 'bcmail-jdk15-142.jar,' + |
---|
| 142 | 'mail.jar,' + |
---|
| 143 | 'activation.jar,' + |
---|
| 144 | 'bcprov-jdk15-142.jar,' + |
---|
| 145 | 'commons-codec-1.3.jar,' + |
---|
| 146 | 'commons-httpclient-3.1.jar,' + |
---|
| 147 | 'commons-logging-1.1.1.jar' |
---|
| 148 | //debug:'true' |
---|
| 149 | } |
---|
[1035] | 150 | |
---|
[3035] | 151 | if (parameters != 'undefined' && parameters != null){ |
---|
| 152 | for (var parameter in parameters) { |
---|
| 153 | var param = document.createElement("PARAM"); |
---|
| 154 | param.setAttribute("name",parameter); |
---|
| 155 | param.setAttribute("value",parameters[parameter]); |
---|
| 156 | applet.appendChild(param); |
---|
| 157 | } |
---|
| 158 | } |
---|
| 159 | } |
---|
[3781] | 160 | else |
---|
| 161 | { |
---|
[3035] | 162 | applet = document.createElement('embed'); |
---|
| 163 | applet.innerHTML = '<embed style="display:yes;width:0;height:0;vertical-align:bottom;" id="cert_applet" code="ExpressoSmimeApplet.class" ' + |
---|
| 164 | 'codebase="/security/" locale="'+locale+'"'+ |
---|
| 165 | '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" ' + |
---|
| 166 | 'token="' + token_param + '" ' + |
---|
| 167 | 'type="application/x-java-applet;version=1.5" mayscript > ' + |
---|
| 168 | //'type="application/x-java-applet;version=1.5" debug="true" mayscript > ' + |
---|
| 169 | '<noembed> ' + |
---|
| 170 | 'No Java Support. ' + |
---|
| 171 | '</noembed> ' + |
---|
| 172 | '</embed> '; |
---|
| 173 | } |
---|
[3781] | 174 | |
---|
| 175 | if( applet != null ) |
---|
| 176 | { |
---|
| 177 | applet.style.top = "-100px"; |
---|
| 178 | applet.style.left = "-100px"; |
---|
| 179 | window.document.body.insertBefore( applet, document.body.lastChild ); |
---|
| 180 | } |
---|
| 181 | |
---|
[1035] | 182 | } |
---|
| 183 | |
---|
[689] | 184 | function disable_field(field,condition) { |
---|
| 185 | var comando = "if ("+condition+") { document.getElementById('"+field.id+"').disabled=true;} else { document.getElementById('"+field.id+"').disabled=false; }"; |
---|
| 186 | eval(comando); |
---|
| 187 | } |
---|
[613] | 188 | /* |
---|
| 189 | função que remove todos os anexos... |
---|
| 190 | */ |
---|
| 191 | function remove_all_attachments(folder,msg_num) { |
---|
[649] | 192 | |
---|
[613] | 193 | var call_back = function(data) { |
---|
[1319] | 194 | if(!data.status) { |
---|
| 195 | alert(data.msg); |
---|
| 196 | } |
---|
| 197 | else { |
---|
| 198 | msg_to_delete = Element(msg_num); |
---|
| 199 | change_tr_properties(msg_to_delete, data.msg_no); |
---|
| 200 | msg_to_delete.childNodes[1].innerHTML = ""; |
---|
| 201 | write_msg(get_lang("Attachments removed")); |
---|
| 202 | delete_border(msg_num+'_r','false'); //close email tab |
---|
| 203 | } |
---|
| 204 | }; |
---|
[613] | 205 | if (confirm(get_lang("delete all attachments confirmation"))) |
---|
[1319] | 206 | cExecute ("$this.imap_functions.remove_attachments&folder=" |
---|
| 207 | +folder+"&msg_num="+msg_num, call_back); |
---|
[613] | 208 | } |
---|
[271] | 209 | function watch_changes_in_msg(border_id) |
---|
| 210 | { |
---|
| 211 | if (document.getElementById('border_id_'+border_id)) |
---|
[3035] | 212 | { |
---|
[271] | 213 | function keypress_handler () |
---|
| 214 | { |
---|
| 215 | away=false; |
---|
[605] | 216 | var save_link = Element("save_message_options_"+border_id); |
---|
| 217 | save_link.onclick = function onclick(event) { openTab.toPreserve[border_id] = true; save_msg(border_id); } ; |
---|
[838] | 218 | save_link.className = 'message_options'; |
---|
[271] | 219 | }; |
---|
[3035] | 220 | |
---|
[271] | 221 | var obj = document.getElementById('body_'+border_id).contentWindow.document; |
---|
| 222 | if ( obj.addEventListener ) |
---|
| 223 | obj.addEventListener('keypress', keypress_handler, false); |
---|
| 224 | else if ( obj.attachEvent ) |
---|
| 225 | obj.attachEvent('onkeypress', keypress_handler); |
---|
[3035] | 226 | |
---|
[271] | 227 | var subject_obj = document.getElementById('subject_'+border_id); |
---|
| 228 | if ( subject_obj.addEventListener ) |
---|
| 229 | subject_obj.addEventListener('keypress', keypress_handler, false); |
---|
| 230 | else if ( subject_obj.attachEvent ) |
---|
| 231 | subject_obj.attachEvent('onkeypress', keypress_handler); |
---|
[3035] | 232 | |
---|
[271] | 233 | var to_obj = document.getElementById('to_'+border_id); |
---|
| 234 | if ( to_obj.addEventListener ) |
---|
| 235 | to_obj.addEventListener('keypress', keypress_handler, false); |
---|
| 236 | else if ( to_obj.attachEvent ) |
---|
| 237 | to_obj.attachEvent('onkeypress', keypress_handler); |
---|
[3035] | 238 | |
---|
[271] | 239 | } |
---|
| 240 | } |
---|
| 241 | |
---|
[1000] | 242 | function show_msg_img(msg_number,folder){ |
---|
[3035] | 243 | var call_back = function(data){ |
---|
| 244 | data.showImg = true; |
---|
| 245 | if (!Element(data.msg_number)){ |
---|
| 246 | trElement = document.createElement('DIV'); |
---|
| 247 | trElement.id = data.msg_number; |
---|
| 248 | Element("tbody_box").appendChild(trElement); |
---|
| 249 | } |
---|
| 250 | show_msg(data); |
---|
| 251 | } |
---|
[1000] | 252 | |
---|
[3035] | 253 | proxy_mensagens.msg_img(msg_number,folder,call_back); |
---|
[1000] | 254 | |
---|
[800] | 255 | } |
---|
[271] | 256 | |
---|
[827] | 257 | function show_msg(msg_info){ |
---|
[2] | 258 | if(!verify_session(msg_info)) |
---|
| 259 | return; |
---|
[800] | 260 | if (typeof(msg_info) != 'object') |
---|
| 261 | alert(get_lang("Error in show_msg param is not object")); |
---|
[3035] | 262 | |
---|
[206] | 263 | if (msg_info.status_get_msg_info == 'false') |
---|
| 264 | { |
---|
| 265 | write_msg(get_lang("Problems reading your message")+ "."); |
---|
| 266 | return; |
---|
| 267 | } |
---|
[3035] | 268 | |
---|
[2] | 269 | var handler_sendNotification = function(data){ |
---|
| 270 | if (data) |
---|
| 271 | write_msg(get_lang("A read confirmation was sent.")); |
---|
| 272 | else |
---|
| 273 | write_msg(get_lang("Error in SMTP sending read confirmation.")); |
---|
| 274 | } |
---|
[3035] | 275 | |
---|
[1035] | 276 | if(msg_info.source) |
---|
| 277 | { |
---|
[3035] | 278 | // Abrindo um e-mail criptografado |
---|
| 279 | // Verifica se existe o objeto applet |
---|
| 280 | if (!Element('cert_applet')){ |
---|
| 281 | // se não existir, mostra mensagem de erro. |
---|
| 282 | write_msg(get_lang('The preference "%1" isn\'t enabled.', get_lang('Enable digitally sign/cipher the message?'))); |
---|
| 283 | } else { |
---|
| 284 | // se existir prepara os dados para serem enviados e chama a |
---|
| 285 | // operação na applet |
---|
[847] | 286 | |
---|
[3035] | 287 | connector.showProgressBar(); |
---|
[1035] | 288 | |
---|
[3035] | 289 | // if ((msg_info.DispositionNotificationTo) && ((msg_info.Unseen == 'U') || (msg_info.Recent == 'N'))){ |
---|
| 290 | /* var confNotification = confirm(get_lang("The sender waits your notification of reading. Do you want to confirm this?"), ""); |
---|
| 291 | if (confNotification)*/ |
---|
| 292 | // cExecute ("$this.imap_functions.send_notification¬ificationto="+msg_info.DispositionNotificationTo+"&subject="+url_encode(msg_info.subject), handler_sendNotification); |
---|
| 293 | // } |
---|
[1035] | 294 | |
---|
[3035] | 295 | Element('cert_applet').doButtonClickAction('decript', |
---|
| 296 | msg_info.msg_number, |
---|
| 297 | msg_info.source, |
---|
| 298 | msg_info.msg_folder); // Passa os dados para a applet |
---|
| 299 | } |
---|
[1035] | 300 | return; |
---|
| 301 | |
---|
| 302 | } |
---|
| 303 | |
---|
| 304 | |
---|
| 305 | if (msg_info.status_get_msg_info == 'false') |
---|
| 306 | { |
---|
| 307 | write_msg(get_lang("Problems reading your message")+ "."); |
---|
| 308 | return; |
---|
| 309 | } |
---|
| 310 | |
---|
[2] | 311 | if (msg_info.status == 'false'){ |
---|
| 312 | eval(msg_info.command_to_exec); |
---|
| 313 | } |
---|
| 314 | else{ |
---|
[3035] | 315 | var ID = msg_info.original_ID ? msg_info.original_ID : msg_info.msg_number; |
---|
| 316 | var id_msg_read = ID+"_r"; |
---|
[1035] | 317 | |
---|
[139] | 318 | if (preferences.use_shortcuts == '1') |
---|
[1035] | 319 | select_msg(ID, 'null'); |
---|
[2] | 320 | // Call function to draw message |
---|
[59] | 321 | // If needed, delete old border |
---|
[605] | 322 | if (openTab.type[currentTab] == 2 || openTab.type[currentTab] == 3) |
---|
| 323 | delete_border(currentTab,'false'); |
---|
[59] | 324 | |
---|
[3035] | 325 | |
---|
[3018] | 326 | if(Element("border_id_" + id_msg_read)) { |
---|
[3035] | 327 | alternate_border(id_msg_read); |
---|
| 328 | resizeWindow(); |
---|
[3018] | 329 | } |
---|
[2] | 330 | else { |
---|
| 331 | var border_id = create_border(msg_info.subject, id_msg_read); |
---|
| 332 | if(border_id) |
---|
[827] | 333 | { |
---|
| 334 | openTab.type[border_id] = 2; |
---|
[2] | 335 | draw_message(msg_info,border_id); |
---|
[827] | 336 | var unseen_sort = document.getElementById('span_flag_UNSEEN').getAttribute('onclick'); |
---|
| 337 | unseen_sort = unseen_sort.toString(); |
---|
| 338 | if ( !(unseen_sort.indexOf("'UNSEEN' == 'UNSEEN'") < 0) ) |
---|
| 339 | { |
---|
| 340 | var sort_type = sort_box_type; |
---|
| 341 | sort_box_type = null; |
---|
| 342 | sort_box('UNSEEN', sort_type); |
---|
| 343 | } |
---|
| 344 | } |
---|
[2] | 345 | else |
---|
| 346 | return; |
---|
| 347 | } |
---|
| 348 | |
---|
[605] | 349 | var domains = ""; |
---|
[1035] | 350 | if ((msg_info.DispositionNotificationTo) && (!msg_is_read(ID) || (msg_info.Recent == 'N'))) |
---|
[3035] | 351 | { |
---|
[605] | 352 | if (preferences.notification_domains != undefined && preferences.notification_domains != "") |
---|
[3035] | 353 | { |
---|
[605] | 354 | domains = preferences.notification_domains.split(','); |
---|
[3035] | 355 | } |
---|
[605] | 356 | else |
---|
[3035] | 357 | { |
---|
[605] | 358 | var confNotification = true; |
---|
| 359 | } |
---|
| 360 | for (var i = 0; i < domains.length; i++) |
---|
| 361 | if (msg_info.DispositionNotificationTo.match(domains[i]+">")) |
---|
| 362 | { |
---|
| 363 | var confNotification = true; |
---|
| 364 | break; |
---|
| 365 | } |
---|
| 366 | if (confNotification == undefined) |
---|
| 367 | var confNotification = confirm(get_lang("The sender:\n%1\nwaits your notification of reading. Do you want to confirm this?",msg_info.DispositionNotificationTo), ""); |
---|
| 368 | |
---|
| 369 | if (confNotification) |
---|
[3231] | 370 | cExecute ("$this.imap_functions.send_notification¬ificationto="+msg_info.DispositionNotificationTo+"&date="+msg_info.udate+"&subject="+url_encode(msg_info.subject), handler_sendNotification); |
---|
[605] | 371 | } |
---|
[163] | 372 | //Change msg class to read. |
---|
[1035] | 373 | if (!msg_is_read(ID)) |
---|
[605] | 374 | { |
---|
[3035] | 375 | set_msg_as_read(ID, true); |
---|
[1035] | 376 | if (msg_info.cacheHit || (!proxy_mensagens.is_local_folder(get_current_folder()) && msg_info.original_ID)) |
---|
[3035] | 377 | { |
---|
[1035] | 378 | set_message_flag(ID, "seen"); // avoid caducous (lazy) data |
---|
[3035] | 379 | } |
---|
| 380 | } |
---|
[2] | 381 | } |
---|
| 382 | } |
---|
| 383 | |
---|
| 384 | function auto_refresh(){ |
---|
| 385 | refresh(preferences.alert_new_msg); |
---|
| 386 | setTimeout('auto_refresh()', time_refresh); |
---|
| 387 | } |
---|
| 388 | |
---|
[1518] | 389 | function auto_archiving() { |
---|
| 390 | expresso_mail_sync.start_sync(); |
---|
| 391 | setTimeout('auto_archiving()',600000); |
---|
| 392 | } |
---|
| 393 | |
---|
[2] | 394 | function refresh(alert_new_msg){ |
---|
| 395 | var handler_refresh = function(data){ |
---|
| 396 | if(!verify_session(data)) |
---|
| 397 | return; |
---|
[3955] | 398 | |
---|
[833] | 399 | var box = Element("tbody_box"); |
---|
| 400 | if (box.childNodes.length == 0) |
---|
| 401 | { |
---|
[3140] | 402 | var tr_info = document.createElement("TR"); |
---|
| 403 | var td_info = document.createElement("TD"); |
---|
| 404 | td_info.setAttribute("colspan", "10"); |
---|
[833] | 405 | td_info.setAttribute("background", "#FFF"); |
---|
[3145] | 406 | td_info.setAttribute("id","msg_info"); |
---|
| 407 | td_info.id = "msg_info"; |
---|
[833] | 408 | td_info.align = "center"; |
---|
[3140] | 409 | td_info.style.padding = "25px"; |
---|
| 410 | td_info.style.fontWeight = "bold"; |
---|
| 411 | td_info.style.fontSize = "11pt"; |
---|
| 412 | td_info.innerHTML = get_lang("This mail box is empty"); |
---|
[3035] | 413 | tr_info.appendChild(td_info); |
---|
[833] | 414 | box.appendChild(td_info); |
---|
| 415 | } |
---|
| 416 | |
---|
[2] | 417 | if (data.length > 0){ |
---|
[3145] | 418 | var msg_info = document.getElementById('msg_info'); |
---|
[3265] | 419 | if (msg_info != null) |
---|
| 420 | { |
---|
[3145] | 421 | var msg_tr = msg_info.parentNode; |
---|
| 422 | msg_tr.removeChild(msg_info); |
---|
[3265] | 423 | } |
---|
[139] | 424 | |
---|
[2] | 425 | table_element = Element("table_box"); |
---|
| 426 | var box = Element("tbody_box"); |
---|
| 427 | table_element.appendChild(box); |
---|
[3265] | 428 | |
---|
| 429 | if (data.msgs_to_delete.length > 0) |
---|
| 430 | for (var i=0; i<data.msgs_to_delete.length; i++){ |
---|
[4104] | 431 | if ( (data.msgs_to_delete[i] != undefined) && (data.msgs_to_delete[i] != "")){ |
---|
[3265] | 432 | removeAll(data.msgs_to_delete[i]); |
---|
| 433 | } |
---|
| 434 | } |
---|
| 435 | |
---|
[3035] | 436 | if (data[0].msg_folder != current_folder) // Bad request |
---|
[3140] | 437 | return false; |
---|
[3018] | 438 | |
---|
[3742] | 439 | var total_messages_element = Element('tot_m'); |
---|
| 440 | |
---|
[271] | 441 | for (var i=0; i<data.length; i++){ |
---|
[3035] | 442 | var existent = document.getElementById(data[i].msg_number); |
---|
| 443 | if (!existent) |
---|
| 444 | { |
---|
[3493] | 445 | var new_msg = this.make_tr_message(data[i], current_folder, data.offsetToGMT); |
---|
[3035] | 446 | _dragArea.makeDragged(new_msg, data[i].msg_number, data[i].subject, true); |
---|
[3955] | 447 | |
---|
| 448 | if( data[i].next_msg_number != undefined && data[i].next_msg_number != null ) |
---|
| 449 | box.insertBefore(new_msg, Element(data[i].next_msg_number)); |
---|
| 450 | else if (data[i].Recent == 'N') |
---|
[3265] | 451 | box.insertBefore(new_msg,box.firstChild); |
---|
[3742] | 452 | else |
---|
[3265] | 453 | box.appendChild(new_msg); |
---|
| 454 | |
---|
[3742] | 455 | total_messages_element.innerHTML = parseInt( total_messages_element.innerHTML ) + 1; |
---|
[3035] | 456 | } |
---|
[2] | 457 | } |
---|
[827] | 458 | |
---|
[2] | 459 | if(parseInt(alert_new_msg) && data.new_msgs > 0) |
---|
[1951] | 460 | alert(data['new_msgs'] > 1 ? get_lang("You have %1 new messages", data['new_msgs']) + "!" : get_lang("You have 1 new message") +"!"); |
---|
[3265] | 461 | build_quota(data['quota']); |
---|
[2] | 462 | } |
---|
[976] | 463 | // Update Box BgColor |
---|
| 464 | var box = Element("tbody_box"); |
---|
| 465 | if(box.childNodes.length > 1){ |
---|
| 466 | updateBoxBgColor(box.childNodes); |
---|
| 467 | } |
---|
[1443] | 468 | connector.purgeCache(); |
---|
[2] | 469 | update_menu(); |
---|
| 470 | } |
---|
| 471 | |
---|
| 472 | msg_range_end = (current_page*preferences.max_email_per_page); |
---|
| 473 | msg_range_begin = (msg_range_end-(preferences.max_email_per_page)+1); |
---|
[3035] | 474 | |
---|
| 475 | |
---|
[2] | 476 | //Get element tBody. |
---|
| 477 | main = Element("tbody_box"); |
---|
| 478 | if(!main) |
---|
[3035] | 479 | return; |
---|
[139] | 480 | |
---|
[2] | 481 | // Get all TR (messages) in tBody. |
---|
| 482 | main_list = main.childNodes; |
---|
| 483 | var tmp = ''; |
---|
| 484 | var string_msgs_in_main = ''; |
---|
[139] | 485 | |
---|
[3035] | 486 | var len = main_list.length; |
---|
[2] | 487 | for (var j=0; j < len; j++) |
---|
| 488 | tmp += main_list[j].id + ','; |
---|
[3035] | 489 | |
---|
[2] | 490 | string_msgs_in_main = tmp.substring(0,(tmp.length-1)); |
---|
[1121] | 491 | if(!expresso_offline) |
---|
| 492 | cExecute ("$this.imap_functions.refresh&folder="+current_folder+"&msgs_existent="+string_msgs_in_main+"&msg_range_begin="+msg_range_begin+"&msg_range_end="+msg_range_end+"&sort_box_type="+sort_box_type+"&search_box_type="+search_box_type+"&sort_box_reverse="+sort_box_reverse, handler_refresh); |
---|
[2] | 493 | } |
---|
| 494 | |
---|
[1000] | 495 | function delete_msgs(folder, msgs_number, border_ID, show_success_msg,archive) |
---|
[827] | 496 | { |
---|
| 497 | if (arguments.length < 4){ |
---|
| 498 | show_success_msg = true; |
---|
| 499 | } |
---|
| 500 | |
---|
[2] | 501 | if (folder == 'null') |
---|
[827] | 502 | folder = current_folder; |
---|
[2] | 503 | |
---|
[827] | 504 | if(openTab.type[currentTab] == 1) |
---|
[845] | 505 | return move_search_msgs('content_id_'+currentTab,'INBOX'+cyrus_delimiter+trashfolder,trashfolder); |
---|
[827] | 506 | |
---|
| 507 | if(currentTab.toString().indexOf("_r") != -1){ |
---|
| 508 | msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); |
---|
| 509 | } |
---|
| 510 | |
---|
[1000] | 511 | if (!archive && (parseInt(preferences.save_deleted_msg)) && (folder!='INBOX'+cyrus_delimiter+trashfolder)){ |
---|
[689] | 512 | move_msgs2(folder, msgs_number, border_ID, 'INBOX'+cyrus_delimiter+trashfolder,trashfolder,show_success_msg ); |
---|
[2] | 513 | return; |
---|
| 514 | } |
---|
[3035] | 515 | |
---|
[2] | 516 | var handler_delete_msgs = function(data){ |
---|
[3035] | 517 | |
---|
[2] | 518 | Element('chk_box_select_all_messages').checked = false; |
---|
[827] | 519 | if (currentTab) |
---|
| 520 | mail_msg = Element("tbody_box_"+currentTab); |
---|
| 521 | else |
---|
| 522 | mail_msg = Element("tbody_box"); |
---|
[3035] | 523 | |
---|
[214] | 524 | if ( preferences.use_shortcuts == '1') { |
---|
[1658] | 525 | //Last msg is selected |
---|
| 526 | if (mail_msg && exist_className(mail_msg.childNodes[mail_msg.childNodes.length-1], 'selected_shortcut_msg') ) { |
---|
[214] | 527 | select_msg('null', 'up', true); |
---|
| 528 | } |
---|
[1658] | 529 | else { |
---|
| 530 | if (!select_msg('null', 'down', true)) { |
---|
| 531 | select_msg('null', 'up', true); |
---|
| 532 | } |
---|
| 533 | } |
---|
[214] | 534 | } |
---|
[3035] | 535 | |
---|
[689] | 536 | if (show_success_msg) { |
---|
[827] | 537 | if (data.msgs_number.length == 1) |
---|
[689] | 538 | write_msg(get_lang("The message was deleted.")); |
---|
[827] | 539 | else |
---|
[689] | 540 | write_msg(get_lang("The messages were deleted.")); |
---|
| 541 | } |
---|
[827] | 542 | if (openTab.type[currentTab] > 1){ |
---|
[1658] | 543 | var msg_to_delete = Element(msgs_number); |
---|
| 544 | if (parseInt(preferences.delete_and_show_previous_message) && msg_to_delete) { |
---|
| 545 | if (msg_to_delete.previousSibling){ |
---|
[3035] | 546 | var previous_msg = msg_to_delete.previousSibling.id; |
---|
| 547 | cExecute("$this.imap_functions.get_info_msg&msg_number="+previous_msg+"&msg_folder=" + url_encode(current_folder), show_msg); |
---|
| 548 | } |
---|
[1658] | 549 | else |
---|
| 550 | delete_border(currentTab,'false'); |
---|
[827] | 551 | } |
---|
[2] | 552 | else |
---|
[827] | 553 | delete_border(currentTab,'false'); |
---|
[2] | 554 | } |
---|
[3035] | 555 | for (var i=0; i<data.msgs_number.length; i++){ |
---|
| 556 | var msg_to_delete = Element(data.msgs_number[i]); |
---|
| 557 | if (msg_to_delete){ |
---|
| 558 | removeAll(msg_to_delete.id); |
---|
| 559 | } |
---|
| 560 | } |
---|
[2] | 561 | Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) - data.msgs_number.length; |
---|
[3035] | 562 | refresh(); |
---|
[2] | 563 | } |
---|
| 564 | |
---|
| 565 | if (msgs_number == 'selected') |
---|
| 566 | msgs_number = get_selected_messages(); |
---|
| 567 | if (msgs_number.length > 0 || parseInt(msgs_number) > 0) |
---|
[1226] | 568 | cExecute ("$this.imap_functions.delete_msgs&folder="+folder+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&search_box_type="+search_box_type+"&sort_box_reverse="+sort_box_reverse, handler_delete_msgs); |
---|
[2] | 569 | else |
---|
[3035] | 570 | write_msg(get_lang('No selected message.')); |
---|
[2] | 571 | } |
---|
| 572 | |
---|
[689] | 573 | |
---|
[163] | 574 | function move_search_msgs(border_id, new_folder, new_folder_name){ |
---|
| 575 | var selected_messages = ''; |
---|
[689] | 576 | var temp_msg; |
---|
[827] | 577 | var main_list = Element("tbody_box_"+currentTab.substr(7)).childNodes; |
---|
[163] | 578 | for (j = 0; j < main_list.length; j++) { |
---|
[3035] | 579 | var check_box = main_list[j].firstChild.firstChild; |
---|
[163] | 580 | if(check_box && check_box.checked) { |
---|
[845] | 581 | if (proxy_mensagens.is_local_folder(main_list[j].getAttribute('name'))) { |
---|
[689] | 582 | alert(get_lang("You cant manipulate local messages on search")); |
---|
| 583 | return; |
---|
| 584 | } |
---|
[163] | 585 | selected_messages += main_list[j].id + ','; |
---|
| 586 | } |
---|
| 587 | } |
---|
| 588 | selected_messages = selected_messages.substring(0,(selected_messages.length-1)); |
---|
| 589 | var handler_move_search_msgs = function(data){ |
---|
| 590 | if(!data || !data.msgs_number) |
---|
| 591 | return; |
---|
[3035] | 592 | else if(data.deleted) { |
---|
[163] | 593 | if (data.msgs_number.length == 1) |
---|
| 594 | write_msg(get_lang("The message was deleted.")); |
---|
| 595 | else |
---|
[3035] | 596 | write_msg(get_lang("The messages were deleted.")); |
---|
[163] | 597 | } |
---|
| 598 | else{ |
---|
| 599 | if (data.msgs_number.length == 1) |
---|
| 600 | write_msg(get_lang("The message was moved to folder ") + lang_folder(data.new_folder_name)); |
---|
| 601 | else |
---|
| 602 | write_msg(get_lang("The messages were moved to folder ") + lang_folder(data.new_folder_name)); |
---|
| 603 | } |
---|
[569] | 604 | |
---|
[163] | 605 | selected_messages = selected_messages.split(","); |
---|
| 606 | for (i = 0; i < selected_messages.length; i++){ |
---|
[845] | 607 | removeAll(selected_messages[i]); |
---|
[827] | 608 | } |
---|
[976] | 609 | // Update Box BgColor |
---|
| 610 | var box = Element("tbody_box_"+currentTab.substr(7)).childNodes; |
---|
| 611 | if(main_list.length > 1){ |
---|
| 612 | updateBoxBgColor(box); |
---|
| 613 | } |
---|
[1443] | 614 | connector.purgeCache(); |
---|
[827] | 615 | } |
---|
[163] | 616 | |
---|
| 617 | if (selected_messages){ |
---|
[569] | 618 | var selected_param = ""; |
---|
| 619 | if (selected_messages.indexOf(',') != -1) |
---|
| 620 | { |
---|
| 621 | selected_msg_array = selected_messages.split(","); |
---|
| 622 | for (i = 0; i < selected_msg_array.length; i++){ |
---|
| 623 | var tr = Element(selected_msg_array[i]); |
---|
[845] | 624 | if (tr.getAttribute('name') == new_folder) |
---|
[829] | 625 | { |
---|
| 626 | write_msg(get_lang('At least one message have the same origin')); |
---|
| 627 | return false; |
---|
| 628 | } |
---|
[845] | 629 | trfolder = (tr.getAttribute('name') == null?get_current_folder():tr.getAttribute('name')); |
---|
[3035] | 630 | selected_param += ','+trfolder+';'+tr.id.replace(/_[a-zA-Z0-9]+/,""); |
---|
[569] | 631 | } |
---|
| 632 | } |
---|
| 633 | else |
---|
| 634 | { |
---|
| 635 | var tr=Element(selected_messages); |
---|
[845] | 636 | if (tr.getAttribute('name') == new_folder) |
---|
[829] | 637 | { |
---|
| 638 | write_msg(get_lang('The origin folder and the destination folder are the same.')); |
---|
| 639 | return false; |
---|
| 640 | } |
---|
[845] | 641 | trfolder = (tr.getAttribute('name') == null?get_current_folder():tr.getAttribute('name')); |
---|
[1969] | 642 | selected_param=trfolder+';'+tr.id.replace(/_[a-zA-Z0-9]+/,""); |
---|
[569] | 643 | } |
---|
[163] | 644 | var params = ""; |
---|
[3035] | 645 | if (!new_folder && parseInt(preferences.save_deleted_msg)){ |
---|
[163] | 646 | new_folder = 'INBOX'+cyrus_delimiter+trashfolder; |
---|
| 647 | new_folder_name = trashfolder; |
---|
| 648 | params = "&delete=true"; |
---|
[829] | 649 | } |
---|
| 650 | |
---|
[569] | 651 | params += "&selected_messages="+url_encode(selected_param); |
---|
[163] | 652 | if(new_folder) { |
---|
| 653 | params += "&new_folder="+url_encode(new_folder); |
---|
| 654 | params += "&new_folder_name="+url_encode(new_folder_name); |
---|
| 655 | } |
---|
| 656 | cExecute ("$this.imap_functions.move_search_messages", handler_move_search_msgs, params); |
---|
| 657 | } |
---|
| 658 | else |
---|
[3035] | 659 | write_msg(get_lang('No selected message.')); |
---|
[163] | 660 | } |
---|
| 661 | |
---|
[689] | 662 | function move_msgs2(folder, msgs_number, border_ID, new_folder, new_folder_name,show_success_msg){ |
---|
[320] | 663 | if (! folder || folder == 'null') |
---|
[3018] | 664 | folder = Element("input_folder_"+msgs_number+"_r") ? Element("input_folder_"+msgs_number+"_r").value : (openTab.imapBox[currentTab] ? openTab.imapBox[currentTab]:get_current_folder()); |
---|
[845] | 665 | if(openTab.type[currentTab] == 1) |
---|
| 666 | return move_search_msgs('content_id_'+currentTab,new_folder,new_folder_name); |
---|
| 667 | |
---|
[2] | 668 | var handler_move_msgs = function(data){ |
---|
[320] | 669 | if(typeof(data) == 'string') |
---|
| 670 | if (data.match(/^(.*)TRYCREATE(.*)$/)){ |
---|
| 671 | connector.loadScript('TreeS'); |
---|
| 672 | var move_to_folder = data.match(/^(.*)Spam(.*)$/) ? "Spam" : trashfolder; |
---|
| 673 | alert(get_lang('There is not %1 folder, Expresso is creating it for you... Please, repeat your request later.', move_to_folder)); |
---|
| 674 | connector.loadScript('TreeShow'); |
---|
| 675 | ttree.FOLDER = 'root'; |
---|
| 676 | ttreeBox.new_past(move_to_folder); |
---|
| 677 | return false; |
---|
| 678 | }else{ |
---|
[827] | 679 | alert(get_lang('Error moving message.')+":\n"+data); |
---|
[320] | 680 | return false; |
---|
| 681 | } |
---|
[325] | 682 | //Este bloco verifica as permissoes ACL sobre pastas compartilhadas |
---|
| 683 | if(data.status == false){ |
---|
| 684 | alert(get_lang("You don't have permission for this operation in this shared folder!")); |
---|
| 685 | return false; |
---|
| 686 | } |
---|
[827] | 687 | mail_msg = ( Element("divScrollMain_"+numBox) ) ? Element("divScrollMain_"+numBox).firstChild.firstChild : Element("divScrollMain_0").firstChild.firstChild; |
---|
| 688 | if (data.msgs_number.length == 1) |
---|
| 689 | write_msg(get_lang("The message was moved to folder ") + lang_folder(data.new_folder_name)); |
---|
| 690 | else |
---|
| 691 | write_msg(get_lang("The messages were moved to folder ") + lang_folder(data.new_folder_name)); |
---|
| 692 | |
---|
| 693 | if (openTab.type[currentTab] > 1){ |
---|
| 694 | msg_to_delete = Element(msgs_number); |
---|
| 695 | if (parseInt(preferences.delete_and_show_previous_message) && msg_to_delete) |
---|
| 696 | { |
---|
| 697 | if (msg_to_delete.previousSibling){ |
---|
| 698 | var previous_msg = msg_to_delete.previousSibling.id; |
---|
[1635] | 699 | //cExecute("$this.imap_functions.get_info_msg&msg_number="+previous_msg+"&msg_folder=" + current_folder, show_msg); |
---|
[1691] | 700 | cExecute("$this.imap_functions.get_info_msg&msg_number="+previous_msg+"&msg_folder=" + url_encode(folder), show_msg); |
---|
[827] | 701 | } |
---|
| 702 | else |
---|
| 703 | delete_border(currentTab,'false'); |
---|
| 704 | } |
---|
| 705 | else |
---|
| 706 | delete_border(currentTab,'false'); |
---|
| 707 | if(msg_to_delete) |
---|
| 708 | mail_msg.removeChild(msg_to_delete); |
---|
[1652] | 709 | |
---|
| 710 | // Update Box BgColor |
---|
| 711 | var box = Element("tbody_box"); |
---|
| 712 | if(box.childNodes.length > 0){ |
---|
| 713 | updateBoxBgColor(box.childNodes); |
---|
| 714 | } |
---|
[827] | 715 | return; |
---|
| 716 | } |
---|
| 717 | |
---|
[2] | 718 | Element('chk_box_select_all_messages').checked = false; |
---|
[345] | 719 | if (! mail_msg) |
---|
| 720 | mail_msg = Element("tbody_box"); |
---|
[2] | 721 | data.msgs_number = data.msgs_number.split(","); |
---|
[320] | 722 | |
---|
[345] | 723 | var msg_to_delete; |
---|
| 724 | if( typeof(msgs_number) == 'string' ) |
---|
| 725 | all_search_msg = msgs_number.split(','); |
---|
[827] | 726 | else if( typeof(msgs_number) == 'number') |
---|
[345] | 727 | all_search_msg = msgs_number; |
---|
[3035] | 728 | |
---|
[320] | 729 | for (var i=0; i <= all_search_msg.length; i++) |
---|
| 730 | { |
---|
[3035] | 731 | msg_to_delete = Element(folder+';'+all_search_msg[i]); |
---|
[320] | 732 | if (msg_to_delete) |
---|
| 733 | msg_to_delete.parentNode.removeChild(msg_to_delete); |
---|
| 734 | } |
---|
| 735 | |
---|
[214] | 736 | if ( preferences.use_shortcuts == '1') { |
---|
| 737 | var all_messages = Element('tbody_box').childNodes; |
---|
| 738 | |
---|
| 739 | //Last msg is selected |
---|
| 740 | if ( exist_className(all_messages[all_messages.length-1], 'selected_shortcut_msg') ) { |
---|
| 741 | select_msg('null', 'up', true); |
---|
| 742 | } |
---|
| 743 | else { |
---|
| 744 | if (!select_msg('null', 'down', true)) { |
---|
| 745 | select_msg('null', 'up', true); |
---|
[135] | 746 | } |
---|
[2] | 747 | } |
---|
| 748 | } |
---|
[214] | 749 | for (var i=0; i<data.msgs_number.length; i++) |
---|
| 750 | { |
---|
| 751 | msg_to_delete = Element(data.msgs_number[i]); |
---|
| 752 | if (msg_to_delete) |
---|
| 753 | mail_msg.removeChild(msg_to_delete); |
---|
[3035] | 754 | } |
---|
| 755 | |
---|
| 756 | |
---|
[673] | 757 | if (data.msgs_number.length == 1) |
---|
| 758 | write_msg(get_lang("The message was moved to folder ") + lang_folder(data.new_folder_name)); |
---|
| 759 | else |
---|
| 760 | write_msg(get_lang("The messages were moved to folder ") + lang_folder(data.new_folder_name)); |
---|
[320] | 761 | if (data.border_ID.indexOf('r') != -1){ |
---|
[605] | 762 | if (parseInt(preferences.delete_and_show_previous_message) && folder == get_current_folder()){ |
---|
| 763 | delete_border(data.border_ID,'false'); |
---|
[2] | 764 | show_msg(data.previous_msg); |
---|
[605] | 765 | } |
---|
[2] | 766 | else |
---|
| 767 | delete_border(data.border_ID,'false'); |
---|
| 768 | } |
---|
[72] | 769 | if(folder == get_current_folder()) |
---|
[3035] | 770 | Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) - data.msgs_number.length; |
---|
| 771 | |
---|
[2] | 772 | refresh(); |
---|
| 773 | } |
---|
| 774 | |
---|
| 775 | if (folder == new_folder){ |
---|
[53] | 776 | write_msg(get_lang('The origin folder and the destination folder are the same.')); |
---|
[2] | 777 | return; |
---|
| 778 | } |
---|
| 779 | |
---|
[827] | 780 | if (msgs_number == 'selected'){ |
---|
[2] | 781 | msgs_number = get_selected_messages(); |
---|
[827] | 782 | } |
---|
[2] | 783 | |
---|
[827] | 784 | if(openTab.type[currentTab] == 1){ |
---|
| 785 | return move_search_msgs('content_id_'+currentTab,new_folder,new_folder_name); |
---|
| 786 | } |
---|
| 787 | |
---|
| 788 | if(currentTab.toString().indexOf("_r") != -1){ |
---|
| 789 | msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); |
---|
| 790 | } |
---|
| 791 | |
---|
[2] | 792 | if (parseInt(msgs_number) > 0 || msgs_number.length > 0) |
---|
[51] | 793 | cExecute ("$this.imap_functions.move_messages&folder="+folder+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&search_box_type="+search_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+preferences.delete_and_show_previous_message, handler_move_msgs); |
---|
[2] | 794 | else |
---|
[3035] | 795 | write_msg(get_lang('No selected message.')); |
---|
| 796 | |
---|
[2] | 797 | } |
---|
| 798 | |
---|
[689] | 799 | function move_msgs(folder, msgs_number, border_ID, new_folder, new_folder_name) { |
---|
| 800 | move_msgs2(folder, msgs_number, border_ID, new_folder, new_folder_name,true); |
---|
| 801 | } |
---|
| 802 | |
---|
| 803 | function archive_msgs(folder,folder_dest,id_msgs) { |
---|
| 804 | if(proxy_mensagens.is_local_folder(folder)) { |
---|
| 805 | write_msg(get_lang("You cant archive local mails")); |
---|
| 806 | return; |
---|
| 807 | } |
---|
[1595] | 808 | |
---|
[3411] | 809 | if(currentTab.toString().indexOf("_r") != -1){ |
---|
| 810 | id_msgs = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); |
---|
| 811 | } |
---|
| 812 | |
---|
[1595] | 813 | if(!id_msgs) |
---|
| 814 | id_msgs = get_selected_messages(); |
---|
[3035] | 815 | |
---|
[1595] | 816 | if(folder_dest=='local_root' || folder_dest==null) //Caso seja o primeiro arquivamento... |
---|
| 817 | folder_dest = 'local_Inbox'; |
---|
[3035] | 818 | |
---|
[1595] | 819 | if (parseInt(id_msgs) > 0 || id_msgs.length > 0) |
---|
[3035] | 820 | expresso_mail_sync.archive_msgs(folder,folder_dest,id_msgs); |
---|
[1595] | 821 | //cExecute("$this.imap_functions.get_info_msgs&folder=" + folder + "&msgs_number=" + id_msgs , handler_arquivar_mensagens); |
---|
[3035] | 822 | else |
---|
[1595] | 823 | write_msg(get_lang('No selected message.')); |
---|
[827] | 824 | |
---|
[689] | 825 | } |
---|
| 826 | |
---|
[2] | 827 | function get_selected_messages(){ |
---|
[3062] | 828 | try{ |
---|
| 829 | main = document.getElementById("divScrollMain_"+numBox).firstChild.firstChild; |
---|
| 830 | }catch(e){ |
---|
| 831 | }; |
---|
| 832 | |
---|
[345] | 833 | if (! main) |
---|
| 834 | main = Element("tbody_box"); |
---|
[320] | 835 | |
---|
[2] | 836 | // Get all TR (messages) in tBody. |
---|
| 837 | main_list = main.childNodes; |
---|
[320] | 838 | |
---|
[2] | 839 | var selected_messages = ''; |
---|
[163] | 840 | var selected_messages_by_shortcuts = ''; |
---|
[2] | 841 | var j = 0; |
---|
[163] | 842 | for (j; j<(main_list.length); j++) |
---|
| 843 | { |
---|
[3724] | 844 | |
---|
| 845 | if (numBox > 0) { |
---|
| 846 | id_mensagem = main_list[j].id.split('_'); |
---|
| 847 | check_box = Element("search_" + numBox + "_check_box_message_" + id_mensagem[0]); |
---|
| 848 | } |
---|
| 849 | else |
---|
| 850 | check_box = Element("check_box_message_" + main_list[j].id); |
---|
| 851 | |
---|
[569] | 852 | if ( (check_box) && (check_box.checked) ) |
---|
| 853 | selected_messages += main_list[j].id + ','; |
---|
[3035] | 854 | |
---|
[163] | 855 | if (preferences.use_shortcuts == '1') |
---|
| 856 | { |
---|
| 857 | if ( exist_className(Element(main_list[j].id), 'selected_shortcut_msg') ) |
---|
| 858 | { |
---|
| 859 | selected_messages_by_shortcuts += main_list[j].id + ','; |
---|
| 860 | } |
---|
| 861 | } |
---|
[2] | 862 | } |
---|
| 863 | selected_messages = selected_messages.substring(0,(selected_messages.length-1)); |
---|
[3035] | 864 | |
---|
[163] | 865 | if (preferences.use_shortcuts == '1') |
---|
| 866 | { |
---|
| 867 | selected_messages_by_shortcuts = selected_messages_by_shortcuts.substring(0,(selected_messages_by_shortcuts.length-1)); |
---|
[3035] | 868 | |
---|
[163] | 869 | var array_selected_messages_by_shortcuts = selected_messages_by_shortcuts.split(","); |
---|
| 870 | var array_selected_messages = selected_messages.split(","); |
---|
[3035] | 871 | |
---|
[163] | 872 | if ((array_selected_messages.length <= 1) && (array_selected_messages_by_shortcuts.length > 1)) |
---|
| 873 | { |
---|
| 874 | return selected_messages_by_shortcuts; |
---|
| 875 | } |
---|
| 876 | } |
---|
[3035] | 877 | |
---|
[2] | 878 | if (selected_messages == '') |
---|
| 879 | return false; |
---|
| 880 | else |
---|
| 881 | return selected_messages; |
---|
| 882 | } |
---|
| 883 | |
---|
[689] | 884 | function replaceAll(string, token, newtoken) { |
---|
| 885 | while (string.indexOf(token) != -1) { |
---|
| 886 | string = string.replace(token, newtoken); |
---|
| 887 | } |
---|
| 888 | return string; |
---|
| 889 | } |
---|
| 890 | |
---|
[603] | 891 | function new_message_to(email) { |
---|
| 892 | var new_border_ID = new_message('new','null'); |
---|
| 893 | document.getElementById("to_" + new_border_ID).value=email; |
---|
| 894 | } |
---|
| 895 | |
---|
[2] | 896 | function new_message(type, border_ID){ |
---|
[3035] | 897 | if (Element('show_img_link_'+border_ID)) |
---|
| 898 | { |
---|
| 899 | show_msg_img(border_ID.match(/^\d*/)[0], Element('input_folder_'+border_ID).value); |
---|
| 900 | } |
---|
[271] | 901 | var new_border_ID = draw_new_message(parseInt(border_ID)); |
---|
[3143] | 902 | if(typeof(openTab.type[new_border_ID]) != "undefined") { |
---|
| 903 | if(tabTypes[type] == openTab.type[new_border_ID]) { |
---|
| 904 | return new_border_ID; |
---|
| 905 | } else { |
---|
[3147] | 906 | var a_types = { 6 : get_lang("Forward"),7 : get_lang("Reply"), |
---|
| 907 | 8 : get_lang("Reply to all with history"), |
---|
| 908 | 9 : get_lang("Reply without history"), |
---|
| 909 | 10: get_lang("Reply to all without history")}; |
---|
| 910 | |
---|
| 911 | if(!confirm(get_lang("Your message to %1 has not been saved or sent. "+ |
---|
| 912 | "To %2 will be necessary open it again. Discard your message?", |
---|
| 913 | a_types[openTab.type[new_border_ID]].toUpperCase(), |
---|
| 914 | a_types[tabTypes[type]].toUpperCase()))){ |
---|
| 915 | return new_border_ID; |
---|
| 916 | } else { |
---|
| 917 | delete_border(currentTab); |
---|
| 918 | new_border_ID = draw_new_message(parseInt(border_ID)); |
---|
| 919 | } |
---|
[3143] | 920 | } |
---|
| 921 | } |
---|
[352] | 922 | if (new_border_ID == false) |
---|
[3075] | 923 | { |
---|
| 924 | setTimeout('new_message(\''+type+'\',\''+border_ID+'\');',500); |
---|
[3035] | 925 | return false; |
---|
[3075] | 926 | } |
---|
| 927 | openTab.type[new_border_ID] = tabTypes[type]; |
---|
[4092] | 928 | |
---|
[63] | 929 | // Salva a pasta da mensagem respondida ou encaminhada: |
---|
| 930 | var folder_message = Element("input_folder_"+border_ID); |
---|
| 931 | if(folder_message) { |
---|
[3035] | 932 | var input_current_folder = document.createElement('input'); |
---|
[63] | 933 | input_current_folder.id = "new_input_folder_"+border_ID; |
---|
| 934 | input_current_folder.name = "input_folder"; |
---|
| 935 | input_current_folder.type = "hidden"; |
---|
| 936 | input_current_folder.value = folder_message.value; |
---|
| 937 | Element("content_id_" + new_border_ID).appendChild(input_current_folder); |
---|
| 938 | }//Fim. |
---|
[2] | 939 | var title = ''; |
---|
| 940 | data = []; |
---|
| 941 | if (Element("from_" + border_ID)){ |
---|
[320] | 942 | if (document.getElementById("reply_to_" + border_ID)){ |
---|
| 943 | data.to = document.getElementById("reply_to_values_" + border_ID).value; |
---|
| 944 | data.to = data.to.replace(/</gi,"<"); |
---|
| 945 | data.to = data.to.replace(/>/gi,">"); |
---|
[2] | 946 | } |
---|
| 947 | else { |
---|
[320] | 948 | if (document.getElementById("from_values_" + border_ID)) |
---|
| 949 | { |
---|
| 950 | data.to = document.getElementById("from_values_" + border_ID).value; |
---|
| 951 | data.to = data.to.replace(/</gi,"<"); |
---|
| 952 | data.to = data.to.replace(/>/gi,">"); |
---|
| 953 | } |
---|
[3035] | 954 | } |
---|
| 955 | |
---|
[320] | 956 | if (document.getElementById("to_values_" + border_ID)){ |
---|
| 957 | data.to_all = document.getElementById("to_values_" + border_ID).value; |
---|
[3035] | 958 | data.to_all = data.to_all.replace(/\n/gi," "); |
---|
[320] | 959 | data.to_all = data.to_all.replace(/</gi,"<"); |
---|
| 960 | data.to_all = data.to_all.replace(/>/gi,">"); |
---|
| 961 | var _array_to_all = data.to_all.split(","); |
---|
[3035] | 962 | } |
---|
[2] | 963 | } |
---|
[3035] | 964 | |
---|
[2] | 965 | if (document.getElementById("cc_" + border_ID)){ |
---|
| 966 | data.cc = document.getElementById("cc_values_" + border_ID).value; |
---|
| 967 | data.cc = data.cc.replace(/</gi,"<"); |
---|
| 968 | data.cc = data.cc.replace(/>/gi,">"); |
---|
| 969 | } |
---|
[1638] | 970 | if (document.getElementById("cco_" + border_ID)){ |
---|
| 971 | data.cco = document.getElementById("cco_values_" + border_ID).value; |
---|
| 972 | data.cco = data.cco.replace(/</gi,"<"); |
---|
| 973 | data.cco = data.cco.replace(/>/gi,">"); |
---|
| 974 | } |
---|
[2] | 975 | if (document.getElementById("subject_" + border_ID)) |
---|
| 976 | data.subject = document.getElementById("subject_" + border_ID).innerHTML; |
---|
| 977 | if (document.getElementById("body_" + border_ID)) |
---|
| 978 | data.body = document.getElementById("body_" + border_ID).innerHTML; |
---|
[3035] | 979 | |
---|
[2] | 980 | if (Element('date_' + border_ID)){ |
---|
| 981 | data.date = Element('date_' + border_ID).innerHTML; |
---|
| 982 | } |
---|
[3035] | 983 | |
---|
[2] | 984 | if (Element('date_day_' + border_ID)){ |
---|
| 985 | data.date_day = Element('date_day_' + border_ID).value; |
---|
| 986 | } |
---|
| 987 | if (Element('date_hour_' + border_ID)){ |
---|
| 988 | data.date_hour = Element('date_hour_' + border_ID).value; |
---|
| 989 | } |
---|
[878] | 990 | if(typeof(preferences.signature) == 'undefined') |
---|
| 991 | preferences.signature = ""; |
---|
[389] | 992 | var signature = preferences.type_signature == 'html' ? preferences.signature : preferences.signature.replace(/\n/g, "<br>"); |
---|
[3387] | 993 | if(type!="new" && type!="edit") |
---|
| 994 | data.is_local_message = (document.getElementById("is_local_"+border_ID).value=="1")?true:false; |
---|
[2] | 995 | switch(type){ |
---|
[3035] | 996 | case "reply_without_history": |
---|
[2] | 997 | Element("to_" + new_border_ID).value = data.to; |
---|
| 998 | title = "Re: " + data.subject; |
---|
[3387] | 999 | Element("subject_" + new_border_ID).value = "Re: " + data.subject; |
---|
| 1000 | useOriginalAttachments(new_border_ID,border_ID,data.is_local_message); |
---|
[2] | 1001 | var body = Element("body_" + new_border_ID); |
---|
| 1002 | body.contentWindow.document.open(); |
---|
[325] | 1003 | // Insert the signature automaticaly at message body if use_signature preference is set |
---|
[3035] | 1004 | if (preferences.use_signature == "1"){ |
---|
[389] | 1005 | body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>"); |
---|
[325] | 1006 | } |
---|
[3035] | 1007 | else{ |
---|
[345] | 1008 | body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'></body></html>"); |
---|
[325] | 1009 | } |
---|
[2] | 1010 | body.contentWindow.document.close(); |
---|
| 1011 | body.contentWindow.document.designMode = "on"; |
---|
[245] | 1012 | //Focus |
---|
[128] | 1013 | if (is_ie) |
---|
[245] | 1014 | window.setTimeout('document.getElementById("body_'+new_border_ID+'").contentWindow.focus();', 300); |
---|
| 1015 | else |
---|
| 1016 | body.contentWindow.focus(); |
---|
[901] | 1017 | config_events( body.contentWindow.document, 'onkeyup', function( e ) |
---|
| 1018 | { |
---|
| 1019 | if ( e.keyCode == 13 ) |
---|
| 1020 | { |
---|
| 1021 | var paragraphs = body.contentWindow.document.getElementsByTagName( 'p' ); |
---|
| 1022 | for ( p = 0; p < paragraphs.length; p++ ) |
---|
| 1023 | paragraphs.item( p ).style.margin = '0px'; |
---|
| 1024 | } |
---|
| 1025 | }); |
---|
[2] | 1026 | msg_reply_from = document.createElement('input'); |
---|
| 1027 | msg_reply_from.id = "msg_reply_from_" + new_border_ID; |
---|
| 1028 | msg_reply_from.type = "hidden"; |
---|
| 1029 | msg_reply_from.value = Element("msg_number_" + border_ID).value; |
---|
| 1030 | Element("content_id_" + new_border_ID).appendChild(msg_reply_from); |
---|
| 1031 | break; |
---|
| 1032 | case "reply_with_history": |
---|
| 1033 | title = "Re: " + data.subject; |
---|
| 1034 | Element("subject_" + new_border_ID).value = "Re: " + data.subject; |
---|
| 1035 | Element("to_" + new_border_ID).value = data.to; |
---|
[3387] | 1036 | useOriginalAttachments(new_border_ID,border_ID,data.is_local_message); |
---|
[2] | 1037 | block_quoted_body = make_body_reply(data.body, data.to, data.date_day, data.date_hour); |
---|
| 1038 | var body = Element("body_" + new_border_ID); |
---|
| 1039 | body.contentWindow.document.open(); |
---|
[325] | 1040 | // Insert the signature automaticaly at message body if use_signature preference is set |
---|
[336] | 1041 | if (preferences.use_signature == "1") { |
---|
[389] | 1042 | body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>" + block_quoted_body + "</body></html>"); |
---|
[325] | 1043 | } |
---|
| 1044 | else { |
---|
[345] | 1045 | body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>"+block_quoted_body+"</body></html>"); |
---|
[325] | 1046 | } |
---|
[2] | 1047 | body.contentWindow.document.close(); |
---|
| 1048 | body.contentWindow.document.designMode = "on"; |
---|
[245] | 1049 | //Focus |
---|
[128] | 1050 | if (is_ie) |
---|
[245] | 1051 | window.setTimeout('document.getElementById("body_'+new_border_ID+'").contentWindow.focus();', 300); |
---|
| 1052 | else |
---|
| 1053 | body.contentWindow.focus(); |
---|
[901] | 1054 | config_events( body.contentWindow.document, 'onkeyup', function( e ) |
---|
| 1055 | { |
---|
| 1056 | if ( e.keyCode == 13 ) |
---|
| 1057 | { |
---|
| 1058 | var paragraphs = body.contentWindow.document.getElementsByTagName( 'p' ); |
---|
| 1059 | for ( p = 0; p < paragraphs.length; p++ ) |
---|
| 1060 | paragraphs.item( p ).style.margin = '0px'; |
---|
| 1061 | } |
---|
| 1062 | }); |
---|
[2] | 1063 | msg_reply_from = document.createElement('input'); |
---|
| 1064 | msg_reply_from.id = "msg_reply_from_" + new_border_ID; |
---|
| 1065 | msg_reply_from.type = "hidden"; |
---|
| 1066 | msg_reply_from.value = Element("msg_number_" + border_ID).value; |
---|
| 1067 | Element("content_id_" + new_border_ID).appendChild(msg_reply_from); |
---|
| 1068 | break; |
---|
| 1069 | case "reply_to_all_without_history": |
---|
[320] | 1070 | // delete user email from to_all array. |
---|
| 1071 | data.to_all = new Array(); |
---|
| 1072 | var j = 0; |
---|
[3035] | 1073 | for(i = 0; i < _array_to_all.length; i++) { |
---|
[320] | 1074 | if(_array_to_all[i].lastIndexOf(Element("user_email").value) == "-1"){ |
---|
| 1075 | data.to_all[j++] = _array_to_all[i]; |
---|
| 1076 | } |
---|
| 1077 | } |
---|
| 1078 | data.to_all = data.to_all.join(","); |
---|
| 1079 | |
---|
[2] | 1080 | title = "Re: " + data.subject; |
---|
| 1081 | Element("subject_" + new_border_ID).value = "Re: " + data.subject; |
---|
| 1082 | Element("to_" + new_border_ID).value = data.to; |
---|
| 1083 | Element("to_" + new_border_ID).value += ', ' + data.to_all; |
---|
| 1084 | if (data.cc){ |
---|
| 1085 | Element("cc_" + new_border_ID).value = data.cc; |
---|
| 1086 | Element("a_cc_link_" + new_border_ID).style.display='none'; |
---|
| 1087 | Element("tr_cc_" + new_border_ID).style.display=''; |
---|
| 1088 | Element('space_link_' + new_border_ID).style.display='none'; |
---|
| 1089 | } |
---|
[3387] | 1090 | useOriginalAttachments(new_border_ID,border_ID,data.is_local_message); |
---|
[2] | 1091 | var body = Element("body_" + new_border_ID); |
---|
| 1092 | body.contentWindow.document.open(); |
---|
[325] | 1093 | // Insert the signature automaticaly at message body if use_signature preference is set |
---|
[336] | 1094 | if (preferences.use_signature == "1") { |
---|
[389] | 1095 | body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>"); |
---|
[325] | 1096 | } |
---|
| 1097 | else { |
---|
[345] | 1098 | body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'></body></html>"); |
---|
[325] | 1099 | } |
---|
[2] | 1100 | body.contentWindow.document.close(); |
---|
| 1101 | body.contentWindow.document.designMode = "on"; |
---|
[245] | 1102 | //Focus |
---|
[128] | 1103 | if (is_ie) |
---|
[245] | 1104 | window.setTimeout('document.getElementById("body_'+new_border_ID+'").contentWindow.focus();', 300); |
---|
| 1105 | else |
---|
| 1106 | body.contentWindow.focus(); |
---|
[901] | 1107 | config_events( body.contentWindow.document, 'onkeyup', function( e ) |
---|
| 1108 | { |
---|
| 1109 | if ( e.keyCode == 13 ) |
---|
| 1110 | { |
---|
| 1111 | var paragraphs = body.contentWindow.document.getElementsByTagName( 'p' ); |
---|
| 1112 | for ( p = 0; p < paragraphs.length; p++ ) |
---|
| 1113 | paragraphs.item( p ).style.margin = '0px'; |
---|
| 1114 | } |
---|
| 1115 | }); |
---|
[2] | 1116 | msg_reply_from = document.createElement('input'); |
---|
| 1117 | msg_reply_from.id = "msg_reply_from_" + new_border_ID; |
---|
| 1118 | msg_reply_from.type = "hidden"; |
---|
| 1119 | msg_reply_from.value = Element("msg_number_" + border_ID).value; |
---|
| 1120 | Element("content_id_" + new_border_ID).appendChild(msg_reply_from); |
---|
| 1121 | break; |
---|
| 1122 | case "reply_to_all_with_history": |
---|
[320] | 1123 | // delete user email from to_all array. |
---|
| 1124 | data.to_all = new Array(); |
---|
| 1125 | var j = 0; |
---|
[3035] | 1126 | for(i = 0; i < _array_to_all.length; i++) { |
---|
[320] | 1127 | if(_array_to_all[i].lastIndexOf(Element("user_email").value) == "-1"){ |
---|
| 1128 | data.to_all[j++] = _array_to_all[i]; |
---|
| 1129 | } |
---|
[4117] | 1130 | } |
---|
| 1131 | if (data.to_all != get_lang("undisclosed-recipient")) |
---|
| 1132 | data.to_all = data.to_all.join(","); |
---|
| 1133 | else |
---|
| 1134 | data.to_all = ""; |
---|
[2] | 1135 | title = "Re: " + data.subject; |
---|
| 1136 | Element("to_" + new_border_ID).value = data.to; |
---|
| 1137 | Element("to_" + new_border_ID).value += ', ' + data.to_all; |
---|
| 1138 | if (data.cc){ |
---|
| 1139 | document.getElementById("cc_" + new_border_ID).value = data.cc; |
---|
| 1140 | document.getElementById("a_cc_link_" + new_border_ID).style.display='none'; |
---|
| 1141 | document.getElementById("tr_cc_" + new_border_ID).style.display=''; |
---|
| 1142 | document.getElementById('space_link_' + new_border_ID).style.display='none'; |
---|
| 1143 | } |
---|
| 1144 | document.getElementById("subject_" + new_border_ID).value = "Re: " + data.subject; |
---|
[3387] | 1145 | useOriginalAttachments(new_border_ID,border_ID,data.is_local_message); |
---|
[2] | 1146 | block_quoted_body = make_body_reply(data.body, data.to, data.date_day, data.date_hour); |
---|
| 1147 | var body = document.getElementById("body_" + new_border_ID); |
---|
| 1148 | body.contentWindow.document.open(); |
---|
[325] | 1149 | // Insert the signature automaticaly at message body if use_signature preference is set |
---|
[336] | 1150 | if (preferences.use_signature == "1") { |
---|
[389] | 1151 | body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>" + block_quoted_body + "</body></html>"); |
---|
[325] | 1152 | } |
---|
| 1153 | else { |
---|
[345] | 1154 | body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>"+block_quoted_body+"</body></html>"); |
---|
[325] | 1155 | } |
---|
[2] | 1156 | body.contentWindow.document.close(); |
---|
| 1157 | body.contentWindow.document.designMode = "on"; |
---|
[245] | 1158 | //Focus |
---|
[128] | 1159 | if (is_ie) |
---|
[245] | 1160 | window.setTimeout('document.getElementById("body_'+new_border_ID+'").contentWindow.focus();', 300); |
---|
| 1161 | else |
---|
| 1162 | body.contentWindow.focus(); |
---|
[901] | 1163 | config_events( body.contentWindow.document, 'onkeyup', function( e ) |
---|
| 1164 | { |
---|
| 1165 | if ( e.keyCode == 13 ) |
---|
| 1166 | { |
---|
| 1167 | var paragraphs = body.contentWindow.document.getElementsByTagName( 'p' ); |
---|
| 1168 | for ( p = 0; p < paragraphs.length; p++ ) |
---|
| 1169 | paragraphs.item( p ).style.margin = '0px'; |
---|
| 1170 | } |
---|
| 1171 | }); |
---|
[2] | 1172 | msg_reply_from = document.createElement('input'); |
---|
| 1173 | msg_reply_from.id = "msg_reply_from_" + new_border_ID; |
---|
| 1174 | msg_reply_from.type = "hidden"; |
---|
| 1175 | msg_reply_from.value = Element("msg_number_" + border_ID).value; |
---|
| 1176 | Element("content_id_" + new_border_ID).appendChild(msg_reply_from); |
---|
| 1177 | break; |
---|
| 1178 | case "forward": |
---|
[689] | 1179 | data.is_local_message = (document.getElementById("is_local_"+border_ID).value=="1")?true:false; |
---|
[2] | 1180 | msg_forward_from = document.createElement('input'); |
---|
| 1181 | msg_forward_from.id = "msg_forward_from_" + new_border_ID; |
---|
| 1182 | msg_forward_from.type = "hidden"; |
---|
| 1183 | msg_forward_from.value = Element("msg_number_" + border_ID).value; |
---|
[3035] | 1184 | Element("content_id_" + new_border_ID).appendChild(msg_forward_from); |
---|
[2] | 1185 | title = "Fw: " + data.subject; |
---|
| 1186 | document.getElementById("subject_" + new_border_ID).value = "Fw: " + data.subject; |
---|
| 1187 | var divFiles = Element("divFiles_"+new_border_ID); |
---|
[1711] | 1188 | var campo_arquivo; |
---|
[2] | 1189 | if (Element("attachments_" + border_ID)){ |
---|
[3520] | 1190 | var attachments = document.getElementById("attachments_" + border_ID).getElementsByTagName("a"); |
---|
| 1191 | |
---|
[2] | 1192 | for (var i = (attachments.length > 1 ? 1 : 0); i < attachments.length; i++){ |
---|
[689] | 1193 | if((attachments[i].tagName=="SPAN") || (attachments[i].tagName=="IMG") || |
---|
| 1194 | ((attachments[i].href.indexOf("javascript:download_local_attachment")==-1)&&(attachments[i].href.indexOf("javascript:download_attachments")==-1))) |
---|
[3035] | 1195 | continue; |
---|
[2] | 1196 | var link_attachment = document.createElement("A"); |
---|
| 1197 | link_attachment.setAttribute("href", attachments[i].href); |
---|
[3520] | 1198 | link_attachment.innerHTML = attachments[i].firstChild.nodeValue + '<br/>'; |
---|
[689] | 1199 | if (data.is_local_message) {//Local messages |
---|
| 1200 | document.getElementById("is_local_forward"+new_border_ID).value = "1"; |
---|
| 1201 | var tmp = link_attachment.href.substring(link_attachment.href.indexOf("(") + 2);//Pula o parenteses e a aspas |
---|
| 1202 | tmp = tmp.substring(0, tmp.length - 2);//corta a aspas e o parenteses |
---|
| 1203 | tmp = replaceAll(tmp,"%20"," "); |
---|
[3368] | 1204 | if (!tmp.match(/inc\/gotodownload.php/)) { //Anexos após ticket #1257 que usa gotodownload |
---|
| 1205 | var tempNomeArquivo = tmp.split("/"); |
---|
| 1206 | var nomeArquivo = tempNomeArquivo[tempNomeArquivo.length - 1]; |
---|
| 1207 | } |
---|
| 1208 | else { |
---|
| 1209 | var tempNomeArquivo = tmp.split("&newfilename="); |
---|
| 1210 | var nomeArquivo = tempNomeArquivo[tempNomeArquivo.length - 1]; |
---|
| 1211 | } |
---|
| 1212 | |
---|
| 1213 | if(nomeArquivo.match(/\.[a-z]{1,3}\.php$/i)!=null) //Anexos no gears podem vir com .php depois de sua extensão. tenho que tirar o .php para ficar o nome real do arquivo. |
---|
| 1214 | nomeArquivo = nomeArquivo.substring(0, nomeArquivo.length - 4); |
---|
| 1215 | campo_arquivo = addForwardedFile(new_border_ID, nomeArquivo, link_attachment.href); |
---|
| 1216 | |
---|
[1121] | 1217 | if(!expresso_offline) |
---|
| 1218 | expresso_local_messages.getInputFileFromAnexo(campo_arquivo, tmp); |
---|
| 1219 | else //To offline, you just set the url on value of a hidden input. |
---|
| 1220 | campo_arquivo.value = tmp; |
---|
[3035] | 1221 | |
---|
[689] | 1222 | } |
---|
| 1223 | else { |
---|
| 1224 | var tmp = link_attachment.href.replace("javascript:download_attachments(", "").replace(")", ""); |
---|
| 1225 | var a_tmp = tmp.split(','); |
---|
| 1226 | tmp = link_attachment.innerHTML.substring(0,link_attachment.innerHTML.lastIndexOf("(")); |
---|
| 1227 | a_tmp[2] = "'"+tmp.substring(0,tmp.length-1)+"'"; |
---|
[3137] | 1228 | s_tmp = trim(escape(connector.serialize(a_tmp))); |
---|
[689] | 1229 | |
---|
| 1230 | divFiles.innerHTML += "<input style='border:0' type='CHECKBOX' name='forwarding_attachments[]' checked value=\""+s_tmp+"\"/>"; |
---|
| 1231 | divFiles.innerHTML += "<link style='border:0' name='file_"+i+"' id='inputFile_"+border_ID+i+"'/>"; |
---|
| 1232 | divFiles.appendChild(link_attachment); |
---|
[827] | 1233 | } |
---|
[2] | 1234 | } |
---|
| 1235 | } |
---|
| 1236 | var body = Element("body_" + new_border_ID); |
---|
| 1237 | body.contentWindow.document.open(); |
---|
[325] | 1238 | // Insert the signature automaticaly at message body if use_signature preference is set |
---|
[336] | 1239 | if (preferences.use_signature == "1") { |
---|
[389] | 1240 | body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>" + make_forward_body(data.body, data.to, data.date, data.subject, data.to_all, data.cc) + "</body></html>"); |
---|
[325] | 1241 | } |
---|
| 1242 | else { |
---|
[345] | 1243 | body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>"+make_forward_body(data.body, data.to, data.date, data.subject, data.to_all, data.cc)+"</body></html>"); |
---|
[325] | 1244 | } |
---|
[2] | 1245 | body.contentWindow.document.close(); |
---|
| 1246 | body.contentWindow.document.designMode = "on"; |
---|
[901] | 1247 | config_events( body.contentWindow.document, 'onkeyup', function( e ) |
---|
| 1248 | { |
---|
| 1249 | if ( e.keyCode == 13 ) |
---|
| 1250 | { |
---|
| 1251 | var paragraphs = body.contentWindow.document.getElementsByTagName( 'p' ); |
---|
| 1252 | for ( p = 0; p < paragraphs.length; p++ ) |
---|
| 1253 | paragraphs.item( p ).style.margin = '0px'; |
---|
| 1254 | } |
---|
| 1255 | }); |
---|
[2] | 1256 | Element("to_" + new_border_ID).focus(); |
---|
| 1257 | break; |
---|
| 1258 | case "new": |
---|
| 1259 | title = get_lang("New Message"); |
---|
| 1260 | if(Element('msg_number').value) { |
---|
| 1261 | var _to = Element('msg_number').value; |
---|
[3035] | 1262 | 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}\])$/; |
---|
[2] | 1263 | if(!reEmail.test(_to)){ |
---|
| 1264 | var array_contacts = contacts.split(','); |
---|
| 1265 | for(i = 0; i < array_contacts.length;i++) { |
---|
| 1266 | if(array_contacts[i].lastIndexOf(_to) != "-1"){ |
---|
| 1267 | var _group = array_contacts[i].split(";"); |
---|
| 1268 | _to = '"'+_group[0]+'" <'+_group[1]+'>'; |
---|
| 1269 | break; |
---|
| 1270 | } |
---|
| 1271 | } |
---|
| 1272 | } |
---|
| 1273 | Element("to_" + new_border_ID).value = _to +','; |
---|
| 1274 | Element('msg_number').value = ''; |
---|
| 1275 | } |
---|
| 1276 | var body = document.getElementById("body_" + new_border_ID); |
---|
| 1277 | body.contentWindow.document.open(); |
---|
[325] | 1278 | // Insert the signature automaticaly at message body if use_signature preference is set |
---|
[336] | 1279 | if (preferences.use_signature == "1") { |
---|
[389] | 1280 | body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>"); |
---|
[325] | 1281 | } |
---|
| 1282 | else { |
---|
[345] | 1283 | body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'></body></html>"); |
---|
[325] | 1284 | } |
---|
[2] | 1285 | body.contentWindow.document.close(); |
---|
| 1286 | body.contentWindow.document.designMode = "on"; |
---|
[901] | 1287 | config_events( body.contentWindow.document, 'onkeyup', function( e ) |
---|
| 1288 | { |
---|
| 1289 | if ( e.keyCode == 13 ) |
---|
| 1290 | { |
---|
| 1291 | var paragraphs = body.contentWindow.document.getElementsByTagName( 'p' ); |
---|
| 1292 | for ( p = 0; p < paragraphs.length; p++ ) |
---|
| 1293 | paragraphs.item( p ).style.margin = '0px'; |
---|
| 1294 | } |
---|
| 1295 | }); |
---|
[827] | 1296 | Element("to_" + new_border_ID).focus(); |
---|
[2] | 1297 | break; |
---|
| 1298 | case "edit": |
---|
[605] | 1299 | openTab.imapBox[new_border_ID] = folder_message.value; |
---|
| 1300 | openTab.toPreserve[new_border_ID] = true; |
---|
| 1301 | openTab.imapUid[new_border_ID] = parseInt(border_ID.substr(0,border_ID.indexOf("_"))); |
---|
[271] | 1302 | document.getElementById('font_border_id_'+new_border_ID).innerHTML = data.subject; |
---|
[3770] | 1303 | title = "Edição: "+data.subject; |
---|
| 1304 | |
---|
[2] | 1305 | data.to = Element("to_values_" + border_ID).value; |
---|
[3770] | 1306 | if( data.to != get_lang("without destination") ) { |
---|
| 1307 | data.to = data.to.replace(/</gi,"<"); |
---|
| 1308 | data.to = data.to.replace(/>/gi,">"); |
---|
| 1309 | } else { |
---|
| 1310 | data.to = ""; |
---|
| 1311 | } |
---|
[3035] | 1312 | |
---|
[2] | 1313 | Element("to_" + new_border_ID).value = data.to; |
---|
| 1314 | if (data.cc){ |
---|
| 1315 | Element("cc_" + new_border_ID).value = data.cc; |
---|
| 1316 | Element("space_link_" + new_border_ID).style.display = 'none'; |
---|
| 1317 | Element("a_cc_link_" + new_border_ID).style.display = 'none'; |
---|
| 1318 | Element("tr_cc_"+ new_border_ID).style.display = ''; |
---|
| 1319 | } |
---|
[1638] | 1320 | if (data.cco){ |
---|
| 1321 | Element("cco_" + new_border_ID).value = data.cco; |
---|
| 1322 | Element("space_link_" + new_border_ID).style.display = 'none'; |
---|
| 1323 | Element("a_cco_link_" + new_border_ID).style.display = 'none'; |
---|
| 1324 | Element("tr_cco_"+ new_border_ID).style.display = ''; |
---|
| 1325 | } |
---|
[2] | 1326 | Element("subject_" + new_border_ID).value = data.subject; |
---|
[3798] | 1327 | |
---|
| 1328 | if( Element("disposition_notification_" + border_ID) ) |
---|
| 1329 | Element("return_receipt_" + new_border_ID).checked = true; |
---|
[3035] | 1330 | |
---|
[3798] | 1331 | var element_important_message = Element("important_message_" + new_border_ID); |
---|
| 1332 | if(element_important_message) { |
---|
| 1333 | if(Element("is_important_" + border_ID).value == "1") element_important_message.checked = true; |
---|
| 1334 | } |
---|
| 1335 | |
---|
[271] | 1336 | var divFiles = Element("divFiles_"+new_border_ID); |
---|
| 1337 | if (Element("attachments_" + border_ID)){ |
---|
| 1338 | var attachments = document.getElementById("attachments_" + border_ID).childNodes; |
---|
| 1339 | for (var i = (attachments.length > 1 ? 1 : 0); i < attachments.length; i++){ |
---|
| 1340 | var link_attachment = document.createElement("A"); |
---|
| 1341 | link_attachment.setAttribute("href", attachments[i].href); |
---|
| 1342 | link_attachment.innerHTML = attachments[i].innerHTML; |
---|
| 1343 | var tmp = link_attachment.href.replace("javascript:download_attachments(", "").replace(")", ""); |
---|
| 1344 | var a_tmp = tmp.split(','); |
---|
| 1345 | tmp = link_attachment.innerHTML.substring(0,link_attachment.innerHTML.lastIndexOf("(")); |
---|
| 1346 | a_tmp[2] = "'"+tmp.substring(0,tmp.length-1)+"'"; |
---|
[3137] | 1347 | s_tmp = trim(escape(connector.serialize(a_tmp))); |
---|
[271] | 1348 | divFiles.innerHTML += "<input style='border:0' type='CHECKBOX' name='forwarding_attachments[]' checked value=\""+s_tmp+"\"/>"; |
---|
| 1349 | divFiles.appendChild(link_attachment); |
---|
| 1350 | } |
---|
| 1351 | } |
---|
[2] | 1352 | var body = Element("body_" + new_border_ID); |
---|
| 1353 | body.contentWindow.document.open(); |
---|
| 1354 | body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>"+data.body+"</body></html>"); |
---|
| 1355 | body.contentWindow.document.close(); |
---|
| 1356 | body.contentWindow.document.designMode = "on"; |
---|
[245] | 1357 | //Focus |
---|
[128] | 1358 | if (is_ie) |
---|
[245] | 1359 | window.setTimeout('document.getElementById("body_'+new_border_ID+'").contentWindow.focus();', 300); |
---|
| 1360 | else |
---|
| 1361 | body.contentWindow.focus(); |
---|
[901] | 1362 | config_events( body.contentWindow.document, 'onkeyup', function( e ) |
---|
| 1363 | { |
---|
| 1364 | if ( e.keyCode == 13 ) |
---|
| 1365 | { |
---|
| 1366 | var paragraphs = body.contentWindow.document.getElementsByTagName( 'p' ); |
---|
| 1367 | for ( p = 0; p < paragraphs.length; p++ ) |
---|
| 1368 | paragraphs.item( p ).style.margin = '0px'; |
---|
| 1369 | } |
---|
| 1370 | }); |
---|
[2] | 1371 | break; |
---|
| 1372 | default: |
---|
| 1373 | } |
---|
[320] | 1374 | |
---|
[836] | 1375 | // IM Module Enabled |
---|
[3035] | 1376 | if( window.parent.loadscript && loadscript.autoStatusIM ) |
---|
[836] | 1377 | { |
---|
[3035] | 1378 | config_events( body.contentWindow.document, "onkeypress", loadscript.autoStatusIM ); |
---|
[836] | 1379 | } |
---|
| 1380 | |
---|
[320] | 1381 | if (preferences.auto_save_draft == 1) |
---|
[827] | 1382 | { |
---|
[649] | 1383 | openTab.autosave_timer[new_border_ID] = false; |
---|
| 1384 | var save_link = document.getElementById("save_message_options"+new_border_ID); |
---|
[320] | 1385 | |
---|
[3035] | 1386 | function auto_sav() |
---|
[827] | 1387 | { |
---|
| 1388 | if (openTab.autosave_timer[new_border_ID]) |
---|
| 1389 | clearTimeout(openTab.autosave_timer[new_border_ID]); |
---|
[320] | 1390 | |
---|
[827] | 1391 | openTab.autosave_timer[new_border_ID] = setTimeout("save_msg("+new_border_ID+")", autosave_time); |
---|
| 1392 | } |
---|
[3035] | 1393 | config_events(body.contentWindow.document,'keypress', auto_sav); |
---|
| 1394 | } |
---|
[320] | 1395 | |
---|
[220] | 1396 | //BEGIN Tab event |
---|
| 1397 | if (preferences.use_shortcuts == '1') |
---|
| 1398 | { |
---|
| 1399 | if (is_ie) |
---|
| 1400 | { |
---|
[245] | 1401 | body.contentWindow.document.attachEvent('onkeydown', function(event) { if(event.keyCode==27){delete_border(new_border_ID,'false');} if(event.keyCode==9) { Element('to_'+new_border_ID).focus(); Element('send_button_'+new_border_ID).focus(); return false;} }, false); |
---|
[220] | 1402 | } |
---|
| 1403 | else |
---|
| 1404 | { |
---|
[245] | 1405 | body.contentWindow.document.addEventListener('keypress', function(event) { if(event.keyCode==27){delete_border(new_border_ID,'false');} if(event.keyCode==9) { Element('send_button_'+new_border_ID).focus(); event.preventDefault(); } }, false); |
---|
[220] | 1406 | } |
---|
| 1407 | } |
---|
| 1408 | // END Tab event |
---|
[3035] | 1409 | |
---|
[3336] | 1410 | // Load default style for <PRE> tag, inside RichTextEditor. |
---|
| 1411 | RichTextEditor.loadStyle("pre","main.css"); |
---|
[3035] | 1412 | |
---|
[3336] | 1413 | Element("border_id_" + new_border_ID).title = title; |
---|
[3372] | 1414 | set_border_caption("border_id_" + new_border_ID, title); |
---|
[3035] | 1415 | |
---|
[3400] | 1416 | if(!expresso_offline && preferences.use_SpellChecker != '0') |
---|
| 1417 | setupSpellChecker(); |
---|
| 1418 | |
---|
[603] | 1419 | return new_border_ID; //Preciso retornar o ID da nova mensagem. |
---|
[2] | 1420 | } |
---|
| 1421 | |
---|
[3387] | 1422 | function useOriginalAttachments(new_id_border,old_id_border,is_local) |
---|
[799] | 1423 | { |
---|
| 1424 | var divFiles = Element("divFiles_"+new_id_border); |
---|
| 1425 | if (Element("attachments_" + old_id_border)) { |
---|
| 1426 | var areaOldAttachments = document.createElement("DIV"); |
---|
| 1427 | areaOldAttachments.id = "area_div_attachments_"+new_id_border; |
---|
| 1428 | divFiles.appendChild(areaOldAttachments); |
---|
| 1429 | var optAttachments = document.createElement("A"); |
---|
| 1430 | optAttachments.setAttribute("href","javascript:void(0)"); |
---|
| 1431 | optAttachments.tabIndex = -1; |
---|
| 1432 | optAttachments.innerHTML = get_lang("Original attachments: add")+"</br>"; |
---|
| 1433 | areaOldAttachments.appendChild(optAttachments); |
---|
| 1434 | var divOriginalAttachments = document.createElement("DIV"); |
---|
| 1435 | divOriginalAttachments.id = "div_attachments_"+new_id_border; |
---|
| 1436 | optAttachments.onclick = function(){ |
---|
| 1437 | if(document.getElementById('div_attachments_'+new_id_border)) |
---|
| 1438 | { |
---|
| 1439 | areaOldAttachments.removeChild(document.getElementById('div_attachments_'+new_id_border)); |
---|
| 1440 | optAttachments.innerHTML = get_lang("Original attachments: add")+"</br>"; |
---|
| 1441 | } |
---|
| 1442 | else |
---|
| 1443 | { |
---|
| 1444 | areaOldAttachments.appendChild(divOriginalAttachments); |
---|
| 1445 | optAttachments.innerHTML = get_lang("Original attachments: remove")+"</br>"; |
---|
| 1446 | } |
---|
| 1447 | return false;}; |
---|
[3520] | 1448 | var attachments = document.getElementById("attachments_" + old_id_border).getElementsByTagName("a"); |
---|
[799] | 1449 | for (var i = (attachments.length > 1 ? 1 : 0); i < attachments.length; i++){ |
---|
[3387] | 1450 | if (!is_local) { |
---|
| 1451 | var link_attachment = document.createElement("A"); |
---|
| 1452 | link_attachment.setAttribute("href", attachments[i].href); |
---|
[3520] | 1453 | link_attachment.innerHTML = attachments[i].firstChild.nodeValue + '<br/>'; |
---|
[3387] | 1454 | var tmp = link_attachment.href.replace("javascript:download_attachments(", "").replace(")", ""); |
---|
| 1455 | var a_tmp = tmp.split(','); |
---|
| 1456 | tmp = link_attachment.innerHTML.substring(0,link_attachment.innerHTML.lastIndexOf("(")); |
---|
| 1457 | a_tmp[2] = "'"+tmp.substring(0,tmp.length-1)+"'"; |
---|
| 1458 | s_tmp = trim(escape(connector.serialize(a_tmp))); |
---|
| 1459 | divOriginalAttachments.innerHTML += "<input style='border:0' type='CHECKBOX' name='forwarding_attachments[]' checked value=\""+s_tmp+"\"/>"; |
---|
| 1460 | divOriginalAttachments.appendChild(link_attachment); |
---|
| 1461 | } |
---|
| 1462 | else { |
---|
| 1463 | document.getElementById("is_local_forward"+new_id_border).value = "1"; |
---|
| 1464 | var link = attachments[i].href.replace("javascript:download_local_attachment('", "").replace("')", ""); |
---|
| 1465 | var name = attachments[i].innerHTML.substring(0, attachments[i].innerHTML.lastIndexOf("(")); |
---|
| 1466 | var campo_arquivo = addForwardedFile(new_id_border, name, attachments[i].href, divOriginalAttachments); |
---|
| 1467 | expresso_local_messages.getInputFileFromAnexo(campo_arquivo, link); |
---|
| 1468 | } |
---|
[799] | 1469 | } |
---|
| 1470 | } |
---|
| 1471 | } |
---|
| 1472 | |
---|
[2] | 1473 | function send_message_return(data, ID){ |
---|
[3035] | 1474 | watch_changes_in_msg(ID); |
---|
[1035] | 1475 | |
---|
[3035] | 1476 | var sign = false; |
---|
[1035] | 1477 | var crypt = false; |
---|
[3035] | 1478 | if ((preferences.use_assinar_criptografar != '0') && (preferences.use_signature_digital_cripto != '0')){ |
---|
[1035] | 1479 | var checkSign = document.getElementById('return_digital_'+ID) |
---|
| 1480 | if (checkSign.checked){ |
---|
| 1481 | sign = true; |
---|
| 1482 | } |
---|
| 1483 | |
---|
| 1484 | var checkCript = document.getElementById('return_cripto_'+ID); |
---|
| 1485 | if (checkCript.checked){ |
---|
| 1486 | crypt = true; |
---|
| 1487 | } |
---|
| 1488 | } |
---|
| 1489 | |
---|
[3035] | 1490 | if (typeof(data) == 'object' && !data.success) |
---|
[1035] | 1491 | { |
---|
[3035] | 1492 | connector = new cConnector(); |
---|
| 1493 | connector.showProgressBar(); |
---|
[1035] | 1494 | |
---|
[3035] | 1495 | if (sign || crypt){ |
---|
| 1496 | var operation = ''; |
---|
[1035] | 1497 | if (sign){ |
---|
| 1498 | operation = 'sign'; |
---|
| 1499 | } |
---|
| 1500 | else { // crypt |
---|
[3035] | 1501 | //TODO: Colocar mensagem de erro, e finalizar o método. |
---|
[1035] | 1502 | operation = 'nop'; |
---|
| 1503 | } |
---|
[3035] | 1504 | } |
---|
[1035] | 1505 | |
---|
[3035] | 1506 | if (data.body){ |
---|
| 1507 | Element('cert_applet').doButtonClickAction(operation, ID, data.body); |
---|
| 1508 | } |
---|
| 1509 | else { |
---|
[1035] | 1510 | alert(data.error); |
---|
| 1511 | } |
---|
| 1512 | |
---|
| 1513 | return; |
---|
[3035] | 1514 | } |
---|
[485] | 1515 | if(data && data.success == true ){ |
---|
[2] | 1516 | // if send ok, set a flag as answered or forwarded |
---|
| 1517 | var msg_number_replied = Element('msg_reply_from_'+ID); |
---|
| 1518 | var msg_number_forwarded = Element('msg_forward_from_'+ID); |
---|
| 1519 | |
---|
| 1520 | if (msg_number_replied){ |
---|
[1121] | 1521 | proxy_mensagens.proxy_set_message_flag(msg_number_replied.value, 'answered'); |
---|
[2] | 1522 | } |
---|
| 1523 | else if (msg_number_forwarded){ |
---|
[1121] | 1524 | proxy_mensagens.proxy_set_message_flag(msg_number_forwarded.value, 'forwarded'); |
---|
[2] | 1525 | } |
---|
[1121] | 1526 | if(expresso_offline){ |
---|
| 1527 | write_msg(get_lang('Your message was sent to queue')); |
---|
| 1528 | delete_border(ID,'true'); |
---|
| 1529 | return; |
---|
[2] | 1530 | }else{ |
---|
[1121] | 1531 | if (wfolders.alert) { |
---|
| 1532 | write_msg(get_lang('Your message was sent and save.')); |
---|
| 1533 | wfolders.alert = false; |
---|
| 1534 | } |
---|
| 1535 | else { |
---|
| 1536 | write_msg(get_lang('Your message was sent.')); |
---|
| 1537 | } |
---|
[2] | 1538 | } |
---|
[485] | 1539 | // If new dynamic contacts were added, update the autocomplete .... |
---|
| 1540 | if(data.new_contacts){ |
---|
| 1541 | var ar_contacts = data.new_contacts.split(',;'); |
---|
| 1542 | for(var j in ar_contacts){ |
---|
| 1543 | // If the dynamic contact don't exist, update the autocomplete.... |
---|
| 1544 | if((contacts+",").indexOf(";"+ar_contacts[j]+",") == -1) |
---|
| 1545 | contacts += ",;" + ar_contacts[j]; |
---|
| 1546 | } |
---|
| 1547 | } |
---|
[605] | 1548 | if ((! openTab.toPreserve[ID]) && (openTab.imapUid[ID] != 0)) |
---|
| 1549 | cExecute ("$this.imap_functions.delete_msgs&folder="+openTab.imapBox[ID]+"&msgs_number="+openTab.imapUid[ID],function(data){ return }); |
---|
[649] | 1550 | delete_border(ID,'true'); // Becarefull: email saved automatically should be deleted. delete_border erase information about openTab |
---|
| 1551 | } |
---|
| 1552 | else{ |
---|
[504] | 1553 | if(data == 'Post-Content-Length') |
---|
[65] | 1554 | write_msg(get_lang('The size of this message has exceeded the limit (%1B).',Element('upload_max_filesize').value)); |
---|
[504] | 1555 | else if(data) |
---|
| 1556 | write_msg(data); |
---|
[2] | 1557 | else |
---|
[504] | 1558 | write_msg(get_lang("Connection failed with %1 Server. Try later.", "Web")); |
---|
[3509] | 1559 | |
---|
| 1560 | var save_link = Element("save_message_options_"+ID); |
---|
| 1561 | save_link.onclick = function onclick(event) { openTab.toPreserve[ID] = true; save_msg(ID); } ; |
---|
| 1562 | save_link.className = 'message_options'; |
---|
[2] | 1563 | } |
---|
[1121] | 1564 | if(!expresso_offline) |
---|
| 1565 | connector.hideProgressBar(); |
---|
[2] | 1566 | } |
---|
| 1567 | |
---|
[1629] | 1568 | /** |
---|
| 1569 | * Método chamado pela applet para retornar o resultado da assinatura/decifragem do e-mail. |
---|
| 1570 | * para posterior envio ao servidor. |
---|
| 1571 | * @author Mário César Kolling <mario.kolling@serpro.gov.br>, Bruno Vieira da Costa <bruno.vieira-costa@serpro.gov.br> |
---|
| 1572 | * @param smime O e-mail decifrado/assinado |
---|
| 1573 | * @param ID O ID do e-mail, para saber em que aba esse e-mail será mostrado. |
---|
| 1574 | * @param operation A operação que foi realizada pela applet (assinatura ou decifragem) |
---|
| 1575 | */ |
---|
[1035] | 1576 | function appletReturn(smime, ID, operation, folder){ |
---|
[1629] | 1577 | |
---|
[3035] | 1578 | if (!smime){ // Erro aconteceu ao assinar ou decifrar e-mail |
---|
| 1579 | connector = new cConnector(); |
---|
| 1580 | connector.hideProgressBar(); |
---|
| 1581 | return; |
---|
| 1582 | } |
---|
[1629] | 1583 | |
---|
[1035] | 1584 | if(operation=='decript') |
---|
| 1585 | { |
---|
| 1586 | var handler = function(data){ |
---|
| 1587 | |
---|
| 1588 | if(data.msg_day == '') |
---|
| 1589 | { |
---|
[3035] | 1590 | header=expresso_local_messages.get_msg_date(data.original_ID, proxy_mensagens.is_local_folder(get_current_folder())); |
---|
[1035] | 1591 | |
---|
| 1592 | data.fulldate=header.fulldate; |
---|
| 1593 | data.smalldate=header.smalldate; |
---|
| 1594 | data.msg_day = header.msg_day; |
---|
| 1595 | data.msg_hour = header.msg_hour; |
---|
| 1596 | |
---|
| 1597 | } |
---|
| 1598 | this.show_msg(data); |
---|
| 1599 | } |
---|
| 1600 | para="&source="+smime+"&ID="+ID+"&folder="+folder; |
---|
| 1601 | cExecute ("$this.imap_functions.show_decript&", handler, para); |
---|
| 1602 | }else |
---|
| 1603 | { |
---|
[3035] | 1604 | ID_tmp = ID; |
---|
| 1605 | // Lê a variável e chama a nova função cExecuteForm |
---|
| 1606 | // Processa e envia para o servidor web |
---|
| 1607 | // Faz o request do connector novamente. Talvez implementar no connector |
---|
| 1608 | // para manter coerência. |
---|
[1035] | 1609 | |
---|
[3035] | 1610 | var handler_send_smime = function(data){ |
---|
| 1611 | send_message_return(data, this.ID_tmp); // this is a hack to escape quotation form connector bug |
---|
| 1612 | }; |
---|
[1035] | 1613 | |
---|
[3035] | 1614 | var textArea = document.createElement("TEXTAREA"); |
---|
| 1615 | textArea.style.display='none'; |
---|
| 1616 | textArea.id = 'smime'; |
---|
| 1617 | textArea.name = "smime"; |
---|
| 1618 | textArea.value += smime; |
---|
[1035] | 1619 | |
---|
[3035] | 1620 | // Lê a variável e chama a nova função cExecuteForm |
---|
| 1621 | // Processa e envia para o servidor web |
---|
| 1622 | // Faz o request do connector novamente. Talvez implementar no connector |
---|
| 1623 | // para manter coerência. |
---|
| 1624 | if (is_ie){ |
---|
| 1625 | var i = 0; |
---|
| 1626 | while (document.forms(i).name != "form_message_"+ID){i++} |
---|
| 1627 | form = document.forms(i); |
---|
| 1628 | } |
---|
| 1629 | else |
---|
| 1630 | form = document.forms["form_message_"+ID]; |
---|
[1035] | 1631 | |
---|
[3035] | 1632 | form.appendChild(textArea); |
---|
[1035] | 1633 | |
---|
[3035] | 1634 | cExecuteForm ("$this.imap_functions.send_mail", form, handler_send_smime, ID); |
---|
| 1635 | } |
---|
[1035] | 1636 | } |
---|
| 1637 | |
---|
[2] | 1638 | function send_message(ID, folder, folder_name){ |
---|
[3035] | 1639 | |
---|
[1398] | 1640 | //limpa autosave_timer[ID]; havia conflito quando uma mensagem ia ser enviada e nesse exato momento o autosave |
---|
[3035] | 1641 | //entrava em execucao (a aba de edicao da mensagem continuava aberta e a mensagem exibida era a de que a mensagem foi |
---|
| 1642 | //salva na pasta Rascunhos e nao que tinha sido enviada, como deveria); |
---|
| 1643 | if (preferences.auto_save_draft == 1) |
---|
[1398] | 1644 | { |
---|
| 1645 | if (openTab.autosave_timer[ID]) |
---|
| 1646 | { |
---|
| 1647 | clearTimeout(openTab.autosave_timer[ID]); |
---|
| 1648 | } |
---|
| 1649 | } |
---|
| 1650 | |
---|
[4366] | 1651 | if ( document.getElementById('viewsource_rt_checkbox_' + ID).checked == true ) |
---|
| 1652 | document.getElementById('viewsource_rt_checkbox_' + ID).click(); |
---|
[834] | 1653 | |
---|
[605] | 1654 | var save_link = Element("save_message_options_"+ID); |
---|
[271] | 1655 | save_link.onclick = ''; |
---|
[835] | 1656 | save_link.className = 'message_options_inactive'; |
---|
[3035] | 1657 | |
---|
[2] | 1658 | ID_tmp = ID; |
---|
[271] | 1659 | |
---|
[2] | 1660 | var handler_send_message = function(data){ |
---|
[271] | 1661 | send_message_return(data, this.ID_tmp); // this is a hack to escape quotation form connector bug |
---|
| 1662 | }; |
---|
[3035] | 1663 | |
---|
[4366] | 1664 | var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + ID ); |
---|
| 1665 | mail_as_plain = ( mail_as_plain ) ? mail_as_plain.checked : false; |
---|
| 1666 | |
---|
[2] | 1667 | var textArea = document.createElement("TEXTAREA"); |
---|
| 1668 | textArea.style.display='none'; |
---|
| 1669 | textArea.name = "body"; |
---|
| 1670 | body = document.getElementById("body_"+ID); |
---|
[4374] | 1671 | textArea.value = ( ( mail_as_plain ) ? body.previousSibling.value : ( '<body>\r\n' + body.contentWindow.document.body.innerHTML + '\r\n</body>' ) ); |
---|
[2] | 1672 | var input_folder = document.createElement("INPUT"); |
---|
| 1673 | input_folder.style.display='none'; |
---|
| 1674 | input_folder.name = "folder"; |
---|
| 1675 | input_folder.value = folder; |
---|
[271] | 1676 | var msg_id = document.createElement("INPUT"); |
---|
| 1677 | msg_id.style.display='none'; |
---|
| 1678 | msg_id.name = "msg_id"; |
---|
[605] | 1679 | msg_id.value = openTab.imapUid[ID]; |
---|
[3035] | 1680 | |
---|
[2] | 1681 | if (is_ie){ |
---|
| 1682 | var i = 0; |
---|
| 1683 | while (document.forms(i).name != "form_message_"+ID){i++} |
---|
| 1684 | form = document.forms(i); |
---|
| 1685 | } |
---|
| 1686 | else |
---|
| 1687 | form = document.forms["form_message_"+ID]; |
---|
[1632] | 1688 | |
---|
[3035] | 1689 | // Evita que e-mails assinados sejam enviados quando o usuário tenta enviar um e-mail |
---|
| 1690 | // não assinado (desmarcou a opção) após tentar enviar um e-mail assinado que não passou |
---|
| 1691 | // no teste de validação. |
---|
| 1692 | var checkSign = document.getElementById('return_digital_'+ID); |
---|
| 1693 | if (checkSign && !checkSign.checked){ |
---|
| 1694 | var smime = Element('smime'); |
---|
| 1695 | if (smime) |
---|
| 1696 | { |
---|
| 1697 | var parent = smime.parentNode; |
---|
| 1698 | parent.removeChild(smime); |
---|
| 1699 | } |
---|
| 1700 | } |
---|
[1632] | 1701 | |
---|
[2] | 1702 | form.appendChild(textArea); |
---|
| 1703 | form.appendChild(input_folder); |
---|
[271] | 1704 | form.appendChild(msg_id); |
---|
[2] | 1705 | |
---|
[4389] | 1706 | var mail_type = document.createElement('input'); |
---|
| 1707 | mail_type.setAttribute('type', 'hidden'); |
---|
[4366] | 1708 | mail_type.name = 'type'; |
---|
| 1709 | mail_type.value = ( mail_as_plain ) ? 'plain' : 'html'; |
---|
[4389] | 1710 | form.parentNode.appendChild(mail_type); |
---|
[4366] | 1711 | |
---|
[2] | 1712 | var _subject = trim(Element("subject_"+ID).value); |
---|
| 1713 | if((_subject.length == 0) && !confirm(get_lang("Send this message without a subject?"))) { |
---|
| 1714 | Element("subject_"+ID).focus(); |
---|
| 1715 | return; |
---|
| 1716 | } |
---|
[3035] | 1717 | |
---|
| 1718 | if (expresso_offline) { |
---|
[1121] | 1719 | stringEmail = Element("to_"+ID).value; |
---|
| 1720 | stringEmail += Element("cco_"+ID).value =='' ? "":", "+Element("cco_"+ID).value; |
---|
| 1721 | stringEmail += Element("cc_"+ID).value =='' ? "":", "+Element("cc_"+ID).value; |
---|
[3227] | 1722 | var invalidEmail = searchEmail(stringEmail); |
---|
[1121] | 1723 | if(Element("to_"+ID).value=="" && Element("cco_"+ID).value=="" && Element("cc_"+ID).value=="") { |
---|
| 1724 | write_msg(get_lang("message without receiver.")); |
---|
| 1725 | return; |
---|
| 1726 | }else if(invalidEmail[0] == true){ |
---|
| 1727 | write_msg("Os endereços de destinatário a seguir estão incorretos: "+invalidEmail[1]); |
---|
| 1728 | return; |
---|
| 1729 | } |
---|
| 1730 | |
---|
| 1731 | sucess = expresso_local_messages.send_to_queue(form); |
---|
| 1732 | var data_return = new Array(); |
---|
| 1733 | data_return.success = sucess; |
---|
| 1734 | handler_send_message(data_return,ID); |
---|
| 1735 | } |
---|
[3035] | 1736 | else |
---|
[1121] | 1737 | cExecuteForm("$this.imap_functions.send_mail", form, handler_send_message, ID); |
---|
[2] | 1738 | } |
---|
[1318] | 1739 | function change_tr_properties(tr_element, newUid, newSubject){ |
---|
[1319] | 1740 | message_id=tr_element.id; |
---|
| 1741 | var td_who = document.getElementById('td_who_'+message_id); |
---|
| 1742 | if (typeof(newSubject) != 'undefined') |
---|
| 1743 | td_who.nextSibling.innerHTML = newSubject; |
---|
[1318] | 1744 | tr_element.id = newUid; |
---|
[2] | 1745 | |
---|
[1318] | 1746 | var openNewMessage = function () { |
---|
| 1747 | cExecute("$this.imap_functions.get_info_msg&msg_number="+newUid |
---|
[1691] | 1748 | +"&msg_folder="+url_encode(current_folder),show_msg); |
---|
[1318] | 1749 | }; |
---|
| 1750 | for (var i=2; i < 10; i++){ |
---|
[1319] | 1751 | if (typeof(tr_element.childNodes[i].id) != "undefined") |
---|
| 1752 | tr_element.childNodes[i].id = tr_element.childNodes[i].id.replace(message_id,newUid); |
---|
[1318] | 1753 | tr_element.childNodes[i].onclick = openNewMessage; |
---|
| 1754 | } |
---|
| 1755 | } |
---|
| 1756 | |
---|
[271] | 1757 | function return_save(data,border_id,folder_name,folder_id,message_id) |
---|
| 1758 | { |
---|
[3035] | 1759 | Element("send_button_"+border_id).style.visibility="visible"; |
---|
[271] | 1760 | var handler_delete_msg = function(data){ refresh(preferences.alert_new_msg); }; |
---|
| 1761 | |
---|
[320] | 1762 | if (data.append != true || !data) |
---|
| 1763 | { |
---|
| 1764 | RichTextEditor.saveFlag = -1; |
---|
| 1765 | if (! data.append) |
---|
[3868] | 1766 | if(data == 'Post-Content-Length') |
---|
| 1767 | write_msg(get_lang('The size of this message has exceeded the limit (%1B).', preferences.max_attachment_size ? preferences.max_attachment_size : Element('upload_max_filesize').value)); |
---|
| 1768 | else |
---|
| 1769 | write_msg(get_lang('ERROR saving your message.')); |
---|
[320] | 1770 | else |
---|
| 1771 | { |
---|
| 1772 | if (data.append.match(/^(.*)TRYCREATE(.*)$/)) |
---|
| 1773 | { |
---|
| 1774 | connector.loadScript('TreeS'); |
---|
| 1775 | alert(get_lang('There is not %1 folder, Expresso is creating it for you... Please, repeat your request later.',draftsfolder)); |
---|
| 1776 | connector.loadScript('TreeShow'); |
---|
| 1777 | ttree.FOLDER = 'root'; |
---|
| 1778 | ttreeBox.new_past(draftsfolder); |
---|
| 1779 | setTimeout('save_msg('+border_id+')',3000); |
---|
| 1780 | } |
---|
| 1781 | else |
---|
| 1782 | write_msg(data.append); |
---|
| 1783 | } |
---|
| 1784 | } |
---|
[271] | 1785 | else |
---|
| 1786 | { |
---|
[320] | 1787 | RichTextEditor.saveFlag = 1; |
---|
[605] | 1788 | openTab.imapUid[border_id] = data.msg_no; |
---|
| 1789 | openTab.imapBox[border_id] = data.folder_id; |
---|
[3035] | 1790 | |
---|
[271] | 1791 | var newTitle = document.getElementById('subject_'+border_id).value; |
---|
[3372] | 1792 | if (newTitle == '') |
---|
| 1793 | newTitle = get_lang("No subject"); |
---|
| 1794 | set_border_caption('border_id_'+border_id, newTitle); |
---|
[3035] | 1795 | |
---|
[271] | 1796 | // Replace the embedded images for new uids |
---|
| 1797 | var mainField = document.getElementById('body_'+border_id).contentWindow; |
---|
| 1798 | var content_body = mainField.document.getElementsByTagName('body').item(0).innerHTML; |
---|
| 1799 | var body_images = content_body.match(/msg_num=\d*/g); |
---|
[320] | 1800 | var images_part = content_body.match(/msg_part=\d*/g); |
---|
[271] | 1801 | if (body_images) |
---|
| 1802 | { |
---|
| 1803 | for (var i=0; i<body_images.length; i++){ |
---|
[605] | 1804 | content_body = content_body.replace(body_images[i],"msg_num="+openTab.imapUid[border_id]); |
---|
[271] | 1805 | } |
---|
[320] | 1806 | var allImgs = new Array (images_part.length); |
---|
| 1807 | var j=-1; |
---|
| 1808 | for (var i in images_part){ |
---|
[3035] | 1809 | |
---|
[320] | 1810 | if (is_ie) |
---|
| 1811 | if (i == 0) |
---|
| 1812 | var image_number = parseInt(images_part[i].substr(9)); |
---|
| 1813 | else |
---|
| 1814 | image_number = "null"; |
---|
| 1815 | else |
---|
| 1816 | var image_number = parseInt(images_part[i].substr(9)); |
---|
[3035] | 1817 | |
---|
[320] | 1818 | if (! isNaN(image_number)) |
---|
| 1819 | { |
---|
| 1820 | if (! allImgs[image_number]) |
---|
| 1821 | { |
---|
| 1822 | allImgs[image_number] = true; |
---|
[3035] | 1823 | j--; |
---|
[320] | 1824 | } |
---|
| 1825 | content_body = content_body.replace(images_part[i],'msg_part='+j); |
---|
| 1826 | } |
---|
| 1827 | } |
---|
| 1828 | content_body = content_body.replace(/msg_part=-/g,'msg_part='); |
---|
[3035] | 1829 | |
---|
[271] | 1830 | mainField.document.getElementsByTagName('body').item(0).innerHTML = content_body; |
---|
[3035] | 1831 | } |
---|
| 1832 | |
---|
[271] | 1833 | //Replace all files to new files |
---|
| 1834 | var divFiles = Element("divFiles_"+border_id); |
---|
[1989] | 1835 | elFiles = divFiles.getElementsByTagName("input"); |
---|
| 1836 | var countCheck =0; |
---|
| 1837 | for (var i=0; i<elFiles.length; i++) { |
---|
| 1838 | if(elFiles[i].value !=""){ |
---|
| 1839 | if (elFiles[i].type == "checkbox") { |
---|
[3035] | 1840 | countCheck++; |
---|
[1989] | 1841 | } |
---|
| 1842 | else { |
---|
| 1843 | elFiles[i].value =""; |
---|
| 1844 | parantNodeFile = elFiles[i].parentNode.parentNode; |
---|
| 1845 | parantNodeFile.removeChild(elFiles[i].parentNode); |
---|
| 1846 | i--; |
---|
| 1847 | } |
---|
[3035] | 1848 | |
---|
[1989] | 1849 | } |
---|
[3035] | 1850 | }; |
---|
| 1851 | |
---|
[271] | 1852 | var attach_files = connector.unserialize(data.files); |
---|
| 1853 | if (attach_files != null) { |
---|
[605] | 1854 | openTab.countFile[border_id] = attach_files.length; |
---|
[1989] | 1855 | att_index = countCheck; |
---|
| 1856 | for (att_index; att_index < attach_files.length; att_index++){ |
---|
[3035] | 1857 | |
---|
[271] | 1858 | var link_attachment = document.createElement("A"); |
---|
| 1859 | var fileName = attach_files[att_index].substr(0,attach_files[att_index].indexOf('_SIZE_')); |
---|
| 1860 | var fileSize = parseInt(attach_files[att_index].substr(attach_files[att_index].indexOf('_SIZE_')+6))/1024 |
---|
[3028] | 1861 | link_attachment.innerHTML = fileName + " ("+borkb((parseInt(fileSize)*1024))+")"; |
---|
[271] | 1862 | |
---|
| 1863 | var href = "'"+folder_id+"','"+data.msg_no+"','"+(att_index)+"','"+(att_index+2)+"','base64'"; |
---|
| 1864 | |
---|
| 1865 | link_attachment.setAttribute("href", "javascript:download_attachments("+href+")"); |
---|
| 1866 | |
---|
| 1867 | var a_tmp = href.split(','); |
---|
| 1868 | a_tmp[2] = fileName; |
---|
| 1869 | s_tmp = escape(connector.serialize(a_tmp)); |
---|
[3035] | 1870 | |
---|
[271] | 1871 | var check_attachment = document.createElement("INPUT"); |
---|
| 1872 | check_attachment.type = 'CHECKBOX'; |
---|
| 1873 | check_attachment.name = 'forwarding_attachments[]'; |
---|
[3137] | 1874 | check_attachment.value = trim(s_tmp); |
---|
[271] | 1875 | |
---|
[3427] | 1876 | if (!divFiles.childNodes[0]) |
---|
| 1877 | { |
---|
| 1878 | divFiles.appendChild(document.createElement("BR")); |
---|
| 1879 | } |
---|
| 1880 | else |
---|
| 1881 | { |
---|
| 1882 | divFiles.insertBefore(document.createElement("BR"),divFiles.childNodes[0]); |
---|
| 1883 | } |
---|
[271] | 1884 | |
---|
[3427] | 1885 | divFiles.insertBefore(link_attachment,divFiles.childNodes[0]); |
---|
| 1886 | divFiles.insertBefore(check_attachment,divFiles.childNodes[0]); |
---|
| 1887 | |
---|
[271] | 1888 | check_attachment.checked = true; |
---|
[2] | 1889 | } |
---|
| 1890 | } |
---|
[271] | 1891 | if (message_id) |
---|
[673] | 1892 | { |
---|
[605] | 1893 | cExecute ("$this.imap_functions.delete_msgs&folder="+openTab.imapBox[border_id]+"&msgs_number="+message_id,handler_delete_msg); |
---|
[673] | 1894 | if (openTab.imapBox[0] == "INBOX/"+draftsfolder) |
---|
| 1895 | { |
---|
| 1896 | //Update mailbox |
---|
[3035] | 1897 | var tr_msg = document.getElementById(message_id); |
---|
[673] | 1898 | change_tr_properties(tr_msg, data.msg_no, data.subject); |
---|
| 1899 | } |
---|
[3955] | 1900 | } else { |
---|
| 1901 | refresh(); |
---|
| 1902 | } |
---|
[3035] | 1903 | |
---|
[605] | 1904 | var save_link = Element("save_message_options_"+border_id); |
---|
[271] | 1905 | save_link.onclick = ''; |
---|
[835] | 1906 | save_link.className = 'message_options_inactive'; |
---|
[271] | 1907 | watch_changes_in_msg(border_id); |
---|
[325] | 1908 | write_msg(get_lang('Your message was save as draft in folder %1.', lang_folder(folder_name))); |
---|
[3035] | 1909 | } |
---|
[271] | 1910 | } |
---|
| 1911 | |
---|
[1005] | 1912 | function save_msg(border_id,withImage){ |
---|
| 1913 | if (typeof(withImage) == 'undefined') |
---|
| 1914 | withImage = false; |
---|
| 1915 | |
---|
[4374] | 1916 | var rt_checkbox = Element('viewsource_rt_checkbox_' + border_id); |
---|
[834] | 1917 | if (rt_checkbox == null) |
---|
| 1918 | return false; |
---|
| 1919 | if (rt_checkbox.checked == true) |
---|
| 1920 | rt_checkbox.click(); |
---|
| 1921 | |
---|
[649] | 1922 | var sendButton = Element("send_button_"+border_id); |
---|
| 1923 | if (sendButton) |
---|
| 1924 | sendButton.style.visibility="hidden"; |
---|
[320] | 1925 | |
---|
[3143] | 1926 | if (openTab.imapBox[border_id] && openTab.type[border_id] < 6) //Gets the imap folder |
---|
[605] | 1927 | var folder_id = openTab.imapBox[border_id]; |
---|
[271] | 1928 | else |
---|
[1005] | 1929 | var folder_id = "INBOX/"+draftsfolder; |
---|
[271] | 1930 | |
---|
| 1931 | if (folder_id == 'INBOX') // and folder name from border |
---|
| 1932 | var folder_name = get_lang(folder_id); |
---|
| 1933 | else |
---|
| 1934 | var folder_name = folder_id.substr(6); |
---|
[3035] | 1935 | |
---|
[271] | 1936 | // hack to avoid form connector bug, escapes quotation. Please see #179 |
---|
| 1937 | tmp_border_id=border_id; |
---|
| 1938 | tmp_folder_name=folder_name; |
---|
| 1939 | tmp_folder_id=folder_id; |
---|
[605] | 1940 | message_id = openTab.imapUid[border_id]; |
---|
[271] | 1941 | var handler_save_msg = function(data){ return_save(data,this.tmp_border_id,this.tmp_folder_name,this.tmp_folder_id,this.message_id); } |
---|
[320] | 1942 | |
---|
[4374] | 1943 | var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + border_id ); |
---|
| 1944 | mail_as_plain = ( mail_as_plain ) ? mail_as_plain.checked : false; |
---|
| 1945 | |
---|
[271] | 1946 | var textArea = document.createElement("TEXTAREA"); |
---|
| 1947 | textArea.style.display='none'; |
---|
| 1948 | textArea.name = "body"; |
---|
| 1949 | body = document.getElementById("body_"+border_id); |
---|
[320] | 1950 | if (! body) |
---|
| 1951 | return; |
---|
[4374] | 1952 | textArea.value = ( ( mail_as_plain ) ? body.previousSibling.value : ( '<body>\r\n' + body.contentWindow.document.body.innerHTML + '\r\n</body>' ) ); |
---|
[271] | 1953 | var input_folder = document.createElement("INPUT"); |
---|
| 1954 | input_folder.style.display='none'; |
---|
| 1955 | input_folder.name = "folder"; |
---|
| 1956 | input_folder.value = folder_id; |
---|
[320] | 1957 | var input_msgid = document.createElement("INPUT"); |
---|
| 1958 | input_msgid.style.display='none'; |
---|
| 1959 | input_msgid.name = "msg_id"; |
---|
| 1960 | input_msgid.value = message_id; |
---|
[1005] | 1961 | var input_insertImg = document.createElement("INPUT"); |
---|
| 1962 | input_insertImg.style.display='none'; |
---|
| 1963 | input_insertImg.name = "insertImg"; |
---|
| 1964 | input_insertImg.value = withImage; |
---|
| 1965 | |
---|
[3035] | 1966 | |
---|
[271] | 1967 | if (is_ie){ |
---|
| 1968 | var i = 0; |
---|
| 1969 | while (document.forms(i).name != "form_message_"+border_id){i++} |
---|
| 1970 | form = document.forms(i); |
---|
| 1971 | } |
---|
| 1972 | else |
---|
| 1973 | form = document.forms["form_message_"+border_id]; |
---|
| 1974 | form.appendChild(textArea); |
---|
| 1975 | form.appendChild(input_folder); |
---|
[320] | 1976 | form.appendChild(input_msgid); |
---|
[1005] | 1977 | form.appendChild(input_insertImg); |
---|
[271] | 1978 | |
---|
[4389] | 1979 | var mail_type = document.createElement('input'); |
---|
[4374] | 1980 | mail_type.name = 'type'; |
---|
[4389] | 1981 | mail_type.setAttribute('type', 'hidden'); |
---|
[4374] | 1982 | mail_type.value = ( mail_as_plain ) ? 'plain' : 'html'; |
---|
[4389] | 1983 | form.parentNode.appendChild(mail_type); |
---|
[4374] | 1984 | |
---|
[3035] | 1985 | cExecuteForm ("$this.imap_functions.save_msg", form, handler_save_msg,border_id); |
---|
[271] | 1986 | } |
---|
| 1987 | |
---|
| 1988 | function return_saveas(data,border_id,folder_name) |
---|
| 1989 | { |
---|
| 1990 | if(!verify_session(data)) |
---|
| 1991 | return; |
---|
| 1992 | if (data.append) |
---|
| 1993 | { |
---|
| 1994 | delete_border(border_id,null); |
---|
| 1995 | write_msg(get_lang('Your message was save as draft in folder %1.', folder_name)); |
---|
| 1996 | } |
---|
| 1997 | else |
---|
[3035] | 1998 | write_msg('ERROR saving your message.'); |
---|
[271] | 1999 | } |
---|
| 2000 | |
---|
| 2001 | |
---|
| 2002 | function save_as_msg(border_id, folder_id, folder_name){ |
---|
| 2003 | // hack to avoid form connector bug, escapes quotation. Please see #179 |
---|
| 2004 | tmp_border_id=border_id; |
---|
| 2005 | tmp_folder_name=folder_name; |
---|
[3035] | 2006 | var handler_save_msg = function(data){ return_saveas(data,this.tmp_border_id,this.tmp_folder_name); } |
---|
[271] | 2007 | var textArea = document.createElement("TEXTAREA"); |
---|
| 2008 | textArea.style.display='none'; |
---|
| 2009 | textArea.name = "body"; |
---|
| 2010 | body = document.getElementById("body_"+border_id); |
---|
| 2011 | textArea.value += '<body>\r\n'; |
---|
| 2012 | textArea.value += body.contentWindow.document.body.innerHTML; |
---|
| 2013 | textArea.value += '\r\n</body>'; |
---|
[3035] | 2014 | |
---|
[271] | 2015 | var input_folder = document.createElement("INPUT"); |
---|
| 2016 | input_folder.style.display='none'; |
---|
| 2017 | input_folder.name = "folder"; |
---|
| 2018 | input_folder.value = folder_id; |
---|
[3035] | 2019 | |
---|
[271] | 2020 | if (is_ie){ |
---|
| 2021 | var i = 0; |
---|
| 2022 | while (document.forms(i).name != "form_message_"+border_id){i++} |
---|
| 2023 | form = document.forms(i); |
---|
| 2024 | } |
---|
| 2025 | else |
---|
| 2026 | form = document.forms["form_message_"+border_id]; |
---|
| 2027 | form.appendChild(textArea); |
---|
| 2028 | form.appendChild(input_folder); |
---|
[3035] | 2029 | |
---|
[271] | 2030 | cExecuteForm ("$this.imap_functions.save_msg", form, handler_save_msg,border_id); |
---|
[2] | 2031 | } |
---|
| 2032 | |
---|
[271] | 2033 | |
---|
[2] | 2034 | // Get checked messages |
---|
| 2035 | function set_messages_flag(flag, msgs_to_set){ |
---|
| 2036 | var handler_set_messages_flag = function (data){ |
---|
| 2037 | if(!verify_session(data)) |
---|
| 2038 | return; |
---|
| 2039 | var msgs_to_set = data.msgs_to_set.split(","); |
---|
[649] | 2040 | |
---|
[614] | 2041 | if(!data.status) { |
---|
[3806] | 2042 | write_msg(data.msg); |
---|
[614] | 2043 | Element('chk_box_select_all_messages').checked = false; |
---|
| 2044 | for (var i = 0; i < msgs_to_set.length; i++) { |
---|
| 2045 | Element("check_box_message_" + msgs_to_set[i]).checked = false; |
---|
| 2046 | remove_className(Element(msgs_to_set[i]), 'selected_msg'); |
---|
| 2047 | } |
---|
[659] | 2048 | if(!data.msgs_unflageds) |
---|
| 2049 | return; |
---|
| 2050 | else |
---|
| 2051 | msgs_to_set = data.msgs_unflageds.split(","); |
---|
[614] | 2052 | } |
---|
[2] | 2053 | |
---|
| 2054 | for (var i=0; i<msgs_to_set.length; i++){ |
---|
[3032] | 2055 | if (preferences.use_cache == 'True') |
---|
| 2056 | { |
---|
| 2057 | if (current_folder == '') |
---|
| 2058 | current_folder = 'INBOX'; |
---|
| 2059 | var setFlag = function(msgObj) { |
---|
| 2060 | switch(data.flag){ |
---|
| 2061 | case "unseen": |
---|
| 2062 | msgObj.Unseen = "U"; |
---|
| 2063 | break; |
---|
| 2064 | case "seen": |
---|
| 2065 | msgObj.Unseen = ""; |
---|
| 2066 | break; |
---|
| 2067 | case "flagged": |
---|
| 2068 | msgObj.Flagged = "F"; |
---|
| 2069 | break; |
---|
| 2070 | case "unflagged": |
---|
| 2071 | msgObj.Flagged = ""; |
---|
| 2072 | break; |
---|
| 2073 | } |
---|
| 2074 | } |
---|
| 2075 | proxy_mensagens.get_msg(msgs_to_set[i],current_folder, false, setFlag); |
---|
| 2076 | |
---|
| 2077 | |
---|
| 2078 | } |
---|
[63] | 2079 | if(Element("check_box_message_" + msgs_to_set[i])){ |
---|
| 2080 | switch(data.flag){ |
---|
| 2081 | case "unseen": |
---|
[163] | 2082 | set_msg_as_unread(msgs_to_set[i]); |
---|
[63] | 2083 | Element("check_box_message_" + msgs_to_set[i]).checked = false; |
---|
| 2084 | break; |
---|
| 2085 | case "seen": |
---|
[163] | 2086 | set_msg_as_read(msgs_to_set[i], false); |
---|
[63] | 2087 | Element("check_box_message_" + msgs_to_set[i]).checked = false; |
---|
| 2088 | break; |
---|
| 2089 | case "flagged": |
---|
[163] | 2090 | set_msg_as_flagged(msgs_to_set[i]); |
---|
[63] | 2091 | document.getElementById("check_box_message_" + msgs_to_set[i]).checked = false; |
---|
| 2092 | break; |
---|
| 2093 | case "unflagged": |
---|
[163] | 2094 | set_msg_as_unflagged(msgs_to_set[i]); |
---|
[63] | 2095 | Element("check_box_message_" + msgs_to_set[i]).checked = false; |
---|
| 2096 | break; |
---|
| 2097 | } |
---|
[2] | 2098 | } |
---|
| 2099 | } |
---|
| 2100 | Element('chk_box_select_all_messages').checked = false; |
---|
| 2101 | } |
---|
[3035] | 2102 | |
---|
[63] | 2103 | var folder = get_current_folder(); |
---|
[2] | 2104 | if (msgs_to_set == 'get_selected_messages') |
---|
| 2105 | var msgs_to_set = this.get_selected_messages(); |
---|
[63] | 2106 | else |
---|
| 2107 | folder = Element("input_folder_"+msgs_to_set+"_r").value; |
---|
[3035] | 2108 | |
---|
[2] | 2109 | if (msgs_to_set) |
---|
[63] | 2110 | cExecute ("$this.imap_functions.set_messages_flag&folder="+folder+"&msgs_to_set="+msgs_to_set+"&flag="+flag, handler_set_messages_flag); |
---|
[2] | 2111 | else |
---|
[3035] | 2112 | write_msg(get_lang('No selected message.')); |
---|
[2] | 2113 | } |
---|
| 2114 | |
---|
| 2115 | // By message number |
---|
[3806] | 2116 | function set_message_flag(msg_number, flag, func_after_flag_change){ |
---|
| 2117 | var msg_number_folder = Element("new_input_folder_"+msg_number+"_r"); //Mensagens respondidas/encaminhadas |
---|
| 2118 | if(!msg_number_folder) |
---|
| 2119 | var msg_number_folder = Element("input_folder_"+msg_number+"_r"); //Mensagens abertas |
---|
| 2120 | |
---|
[2] | 2121 | var handler_set_messages_flag = function (data){ |
---|
| 2122 | if(!verify_session(data)) |
---|
| 2123 | return; |
---|
[3806] | 2124 | if(!data.status) { |
---|
| 2125 | write_msg(get_lang("this message cant be marked as normal")); |
---|
| 2126 | return; |
---|
| 2127 | } |
---|
| 2128 | else if(func_after_flag_change) { |
---|
| 2129 | func_after_flag_change(true); |
---|
| 2130 | } |
---|
[3035] | 2131 | if (data.status && Element("td_message_answered_"+msg_number)) { |
---|
[3716] | 2132 | |
---|
| 2133 | switch(flag){ |
---|
| 2134 | case "unseen": |
---|
| 2135 | set_msg_as_unread(msg_number); |
---|
| 2136 | break; |
---|
| 2137 | case "seen": |
---|
| 2138 | set_msg_as_read(msg_number); |
---|
| 2139 | break; |
---|
| 2140 | case "flagged": |
---|
| 2141 | set_msg_as_flagged(msg_number); |
---|
| 2142 | break; |
---|
| 2143 | case "unflagged": |
---|
| 2144 | set_msg_as_unflagged(msg_number); |
---|
| 2145 | break; |
---|
| 2146 | case "answered": |
---|
| 2147 | Element("td_message_answered_"+msg_number).innerHTML = '<img src=templates/'+template+'/images/answered.gif title=Respondida>'; |
---|
| 2148 | break; |
---|
| 2149 | case "forwarded": |
---|
| 2150 | Element("td_message_answered_"+msg_number).innerHTML = '<img src=templates/'+template+'/images/forwarded.gif title=Encaminhada>'; |
---|
| 2151 | break; |
---|
| 2152 | } |
---|
[3742] | 2153 | } else { |
---|
| 2154 | refresh(); |
---|
[2] | 2155 | } |
---|
| 2156 | } |
---|
[63] | 2157 | cExecute ("$this.imap_functions.set_messages_flag&folder="+( msg_number_folder ? msg_number_folder.value : get_current_folder() )+"&msgs_to_set="+msg_number+"&flag="+flag, handler_set_messages_flag); |
---|
[2] | 2158 | } |
---|
| 2159 | |
---|
| 2160 | function print_all(){ |
---|
[827] | 2161 | if (openTab.type[currentTab] == 2) |
---|
| 2162 | return print_msg(current_folder,currentTab.substr(0,currentTab.indexOf("_r")),currentTab); |
---|
| 2163 | |
---|
[2] | 2164 | var folder= Element('border_id_0').innerHTML; |
---|
[320] | 2165 | var body = Element('divScrollMain_'+numBox).innerHTML; |
---|
[2] | 2166 | var print_width = screen.width - 200; |
---|
| 2167 | var x = ((screen.width - print_width) / 2); |
---|
| 2168 | var y = ((screen.height - 400) / 2) - 35; |
---|
| 2169 | var window_print = window.open('','ExpressoMail','width='+print_width+',height=400,resizable=yes,scrollbars=yes,left='+x+',top='+y); |
---|
| 2170 | var seekDot = /\<img /gi; |
---|
| 2171 | body = body.replace(seekDot, "<img style='display:none' "); |
---|
| 2172 | seekDot = /\<input /gi; |
---|
| 2173 | body = body.replace(seekDot, "<input style='display:none' "); |
---|
[3035] | 2174 | |
---|
[2] | 2175 | while (1){ |
---|
| 2176 | try{ |
---|
| 2177 | var html = '<br>'; |
---|
| 2178 | html += "<h4>ExpressoLivre - ExpressoMail</h4>"; |
---|
| 2179 | html += folder+"<hr>"; |
---|
[3035] | 2180 | |
---|
[2] | 2181 | window_print.document.body.innerHTML = html + '<blockquote><font size="2">' + |
---|
[3943] | 2182 | '<table style="font-size:12" width="'+(is_ie ? "94%" : "100%" )+'">' + |
---|
| 2183 | '<TD width="25%" align="center">'+get_lang("Who")+'</TD>' + |
---|
| 2184 | '<TD align="center" width="'+(is_ie ? "50%" : "55%" )+'">'+get_lang("Subject")+'</TD>' + |
---|
| 2185 | '<TD align="center" width="11%">'+get_lang("Date")+'</TD>' + |
---|
| 2186 | '<TD align="center" width="'+(is_ie ? "10%" : "9%" )+'">'+get_lang("Size")+'</TD></TR></table>' |
---|
[2] | 2187 | + body + '</font></blockquote>'; |
---|
| 2188 | break; |
---|
| 2189 | } |
---|
| 2190 | catch(e){ |
---|
| 2191 | //alert(e.message); |
---|
| 2192 | } |
---|
| 2193 | } |
---|
| 2194 | window_print.document.close(); |
---|
| 2195 | window_print.print(); |
---|
| 2196 | } |
---|
| 2197 | |
---|
| 2198 | |
---|
| 2199 | function print_msg(msg_folder, msg_number, border_ID){ |
---|
[3035] | 2200 | var div_toaddress_full = Element("div_toaddress_full_"+border_ID); |
---|
[2] | 2201 | var div_ccaddress_full = Element("div_ccaddress_full_"+border_ID); |
---|
[3342] | 2202 | var div_ccoaddress_full = Element("div_ccoaddress_full_"+border_ID); |
---|
| 2203 | var printListTO = (div_toaddress_full && div_toaddress_full.style.display != 'none') || toaddress_array[border_ID].length == 1 ? true : false; |
---|
[3035] | 2204 | var printListCC = (div_ccaddress_full && div_ccaddress_full.style.display != 'none') || !div_ccaddress_full ? true : false; |
---|
[3342] | 2205 | var printListCCO = (div_ccoaddress_full && div_ccoaddress_full.style.display != 'none') || !div_ccoaddress_full ? true : false; |
---|
[2] | 2206 | var sender = Element('sender_values_'+border_ID) ? Element('sender_values_'+border_ID).value : null; |
---|
| 2207 | var from = Element('from_values_'+border_ID) ? Element('from_values_'+border_ID).value : null; |
---|
| 2208 | var to = Element('to_values_'+border_ID) ? Element('to_values_'+border_ID).value :null; |
---|
[3342] | 2209 | var cco = Element('cco_values_'+border_ID) ? Element('cco_values_'+border_ID).value : null; |
---|
| 2210 | var cc = Element('cc_values_'+border_ID) ? Element('cc_values_'+border_ID).value : null; |
---|
| 2211 | var date = Element('date_'+border_ID); |
---|
[2] | 2212 | var subject = Element('subject_'+border_ID); |
---|
| 2213 | var attachments = Element('attachments_'+border_ID); |
---|
| 2214 | var body = Element('body_'+border_ID); |
---|
| 2215 | |
---|
[3355] | 2216 | if(!is_ie) |
---|
| 2217 | { |
---|
| 2218 | var link = location.href.replace(/\/expressoMail1_2\/(.*)/, ""); |
---|
| 2219 | var tab_tags = body.getElementsByTagName("IMG"); |
---|
| 2220 | for(var i = 0; i < tab_tags.length;i++) |
---|
| 2221 | { |
---|
| 2222 | var _img = document.createElement("IMG"); |
---|
| 2223 | _img.src = tab_tags[i].src; |
---|
| 2224 | if(tab_tags[i].src.toUpperCase().indexOf('/INC/SHOW_EMBEDDED_ATTACH.PHP?MSG_FOLDER=') > -1) |
---|
| 2225 | { |
---|
| 2226 | _img.src = link + '/expressoMail1_2'+tab_tags[i].src.substr(tab_tags[i].src.toUpperCase().indexOf('/INC/SHOW_EMBEDDED_ATTACH.PHP?MSG_FOLDER=')); |
---|
| 2227 | } |
---|
| 2228 | tab_tags[i].parentNode.replaceChild(_img,tab_tags[i]); |
---|
| 2229 | } |
---|
| 2230 | } |
---|
[2] | 2231 | var print_width = screen.width - 200; |
---|
| 2232 | var x = ((screen.width - print_width) / 2); |
---|
| 2233 | var y = ((screen.height - 400) / 2) - 35; |
---|
| 2234 | var window_print = window.open('','ExpressoMail','width='+print_width+',height=400,resizable=yes,scrollbars=yes,left='+x+',top='+y); |
---|
[135] | 2235 | if(window_print == null) { |
---|
| 2236 | alert(get_lang("The Anti Pop-Up is enabled. Allow this site (%1) for print.",document.location.hostname)); |
---|
| 2237 | return; |
---|
| 2238 | } |
---|
[1754] | 2239 | |
---|
| 2240 | //needed to get the names of the attachments... only. |
---|
| 2241 | if(attachments != null) |
---|
| 2242 | { |
---|
| 2243 | var a = attachments.childNodes; |
---|
| 2244 | var attachs = ""; |
---|
| 2245 | var show_attachs = ""; |
---|
[4105] | 2246 | for(i=3;i<a.length;i++) |
---|
[1754] | 2247 | { |
---|
| 2248 | if(a[i].tagName && a[i].tagName == "A") |
---|
| 2249 | { |
---|
| 2250 | attachs += a[i].innerHTML; |
---|
| 2251 | } |
---|
| 2252 | } |
---|
| 2253 | show_attachs = "<tr><td width=7%><font size='2'>" + get_lang('Attachments: ')+ " </font></td><td><font size='2'>"+attachs+"</font></td></tr>"; |
---|
| 2254 | } else{ |
---|
| 2255 | show_attachs = ""; |
---|
| 2256 | } |
---|
[3130] | 2257 | var current_path = window.location.href.substr(0,window.location.href.lastIndexOf("/")); |
---|
[4383] | 2258 | var head = '<head><title></title><link href="'+current_path+'/templates/default/main.css" type="text/css" rel="stylesheet"></head>'; |
---|
| 2259 | window_print.document.write(head); |
---|
[3130] | 2260 | |
---|
[2] | 2261 | while (1){ |
---|
| 2262 | try{ |
---|
[3130] | 2263 | var html ='<body>'; |
---|
[2] | 2264 | html += "<h4>ExpressoLivre - ExpressoMail</h4><hr>"; |
---|
| 2265 | html += '<table><tbody>'; |
---|
| 2266 | if(sender) |
---|
[197] | 2267 | html += "<tr><td width=7% noWrap><font size='2'>" + get_lang('Sent by') + ": </font></td><td><font size='2'>"+sender+"</font></td></tr>"; |
---|
[2] | 2268 | if(from) |
---|
[197] | 2269 | html += "<tr><td width=7%><font size='2'>" + get_lang('From') + ": </font></td><td><font size='2'>"+from+"</font></td></tr>"; |
---|
[2] | 2270 | if(to) { |
---|
| 2271 | if(!printListTO) |
---|
| 2272 | to = 'Os destinatários não estão sendo exibidos para esta impressão'; |
---|
[197] | 2273 | html += "<tr><td width=7%><font size='2'>" + get_lang('To') + ": </font></td><td><font size='2'>"+to+"</font></td></tr>"; |
---|
[3035] | 2274 | } |
---|
[2] | 2275 | if (cc) { |
---|
| 2276 | if(!printListCC) |
---|
| 2277 | cc = 'Os destinatários não estão sendo exibidos para esta impressão'; |
---|
[197] | 2278 | html += "<tr><td width=7%><font size='2'>" + get_lang('Cc') + ": </font></td><td><font size='2'>"+cc+"</font></td></tr>"; |
---|
[2] | 2279 | } |
---|
[3342] | 2280 | if (cco) { |
---|
| 2281 | if(!printListCCO) |
---|
| 2282 | cco = 'Os destinatários não estão sendo exibidos para esta impressão'; |
---|
| 2283 | html += "<tr><td width=7%><font size='2'>" + get_lang('Cco') + ": </font></td><td><font size='2'>"+cco+"</font></td></tr>"; |
---|
| 2284 | } |
---|
[2] | 2285 | if(date) |
---|
[3035] | 2286 | html += "<tr><td width=7%><font size='2'>" + get_lang('Date') + ": </font></td><td><font size='2'>"+date.innerHTML+"</font></td></tr>"; |
---|
[197] | 2287 | html += "<tr><td width=7%><font size='2'>" + get_lang('Subject')+ ": </font></td><td><font size='2'>"+subject.innerHTML+"</font></td></tr>"; |
---|
[1754] | 2288 | html += show_attachs; //to show the names of the attachments |
---|
[2] | 2289 | html += "</tbody></table><hr>"; |
---|
[4383] | 2290 | window_print.document.write(html + body.innerHTML); |
---|
[2] | 2291 | if(!is_ie){ |
---|
[3035] | 2292 | var tab_tags = window_print.document.getElementsByTagName("IMG"); |
---|
[2] | 2293 | for(var i = 0; i < tab_tags.length;i++){ |
---|
| 2294 | var _img = document.createElement("IMG"); |
---|
| 2295 | _img.src = tab_tags[i].src; |
---|
| 2296 | tab_tags[i].parentNode.replaceChild(_img,tab_tags[i]); |
---|
| 2297 | } |
---|
| 2298 | } |
---|
| 2299 | break; |
---|
| 2300 | } |
---|
| 2301 | catch(e){ |
---|
| 2302 | //alert(e.message); |
---|
| 2303 | } |
---|
| 2304 | } |
---|
| 2305 | window_print.document.close(); |
---|
| 2306 | window_print.print(); |
---|
| 2307 | } |
---|
| 2308 | |
---|
| 2309 | function empty_trash_imap(){ |
---|
| 2310 | var handler_empty_trash = function(data){ |
---|
| 2311 | Element('chk_box_select_all_messages').checked = false; |
---|
| 2312 | if(!verify_session(data)) |
---|
| 2313 | return; |
---|
[96] | 2314 | tree_folders.getNodeById('INBOX'+cyrus_delimiter+trashfolder).alter({caption: get_lang("Trash")}); |
---|
[197] | 2315 | tree_folders.getNodeById('INBOX'+cyrus_delimiter+trashfolder)._refresh(); |
---|
[325] | 2316 | update_quota(get_current_folder()); |
---|
[3018] | 2317 | if (data){ |
---|
[2] | 2318 | write_msg(get_lang('Your Trash folder was empty.')); |
---|
[3018] | 2319 | if (get_current_folder() == 'INBOX'+cyrus_delimiter+trashfolder){ |
---|
| 2320 | draw_paging(0); |
---|
| 2321 | kill_current_box(); |
---|
| 2322 | Element('tot_m').innerHTML = 0; |
---|
| 2323 | Element('new_m').innerHTML = 0; |
---|
| 2324 | } |
---|
| 2325 | } |
---|
[2] | 2326 | else |
---|
| 2327 | write_msg(get_lang('ERROR emptying your Trash folder.')); |
---|
| 2328 | } |
---|
[61] | 2329 | var realyEmptyTrash=confirm(get_lang('Do you really want to empty your trash folder?')); |
---|
[2] | 2330 | if (realyEmptyTrash) |
---|
[1965] | 2331 | cExecute ("$this.imap_functions.empty_folder&clean_folder="+"imapDefaultTrashFolder", handler_empty_trash); |
---|
[2] | 2332 | } |
---|
| 2333 | |
---|
[1965] | 2334 | function empty_spam_imap(){ |
---|
| 2335 | var handler_empty_spam = function(data){ |
---|
| 2336 | Element('chk_box_select_all_messages').checked = false; |
---|
| 2337 | if(!verify_session(data)) |
---|
| 2338 | return; |
---|
| 2339 | if (get_current_folder() == 'INBOX'+cyrus_delimiter+spamfolder){ |
---|
| 2340 | draw_paging(0); |
---|
| 2341 | kill_current_box(); |
---|
| 2342 | } |
---|
| 2343 | tree_folders.getNodeById('INBOX'+cyrus_delimiter+spamfolder).alter({caption: get_lang("Spam")}); |
---|
| 2344 | tree_folders.getNodeById('INBOX'+cyrus_delimiter+spamfolder)._refresh(); |
---|
| 2345 | update_quota(get_current_folder()); |
---|
| 2346 | if (data) |
---|
| 2347 | write_msg(get_lang('Your Spam folder was empty.')); |
---|
| 2348 | else |
---|
| 2349 | write_msg(get_lang('ERROR emptying your Spam folder.')); |
---|
| 2350 | } |
---|
| 2351 | var realyEmptySpam=confirm(get_lang('Do you really want to empty your spam folder?')); |
---|
| 2352 | if (realyEmptySpam) |
---|
| 2353 | cExecute ("$this.imap_functions.empty_folder&clean_folder="+"imapDefaultSpamFolder", handler_empty_spam); |
---|
| 2354 | } |
---|
| 2355 | |
---|
| 2356 | |
---|
[2] | 2357 | function export_all_selected_msgs(){ |
---|
[827] | 2358 | if (openTab.type[currentTab] > 1){ |
---|
| 2359 | source_msg(currentTab,current_folder); |
---|
| 2360 | return; |
---|
| 2361 | } |
---|
[2] | 2362 | var msgs_to_export = this.get_selected_messages(); |
---|
[3035] | 2363 | |
---|
[2] | 2364 | var handler_export_all_selected_msgs = function(data){ |
---|
[3035] | 2365 | |
---|
[2] | 2366 | if(!data){ |
---|
| 2367 | write_msg(get_lang('Error compressing messages (ZIP). Contact the administrator.')); |
---|
| 2368 | } |
---|
| 2369 | else |
---|
| 2370 | download_attachments(null, null, data, null,null,'mensagens.zip'); |
---|
| 2371 | } |
---|
[3035] | 2372 | |
---|
[2] | 2373 | if (msgs_to_export) { |
---|
| 2374 | cExecute ("$this.exporteml.makeAll", handler_export_all_selected_msgs, "folder="+get_current_folder()+"&msgs_to_export="+msgs_to_export); |
---|
[53] | 2375 | write_msg(get_lang('You must wait while the messages will be exported...')); |
---|
[2] | 2376 | } |
---|
| 2377 | else |
---|
| 2378 | write_msg(get_lang('No selected message.')); |
---|
| 2379 | } |
---|
| 2380 | |
---|
[163] | 2381 | function select_all_search_messages(select, id){ |
---|
| 2382 | var search_box = Element("table_resultsearch_" + id.substr(18)).firstChild; |
---|
[156] | 2383 | var felement = search_box.firstChild; |
---|
| 2384 | while(felement) |
---|
| 2385 | { |
---|
| 2386 | if (select) |
---|
| 2387 | felement.firstChild.firstChild.checked = true; |
---|
| 2388 | else |
---|
| 2389 | felement.firstChild.firstChild.checked = false; |
---|
| 2390 | felement = felement.nextSibling; |
---|
| 2391 | } |
---|
| 2392 | } |
---|
| 2393 | |
---|
[2] | 2394 | function verify_session(data){ |
---|
[504] | 2395 | |
---|
[2] | 2396 | if(data && data.imap_error) { |
---|
[504] | 2397 | if(data.imap_error == "nosession") |
---|
| 2398 | write_msg(get_lang("your session could not be verified.")); |
---|
| 2399 | else |
---|
| 2400 | write_msg(data.imap_error); |
---|
| 2401 | // Hold sesion for edit message. |
---|
| 2402 | //if(!hold_session) |
---|
[3035] | 2403 | // location.href="../login.php?cd=10&phpgw_forward=%2FexpressoMail1_2%2Findex.php"; |
---|
[2] | 2404 | return false; |
---|
| 2405 | } |
---|
| 2406 | else |
---|
| 2407 | return true; |
---|
| 2408 | } |
---|
| 2409 | |
---|
| 2410 | // Save image file. |
---|
[1005] | 2411 | function save_image(e,thumb,file_type){ |
---|
| 2412 | file_type = file_type.replace("/","."); |
---|
[2] | 2413 | thumb.oncontextmenu = function(e) { |
---|
| 2414 | return false; |
---|
| 2415 | } |
---|
| 2416 | var _button = is_ie ? window.event.button : e.which; |
---|
| 2417 | var _target = is_ie ? event.srcElement : e.target; |
---|
[3035] | 2418 | |
---|
[2] | 2419 | if(_button == 2 || _button == 3) { |
---|
| 2420 | var _params = _target.id.split(";;"); |
---|
[1005] | 2421 | download_attachments(_params[0],_params[1],_params[2],_params[3],_params[4],file_type); |
---|
[2] | 2422 | } |
---|
[69] | 2423 | } |
---|
| 2424 | |
---|
[75] | 2425 | function nospam(msgs_number, border_ID, folder){ |
---|
| 2426 | if (folder == 'null') |
---|
| 2427 | folder = get_current_folder(); |
---|
[69] | 2428 | var new_folder = 'INBOX'; |
---|
| 2429 | var new_folder_name = get_lang('INBOX'); |
---|
| 2430 | var handler_move_msgs = function(data){ |
---|
[3035] | 2431 | if (msgs_number == 'selected') |
---|
[75] | 2432 | set_messages_flag("unseen", "get_selected_messages"); |
---|
| 2433 | else |
---|
[1121] | 2434 | proxy_mensagens.proxy_set_message_flag(msgs_number, "unseen"); |
---|
[3035] | 2435 | proxy_mensagens.proxy_move_messages(folder, msgs_number, border_ID, new_folder, new_folder_name); |
---|
[3693] | 2436 | |
---|
| 2437 | if (openTab.type[currentTab] > 1) |
---|
| 2438 | delete_border(currentTab,'false'); |
---|
[69] | 2439 | } |
---|
| 2440 | |
---|
[3693] | 2441 | if(currentTab.toString().indexOf("_r") != -1) |
---|
| 2442 | msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); |
---|
| 2443 | else if(msgs_number == 'selected') |
---|
| 2444 | msgs_number = get_selected_messages(); |
---|
[3035] | 2445 | |
---|
[69] | 2446 | if (parseInt(msgs_number) > 0 || msgs_number.length > 0) |
---|
| 2447 | cExecute ("$this.imap_functions.spam&folder="+folder+"&spam=false"+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+preferences.delete_and_show_previous_message+"&cyrus_delimiter="+cyrus_delimiter, handler_move_msgs); |
---|
| 2448 | else |
---|
[75] | 2449 | write_msg(get_lang('No selected message.')); |
---|
[69] | 2450 | } |
---|
| 2451 | |
---|
| 2452 | function spam(folder, msgs_number, border_ID){ |
---|
| 2453 | if (folder == 'null') |
---|
| 2454 | folder = get_current_folder(); |
---|
[3693] | 2455 | var new_folder = 'INBOX'+cyrus_delimiter+'Spam'; |
---|
[69] | 2456 | var new_folder_name = 'Spam'; |
---|
| 2457 | var handler_move_msgs = function(data){ |
---|
[689] | 2458 | proxy_mensagens.proxy_move_messages(folder, msgs_number, border_ID, new_folder, new_folder_name); |
---|
[3693] | 2459 | if (openTab.type[currentTab] > 1) |
---|
| 2460 | delete_border(currentTab,'false'); |
---|
[69] | 2461 | } |
---|
[3693] | 2462 | |
---|
| 2463 | if(currentTab.toString().indexOf("_r") != -1) |
---|
| 2464 | msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); |
---|
| 2465 | else if(msgs_number == 'selected') |
---|
[69] | 2466 | msgs_number = get_selected_messages(); |
---|
[3693] | 2467 | |
---|
[69] | 2468 | if(parseInt(msgs_number) > 0 || msgs_number.length > 0) |
---|
| 2469 | cExecute ("$this.imap_functions.spam&folder="+folder+"&spam=true"+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+preferences.delete_and_show_previous_message+"&cyrus_delimiter="+cyrus_delimiter, handler_move_msgs); |
---|
| 2470 | else |
---|
[3035] | 2471 | write_msg(get_lang('No selected message.')); |
---|
[271] | 2472 | } |
---|
[660] | 2473 | |
---|
| 2474 | function import_window(){ |
---|
| 2475 | var win = arrayJSWin["import_window"]; |
---|
| 2476 | var form_upload = Element("form_upload"); |
---|
| 2477 | if(!win) { |
---|
| 2478 | var form = document.createElement("DIV"); |
---|
| 2479 | form.id = "import_window"; |
---|
| 2480 | form.style.visibility = "hidden"; |
---|
| 2481 | form.style.position = "absolute"; |
---|
| 2482 | form.style.background = "#eeeeee"; |
---|
| 2483 | form.style.left = "0px"; |
---|
[3035] | 2484 | form.style.top = "0px"; |
---|
[660] | 2485 | form.style.width = "0px"; |
---|
| 2486 | form.style.height = "0px"; |
---|
| 2487 | document.body.appendChild(form); |
---|
| 2488 | form_upload = document.createElement("DIV"); |
---|
| 2489 | form_upload.id = "form_upload"; |
---|
| 2490 | form_upload.style.position = "absolute"; |
---|
| 2491 | form_upload.style.top = "5px"; |
---|
| 2492 | form_upload.style.left = "5px"; |
---|
| 2493 | form_upload.name = get_lang('zip mails to import'); |
---|
| 2494 | form_upload.style.width = "450px"; |
---|
| 2495 | form_upload.style.height = "75px"; |
---|
[3035] | 2496 | form.appendChild(form_upload); |
---|
[660] | 2497 | form.style.width = form.firstChild.style.width; |
---|
| 2498 | form.style.height = form.firstChild.style.height; |
---|
[3035] | 2499 | form.style.zIndex = "10000"; |
---|
[660] | 2500 | var title = form.firstChild.name; |
---|
| 2501 | var wHeight = form.offsetHeight + "px"; |
---|
| 2502 | var wWidth = form.offsetWidth + "px"; |
---|
| 2503 | form.style.width = form.offsetWidth - 5; |
---|
| 2504 | win = new dJSWin({ |
---|
| 2505 | id: 'win_'+form.id, |
---|
| 2506 | content_id: form.id, |
---|
| 2507 | width: wWidth, |
---|
| 2508 | height: wHeight, |
---|
| 2509 | title_color: '#3978d6', |
---|
| 2510 | bg_color: '#eee', |
---|
| 2511 | title: title, |
---|
| 2512 | title_text_color: 'white', |
---|
| 2513 | button_x_img: '../phpgwapi/images/winclose.gif', |
---|
[3035] | 2514 | border: true }); |
---|
[660] | 2515 | win.draw(); |
---|
| 2516 | } |
---|
| 2517 | form_upload.innerHTML = '<form method="POST" name="form_import" enctype="multipart/form-data">'+get_lang('zip mails to import')+':<br>'+ |
---|
| 2518 | '<input name="file_1" maxlength="255" size="50" id="file_1" type="file"><br>' + |
---|
| 2519 | '<input title="'+get_lang('Select a folder')+'" value="' + get_lang('Select a folder') + '"' + 'type="button" onclick="javascript:select_import_folder()"> ' + |
---|
| 2520 | '<input title="' + get_lang('Close') + '" value="' + get_lang('Close') + '"' + |
---|
[3035] | 2521 | ' type="button" onclick="arrayJSWin[\'import_window\'].close()"></form>'; |
---|
[660] | 2522 | win.open(); |
---|
| 2523 | } |
---|
| 2524 | |
---|
| 2525 | function import_msgs(wfolders_tree){ |
---|
[3035] | 2526 | function handler(data){ |
---|
[660] | 2527 | // Its necessary to encapsulate the data returned (IE bugfix) |
---|
[3035] | 2528 | return_import_msgs(data,wfolders_tree); |
---|
[660] | 2529 | } |
---|
| 2530 | var countFiles = document.form_import.countFiles; |
---|
| 2531 | if(!countFiles){ |
---|
| 2532 | countFiles = document.createElement("INPUT"); |
---|
| 2533 | countFiles.type = "hidden"; |
---|
| 2534 | countFiles.name = "countFiles"; |
---|
| 2535 | countFiles.value = "1"; |
---|
| 2536 | document.form_import.appendChild(countFiles); |
---|
| 2537 | } |
---|
| 2538 | var folder = document.createElement("INPUT"); |
---|
| 2539 | folder.type = "hidden"; |
---|
| 2540 | folder.name = "folder"; |
---|
| 2541 | folder.value = wfolders_tree._selected.id; |
---|
| 2542 | document.form_import.appendChild(folder); |
---|
| 2543 | write_msg(get_lang('You must wait while the messages will be imported...')); |
---|
[3035] | 2544 | |
---|
[660] | 2545 | cExecuteForm('$this.imap_functions.import_msgs', document.form_import, handler); |
---|
| 2546 | } |
---|
| 2547 | function return_import_msgs(data, wfolders_tree){ |
---|
| 2548 | if(data && data.error){ |
---|
| 2549 | write_msg(data.error); |
---|
| 2550 | } |
---|
| 2551 | else{ |
---|
| 2552 | if(data == 'Post-Content-Length') |
---|
[3018] | 2553 | write_msg(get_lang('The size of this message has exceeded the limit (%1B).', preferences.max_attachment_size ? preferences.max_attachment_size : Element('upload_max_filesize').value)); |
---|
[1000] | 2554 | else { /* |
---|
| 2555 | * @author Rommel Cysne (rommel.cysne@serpro.gov.br) |
---|
| 2556 | * @date 2009/05/15 |
---|
| 2557 | * Foi colocado um teste para verificar se a pasta selecionada, passada como parametro, |
---|
| 2558 | * eh uma pasta local (qualquer uma) |
---|
| 2559 | */ |
---|
| 2560 | var er = /^local_/; |
---|
| 2561 | if ( er.test(wfolders_tree._selected.id) ) |
---|
| 2562 | { |
---|
| 2563 | archive_msgs('INBOX/Lixeira/tmpMoveToLocal',wfolders_tree._selected.id,data); |
---|
| 2564 | cExecute('$this.imap_functions.delete_mailbox',function(){},'del_past=INBOX/Lixeira/tmpMoveToLocal'); |
---|
[660] | 2565 | } |
---|
[3035] | 2566 | else{ |
---|
[3298] | 2567 | write_msg(get_lang(data)); |
---|
[1000] | 2568 | arrayJSWin["import_window"].close(); |
---|
| 2569 | if(openTab.imapBox[0] == wfolders_tree._selected.id) |
---|
| 2570 | { |
---|
| 2571 | openTab.imapBox[0] = ''; |
---|
| 2572 | change_folder(wfolders_tree._selected.id, wfolders_tree._selected.caption); |
---|
| 2573 | } else{ |
---|
| 2574 | refresh(); |
---|
| 2575 | } |
---|
[660] | 2576 | } |
---|
| 2577 | } |
---|
[3035] | 2578 | } |
---|
[1000] | 2579 | |
---|
[660] | 2580 | } |
---|
| 2581 | |
---|
| 2582 | function select_import_folder(){ |
---|
| 2583 | //Begin: Verify if the file extension is allowed. |
---|
| 2584 | var imgExtensions = new Array("eml","zip"); |
---|
[3035] | 2585 | var inputFile = document.form_import.file_1; |
---|
[660] | 2586 | if(!inputFile.value){ |
---|
| 2587 | alert(get_lang('File extension forbidden or invalid file') + '.'); |
---|
| 2588 | return false; |
---|
| 2589 | } |
---|
| 2590 | var fileExtension = inputFile.value.split("."); |
---|
| 2591 | fileExtension = fileExtension[(fileExtension.length-1)]; |
---|
| 2592 | var deniedExtension = true; |
---|
| 2593 | for(var i=0; i<imgExtensions.length; i++) { |
---|
| 2594 | if(imgExtensions[i].toUpperCase() == fileExtension.toUpperCase()) { |
---|
| 2595 | deniedExtension = false; |
---|
| 2596 | break; |
---|
| 2597 | } |
---|
| 2598 | } |
---|
| 2599 | if(deniedExtension) { |
---|
| 2600 | alert(get_lang('File extension forbidden or invalid file') + '.'); |
---|
| 2601 | return false; |
---|
| 2602 | } |
---|
| 2603 | arrayJSWin['import_window'].close(); |
---|
[3181] | 2604 | connector.loadScript('wfolders'); |
---|
| 2605 | |
---|
| 2606 | if ( typeof(wfolders) == "undefined" ) |
---|
| 2607 | setTimeout( 'select_import_folder()', 500 ); |
---|
| 2608 | else |
---|
| 2609 | wfolders.makeWindow('null','import'); |
---|
[673] | 2610 | } |
---|
| 2611 | function import_calendar(data){ |
---|
| 2612 | function handler_import_calendar(data){ |
---|
| 2613 | if(data === true){ |
---|
| 2614 | write_msg(get_lang("The event was imported successfully.")); |
---|
| 2615 | } |
---|
| 2616 | } |
---|
| 2617 | if(confirm(get_lang("Do you confirm this import to your Calendar?"))){ |
---|
| 2618 | cExecute('$this.db_functions.import_vcard&msg_folder='+data,handler_import_calendar); |
---|
| 2619 | } |
---|
| 2620 | } |
---|
[1121] | 2621 | function hack_sent_queue(data,rowid_message) { |
---|
| 2622 | |
---|
| 2623 | if (data.success != true) { |
---|
| 2624 | queue_send_errors = true; |
---|
| 2625 | expresso_local_messages.set_problem_on_sent(rowid_message,data); |
---|
| 2626 | } |
---|
| 2627 | else { |
---|
| 2628 | expresso_local_messages.set_as_sent(rowid_message); |
---|
| 2629 | if(document.getElementById('_action')) { //Não posso manter esse elemento, pois o connector irá criar outro com o mesmo id para a próxima mensagem. |
---|
| 2630 | el =document.getElementById('_action'); |
---|
| 2631 | father = el.parentNode; |
---|
| 2632 | father.removeChild(el); |
---|
| 2633 | } |
---|
| 2634 | send_mail_from_queue(false); |
---|
| 2635 | } |
---|
| 2636 | } |
---|
| 2637 | |
---|
| 2638 | function send_mail_from_queue(first_pass) { |
---|
| 2639 | if(first_pass) |
---|
| 2640 | modal('send_queue'); |
---|
| 2641 | var num_msgs = expresso_local_messages.get_num_msgs_to_send(); |
---|
| 2642 | if (num_msgs <= 0) { |
---|
| 2643 | close_lightbox(); |
---|
| 2644 | return; |
---|
| 2645 | } |
---|
[3035] | 2646 | document.getElementById('text_send_queue').innerHTML = get_lang('Number of messages to send:')+' '+num_msgs; |
---|
[1121] | 2647 | var handler_send_queue_message = function(data,rowid_message) { |
---|
| 2648 | hack_sent_queue(data,this.ID_tmp); |
---|
| 2649 | } |
---|
| 2650 | var msg_to_send = expresso_local_messages.get_form_msg_to_send(); |
---|
| 2651 | if(!is_ie) |
---|
| 2652 | ID_tmp = msg_to_send.rowid.value; |
---|
| 2653 | else {//I.E kills me of shame... |
---|
| 2654 | for (var i=0;i<msg_to_send.length;i++) { |
---|
| 2655 | if(msg_to_send.elements[i].name=='rowid') { |
---|
| 2656 | ID_tmp = msg_to_send.elements[i].value; |
---|
| 2657 | break; |
---|
| 2658 | } |
---|
| 2659 | } |
---|
| 2660 | } |
---|
[3537] | 2661 | expresso_local_messages.set_as_sent(ID_tmp); |
---|
[1121] | 2662 | cExecuteForm("$this.imap_functions.send_mail", msg_to_send, handler_send_queue_message,"queue_"+ID_tmp); |
---|
[3537] | 2663 | send_mail_from_queue(false); |
---|
[1121] | 2664 | } |
---|
| 2665 | |
---|
| 2666 | function check_mail_in_queue() { |
---|
| 2667 | var num_msgs = expresso_local_messages.get_num_msgs_to_send(); |
---|
| 2668 | if(num_msgs>0) { |
---|
| 2669 | control = confirm(get_lang('You have messages to send. Want you to send them now?')); |
---|
| 2670 | if(control) { |
---|
| 2671 | send_mail_from_queue(true); |
---|
| 2672 | } |
---|
| 2673 | return true; |
---|
| 2674 | } |
---|
| 2675 | else { |
---|
| 2676 | return false; |
---|
| 2677 | } |
---|
| 2678 | } |
---|
| 2679 | |
---|
| 2680 | function force_check_queue() { |
---|
| 2681 | if(!check_mail_in_queue()) { |
---|
| 2682 | write_msg(get_lang("No messages to send")); |
---|
| 2683 | } |
---|
| 2684 | } |
---|
| 2685 | |
---|
[3227] | 2686 | function searchEmail(emailString){ |
---|
[1121] | 2687 | var arrayInvalidEmails = new Array(); |
---|
[3035] | 2688 | arrayInvalidEmails[1] = ''; |
---|
[1121] | 2689 | var email; |
---|
| 2690 | var arrayEmailsFull = new Array(); |
---|
| 2691 | arrayEmailsFull = emailString.split(','); |
---|
[3227] | 2692 | var er_Email = new RegExp("<(.*?)>"); |
---|
| 2693 | // TODO Use validateEmail of common functions ! |
---|
[1121] | 2694 | var er_ValidaEmail = new RegExp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"); |
---|
| 2695 | |
---|
| 2696 | for (i=0; i < arrayEmailsFull.length; i++){ |
---|
| 2697 | email = er_Email.exec(arrayEmailsFull[i]); |
---|
| 2698 | tempEmail = email == null ? arrayEmailsFull[i]:email[1]; |
---|
| 2699 | tempEmail = tempEmail.replace(/^\s+|\s+$/g,""); |
---|
| 2700 | if (tempEmail != '') { |
---|
| 2701 | singleEmail = er_ValidaEmail.exec(tempEmail); |
---|
[3035] | 2702 | |
---|
[1121] | 2703 | if (singleEmail == null) { |
---|
| 2704 | arrayInvalidEmails[0] = true; |
---|
| 2705 | arrayInvalidEmails[1] += (email == null ? arrayEmailsFull[i] : email[1]) + "; "; |
---|
| 2706 | } |
---|
[3035] | 2707 | } |
---|
[1121] | 2708 | } |
---|
[3035] | 2709 | |
---|
[1121] | 2710 | return arrayInvalidEmails; |
---|
[1754] | 2711 | } |
---|