Changeset 6711
- Timestamp:
- 07/05/12 10:29:43 (12 years ago)
- Location:
- sandbox/novoExpressoMail/expressoMail1_2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/novoExpressoMail/expressoMail1_2/js/abas.js
r6684 r6711 1 1 var BordersArray = new Array(); 2 BordersArray[0] = new setBorderAttributes(0);3 2 var countBorders = 0; 4 3 var partMsgs = new Array(); … … 7 6 var zebraDiscardEventDialog = false; 8 7 var saveBorderError = new Array(); 8 var ID = 1; 9 9 10 function setBorderAttributes(ID)11 {12 this.border_id = "border_id_"+ID;13 this.sequence = ID;14 }15 16 17 function alternate_border(ID)18 {19 msg_selected = false;//Controle da seleção de mensagens20 if(isNaN(ID))21 if(preferences.use_shortcuts == "1")22 select_msg((ID.split("_"))[0]);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 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 45 if (! Element('border_id_'+ID))46 return false; // Not possible to alternate47 show_hide_span_paging(ID);48 spanD = Element("span_D");49 if (spanD)50 spanD.style.display = (openTab.type[ID] == 0 ? '' : 'none');51 52 var footer_menu = Element("footer_menu");53 var aba = Element('border_id_'+ID);54 if (footer_menu != null) {55 footer_menu.style.display = (openTab.type[ID] != 4 ? '' : 'none');56 var alternate_menu = document.getElementById('localOption');57 58 if(alternate_menu != null && alternate_menu != 'undefined'){ //Quando Carregado o expresso mail59 if(openTab.imapBox[ID]!= null && openTab.imapBox[ID]!= 'undefined' ){ //Quando abrir uma Nova Mensagem60 if((openTab.imapBox[ID].indexOf("local_") >= 0)){61 alternate_menu.title = get_lang("Unarchive");62 alternate_menu.removeAttribute("onclick");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 }70 alternate_menu.innerHTML = get_lang("Unarchive");71 72 }else{73 alternate_menu.title = get_lang("Archive");74 alternate_menu.removeAttribute("onclick");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 }82 alternate_menu.innerHTML = get_lang("Archive");83 }84 85 }86 }87 88 if((aba.id.indexOf("_r") < 0) && (aba.id.indexOf("_0") < 0) && (aba.id.indexOf("id_search_") < 0) && (aba.id.indexOf("_s") < 0)){89 spanD.style.display = 'none';90 footer_menu.style.display = 'none';91 }92 }93 94 95 var len = BordersArray.length;96 for (var i=0; i < len; i++)97 {98 m = document.getElementById(BordersArray[i].border_id);99 if ((m)&&(m.className == 'menu-sel'))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';106 107 }108 }109 110 m = Element("border_id_"+ID);111 if (m)112 m.className = 'menu-sel';113 if(Element("font_border_id_" + ID))114 Element("font_border_id_" + ID).className = 'font-menu-sel';115 var c = Element("content_id_"+ID)116 if (c)117 c.style.display = '';118 119 120 // hide the DropDrowContact, if necessary121 window_DropDownContacts = Element('tipDiv');122 if ((window_DropDownContacts)&&(window_DropDownContacts.style.visibility != 'hidden')){123 window_DropDownContacts.style.visibility = 'hidden';124 }125 126 numBox = getNumBoxFromTabId(ID);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 else139 {140 numBox = ID.substr(7);141 }142 }143 }144 currentTab=ID;145 if( document.getElementById('to_'+ID) && document.getElementById('to_'+ID).type == "textarea"){146 document.getElementById('to_'+ID).focus();147 }148 RichTextEditor.setEditable(ID);149 resizeWindow();150 return ID;151 }152 153 function create_border(borderTitle, id_value, search)154 {155 156 borderTitle = ( ( borderTitle && borderTitle.constructor == String && borderTitle.length > 0 ) ? borderTitle : ' ' );157 borderTitle = html_entities(borderTitle);158 var resize = false;159 resize = resize_borders();160 if (!resize){161 var str_continue = '';162 var bolContinue = true;163 str_continue = '\n' + get_lang('You must manually close one of your tabs before opening a new one');164 if (preferences.auto_close_first_tab == 1){165 var children = Element('border_tr').childNodes;166 var bolDelete = true;167 for (var i=0; i<children.length; i++) {168 if ((children[i].nodeName === 'TD') && (children[i].id!=='border_id_0') && (children[i].id!=='border_blank'))169 {170 bolDelete = true;171 var num_child = children[i].id.toString().substr(10);172 alternate_border(num_child);173 if (editTest(num_child)){174 bolDelete = false;175 }176 if (bolDelete || bolContinue){177 str_fechar = '\n' + get_lang('Reached maximum tab limit. Want to close this tab');178 var confirmacao = confirm(str_fechar);179 if(confirmacao){180 bolContinue = false;181 delete_border(num_child, 'false');182 break;183 }else{184 return 'maximo';185 }186 }187 }188 }189 }else{190 alert(get_lang('Reached maximum tab limit') + str_continue );191 return 'maximo';192 }193 }194 195 if (! id_value){ // Is new message?196 var ID = parseInt(BordersArray[(BordersArray.length-1)].sequence) + 1;197 if(isNaN(ID)){198 var aux = BordersArray[(BordersArray.length-1)].sequence.split("_");199 ID = parseInt(aux[1]) + 1;200 }201 }else202 {203 if (Element("border_id_"+id_value)) // It's opened already!204 return alternate_border(id_value);205 206 var ID = id_value;207 if(isNaN(ID) && ID.indexOf("search_local") >= 0){208 if(current_folder.indexOf("local") >= 0)209 openTab.imapBox[ID] = current_folder;210 else211 openTab.imapBox[ID] = 'local_search';212 }else if(isNaN(ID) && ID.indexOf("search_") >= 0){213 if(current_folder.indexOf("local") < 0)214 openTab.imapBox[ID] = current_folder;215 else216 openTab.imapBox[ID] = 'search';217 }else if( (currentTab != 0) && isNaN(currentTab) && (currentTab.indexOf("search") >= 0) && (ID.indexOf("msg") < 0) ) {218 var id_border = currentTab.replace(/[a-zA-Z_]+/, "");219 ID_TR = ID.toString().substr(0,ID.toString().indexOf("_r"));220 var tr = Element(ID_TR);221 openTab.imapBox[ID] = (tr.getAttribute('name') == null?get_current_folder():tr.getAttribute('name'));222 }else223 openTab.imapBox[ID] = current_folder;224 }225 td = document.createElement("TD");226 td.id="border_id_" + ID;227 if(resize)228 {229 td.setAttribute("width", parseInt(resize)+"px");230 td.style.width = parseInt(resize)+"px";231 }232 else233 td.setAttribute("width", "200px");234 235 td.setAttribute("align", "right");236 td.onclick = function(){alternate_border(ID);resizeWindow()};237 td.setAttribute("noWrap","true");238 td.alt = ' ';239 td.title = borderTitle;240 borderTitle = borderTitle ? borderTitle : id_value ? get_lang("No Subject") : " " ;241 td.value = borderTitle;242 if (borderTitle.length > 21)243 borderTitle = borderTitle.substring(0,21) + "...";244 245 if ( resize )246 borderTitle = borderTitle.substring(0, resize*0.08);247 248 var cc = search;249 if(!cc){250 if(isNaN(ID)){251 var is_local = ID.match('.*_local_.*');252 if(!is_local)253 cc = document.getElementById("em_message_search").value;254 else{255 cc = document.getElementsByName(currentTab)[0].value;256 }257 }else{258 cc ="";259 }260 }261 td.innerHTML = "<div><div id='font_border_id_" + ID+"' class='font-menu'>" +262 borderTitle +263 "</div>\n\264 <div style='float:right;'>\n\265 <img onmousedown='javascript:return false' style='cursor:pointer' onclick=delete_border('" + ID + "','false') src='templates/"+template+"/images/close_button.gif'/>\n\ " +266 "</div>\n\ " +267 "<input type=\"hidden\" name=\""+ ID+"\" value=\""+cc+"\"></div>";268 bb = document.getElementById("border_blank");269 parent_bb = bb.parentNode; //Pego o tbody270 parent_bb.insertBefore(td, bb);271 272 if((typeof(id_value) == 'string') && id_value.match(/_r/)){273 $(td).draggable({274 start : function(){275 if($(".shared-folders").length){276 $(".shared-folders").parent().find('.folder:not(".shared-folders")').droppable({277 over : function(a, b){278 //SETA BORDA EM VOLTA DA PASTA279 over = $(this);280 $(this).addClass("folder-over");281 if(($(this)[0] != $(this).parent().find(".head_folder")[0]))282 if($(this).prev()[0])283 if($(this).parent().find(".expandable-hitarea")[0] == $(this).prev()[0]){284 setTimeout(function(){285 if(over.hasClass("folder-over"))286 over.prev().trigger("click");287 }, 500);288 289 }290 },291 out : function(){292 //RETIRA BORDA EM VOLTA DA PASTA293 $(this).removeClass("folder-over");294 },295 //accept: ".draggin_mail",296 drop : function(event, ui){297 $(this).css("border", "");298 if($(this).parent().attr('id') == undefined){299 var folder_to = 'INBOX';300 var to_folder_title = get_lang("Inbox");301 }else{302 var folder_to = $(this).parent().attr('id');303 var to_folder_title = $(this).attr('title');304 }305 var folder_to_move = ui.draggable.parent().attr('id');306 var border_id = ui.draggable.find("input[type=hidden]").attr("name");307 if(folder_to_move == "border_tr"){308 var id_msg = border_id.split("_")[0];309 folder = $("#input_folder_"+border_id+"_r")[0] ? $("#input_folder_"+border_id+"_r").val() : (openTab.imapBox[border_id] ? openTab.imapBox[border_id]:get_current_folder());310 move_msgs2(folder, id_msg, border_id, folder_to, to_folder_title,true);311 return refresh();312 }313 }314 });315 }316 },317 stop :function(){318 $(".shared-folders").parent().find(".folder").droppable("destroy");319 },320 helper: function(event){321 if( borderTitle.length > 18 )322 return $("<td>"+DataLayer.render('../prototype/modules/mail/templates/draggin_box.ejs', {texto : borderTitle.substring(0,18) + "...", type: "messages"})+"</td>");323 else324 return $("<td>"+DataLayer.render('../prototype/modules/mail/templates/draggin_box.ejs', {texto : borderTitle, type: "messages"})+"</td>");325 },326 delay: 150,327 cursorAt: {top: 5, left: 56},328 refreshPositions: true ,329 containment: "#divAppbox"330 });331 }332 //_dragArea.makeDragged(td, id_value,td.value);333 334 BordersArray[BordersArray.length] = new setBorderAttributes(ID);335 336 var div = document.createElement("DIV");337 div.id = "content_id_" + ID;338 div.className = "conteudo";339 div.style.display='';340 341 div.style.overflow = "hidden";342 343 Element("exmail_main_body").insertBefore(div,Element("footer_menu"));344 if (!is_ie)345 resizeWindow();346 alternate_border(ID);347 uidsSave[ID] = [];348 saveBorderError[ID] = false;349 return ID;350 }351 352 function resize_borders()353 {354 var numBorders = count_borders();355 356 if (numBorders > 8)357 return false;358 359 return redim_borders(numBorders+1);360 }361 362 function count_borders()363 {364 var numBorders = 0;365 var children = Element('border_tr').childNodes;366 for (var i=0; i<children.length; i++) {367 if ((children[i].nodeName === 'TD') && (children[i].id!=='border_id_0') && (children[i].id!=='border_blank'))368 numBorders++;369 }370 371 return numBorders;372 }373 374 function redim_borders(numBorders)375 {376 var children = Element('border_tr').childNodes;377 var clientWidth = (window.document.body.clientWidth - findPosX(Element("exmail_main_body"))) - Element("border_id_0").clientWidth - 30;378 var newWidthTD = (clientWidth/numBorders)-6;379 newWidthTD = newWidthTD > 200 ? 200 : (newWidthTD < 50 ? 50 : newWidthTD);380 children = Element('border_tr').childNodes;381 for (var i=0; i<children.length; i++) {382 if ((children[i].nodeName === 'TD') && (children[i].id!=='border_id_0') && (children[i].id!=='border_blank')){383 $(children[i]).css("width", newWidthTD);384 $(children[i]).find('div:first').css("width", newWidthTD);385 set_border_caption(children[i].id, children[i].title, newWidthTD);386 }387 }388 return newWidthTD;389 }390 391 392 393 394 function set_border_caption(border_id, title, border_width)395 {396 var border = document.getElementById(border_id);397 if (border_width == null)398 {399 border_width = border.clientWidth;400 }401 var caption = "";402 if (border != null){403 Element("font_"+border.id).style.width = (border_width - 35)+'px';404 Element("font_"+border.id).innerHTML = title;405 }406 return(title);407 }408 409 410 function draftTests(ID, msg_sent){411 412 413 if( openTab.toPreserve[ID] = false)414 {415 close_delete(ID, msg_sent);416 delete(openTab.type[ID]);417 }418 else419 {420 var msg = 'Existem alterações não salvas na mensagem.';421 var buttons = ['Descartar alterações', 'Salvar e fechar' ,'Cancelar'];422 var width = 371;423 if($('#fileupload_msg'+ID).find('.in-progress').length)424 {425 msg = 'Existem anexos sendo enviados para o servidor.';426 buttons = ['Descartar alterações e anexos', 'Salvar estado atual fechar', 'Continuar editando'];427 width = 560;428 }429 zebraDiscardEventDialog = true;430 window.setTimeout(function() {431 $.Zebra_Dialog(msg, {432 'type': 'question',433 'overlay_opacity': '0.5',434 'buttons': buttons,435 'width' : width,436 'onClose': function(clicked) {437 if(clicked == 'Cancelar'){438 if (RichTextEditor.plain[id] != true)439 setTimeout("RichTextEditor.focus("+ID+")",100);440 else441 $('#body_'+ID).focus();442 }443 if(clicked == 'Descartar alterações' || clicked == 'Descartar alterações e anexos' ) {444 if (openTab.imapBox[ID] && !openTab.toPreserve[ID])445 openTab.toPreserve[ID] = false;446 447 delete(openTab.type[ID]);448 close_delete(ID, msg_sent);449 }450 else if(clicked == 'Salvar e fechar' || clicked == 'Salvar estado atual fechar')451 {452 save_msg(ID);453 openTab.toPreserve[ID] = false;454 close_delete(ID, msg_sent);455 delete(openTab.type[ID]);456 }457 else{458 459 Element("border_id_"+ID).onclick = function () {alternate_border(ID);};460 var setFocus = function(ID){461 if ($.trim($("#to_"+ID).val()) == "")462 $("#to_"+ID).focus();463 else if ($("#tr_cc_"+ID).css('display') != 'none' && $.trim($("#cc_"+ID).val()) == "")464 $("#cc_"+ID).focus();465 else if ($("#tr_cco_"+ID).css('display') != 'none' && $.trim($("#cco_"+ID).val()) == "")466 $("#cco_"+ID).focus();467 else if ($.trim($("#subject_"+ID).val()) == "")468 $("#subject_"+ID).focus();469 else{470 if (RichTextEditor.plain[id] != true)471 setTimeout("RichTextEditor.focus("+ID+")",100);472 else473 $('#body_'+ID).focus();474 }475 }476 setFocus(ID);477 }478 window.setTimeout(function() {479 zebraDiscardEventDialog = false;480 }, 500);481 }})}, 300);482 }483 484 }485 486 function editTest(ID){487 var body = document.getElementById('body_'+ ID);488 var content = $('#content_id_'+ ID);489 if (body)490 {491 var save_link = content.find(".save");492 if (openTab.toPreserve[ID] == undefined)493 openTab.toPreserve[ID] = false;494 if (((! openTab.toPreserve[ID] && ! ID.toString().match("_r")) || ((body.contentWindow) == 'object' && body.contentWindow.document.designMode.toLowerCase() == 'on')) && (save_link.onclick != ''))495 {496 return true;497 }498 }499 return false;500 }501 502 function delete_border(ID, msg_sent)503 {504 505 if($("#border_id_"+ID).attr("title") == get_lang("New Message")){506 var to = $("#content_id_"+ID).find(".to").parent(".email-area").find("div").length || $("#content_id_"+ID).find(".email-area").find(".to").val();507 var cc = $("#content_id_"+ID).find(".cc").parent(".email-area").find("div").length || $("#content_id_"+ID).find(".email-area").find(".cc").val();508 var cco = $("#content_id_"+ID).find(".cco").parent(".email-area").find("div").length || $("#content_id_"+ID).find(".email-area").find(".cco").val();509 var subject = $("#content_id_"+ID).find(".subject").val();510 var auxAttachments = false;511 var attachments = $("#content_id_"+ID).find("ul.attachments-list").find("li").each(function(){512 ($(this).find("p").length > 0) ? auxAttachments = true : auxAttachments;513 if(auxAttachments)514 return false;515 });516 var textArea = RichTextEditor.getData("body_"+ID);517 518 if(!to && !cc && !cco && !auxAttachments && subject == "" && textArea == "")519 close_delete(ID, msg_sent);520 }521 var bolExecuteClose = true;522 var borderElem = Element("border_id_" + ID);523 if (borderElem){524 borderElem.onclick = null; // It's avoid a FF3 bug525 }else{526 return false;527 }528 if (msg_sent == 'false')529 {530 if (editTest(ID)){531 bolExecuteClose = false;532 if(zebraDiscardEventDialog === false)533 return(draftTests(ID, msg_sent));534 }535 }536 if (bolExecuteClose)537 {538 close_delete(ID, msg_sent);539 }540 delete(openTab.type[ID]);541 return true;542 }543 544 function close_delete(ID, msg_sent)545 {546 openTab.toPreserve[ID] = false;547 // Limpa o autosave548 if (preferences.auto_save_draft == 1 && autoSaveControl.timer[ID] !== null )549 {550 autoSaveControl.status[ID] = null;551 clearInterval(autoSaveControl.timer[ID]);552 }553 ////////////////////////////////554 555 hold_session = false;556 if (exist_className(Element('border_id_'+ID),'menu-sel'))557 {558 if (BordersArray[BordersArray.length-2].sequence == ID)559 this.alternate_border(0);560 else561 this.alternate_border(BordersArray[BordersArray.length-2].sequence);562 }563 564 // Remove TD, title565 border = Element('border_id_' + ID);566 border.parentNode.removeChild(border);567 var j=0;568 var new_BordersArray = new Array();569 for (i=0;i<BordersArray.length;i++)570 if (document.getElementById(BordersArray[i].border_id) != null){571 new_BordersArray[j] = BordersArray[i];572 j++;573 }574 if(j == 1)575 Element("footer_menu").style.display = '';576 BordersArray = new_BordersArray;577 578 // Remove Div Content579 content = Element('content_id_' + ID);580 content.parentNode.removeChild(content);581 if(is_webkit)582 resizeWindow();583 RichTextEditor.destroy( 'body_'+ID );584 delete msgAttachments[ID];585 //Caso for uma mensagem anexada tem que deletar ela da lixeira apos fechar a aba586 var isPartMsg = false;587 if(!parseInt(id2))588 return;589 var id2 = ID.replace('_r','');590 for(var ii = 0; ii < partMsgs.length; ii++)591 if(partMsgs[ii] == id2){592 isPartMsg = true;593 partMsgs[ii] = null;594 }595 596 if(isPartMsg === true){597 var handler_delete_msg = function(){};598 cExecute ("$this.imap_functions.delete_msgs&folder=INBOX"+cyrus_delimiter+trashfolder+"&msgs_number="+id2,handler_delete_msg);599 }600 ///////////////////////////////////////////////////////////////////////////////////601 602 return true;603 }604 605 function getTabPrefix() { // define o prefixo para os checkboxes das mensagens606 if (typeof(currentTab)!='number')607 return currentTab+"_";608 else609 return "";610 }611 612 function getMessageIdFromRowId(row_id) { // extrai o id da mensagem do id da linha613 var p = row_id.search("_s");614 if (p>0)615 return row_id.substr(0,p);616 else617 return row_id;618 }619 620 function getNumBoxFromTabId(tab_id) { // extrai o numBox do id da tab621 if (typeof(tab_id)=='number') {622 return tab_id;623 }624 else {625 var p = tab_id.search(/[0-9]/);626 return tab_id.substr(p);627 }628 }629 630 function addAttachment(ID, att)631 {632 if(typeof(msgAttachments[ID]) == 'undefined')633 msgAttachments[ID] = [];634 635 msgAttachments[ID].push(att);636 }637 638 function delAttachment(ID, att)639 {640 641 if(msgAttachments[ID] == undefined) return;642 var len = msgAttachments[ID].length;643 for(var i = 0; i < len; i++)644 {645 if(msgAttachments[ID][i] == att)646 {647 delete msgAttachments[ID][i];648 break;649 }650 }651 }652 653 function listAttachment(ID)654 {655 return (typeof(msgAttachments[ID]) == 'undefined') ? '' : JSON.stringify(msgAttachments[ID]);656 }657 -
sandbox/novoExpressoMail/expressoMail1_2/js/draw_api.js
r6698 r6711 1073 1073 numBox = 0; //As pastas sempre estarão na aba 0 1074 1074 1075 openTab.content_id[numBox] = document.getElementById(" content_id_"+numBox);1075 openTab.content_id[numBox] = document.getElementById("ptabs_"+numBox); 1076 1076 openTab.content_id[numBox].innerHTML = ""; 1077 1077 openTab.imapBox[numBox] = msg_folder; … … 1361 1361 var tdFolders = Element("folderscol"); 1362 1362 tdFolders.style.display = preferences.hide_folders == '1' ? "none" : ""; 1363 if ( !currentTab ) 1364 alternate_border(numBox); 1363 1365 1364 draw_footer_box(headers_msgs.num_msgs); 1366 1365 Element('main_table').style.display = ''; … … 1368 1367 setTimeout("resizeWindow()",1); 1369 1368 else 1370 resizeWindow();1369 //resizeWindow(); 1371 1370 if(debug) { 1372 1371 var _eTime = new Date(); … … 1403 1402 Element('msg_number').value = ''; 1404 1403 } 1404 $("#ptabs_0")//.empty().html("<table style='height: 618px;'></table>") 1405 .find("table:first").remove(); 1406 $("#ptabs_0")//.empty().html("<table style='height: 618px;'></table>") 1407 .html(DataLayer.render(BASE_PATH + 'api/templates/messagegrid.ejs', {})) 1408 .find("#message_attacher_grid") 1409 .jqGrid({ 1410 url:BASE_PATH + 'REST.php?q=folder/INBOX/message', 1411 datatype: "json", 1412 mtype: 'GET', 1413 colNames:['#',' ', 'De', 'Assunto', 'Data', 'Tamanho'], 1414 colModel:[ 1415 {name:'msg_number',index:'msg_number', width:"10%", hidden:true, sortable:false}, 1416 {name:'flags',index:'msg_number',edittype: 'image', width:"10%", sortable:false, formatter:pflags2Class, title :false}, 1417 {name:'from.name',index:'msg_number', width:"25%", sortable:false, formatter:pNormaliseFrom}, 1418 {name:'subject',index:'subject', width:"60%", sortable:false,formatter:pNormaliseSubject}, 1419 {name:'timestamp',index:'timestamp', width:"10%", align:"center", sortable:false, formatter:pdate2Time}, 1420 {name:'size',index:'size', width:"10%", align:"center", sortable:false, formatter:pbytes2Size} 1421 ], 1422 jsonReader : { 1423 root:"rows", 1424 page: "page", 1425 total: "total", 1426 records: "records", 1427 repeatitems: false, 1428 id: "0" 1429 }, 1430 rowNum:50, 1431 rowList:[10,25,50], 1432 pager: '#message_attacher_grid_pager', 1433 //sortname: 'id', 1434 //viewrecords: true, 1435 //sortorder: "desc", 1436 multiselect: true, 1437 autowidth: true, 1438 height : '600px', 1439 //shrinkToFit: false, 1440 //width: 1300, 1441 //toppager : true, 1442 loadComplete: function(data) { 1443 var lastLoadedMessages = data.rows; 1444 1445 // aplica o contador 1446 jQuery('.timable').each(function (i) { 1447 jQuery(this).countdown({ 1448 since: new Date(parseInt(this.title)), 1449 significant: 1, 1450 layout: 'há {d<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl}{s>}', 1451 description: ' atrás' 1452 }); 1453 }); 1454 /* 1455 // reconstrói a seleção das mensagens mesmo depois da mudança de pasta 1456 if (selectedMessages[selectedFolder.id]) { 1457 for (var message in selectedMessages[selectedFolder.id]){ 1458 for (var j=0; j<data.rows.length; j++){ 1459 if (selectedMessages[selectedFolder.id][message] && message == data.rows[j].msg_number) { 1460 jQuery("#message_attacher_grid").setSelection(jQuery("#message_attacher_grid").getDataIDs()[j], false); 1461 } 1462 } 1463 } 1464 }*/ 1465 $('#cb_message_attacher_grid').css('display', 'none'); 1466 1467 } 1468 }); 1469 //$("#ptabs").find(".ui-tabs-nav li:first").addClass("ui-state-disabled"); 1470 //$("#ptabs").find(".ui-tabs-nav").sortable({ axis: "x",cancel: ".ui-state-disabled" }); 1471 $("#selected_messages_counter").remove(); 1405 1472 var scripts = new Array("InfoContact", 1406 1473 "TreeShow"); … … 1417 1484 ruler_element.className = "table_message_ruler"; 1418 1485 ruler_element.style.top = getColumnPosition(document.getElementById("content_id_0"),"BODY")[1]; 1419 document.getElementById("exmail_main_body").appendChild(ruler_element); 1420 } 1421 1422 } 1423 1486 //document.getElementById("exmail_main_body").appendChild(ruler_element); 1487 } 1488 resizeWindow(); 1489 } 1490 punorphanize = function(root, element) { 1491 var ok = false; 1492 for (var i=0; i<root.length; i++) { 1493 if (root[i].id == element.parentFolder) { 1494 element.children = new Array(); 1495 root[i].children.push(element); 1496 return true; 1497 } else if (ok = unorphanize(root[i].children, element)) { 1498 break; 1499 } 1500 } 1501 1502 return ok; 1503 } 1504 1505 /* --- helpers --- */ 1506 pbytes2Size = function(bytes) { 1507 var sizes = ['B', 'KB', 'MB', 'GB', 'TB']; 1508 if (bytes == 0) return 'n/a'; 1509 var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); 1510 var size = (i<2) ? Math.round((bytes / Math.pow(1024, i))) : Math.round((bytes / Math.pow(1024, i)) * 100)/100; 1511 return size + ' ' + sizes[i]; 1512 } 1513 1514 pflags2Class = function(cellvalue, options, rowObject) { 1515 var classes = ''; 1516 cellvalue = cellvalue.split(','); 1517 cell = { 1518 Unseen: parseInt(cellvalue[0]) ? 'Unseen' : 'Seen', 1519 Answered: parseInt(cellvalue[1]) ? 'Answered' : (parseInt(cellvalue[2]) ? 'Forwarded' : ''), 1520 Flagged: parseInt(cellvalue[3]) ? 'Flagged' : '', 1521 Recent: parseInt(cellvalue[4]) ? 'Recent' : '', 1522 Draft: parseInt(cellvalue[5]) ? 'Draft' : '' 1523 }; 1524 for(var flag in cell){ 1525 classes += '<span class="flags '+ (cell[flag]).toLowerCase() + '"' + (cell[flag] != "" ? 'title="'+ get_lang(cell[flag])+'"' : '')+'> </span>'; 1526 } 1527 if(rowObject.labels){ 1528 var titles = []; 1529 var count = 0; 1530 for(i in rowObject.labels){ 1531 titles[count] = " "+rowObject.labels[i].name; 1532 count++; 1533 } 1534 titles = titles.join(); 1535 classes += '<span class="flags labeled" title="'+titles+'"> </span>'; 1536 }else{ 1537 classes += '<span class="flags"> </span>'; 1538 } 1539 1540 if(rowObject.followupflagged){ 1541 if(rowObject.followupflagged.followupflag.id < 7){ 1542 var nameFollowupflag = get_lang(rowObject.followupflagged.followupflag.name); 1543 }else{ 1544 var nameFollowupflag = rowObject.followupflagged.followupflag.name; 1545 } 1546 if(rowObject.followupflagged.isDone == 1){ 1547 classes += '<span class="flags followupflagged" title="'+nameFollowupflag+'" style="background:'+rowObject.followupflagged.backgroundColor+';"><img style=" margin-left:-3px;" src="../prototype/modules/mail/img/flagChecked.png"></span>'; 1548 }else{ 1549 classes += '<span class="flags followupflagged" title="'+nameFollowupflag+'" style="background:'+rowObject.followupflagged.backgroundColor+';"><img src="../prototype/modules/mail/img/flagEditor.png"></span>'; 1550 } 1551 1552 } 1553 1554 return classes; 1555 } 1556 1557 function numberMonths (months){ 1558 switch(months){ 1559 case 'Jan': 1560 return 1; 1561 case 'Feb': 1562 return 2; 1563 case 'Mar': 1564 return 3; 1565 case 'Apr': 1566 return 4; 1567 case 'May': 1568 return 5; 1569 case 'June': 1570 return 6; 1571 case 'July': 1572 return 7; 1573 case 'Aug': 1574 return 8; 1575 case 'Sept': 1576 return 9; 1577 case 'Oct': 1578 return 10; 1579 case 'Nov': 1580 return 11; 1581 case 'Dec': 1582 return 12; 1583 } 1584 } 1585 1586 pNormaliseFrom = function(cellvalue, options, rowObject) { 1587 rowObject['flags'] = rowObject['flags'].split(","); 1588 if(rowObject['flags'][rowObject['flags'].length-1] == 1){ 1589 return get_lang(special_folders["Drafts"]); 1590 } 1591 return cellvalue; 1592 } 1593 1594 pNormaliseSubject = function(cellvalue, options, rowObject) { 1595 return html_entities(cellvalue); 1596 } 1597 1598 pdate2Time = function (timestamp) { 1599 date = new Date(); 1600 dat = new Date(timestamp); 1601 if ((date.getTime() - timestamp) < (24*60*60*1000)) { 1602 return '<span class="timable" title="'+dat.getTime()+'"></span>'; 1603 } else { 1604 date = new Date(timestamp); 1605 if(is_ie){ 1606 var b = date.toString().split(' '); 1607 var c = b[2] + "/" + numberMonths(b[1]) + "/" + b[5]; 1608 return '<span class="datable">' + c + '</span>'; 1609 }else{ 1610 var b = date.toISOString().split("T")[0].split("-"); 1611 var c = b[2] + "/" + b[1] + "/" + b[0]; 1612 return '<span class="datable">' + c + '</span>'; 1613 } 1614 } 1615 } 1424 1616 function showEmptyBoxMsg(tbody_element) { 1425 1617 document.getElementById("table_message_header_box_"+numBox).emptyBody = true; … … 4187 4379 }); 4188 4380 } 4189 var ID = create_border("",border_ID); 4190 4191 if (ID == 0) 4381 //var ID = create_border("",border_ID); 4382 tab_content = DataLayer.render("../prototype/modules/mail/templates/new_message.ejs", {id: ID+1}); 4383 4384 ptabs.tabs("add", "#ptabs_"+(ID+1), "Nova Mensagem"); 4385 4386 4387 //ID = 5; 4388 var thisID = ID; 4389 if (thisID == 0) 4192 4390 return 0; 4193 else if( ID == 'maximo')4391 else if(thisID == 'maximo') 4194 4392 return 'maximo'; 4195 4393 … … 4199 4397 $("#footer_menu").css('display','none'); 4200 4398 } 4201 var content = $("# content_id_"+ID).html(DataLayer.render("../prototype/modules/mail/templates/new_message.ejs", {id:ID}));4202 RichTextEditor.loadEditor2( ID);4399 var content = $("#ptabs_"+thisID).html(DataLayer.render("../prototype/modules/mail/templates/new_message.ejs", {id: thisID})); 4400 RichTextEditor.loadEditor2(thisID); 4203 4401 4204 4402 //if(!expresso_offline) … … 4228 4426 if(!field.find("textarea").hasClass("track")){ 4229 4427 field.find("textarea").css({"max-height" : "115px", "overflow-y" : "auto"}).addClass("track"); 4230 input_binds(field.find(".email-area"), ID);4428 input_binds(field.find(".email-area"), thisID); 4231 4429 } 4232 4430 } 4233 4431 4234 input_binds(content.find('[name="input_aux_to"]').css("max-width" , parseInt(content.find(".email-area").css("width"))-5).focus().parent().css({"max-height" : "115px", "overflow-y" : "auto"}), ID);4432 input_binds(content.find('[name="input_aux_to"]').css("max-width" , parseInt(content.find(".email-area").css("width"))-5).focus().parent().css({"max-height" : "115px", "overflow-y" : "auto"}), thisID); 4235 4433 4236 4434 //Botão TextoRico/TextoSimples 4237 4435 content.find(".new-msg-head-right-buttons").find(".button").button().filter(".rich-button").click(function(){ 4238 /*Se o texto do botão for "Texto simples" exibirá a mensagem antes de alterar para texto simples*/ 4239 if($(".rich-button").find("span").text() == get_lang("Simple Text")){ 4240 $.Zebra_Dialog(get_lang("Convert this message into plain text can make parts of it are removed. Continue?"), { 4241 'type': 'warning', 4242 'overlay_opacity': '0.5', 4243 'buttons': ['OK','Cancelar'], 4244 'width' : 380, 4245 'onClose': function(clicked) { 4246 if(clicked == 'OK'){ 4247 RichTextEditor.setPlain(check_input(content.find('[name="textplain_rt_checkbox"]')), ID); 4248 $(".rich-button").find("span").text(get_lang("Rich Text")); 4249 } 4250 } 4251 }) 4252 } 4253 /*Se o texto do botão for "Texto rico" simplesmente altera para texto rico*/ 4254 else{ 4255 RichTextEditor.setPlain(check_input(content.find('[name="textplain_rt_checkbox"]')), ID); 4256 $(".rich-button").find("span").text(get_lang("Simple Text")); 4257 } 4436 //RichTextEditor.loadEditor2(ID); 4437 RichTextEditor.setPlain(check_input(content.find('[name="textplain_rt_checkbox"]')), thisID); 4438 change_text($(this).find(".ui-button-text"), get_lang("Rich Text"), get_lang("Simple Text")); 4258 4439 }) 4259 4440 … … 4275 4456 } 4276 4457 }).click(function(){ 4277 send_message( ID,preferences.save_in_folder,null);4458 send_message(thisID,preferences.save_in_folder,null); 4278 4459 }) 4279 4460 //BOTAO SALVAR E ENVIAR … … 4283 4464 } 4284 4465 }).click(function(){ 4285 wfolders.makeWindow( ID,"send_and_file");4466 wfolders.makeWindow(thisID,"send_and_file"); 4286 4467 }) 4287 4468 //BOTAO SALVAR … … 4291 4472 } 4292 4473 }).click(function(){ 4293 save_msg( ID);4474 save_msg(thisID); 4294 4475 }) 4295 4476 //BOTAO CONF. LEITURA … … 4330 4511 }); 4331 4512 4332 content.find(".attachment td").filter(".value").prepend(DataLayer.render("../prototype/modules/mail/templates/attachment.ejs", {ID: ID}));4333 var fileUploadMSG = $('#fileupload_msg'+ ID);4513 content.find(".attachment td").filter(".value").prepend(DataLayer.render("../prototype/modules/mail/templates/attachment.ejs", {ID:thisID})); 4514 var fileUploadMSG = $('#fileupload_msg'+thisID); 4334 4515 var maxAttachmentSize = (preferences.max_attachment_size !== "" && preferences.max_attachment_size != 0) ? (parseInt(preferences.max_attachment_size.replace('M', '')) * 1048576 ) : false; 4335 4516 … … 4361 4542 if(!maxAttachmentSize || data.files[0].size < maxAttachmentSize || is_ie) { 4362 4543 setTimeout(function() { 4363 $('#attDisposition'+ ID).val('attachment');4544 $('#attDisposition'+thisID).val('attachment'); 4364 4545 data.submit(); 4365 4546 }, 3000); … … 4384 4565 var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 4385 4566 fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); 4386 delAttachment( ID, idAttach)4567 delAttachment(thisID, idAttach) 4387 4568 $(this).parent().remove(); 4388 4569 }); … … 4406 4587 { 4407 4588 fileUploadMSG.find('.in-progress:first').parents('p').append('<input type="hidden" name="fileId[]" value="'+newAttach['mailAttachment'][0][0].id+'"/>').find('.status-upload').addClass('ui-icon ui-icon-check'); 4408 addAttachment( ID,newAttach['mailAttachment'][0][0].id);4589 addAttachment(thisID,newAttach['mailAttachment'][0][0].id); 4409 4590 } 4410 4591 else … … 4452 4633 att.name = Base64.encode(onceOpenedMessages[folder_name][message_number].subject + '.eml'); 4453 4634 var idATT = JSON.stringify(att); 4454 addAttachment( ID , idATT);4635 addAttachment( thisID , idATT); 4455 4636 var attach = {}; 4456 4637 attach.fileName = onceOpenedMessages[folder_name][message_number].subject + '.eml'; … … 4472 4653 var idAttach = $(this).parents("li:first").find('input[name="fileId[]"]').val(); 4473 4654 fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]'); 4474 delAttachment( ID,idAttach);4655 delAttachment(thisID,idAttach); 4475 4656 $(this).parent().remove(); 4476 4657 }); … … 4489 4670 }); 4490 4671 }); 4491 return ID;4672 return thisID; 4492 4673 } 4493 4674 -
sandbox/novoExpressoMail/expressoMail1_2/js/main.js
r6673 r6711 2 2 var time_refresh = 300000; 3 3 // tempo do auto save (em milisegundos) 4 // 20000 = 20 segundos 4 // 20000 = 20 segundosfun 5 5 var autosave_time = 40000; 6 6 var results_search_messages = ""; … … 8 8 // Variavel para controle de atualização das mensagens listadas na modal de alerta de filtro por remetente 9 9 var checkAlarmsFilter = false; 10 10 var ptabs; 11 11 var dynamicPersonalContacts = new Array(); 12 12 var dynamicContacts = new Array(); 13 13 var topContact = 0; 14 var tab_content = ""; 14 15 DataLayer.get("folder", true); 15 16 … … 116 117 cExecute ("$this.imap_functions.automatic_trash_cleanness&before_date="+preferences.delete_trash_messages_after_n_days+"&cyrus_delimiter="+cyrus_delimiter, handler_automatic_trash_cleanness); 117 118 119 ptabs = $("#ptabs").tabs({ 120 tabTemplate: "<li><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close'>Remove Tab</span></li>", 121 add: function( event, ui ) { 122 //var tab_content = $tab_content_input.val() || "Tab " + tab_counter + " content."; 123 ID++; 124 ptabs.tabs('select', '#' + ui.panel.id); 125 $( ui.panel ).html(tab_content); 126 } 127 }); 128 118 129 //if(preferences.outoffice == "1") 119 130 // … … 129 140 loadApplet(); 130 141 } 131 // Fim da inserção da applet132 DataLayer.get("folder", true);133 cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu);134 142 135 143 if($.cookie('collapse_folders') == "true"){ … … 139 147 $("#folderscol").hide(); 140 148 $(".collapse_folders").addClass("ui-icon ui-icon-triangle-1-e").children().attr('title', "Expandir"); 141 refresh();142 resizeWindow();149 //refresh(); 150 //resizeWindow(); 143 151 } 144 152 else{ 145 153 $(".collapse_folders").addClass("ui-icon ui-icon-triangle-1-w").children().attr('title', "Ocultar"); 146 refresh();147 resizeWindow();154 //refresh(); 155 //resizeWindow(); 148 156 } 149 157 … … 159 167 $(".collapse_folders").parent().attr('title', "Expandir"); 160 168 $.cookie('collapse_folders', "true"); 161 refresh();162 resizeWindow();169 //refresh(); 170 //resizeWindow(); 163 171 }else{ 164 172 if(!is_ie) … … 170 178 $(".collapse_folders").parent().attr('title', "Ocultar"); 171 179 $.cookie('collapse_folders', "false"); 172 refresh();173 resizeWindow();174 } 175 resizeWindow();180 //refresh(); 181 //resizeWindow(); 182 } 183 //resizeWindow(); 176 184 177 185 }).hover( … … 2080 2088 txtarea.css("height",height); 2081 2089 $("#border_id_" + new_border_ID).attr("title", title); 2082 set_border_caption("border_id_" + new_border_ID, title);2090 //set_border_caption("border_id_" + new_border_ID, title); 2083 2091 resizeWindow(); 2084 2092 return new_border_ID; //Preciso retornar o ID da nova mensagem. … … 2092 2100 }); 2093 2101 } 2102 2103 $( "#ptabs span.ui-icon-close" ).live( "click", function() { 2104 var index = $( "li", ptabs ).index( $( this ).parent() ); 2105 ptabs.tabs( "remove", index ); 2106 }); 2094 2107 2095 2108 //Remove o email do usuario ao responder a todos … … 2319 2332 } 2320 2333 2321 function send_message_return(data, ID){2334 function send_message_return(data, aID){ 2322 2335 2323 2336 if (typeof(data) == 'object' && data.load){ 2324 2337 cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu); 2325 2338 } 2326 watch_changes_in_msg( ID);2327 2328 var content = $("#content_id_"+ ID);2339 watch_changes_in_msg(aID); 2340 2341 var content = $("#content_id_"+aID); 2329 2342 var sign = false; 2330 2343 var crypt = false; 2331 2344 var reComplexEmail = /<([^<]*)>[\s]*$/; 2332 2345 if ((preferences.use_assinar_criptografar != '0') && (preferences.use_signature_digital_cripto != '0')){ 2333 var checkSign = document.getElementById('return_digital_'+ ID)2346 var checkSign = document.getElementById('return_digital_'+aID) 2334 2347 if (checkSign.checked){ 2335 2348 sign = true; 2336 2349 } 2337 2350 2338 var checkCript = document.getElementById('return_cripto_'+ ID);2351 var checkCript = document.getElementById('return_cripto_'+aID); 2339 2352 if (checkCript.checked){ 2340 2353 crypt = true; … … 2407 2420 var dynamicContactList = new Array(); 2408 2421 2422 2423 delete_border(ID,'true'); 2409 2424 */ 2410 delete_border(ID,'true'); 2425 var index = $( "li", ptabs ).index( $("#ptabs_"+aID) ); 2426 ptabs.tabs("remove", index); 2411 2427 var arrayTo = content.find(".to-tr").find(".box").clone(); 2412 2428 save_dynamic_contacts(arrayTo); … … 2589 2605 if (preferences.auto_save_draft == 1) 2590 2606 autoSaveControl.status[ID] = true; 2591 var content = $("# content_id_"+ID);2592 var save_link = $("# content_id_"+ID).find(".save");2607 var content = $("#ptabs_"+ID); 2608 var save_link = $("#ptabs_"+ID).find(".save"); 2593 2609 var onClick = save_link.onclick; 2594 2610 save_link.onclick = ''; … … 2619 2635 input_type.name = "type"; 2620 2636 input_type.value = RichTextEditor.plain[ID] ? 'plain' : 'html'; 2621 2637 /* 2622 2638 var uids = document.createElement("INPUT"); 2623 2639 uids.style.display='none'; 2624 2640 uids.name = "uids_save"; 2625 2641 uids.value = uidsSave[ID].toString(); 2626 2642 */ 2627 2643 var save_folder = document.createElement("INPUT"); 2628 2644 save_folder.style.display='none'; 2629 2645 save_folder.name = "save_folder"; 2630 2646 save_folder.value = (openTab.imapBox[ID] && openTab.type[ID] < 6) ? openTab.imapBox[ID]: "INBOX" + cyrus_delimiter + draftsfolder; 2631 2647 /* 2632 2648 var msg_attachments = document.createElement("INPUT"); 2633 2649 msg_attachments.style.display='none'; 2634 2650 msg_attachments.name = "attachments"; 2635 2651 msg_attachments.value = listAttachment(ID); 2636 2652 */ 2637 2653 if (is_ie){ 2638 2654 var i = 0; … … 2667 2683 form.appendChild(msgId); 2668 2684 form.appendChild(save_folder); 2685 /* 2669 2686 form.appendChild(uids); 2670 2687 form.appendChild(msg_attachments); 2671 2688 */ 2672 2689 var mail_type = document.createElement('input'); 2673 2690 mail_type.setAttribute('type', 'hidden'); -
sandbox/novoExpressoMail/expressoMail1_2/templates/default/index.tpl
r6487 r6711 98 98 </td> 99 99 <td width="100%" valign="top" align="left"> 100 <div id="exmail_main_body" class="messagescol"> 101 <table id="border_table" width="auto" height="26" cellspacing="0" cellpadding="0" border="0"> 102 <tbody id="border_tbody"> 103 <tr id="border_tr"> 104 <td nowrap class="menu" onClick="alternate_border(0);resizeWindow();" id="border_id_0"> 105 {lang_inbox} <font face="Verdana" size="1" color="#505050">[ 106 <span id="new_m">0</span> / 107 <span id="tot_m">0</span>] 108 </font> 109 </td> 110 <td nowrap id="border_blank" class="last_menu" width="100%"> </td> 100 <div id="ptabs"> 101 <ul> 102 <li> 103 <a href="#ptabs_0"> {lang_inbox} <font face="Verdana" size="1" color="#505050"> 104 [<span id="new_m">0</span> / <span id="tot_m">0</span>]</font> 105 </a> 106 </li> 107 </ul> 108 <div id="ptabs_0"> 109 <table class="fuu" id="message_attacher_grid"> 110 <tr> 111 <td/> 111 112 </tr> 112 </t body>113 </table>114 < div id="content_id_0" class="conteudo"></div>115 <div id="footer_menu"> 113 </table> 114 <div id="message_attacher_grid_pager"></div> 115 </div> 116 <div id="footer_menu"> 116 117 <table style="border-top:0px solid black" id="footer_box" cellpadding=0 cellspacing=0 border=0 width="100%" height="10px"> 117 118 <tbody> -
sandbox/novoExpressoMail/expressoMail1_2/templates/default/main.css
r6680 r6711 1390 1390 border-color : red; 1391 1391 } 1392 1393 .ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a{ 1394 font-size: 10px; 1395 } 1396 1397 .ui-tabs .ui-tabs-nav li a:hover, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a:hover{ 1398 text-decoration: none !important; 1399 } 1400 1401 .ui-tabs .ui-tabs-panel{ 1402 width: 99.7%; 1403 margin-top: 2px !important; 1404 }
Note: See TracChangeset
for help on using the changeset viewer.