var BASE_PATH = '../prototype/'; $(document).ready(function() { Layout = $('#wrap').layout({ applyDefaultStyles: true, north__size: 'auto', north__closable: false, north__resizable: false, north__slidable: false, west__resizable: false, west__slidable: false, center__maxSize : 0 }); $tabs = $("#tabs").wijtabs({ tabTemplate: "
  • #{label}Fechar Aba
  • ", panelTemplate: "
    ", add: function( event, ui ) { $tabs.wijtabs('select', '#' + $tabs.find("div:last").attr("id")); $tabs.find("span.tab-close:last").hover(function(){$(this).toggleClass("ui-icon-circle-close ui-icon-close");}, function(){$(this).toggleClass("ui-icon-circle-close ui-icon-close");}) $tabs.find("div:last").addClass("conteudo").attr("role", tab_role).append(tab_content); }, show: function(event, ui){ switch($( ui.panel ).attr("role")){ case "new": case "search": $("#footer_menu").hide(); break; case "message": case "draft": case "folder": $("#footer_menu").show(); break; } }, select: function(event, ui) { lastIndexSelected = ui.index; }, scrollable: true, sortable: true, hideOption: { blind: true, fade: false, duration: 200 }, showOption: { blind: true, fade: false, duration: 200 } }); draw_new_tree_folder(); $(".new-message-button").button({ icons: { secondary : "ui-icon-plusthick" } }); var messages = DataLayer.get("message", {criteria : {folder: 'INBOX', rows: 999999}}); $('.button.config-menu').button({ icons: { primary: "ui-icon-gear", secondary: "ui-icon-triangle-1-s" }, text: false }); var menus = $(".main-menus-content").clone(); $(".main-menus-content").remove(); $(".this-module").button().next().button({ icons :{ primary: "ui-icon-triangle-1-s" }, text: false }).parent().buttonset(); $(".this-module").parent().append(menus); $('.this-module').next().menu({ content: $('.main-menus-content').html(), positionOpts: { posX: 'left', posY: 'bottom', offsetX: -140, offsetY: 0, directionH: 'right', directionV: 'down', detectH: true, // do horizontal collision detection detectV: true, // do vertical collision detection linkToFront: false }, flyOut: true, showSpeed: 100, crumbDefaultText: '>' }); $('.block-horizontal-toolbox .main-config-menu').menu({ content: $('.main-config-menu-content').html(), positionOpts: { posX: 'left', posY: 'bottom', offsetX: -140, offsetY: 0, directionH: 'right', directionV: 'down', detectH: true, // do horizontal collision detection detectV: true, // do vertical collision detection linkToFront: false }, flyOut: true, showSpeed: 100, crumbDefaultText: '>' }); Tab.setFolderName("Caixa de Entrada"); $(".folder-tab-total-msgs-number").html(messages.records); Tab.setFolderUnread($("#INBOX").find(".folder_unseen").html()); Grid = $("#imap-folder-table-messages").jqGrid({ url:BASE_PATH + 'REST.php?q=folder/INBOX/message', datatype: "json", colNames:['#',' ', 'De', 'Assunto', 'Data', 'Tamanho'], colModel:[ {name:'msg_number',index:'msg_number', width:45, hidden:true, sortable:false}, {name:'flags',index:'msg_number',edittype: 'image', width:60, formatter:flags2Class, sortable:false, title :false}, {name:'from.name',index:'SORTFROM', width:100, sortable:true, formatter:subjectFormatter}, {name:'subject',index:'SORTSUBJECT', width:245, sortable:true}, {name:'timestamp',index:'SORTARRIVAL', width:65, align:"center", sortable:true, formatter: date2Time}, {name:'size',index:'SORTSIZE', width:55, align:"center", sortable:true, formatter: bytes2Size} ], jsonReader : { root:"rows", page: "page", total: "total", records: "records", repeatitems: false, id: "0" }, rowNum:50, rowList:[10,25,50], pager: "#imap-folder-table-pager", sortorder: "desc", multiselect: true, autowidth: true, height : '85.5%', emptyrecords: 'A pasta nao contem nenhuma mensagem.', viewrecords: true, loadComplete: function(data) { lastLoadedMessages = data.rows; // aplica o contador $('.timable').each(function (i) { $(this).countdown({ since: new Date(parseInt(this.title)), significant: 1, layout: 'há {d<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl}{s>}', description: ' atrás' }); }); } }); Grid.jqGrid('bindKeys', {"onEnter":function( rowid ) { alert("You enter a row with id:"+rowid)} }); });