[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 | } |
---|
| 141 | |
---|
[1701] | 142 | currentTab=ID; |
---|
[3839] | 143 | |
---|
[3876] | 144 | if( document.getElementById('to_'+ID) && document.getElementById('to_'+ID).type == "textarea"){ |
---|
[3839] | 145 | document.getElementById('to_'+ID).focus(); |
---|
[3876] | 146 | } |
---|
[5083] | 147 | |
---|
| 148 | RichTextEditor.setEditable(ID); |
---|
[2] | 149 | return ID; |
---|
| 150 | } |
---|
| 151 | |
---|
[5219] | 152 | function create_border(borderTitle, id_value, search) |
---|
[2] | 153 | { |
---|
[5213] | 154 | |
---|
[3776] | 155 | borderTitle = ( ( borderTitle && borderTitle.constructor == String && borderTitle.length > 0 ) ? borderTitle : ' ' ); |
---|
| 156 | |
---|
[790] | 157 | var resize = false; |
---|
[3995] | 158 | resize = resize_borders(); |
---|
| 159 | if (!resize){ |
---|
| 160 | var str_continue = ''; |
---|
| 161 | var bolContinue = true; |
---|
[5134] | 162 | str_continue = '\n' + get_lang('You must manually close one of your tabs before opening a new one'); |
---|
[3995] | 163 | if (preferences.auto_close_first_tab == 1){ |
---|
| 164 | var children = Element('border_tr').childNodes; |
---|
| 165 | var bolDelete = true; |
---|
| 166 | for (var i=0; i<children.length; i++) { |
---|
| 167 | if ((children[i].nodeName === 'TD') && (children[i].id!=='border_id_0') && (children[i].id!=='border_blank')) |
---|
| 168 | { |
---|
| 169 | bolDelete = true; |
---|
| 170 | var num_child = children[i].id.toString().substr(10); |
---|
| 171 | alternate_border(num_child); |
---|
| 172 | if (editTest(num_child)){ |
---|
| 173 | bolDelete = false; |
---|
| 174 | } |
---|
[5134] | 175 | if (bolDelete || bolContinue){ |
---|
| 176 | str_fechar = '\n' + get_lang('Reached maximum tab limit. Want to close this tab'); |
---|
| 177 | var confirmacao = confirm(str_fechar); |
---|
| 178 | if(confirmacao){ |
---|
[3995] | 179 | bolContinue = false; |
---|
| 180 | delete_border(num_child, 'false'); |
---|
| 181 | break; |
---|
[5134] | 182 | }else{ |
---|
| 183 | return 'maximo'; |
---|
[3995] | 184 | } |
---|
| 185 | } |
---|
| 186 | } |
---|
| 187 | } |
---|
[5134] | 188 | }else{ |
---|
[3995] | 189 | alert(get_lang('Reached maximum tab limit') + str_continue ); |
---|
[5134] | 190 | return 'maximo'; |
---|
[3995] | 191 | } |
---|
| 192 | } |
---|
[2] | 193 | |
---|
[5172] | 194 | if (! id_value){ // Is new message? |
---|
[271] | 195 | var ID = parseInt(BordersArray[(BordersArray.length-1)].sequence) + 1; |
---|
[5172] | 196 | if(isNaN(ID)){ |
---|
| 197 | var aux = BordersArray[(BordersArray.length-1)].sequence.split("_"); |
---|
| 198 | ID = parseInt(aux[1]) + 1; |
---|
| 199 | } |
---|
| 200 | }else |
---|
[790] | 201 | { |
---|
[3839] | 202 | if (Element("border_id_"+id_value)) // It's opened already! |
---|
[790] | 203 | return alternate_border(id_value); |
---|
[3839] | 204 | |
---|
[271] | 205 | var ID = id_value; |
---|
[5213] | 206 | if(isNaN(ID) && ID.indexOf("search_local") >= 0){ |
---|
[5200] | 207 | if(current_folder.indexOf("local") >= 0) |
---|
| 208 | openTab.imapBox[ID] = current_folder; |
---|
| 209 | else |
---|
| 210 | openTab.imapBox[ID] = 'local_search'; |
---|
[5205] | 211 | }else if(isNaN(ID) && ID.indexOf("search_") >= 0){ |
---|
[5200] | 212 | if(current_folder.indexOf("local") < 0) |
---|
| 213 | openTab.imapBox[ID] = current_folder; |
---|
| 214 | else |
---|
| 215 | openTab.imapBox[ID] = 'search'; |
---|
[5284] | 216 | }else if( (currentTab != 0) && isNaN(currentTab) && (currentTab.indexOf("search") >= 0) && (ID.indexOf("msg") < 0) ) { |
---|
[5213] | 217 | var id_border = currentTab.replace(/[a-zA-Z_]+/, ""); |
---|
| 218 | ID_TR = ID.toString().substr(0,ID.toString().indexOf("_r")); |
---|
| 219 | var tr = Element(ID_TR); |
---|
| 220 | openTab.imapBox[ID] = (tr.getAttribute('name') == null?get_current_folder():tr.getAttribute('name')); |
---|
[5200] | 221 | }else |
---|
| 222 | openTab.imapBox[ID] = current_folder; |
---|
[271] | 223 | } |
---|
[2] | 224 | td = document.createElement("TD"); |
---|
| 225 | td.id="border_id_" + ID; |
---|
[3839] | 226 | if(resize) |
---|
| 227 | { |
---|
[2] | 228 | td.setAttribute("width", parseInt(resize)+"px"); |
---|
| 229 | td.style.width = parseInt(resize)+"px"; |
---|
| 230 | } |
---|
| 231 | else |
---|
| 232 | td.setAttribute("width", "200px"); |
---|
[790] | 233 | |
---|
[2] | 234 | td.setAttribute("align", "right"); |
---|
[3018] | 235 | td.onclick = function(){alternate_border(ID);resizeWindow()}; |
---|
[2] | 236 | td.setAttribute("noWrap","true"); |
---|
[3839] | 237 | td.alt = borderTitle.replace( ' ', ' ' ); |
---|
| 238 | td.title = borderTitle; |
---|
[2] | 239 | borderTitle = borderTitle ? borderTitle : id_value ? get_lang("No Subject") : " " ; |
---|
| 240 | td.value = borderTitle; |
---|
[790] | 241 | if (borderTitle.length > 21) |
---|
[2] | 242 | borderTitle = borderTitle.substring(0,21) + "..."; |
---|
[790] | 243 | |
---|
[3839] | 244 | if ( resize ) |
---|
[2] | 245 | borderTitle = borderTitle.substring(0, resize*0.08); |
---|
[5219] | 246 | |
---|
| 247 | var cc = search; |
---|
| 248 | if(!cc){ |
---|
[5222] | 249 | if(isNaN(ID)){ |
---|
| 250 | var is_local = ID.match('.*_local_.*'); |
---|
| 251 | if(!is_local) |
---|
| 252 | cc = document.getElementById("em_message_search").value; |
---|
| 253 | else{ |
---|
| 254 | cc = document.getElementsByName(currentTab)[0].value; |
---|
| 255 | } |
---|
| 256 | }else{ |
---|
| 257 | cc =""; |
---|
[5219] | 258 | } |
---|
| 259 | } |
---|
[2] | 260 | |
---|
[3525] | 261 | td.innerHTML = "<div style='width:100%;border:0;padding:0;'>\n\ |
---|
| 262 | <div id='font_border_id_" + ID+"' class='font-menu' style='width:*;'>" + |
---|
| 263 | borderTitle + |
---|
| 264 | "</div>\n\ |
---|
| 265 | <div style='width:1px;float:left;clear:right;'>\n\ |
---|
[5213] | 266 | <img onmousedown='javascript:return false' style='cursor:pointer' onclick=delete_border('" + ID + "','false') src='templates/"+template+"/images/close_button.gif'/>\n\ " + |
---|
| 267 | "</div>\n\ " + |
---|
[5219] | 268 | "<input type=\"hidden\" name=\""+ ID+"\" value=\""+cc+"\">" + |
---|
[5213] | 269 | "</div>"; |
---|
| 270 | |
---|
[2] | 271 | bb = document.getElementById("border_blank"); |
---|
| 272 | parent_bb = bb.parentNode; //Pego o tbody |
---|
| 273 | parent_bb.insertBefore(td, bb); |
---|
[790] | 274 | |
---|
| 275 | if(! Element("border_id_"+id_value+"_r") ||((typeof(id_value) == 'string') && id_value.match(/_r$/))) |
---|
[2] | 276 | _dragArea.makeDragged(td, id_value,td.value); |
---|
| 277 | |
---|
| 278 | BordersArray[BordersArray.length] = new setBorderAttributes(ID); |
---|
[790] | 279 | |
---|
[2] | 280 | var div = document.createElement("DIV"); |
---|
| 281 | div.id = "content_id_" + ID; |
---|
| 282 | div.className = "conteudo"; |
---|
| 283 | div.style.display=''; |
---|
| 284 | |
---|
[320] | 285 | div.style.overflow = "hidden"; |
---|
[2] | 286 | |
---|
[790] | 287 | Element("exmail_main_body").insertBefore(div,Element("footer_menu")); |
---|
[2] | 288 | alternate_border(ID); |
---|
| 289 | return ID; |
---|
| 290 | } |
---|
| 291 | |
---|
| 292 | function resize_borders() |
---|
| 293 | { |
---|
[3336] | 294 | var numBorders = count_borders(); |
---|
| 295 | |
---|
[2] | 296 | if (numBorders > 8) |
---|
| 297 | return false; |
---|
[3336] | 298 | |
---|
| 299 | return redim_borders(numBorders+1); |
---|
| 300 | } |
---|
| 301 | |
---|
| 302 | function count_borders() |
---|
| 303 | { |
---|
| 304 | var numBorders = 0; |
---|
| 305 | var children = Element('border_tr').childNodes; |
---|
[2] | 306 | for (var i=0; i<children.length; i++) { |
---|
[3336] | 307 | if ((children[i].nodeName === 'TD') && (children[i].id!=='border_id_0') && (children[i].id!=='border_blank')) |
---|
| 308 | numBorders++; |
---|
| 309 | } |
---|
| 310 | |
---|
| 311 | return numBorders; |
---|
| 312 | } |
---|
| 313 | |
---|
| 314 | function redim_borders(numBorders) |
---|
| 315 | { |
---|
| 316 | var children = Element('border_tr').childNodes; |
---|
| 317 | var clientWidth = (window.document.body.clientWidth - findPosX(Element("exmail_main_body"))) - Element("border_id_0").clientWidth - 30; |
---|
| 318 | var newWidthTD = (clientWidth/numBorders)-6; |
---|
| 319 | newWidthTD = newWidthTD > 200 ? 200 : (newWidthTD < 50 ? 50 : newWidthTD); |
---|
| 320 | children = Element('border_tr').childNodes; |
---|
| 321 | for (var i=0; i<children.length; i++) { |
---|
[2] | 322 | if ((children[i].nodeName === 'TD') && (children[i].id!=='border_id_0') && (children[i].id!=='border_blank')){ |
---|
| 323 | children[i].style.width = newWidthTD; |
---|
[3525] | 324 | set_border_caption(children[i].id, children[i].title, newWidthTD); |
---|
[2] | 325 | } |
---|
| 326 | } |
---|
| 327 | return newWidthTD; |
---|
| 328 | } |
---|
| 329 | |
---|
[5268] | 330 | |
---|
| 331 | |
---|
| 332 | |
---|
[3525] | 333 | function set_border_caption(border_id, title, border_width) |
---|
[3372] | 334 | { |
---|
[3525] | 335 | var border = document.getElementById(border_id); |
---|
| 336 | if (border_width == null) |
---|
| 337 | { |
---|
| 338 | border_width = border.clientWidth; |
---|
| 339 | } |
---|
[3372] | 340 | var caption = ""; |
---|
[5134] | 341 | Element("font_"+border.id).style.width = (border_width - 30)+'px'; |
---|
[3372] | 342 | Element("font_"+border.id).innerHTML = title; |
---|
| 343 | return(title); |
---|
| 344 | } |
---|
| 345 | |
---|
[5268] | 346 | opened_alert = false; |
---|
| 347 | |
---|
[3977] | 348 | function draftTests(ID, msg_sent){ |
---|
[5268] | 349 | var cancel = new LertButton(get_lang('cancel'), function() { |
---|
[5134] | 350 | Element("border_id_"+ID).onclick = function () { alternate_border(ID);}; |
---|
| 351 | cRichTextEditor.prototype.focus(ID); |
---|
[5268] | 352 | opened_alert = false; |
---|
[3977] | 353 | }); |
---|
[5134] | 354 | |
---|
[3977] | 355 | var yes = new LertButton(get_lang('Save'), function() { |
---|
[5134] | 356 | save_msg(ID, 'undefined', true); |
---|
[3995] | 357 | openTab.toPreserve[ID] = false; |
---|
| 358 | close_delete(ID, msg_sent); |
---|
[4460] | 359 | delete(openTab.type[ID]); |
---|
[5134] | 360 | //write_msg(get_lang('Your message was save as draft in folder %1.', lang_folder('Drafts'))); |
---|
| 361 | |
---|
[3977] | 362 | }); |
---|
| 363 | var discard = new LertButton(get_lang('Discard'), function() { |
---|
[5268] | 364 | if (openTab.imapBox[ID] && !openTab.toPreserve[ID]) |
---|
[3977] | 365 | { |
---|
| 366 | //delete_msgs(openTab.imapBox[ID], openTab.imapUid[ID].toString(), 0) |
---|
| 367 | //delete(openTab.imapBox[ID]); |
---|
| 368 | openTab.toPreserve[ID] = false; |
---|
| 369 | } |
---|
[4460] | 370 | delete(openTab.type[ID]); |
---|
[3977] | 371 | close_delete(ID, msg_sent); |
---|
| 372 | }); |
---|
[5268] | 373 | if(opened_alert) { |
---|
[5274] | 374 | Element("border_id_"+ID).onclick = function () { alternate_border(ID);}; |
---|
[5268] | 375 | document.getElementById('lertOverlay').style.display='none'; |
---|
| 376 | document.getElementById('lertContainer').style.display='none'; |
---|
| 377 | document.getElementById('lertContainer').innerHTML = ''; |
---|
| 378 | |
---|
| 379 | opened_alert = false; |
---|
| 380 | return; |
---|
| 381 | } |
---|
| 382 | var titulo = '<b>' + get_lang('Warning') + '!</b>'; |
---|
[3977] | 383 | var message = get_lang("Your changes are not saved. What to do?"); |
---|
| 384 | var multConfirm = new Lert( |
---|
| 385 | titulo, |
---|
| 386 | message, |
---|
| 387 | [cancel,discard,yes], |
---|
| 388 | { |
---|
| 389 | defaultButton:yes, |
---|
| 390 | icon:'js/lert/images/dialog-help.gif' |
---|
| 391 | }); |
---|
| 392 | multConfirm.display(); |
---|
[5268] | 393 | opened_alert = true; |
---|
[3977] | 394 | } |
---|
| 395 | |
---|
[3995] | 396 | function editTest(ID){ |
---|
| 397 | var body = document.getElementById('body_'+ ID); |
---|
| 398 | if (body) |
---|
| 399 | { |
---|
| 400 | var save_link = Element("save_message_options_"+ID); |
---|
| 401 | if (openTab.toPreserve[ID] == undefined) |
---|
| 402 | openTab.toPreserve[ID] = false; |
---|
| 403 | if (((! openTab.toPreserve[ID] && ! ID.toString().match("_r")) || ((body.contentWindow) == 'object' && body.contentWindow.document.designMode.toLowerCase() == 'on')) && (save_link.onclick != '')) |
---|
| 404 | { |
---|
| 405 | return true; |
---|
| 406 | } |
---|
| 407 | } |
---|
| 408 | return false; |
---|
| 409 | } |
---|
| 410 | |
---|
[2] | 411 | function delete_border(ID, msg_sent) |
---|
| 412 | { |
---|
[5134] | 413 | |
---|
[3977] | 414 | var bolExecuteClose = true; |
---|
[5134] | 415 | var borderElem = Element("border_id_" + ID); |
---|
[3995] | 416 | if (borderElem){ |
---|
| 417 | borderElem.onclick = null; // It's avoid a FF3 bug |
---|
| 418 | }else{ |
---|
| 419 | return false; |
---|
| 420 | } |
---|
[2] | 421 | if (msg_sent == 'false') |
---|
| 422 | { |
---|
[3995] | 423 | if (editTest(ID)){ |
---|
| 424 | bolExecuteClose = false; |
---|
| 425 | return(draftTests(ID, msg_sent)); |
---|
| 426 | } |
---|
[2] | 427 | } |
---|
[3977] | 428 | if (bolExecuteClose) |
---|
| 429 | { |
---|
| 430 | close_delete(ID, msg_sent); |
---|
[4460] | 431 | } |
---|
| 432 | delete(openTab.type[ID]); |
---|
[3977] | 433 | return true; |
---|
| 434 | } |
---|
[2] | 435 | |
---|
[3977] | 436 | function close_delete(ID, msg_sent) |
---|
| 437 | { |
---|
[606] | 438 | openTab.toPreserve[ID] = false; |
---|
| 439 | openTab.imapUid[ID] = 0; |
---|
[271] | 440 | |
---|
[801] | 441 | if (preferences.auto_save_draft == 1) |
---|
| 442 | { |
---|
| 443 | if (openTab.autosave_timer[ID]) |
---|
| 444 | clearTimeout(openTab.autosave_timer[ID]); |
---|
| 445 | openTab.autosave_timer[ID] = false; |
---|
| 446 | } |
---|
| 447 | |
---|
[2] | 448 | hold_session = false; |
---|
[790] | 449 | if (exist_className(Element('border_id_'+ID),'menu-sel')) |
---|
[2] | 450 | { |
---|
[790] | 451 | if (BordersArray[BordersArray.length-2].sequence == ID) |
---|
[2] | 452 | this.alternate_border(0); |
---|
| 453 | else |
---|
[790] | 454 | this.alternate_border(BordersArray[BordersArray.length-2].sequence); |
---|
[2] | 455 | } |
---|
| 456 | |
---|
| 457 | // Remove TD, title |
---|
[320] | 458 | border = Element('border_id_' + ID); |
---|
[2] | 459 | border.parentNode.removeChild(border); |
---|
[790] | 460 | var j=0; |
---|
[2] | 461 | var new_BordersArray = new Array(); |
---|
| 462 | for (i=0;i<BordersArray.length;i++) |
---|
[790] | 463 | if (document.getElementById(BordersArray[i].border_id) != null){ |
---|
[2] | 464 | new_BordersArray[j] = BordersArray[i]; |
---|
[790] | 465 | j++; |
---|
[2] | 466 | } |
---|
[58] | 467 | if(j == 1) |
---|
| 468 | Element("footer_menu").style.display = ''; |
---|
[2] | 469 | BordersArray = new_BordersArray; |
---|
[790] | 470 | |
---|
| 471 | // Remove Div Content |
---|
| 472 | content = Element('content_id_' + ID); |
---|
| 473 | content.parentNode.removeChild(content); |
---|
[3018] | 474 | resizeWindow(); |
---|
[5083] | 475 | RichTextEditor.destroy( 'body_'+ID ); |
---|
[5134] | 476 | |
---|
| 477 | //Caso for uma mensagem anexada tem que deletar ela da lixeira apos fechar a aba |
---|
| 478 | var isPartMsg = false; |
---|
| 479 | var id2 = ID.replace('_r',''); |
---|
| 480 | for(var ii = 0; ii < partMsgs.length; ii++) |
---|
| 481 | if(partMsgs[ii] == id2){ |
---|
| 482 | isPartMsg = true; |
---|
| 483 | partMsgs[ii] = null; |
---|
| 484 | } |
---|
| 485 | |
---|
| 486 | if(isPartMsg === true){ |
---|
| 487 | var handler_delete_msg = function(){}; |
---|
| 488 | cExecute ("$this.imap_functions.delete_msgs&folder=INBOX"+cyrus_delimiter+trashfolder+"&msgs_number="+id2,handler_delete_msg); |
---|
| 489 | } |
---|
| 490 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 491 | |
---|
[320] | 492 | return true; |
---|
[4802] | 493 | } |
---|
| 494 | |
---|
[5134] | 495 | function getTabPrefix() { // define o prefixo para os checkboxes das mensagens |
---|
| 496 | if (typeof(currentTab)!='number') |
---|
| 497 | return currentTab+"_"; |
---|
| 498 | else |
---|
| 499 | return ""; |
---|
| 500 | } |
---|
| 501 | |
---|
[4807] | 502 | function getMessageIdFromRowId(row_id) { // extrai o id da mensagem do id da linha |
---|
| 503 | var p = row_id.search("_s"); |
---|
| 504 | if (p>0) |
---|
| 505 | return row_id.substr(0,p); |
---|
[4802] | 506 | else |
---|
| 507 | return row_id; |
---|
[4807] | 508 | } |
---|
| 509 | |
---|
| 510 | function getNumBoxFromTabId(tab_id) { // extrai o numBox do id da tab |
---|
| 511 | if (typeof(tab_id)=='number') { |
---|
| 512 | return tab_id; |
---|
| 513 | } |
---|
| 514 | else { |
---|
| 515 | var p = tab_id.search(/[0-9]/); |
---|
| 516 | return tab_id.substr(p); |
---|
| 517 | } |
---|
[4843] | 518 | } |
---|