[2] | 1 | var BordersArray = new Array(); |
---|
| 2 | BordersArray[0] = new setBorderAttributes(0); |
---|
[5083] | 3 | var countBorders = 0; |
---|
[5134] | 4 | var partMsgs = new Array(); |
---|
[2] | 5 | |
---|
[5134] | 6 | |
---|
[2] | 7 | function setBorderAttributes(ID) |
---|
| 8 | { |
---|
| 9 | this.border_id = "border_id_"+ID; |
---|
| 10 | this.sequence = ID; |
---|
| 11 | } |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | function alternate_border(ID) |
---|
| 15 | { |
---|
[5367] | 16 | msg_selected = false;//Controle da seleção de mensagens |
---|
[5250] | 17 | if(isNaN(ID)) |
---|
[5260] | 18 | if(preferences.use_shortcuts == "1") |
---|
| 19 | select_msg((ID.split("_"))[0]); |
---|
[3839] | 20 | if( document.getElementById("div_menu_c3") != null ) |
---|
| 21 | { |
---|
| 22 | var node = document.getElementById("div_menu_c3").firstChild; |
---|
| 23 | |
---|
| 24 | while ( node ) |
---|
| 25 | { |
---|
| 26 | node.style.display = "none"; |
---|
| 27 | node = node.nextSibling; |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | if( document.getElementById("span_paging"+ID) != null ) |
---|
| 31 | document.getElementById("span_paging"+ID).style.display = "block"; |
---|
| 32 | } |
---|
| 33 | |
---|
[4787] | 34 | if ( typeof win == 'object' && win.close && win.close.constructor == Function ){ |
---|
| 35 | var search_win = document.getElementById( 'window_QuickCatalogSearch' ); |
---|
| 36 | if(search_win){ |
---|
| 37 | search_win.style.visibility = 'hidden'; |
---|
| 38 | } |
---|
| 39 | win.close( ); |
---|
| 40 | } |
---|
| 41 | |
---|
[320] | 42 | if (! Element('border_id_'+ID)) |
---|
| 43 | return false; // Not possible to alternate |
---|
[412] | 44 | show_hide_span_paging(ID); |
---|
[790] | 45 | spanD = Element("span_D"); |
---|
| 46 | if (spanD) |
---|
| 47 | spanD.style.display = (openTab.type[ID] == 0 ? '' : 'none'); |
---|
[1701] | 48 | |
---|
| 49 | var footer_menu = Element("footer_menu"); |
---|
[5134] | 50 | var aba = Element('border_id_'+ID); |
---|
| 51 | if (footer_menu != null) { |
---|
[1701] | 52 | footer_menu.style.display = (openTab.type[ID] != 4 ? '' : 'none'); |
---|
[5200] | 53 | var alternate_menu = document.getElementById('localOption'); |
---|
[5213] | 54 | |
---|
[5200] | 55 | if(alternate_menu != null && alternate_menu != 'undefined'){ //Quando Carregado o expresso mail |
---|
| 56 | if(openTab.imapBox[ID]!= null && openTab.imapBox[ID]!= 'undefined' ){ //Quando abrir uma Nova Mensagem |
---|
| 57 | if((openTab.imapBox[ID].indexOf("local_") >= 0)){ |
---|
| 58 | alternate_menu.title = get_lang("Unarchive"); |
---|
| 59 | alternate_menu.removeAttribute("onclick"); |
---|
[5213] | 60 | if(!is_ie) |
---|
| 61 | alternate_menu.setAttribute("onclick", 'expresso_local_messages.unarchive_msgs(\''+openTab.imapBox[ID]+'\', null)'); |
---|
| 62 | else{ |
---|
| 63 | alternate_menu.onclick = function(){ |
---|
| 64 | expresso_local_messages.unarchive_msgs(openTab.imapBox[ID], null); |
---|
| 65 | } |
---|
| 66 | } |
---|
[5200] | 67 | alternate_menu.innerHTML = get_lang("Unarchive"); |
---|
| 68 | |
---|
| 69 | }else{ |
---|
| 70 | alternate_menu.title = get_lang("Archive"); |
---|
| 71 | alternate_menu.removeAttribute("onclick"); |
---|
[5213] | 72 | if(!is_ie) |
---|
| 73 | alternate_menu.setAttribute("onclick", 'archive_msgs(\''+openTab.imapBox[ID]+'\', null)'); |
---|
| 74 | else{ |
---|
| 75 | alternate_menu.onclick = function(){ |
---|
| 76 | archive_msgs(openTab.imapBox[ID], null); |
---|
| 77 | } |
---|
| 78 | } |
---|
[5200] | 79 | alternate_menu.innerHTML = get_lang("Archive"); |
---|
| 80 | } |
---|
[5213] | 81 | |
---|
[5200] | 82 | } |
---|
| 83 | } |
---|
[5213] | 84 | |
---|
[5200] | 85 | if((aba.id.indexOf("_r") < 0) && (aba.id.indexOf("_0") < 0) && (aba.id.indexOf("id_search_") < 0) && (aba.id.indexOf("_s") < 0)){ |
---|
[5134] | 86 | spanD.style.display = 'none'; |
---|
| 87 | footer_menu.style.display = 'none'; |
---|
| 88 | } |
---|
[1701] | 89 | } |
---|
| 90 | |
---|
[5134] | 91 | |
---|
[2] | 92 | var len = BordersArray.length; |
---|
| 93 | for (var i=0; i < len; i++) |
---|
| 94 | { |
---|
| 95 | m = document.getElementById(BordersArray[i].border_id); |
---|
[320] | 96 | if ((m)&&(m.className == 'menu-sel')) |
---|
[2] | 97 | { |
---|
| 98 | m.className = 'menu'; |
---|
| 99 | c = document.getElementById("content_id_"+BordersArray[i].sequence); |
---|
| 100 | c.style.display = 'none'; |
---|
| 101 | if(Element("font_border_id_"+BordersArray[i].sequence)) |
---|
| 102 | Element("font_border_id_"+BordersArray[i].sequence).className = 'font-menu'; |
---|
[5083] | 103 | |
---|
[2] | 104 | } |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | m = Element("border_id_"+ID); |
---|
[320] | 108 | if (m) |
---|
| 109 | m.className = 'menu-sel'; |
---|
[2] | 110 | if(Element("font_border_id_" + ID)) |
---|
| 111 | Element("font_border_id_" + ID).className = 'font-menu-sel'; |
---|
| 112 | var c = Element("content_id_"+ID) |
---|
[320] | 113 | if (c) |
---|
| 114 | c.style.display = ''; |
---|
[2] | 115 | |
---|
| 116 | |
---|
| 117 | // hide the DropDrowContact, if necessary |
---|
| 118 | window_DropDownContacts = Element('tipDiv'); |
---|
| 119 | if ((window_DropDownContacts)&&(window_DropDownContacts.style.visibility != 'hidden')){ |
---|
| 120 | window_DropDownContacts.style.visibility = 'hidden'; |
---|
| 121 | } |
---|
[320] | 122 | |
---|
[5134] | 123 | numBox = getNumBoxFromTabId(ID); |
---|
[4889] | 124 | if (typeof(ID)=='number') { |
---|
| 125 | numBox = ID; |
---|
| 126 | } |
---|
| 127 | else { |
---|
| 128 | if (ID.match("search_")) |
---|
| 129 | { |
---|
| 130 | if (ID.match("search_local_msg")) |
---|
| 131 | { |
---|
| 132 | var p = ID.search(/[0-9]/); |
---|
| 133 | numBox = ID.substr(p); |
---|
| 134 | } |
---|
| 135 | else |
---|
| 136 | { |
---|
| 137 | numBox = ID.substr(7); |
---|
| 138 | } |
---|
| 139 | } |
---|
| 140 | } |
---|
[1701] | 141 | currentTab=ID; |
---|
[5083] | 142 | RichTextEditor.setEditable(ID); |
---|
[2] | 143 | return ID; |
---|
| 144 | } |
---|
| 145 | |
---|
[5219] | 146 | function create_border(borderTitle, id_value, search) |
---|
[2] | 147 | { |
---|
[5439] | 148 | |
---|
[3776] | 149 | borderTitle = ( ( borderTitle && borderTitle.constructor == String && borderTitle.length > 0 ) ? borderTitle : ' ' ); |
---|
| 150 | |
---|
[790] | 151 | var resize = false; |
---|
[3995] | 152 | resize = resize_borders(); |
---|
| 153 | if (!resize){ |
---|
| 154 | var str_continue = ''; |
---|
| 155 | var bolContinue = true; |
---|
[5134] | 156 | str_continue = '\n' + get_lang('You must manually close one of your tabs before opening a new one'); |
---|
[3995] | 157 | if (preferences.auto_close_first_tab == 1){ |
---|
| 158 | var children = Element('border_tr').childNodes; |
---|
| 159 | var bolDelete = true; |
---|
| 160 | for (var i=0; i<children.length; i++) { |
---|
| 161 | if ((children[i].nodeName === 'TD') && (children[i].id!=='border_id_0') && (children[i].id!=='border_blank')) |
---|
| 162 | { |
---|
| 163 | bolDelete = true; |
---|
| 164 | var num_child = children[i].id.toString().substr(10); |
---|
| 165 | alternate_border(num_child); |
---|
| 166 | if (editTest(num_child)){ |
---|
| 167 | bolDelete = false; |
---|
| 168 | } |
---|
[5134] | 169 | if (bolDelete || bolContinue){ |
---|
| 170 | str_fechar = '\n' + get_lang('Reached maximum tab limit. Want to close this tab'); |
---|
| 171 | var confirmacao = confirm(str_fechar); |
---|
| 172 | if(confirmacao){ |
---|
[3995] | 173 | bolContinue = false; |
---|
| 174 | delete_border(num_child, 'false'); |
---|
| 175 | break; |
---|
[5134] | 176 | }else{ |
---|
| 177 | return 'maximo'; |
---|
[3995] | 178 | } |
---|
| 179 | } |
---|
| 180 | } |
---|
| 181 | } |
---|
[5134] | 182 | }else{ |
---|
[3995] | 183 | alert(get_lang('Reached maximum tab limit') + str_continue ); |
---|
[5134] | 184 | return 'maximo'; |
---|
[3995] | 185 | } |
---|
| 186 | } |
---|
[2] | 187 | |
---|
[5172] | 188 | if (! id_value){ // Is new message? |
---|
[271] | 189 | var ID = parseInt(BordersArray[(BordersArray.length-1)].sequence) + 1; |
---|
[5172] | 190 | if(isNaN(ID)){ |
---|
| 191 | var aux = BordersArray[(BordersArray.length-1)].sequence.split("_"); |
---|
| 192 | ID = parseInt(aux[1]) + 1; |
---|
| 193 | } |
---|
| 194 | }else |
---|
[790] | 195 | { |
---|
[3839] | 196 | if (Element("border_id_"+id_value)) // It's opened already! |
---|
[790] | 197 | return alternate_border(id_value); |
---|
[3839] | 198 | |
---|
[271] | 199 | var ID = id_value; |
---|
[5213] | 200 | if(isNaN(ID) && ID.indexOf("search_local") >= 0){ |
---|
[5200] | 201 | if(current_folder.indexOf("local") >= 0) |
---|
| 202 | openTab.imapBox[ID] = current_folder; |
---|
| 203 | else |
---|
| 204 | openTab.imapBox[ID] = 'local_search'; |
---|
[5205] | 205 | }else if(isNaN(ID) && ID.indexOf("search_") >= 0){ |
---|
[5200] | 206 | if(current_folder.indexOf("local") < 0) |
---|
| 207 | openTab.imapBox[ID] = current_folder; |
---|
| 208 | else |
---|
| 209 | openTab.imapBox[ID] = 'search'; |
---|
[5284] | 210 | }else if( (currentTab != 0) && isNaN(currentTab) && (currentTab.indexOf("search") >= 0) && (ID.indexOf("msg") < 0) ) { |
---|
[5213] | 211 | var id_border = currentTab.replace(/[a-zA-Z_]+/, ""); |
---|
| 212 | ID_TR = ID.toString().substr(0,ID.toString().indexOf("_r")); |
---|
| 213 | var tr = Element(ID_TR); |
---|
| 214 | openTab.imapBox[ID] = (tr.getAttribute('name') == null?get_current_folder():tr.getAttribute('name')); |
---|
[5200] | 215 | }else |
---|
| 216 | openTab.imapBox[ID] = current_folder; |
---|
[271] | 217 | } |
---|
[2] | 218 | td = document.createElement("TD"); |
---|
| 219 | td.id="border_id_" + ID; |
---|
[3839] | 220 | if(resize) |
---|
| 221 | { |
---|
[2] | 222 | td.setAttribute("width", parseInt(resize)+"px"); |
---|
| 223 | td.style.width = parseInt(resize)+"px"; |
---|
| 224 | } |
---|
| 225 | else |
---|
| 226 | td.setAttribute("width", "200px"); |
---|
[790] | 227 | |
---|
[2] | 228 | td.setAttribute("align", "right"); |
---|
[3018] | 229 | td.onclick = function(){alternate_border(ID);resizeWindow()}; |
---|
[2] | 230 | td.setAttribute("noWrap","true"); |
---|
[3839] | 231 | td.alt = borderTitle.replace( ' ', ' ' ); |
---|
| 232 | td.title = borderTitle; |
---|
[2] | 233 | borderTitle = borderTitle ? borderTitle : id_value ? get_lang("No Subject") : " " ; |
---|
| 234 | td.value = borderTitle; |
---|
[790] | 235 | if (borderTitle.length > 21) |
---|
[2] | 236 | borderTitle = borderTitle.substring(0,21) + "..."; |
---|
[790] | 237 | |
---|
[3839] | 238 | if ( resize ) |
---|
[2] | 239 | borderTitle = borderTitle.substring(0, resize*0.08); |
---|
[5219] | 240 | |
---|
| 241 | var cc = search; |
---|
| 242 | if(!cc){ |
---|
[5222] | 243 | if(isNaN(ID)){ |
---|
| 244 | var is_local = ID.match('.*_local_.*'); |
---|
| 245 | if(!is_local) |
---|
| 246 | cc = document.getElementById("em_message_search").value; |
---|
| 247 | else{ |
---|
| 248 | cc = document.getElementsByName(currentTab)[0].value; |
---|
| 249 | } |
---|
| 250 | }else{ |
---|
| 251 | cc =""; |
---|
[5219] | 252 | } |
---|
| 253 | } |
---|
[2] | 254 | |
---|
[3525] | 255 | td.innerHTML = "<div style='width:100%;border:0;padding:0;'>\n\ |
---|
| 256 | <div id='font_border_id_" + ID+"' class='font-menu' style='width:*;'>" + |
---|
| 257 | borderTitle + |
---|
| 258 | "</div>\n\ |
---|
| 259 | <div style='width:1px;float:left;clear:right;'>\n\ |
---|
[5213] | 260 | <img onmousedown='javascript:return false' style='cursor:pointer' onclick=delete_border('" + ID + "','false') src='templates/"+template+"/images/close_button.gif'/>\n\ " + |
---|
| 261 | "</div>\n\ " + |
---|
[5219] | 262 | "<input type=\"hidden\" name=\""+ ID+"\" value=\""+cc+"\">" + |
---|
[5213] | 263 | "</div>"; |
---|
| 264 | |
---|
[2] | 265 | bb = document.getElementById("border_blank"); |
---|
| 266 | parent_bb = bb.parentNode; //Pego o tbody |
---|
| 267 | parent_bb.insertBefore(td, bb); |
---|
[790] | 268 | |
---|
[5486] | 269 | if(! Element("border_id_"+id_value+"_r") ||((typeof(id_value) == 'string') && id_value.match(/_r$/))){ |
---|
| 270 | $(td).draggable({ |
---|
| 271 | helper: function(event){ |
---|
| 272 | if( borderTitle.length > 18 ) |
---|
| 273 | return $(DataLayer.render('../prototype/modules/mail/templates/draggin_box.ejs', {texto : borderTitle.substring(0,18) + "...", type: "messages"})); |
---|
| 274 | else |
---|
| 275 | return $(DataLayer.render('../prototype/modules/mail/templates/draggin_box.ejs', {texto : borderTitle, type: "messages"})); |
---|
| 276 | }, |
---|
| 277 | cursorAt: { cursor: "move", top: 5, left: 56 }, |
---|
| 278 | refreshPositions: true , |
---|
| 279 | scroll: true, |
---|
| 280 | scrollSensitivity: 100, |
---|
| 281 | scrollSpeed: 100, |
---|
| 282 | containment: "#divAppbox" |
---|
| 283 | }); |
---|
| 284 | } |
---|
| 285 | //_dragArea.makeDragged(td, id_value,td.value); |
---|
[2] | 286 | |
---|
| 287 | BordersArray[BordersArray.length] = new setBorderAttributes(ID); |
---|
[790] | 288 | |
---|
[2] | 289 | var div = document.createElement("DIV"); |
---|
| 290 | div.id = "content_id_" + ID; |
---|
| 291 | div.className = "conteudo"; |
---|
| 292 | div.style.display=''; |
---|
| 293 | |
---|
[320] | 294 | div.style.overflow = "hidden"; |
---|
[2] | 295 | |
---|
[5459] | 296 | Element("exmail_main_body").insertBefore(div,Element("footer_menu")); |
---|
[2] | 297 | alternate_border(ID); |
---|
| 298 | return ID; |
---|
| 299 | } |
---|
| 300 | |
---|
| 301 | function resize_borders() |
---|
| 302 | { |
---|
[3336] | 303 | var numBorders = count_borders(); |
---|
| 304 | |
---|
[2] | 305 | if (numBorders > 8) |
---|
| 306 | return false; |
---|
[3336] | 307 | |
---|
| 308 | return redim_borders(numBorders+1); |
---|
| 309 | } |
---|
| 310 | |
---|
| 311 | function count_borders() |
---|
| 312 | { |
---|
| 313 | var numBorders = 0; |
---|
| 314 | var children = Element('border_tr').childNodes; |
---|
[2] | 315 | for (var i=0; i<children.length; i++) { |
---|
[3336] | 316 | if ((children[i].nodeName === 'TD') && (children[i].id!=='border_id_0') && (children[i].id!=='border_blank')) |
---|
| 317 | numBorders++; |
---|
| 318 | } |
---|
| 319 | |
---|
| 320 | return numBorders; |
---|
| 321 | } |
---|
| 322 | |
---|
| 323 | function redim_borders(numBorders) |
---|
| 324 | { |
---|
| 325 | var children = Element('border_tr').childNodes; |
---|
| 326 | var clientWidth = (window.document.body.clientWidth - findPosX(Element("exmail_main_body"))) - Element("border_id_0").clientWidth - 30; |
---|
| 327 | var newWidthTD = (clientWidth/numBorders)-6; |
---|
| 328 | newWidthTD = newWidthTD > 200 ? 200 : (newWidthTD < 50 ? 50 : newWidthTD); |
---|
| 329 | children = Element('border_tr').childNodes; |
---|
| 330 | for (var i=0; i<children.length; i++) { |
---|
[2] | 331 | if ((children[i].nodeName === 'TD') && (children[i].id!=='border_id_0') && (children[i].id!=='border_blank')){ |
---|
| 332 | children[i].style.width = newWidthTD; |
---|
[3525] | 333 | set_border_caption(children[i].id, children[i].title, newWidthTD); |
---|
[2] | 334 | } |
---|
| 335 | } |
---|
| 336 | return newWidthTD; |
---|
| 337 | } |
---|
| 338 | |
---|
[5268] | 339 | |
---|
| 340 | |
---|
| 341 | |
---|
[3525] | 342 | function set_border_caption(border_id, title, border_width) |
---|
[3372] | 343 | { |
---|
[3525] | 344 | var border = document.getElementById(border_id); |
---|
| 345 | if (border_width == null) |
---|
| 346 | { |
---|
| 347 | border_width = border.clientWidth; |
---|
| 348 | } |
---|
[3372] | 349 | var caption = ""; |
---|
[5134] | 350 | Element("font_"+border.id).style.width = (border_width - 30)+'px'; |
---|
[3372] | 351 | Element("font_"+border.id).innerHTML = title; |
---|
| 352 | return(title); |
---|
| 353 | } |
---|
| 354 | |
---|
[5268] | 355 | opened_alert = false; |
---|
| 356 | |
---|
[3977] | 357 | function draftTests(ID, msg_sent){ |
---|
[5268] | 358 | var cancel = new LertButton(get_lang('cancel'), function() { |
---|
[5134] | 359 | Element("border_id_"+ID).onclick = function () { alternate_border(ID);}; |
---|
[5439] | 360 | $("#to_"+ID).focus(); |
---|
[5268] | 361 | opened_alert = false; |
---|
[3977] | 362 | }); |
---|
[5134] | 363 | |
---|
[3977] | 364 | var yes = new LertButton(get_lang('Save'), function() { |
---|
[5134] | 365 | save_msg(ID, 'undefined', true); |
---|
[3995] | 366 | openTab.toPreserve[ID] = false; |
---|
| 367 | close_delete(ID, msg_sent); |
---|
[4460] | 368 | delete(openTab.type[ID]); |
---|
[5134] | 369 | //write_msg(get_lang('Your message was save as draft in folder %1.', lang_folder('Drafts'))); |
---|
| 370 | |
---|
[3977] | 371 | }); |
---|
| 372 | var discard = new LertButton(get_lang('Discard'), function() { |
---|
[5268] | 373 | if (openTab.imapBox[ID] && !openTab.toPreserve[ID]) |
---|
[3977] | 374 | { |
---|
| 375 | //delete_msgs(openTab.imapBox[ID], openTab.imapUid[ID].toString(), 0) |
---|
| 376 | //delete(openTab.imapBox[ID]); |
---|
| 377 | openTab.toPreserve[ID] = false; |
---|
| 378 | } |
---|
[4460] | 379 | delete(openTab.type[ID]); |
---|
[3977] | 380 | close_delete(ID, msg_sent); |
---|
| 381 | }); |
---|
[5439] | 382 | if( $("#save_message_options_"+ID).attr("disabled") == "disabled") { |
---|
| 383 | openTab.toPreserve[ID] = false; |
---|
| 384 | close_delete(ID, msg_sent); |
---|
| 385 | delete(openTab.type[ID]); |
---|
| 386 | }else{ |
---|
| 387 | var titulo = '<b>' + get_lang('Warning') + '!</b>'; |
---|
| 388 | var message = get_lang("Your changes are not saved. What to do?"); |
---|
| 389 | var multConfirm = new Lert( |
---|
| 390 | titulo, |
---|
| 391 | message, |
---|
| 392 | [cancel,discard,yes], |
---|
| 393 | { |
---|
| 394 | defaultButton:yes, |
---|
| 395 | icon:'js/lert/images/dialog-help.gif' |
---|
| 396 | }); |
---|
| 397 | multConfirm.display(); |
---|
| 398 | opened_alert = true; |
---|
[5268] | 399 | } |
---|
[3977] | 400 | } |
---|
| 401 | |
---|
[3995] | 402 | function editTest(ID){ |
---|
| 403 | var body = document.getElementById('body_'+ ID); |
---|
| 404 | if (body) |
---|
| 405 | { |
---|
| 406 | var save_link = Element("save_message_options_"+ID); |
---|
| 407 | if (openTab.toPreserve[ID] == undefined) |
---|
| 408 | openTab.toPreserve[ID] = false; |
---|
| 409 | if (((! openTab.toPreserve[ID] && ! ID.toString().match("_r")) || ((body.contentWindow) == 'object' && body.contentWindow.document.designMode.toLowerCase() == 'on')) && (save_link.onclick != '')) |
---|
| 410 | { |
---|
| 411 | return true; |
---|
| 412 | } |
---|
| 413 | } |
---|
| 414 | return false; |
---|
| 415 | } |
---|
| 416 | |
---|
[2] | 417 | function delete_border(ID, msg_sent) |
---|
| 418 | { |
---|
[5134] | 419 | |
---|
[3977] | 420 | var bolExecuteClose = true; |
---|
[5134] | 421 | var borderElem = Element("border_id_" + ID); |
---|
[3995] | 422 | if (borderElem){ |
---|
| 423 | borderElem.onclick = null; // It's avoid a FF3 bug |
---|
| 424 | }else{ |
---|
| 425 | return false; |
---|
| 426 | } |
---|
[2] | 427 | if (msg_sent == 'false') |
---|
| 428 | { |
---|
[3995] | 429 | if (editTest(ID)){ |
---|
| 430 | bolExecuteClose = false; |
---|
| 431 | return(draftTests(ID, msg_sent)); |
---|
| 432 | } |
---|
[2] | 433 | } |
---|
[3977] | 434 | if (bolExecuteClose) |
---|
| 435 | { |
---|
| 436 | close_delete(ID, msg_sent); |
---|
[4460] | 437 | } |
---|
| 438 | delete(openTab.type[ID]); |
---|
[3977] | 439 | return true; |
---|
| 440 | } |
---|
[2] | 441 | |
---|
[3977] | 442 | function close_delete(ID, msg_sent) |
---|
| 443 | { |
---|
[606] | 444 | openTab.toPreserve[ID] = false; |
---|
| 445 | openTab.imapUid[ID] = 0; |
---|
[271] | 446 | |
---|
[5459] | 447 | // Limpa o autosave |
---|
| 448 | if (preferences.auto_save_draft == 1 && autoSaveControl.timer[ID] !== null ) |
---|
| 449 | { |
---|
| 450 | autoSaveControl.status[ID] = null; |
---|
| 451 | clearInterval(autoSaveControl.timer[ID]); |
---|
| 452 | } |
---|
| 453 | //////////////////////////////// |
---|
| 454 | |
---|
[2] | 455 | hold_session = false; |
---|
[790] | 456 | if (exist_className(Element('border_id_'+ID),'menu-sel')) |
---|
[2] | 457 | { |
---|
[790] | 458 | if (BordersArray[BordersArray.length-2].sequence == ID) |
---|
[2] | 459 | this.alternate_border(0); |
---|
| 460 | else |
---|
[790] | 461 | this.alternate_border(BordersArray[BordersArray.length-2].sequence); |
---|
[2] | 462 | } |
---|
| 463 | |
---|
| 464 | // Remove TD, title |
---|
[320] | 465 | border = Element('border_id_' + ID); |
---|
[2] | 466 | border.parentNode.removeChild(border); |
---|
[790] | 467 | var j=0; |
---|
[2] | 468 | var new_BordersArray = new Array(); |
---|
| 469 | for (i=0;i<BordersArray.length;i++) |
---|
[790] | 470 | if (document.getElementById(BordersArray[i].border_id) != null){ |
---|
[2] | 471 | new_BordersArray[j] = BordersArray[i]; |
---|
[790] | 472 | j++; |
---|
[2] | 473 | } |
---|
[58] | 474 | if(j == 1) |
---|
| 475 | Element("footer_menu").style.display = ''; |
---|
[2] | 476 | BordersArray = new_BordersArray; |
---|
[790] | 477 | |
---|
| 478 | // Remove Div Content |
---|
| 479 | content = Element('content_id_' + ID); |
---|
| 480 | content.parentNode.removeChild(content); |
---|
[3018] | 481 | resizeWindow(); |
---|
[5083] | 482 | RichTextEditor.destroy( 'body_'+ID ); |
---|
[5134] | 483 | |
---|
| 484 | //Caso for uma mensagem anexada tem que deletar ela da lixeira apos fechar a aba |
---|
| 485 | var isPartMsg = false; |
---|
| 486 | var id2 = ID.replace('_r',''); |
---|
| 487 | for(var ii = 0; ii < partMsgs.length; ii++) |
---|
| 488 | if(partMsgs[ii] == id2){ |
---|
| 489 | isPartMsg = true; |
---|
| 490 | partMsgs[ii] = null; |
---|
| 491 | } |
---|
| 492 | |
---|
| 493 | if(isPartMsg === true){ |
---|
| 494 | var handler_delete_msg = function(){}; |
---|
| 495 | cExecute ("$this.imap_functions.delete_msgs&folder=INBOX"+cyrus_delimiter+trashfolder+"&msgs_number="+id2,handler_delete_msg); |
---|
| 496 | } |
---|
| 497 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 498 | |
---|
[320] | 499 | return true; |
---|
[4802] | 500 | } |
---|
| 501 | |
---|
[5134] | 502 | function getTabPrefix() { // define o prefixo para os checkboxes das mensagens |
---|
| 503 | if (typeof(currentTab)!='number') |
---|
| 504 | return currentTab+"_"; |
---|
| 505 | else |
---|
| 506 | return ""; |
---|
| 507 | } |
---|
| 508 | |
---|
[4807] | 509 | function getMessageIdFromRowId(row_id) { // extrai o id da mensagem do id da linha |
---|
| 510 | var p = row_id.search("_s"); |
---|
| 511 | if (p>0) |
---|
| 512 | return row_id.substr(0,p); |
---|
[4802] | 513 | else |
---|
| 514 | return row_id; |
---|
[4807] | 515 | } |
---|
| 516 | |
---|
| 517 | function getNumBoxFromTabId(tab_id) { // extrai o numBox do id da tab |
---|
| 518 | if (typeof(tab_id)=='number') { |
---|
| 519 | return tab_id; |
---|
| 520 | } |
---|
| 521 | else { |
---|
| 522 | var p = tab_id.search(/[0-9]/); |
---|
| 523 | return tab_id.substr(p); |
---|
| 524 | } |
---|
[4843] | 525 | } |
---|