source: sandbox/expresso-solr/expressoMail1_2/js/abas.js @ 8056

Revision 8056, 23.4 KB checked in by gustavo, 11 years ago (diff)

Ticket #000 - Commit contendo o expresso com solr funcionando corretamente

  • Property svn:eol-style set to native
  • Property svn:executable set to *
RevLine 
[2]1var BordersArray = new Array();
2BordersArray[0] = new setBorderAttributes(0);
[5083]3var countBorders = 0;
[5134]4var partMsgs = new Array();
[5604]5var msgAttachments = new Array();
6var uidsSave = new Array();
[5637]7var zebraDiscardEventDialog = false;
[6085]8var saveBorderError = new Array();
9
[2]10function setBorderAttributes(ID)
11{
12        this.border_id = "border_id_"+ID;
13        this.sequence = ID;
14}
15
16
17function alternate_border(ID)
18{
[5367]19        msg_selected = false;//Controle da seleção de mensagens
[5250]20        if(isNaN(ID))
[5260]21                if(preferences.use_shortcuts == "1")
22                        select_msg((ID.split("_"))[0]);
[3839]23        if( document.getElementById("div_menu_c3") != null )
24        {
25                var node = document.getElementById("div_menu_c3").firstChild;
26               
27                while ( node )
28                {
29                        node.style.display = "none";
30                        node = node.nextSibling;
31                }
32               
33                if( document.getElementById("span_paging"+ID) != null )
34                        document.getElementById("span_paging"+ID).style.display = "block";
35        }
36       
[4787]37        if ( typeof win == 'object' && win.close && win.close.constructor == Function ){
38            var search_win = document.getElementById( 'window_QuickCatalogSearch' );
39            if(search_win){
40                search_win.style.visibility = 'hidden';
41            }
42            win.close( );
43        }
44               
[320]45        if (! Element('border_id_'+ID))
46                return false; // Not possible to alternate
[412]47        show_hide_span_paging(ID);
[790]48        spanD = Element("span_D");
49        if (spanD)
50                spanD.style.display = (openTab.type[ID] == 0 ? '' : 'none');
[1701]51
52        var footer_menu = Element("footer_menu");       
[5134]53        var aba = Element('border_id_'+ID);
54        if (footer_menu != null) {
[1701]55                footer_menu.style.display = (openTab.type[ID] != 4 ? '' : 'none');
[5200]56                var alternate_menu = document.getElementById('localOption');
[5213]57               
[5200]58                if(alternate_menu != null && alternate_menu != 'undefined'){ //Quando Carregado o expresso mail
59                        if(openTab.imapBox[ID]!= null && openTab.imapBox[ID]!= 'undefined' ){ //Quando abrir uma Nova Mensagem
60                                if((openTab.imapBox[ID].indexOf("local_") >= 0)){                                               
61                                                alternate_menu.title = get_lang("Unarchive");
62                                                alternate_menu.removeAttribute("onclick");
[5213]63                                                if(!is_ie)
64                                                        alternate_menu.setAttribute("onclick",  'expresso_local_messages.unarchive_msgs(\''+openTab.imapBox[ID]+'\', null)');
65                                                else{
66                                                        alternate_menu.onclick = function(){
67                                                                expresso_local_messages.unarchive_msgs(openTab.imapBox[ID], null);
68                                                        }
69                                                }
[5200]70                                                alternate_menu.innerHTML = get_lang("Unarchive");
71                                               
72                                        }else{
73                                                alternate_menu.title = get_lang("Archive");
74                                                alternate_menu.removeAttribute("onclick");
[5213]75                                                if(!is_ie)
76                                                        alternate_menu.setAttribute("onclick", 'archive_msgs(\''+openTab.imapBox[ID]+'\', null)');             
77                                                else{
78                                                        alternate_menu.onclick = function(){
79                                                                archive_msgs(openTab.imapBox[ID], null);
80                                                        }       
81                                                }
[5200]82                                                alternate_menu.innerHTML = get_lang("Archive");
83                                        }
[5213]84                                       
[5200]85                        }
86                }
[5213]87               
[5200]88                if((aba.id.indexOf("_r") < 0) && (aba.id.indexOf("_0") < 0) && (aba.id.indexOf("id_search_") < 0) && (aba.id.indexOf("_s") < 0)){
[5134]89                        spanD.style.display = 'none';
90                        footer_menu.style.display = 'none';                     
91                }
[1701]92        }
93
[5134]94
[2]95        var len = BordersArray.length;
96        for (var i=0; i < len; i++)
97        {
98                m = document.getElementById(BordersArray[i].border_id);
[320]99                if ((m)&&(m.className == 'menu-sel'))
[2]100                {
101                        m.className = 'menu';
102                        c = document.getElementById("content_id_"+BordersArray[i].sequence);
103                        c.style.display = 'none';
104                        if(Element("font_border_id_"+BordersArray[i].sequence))
105                                Element("font_border_id_"+BordersArray[i].sequence).className = 'font-menu';   
[5083]106
[2]107                }
108        }
109
110        m = Element("border_id_"+ID);
[320]111        if (m)
112                m.className = 'menu-sel';
[2]113        if(Element("font_border_id_" + ID))
114                Element("font_border_id_" + ID).className = 'font-menu-sel';
115        var c = Element("content_id_"+ID)
[320]116        if (c)
117                c.style.display = '';
[2]118
119
120        // hide the DropDrowContact, if necessary
121        window_DropDownContacts = Element('tipDiv');
122        if ((window_DropDownContacts)&&(window_DropDownContacts.style.visibility != 'hidden')){
123                window_DropDownContacts.style.visibility = 'hidden';
124        }
[320]125
[5134]126        numBox = getNumBoxFromTabId(ID);
[4889]127        if (typeof(ID)=='number') {
128                 numBox = ID;
129         }
130         else {
131             if (ID.match("search_"))
132             {
133                 if (ID.match("search_local_msg"))
134                 {
135                         var p = ID.search(/[0-9]/);
136                         numBox =  ID.substr(p);
137                 }
138                 else
139                 {
140                         numBox = ID.substr(7);
141                 }
142             }
143         }
[1701]144        currentTab=ID;
[5498]145        if( document.getElementById('to_'+ID) && document.getElementById('to_'+ID).type == "textarea"){
146            document.getElementById('to_'+ID).focus();
147        }
[6930]148        if (ID == 0){
149                updateSelectedMsgs();
150        }
[5083]151        RichTextEditor.setEditable(ID);
[6229]152        resizeWindow();
[2]153        return ID;
154}
155
[5219]156function create_border(borderTitle, id_value, search)
[2]157{
[6122]158        borderTitle = ( ( borderTitle && borderTitle.constructor == String && borderTitle.length > 0 ) ? borderTitle : ' ' );
[6104]159    borderTitle = html_entities(borderTitle);   
[790]160        var resize = false;
[3995]161        resize = resize_borders();
162        if (!resize){
163            var str_continue = '';
164            var bolContinue = true;
[5134]165                        str_continue = '\n' + get_lang('You must manually close one of your tabs before opening a new one');
[3995]166            if (preferences.auto_close_first_tab == 1){
167                var children = Element('border_tr').childNodes;
168                var bolDelete = true;
169                for (var i=0; i<children.length; i++) {
170                    if ((children[i].nodeName === 'TD') && (children[i].id!=='border_id_0') && (children[i].id!=='border_blank'))
171                    {
172                        bolDelete = true;
173                        var num_child = children[i].id.toString().substr(10);
174                        alternate_border(num_child);
175                        if (editTest(num_child)){
176                            bolDelete = false;
177                        }
[5134]178                        if (bolDelete || bolContinue){
179                                                        str_fechar = '\n' + get_lang('Reached maximum tab limit. Want to close this tab');
180                                                        var confirmacao = confirm(str_fechar);
181                            if(confirmacao){
[3995]182                            bolContinue = false;
183                            delete_border(num_child, 'false');
184                            break;
[5134]185                                                        }else{
186                                                                return 'maximo';
[3995]187                        }
188                    }
189                }
190            }
[5134]191            }else{                     
[3995]192                alert(get_lang('Reached maximum tab limit') + str_continue );
[5134]193                return 'maximo';
[3995]194            }
195        }
[2]196       
[5172]197        if (! id_value){ // Is new message?
[271]198                var ID = parseInt(BordersArray[(BordersArray.length-1)].sequence) + 1;
[5172]199                        if(isNaN(ID)){
200                                var aux = BordersArray[(BordersArray.length-1)].sequence.split("_");
201                                ID = parseInt(aux[1]) + 1;
202                        }
203        }else
[790]204        {
[3839]205                if (Element("border_id_"+id_value)) // It's opened already!
[790]206                        return alternate_border(id_value);
[3839]207               
[271]208                var ID = id_value;
[5213]209                if(isNaN(ID) && ID.indexOf("search_local") >= 0){
[5200]210                        if(current_folder.indexOf("local") >= 0)
211                                openTab.imapBox[ID] = current_folder;
212                        else
213                                openTab.imapBox[ID] = 'local_search';
[5205]214                }else if(isNaN(ID) && ID.indexOf("search_") >= 0){
[5200]215                        if(current_folder.indexOf("local") < 0)
216                                openTab.imapBox[ID] = current_folder;
217                        else
218                                openTab.imapBox[ID] = 'search';
[5284]219                }else if( (currentTab != 0) && isNaN(currentTab) && (currentTab.indexOf("search") >= 0) && (ID.indexOf("msg") < 0) ) {
[5213]220                        var id_border = currentTab.replace(/[a-zA-Z_]+/, "");
221                        ID_TR = ID.toString().substr(0,ID.toString().indexOf("_r"));
[7414]222                        var tr = Element(ID_TR) ? Element(ID_TR) : Element(ID_TR+"_s"+id_border);
[5213]223                        openTab.imapBox[ID] = (tr.getAttribute('name') == null?get_current_folder():tr.getAttribute('name'));
[5200]224                }else
225                        openTab.imapBox[ID] = current_folder;
[271]226        }
[8056]227        ID = $.trim(ID);
[2]228        td = document.createElement("TD");
229        td.id="border_id_" + ID;
[3839]230        if(resize)
231        {
[2]232                td.setAttribute("width", parseInt(resize)+"px");
233                td.style.width = parseInt(resize)+"px";
234        }
235        else
236                td.setAttribute("width", "200px");
[790]237
[2]238        td.setAttribute("align", "right");
[3018]239        td.onclick = function(){alternate_border(ID);resizeWindow()};
[2]240        td.setAttribute("noWrap","true");
[6122]241    td.alt = ' ';
[3839]242    td.title = borderTitle;
[6122]243        borderTitle = borderTitle ?  borderTitle : id_value ? get_lang("No Subject") : " "      ;
[2]244        td.value = borderTitle;
[790]245        if (borderTitle.length > 21)
[2]246                borderTitle = borderTitle.substring(0,21) + "...";
[790]247
[3839]248        if ( resize )
[2]249                borderTitle = borderTitle.substring(0, resize*0.08);
[5219]250       
251        var cc = search;
252        if(!cc){
[5222]253                if(isNaN(ID)){
254                        var is_local = ID.match('.*_local_.*');
255                        if(!is_local)
256                                cc = document.getElementById("em_message_search").value;
257                        else{
[7414]258                                if (currentTab == 0)
259                                        cc = "";
260                                else
261                                        cc = document.getElementsByName(currentTab)[0].value;
[5222]262                        }
263                }else{
264                        cc ="";
[5219]265                }
266        }
[5754]267        td.innerHTML = "<div><div id='font_border_id_" + ID+"' class='font-menu'>" +
[3525]268                                borderTitle +
269                            "</div>\n\
[5754]270                            <div style='float:right;'>\n\
[5213]271                                <img onmousedown='javascript:return false' style='cursor:pointer' onclick=delete_border('" + ID + "','false') src='templates/"+template+"/images/close_button.gif'/>\n\ " +
272                            "</div>\n\ " +
[5754]273                                                        "<input type=\"hidden\" name=\""+ ID+"\" value=\""+cc+"\"></div>";             
[2]274        bb = document.getElementById("border_blank");
275        parent_bb = bb.parentNode; //Pego o tbody
276        parent_bb.insertBefore(td, bb);
[790]277
[6432]278        if((typeof(id_value) == 'string') && id_value.match(/_r/)){
[5486]279                $(td).draggable({
[5499]280                        start : function(){
281                                if($(".shared-folders").length){
282                                        $(".shared-folders").parent().find('.folder:not(".shared-folders")').droppable({
283                                                over : function(a, b){                                         
284                                                        //SETA BORDA EM VOLTA DA PASTA
[5765]285                                                        over = $(this);
286                                                        $(this).addClass("folder-over");
287                                                        if(($(this)[0] != $(this).parent().find(".head_folder")[0]))
288                                                                if($(this).prev()[0])
289                                                                        if($(this).parent().find(".expandable-hitarea")[0] == $(this).prev()[0]){
290                                                                                setTimeout(function(){
291                                                                                        if(over.hasClass("folder-over"))
292                                                                                                over.prev().trigger("click");
293                                                                                }, 500);
294                                                                               
295                                                                        }
[5499]296                                                },
297                                                out : function(){
298                                                        //RETIRA BORDA EM VOLTA DA PASTA
[5765]299                                                        $(this).removeClass("folder-over");
[5499]300                                                },
301                                                //accept: ".draggin_mail",
302                                                drop : function(event, ui){
303                                                        $(this).css("border", "");
304                                                        if($(this).parent().attr('id') == undefined){
305                                                                var folder_to = 'INBOX';
306                                                                var to_folder_title = get_lang("Inbox");
307                                                        }else{
308                                                                var folder_to = $(this).parent().attr('id');
309                                                                var to_folder_title = $(this).attr('title');
310                                                        }               
311                                                        var folder_to_move = ui.draggable.parent().attr('id');
312                                                        var border_id = ui.draggable.find("input[type=hidden]").attr("name");
313                                                        if(folder_to_move == "border_tr"){
[6458]314                                                                var id_msg = border_id.split("_")[0];
[5499]315                                                                folder = $("#input_folder_"+border_id+"_r")[0] ? $("#input_folder_"+border_id+"_r").val() : (openTab.imapBox[border_id] ? openTab.imapBox[border_id]:get_current_folder());
316                                                                move_msgs2(folder, id_msg, border_id, folder_to, to_folder_title,true);
317                                                                return refresh();
318                                                        }
319                                                }
320                                        });
321                                }
322                        },
323                        stop :function(){
324                                $(".shared-folders").parent().find(".folder").droppable("destroy");
325                        },
[5486]326                        helper: function(event){
327                                if(     borderTitle.length > 18 )
[5754]328                                        return $("<td>"+DataLayer.render('../prototype/modules/mail/templates/draggin_box.ejs', {texto : borderTitle.substring(0,18) + "...", type: "messages"})+"</td>");
[5486]329                                else
[5754]330                                        return $("<td>"+DataLayer.render('../prototype/modules/mail/templates/draggin_box.ejs', {texto : borderTitle, type: "messages"})+"</td>");
[5486]331                        },
[5754]332                        delay: 150,
333                        cursorAt: {top: 5, left: 56},
[5486]334                        refreshPositions: true ,
335                        containment: "#divAppbox"
336                });
337        }
338                //_dragArea.makeDragged(td, id_value,td.value);
[2]339
340        BordersArray[BordersArray.length] = new setBorderAttributes(ID);
[790]341
[2]342        var div = document.createElement("DIV");
343        div.id = "content_id_" + ID;
344        div.className = "conteudo";
345        div.style.display='';
346
[320]347        div.style.overflow = "hidden";
[2]348
[5459]349        Element("exmail_main_body").insertBefore(div,Element("footer_menu"));       
[6181]350        if (!is_ie)
351                resizeWindow();
[2]352        alternate_border(ID);
[6085]353    uidsSave[ID] = [];
354    saveBorderError[ID] = false;
[2]355        return ID;
356}
357
358function resize_borders()
359{
[3336]360        var numBorders = count_borders();
361
[2]362        if (numBorders > 8)
363                return false;
[3336]364
365        return redim_borders(numBorders+1);
366}
367
368function count_borders()
369{
370        var numBorders = 0;
371        var children = Element('border_tr').childNodes;
[2]372        for (var i=0; i<children.length; i++) {
[3336]373            if ((children[i].nodeName === 'TD') && (children[i].id!=='border_id_0') && (children[i].id!=='border_blank'))
374                numBorders++;
375        }
376
377        return numBorders;
378}
379
380function redim_borders(numBorders)
381{
382        var children = Element('border_tr').childNodes;
383        var clientWidth = (window.document.body.clientWidth - findPosX(Element("exmail_main_body"))) - Element("border_id_0").clientWidth - 30;
384        var newWidthTD = (clientWidth/numBorders)-6;
385        newWidthTD = newWidthTD > 200 ? 200 : (newWidthTD < 50 ? 50 : newWidthTD);
386        children = Element('border_tr').childNodes;
387        for (var i=0; i<children.length; i++) {
[2]388                if ((children[i].nodeName === 'TD') && (children[i].id!=='border_id_0') && (children[i].id!=='border_blank')){
[5754]389                        $(children[i]).css("width", newWidthTD);
390                        $(children[i]).find('div:first').css("width", newWidthTD);
[3525]391                        set_border_caption(children[i].id, children[i].title, newWidthTD);
[2]392                }
393        }
394        return newWidthTD;
395}
396
[5268]397
398
399
[3525]400function set_border_caption(border_id, title, border_width)
[3372]401{
[3525]402        var border = document.getElementById(border_id);
403        if (border_width == null)
404        {
405            border_width = border.clientWidth;
406        }
[3372]407        var caption = "";
[6458]408    if (border != null){
409                Element("font_"+border.id).style.width = (border_width - 35)+'px';
410                Element("font_"+border.id).innerHTML = title;
411        }
[3372]412        return(title);
413}
414
[5268]415
[3977]416function draftTests(ID, msg_sent){
[5637]417   
418       
419        if( openTab.toPreserve[ID] = false)
420        {
421            close_delete(ID, msg_sent);
422            delete(openTab.type[ID]);
423        }   
424        else 
425        {
426             var msg = 'Existem alterações não salvas na mensagem.';
[6101]427             var buttons = ['Descartar alterações', 'Salvar e fechar' ,'Cancelar'];
[6102]428             var width = 371;
[5637]429             if($('#fileupload_msg'+ID).find('.in-progress').length)
430             {
[5702]431                 msg = 'Existem anexos sendo enviados para o servidor.';
[5637]432                 buttons = ['Descartar alterações e anexos', 'Salvar estado atual fechar', 'Continuar editando'];
433                 width = 560;
434             }
435             zebraDiscardEventDialog = true;
436             window.setTimeout(function() {
437                $.Zebra_Dialog(msg, {
438                            'type':     'question',
439                            'overlay_opacity': '0.5',
440                            'buttons':  buttons,
441                            'width' : width,
442                            'onClose':  function(clicked) {
[6557]443                                                                        if(clicked == 'Cancelar'){
444                                                                                if (RichTextEditor.plain[id] != true)
445                                                                                        setTimeout("RichTextEditor.focus("+ID+")",100);                 
446                                                                                else 
447                                                                                        $('#body_'+ID).focus();
448                                                                        }
[5637]449                                    if(clicked == 'Descartar alterações' || clicked == 'Descartar alterações e anexos' ) {
450                                        if (openTab.imapBox[ID] && !openTab.toPreserve[ID])
451                                            openTab.toPreserve[ID] = false;
452
453                                        delete(openTab.type[ID]);
454                                        close_delete(ID, msg_sent);
[7520]455                                       
[5637]456                                    }
457                                    else if(clicked == 'Salvar e fechar' || clicked == 'Salvar estado atual fechar')
458                                    {
459                                        save_msg(ID);
460                                        openTab.toPreserve[ID] = false;
[7520]461                                   
[5637]462                                        close_delete(ID, msg_sent);
463                                        delete(openTab.type[ID]);
464                                    }   
465                                    else{
466
467                                        Element("border_id_"+ID).onclick = function () {alternate_border(ID);};
468                                        var setFocus = function(ID){
469                                                        if ($.trim($("#to_"+ID).val()) == "")
470                                                                $("#to_"+ID).focus();
471                                                        else if ($("#tr_cc_"+ID).css('display') != 'none' && $.trim($("#cc_"+ID).val()) == "")
472                                                                $("#cc_"+ID).focus();
473                                                        else if ($("#tr_cco_"+ID).css('display') != 'none' && $.trim($("#cco_"+ID).val()) == "")
474                                                                $("#cco_"+ID).focus();         
475                                                        else if ($.trim($("#subject_"+ID).val()) == "")
476                                                                $("#subject_"+ID).focus();
477                                                        else{
478                                                                if (RichTextEditor.plain[id] != true)
479                                                                        setTimeout("RichTextEditor.focus("+ID+")",100);                 
480                                                                else 
481                                                                        $('#body_'+ID).focus();
482                                                        }
483                                                }
484                                                setFocus(ID); 
485                                    }
486                                    window.setTimeout(function() {
487                                            zebraDiscardEventDialog = false;
488                                    }, 500);
489                            }})}, 300);   
490        }
[5134]491       
[3977]492}
493
[3995]494function editTest(ID){
495    var body = document.getElementById('body_'+ ID);
[5911]496        var content = $('#content_id_'+ ID);
[3995]497    if (body)
498    {
[5911]499        var save_link = content.find(".save");
[3995]500        if (openTab.toPreserve[ID] == undefined)
501                openTab.toPreserve[ID] = false;
502        if (((! openTab.toPreserve[ID] && ! ID.toString().match("_r")) || ((body.contentWindow) == 'object' && body.contentWindow.document.designMode.toLowerCase() == 'on')) && (save_link.onclick != ''))
503        {
504            return true;
505        }
506    }
507    return false;
508}
509
[2]510function delete_border(ID, msg_sent)
511{
[7520]512
513        /*if($("#border_id_"+ID).attr("title") == get_lang("New Message")){
[6684]514                var to = $("#content_id_"+ID).find(".to").parent(".email-area").find("div").length || $("#content_id_"+ID).find(".email-area").find(".to").val();
515                var cc = $("#content_id_"+ID).find(".cc").parent(".email-area").find("div").length || $("#content_id_"+ID).find(".email-area").find(".cc").val();
516                var cco = $("#content_id_"+ID).find(".cco").parent(".email-area").find("div").length || $("#content_id_"+ID).find(".email-area").find(".cco").val();
517                var subject = $("#content_id_"+ID).find(".subject").val();
[6681]518                var auxAttachments = false;
[6684]519                var attachments = $("#content_id_"+ID).find("ul.attachments-list").find("li").each(function(){
[6681]520                        ($(this).find("p").length > 0) ? auxAttachments = true : auxAttachments;
521                        if(auxAttachments)
522                                return false;
523                });
[6684]524                var textArea = RichTextEditor.getData("body_"+ID);
[6681]525               
526                if(!to && !cc && !cco && !auxAttachments && subject == "" && textArea == "")
[6892]527                {
528            var borderElem = Element("border_id_" + ID);
[6878]529                        borderElem.onclick = null;
[6681]530                        close_delete(ID, msg_sent);
[6960]531                }
[6681]532        }
[7520]533    */
534    if($("#content_id_"+currentTab+" textarea[name=input_to]").length ){
535        if($("#content_id_"+currentTab+" .save").is(':disabled') ) {
536             close_delete(ID, msg_sent);
537        } else if( $("#content_id_"+currentTab+" .save").is(':enabled') ) {
538             return(draftTests(ID, msg_sent));
539        }
540    } else {
541        close_delete(ID, msg_sent);
542    }
543     
544    /*var bolExecuteClose = true;
[5134]545        var borderElem = Element("border_id_" + ID);
[3995]546        if (borderElem){
547            borderElem.onclick = null; // It's avoid a FF3 bug
548        }else{
549            return false;
550        }
[2]551        if (msg_sent == 'false')
552        {
[3995]553            if (editTest(ID)){
554                bolExecuteClose = false;
[5637]555                if(zebraDiscardEventDialog === false)
556                    return(draftTests(ID, msg_sent));
[3995]557            }
[2]558        }
[7520]559   
560       
[3977]561        if (bolExecuteClose)
562        {
563            close_delete(ID, msg_sent);
[4460]564                }
565                delete(openTab.type[ID]);
[7520]566        return true;*/
567         delete(openTab.type[ID]);
[3977]568        return true;
569}
[2]570
[3977]571function close_delete(ID, msg_sent)
572{
[606]573        openTab.toPreserve[ID] = false;
[5459]574        // Limpa o autosave
575            if (preferences.auto_save_draft == 1 && autoSaveControl.timer[ID] !== null )
576            {
577                autoSaveControl.status[ID] = null;
578                clearInterval(autoSaveControl.timer[ID]);
579            }
580        ////////////////////////////////
581       
[2]582        hold_session = false;
[790]583        if (exist_className(Element('border_id_'+ID),'menu-sel'))
[2]584        {
[790]585                if (BordersArray[BordersArray.length-2].sequence == ID)
[2]586                        this.alternate_border(0);
587                else
[790]588                        this.alternate_border(BordersArray[BordersArray.length-2].sequence);
[2]589        }
590
591        // Remove TD, title
[320]592        border = Element('border_id_' + ID);
[2]593        border.parentNode.removeChild(border);
[790]594        var j=0;
[2]595        var new_BordersArray = new Array();
596        for (i=0;i<BordersArray.length;i++)
[790]597                if (document.getElementById(BordersArray[i].border_id) != null){
[2]598                        new_BordersArray[j] = BordersArray[i];
[790]599                        j++;
[2]600                }
[58]601        if(j == 1)
602                Element("footer_menu").style.display = '';
[2]603        BordersArray = new_BordersArray;
[790]604
605        // Remove Div Content
606        content = Element('content_id_' + ID);
607        content.parentNode.removeChild(content);
[6204]608        if(is_webkit)
609                resizeWindow();
[5083]610        RichTextEditor.destroy( 'body_'+ID );
[5620]611        delete msgAttachments[ID];
[5134]612        //Caso for uma mensagem anexada tem que deletar ela da lixeira apos fechar a aba
613            var isPartMsg = false;
[5911]614                        if(!parseInt(id2))
615                                return;
[5134]616            var id2 = ID.replace('_r','');
617            for(var ii = 0; ii < partMsgs.length; ii++)
618               if(partMsgs[ii] == id2){           
619                  isPartMsg = true;
620                  partMsgs[ii] = null;
621               }     
622
623            if(isPartMsg === true){
624                var handler_delete_msg = function(){};
625                cExecute ("$this.imap_functions.delete_msgs&folder=INBOX"+cyrus_delimiter+trashfolder+"&msgs_number="+id2,handler_delete_msg);
626            }
627        ///////////////////////////////////////////////////////////////////////////////////
628       
[320]629        return true;
[4802]630}
631
[5134]632function getTabPrefix() { // define o prefixo para os checkboxes das mensagens
633        if (typeof(currentTab)!='number')
634                return currentTab+"_";
635        else
636                return "";
637}
638
[4807]639function getMessageIdFromRowId(row_id) { // extrai o id da mensagem do id da linha
640        var p = row_id.search("_s");
641        if (p>0)
642                return row_id.substr(0,p);
[4802]643        else
644                return row_id;
[4807]645}
646
647function getNumBoxFromTabId(tab_id) { // extrai o numBox do id da tab
648        if (typeof(tab_id)=='number') {
649                return tab_id;
650        }
651        else {
652                var p = tab_id.search(/[0-9]/);
653                return tab_id.substr(p);
654        }
[4843]655}
[5604]656
657function addAttachment(ID, att)
658{
659    if(typeof(msgAttachments[ID]) == 'undefined')
660            msgAttachments[ID] = [];
661
662        msgAttachments[ID].push(att);
663}
664
665function delAttachment(ID, att)
666{
667   
668    if(msgAttachments[ID] == undefined) return;
669    var len = msgAttachments[ID].length;
670    for(var i = 0; i < len; i++)
671    {
672        if(msgAttachments[ID][i] == att)
673        {
[5620]674            delete msgAttachments[ID][i];
[5604]675            break;
676        }
677    } 
678}
679
680function listAttachment(ID)
681{
682   return (typeof(msgAttachments[ID]) == 'undefined') ? '' : JSON.stringify(msgAttachments[ID]);
683}
684
Note: See TracBrowser for help on using the repository browser.