[670] | 1 | /** |
---|
| 2 | * @author diogenes |
---|
| 3 | */ |
---|
| 4 | |
---|
| 5 | function messages_proxy() { |
---|
| 6 | |
---|
| 7 | } |
---|
| 8 | /** |
---|
| 9 | * Retorna os cabeçalhos das mensagens a serem desenhadas na caixa de email. |
---|
| 10 | */ |
---|
[1752] | 11 | messages_proxy.prototype.messages_list = function(folder,msg_range_begin,emails_per_page,sort_box_type,search_box_type,sort_box_reverse,preview_msg_subject,preview_msg_tip,call_back) { |
---|
[670] | 12 | if(this.is_local_folder(folder)) { |
---|
| 13 | var real_folder = folder.substr(6); |
---|
[1752] | 14 | var msgs = expresso_local_messages.get_local_range_msgs(real_folder,msg_range_begin,preferences.max_email_per_page,sort_box_type,sort_box_reverse,search_box_type,preferences.preview_msg_subject,preferences.preview_msg_tip); |
---|
[5134] | 15 | if(call_back) |
---|
| 16 | call_back(msgs); |
---|
| 17 | else{ |
---|
| 18 | call_back = function(data) |
---|
| 19 | { |
---|
| 20 | alternate_border(0); |
---|
| 21 | draw_box(data, get_current_folder()); |
---|
| 22 | } |
---|
| 23 | call_back(msgs); |
---|
| 24 | } |
---|
[1938] | 25 | draw_tree_local_folders(); |
---|
[670] | 26 | }else { |
---|
[6254] | 27 | $.ajax({ |
---|
| 28 | url: "controller.php?" + $.param( {action: "$this.imap_functions.get_range_msgs3", |
---|
| 29 | folder: folder, |
---|
| 30 | msg_range_begin: msg_range_begin, |
---|
| 31 | msg_range_end: emails_per_page, |
---|
| 32 | sort_box_type: sort_box_type, |
---|
| 33 | search_box_type: search_box_type, |
---|
| 34 | sort_box_reverse: sort_box_reverse } ), |
---|
| 35 | |
---|
| 36 | success: function( data ){ |
---|
| 37 | data = connector.unserialize(data); |
---|
| 38 | |
---|
| 39 | if( data ) |
---|
| 40 | call_back( data ); |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | }); |
---|
[670] | 44 | } |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | messages_proxy.prototype.get_msg = function(msg_number,msg_folder,set_flag,call_back) { |
---|
| 48 | if(this.is_local_folder(msg_folder)) { |
---|
| 49 | if(set_flag) |
---|
| 50 | expresso_local_messages.set_messages_flag(msg_number,"seen"); |
---|
| 51 | var data = expresso_local_messages.get_local_mail(msg_number); |
---|
[1969] | 52 | |
---|
[670] | 53 | eval("call_back(data)"); |
---|
[6317] | 54 | }else{ |
---|
| 55 | |
---|
| 56 | //Problema ao abrir outras pastas CORRIGIDO! |
---|
| 57 | var folder = ""; |
---|
| 58 | msg_folder = msg_folder.split("%2F"); |
---|
| 59 | for(var i=0; i < msg_folder.length; i++){ |
---|
| 60 | if(i == 0) |
---|
| 61 | folder = msg_folder[i]; |
---|
| 62 | else |
---|
| 63 | folder += cyrus_delimiter+msg_folder[i]; |
---|
| 64 | } |
---|
| 65 | msg_folder = folder; |
---|
| 66 | |
---|
[6275] | 67 | $.ajax({ |
---|
| 68 | url: 'controller.php?' + $.param( {action: '$this.imap_functions.get_info_msg', |
---|
| 69 | msg_number: msg_number, |
---|
| 70 | msg_folder: msg_folder, |
---|
| 71 | decoded: true } ), |
---|
| 72 | success: function( data ){ |
---|
| 73 | data = connector.unserialize( data ); |
---|
| 74 | |
---|
| 75 | if( data ) |
---|
| 76 | call_back( data ); |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | }); |
---|
[6317] | 80 | } |
---|
[6275] | 81 | |
---|
[670] | 82 | } |
---|
| 83 | |
---|
| 84 | messages_proxy.prototype.delete_msgs = function(folder, msgs_number, border_ID) { |
---|
| 85 | |
---|
| 86 | if (folder == 'null') |
---|
| 87 | folder = get_current_folder(); |
---|
| 88 | if (msgs_number == 'selected') |
---|
| 89 | msgs_number = get_selected_messages(); |
---|
[5172] | 90 | if(currentTab != 0 && currentTab.indexOf("search_") >= 0){ |
---|
| 91 | var content_search = document.getElementById('content_id_'+currentTab); |
---|
| 92 | action_msg_selected_from_search(content_search.id, 'delete'); |
---|
| 93 | refresh(); |
---|
| 94 | //draw_tree_folders(); |
---|
| 95 | //update_local_box(); |
---|
| 96 | return; |
---|
| 97 | } |
---|
| 98 | |
---|
[5134] | 99 | if (!this.is_local_folder(folder)){ |
---|
[670] | 100 | delete_msgs(folder, msgs_number, border_ID); |
---|
[5134] | 101 | }else { |
---|
| 102 | if((folder != 'local_Trash') && (expresso_local_messages.as_trash())){ |
---|
| 103 | expresso_local_messages.move_messages('Trash', msgs_number); |
---|
| 104 | this.aux_interface_remove_mails(msgs_number, 'local_Trash', border_ID); |
---|
| 105 | draw_tree_local_folders(); |
---|
[5158] | 106 | update_local_box(); |
---|
[5134] | 107 | refresh(); |
---|
| 108 | }else{ |
---|
[1938] | 109 | expresso_local_messages.delete_msgs(msgs_number, border_ID); |
---|
| 110 | draw_tree_local_folders(); |
---|
[5158] | 111 | update_local_box(); |
---|
[5134] | 112 | refresh(); |
---|
| 113 | } |
---|
[1938] | 114 | } |
---|
[670] | 115 | } |
---|
| 116 | |
---|
| 117 | messages_proxy.prototype.link_anexo = function (info_msg,numero_ordem_anexo) { |
---|
| 118 | |
---|
| 119 | if(info_msg.local_message==true) { |
---|
| 120 | return "javascript:download_local_attachment('"+ |
---|
| 121 | expresso_local_messages.get_url_anexo(info_msg.msg_number,info_msg.attachments[numero_ordem_anexo].pid)+ |
---|
| 122 | "')"; |
---|
| 123 | } |
---|
| 124 | else { |
---|
[1005] | 125 | return "javascript:download_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"',"+numero_ordem_anexo+",'"+info_msg.attachments[numero_ordem_anexo].pid+"','"+info_msg.attachments[numero_ordem_anexo].encoding+"','"+info_msg.attachments[numero_ordem_anexo].name+"')"; |
---|
[670] | 126 | } |
---|
| 127 | } |
---|
| 128 | |
---|
| 129 | messages_proxy.prototype.proxy_source_msg = function (id_msg,folder) { |
---|
| 130 | if(!this.is_local_folder(folder)) { |
---|
| 131 | source_msg(id_msg,folder); |
---|
| 132 | } |
---|
| 133 | else { |
---|
| 134 | var num_msg = id_msg.substr(0,(id_msg.length - 2)); |
---|
| 135 | expresso_local_messages.get_source_msg(num_msg); |
---|
| 136 | } |
---|
| 137 | } |
---|
| 138 | |
---|
| 139 | messages_proxy.prototype.proxy_set_messages_flag = function (flag,msg_number){ |
---|
| 140 | if(this.is_local_folder(get_current_folder())) { |
---|
| 141 | expresso_local_messages.set_messages_flag(msg_number,flag); |
---|
| 142 | } |
---|
| 143 | else { |
---|
| 144 | set_messages_flag(flag,msg_number); |
---|
[6088] | 145 | // Verifica se a pasta que esta selecionada contem a opção "Não lidas" ativada |
---|
| 146 | // caso exista, ele chama novamente a opção "Não lidas" para atualizar a pasta. |
---|
| 147 | if('UNSEEN' == search_box_type) |
---|
| 148 | return sort_box('UNSEEN','SORTARRIVAL'); |
---|
[670] | 149 | } |
---|
| 150 | } |
---|
| 151 | |
---|
[3806] | 152 | messages_proxy.prototype.proxy_set_message_flag = function (msg_number,flag,func_after_flag_change){ |
---|
| 153 | var msg_number_folder = Element("new_input_folder_"+msg_number+"_r"); //Mensagens respondidas/encaminhadas |
---|
| 154 | if(!msg_number_folder) |
---|
| 155 | var msg_number_folder = Element("input_folder_"+msg_number+"_r"); //Mensagens abertas |
---|
| 156 | var folder = msg_number_folder ? msg_number_folder.value : get_current_folder(); |
---|
[1121] | 157 | if(this.is_local_folder(folder)) { |
---|
[3806] | 158 | expresso_local_messages.set_message_flag(msg_number,flag, func_after_flag_change); |
---|
[1121] | 159 | } |
---|
| 160 | else { |
---|
[3806] | 161 | set_message_flag(msg_number,flag, func_after_flag_change); |
---|
[1121] | 162 | } |
---|
| 163 | } |
---|
| 164 | |
---|
[670] | 165 | messages_proxy.prototype.is_local_folder = function(folder) { |
---|
[3018] | 166 | if(typeof(folder) == "undefined" || folder.indexOf("local_")==-1) |
---|
[670] | 167 | return false; |
---|
| 168 | return true; |
---|
| 169 | } |
---|
| 170 | |
---|
| 171 | |
---|
| 172 | messages_proxy.prototype.proxy_rename_folder = function(){ |
---|
[5864] | 173 | var specialFolders = special_folders[ttree.getFolder().split(cyrus_delimiter)[ttree.getFolder().split(cyrus_delimiter).length-1]]; |
---|
| 174 | if (ttree.getFolder() == 'INBOX' || specialFolders ) { |
---|
| 175 | alert(get_lang("It's not possible rename the folder: ") + lang_folder((specialFolders ? specialFolders : ttree.getFolder()))+ '.'); |
---|
[670] | 176 | return false; |
---|
| 177 | } |
---|
[5864] | 178 | if(ttree.getFolder() == 'root') { |
---|
| 179 | alert(get_lang("It's not possible rename this folder!")); |
---|
| 180 | return false; |
---|
| 181 | } |
---|
| 182 | if(!specialFolders && ttree.getFolder() == get_current_folder()){ |
---|
| 183 | alert(get_lang("It's not possible rename this folder, because it is being used in the moment!")); |
---|
[670] | 184 | return false; |
---|
| 185 | } |
---|
[4790] | 186 | |
---|
[5864] | 187 | if (this.is_local_folder(ttree.getFolder())) { |
---|
[670] | 188 | folder = prompt(get_lang("Enter a name for the box"), ""); |
---|
[5864] | 189 | if(folder.match(/[\/\\\!\@\#\$\%\&\*\+\(\)]/gi)){ |
---|
| 190 | alert(get_lang("It's not possible rename this folder. try other folder name")); |
---|
| 191 | return false; |
---|
[3390] | 192 | } |
---|
[670] | 193 | if(trim(folder) == "" || trim(folder) == null){ |
---|
| 194 | alert(get_lang("you have to enter the name of the new folder")); |
---|
| 195 | return false; |
---|
| 196 | } |
---|
| 197 | var temp = expresso_local_messages.rename_folder(folder, ttree.FOLDER.substr(6)); |
---|
| 198 | if (!temp) |
---|
| 199 | alert(get_lang("cannot rename folder. try other folder name")); |
---|
| 200 | ttreeBox.update_folder(); |
---|
| 201 | } |
---|
| 202 | else { |
---|
| 203 | ttreeBox.validate("rename"); |
---|
| 204 | } |
---|
| 205 | |
---|
| 206 | } |
---|
| 207 | |
---|
| 208 | messages_proxy.prototype.proxy_create_folder = function() { |
---|
[4272] | 209 | if (folders.length == preferences.imap_max_folders){ |
---|
| 210 | alert(get_lang("Limit reached folders")); |
---|
| 211 | return false; |
---|
| 212 | } |
---|
| 213 | |
---|
[1477] | 214 | if (this.is_local_folder(ttree.FOLDER)) { |
---|
[670] | 215 | folder = prompt(get_lang('Enter the name of the new folder:'), ""); |
---|
| 216 | |
---|
[3921] | 217 | if(folder == null) |
---|
| 218 | return; |
---|
| 219 | |
---|
| 220 | |
---|
| 221 | if(trim(folder) == ""){ |
---|
[670] | 222 | alert(get_lang("you have to enter the name of the new folder")); |
---|
| 223 | return false; |
---|
| 224 | } |
---|
[5158] | 225 | if(folder.match(/[\/\\\!\@\#\$\%\&\*\+\(\)]/gi)){ |
---|
[3390] | 226 | alert(get_lang("cannot create folder. try other folder name")); |
---|
| 227 | return false; |
---|
| 228 | } |
---|
[1477] | 229 | if(ttree.FOLDER=="local_root") |
---|
| 230 | var temp = expresso_local_messages.create_folder(folder); |
---|
| 231 | else |
---|
| 232 | var temp = expresso_local_messages.create_folder(ttree.FOLDER.substr(6)+"/"+folder); |
---|
[670] | 233 | if (!temp) |
---|
| 234 | alert(get_lang("cannot create folder. try other folder name")); |
---|
[3750] | 235 | ttreeBox.update_folder(true); |
---|
[670] | 236 | } |
---|
[1537] | 237 | else |
---|
| 238 | if(ttree.FOLDER == "INBOX") |
---|
[3931] | 239 | alert(get_lang("It's not possible create inside: ") + lang_folder(ttree.FOLDER)+"."); |
---|
[1537] | 240 | else if (!this.is_local_folder(ttree.FOLDER)) |
---|
[670] | 241 | ttreeBox.validate("newpast"); |
---|
| 242 | else |
---|
[3931] | 243 | alert(get_lang("It's not possible create inside: ") + lang_folder(ttree.FOLDER.substr(6))+"."); |
---|
[670] | 244 | } |
---|
| 245 | |
---|
| 246 | messages_proxy.prototype.proxy_remove_folder = function() { |
---|
| 247 | if (this.is_local_folder(ttree.FOLDER)) { |
---|
| 248 | if(ttree.FOLDER == 'local_root') { |
---|
| 249 | alert(get_lang("Select a folder!")); |
---|
| 250 | return false; |
---|
| 251 | } |
---|
[3901] | 252 | if (ttree.FOLDER == 'local_Inbox' || (preferences.auto_create_local == '1' && (ttree.FOLDER == 'local_Sent' || ttree.FOLDER == 'local_Drafts' || ttree.FOLDER == 'local_Trash'))) { |
---|
[3884] | 253 | alert(get_lang("It's not possible delete the folder: ") + lang_folder(ttree.FOLDER.substr(6)) + '.'); |
---|
[670] | 254 | return false; |
---|
| 255 | } |
---|
[4790] | 256 | if(ttree.FOLDER.match("^local_.*$") && ttree.FOLDER == get_current_folder()){ |
---|
| 257 | alert(get_lang("It's not possible rename this folder, because it is being used in the moment!")); |
---|
| 258 | return false; |
---|
| 259 | } |
---|
| 260 | |
---|
[1477] | 261 | if(ttree.FOLDER.indexOf("/")!="-1") { |
---|
| 262 | final_pos = ttree.FOLDER.lastIndexOf("/"); |
---|
| 263 | new_caption = ttree.FOLDER.substr(final_pos+1); |
---|
| 264 | } |
---|
| 265 | else { |
---|
| 266 | new_caption = ttree.FOLDER.substr(6); |
---|
| 267 | } |
---|
| 268 | var string_confirm = get_lang("Do you wish to exclude the folder ") + new_caption + "?"; |
---|
[670] | 269 | |
---|
| 270 | if (confirm(string_confirm)) { |
---|
[3735] | 271 | var flag = expresso_local_messages.remove_folder(ttree.FOLDER.substr(6)); |
---|
| 272 | if (flag) { |
---|
[3928] | 273 | write_msg(get_lang("The folder %1 was successfully removed", new_caption)); |
---|
[3735] | 274 | draw_tree_local_folders(); |
---|
[3844] | 275 | ttreeBox.update_folder(true); |
---|
[3735] | 276 | } |
---|
| 277 | else |
---|
| 278 | alert(get_lang("Delete your sub-folders first")); |
---|
| 279 | |
---|
[670] | 280 | } |
---|
| 281 | } |
---|
| 282 | else |
---|
| 283 | ttreeBox.del(); |
---|
| 284 | } |
---|
| 285 | |
---|
| 286 | messages_proxy.prototype.proxy_move_messages = function (folder, msgs_number, border_ID, new_folder, new_folder_name) { |
---|
| 287 | if (! folder || folder == 'null') |
---|
[3018] | 288 | folder = Element("input_folder_"+msgs_number+"_r") ? Element("input_folder_"+msgs_number+"_r").value : (openTab.imapBox[currentTab] ? openTab.imapBox[currentTab]:get_current_folder()); |
---|
[670] | 289 | if ((this.is_local_folder(folder)) && (this.is_local_folder(new_folder))) { //Move entre pastas não locais... |
---|
| 290 | if (folder == new_folder){ |
---|
| 291 | write_msg(get_lang('The origin folder and the destination folder are the same.')); |
---|
| 292 | return; |
---|
| 293 | } |
---|
| 294 | if(msgs_number=='selected') |
---|
| 295 | msgs_number = get_selected_messages(); |
---|
| 296 | if (new_folder == 'local_root') |
---|
| 297 | alert(get_lang("Select a folder!")); |
---|
| 298 | if (parseInt(msgs_number) > 0 || msgs_number.length > 0) { |
---|
| 299 | expresso_local_messages.move_messages(new_folder.substr(6), msgs_number); |
---|
| 300 | this.aux_interface_remove_mails(msgs_number, new_folder_name, border_ID); |
---|
[1938] | 301 | draw_tree_local_folders(); |
---|
[4826] | 302 | update_local_box(); |
---|
[670] | 303 | } |
---|
| 304 | else |
---|
| 305 | write_msg(get_lang('No selected message.')); |
---|
| 306 | } |
---|
| 307 | else |
---|
| 308 | if ((!this.is_local_folder(folder)) && (!this.is_local_folder(new_folder))) { //Move entre pastas locais... |
---|
[5134] | 309 | if(new_folder_name == 'Spam'){ |
---|
| 310 | move_msgs_not_previus(folder, msgs_number, border_ID, new_folder, new_folder_name); |
---|
| 311 | }else{ |
---|
[670] | 312 | move_msgs(folder, msgs_number, border_ID, new_folder, new_folder_name); |
---|
| 313 | } |
---|
[5134] | 314 | }else if ((!this.is_local_folder(folder)) && (this.is_local_folder(new_folder))) { |
---|
[670] | 315 | if(msgs_number=='selected') |
---|
| 316 | archive_msgs(folder,new_folder); |
---|
| 317 | else |
---|
| 318 | archive_msgs(folder,new_folder,msgs_number); |
---|
[5134] | 319 | |
---|
| 320 | |
---|
[1938] | 321 | draw_tree_local_folders(); |
---|
[5134] | 322 | refresh(); |
---|
[670] | 323 | } |
---|
| 324 | else { |
---|
[1000] | 325 | //Por Bruno Costa (bruno.vieira-costa@serpro.gov.br) permite o desarquivamento de menssagens chamando a função unarchive_msgs quando uma msg é movida de uma pasta local para uma pasta remota. |
---|
| 326 | |
---|
| 327 | expresso_local_messages.unarchive_msgs(folder,new_folder,msgs_number); |
---|
| 328 | //write_msg(get_lang("you can't move mails from local to server folders")); |
---|
[670] | 329 | } |
---|
| 330 | |
---|
| 331 | |
---|
| 332 | } |
---|
| 333 | |
---|
| 334 | messages_proxy.prototype.proxy_move_search_messages = function(border_id, new_folder, new_folder_name) { |
---|
| 335 | |
---|
| 336 | |
---|
| 337 | /* |
---|
| 338 | |
---|
| 339 | |
---|
| 340 | if ((this.is_local_folder(folder)) && (this.is_local_folder(new_folder))) { //Move entre pastas não locais... |
---|
| 341 | if (folder == new_folder){ |
---|
| 342 | write_msg(get_lang('The origin folder and the destination folder are the same.')); |
---|
| 343 | return; |
---|
| 344 | } |
---|
| 345 | if(msgs_number=='selected') |
---|
| 346 | msgs_number = get_selected_messages(); |
---|
| 347 | if (new_folder == 'local_root') |
---|
| 348 | alert(get_lang("Select a folder!")); |
---|
| 349 | if (parseInt(msgs_number) > 0 || msgs_number.length > 0) { |
---|
| 350 | expresso_local_messages.move_messages(new_folder.substr(6), msgs_number); |
---|
| 351 | this.aux_interface_remove_mails(msgs_number, new_folder_name, border_ID); |
---|
| 352 | } |
---|
| 353 | else |
---|
| 354 | write_msg(get_lang('No selected message.')); |
---|
| 355 | } |
---|
| 356 | else |
---|
| 357 | if ((!this.is_local_folder(folder)) && (!this.is_local_folder(new_folder))) { //Move entre pastas locais... |
---|
| 358 | move_msgs(folder, msgs_number, border_ID, new_folder, new_folder_name); |
---|
| 359 | } |
---|
| 360 | else if ((!this.is_local_folder(folder)) && (this.is_local_folder(new_folder))) { |
---|
| 361 | archive_msgs(folder,new_folder); |
---|
| 362 | } |
---|
| 363 | else { |
---|
| 364 | write_msg(get_lang("you can't move mails from local to server folders")); |
---|
| 365 | }*/ |
---|
| 366 | } |
---|
| 367 | |
---|
| 368 | messages_proxy.prototype.aux_interface_remove_mails = function(msgs_number,new_folder_name,border_ID,previous_msg) { |
---|
[5134] | 369 | if(!msgs_number) |
---|
| 370 | msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); |
---|
| 371 | |
---|
| 372 | if(msgs_number === ""){ |
---|
| 373 | write_msg(get_lang('No selected message.')); |
---|
| 374 | return; |
---|
| 375 | } |
---|
| 376 | |
---|
[670] | 377 | Element('chk_box_select_all_messages').checked = false; |
---|
| 378 | mail_msg = Element("tbody_box"); |
---|
| 379 | msgs_number = msgs_number.split(","); |
---|
| 380 | var msg_to_delete; |
---|
[5134] | 381 | this.previous = 0; |
---|
[670] | 382 | for (var i=0; i<msgs_number.length; i++){ |
---|
| 383 | msg_to_delete = Element(msgs_number[i]); |
---|
| 384 | if (msg_to_delete){ |
---|
| 385 | if ( (msg_to_delete.style.backgroundColor != '') && (preferences.use_shortcuts == '1') ) |
---|
| 386 | select_msg('null', 'down'); |
---|
[5134] | 387 | |
---|
| 388 | if (parseInt(preferences.delete_and_show_previous_message) && msg_to_delete && currentTab.toString().indexOf("_r") > 0) |
---|
| 389 | for(var ii=0; ii < mail_msg.rows.length; ii++){ |
---|
| 390 | if(mail_msg.rows[ii] === msg_to_delete){ |
---|
| 391 | if(ii == 0){ |
---|
| 392 | break; |
---|
| 393 | }else{ |
---|
| 394 | this.previous = mail_msg.rows[(ii - 1)].attributes[0]; |
---|
| 395 | this.previous = parseInt(this.previous.value); |
---|
| 396 | break; |
---|
| 397 | } |
---|
| 398 | } |
---|
| 399 | } |
---|
[670] | 400 | mail_msg.removeChild(msg_to_delete); |
---|
| 401 | } |
---|
| 402 | } |
---|
[5158] | 403 | new_folder_name = this.get_folder_name(new_folder_name); |
---|
[670] | 404 | if (msgs_number.length == 1) |
---|
| 405 | write_msg(get_lang("The message was moved to folder ") + new_folder_name); |
---|
| 406 | else |
---|
| 407 | write_msg(get_lang("The messages were moved to folder ") + new_folder_name); |
---|
| 408 | |
---|
[5134] | 409 | if (parseInt(preferences.delete_and_show_previous_message) && msg_to_delete && this.previous){ |
---|
| 410 | proxy_mensagens.get_msg(this.previous, folder, true, show_msg); |
---|
| 411 | }else if(currentTab != 0){ |
---|
[670] | 412 | if (border_ID != '' && border_ID != 'null'){ |
---|
| 413 | delete_border(border_ID,'false'); |
---|
[5134] | 414 | }else{ |
---|
| 415 | delete_border(currentTab,'false'); |
---|
| 416 | } |
---|
[670] | 417 | } |
---|
| 418 | if(folder == get_current_folder()) |
---|
| 419 | Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) - msgs_number.length; |
---|
| 420 | } |
---|
| 421 | |
---|
[5158] | 422 | messages_proxy.prototype.get_folder_name = function(new_folder_name){ |
---|
| 423 | switch (new_folder_name) { |
---|
| 424 | case 'local_Inbox': |
---|
| 425 | return 'Local_Caixa de Entrada'; |
---|
| 426 | case 'local_Sent': |
---|
| 427 | return 'Local_Enviados'; |
---|
| 428 | case 'local_Trash': |
---|
| 429 | return 'Local_Lixeira'; |
---|
| 430 | case 'local_Drafts': |
---|
| 431 | return 'Local_Rascunhos'; |
---|
| 432 | default: |
---|
| 433 | return new_folder_name; |
---|
| 434 | } |
---|
| 435 | } |
---|
| 436 | |
---|
[1000] | 437 | messages_proxy.prototype.msg_img = function(msgs_number,folder_name,call_back) { |
---|
| 438 | if(this.is_local_folder(folder_name)){ |
---|
| 439 | var msg = expresso_local_messages.get_local_mail(msgs_number); |
---|
| 440 | eval('call_back(msg)'); |
---|
| 441 | } |
---|
| 442 | else |
---|
[6275] | 443 | $.ajax({ |
---|
| 444 | url: 'controller.php?' + $.param( {action: '$this.imap_functions.get_info_msg', |
---|
| 445 | msg_number: msg_number, |
---|
| 446 | msg_folder: msg_folder, |
---|
| 447 | decoded: true } ), |
---|
| 448 | success: function( data ){ |
---|
| 449 | data = connector.unserialize( data ); |
---|
| 450 | |
---|
| 451 | if( data ) |
---|
| 452 | call_back( data ); |
---|
| 453 | } |
---|
| 454 | |
---|
| 455 | }); |
---|
[1000] | 456 | } |
---|
| 457 | |
---|
| 458 | messages_proxy.prototype.export_all_messages = function(folder){ |
---|
| 459 | |
---|
| 460 | if (!folder){ |
---|
| 461 | folder = get_current_folder(); |
---|
| 462 | } |
---|
| 463 | |
---|
| 464 | if(!this.is_local_folder(folder)){ |
---|
| 465 | export_all_selected_msgs(); |
---|
| 466 | }else{ |
---|
| 467 | local_messages.prototype.local_messages_to_export(); |
---|
| 468 | } |
---|
| 469 | } |
---|
| 470 | |
---|
| 471 | messages_proxy.prototype.proxy_export_all_msg=function(){ |
---|
| 472 | |
---|
| 473 | var er=/^local/; |
---|
| 474 | |
---|
| 475 | |
---|
| 476 | if(ttree.FOLDER == "local_root"){return false;} //Usuario não selecionou uma pasta local e esta no começo dos nós |
---|
| 477 | var nm_bx = ttree.FOLDER.split(cyrus_delimiter); |
---|
| 478 | |
---|
| 479 | var name_f = nm_bx[nm_bx.length -1].replace("local_",""); |
---|
| 480 | |
---|
| 481 | if (!er.test(nm_bx)){ |
---|
| 482 | //Se a pasta nao for local, ou seja a string nao contem a string "local" |
---|
| 483 | ttreeBox.export_all_msg(); |
---|
| 484 | } else{ |
---|
| 485 | expresso_local_messages.get_all_local_folder_messages(name_f); |
---|
| 486 | } |
---|
| 487 | } |
---|
| 488 | |
---|
[670] | 489 | var proxy_mensagens; |
---|
| 490 | proxy_mensagens = new messages_proxy(); |
---|