var openTab = { 'type' : [], // 8 types of tabs, further info. see expressolivre.org/dev/wiki/mail/Documentacao 'content_id' : [], 'imapUid' : [], // Stores the imap email number of current tab 'countFile' : [0,0,0,0,0,0,0,0,0,0], // Stores the number of files attached in current tab 'imapBox' : [], // Stores the folder name 'toPreserve' : [], // Check if the message should be removed from draft after send 'autosave_timer' : [] // The timeout timer for autosave function }; var tabTypes = { 'new':4, 'forward':6, 'reply_with_history':7, 'reply_to_all_with_history':7, 'reply_without_history':7, 'reply_to_all_without_history':7, 'edit':5 } var currentTab,numBox = 0; // Open Tab and num of mailboxes opened at context function draw_tree_folders(folders){ // Check if the tree folders alredy exist. if (Element('dftree_tree_folders')){ var update_tree_folders = function(data){ build_quota(data); var unseen_in_mailbox = 0; var unseen_in_shared_folders = 0; for (var i=0; i 0 ) { unseen_in_mailbox = parseInt( unseen_in_mailbox + data[ i ].folder_unseen ); if ( data[i].folder_id.indexOf( 'INBOX' ) !== 0 ) unseen_in_shared_folders = parseInt( unseen_in_shared_folders + data[ i ].folder_unseen ); } var folder_unseen = Element('dftree_'+data[i].folder_id+'_unseen'); if ((folder_unseen) && (data[i].folder_unseen > 0)) { folder_unseen.innerHTML = data[i].folder_unseen; } else if (data[i].folder_unseen > 0) { tree_folders.getNodeById(data[i].folder_id).alter({caption:lang_folder(data[i].folder_name) + ' ('+data[i].folder_unseen+')'}); tree_folders.getNodeById(data[i].folder_id)._refresh(); } else if (data[i].folder_unseen <= 0) { tree_folders.getNodeById(data[i].folder_id).alter({caption:lang_folder(data[i].folder_name)}); tree_folders.getNodeById(data[i].folder_id)._refresh(); } if(data[i].folder_id == current_folder){ var old_new_m = isNaN(parseInt(Element('new_m').innerHTML)) ? parseInt(Element('new_m').firstChild.innerHTML) : parseInt(Element('new_m').innerHTML); // if(!isNaN(old_new_m) && old_new_m < data[i].folder_unseen){ // Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) + (parseInt(data[i].folder_unseen)-old_new_m); // } Element('new_m').innerHTML = data[i].folder_unseen ? ''+data[i].folder_unseen+'' : 0; draw_paging(Element('tot_m').innerHTML); } } var display_unseen_in_mailbox = tree_folders.getNodeById( 'root' ); //if ( unseen_in_mailbox ) // display_unseen_in_mailbox.alter({caption:'[' + unseen_in_mailbox +'] ' + get_lang("My Folders")}); //else display_unseen_in_mailbox.alter({caption:get_lang("My Folders")}); display_unseen_in_mailbox._refresh(); var display_unseen_in_shared_folders = tree_folders.getNodeById( 'user' ); if ( display_unseen_in_shared_folders ) { if ( unseen_in_shared_folders ) display_unseen_in_shared_folders.alter({caption:'[' + unseen_in_shared_folders +'] ' + get_lang("Shared folders")}); else display_unseen_in_shared_folders.alter({caption:get_lang("Shared folders")}); display_unseen_in_shared_folders._refresh(); } } cExecute ("$this.imap_functions.get_folders_list&folder="+current_folder, update_tree_folders); /** * Pastas locais */ if(preferences.use_local_messages==1) { var local_folders = expresso_local_messages.list_local_folders(); var has_changes = false; for (var i in local_folders) { //Coloca as pastas locais. var folder_unseen = Element('dftree_local_'+local_folders[i][0]+'_unseen'); if ((folder_unseen) && (local_folders[i][1] > 0)) { folder_unseen.innerHTML = local_folders[i][1]; has_changes = true; } else if (local_folders[i][1] > 0) { tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(local_folders[i][0]) + ' ('+local_folders[i][1]+')'}); tree_folders.getNodeById("local_"+local_folders[i][0])._refresh(); has_changes = true; } else if (local_folders[i][1] <= 0) { tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(local_folders[i][0])}); tree_folders.getNodeById("local_"+local_folders[i][0])._refresh(); has_changes = true; } if("local_"+local_folders[i][0] == get_current_folder()){ var old_new_m = isNaN(parseInt(Element('new_m').innerHTML)) ? parseInt(Element('new_m').firstChild.innerHTML) : parseInt(Element('new_m').innerHTML); if(!isNaN(old_new_m) && old_new_m < local_folders[i][1]){ Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) + (parseInt(local_folders[i][1])-old_new_m); } Element('new_m').innerHTML = local_folders[i][1] ? ''+local_folders[i][1]+'' : 0; draw_paging(Element('tot_m').innerHTML); has_changes = true; } } if(has_changes) tree_folders.getNodeById("local_root").open(); } return; } else{ tree_folders = new dFTree({name: 'tree_folders'}); var n_root = new dNode({id:'root', caption: get_lang("My Folders")}); tree_folders.add(n_root,'anything'); //Places the root; second argument can be anything. var unseen_in_mailbox = 0; var unseen_in_shared_folders = 0; for (var i=0; i 0) { unseen_in_mailbox = parseInt( unseen_in_mailbox + folders[ i ].folder_unseen ); if ( folders[i].folder_id.indexOf( 'INBOX' ) !== 0 ) unseen_in_shared_folders = parseInt( unseen_in_shared_folders + folders[ i ].folder_unseen ); var nn = new dNode({id:folders[i].folder_id, caption:lang_folder(folders[i].folder_name) + ' ('+folders[i].folder_unseen+')', onClick:"change_folder('"+folders[i].folder_id+"','"+folders[i].folder_name+"')", plusSign:folders[i].folder_hasChildren}); if( folders[i].folder_name.toLowerCase() == 'inbox' ) Element('new_m').innerHTML = '' + folders[i].folder_unseen + ''; } else var nn = new dNode({id:folders[i].folder_id, caption:lang_folder(folders[i].folder_name), onClick:"change_folder('"+folders[i].folder_id+"','"+folders[i].folder_name+"')", plusSign:folders[i].folder_hasChildren}); if (folders[i].folder_parent == '') folders[i].folder_parent = 'root'; else if (folders[i].folder_parent == 'user'){ if (!tree_folders.getNodeById('user')){ var n_root_shared_folders = new dNode({id:'user', caption:get_lang("Shared folders"), plusSign:true}); tree_folders.add(n_root_shared_folders,'root'); } } tree_folders.add(nn,folders[i].folder_parent); } //tree_local_folders = new dFTree({name: 'tree_local_folders'}); /** * Pastas locais */ if (preferences.use_local_messages==1) { if (!window.google || !google.gears) { temp = confirm(get_lang("To use local messages you have to install google gears. Would you like to be redirected to gears installation page?")); if (temp) { location.href = "http://gears.google.com/?action=install&message="+ get_lang("To use local messages, install Google Gears")+"&return=" + document.location.href; } else { preferences.use_local_messages=0; } } else{ var root_local = new dNode({ id: "local_root", caption: get_lang('local folders') }); tree_folders.add(root_local, "root"); //coloca root local var local_folders = expresso_local_messages.list_local_folders(); for (var i in local_folders) { //Coloca as pastas locais. if (local_folders[i][1] > 0) var nodeLocal = new dNode({ id: "local_" + local_folders[i][0], caption: lang_folder(local_folders[i][0]) + ' (' + local_folders[i][1] + ')', onClick: "change_folder('local_" + local_folders[i][0] + "','" + local_folders[i][0] + "')", plusSign: 0 }); else var nodeLocal = new dNode({ id: "local_" + local_folders[i][0], caption: lang_folder(local_folders[i][0]), onClick: "change_folder('local_" + local_folders[i][0] + "','" + local_folders[i][0] + "')", plusSign: 0 }); tree_folders.add(nodeLocal, "local_root"); } } } tree_folders.draw(Element('content_folders')); n_root.changeState(); var trash_span=document.getElementById('lINBOX/'+trashfolder+'tree_folders'); var draft_span=document.getElementById('lINBOX/'+draftsfolder+'tree_folders'); var sent_span=document.getElementById('lINBOX/'+sentfolder+'tree_folders'); var spam_span=document.getElementById('lINBOX/'+spamfolder+'tree_folders'); if (trash_span) trash_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_trash.png)"; if (draft_span) draft_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_draft.png)" if (sent_span) sent_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_sent.png)"; if (spam_span) spam_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_spam.png)"; tree_folders.getNodeById('INBOX')._select(); draw_paging(Element('tot_m').innerHTML); // Draw right menu folders. /* var treeroot = document.getElementById('chroottree_folders'); for (var linkBox = treeroot.firstChild; linkBox != null; linkBox = linkBox.nextSibling) _dragArea.makeMenuBox(linkBox); */ var display_unseen_in_mailbox = tree_folders.getNodeById( 'root' ); //if ( unseen_in_mailbox ) // display_unseen_in_mailbox.alter({caption:'[' + unseen_in_mailbox +'] ' + get_lang("My Folders")}); //else display_unseen_in_mailbox.alter({caption:get_lang("My Folders")}); display_unseen_in_mailbox._refresh(); var display_unseen_in_shared_folders = tree_folders.getNodeById( 'user' ); if ( display_unseen_in_shared_folders ) { if ( unseen_in_shared_folders ) display_unseen_in_shared_folders.alter({caption:'[' + unseen_in_shared_folders +'] ' + get_lang("Shared folders")}); else display_unseen_in_shared_folders.alter({caption:get_lang("Shared folders")}); display_unseen_in_shared_folders._refresh(); } } var folder_create = ""; var nm1 = ""; if(tree_folders._folderPr.length > 0){ var nm_folder = ""; for(var i=0; i < tree_folders._folderPr.length; i++){ nm_folder = tree_folders._folderPr[i].split(cyrus_delimiter); if(nm_folder[0] == "INBOX"){ if(nm1 == ""){ nm1 = nm_folder[1]; folder_create = "INBOX" + cyrus_delimiter + nm_folder[1] + ";"; }else{ if( nm1 != nm_folder[1]){ folder_create += "INBOX" + cyrus_delimiter + nm_folder[1] + ";"; nm1 = nm_folder[1]; } } } } } if(folder_create != ""){ if(confirm(get_lang("There are folders with invalid format. Do you want to fix them?"))){ var handler_correct_folders = function(data){ //Timeout to release HTTPRequest , loadScript and update tree folders. if(data) setTimeout("connector.loadScript('TreeShow');ttreeBox.update_folder();",500); } cExecute("$this.imap_functions.create_extra_mailbox",handler_correct_folders,"nw_folders="+folder_create); } } } function update_menu(data){ /* * @AUTHOR Rodrigo Souza dos Santos * @DATE 2008/09/15 * @BRIEF When occurs a error in imap server show the message that is in file "error.html". */ if ( data && data.imap_error ) { connector.newRequest('error.html', 'templates/'+template+'/error.html', 'GET', function(data) { var target = document.getElementById('divAppbox'); if ( target ) target.innerHTML = data; } ); return false; } draw_tree_folders(data); if(data) { build_quota(data); var f_unseen = Element('dftree_'+current_folder+'_unseen'); if(f_unseen && f_unseen.innerHTML) Element('new_m').innerHTML = ''+f_unseen.innerHTML+''; else { if( parseInt(Element('new_m').innerHTML) == 0 ) Element('new_m').innerHTML = 0; } folders = data; cExecute ("$this.imap_functions.get_range_msgs2&folder=INBOX&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type=SORTARRIVAL&search_box_type=ALL&sort_box_reverse=1", handler_draw_box); } } var handler_draw_box = function(data){ draw_box(data, 'INBOX', true); //alternate_border(0); } // Action on change folders. function change_folder(folder, folder_name){ if (openTab.imapBox[0] != folder) { current_folder = folder; var handler_draw_box = function(data) { if(!verify_session(data)) return; alternate_border(0); Element("border_id_0").innerHTML = " " + lang_folder(folder_name) + ' [  / ]'; draw_box(data, folder, true); draw_paging(data.num_msgs); Element("tot_m").innerHTML = data.num_msgs; update_menu(); return true; } proxy_mensagens.messages_list(current_folder,1,preferences.max_email_per_page,sort_box_type,search_box_type,sort_box_reverse,handler_draw_box); // cExecute ("$this.imap_functions.get_range_msgs2&folder="+current_folder+"&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type="+sort_box_type+ "&search_box_type="+ search_box_type +"&sort_box_reverse="+sort_box_reverse+"", handler_draw_box); } else alternate_border(0); } function open_folder(folder, folder_name){ if (current_folder!= folder) { current_folder = folder; var handler_draw_box = function(data){ if(!verify_session(data)) return false; numBox++; create_border(folder_name,numBox.toString()); draw_box(data, current_folder, false); alternate_border(numBox); return true; } cExecute ("$this.imap_functions.get_range_msgs2&folder="+current_folder+"&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type="+sort_box_type+ "&search_box_type="+ search_box_type +"&sort_box_reverse="+sort_box_reverse+"", handler_draw_box); } else alternate_border(numBox); return true; } var lastPage = 1; var numPages = 5; var last_folder = 'INBOX'; function draw_paging(num_msgs){ num_msgs = parseInt(num_msgs); total_pages = 1; if(last_folder != current_folder){ lastPage = 1; current_page = 1; last_folder = current_folder; } if(num_msgs > parseInt(preferences.max_email_per_page)) { total_pages = parseInt(num_msgs/preferences.max_email_per_page); if((num_msgs/preferences.max_email_per_page) > total_pages) total_pages++; } if(total_pages == 1) { if(span_paging = document.getElementById("span_paging")) { span_paging.parentNode.removeChild(span_paging); } return; } span_paging = document.getElementById("span_paging"); if(!span_paging){ span_paging = document.createElement("DIV"); span_paging.id = "span_paging"; span_paging.align="right"; document.getElementById("div_menu_c3").appendChild(span_paging); } span_paging.style.width="100%"; span_paging.innerHTML=""; msg_range_begin = 1; msg_range_end = preferences.max_email_per_page; if(current_page != 1) { lnk_page = document.createElement("A"); lnk_page.setAttribute("href", "javascript:current_page=1;kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+",function handler(data){draw_box(data, get_current_folder());});"); } else { lnk_page = document.createElement("SPAN"); } span_paging.appendChild(lnk_page); lnk_page.innerHTML = "<<"; lnk_page.title = get_lang("First"); span_paging.innerHTML += " "; if(current_page == lastPage + numPages) lastPage = current_page - 1; else if((lastPage != 1 && lastPage == current_page) || current_page == total_pages) lastPage = current_page - (numPages - 1); else if(current_page == 1) lastPage = 1; if(lastPage < 1) lastPage = 1; else if(lastPage > 1 && (lastPage > (total_pages -(numPages - 1)))) lastPage = total_pages -(numPages - 1); var hasMarked = false; for(i = lastPage; i <= total_pages; i++) { if(current_page == i || (i == total_pages && !hasMarked)) { lnk_page = document.createElement("SPAN"); span_paging.appendChild(lnk_page); lnk_page.innerHTML = " "+i+" "; hasMarked = true; continue; } else{ lnk_page = document.createElement("A"); span_paging.appendChild(lnk_page); msg_range_begin = ((i*preferences.max_email_per_page)-(preferences.max_email_per_page-1)); msg_range_end = (i*preferences.max_email_per_page); lnk_page.setAttribute("href", "javascript:current_page="+i+";kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+",function handler(data){draw_box(data, get_current_folder());});"); } lnk_page.innerHTML = " ... "; if(i == (lastPage + numPages)) break; else if(lastPage == 1 || i != lastPage) lnk_page.innerHTML = " "+i+" "; span_paging.innerHTML += " "; } if(current_page != total_pages) { lnk_page = document.createElement("A"); msg_range_begin = ((total_pages*preferences.max_email_per_page)-(preferences.max_email_per_page-1)); msg_range_end = (total_pages*preferences.max_email_per_page); lnk_page.setAttribute("href", "javascript:current_page="+total_pages+";kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+",function handler(data){draw_box(data, get_current_folder());});"); } else { lnk_page = document.createElement("SPAN"); } span_paging.innerHTML += " "; span_paging.appendChild(lnk_page); lnk_page.title = get_lang("Last"); lnk_page.innerHTML = ">>"; } // Draw the inbox and another folders function draw_box(headers_msgs, msg_folder, alternate){ if (alternate) kill_current_box(); if(is_ie) document.getElementById("border_table").width = "99.5%"; openTab.content_id[numBox] = document.getElementById("content_id_"+numBox); openTab.imapBox[numBox] = msg_folder; openTab.type[numBox] = 0; table_message_header_box = document.getElementById("table_message_header_box_"+numBox); if (table_message_header_box == null){ var table_element = document.createElement("TABLE"); var tbody_element = document.createElement("TBODY"); table_element.setAttribute("id", "table_message_header_box_"+numBox); table_element.className = "table_message_header_box"; tr_element = document.createElement("TR"); tr_element.className = "message_header"; td_element1 = document.createElement("TD"); td_element1.setAttribute("width", "1%"); chk_box_element = document.createElement("INPUT"); chk_box_element.id = "chk_box_select_all_messages"; chk_box_element.setAttribute("type", "checkbox"); chk_box_element.className = "checkbox"; chk_box_element.onclick = function(){select_all_messages(this.checked);}; chk_box_element.onmouseover = function () {this.title=get_lang('Select all messages.')}; chk_box_element.onkeydown = function (e){ if (is_ie) { if ((window.event.keyCode) == 46) proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); } else { if ((e.keyCode) == 46) proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); } }; td_element1.appendChild(chk_box_element); td_element2 = document.createElement("TD"); td_element2.setAttribute("width", "2%"); td_element3 = document.createElement("TD"); td_element3.setAttribute("width", "31%"); td_element3.onclick = function () {sort_box(search_box_type,'SORTFROM');}; td_element3.id = "message_header_SORTFROM_"+numBox; td_element3.align = "left"; td_element3.innerHTML = get_lang("Who"); td_element4 = document.createElement("TD"); td_element4.setAttribute("width", "41%"); td_element4.onclick = function () {sort_box(search_box_type,'SORTSUBJECT');}; td_element4.id = "message_header_SORTSUBJECT_"+numBox; td_element4.align = "left"; td_element4.innerHTML = get_lang("Subject"); td_element5 = document.createElement("TD"); td_element5.setAttribute("width", "14%"); td_element5.onclick = function () {sort_box(search_box_type,'SORTARRIVAL');}; td_element5.id = "message_header_SORTARRIVAL_"+numBox; td_element5.align = "center"; td_element5.innerHTML = get_lang("Date"); td_element6 = document.createElement("TD"); td_element6.setAttribute("width", "14%"); td_element6.onclick = function () {sort_box(search_box_type,'SORTSIZE');} td_element6.id = "message_header_SORTSIZE_"+numBox; td_element6.align = "left"; td_element6.innerHTML = get_lang("Size"); tr_element.appendChild(td_element1); tr_element.appendChild(td_element2); tr_element.appendChild(td_element3); tr_element.appendChild(td_element4); tr_element.appendChild(td_element5); tr_element.appendChild(td_element6); tbody_element.appendChild(tr_element); table_element.appendChild(tbody_element); openTab.content_id[numBox].appendChild(table_element); } draw_header_box(); var table_element = document.createElement("TABLE"); var tbody_element = document.createElement("TBODY"); table_element.id = "table_box"; table_element.className = "table_box"; table_element.borderColorDark = "#bbbbbb"; table_element.frame = "void"; table_element.rules = "rows"; table_element.cellPadding = "0"; table_element.cellSpacing = "0"; table_element.onkeydown = function (e){ if (is_ie) { if ((window.event.keyCode) == 46) { //delete_all_selected_msgs_imap(); proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); } } else { if ((e.keyCode) == 46) { //delete_all_selected_msgs_imap(); proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); } } }; if (is_ie) table_element.style.cursor = "hand"; tbody_element.setAttribute("id", "tbody_box"); table_element.appendChild(tbody_element); var _divScroll = document.getElementById("divScrollMain_"+numBox); var bar = document.getElementById("toolbar"); var offset = 0; if(!_divScroll){ _divScroll = document.createElement("DIV"); _divScroll.id = "divScrollMain_"+numBox; } _divScroll.style.overflowY = "auto"; _divScroll.style.overflowX = "hidden"; _divScroll.style.width ="100%"; if (is_mozilla){ _divScroll.style.overflow = "-moz-scrollbars-vertical"; _divScroll.style.width ="99.3%"; } // Inicio: Redimensiona DIV SCROLL var bar = Element("toolbar"); var offset = 0; if(bar.style.visibility != 'hidden') offset = (bar.offsetHeight ? bar.offsetHeight : bar.clientHeight); var screenHeight = document.body.clientHeight ? document.body.clientHeight : document.body.offsetHeight; var defaultHeight = screenHeight - offset; _divScroll.style.height = defaultHeight - 110; Element('content_folders').style.height = defaultHeight - (is_ie ? 165 : 150); // Fim: Redimensiona DIV SCROLL _divScroll.appendChild(table_element); openTab.content_id[numBox].appendChild(_divScroll); var f_unseen = 0; if (headers_msgs.num_msgs == 0){ td_info = document.createElement("H3"); td_info.setAttribute("height", "25%"); td_info.setAttribute("background", "#FFF"); td_info.setAttribute("id", "msg_info"); td_info.align = "center"; td_info.innerHTML = get_lang("This mail box is empty"); tbody_element.appendChild(td_info); } for (var i=0; i < headers_msgs.length; i++){ if ((headers_msgs[i].Unseen == 'U') || (headers_msgs[i].Recent == 'N')) f_unseen++; tr_element = this.make_tr_message(headers_msgs[i], msg_folder); if (tr_element) tbody_element.appendChild(tr_element); _dragArea.makeDragged(tr_element, headers_msgs[i].msg_number, headers_msgs[i].subject, true); } if ((preferences.use_shortcuts == '1') && (headers_msgs[0])) select_msg(headers_msgs[0].msg_number, 'null', true); var tdFolders = Element("folderscol"); tdFolders.style.display = preferences.hide_folders == '1' ? "none" : ""; if ( !currentTab ) alternate_border(numBox); draw_footer_box(headers_msgs.num_msgs); Element('main_table').style.display = ''; if(debug) { var _eTime = new Date(); _eTime = _eTime.getTime(); alert("Carregou em "+(_eTime - _bTime)+" ms"); } var msg_folder = Element('msg_folder').value; var msg_number = Element('msg_number').value; if(!msg_folder && msg_number) { new_message('new','null'); } else if(msg_folder && msg_number){ cExecute("$this.imap_functions.get_info_msg&msg_number="+ msg_number + "&msg_folder=" + msg_folder, show_msg); Element('msg_folder').value = ''; Element('msg_number').value = ''; } if(!is_ie) { var scripts = new Array("ccQuickAdd", "color_palette", "filter", "filters", "html2xhtml", "preferences", "QuickCatalogSearch", "QuickSearchUser", "rich_text_editor", "sharemailbox", "search", "TreeS", "TreeShow"); connector.loadAllScripts(scripts); } } function change_tr_properties(tr_element, newUid, newSubject){ var td_who = document.getElementById('td_who_'+tr_element.id); td_who.nextSibling.innerHTML = newSubject; tr_element.id = newUid; for (var i=2; i < 6; i++) tr_element.childNodes[i].id = tr_element.childNodes[i].id.replace(message_id,newUid); tr_element.onclick = function () { cExecute("$this.imap_functions.get_info_msg&msg_number="+newUid+"&msg_folder="+current_folder,show_msg); }; } function make_tr_message(headers_msgs, msg_folder){ var tr_element = document.createElement('tr'); tr_element.style.height = preferences.line_height; var _fontSize = preferences.font_size ? preferences.font_size : "11"; tr_element.id = headers_msgs.msg_number; if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')){ if ((headers_msgs.Flagged == 'F') || (headers_msgs.Importance.toLowerCase().indexOf("high")!=-1 && preferences.use_important_flag == 'True')) add_className(tr_element, 'flagged_msg'); add_className(tr_element, 'tr_msg_unread'); } else{ if ((headers_msgs.Flagged == 'F') || (headers_msgs.Importance.toLowerCase().indexOf("high")!=-1 && preferences.use_important_flag == 'True')) add_className(tr_element,'flagged_msg'); add_className(tr_element, 'tr_msg_read'); } if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')) add_className(tr_element, 'tr_msg_unread'); else add_className(tr_element, 'tr_msg_read'); if (headers_msgs.Flagged == 'F') add_className(tr_element,'flagged_msg'); td_element1 = document.createElement("TD"); td_element1.setAttribute("width", "1%"); chk_box_element = document.createElement("INPUT"); chk_box_element.setAttribute("type", "checkbox"); chk_box_element.className = "checkbox"; chk_box_element.setAttribute("id", "check_box_message_"+headers_msgs.msg_number); chk_box_element.onclick = function(e){ if (is_ie) changeBgColor(window.event,headers_msgs.msg_number); else changeBgColor(e,headers_msgs.msg_number); }; td_element1.appendChild(chk_box_element); td_element2 = document.createElement("TD"); td_element2.setAttribute("width", "2%"); if (headers_msgs.attachment && headers_msgs.attachment.number_attachments > 0) //td_element2.innerHTML = ""; td_element2.style.background = "url(templates/"+template+"/images/clip.gif) no-repeat center"; td_element21 = document.createElement("TD"); td_element21.setAttribute("width", "1%"); td_element21.id = "td_message_answered_"+headers_msgs.msg_number; if ((headers_msgs.Forwarded == 'F') || (headers_msgs.Draft == 'X' && headers_msgs.Answered == 'A')){ //td_element21.innerHTML += ""; td_element21.style.background = "url(templates/"+template+"/images/forwarded.gif) no-repeat center"; headers_msgs.Draft = '' headers_msgs.Answered = ''; headers_msgs.Forwarded == 'F'; } else if (headers_msgs.Draft == 'X') //td_element2.innerHTML += ""; td_element2.style.background = "url(templates/"+template+"/images/draft.gif) no-repeat center"; else if (headers_msgs.Answered == 'A') //td_element21.innerHTML += ""; td_element21.style.background = "url(templates/"+template+"/images/answered.gif) no-repeat center"; td_element22 = document.createElement("TD"); td_element22.setAttribute("width", "1%"); td_element22.id = "td_message_important_"+headers_msgs.msg_number; if (headers_msgs.Flagged == 'F' || (headers_msgs.Importance.toLowerCase().indexOf("high") != -1 && preferences.use_important_flag == 'True')) { td_element22.style.background = "url(templates/"+template+"/images/important.gif) no-repeat center"; } else td_element22.innerHTML += "   "; td_element23 = document.createElement("TD"); td_element23.setAttribute("width", "1%"); td_element23.id = "td_message_sent_"+headers_msgs.msg_number; td_element23.innerHTML = "   "; // preload image var _img_sent = new Image(); _img_sent.src = "templates/"+template+"/images/sent.gif"; td_element3 = document.createElement("TD"); td_element3.id = "td_who_"+ headers_msgs.msg_number; td_element3.setAttribute("width", "30%"); var _onclick = function(){InfoContact.hide();proxy_mensagens.get_msg(headers_msgs.msg_number, msg_folder,true, show_msg);}; td_element3.onclick = _onclick; td_element3.innerHTML = ' '; if (typeof(headers_msgs.from) == 'undefined') return false; if(headers_msgs.from.email.toLowerCase() == Element("user_email").value) { td_element3.onmouseover = function () {this.title=headers_msgs.to.email;}; if (headers_msgs.Draft == 'X') td_element3.innerHTML += "("+get_lang("Draft")+") "; else{ if(headers_msgs.to.email.toLowerCase() != Element("user_email").value) td_element23.innerHTML = ""; if ((headers_msgs.to)&&(headers_msgs.to.name != null)) td_element3.innerHTML += headers_msgs.to.name; else if (headers_msgs.to){ td_element3.innerHTML += headers_msgs.to.email; } } } else{ td_element3.onmouseover = function (event) {try {InfoContact.begin(this,headers_msgs.from.email)} catch(e){};}; td_element3.onmouseout = function (){ try {clearTimeout(InfoContact.timeout);} catch(e){}}; if (headers_msgs.Draft == 'X'){ td_element3.innerHTML = "("+get_lang("Draft")+") "; } else{ if (headers_msgs.from.name != null) td_element3.innerHTML += headers_msgs.from.name; else td_element3.innerHTML += headers_msgs.from.email; } } if (td_element3.innerHTML.indexOf(" ") == '-1' && td_element3.innerHTML.length > 25){ td_element3.innerHTML = td_element3.innerHTML.substring(0,25) + "..."; } else if (td_element3.innerHTML.length > 40 ){ td_element3.innerHTML = td_element3.innerHTML.substring(0,40) + "..."; } td_element4 = document.createElement("TD"); td_element4.setAttribute("width", "40%"); td_element4.onclick = _onclick; td_element4.innerHTML = !is_ie ? " " : " "; if ((headers_msgs.subject)&&(headers_msgs.subject.length > 50)) td_element4.innerHTML += headers_msgs.subject.substring(0,50) + "..."; else td_element4.innerHTML += headers_msgs.subject; if(!is_ie){ td_element4.innerHTML += ""; tr_element.onmouseover = function(){}; } td_element5 = document.createElement("TD"); td_element5.setAttribute("width", "14%"); td_element5.onclick = _onclick; td_element5.setAttribute("align", "center"); td_element5.innerHTML = headers_msgs.udate; td_element6 = document.createElement("TD"); td_element6.setAttribute("width", "14%"); td_element6.onclick = _onclick; td_element6.setAttribute("noWrap","true"); td_element6.setAttribute("align", "center"); td_element3.style.fontSize= _fontSize; td_element4.style.fontSize= _fontSize; td_element5.style.fontSize= _fontSize; td_element6.style.fontSize= _fontSize; msg_size = headers_msgs.Size; if (msg_size < 1048576 && msg_size > 1024) td_element6.innerHTML = this.round(msg_size / 1024, 0) + ' Kb'; else if(msg_size > 1024) td_element6.innerHTML = this.round(msg_size / (1024*1024), 1) + ' Mb'; else td_element6.innerHTML = "1 Kb"; tr_element.appendChild(td_element1); tr_element.appendChild(td_element2); tr_element.appendChild(td_element21); tr_element.appendChild(td_element22); tr_element.appendChild(td_element23); tr_element.appendChild(td_element3); tr_element.appendChild(td_element4); tr_element.appendChild(td_element5); tr_element.appendChild(td_element6); return tr_element; } function sort_box(search, sort){ var message_header = Element("message_header_"+search); var handler_draw_box = function(data){ draw_box(data, current_folder,true); draw_paging(Element('tot_m').innerHTML); //Mostrar as msgs nao lidas de acordo com o filtro de relevancia var msgs_unseen = 0; for(i in data){ if(data[i].Unseen == 'U') msgs_unseen++; } Element("new_m").innerHTML = '' + msgs_unseen + ''; } if(sort_box_type == sort && search_box_type == search){ sort_box_reverse = sort_box_reverse ? 0 : 1; } else if(sort_box_type != sort){ if ( (sort == 'SORTFROM') || (sort == 'SORTSUBJECT') ) sort_box_reverse = 0; else sort_box_reverse = 1; } // Global variable. sort_box_type = sort; search_box_type = search; proxy_mensagens.messages_list(current_folder,1,preferences.max_email_per_page,sort,search,sort_box_reverse,handler_draw_box); cExecute ("$this.imap_functions.get_range_msgs2&folder="+current_folder+"&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type="+sort+"&search_box_type="+search+"&sort_box_reverse="+sort_box_reverse+"", handler_draw_box); current_page = 1; //Comentado para nao sobrepor o numero de msgs nao lidas ao utilizar os filtros //update_menu(); } function draw_header_box(){ switch(sort_box_type){ case 'SORTFROM': type_name = get_lang("Who"); break; case 'SORTSUBJECT': type_name = get_lang("Subject"); break; case 'SORTARRIVAL': type_name = get_lang("Date"); break; case 'SORTSIZE': type_name = get_lang("Size"); break; default: type_name = get_lang("Date"); break; } document.getElementById("message_header_SORTFROM_"+numBox).innerHTML = get_lang("Who"); document.getElementById("message_header_SORTSUBJECT_"+numBox).innerHTML = get_lang("Subject"); document.getElementById("message_header_SORTARRIVAL_"+numBox).innerHTML = get_lang("Date"); document.getElementById("message_header_SORTSIZE_"+numBox).innerHTML = get_lang("Size"); document.getElementById("message_header_"+(sort_box_type.lastIndexOf("SORT") != "-1" ? sort_box_type : "SORTARRIVAL")+"_"+numBox ).innerHTML = ""+type_name+""; } function draw_message(info_msg, ID){ var content = document.getElementById('content_id_' + ID); var defaultWidth = document.body.offsetWidth - 37; var menuHidden = Element("folderscol").style.display == 'none' ? true : false; if(!menuHidden) defaultWidth -= Element("folderscol").offsetWidth; ////////////////////////////////////////////////////////////////////////////////////////////////////// //Make the next/previous buttom. ////////////////////////////////////////////////////////////////////////////////////////////////////// var next_previous_msg_td = document.createElement("TD"); next_previous_msg_td.setAttribute("noWrap","true"); next_previous_msg_td.align = "right"; next_previous_msg_td.width = "40px"; var img_next_msg = document.createElement("IMG"); img_next_msg.id = 'msg_opt_next_' + ID; img_next_msg.src = './templates/'+template+'/images/down.button.png'; img_next_msg.title = get_lang('Next'); img_next_msg.style.cursor = 'pointer'; // Old //img_next_msg.onclick = function () {cExecute ("$this.imap_functions.get_info_next_msg&msg_number="+ info_msg.msg_number + "&msg_folder="+ info_msg.msg_folder + "&sort_box_type="+ sort_box_type + "&search_box_type="+ search_box_type +"&sort_box_reverse="+ sort_box_reverse +"&reuse_border="+ID, show_msg)}; var folder = document.getElementById(ID.substr(0, ID.indexOf('_'))); if (!folder){ delete_border(ID); return; } if (folder.nextSibling){ var nextMsgBox = folder.nextSibling.name?folder.nextSibling.name:info_msg.msg_folder; img_next_msg.onclick = function() { currentTab = ID; openTab.type[ID] = 2; cExecute("$this.imap_functions.get_info_msg&msg_number="+folder.nextSibling.id+"&msg_folder="+nextMsgBox, show_msg); }; } else img_next_msg.onclick = function() { /*current_page++; msg_range_end = (current_page*preferences.max_email_per_page); msg_range_begin = (msg_range_end-(preferences.max_email_per_page)+1); kill_current_box(); cExecute ('$this.imap_functions.get_range_msgs2&folder='+current_folder+'&msg_range_begin='+msg_range_begin+'&msg_range_end='+msg_range_end+'&sort_box_reverse=1', function handler(data){draw_box(data, current_folder);}) */ delete_border(ID); }; var img_space = document.createElement("SPAN"); img_space.innerHTML = " "; var img_previous_msg = document.createElement("IMG"); img_previous_msg.id = 'msg_opt_previous_' + ID; img_previous_msg.src = './templates/'+template+'/images/up.button.png'; img_previous_msg.title = get_lang('Previous'); img_previous_msg.style.cursor = 'pointer'; //Old //img_previous_msg.onclick = function () {cExecute ("$this.imap_functions.get_info_previous_msg&msgs_number="+ info_msg.msg_number + "&folder="+ info_msg.msg_folder + "&sort_box_type="+ sort_box_type+ "&search_box_type="+ search_box_type + "&sort_box_reverse="+ sort_box_reverse +"&reuse_border="+ID, show_msg)} folder = document.getElementById(ID.substr(0, ID.indexOf('_'))); if (!folder){ delete_border(ID); return; } if (folder.previousSibling) { var previousMsgBox = folder.previousSibling.name?folder.previousSibling.name:info_msg.msg_folder; img_previous_msg.onclick = function() { currentTab = ID; openTab.type[ID] = 2; cExecute("$this.imap_functions.get_info_msg&msg_number="+folder.previousSibling.id+"&msg_folder=" + previousMsgBox, show_msg); }; } else img_previous_msg.onclick = function() { delete_border(ID); }; next_previous_msg_td.appendChild(img_previous_msg); next_previous_msg_td.appendChild(img_space); next_previous_msg_td.appendChild(img_next_msg); ////////////////////////////////////////////////////////////////////////////////////////////////////// //Make the header message. ////////////////////////////////////////////////////////////////////////////////////////////////////// var table_message = document.createElement("TABLE"); var tbody_message = document.createElement("TBODY"); table_message.border = "0"; table_message.width = defaultWidth ; ////////////////////////////////////////////////////////////////////////////////////////////////////// //Make the options message. ////////////////////////////////////////////////////////////////////////////////////////////////////// var tr0 = document.createElement("TR"); tr0.className = "tr_message_header"; var td0 = document.createElement("TD"); var table_message_options = document.createElement("TABLE"); table_message_options.width = "100%"; table_message_options.border = '0'; table_message_options.className = 'table_message'; var tbody_message_options = document.createElement("TBODY"); var tr = document.createElement("TR"); var td = document.createElement("TD"); td.setAttribute("noWrap","true"); var _name = ''; var _maxChar = menuHidden ? 40 : 15; if (info_msg.from.name) _name = info_msg.from.name.length > _maxChar ? info_msg.from.name.substring(0,_maxChar) + "..." : info_msg.from.name; else _name = info_msg.from.email.length > _maxChar ? info_msg.from.email.substring(0,_maxChar) + "..." : info_msg.from.email; td.innerHTML = _name.bold() + ', ' + info_msg.smalldate; if (info_msg.attachments.length > 0) td.innerHTML += " "; if (typeof(info_msg.signature) == 'string') { if (info_msg.signature != "void") td.innerHTML += ' '; else td.innerHTML += " "; } if (info_msg.DispositionNotificationTo) { td.innerHTML += ' '+ get_lang('Message with read notification') + ''; } // NORMAL MSG if(info_msg.Draft != 'X') { var options = document.createElement("TD"); options.width = "30%"; options.setAttribute("noWrap","true"); var option_hide_more = document.createElement("SPAN"); option_hide_more.className = 'message_options'; options.align = 'right'; option_hide_more.value = 'more_options'; option_hide_more.id = 'option_hide_more_'+ID; option_hide_more.onclick = function(){ var _height = Element("div_message_scroll_"+ID).style.height; _height = parseInt(_height.replace("px","")); var _offset = 35; if (this.value == 'more_options'){ this.innerHTML = ""+get_lang('Options')+""; this.value = 'hide_options'; Element("div_message_scroll_"+ID).style.height = (_height - _offset)+"px"; Element('table_message_others_options_'+ID).style.display = ''; Element('tr_other_options_'+ID).style.display = ''; } else{ this.innerHTML = get_lang('Options'); this.value = 'more_options'; Element("div_message_scroll_"+ID).style.height = (_height + _offset)+"px"; Element('table_message_others_options_'+ID).style.display = 'none'; Element('tr_other_options_'+ID).style.display = 'none'; } }; var option_mark = document.createElement('TD'); option_mark.align = "left"; option_mark.width = "50%"; var option_mark_as_unseen = ''+get_lang("Unseen")+', '; var option_mark_as_important = ''+get_lang("Important")+', '; var option_mark_as_normal = ''+get_lang("Normal")+''; option_mark.innerHTML = option_mark_as_unseen+option_mark_as_important+option_mark_as_normal; option_hide_more.innerHTML = get_lang('Options'); options.appendChild(option_hide_more); var space0 = document.createElement("SPAN"); space0.innerHTML = ' | '; var space1 = document.createElement("SPAN"); space1.innerHTML = ' | '; var space2 = document.createElement("SPAN"); space2.innerHTML = ' | '; var space3 = document.createElement("SPAN"); space3.innerHTML = ' | '; var space4 = document.createElement("SPAN"); space4.innerHTML = ' | '; var option_forward = document.createElement("SPAN"); option_forward.id = 'msg_opt_forward_'+ID; option_forward.className = 'message_options'; option_forward.onclick = function(){new_message('forward', ID);}; option_forward.innerHTML = get_lang('Forward'); options.appendChild(space1); options.appendChild(option_forward); var option_reply = document.createElement("SPAN"); option_reply.id = 'msg_opt_reply_'+ID; option_reply.className = 'message_options'; option_reply.onclick = function(){new_message('reply_with_history', ID);}; option_reply.innerHTML = get_lang('Reply'); options.appendChild(space2); options.appendChild(option_reply); /* TODO, template == default ? what hell you're doing*/ if (template == "default"){ var option_delete = document.createElement("SPAN"); option_delete.id = 'msg_opt_delete_'+ID; option_delete.className = 'message_options'; option_delete.onclick = function(){proxy_mensagens.delete_msgs(info_msg.msg_folder, info_msg.msg_number, ID);}; option_delete.innerHTML = get_lang('Delete'); options.appendChild(space3); options.appendChild(option_delete); } tr.appendChild(td); tr.appendChild(option_mark); tr.appendChild(options); tr.appendChild(next_previous_msg_td); tbody_message_options.appendChild(tr); ////////// OTHER OPTIONS //////////////////// var tr_other_options = document.createElement("TR"); tr_other_options.id = 'tr_other_options_' + ID; tr_other_options.style.display = 'none'; var td_other_options = document.createElement("TD"); td_other_options.colSpan = '3'; //td_other_options.align = 'right'; //td_other_options.setAttribute("noWrap","true"); var div_other_options = document.createElement("DIV"); var option_mark_as = ''+get_lang("Mark as")+': '; var option_mark_as_unseen = ''+get_lang("Unseen")+', '; var option_mark_as_important = ''+get_lang("Important")+', '; var option_mark_as_normal = ''+get_lang("Normal")+' | '; var option_move = ''+get_lang("Move")+' | '; var option_reply_to_all = ''+get_lang("Reply to all")+' | '; var option_reply_without_history = ''+get_lang("Reply without history")+' | '; var option_reply_to_all_without_history = ''+get_lang("Reply to all without history")+' '; var option_source_msg =""; //= ''+get_lang("Message Font")+''; div_other_options.innerHTML = option_reply_to_all + option_reply_without_history + option_reply_to_all_without_history + option_source_msg; if (use_spam_filter) { if(info_msg.msg_folder == 'INBOX'+cyrus_delimiter+'Spam') div_other_options.innerHTML += ' | '+get_lang("Not Spam")+''; else div_other_options.innerHTML += ' | '+get_lang("Mark as Spam")+''; } td_other_options.appendChild(div_other_options); //td_other_options.innerHTML = option_print + option_reply_to_all + option_source_msg; tr_other_options.appendChild(td_other_options); tbody_message_options.appendChild(tr_other_options); ////////// END OTHER OPTIONS //////////////// table_message_options.appendChild(tbody_message_options); td0.appendChild(table_message_options); tr0.appendChild(td0); tbody_message.appendChild(tr0); } // IF DRAFT else { var options = document.createElement("TD"); options.width = "1%"; options.setAttribute("noWrap","true"); var option_edit = ''+get_lang('Edit')+' | '; var option_print = ''+get_lang('Print')+' | '; var option_delete = ''+get_lang('Delete')+' | '; var option_hide_more = document.createElement("SPAN"); option_hide_more.className = 'message_options'; options.align = 'right'; option_hide_more.value = 'more_options'; option_hide_more.id = 'option_hide_more_'+ID; option_hide_more.innerHTML = get_lang('Options'); option_hide_more.onclick = function(){ var _height = Element("div_message_scroll_"+ID).style.height; _height = parseInt(_height.replace("px","")); var _offset = 35; if (this.value == 'more_options'){ this.innerHTML = ""+get_lang('Options')+""; this.value = 'hide_options'; Element("div_message_scroll_"+ID).style.height = (_height - _offset)+"px"; Element('table_message_others_options_'+ID).style.display = ''; } else{ this.innerHTML = get_lang('Options'); this.value = 'more_options'; Element("div_message_scroll_"+ID).style.height = (_height + _offset)+"px"; Element('table_message_others_options_'+ID).style.display = 'none'; } }; options.innerHTML = option_edit + option_print + option_delete; options.appendChild(option_hide_more); tr.appendChild(td); tr.appendChild(options); tr.appendChild(next_previous_msg_td); tbody_message_options.appendChild(tr); table_message_options.appendChild(tbody_message_options); td0.appendChild(table_message_options); tr0.appendChild(td0); tbody_message.appendChild(tr0); } ////////////////////////////////////////////////////////////////////////////////////////////////////// // END options message. ////////////////////////////////////////////////////////////////////////////////////////////////////// var table_message_others_options = document.createElement("TABLE"); table_message_others_options.id = 'table_message_others_options_' + ID; table_message_others_options.width = defaultWidth - 30; table_message_others_options.style.display = 'none'; table_message_others_options.className = "table_message"; var tbody_message_others_options = document.createElement("TBODY"); var tr1 = document.createElement("TR"); tr1.className = "tr_message_header"; var td1 = document.createElement("TD"); td1.innerHTML = get_lang("From: "); td1.appendChild(deny_email(info_msg.from.email)); td1.width = "7%"; if (info_msg.sender){ var tr111 = document.createElement("TR"); tr111.className = "tr_message_header"; var td111 = document.createElement("TD"); td111.innerHTML = get_lang("Sent by")+": "; td111.appendChild(deny_email(info_msg.sender.email)); td111.setAttribute("noWrap","true"); var sender = document.createElement("TD"); sender.id = "sender_"+ID; var sender_values = document.createElement("INPUT"); sender_values.id = "sender_values_"+ID; sender_values.type = "HIDDEN"; sender_values.value = info_msg.sender.full; //Veio do IMAP, sem images nem links. sender.innerHTML += draw_plugin_cc(ID, info_msg.sender.full); sender.className = "header_message_field"; tr111.appendChild(td111); tr111.appendChild(sender); tr111.appendChild(sender_values); tbody_message_others_options.appendChild(tr111); } var from = document.createElement("TD"); from.id = "from_"+ID; from.innerHTML = info_msg.from.full; if (info_msg.Draft != "X"){ from.innerHTML += draw_plugin_cc(ID, info_msg.from); tbody_message_others_options.appendChild(tr1); } from.className = "header_message_field"; var from_values = document.createElement("INPUT"); from_values.id = "from_values_"+ID; from_values.type = "HIDDEN"; from_values.value = info_msg.from.full; //Veio do IMAP, sem images nem links. var local_message = document.createElement("INPUT"); local_message.id = "is_local_"+ID; local_message.name = "is_local"; local_message.type = "HIDDEN"; local_message.value = (info_msg.local_message)?"1":"0"; tr1.appendChild(td1); tr1.appendChild(from); tr1.appendChild(from_values); tr1.appendChild(local_message); if (info_msg.reply_to){ var tr11 = document.createElement("TR"); tr11.className = "tr_message_header"; var td11 = document.createElement("TD"); td11.innerHTML = get_lang("Reply to")+": "; td11.setAttribute("noWrap","true"); var reply_to = document.createElement("TD"); reply_to.id = "reply_to_"+ID; var reply_to_values = document.createElement("INPUT"); reply_to_values.id = "reply_to_values_"+ID; reply_to_values.type = "HIDDEN"; reply_to_values.value = info_msg.reply_to; //Veio do IMAP, sem images nem links. reply_to.innerHTML = draw_plugin_cc(ID, info_msg.reply_to); reply_to.className = "header_message_field"; tr11.appendChild(td11); tr11.appendChild(reply_to); tr11.appendChild(reply_to_values); tbody_message_others_options.appendChild(tr11); } ////////////////////////////////////////////////////////////////////////////////////////////////////// var tr2 = document.createElement("TR"); tr2.className = "tr_message_header"; var td2 = document.createElement("TD"); td2.innerHTML = get_lang("To: "); var to = document.createElement("TD"); to.id = "to_"+ID; var to_values = document.createElement("INPUT"); to_values.id = "to_values_"+ID; to_values.type = "HIDDEN"; to_values.value = info_msg.toaddress2; //Veio do IMAP, sem images nem links. // Salva a pasta da mensagem var input_current_folder = document.createElement('input'); input_current_folder.id = "input_folder_"+ID; input_current_folder.name = "input_folder"; input_current_folder.type = "hidden"; input_current_folder.value = info_msg.msg_folder; td2.appendChild(input_current_folder); // fim toaddress_array[ID] = info_msg.toaddress2.split(","); if (toaddress_array[ID].length > 1){ to.innerHTML += draw_plugin_cc(ID, toaddress_array[ID][0]); var div_toaddress = document.createElement("SPAN"); div_toaddress.id = "div_toaddress_"+ID; div_toaddress.style.display=""; div_toaddress.innerHTML += " ("+get_lang('more')+")"; to.appendChild(div_toaddress); } else { to.innerHTML += draw_plugin_cc(ID,toaddress_array[ID]); } to.className = "header_message_field"; tr2.appendChild(td2); tr2.appendChild(to); tr2.appendChild(to_values); tbody_message_others_options.appendChild(tr2); if (info_msg.cc){ var tr3 = document.createElement("TR"); tr3.className = "tr_message_header"; var td3 = document.createElement("TD"); td3.innerHTML = "CC: "; var cc = document.createElement("TD"); cc.id = "cc_"+ID; var cc_values = document.createElement("INPUT"); cc_values.id = "cc_values_"+ID; cc_values.type = "HIDDEN"; cc_values.value = info_msg.cc; ccaddress_array[ID] = info_msg.cc.split(","); if (ccaddress_array[ID].length > 1){ var div_ccaddress = document.createElement("SPAN"); div_ccaddress.id = "div_ccaddress_"+ID; var div_ccaddress_full = document.createElement("SPAN"); div_ccaddress_full.id = "div_ccaddress_full_"+ID; div_ccaddress.style.display=""; cc.innerHTML = draw_plugin_cc(ID, ccaddress_array[ID][0]); div_ccaddress.innerHTML += " ("+get_lang('more')+")"; cc.appendChild(div_ccaddress); } else{ cc.innerHTML = draw_plugin_cc(ID, info_msg.cc); } cc.className = "header_message_field"; tr3.appendChild(td3); tr3.appendChild(cc); tr3.appendChild(cc_values); tbody_message_others_options.appendChild(tr3); } /* * @AUTHOR Rodrigo Souza dos Santos * @MODIFY-DATE 2008/09/11 * @BRIEF Adding routine to create bcc field if there is one. */ if (info_msg.bcc) { var tr3 = document.createElement("tr"); tr3.className = "tr_message_header"; var td3 = document.createElement("td"); td3.innerHTML = get_lang("BCC") + " : "; var cco = document.createElement("td"); cco.id = "cco_"+ID; var cco_values = document.createElement("input"); cco_values.id = "cco_values_"+ID; cco_values.type = "hidden"; cco_values.value = info_msg.cco; ccoaddress_array[ID] = info_msg.bcc.split(","); if (ccoaddress_array[ID].length > 1){ var div_ccoaddress = document.createElement("SPAN"); div_ccoaddress.id = "div_ccoaddress_"+ID; var div_ccoaddress_full = document.createElement("SPAN"); div_ccoaddress_full.id = "div_ccoaddress_full_"+ID; div_ccoaddress.style.display=""; /* * The function below is ugly, doesn't possible use this. * The problem is that the code's function was written * on a hardcode concept. */ //cco.innerHTML = draw_plugin_cc(ID, ccoaddress_array[ID][0]); cco.innerHTML = ccoaddress_array[ID][0]; div_ccoaddress.innerHTML += " ("+get_lang('more')+")"; cco.appendChild(div_ccoaddress); } else{ /* * The function below is ugly, it is not possible to use this. * The problem is that the code's function was written * on a hardcode concept. */ //cco.innerHTML = draw_plugin_cc(ID, info_msg.cco); cco.innerHTML = info_msg.bcc; } cco.className = "header_message_field"; tr3.appendChild(td3); tr3.appendChild(cco); tr3.appendChild(cco_values); tbody_message_others_options.appendChild(tr3); } var tr4 = document.createElement("TR"); tr4.className = "tr_message_header"; var td4 = document.createElement("TD"); td4.innerHTML = get_lang("Date: "); var date = document.createElement("TD"); date.id = "date_"+ID; date.innerHTML = info_msg.fulldate; var date_day = document.createElement("INPUT"); date_day.id = "date_day_"+ID; date_day.type = "HIDDEN"; date_day.value = info_msg.msg_day; var date_hour = document.createElement("INPUT"); date_hour.id = "date_hour_"+ID; date_hour.type = "HIDDEN"; date_hour.value = info_msg.msg_hour date.className = "header_message_field"; tr4.appendChild(td4); tr4.appendChild(date); tr4.appendChild(date_day); tr4.appendChild(date_hour); tbody_message_others_options.appendChild(tr4); var tr5 = document.createElement("TR"); tr5.className = "tr_message_header"; var td5 = document.createElement("TD"); td5.innerHTML = get_lang("Subject"); var subject = document.createElement("TD"); subject.id = "subject_"+ID; subject.innerHTML = info_msg.subject; subject.className = "header_message_field"; tr5.appendChild(td5); tr5.appendChild(subject); tbody_message_others_options.appendChild(tr5); if (info_msg.attachments.length > 0){ var tr6 = document.createElement("TR"); tr6.className = "tr_message_header"; var td6 = document.createElement("TD"); td6.innerHTML = get_lang("Attachments: "); var attachments = document.createElement("TD"); td6.vAlign = "top"; attachments.align='left'; var zipped_attachments = ''; if(info_msg.attachments.length >= 1) { var zipped_attachments = document.createElement("TABLE"); zipped_attachments.style.marginBottom = "4px"; zipped_attachments.cellPadding="0"; zipped_attachments.cellSpacing="0"; var td = document.createElement("TD"); if(info_msg.attachments.length > 1) { var link_attachment = document.createElement("A"); link_attachment.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); link_attachment.innerHTML = " "+info_msg.attachments.length+' '+get_lang('files')+' :: '+get_lang('Download all atachments'); link_attachment.innerHTML += '
'; td.appendChild(link_attachment); } var tr = document.createElement("TR"); if(preferences.remove_attachments_function) { var del_attachments = document.createElement("A"); del_attachments.setAttribute("href", "javascript:remove_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); del_attachments.innerHTML = get_lang('remove all attachments'); del_attachments.appendChild(document.createElement('BR')); td.appendChild(del_attachments); tr.appendChild(td); } tr.appendChild(td); zipped_attachments.appendChild(tr); attachments.appendChild(zipped_attachments); } attachments.id = "attachments_" + ID; for (var i=0; i 1024) link_attachment.innerHTML += ' (' + this.round(msg_size / 1024, 0) + ' Kb)'; else if(msg_size > 1024) link_attachment.innerHTML += ' (' + this.round(msg_size / (1024*1024), 1) + ' Mb)'; else link_attachment.innerHTML += ' (' + msg_size + ' bytes)'; if((url_decode(info_msg.attachments[i].name).indexOf(".ics")!=-1) || (url_decode(info_msg.attachments[i].name).indexOf(".vcard")!=-1)){ //Link para importar calendário var link_import_attachment = new Image(); link_import_attachment.src = "templates/"+template+"/images/new.png"; link_import_attachment.setAttribute("onclick","javascript:import_calendar('"+info_msg.msg_folder+"&msg_number="+info_msg.msg_number+"&msg_part="+info_msg.attachments[i].pid+"&idx_file="+i+"&encoding="+info_msg.attachments[i].encoding+"');"); link_import_attachment.title = get_lang("Import to calendar"); link_import_attachment.align = "top"; link_import_attachment.style.cursor = "pointer"; var space = document.createElement("span"); space.innerHTML = " "; attachments.appendChild(link_attachment); attachments.appendChild(space); attachments.appendChild(link_import_attachment); } else { link_attachment.innerHTML += '
'; attachments.appendChild(link_attachment); } } tr6.appendChild(td6); tr6.appendChild(attachments); tbody_message_others_options.appendChild(tr6); } // BEGIN MAKE THE SCROLL HEIGHT var bar = document.getElementById("toolbar"); var offset = 0; if(bar.style.visibility != 'hidden') offset = bar.offsetHeight ? bar.offsetHeight : bar.clientHeight; var div = document.createElement("DIV"); div.id = "div_message_scroll_"+ID; div.style.background = 'WHITE'; div.style.height = document.body.clientHeight - offset - 125; content.style.height = document.body.clientHeight - offset - 90; div.style.overflow = "auto"; div.style.width = defaultWidth - (is_ie ? 5 : 0); // END MAKE THE SCROLL HEIGHT table_message_others_options.appendChild(tbody_message_others_options); var tr = document.createElement("TR"); var td = document.createElement("TD"); td.colSpan = '2'; div.appendChild(table_message_others_options); var imgTag = info_msg.body.match(/(]*src[^=]*=['"][^'"]*["'][^>]*>)|(]*background[^=]*=['"][^'"]*["'][^>]*>)/gi); var newBody = info_msg.body; if(!info_msg.showImg && imgTag) { var domains = ''; var blocked = false; var forbidden = true; if (preferences.notification_domains != undefined && preferences.notification_domains != "") domains = preferences.notification_domains.split(','); for(var j = 0; j < imgTag.length; j++) { for (var i = 0; i < domains.length; i++) { imgSource = imgTag[j].match(/=['"](http:\/\/)+[^'"\/]*/); if (imgSource && imgSource.toString().substr(5).match(domains[i])) forbidden = false; } if (forbidden) { newBody = newBody.replace(imgTag[j],""); blocked=true; } } if (blocked) { var showImgLink = document.createElement('DIV'); showImgLink.id="show_img_link"; showImgLink.onclick = function () { cExecute('$this.imap_functions.get_info_msg&msg_number='+info_msg.msg_number+'&msg_folder='+info_msg.msg_folder,show_msg_img); }; showImgLink.className="show_img_link"; showImgLink.innerHTML = get_lang("Show images from")+": "+info_msg.from.email; td.appendChild(showImgLink); } } td.appendChild(div); tr.appendChild(td) tbody_message.appendChild(tr); ////////////////////////////////////////////////////////////////////////////////////////////////////// //Make the body message. /////////////////////////////////////////////////////////////////////////////////////////////////////// var tr = document.createElement("TR"); tr.className = "tr_message_body"; var td = document.createElement("TD"); //td.setAttribute("colSpan","2"); newBody = newBody.replace(""+newBody+"

"; ////////////////////////////////////////////////////////////////////////////////////////////////////// //Make the thumbs of the message. ////////////////////////////////////////////////////////////////////////////////////////////////////// if ((info_msg.thumbs)&&(info_msg.thumbs.length > 0)){ var table_message_thumbs = document.createElement("TABLE"); table_message_thumbs.width = "80%"; table_message_thumbs.style.borderTop = "2px solid rgb(170, 170, 170)"; var tbody_message_thumbs = document.createElement("TBODY"); var tr = document.createElement("TR"); tr.className = "tr_message_body"; var td = document.createElement("TD"); td.setAttribute("colSpan","2"); td.id = "body_thumbs_"+ID; td.innerHTML += " "+info_msg.attachments.length+" "+get_lang("attachment")+(info_msg.attachments.length > 1 ? "s" : "")+" "+get_lang("in this message")+""; var _link_attachments = ''; if(info_msg.thumbs.length > 1){ _link_attachments = document.createElement("A"); _link_attachments.className = "message_options"; _link_attachments.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); _link_attachments.innerHTML = get_lang('Download all atachments'); } if(_link_attachments){ td.innerHTML += " :: "; td.appendChild(_link_attachments); } td.innerHTML += "
"+get_lang("Tip: For faster save, click over the image with right button."); td.innerHTML += "
"; for (var i=0; i'+get_lang("Send")+' | '; var option_send = '' + ' | '; var option_send_and_file= ''+get_lang("Send and file")+' | '; } else{ //var option_send = ''+get_lang("Send")+' | '; var option_send = '' + ' | '; var option_send_and_file=''; wfolders.alert = true; } // var option_save_as = ''+get_lang("Save as")+' | '; var option_save = ''+get_lang("Save")+' | '; var option_search = ''+get_lang("Search")+''; td_menu_new_message.innerHTML = option_send + option_send_and_file + option_save + option_search; tr_menu_new_message.appendChild(td_menu_new_message); tbody_menu_new_message.appendChild(tr_menu_new_message); table_menu_new_message.appendChild(tbody_menu_new_message); content.appendChild(table_menu_new_message); tr0.appendChild(td0); tbody_message.appendChild(tr0); //////////////////////////////////////////////////////////////////////////////////////////////////////// var tr1_1 = document.createElement("TR"); tr1_1.style.display = 'none'; var td1_1 = document.createElement("TD"); td1_1.innerHTML = get_lang("From")+":"; td1_1.setAttribute("noWrap","true"); td1_1.style.width = "1%"; var td_from = document.createElement("TD"); td_from.setAttribute("noWrap","true"); td_from.style.width = "100%"; var sel_from = document.createElement('SELECT'); sel_from.id = "from_"+ID; sel_from.name = "input_from"; sel_from.style.width = "70%"; sel_from.setAttribute("wrap","soft"); td_from.appendChild(sel_from); tr1_1.appendChild(td1_1); tr1_1.appendChild(td_from); tbody_message.appendChild(tr1_1); //////////////////////////////////////////////////////////////////////////////////////////////////////// var tr1 = document.createElement("TR"); var td1 = document.createElement("TD"); td1.innerHTML = get_lang("To")+":"; td1.setAttribute("noWrap","true"); td1.style.width = "1%"; var td_to = document.createElement("TD"); td_to.setAttribute("noWrap","true"); td_to.style.width = "100%"; var input_to = document.createElement('TEXTAREA'); input_to.id = "to_"+ID; input_to.name = "input_to"; input_to.setAttribute("tabIndex","1"); input_to.style.width = "100%"; input_to.setAttribute("wrap","soft"); input_to.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus', this.id);}; input_to.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; if (!is_ie) { input_to.rows = 2; input_to.onkeypress = function (e) { if ((e.keyCode) == 120) //F9 { emQuickSearch(input_to.value, 'to', ID); } else { if (((e.keyCode == 13) || ((e.keyCode == 38)||(e.keyCode == 40))) && (document.getElementById('tipDiv').style.visibility!='hidden')) { e.preventDefault(); search_contacts(e.keyCode,this.id); } } } input_to.onkeyup = function (e) { if ((e.keyCode != 13) && (e.keyCode != 38) && (e.keyCode != 40)) { search_contacts(e.keyCode,this.id); } } } else { input_to.rows = 3; input_to.onkeyup = function (e) { if ((window.event.keyCode) == 120) //F9 { emQuickSearch(input_to.value, 'to', ID); } else { search_contacts(window.event.keyCode,this.id); } } } td_to.appendChild(input_to); var forwarded_local_message = document.createElement("INPUT"); //Hidden para indicar se é um forward de uma mensagem local forwarded_local_message.id = "is_local_forward"+ID; forwarded_local_message.name = "is_local_forward"; forwarded_local_message.type = "HIDDEN"; forwarded_local_message.value = "0"; td_to.appendChild(forwarded_local_message); var img_search = document.createElement("IMG"); img_search.src = "./templates/"+template+"/images/search.gif"; img_search.title = get_lang('Search') + " | " + get_lang('Use F9 Key as shortcut.'); img_search.onclick = function () {emQuickSearch(document.getElementById('to_'+ID).value, 'to', ID);}; var span_search = document.createElement("SPAN"); span_search.innerHTML = get_lang('Search'); var td1_img_search = document.createElement("TD"); td1_img_search.setAttribute("noWrap","true"); var td1_span_search = document.createElement("TD"); td1_span_search.setAttribute("noWrap","true"); td1_img_search.appendChild(img_search); td1_span_search.appendChild(span_search); tr1.appendChild(td1); tr1.appendChild(td_to); tr1.appendChild(td1_img_search); tbody_message.appendChild(tr1); ////////////////////////////////////////////////////////////////////////////////////////////////////// var tr2 = document.createElement("TR"); tr2.id = "tr_cc_"+ID; tr2.style.display = 'none'; var td2 = document.createElement("TD"); td2.innerHTML = "Cc:"; td2.setAttribute("noWrap","true"); td2.style.width = "1%"; var td_cc = document.createElement("TD"); td_cc.setAttribute("noWrap","true"); td_cc.style.width = "100%"; var input_cc = document.createElement('TEXTAREA'); input_cc.id = "cc_"+ID; input_cc.name = "input_cc"; input_cc.setAttribute("tabIndex","1"); input_cc.style.width = "100%"; input_cc.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus',this.id);}; input_cc.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; if (!is_ie) { input_cc.rows = 2; input_cc.onkeypress = function (e) { if ((e.keyCode) == 120) //F9 { emQuickSearch(input_cc.value, 'cc', ID); } else { if (((e.keyCode == 13) || ((e.keyCode == 38)||(e.keyCode == 40))) && (document.getElementById('tipDiv').style.visibility!='hidden')) { e.preventDefault(); search_contacts(e.keyCode,this.id); } } } input_cc.onkeyup = function (e) { if ((e.keyCode != 13) && (e.keyCode != 38) && (e.keyCode != 40)) { search_contacts(e.keyCode,this.id); } } } else if (is_ie) { input_cc.rows = 3; input_cc.onkeyup = function (e) { if ((window.event.keyCode) == 120) //F9 { emQuickSearch(input_cc.value, 'cc', ID); } else { search_contacts(window.event.keyCode,this.id); } } } td_cc.appendChild(input_cc); var img_search = document.createElement("IMG"); img_search.src = "./templates/"+template+"/images/search.gif"; img_search.onclick = function () {emQuickSearch(document.getElementById('cc_'+ID).value, 'cc', ID)} img_search.title = get_lang('Search') + " | " + get_lang('Use F9 Key as shortcut.'); var span_search = document.createElement("SPAN"); span_search.innerHTML = get_lang('Search'); var td2_img_search = document.createElement("TD"); td2_img_search.setAttribute("noWrap","true"); var td2_span_search = document.createElement("TD"); td2_span_search.setAttribute("noWrap","true"); td2_img_search.appendChild(img_search); td2_span_search.appendChild(span_search); tr2.appendChild(td2); tr2.appendChild(td_cc); tr2.appendChild(td2_img_search); tbody_message.appendChild(tr2); ////////////////////////////////////////////////////////////////////////////////////////////////////// var tr3 = document.createElement("TR"); tr3.id = "tr_cco_"+ID; tr3.style.display = 'none'; var td3 = document.createElement("TD"); td3.setAttribute("noWrap","true"); td3.innerHTML = get_lang("CCo")+":"; td3.style.width = "1%"; var td_cco = document.createElement("TD"); td_cco.setAttribute("noWrap","true"); td_cco.style.width = "100%"; var input_cco = document.createElement('TEXTAREA'); input_cco.id = "cco_"+ID; input_cco.name = "input_cco"; input_cco.setAttribute("tabIndex","1"); input_cco.style.width = "100%"; input_cco.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus',this.id);}; input_cco.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; if (!is_ie) { input_cco.rows = 2; input_cco.onkeypress = function (e) { if ((e.keyCode) == 120) //F9 { emQuickSearch(input_cco.value, 'cco', ID); } else { if (((e.keyCode == 13) || ((e.keyCode == 38)||(e.keyCode == 40))) && (document.getElementById('tipDiv').style.visibility!='hidden')) { e.preventDefault(); search_contacts(e.keyCode,this.id); } } } input_cco.onkeyup = function (e) { if ((e.keyCode != 13) && (e.keyCode != 38) && (e.keyCode != 40)) { search_contacts(e.keyCode,this.id); } } } else if (is_ie) { input_cco.rows = 3; input_cco.onkeyup = function (e) { if ((window.event.keyCode) == 120) //F9 { emQuickSearch(input_cco.value, 'cco', ID); } else { search_contacts(window.event.keyCode,this.id); } } } td_cco.appendChild(input_cco); var img_search = document.createElement("IMG"); img_search.src = "./templates/"+template+"/images/search.gif"; img_search.title = get_lang('Search') + " | " + get_lang('Use F9 Key as shortcut.'); img_search.onclick = function () {emQuickSearch(document.getElementById('cco_'+ID).value, 'cco', ID);}; var span_search = document.createElement("SPAN"); span_search.innerHTML = get_lang('Search'); var td3_img_search = document.createElement("TD"); td3_img_search.setAttribute("noWrap","true"); var td3_span_search = document.createElement("TD"); td3_span_search.setAttribute("noWrap","true"); td3_img_search.appendChild(img_search); td3_span_search.appendChild(span_search); tr3.appendChild(td3); tr3.appendChild(td_cco); tr3.appendChild(td3_img_search); tbody_message.appendChild(tr3); ////////////////////////////////////////////////////////////////////////////////////////////////////// var tr_link = document.createElement("TR"); tr_link.id = "tr_link_"+ID; var td1_link = document.createElement("TD"); var td2_link = document.createElement("TD"); td1_link.innerHTML = " "; var a_cc_link = document.createElement('A'); a_cc_link.innerHTML = get_lang('Add CC'); a_cc_link.id = "a_cc_link_"+ID; a_cc_link.setAttribute("href","javascript:void(0)"); a_cc_link.setAttribute("tabIndex","-1"); a_cc_link.onclick = function () {this.style.display='none';document.getElementById('tr_cc_'+ID).style.display='';document.getElementById('space_link_'+ID).style.display='none';input_cc.focus(); return false;} td2_link.appendChild(a_cc_link); var space = document.createElement("span"); space.id ="space_link_"+ID; space.innerHTML=" | "; td2_link.appendChild(space); var a_cco_link = document.createElement('A'); a_cco_link.innerHTML = get_lang('Add BCC'); a_cco_link.id = "a_cco_link_"+ID; a_cco_link.setAttribute("href","javascript:void(0)"); a_cco_link.setAttribute("tabIndex","-1"); a_cco_link.onclick = function () {this.style.display='none';document.getElementById('tr_cco_'+ID).style.display='';document.getElementById('space_link_'+ID).style.display='none';input_cco.focus(); return false;} td2_link.appendChild(a_cco_link); tr_link.appendChild(td1_link); tr_link.appendChild(td2_link); tbody_message.appendChild(tr_link); ////////////////////////////////////////////////////////////////////////////////////////////////////// var tr4 = document.createElement("TR"); var td4 = document.createElement("TD"); //td4.setAttribute("noWrap","true"); td4.innerHTML = get_lang("Subject")+":"; var td_subject = document.createElement("TD"); var input_subject = document.createElement('input'); input_subject.id = "subject_"+ID; input_subject.name = "input_subject"; input_subject.setAttribute("tabIndex","1"); input_subject.style.width = "90%"; input_subject.setAttribute("autocomplete","off"); td_subject.appendChild(input_subject); tr4.appendChild(td4); tr4.appendChild(td_subject); tbody_message.appendChild(tr4); ////////////////////////////////////////////////////////////////////////////////////////////////////// var tr5 = document.createElement("TR"); var td5 = document.createElement("TD"); td5.innerHTML = " "; var td_return_receipt = document.createElement("TD"); td_return_receipt.setAttribute("noWrap","true"); td_return_receipt.innerHTML = get_lang("Return receipt")+":"; var input_return_receipt = document.createElement('input'); input_return_receipt.type = "checkbox"; input_return_receipt.className = "checkbox"; input_return_receipt.id = "return_receipt_"+ID; input_return_receipt.name = "input_return_receipt"; input_return_receipt.setAttribute("tabIndex","-1"); td_return_receipt.appendChild(input_return_receipt); tr5.appendChild(td5); tr5.appendChild(td_return_receipt); tbody_message.appendChild(tr5); if (preferences.use_important_flag) { var trn = document.createElement("TR"); var tdn = document.createElement("TD"); tdn.innerHTML = " "; var td_important_msg = document.createElement("TD"); td_important_msg.setAttribute("noWrap","true"); td_important_msg.innerHTML = get_lang("Important message")+":"; var input_important_message = document.createElement('input'); input_important_message.type = "checkbox"; input_important_message.className = "checkbox"; input_important_message.id = "important_message_"+ID; input_important_message.name = "input_important_message"; input_important_message.setAttribute("tabIndex","-1"); td_important_msg.appendChild(input_important_message); trn.appendChild(tdn); trn.appendChild(td_important_msg); tbody_message.appendChild(trn); } var add_files = document.createElement("A"); add_files.setAttribute("href", "javascript:void(0)"); add_files.onclick = function () { addFile(ID); return false;}; add_files.innerHTML = get_lang("Attachments: add+"); add_files.setAttribute("tabIndex","-1"); var divfiles = document.createElement("DIV"); divfiles.id = "divFiles_"+ID; var tr5 = document.createElement("TR"); var td5_link = document.createElement("TD"); var td5_input = document.createElement("TD"); td5_input.innerHTML = " " td5_link.setAttribute("valign","top"); td5_link.setAttribute("colSpan","2"); td5_link.appendChild(add_files); tr5.appendChild(td5_input); tr5.appendChild(td5_link); tbody_message.appendChild(tr5); var tr6 = document.createElement("TR"); var td6_link = document.createElement("TD"); var td6_input = document.createElement("TD"); tr6.appendChild(td6_link); td6_input.appendChild(divfiles); tr6.appendChild(td6_input); tbody_message.appendChild(tr6); ////////////////////////////////////////////////////////////////////////////////////////////////////// var tr5 = document.createElement("TR"); var td5 = document.createElement("TD"); td5.innerHTML = " "; var td_body = document.createElement("TD"); td_body.setAttribute("colSpan","2"); var div_body_position = document.createElement("DIV"); div_body_position.id = "body_position_" + ID; td_body.appendChild(div_body_position); tr5.appendChild(td5); tr5.appendChild(td_body); tbody_message.appendChild(tr5); // BEGIN MAKE THE SCROLL HEIGHT var defaultWidth = document.body.clientWidth - (is_ie ? 200 : 195); var _bar = document.getElementById("toolbar"); var _offset = 0; if(_bar.style.visibility != 'hidden') _offset = _bar.offsetHeight ? _bar.offsetHeight : _bar.clientHeight; var _div = document.createElement("DIV"); _div.id = "div_message_scroll_"+ID; _div.style.height = document.body.clientHeight - _offset - 105; content.style.height = document.body.clientHeight - _offset - 80; _div.style.overflow = "auto"; _div.style.width = defaultWidth; // END MAKE THE SCROLL HEIGHT // Hide the contac tips and re-position the pallete color. _div.onscroll = function() { var intElemScrollTop = Element("div_message_scroll_"+ID).scrollTop; if (!is_ie) ColorPalette.repos(intElemScrollTop); Tooltip.scrollChanged(); }; ////////////////////////////////////////////////////////////////////////////////////////////////////// _div.appendChild(form); content.appendChild(_div); table_message.appendChild(tbody_message); form.appendChild(table_message); connector.loadScript("rich_text_editor"); RichTextEditor.loadEditor(ID); ////////////////////////////////////////////////////////////////////////////////////////////////////// draw_from_field(sel_from,tr1_1); return ID; } // Verify if any user is sharing his name/email address // for use in the new messages's "From " field. function draw_from_field(sel_from,tr1_1){ var el_shared_users = Element("el_shared_users"); // The element was loaded and populated...so return. if(el_shared_users){ // Nothing to work...so return. if(el_shared_users.options.length == 0) return; tr1_1.style.display = ''; for (var x = 0; x < el_shared_users.options.length; x++) { var _option = document.createElement("OPTION"); _option.text = el_shared_users.options[x].text; _option.value = el_shared_users.options[x].value; sel_from.options[sel_from.options.length] = _option ; } return; } // Get the shared folders..... var RegExp_name = new RegExp("(user)"+cyrus_delimiter+"(.*)$", "i"); var sharedFolders = new Array(); for(var i = 0; i < folders.length; i++) { var x = folders[i].folder_id; if (RegExp_name.test(x)){ sharedFolders[sharedFolders.length] = x; } } var matchUser = '#'; var sharedUsers = new Array(); // Filter the shared folders (only root folders) ..... for(var i = 0; i < sharedFolders.length; i++) { if(!sharedFolders[i].match(matchUser)) { matchUser = sharedFolders[i]; sharedUsers[sharedUsers.length] = matchUser.substring(("user"+cyrus_delimiter).length,matchUser.length); } } // Handler function for cExecute var h_user = function(data) { if(data.length > 0) { tr1_1.style.display = ''; var _option = document.createElement("OPTION"); _option.text = '"'+data.myname+'" <'+Element("user_email").value+'>'; _option.value = data.myname+";"+Element("user_email").value; sel_from.options[sel_from.options.length] = _option; var options = ''; for (var x = 0; x < data.length; x++) { var _option = document.createElement("OPTION"); _option.text = '"'+data[x].cn[0] + '" <'+data[x].mail[0]+'>'; _option.value = data[x].cn[0] + ';'+data[x].mail[0]; sel_from.options[sel_from.options.length] = _option ; } } var shared_users_from = Element("el_shared_users"); if(!shared_users_from) { shared_users_from = sel_from.cloneNode(true); shared_users_from.id = "el_shared_users"; shared_users_from.style.display = 'none'; document.body.appendChild(shared_users_from); } } // First time, so execute..... cExecute ("$this.ldap_functions.getSharedUsersFrom&uids="+sharedUsers.join(';'), h_user); } function changeBgColorToON(all_messages, begin, end){ for (begin; begin<=end; begin++) { add_className(all_messages[begin], 'selected_msg'); Element("check_box_message_" + all_messages[begin].id).checked = true; } } function changeBgColor(event, msg_number){ actual_tr = Element(msg_number); if (event.shiftKey) { last_tr = Element(last_message_selected); if(!last_tr) last_tr = actual_tr; all_messages = actual_tr.parentNode.childNodes; for (var i=0; i < all_messages.length; i++) { if (actual_tr.id == all_messages[i].id) first_order = i; if (last_tr.id == all_messages[i].id) last_order = i; } if (parseInt(first_order) > parseInt(last_order)) changeBgColorToON(all_messages, last_order, first_order); else changeBgColorToON(all_messages, first_order, last_order); } else{ //if ( exist_className(actual_tr, 'selected_msg') ) if ( Element('check_box_message_' + msg_number).checked ) add_className(actual_tr, 'selected_msg'); else remove_className(actual_tr, 'selected_msg'); } last_message_selected = msg_number; } function build_quota(data){ id = "content_quota"; q_limit = data['quota_limit']; var div = document.getElementById(id); if(!q_limit){ div.innerHTML = ''+get_lang("Without Quota")+''; } else{ if(div) div.innerHTML = ''; value = data['quota_percent']; q_used = data['quota_used']; table = document.getElementById("table_quota"); if(table) table.parentNode.removeChild(table); table = document.createElement("TABLE"); tbody = document.createElement("TBODY"); table.appendChild(tbody); table.id = "table_quota"; table.width="102"; table.border="0"; table.cellSpacing = 0; table.cellPadding = 0; //tr1 = document.createElement("TR"); td11 = document.createElement("TD"); td11.align="center"; td11.setAttribute("noWrap","true"); td11.innerHTML += ' ' + value+"% ("+q_used+"M/"+q_limit+"M)"; //tr1.appendChild(td11); tr2 = document.createElement("TR"); td21 = document.createElement("TD"); td21.setAttribute("noWrap","true"); td21.height="15"; td22 = document.createElement("TD"); td21.setAttribute("background","templates/"+template+"/images/dsunused.gif"); table221 = document.createElement("TABLE"); tbody221 = document.createElement("TBODY"); table221.appendChild(tbody221); table221.style.width=value+"%"; td21.width="102"; table221.border="0"; table221.cellSpacing = 0; table221.cellPadding = 0; tr221 = document.createElement("TR"); td221 = document.createElement("TD"); td221.height="15"; if(value > 90) { if(value >= 100) write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages.")); else write_msg(get_lang("Warning: Your Mailbox is almost full!")); td221.setAttribute("background","templates/"+template+"/images/dsalert.gif"); } else if(value > 80) td221.setAttribute("background","templates/"+template+"/images/dswarn.gif"); else td221.setAttribute("background","templates/"+template+"/images/dsused.gif"); tr221.appendChild(td221); tbody221.appendChild(tr221); td21.appendChild(table221); tr2.appendChild(td21); tr2.appendChild(td11); //tr2.appendChild(td1); tbody.appendChild(tr2); //Desenho //tbody.appendChild(tr1); //Letras div.appendChild(table); } } function draw_quota(data){ build_quota(data); } function update_quota(folder_id){ cExecute ("$this.imap_functions.get_quota&folder_id="+folder_id,build_quota); } function draw_search(headers_msgs){ Element("border_id_0").innerHTML = "  " + get_lang('Search Result') + "  "; var tbody = Element('tbody_box'); for (var i=0; i<(headers_msgs.length); i++){ var tr = this.make_tr_message(headers_msgs[i], headers_msgs[i].msg_folder); if (tr) tbody.appendChild(tr); } } function draw_search_header_box(){ var table_message_header_box = Element("table_message_header_box"); table_message_header_box.parentNode.removeChild(table_message_header_box); var content_id_0 = Element("content_id_0"); var table_element = document.createElement("TABLE"); var tbody_element = document.createElement("TBODY"); table_element.setAttribute("id", "table_message_header_box"); table_element.className = "table_message_header_box"; tr_element = document.createElement("TR"); tr_element.className = "message_header"; td_element1 = document.createElement("TD"); td_element1.setAttribute("width", "1%"); chk_box_element = document.createElement("INPUT"); chk_box_element.id = "chk_box_select_all_messages"; chk_box_element.setAttribute("type", "checkbox"); chk_box_element.className = "checkbox"; chk_box_element.onclick = function(){select_all_messages(this.checked);}; chk_box_element.onmouseover = function () {this.title=get_lang('Select all messages.')}; chk_box_element.onkeydown = function (e){ if (is_ie) { if ((window.event.keyCode) == 46) { //delete_all_selected_msgs_imap(); proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); } } else { if ((e.keyCode) == 46) { //delete_all_selected_msgs_imap(); proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); } } }; td_element1.appendChild(chk_box_element); td_element2 = document.createElement("TD"); td_element2.setAttribute("width", "3%"); td_element3 = document.createElement("TD"); td_element3.setAttribute("width", "30%"); td_element3.id = "message_header_SORTFROM"; td_element3.align = "left"; td_element3.innerHTML = get_lang("From"); td_element4 = document.createElement("TD"); td_element4.setAttribute("width", "49%"); td_element4.id = "message_header_SORTSUBJECT"; td_element4.align = "left"; td_element4.innerHTML = get_lang("Subject"); td_element5 = document.createElement("TD"); td_element5.setAttribute("width", "10%"); td_element5.id = "message_header_SORTARRIVAL"; td_element5.align = "center"; td_element5.innerHTML = ""+get_lang("Date")+""; td_element5.innerHTML += ""; td_element6 = document.createElement("TD"); td_element6.setAttribute("width", "10%"); td_element6.id = "message_header_SORTSIZE"; td_element6.align = "right"; td_element6.innerHTML = get_lang("Size"); tr_element.appendChild(td_element1); tr_element.appendChild(td_element2); tr_element.appendChild(td_element3); tr_element.appendChild(td_element4); tr_element.appendChild(td_element5); tr_element.appendChild(td_element6); tbody_element.appendChild(tr_element); table_element.appendChild(tbody_element); content_id_0.appendChild(table_element); } function draw_search_division(msg){ var tbody = Element('tbody_box'); var tr = document.createElement("TR"); var td = document.createElement("TD"); td.colSpan = '7'; td.width = '100%'; var action_info_table = document.createElement("TABLE"); var action_info_tbody = document.createElement("TBODY"); action_info_table.className = "action_info_table"; action_info_table.width = "100%"; var action_info_tr = document.createElement("TR"); var action_info_th1 = document.createElement("TH"); action_info_th1.width = "40%"; action_info_th1.innerHTML = " "; var action_info_th2 = document.createElement("TH"); action_info_th2.innerHTML = msg; action_info_th2.className = "action_info_th"; action_info_th2.setAttribute("noWrap", "true"); var action_info_th3 = document.createElement("TH"); action_info_th3.width = "40%"; action_info_th3.innerHTML = " "; action_info_tr.appendChild(action_info_th1); action_info_tr.appendChild(action_info_th2); action_info_tr.appendChild(action_info_th3); action_info_tbody.appendChild(action_info_tr); action_info_table.appendChild(action_info_tbody); td.appendChild(action_info_table); tr.appendChild(td); tbody.appendChild(tr); } function draw_search_box(){ var content_id_0 = Element("content_id_0"); var table = document.createElement("TABLE"); table.id = "table_box"; table.width = 'auto'; var tbody = document.createElement("TBODY"); tbody.id = "tbody_box"; table.className = "table_box"; table.setAttribute("frame", "below"); table.setAttribute("rules", "none"); table.setAttribute("cellpadding", "0"); table.onkeydown = function (e){ if (is_ie) { if ((window.event.keyCode) == 46) { //delete_all_selected_msgs_imap(); proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); } } else { if ((e.keyCode) == 46) { //delete_all_selected_msgs_imap(); proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); } } }; if (is_ie) table.style.cursor = "hand"; table.appendChild(tbody); content_id_0.appendChild(table); } var idx_cc = 0; function draw_plugin_cc(ID, addrs) { connector.loadScript("ccQuickAdd"); var array_addrs = ''; var array_name = ''; var cc_data = new Array(); if(typeof(addrs.name) != 'undefined') { array_name = LTrim(addrs.name).split(" "); array_addrs = new Array(addrs.email); } else { array_addrs = (typeof addrs == 'object' ? addrs.toString().split("\" ") : addrs.split("\" ")); array_name = LTrim(array_addrs[0]).replace('"','').split(" "); } var _split = array_name[0].split('@'); cc_data[0] = _split[0]; cc_data[1] = _split[0]; cc_data[2] = ''; for (i=1; i < array_name.length; i++) cc_data[2] += array_name[i] + " "; if(array_addrs.length > 1) cc_data[3] = array_addrs[1] ? array_addrs[1].replace("<",'').replace(">",'') : ''; else cc_data[3] = array_addrs[0]; var sm_envelope_img1 = ''; var to_addybook_add = ""; to_addybook_add += addrs; to_addybook_add += sm_envelope_img1; idx_cc++; to_addybook_add += ""; return to_addybook_add; } function deny_email(email){ connector.loadScript("filter"); connector.loadScript("filters"); var dn_em = document.createElement("SPAN"); dn_em.id = "tt_d"; dn_em.onclick = function(){filter_rules.new_rule(email);}; dn_em.setAttribute("title",get_lang("Block Sender")); dn_em.style.cursor = "pointer"; dn_em.innerHTML = ""; return dn_em; } function show_div_address_full(id, type) { var div_address_full = Element("div_"+type+"address_full_"+id); if(!div_address_full) { div_address_full = document.createElement("SPAN"); div_address_full.id = "div_"+type+"address_full_"+id; div_address_full.style.display="none"; var _address = eval(type+"address_array['"+id+"']"); var isOverLimit = (_address.length > 100); if(isOverLimit) { alert("Esse campo possui muitos endereços ("+_address.length+" destinatários).\r\n"+ "Para evitar o travamento do navegador, o botão 'Adicionar Contato' foi desabilitado!"); } for(var idx = 1 ; idx < _address.length;idx++) { div_address_full.innerHTML += isOverLimit ? '
'+_address[idx] : ','+draw_plugin_cc(id,_address[idx]); } div_address_full.innerHTML += " ("+get_lang('less')+")"; Element(type+"_"+id).appendChild(div_address_full); } Element('div_'+type+'address_'+id).style.display='none'; div_address_full.style.display=''; } function draw_footer_box(num_msgs){ folder = get_current_folder(); var span_R = Element("table_message"); var span_options = Element("span_options"); if(!span_options) { span_options = document.createElement("TD"); span_options.style.fontSize = "12"; span_options.id = "span_options"; span_R.appendChild(span_options); } var change_font_color = 'onmouseover="var last_class = this.className;'+ 'this.className=\'message_options_active\';'+ 'this.onmouseout=function(){this.className=last_class;}"'; span_options.innerHTML = ''+get_lang("Delete")+''+ ''+get_lang("Move")+''+ ''+get_lang("Print")+''+ ''+get_lang("Export")+'' + ''+get_lang("Import")+''; if(preferences.use_local_messages==1) span_options.innerHTML += ' '+get_lang("Archive")+''; if (use_spam_filter) { if ( current_folder == 'INBOX'+cyrus_delimiter+'Spam' ) { span_options.innerHTML += ' | '+get_lang("Not Spam")+''; } else { span_options.innerHTML += ' | '+get_lang("Mark as Spam")+''; } } var span_D = Element("span_D"); if(!span_D){ span_D = document.createElement("TD"); span_D.align = "right"; span_D.style.fontSize = "12"; span_D.id = "span_D"; span_R.appendChild(span_D); } span_D.innerHTML = get_lang("List")+': '+ ''+get_lang("All")+', '+ ''+get_lang("l_unseen")+', '+ ''+get_lang("l_seen")+', '+ ''+get_lang("l_answered")+', '+ ''+get_lang("l_important")+'  '; draw_paging(num_msgs); Element("tot_m").innerHTML = num_msgs; }