[790] | 1 | _icon_dir="templates/"+template+"/images/menu/"; |
---|
[2] | 2 | |
---|
| 3 | function ConstructMenuTools(){ |
---|
| 4 | // Layout padrão de menu = option1 |
---|
| 5 | var _divMenu = Element('menu_tools'); |
---|
| 6 | if(_divMenu) |
---|
| 7 | return; |
---|
| 8 | var _option1 = preferences.hide_folders == "1" ? false : true; |
---|
| 9 | |
---|
| 10 | var itens = new Array ( |
---|
[214] | 11 | "preferences_mail()|"+get_lang("Preferences")+"|preferences.png", |
---|
| 12 | "search_emails(\"\")|"+get_lang("Search")+"|search.png", |
---|
| 13 | "filterbox()|"+get_lang("Edit filters")+"|filters.png", |
---|
| 14 | "folderbox()|"+get_lang("Edit folders")+"|editfolders.png", |
---|
| 15 | "sharebox()|"+get_lang("Share mailbox")+"|usersfolders.png", |
---|
| 16 | "empty_trash_imap()|"+get_lang("Empty trash")+"|trash.png" |
---|
[2] | 17 | ); |
---|
| 18 | |
---|
| 19 | var _link = Element('link_tools'); |
---|
| 20 | _divMenu = document.createElement("DIV"); |
---|
| 21 | _divMenu.id = "menu_tools"; |
---|
| 22 | _divMenu.style.position = "absolute"; |
---|
| 23 | _divMenu.style.top = findPosY(_link) + (_option1 ? 19 : 14); |
---|
| 24 | _divMenu.style.left = findPosX(_link) + (_option1 ? 22 : 22); |
---|
| 25 | _divMenu.style.width = "auto"; |
---|
| 26 | _divMenu.style.height = "auto"; |
---|
| 27 | _divMenu.style.padding = "1px"; |
---|
| 28 | _divMenu.style.paddingTop = "0px"; |
---|
| 29 | _divMenu.style.zIndex = "10000"; |
---|
| 30 | _divMenu.style.backgroundColor = "WHITE"; |
---|
| 31 | _divMenu.style.border = "1px solid #999999"; |
---|
| 32 | _divMenu.style.borderTop = "0px solid #FFFFFF"; |
---|
| 33 | _divMenu.style.visibility = "hidden"; |
---|
| 34 | var _timeout = false; |
---|
| 35 | _hideMenuTools = function () { |
---|
| 36 | Element('menu_tools').style.visibility = "hidden"; |
---|
| 37 | }; |
---|
| 38 | _viewMenuTools = function () { |
---|
| 39 | Element('menu_tools').style.visibility = "visible"; |
---|
| 40 | }; |
---|
| 41 | |
---|
| 42 | var _mouseover = _link.onmouseover; |
---|
| 43 | |
---|
| 44 | _link.onmouseover = function () { |
---|
| 45 | var _option1 = preferences.hide_folders == "1" ? false : true; |
---|
| 46 | var _link = Element('link_tools'); |
---|
| 47 | Element('menu_tools').style.top = findPosY(_link) + (_option1 ? 19 : 14); |
---|
| 48 | if(_timeout) { |
---|
| 49 | clearTimeout(_timeout); |
---|
| 50 | _timeout=false; |
---|
| 51 | } |
---|
| 52 | if(_mouseover) |
---|
| 53 | _mouseover(); |
---|
| 54 | |
---|
| 55 | _timeout = setTimeout("_viewMenuTools();",500); |
---|
| 56 | }; |
---|
| 57 | |
---|
| 58 | _link.onmouseout = function () { |
---|
| 59 | if(_timeout) { |
---|
| 60 | clearTimeout(_timeout); |
---|
| 61 | _timeout=false; |
---|
| 62 | } |
---|
| 63 | if(_option1) |
---|
| 64 | unset_menu_bg(Element("link_tools")); |
---|
| 65 | _timeout = setTimeout("_hideMenuTools();",500); |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | var _t = document.createElement("TABLE"); |
---|
| 69 | _t.cellPadding="0"; |
---|
| 70 | _t.cellSpacing="0"; |
---|
| 71 | _t.onmouseover = function () { |
---|
| 72 | if(_timeout) { |
---|
| 73 | clearTimeout(_timeout); |
---|
| 74 | _timeout=false; |
---|
| 75 | } |
---|
| 76 | if(_mouseover) |
---|
| 77 | _mouseover(); |
---|
| 78 | |
---|
| 79 | Element('menu_tools').style.visibility = "visible"; |
---|
| 80 | }; |
---|
| 81 | var _tbody = document.createElement("TBODY"); |
---|
| 82 | |
---|
| 83 | var buildTr = function(value) { |
---|
| 84 | var item = value.split('|'); |
---|
| 85 | var _tr = document.createElement("TR"); |
---|
| 86 | var _td = document.createElement("TD"); |
---|
[790] | 87 | _td.innerHTML = "<img height=\"16px\" src=\"templates/"+template+"/images/menu/"+item[2]+"\"> "+item[1]+" "; |
---|
[2] | 88 | _td.style.color = "DARKBLUE"; |
---|
| 89 | _td.style.cursor = "pointer"; |
---|
| 90 | if(_option1) |
---|
| 91 | _td.style.border = '1px solid #f7f7f7'; |
---|
| 92 | _td.onclick = function() { Element('menu_tools').style.visibility='hidden';eval(item[0]);}; |
---|
| 93 | _td.onmouseover = function () { |
---|
| 94 | if(_timeout) { |
---|
| 95 | clearTimeout(_timeout); |
---|
| 96 | timeout=false; |
---|
| 97 | } |
---|
| 98 | |
---|
| 99 | if(_option1) |
---|
| 100 | set_menu_bg(this); |
---|
| 101 | else { |
---|
| 102 | this.style.textDecoration="underline"; |
---|
| 103 | this.style.color = 'DARKORANGE'; |
---|
| 104 | } |
---|
| 105 | }; |
---|
| 106 | _td.onmouseout = function () { |
---|
| 107 | _timeout = setTimeout("_hideMenuTools();",500); |
---|
| 108 | if(_option1){ |
---|
| 109 | unset_menu_bg(this); |
---|
| 110 | unset_menu_bg(Element("link_tools")); |
---|
| 111 | }else { |
---|
| 112 | this.style.backgroundColor = 'WHITE'; |
---|
| 113 | this.style.textDecoration="none"; |
---|
| 114 | this.style.color = 'DARKBLUE'; |
---|
| 115 | } |
---|
| 116 | }; |
---|
| 117 | _tr.appendChild(_td); |
---|
| 118 | return _tr; |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | for(i = 0; i < itens.length; i++) |
---|
| 122 | _tbody.appendChild(buildTr(itens[i])); |
---|
| 123 | |
---|
| 124 | _t.appendChild(_tbody); |
---|
| 125 | _divMenu.appendChild(_t); |
---|
| 126 | document.body.appendChild(_divMenu); |
---|
| 127 | } |
---|
| 128 | |
---|
| 129 | function openListUsers(border_id) { |
---|
| 130 | connector.loadScript("QuickCatalogSearch"); |
---|
| 131 | QuickCatalogSearch.showCatalogList(border_id); |
---|
| 132 | } |
---|
| 133 | |
---|
| 134 | function ConstructRightMenu(_event){ |
---|
| 135 | |
---|
| 136 | var div = Element("div_rightbutton"); |
---|
| 137 | if(!div){ |
---|
| 138 | div = document.createElement("DIV"); |
---|
| 139 | div.style.position = 'absolute'; |
---|
| 140 | div.style.zIndex = '15'; |
---|
| 141 | |
---|
| 142 | div.style.border = '1px outset BLACK'; |
---|
| 143 | div.style.background = "#EEEEE6"; |
---|
| 144 | div.id = 'div_rightbutton'; |
---|
| 145 | div.style.padding = "1px"; |
---|
| 146 | div.style.fontSize = is_ie || is_gecko1_5 || is_win ? "9pt" : "11pt"; |
---|
| 147 | div.style.width = "190px"; |
---|
| 148 | div.style.height = is_win && !is_ie ? "129px" : "139px"; |
---|
| 149 | div.style.display ='none'; |
---|
| 150 | document.body.appendChild(div); |
---|
| 151 | var _tab = " "; |
---|
| 152 | var _sep = "<hr>"; |
---|
| 153 | var optionsMenu = new Array( |
---|
[689] | 154 | _tab + get_lang("Mark as")+" "+get_lang('seen')+'|'+"proxy_mensagens.proxy_set_messages_flag('seen','get_selected_messages')", |
---|
| 155 | _tab + get_lang("Mark as")+" "+get_lang('unseen')+'|'+"proxy_mensagens.proxy_set_messages_flag('unseen','get_selected_messages')", |
---|
| 156 | _tab + get_lang("Mark as")+" "+get_lang('important')+'|'+"proxy_mensagens.proxy_set_messages_flag('flagged','get_selected_messages')", |
---|
| 157 | _tab + get_lang("Mark as")+" "+get_lang('normal')+'|'+"proxy_mensagens.proxy_set_messages_flag('unflagged','get_selected_messages')", |
---|
[2] | 158 | _sep, |
---|
| 159 | _tab + get_lang("Move to")+" ... |wfolders.makeWindow('', 'move_to')", |
---|
[689] | 160 | _tab + get_lang("Delete")+"|"+"proxy_mensagens.delete_msgs('null','selected','null')", |
---|
[1000] | 161 | _tab + get_lang("Export")+"|"+"proxy_mensagens.export_all_messages()" |
---|
[2] | 162 | ); |
---|
| 163 | |
---|
| 164 | for(i = 0; i < optionsMenu.length; i++){ |
---|
| 165 | optionsMenu_l = optionsMenu[i].split('|'); |
---|
| 166 | var div_l = document.createElement("DIV"); |
---|
| 167 | div_l.style.padding = "1px"; |
---|
| 168 | div_l.style.width = "188px"; |
---|
| 169 | div_l.style.cursor = 'pointer'; |
---|
| 170 | div_l.innerHTML = optionsMenu_l[0]; |
---|
| 171 | div_l.style.valign = 'top'; |
---|
| 172 | if(optionsMenu_l[0] != _sep) { |
---|
| 173 | var attr = document.createAttribute('javascript'); |
---|
| 174 | attr.value = optionsMenu_l[1]+";Element('div_rightbutton').style.display = 'none';"; |
---|
| 175 | div_l.setAttributeNode(attr); |
---|
| 176 | div_l.oncontextmenu = function(e) { return false;}; |
---|
| 177 | div_l.onclick = function () {this.onmouseout();eval(this.getAttribute('javascript'));}; |
---|
| 178 | div_l.onmouseover = function () {this.style.color = 'WHITE';this.style.background = "#4a79cd";}; |
---|
| 179 | div_l.onmouseout = function () {this.style.color = 'BLACK';this.style.background = "#EEEEE6";}; |
---|
| 180 | } |
---|
| 181 | else |
---|
| 182 | div_l.style.height = "11px"; |
---|
| 183 | |
---|
| 184 | div_l.id="link_rightbutton_"+i; |
---|
| 185 | div.appendChild(div_l); |
---|
| 186 | } |
---|
| 187 | |
---|
| 188 | } |
---|
| 189 | |
---|
| 190 | var x = _event.clientX + document.body.scrollLeft + 2; |
---|
| 191 | var y = _event.clientY + document.body.scrollTop + 2; |
---|
| 192 | |
---|
| 193 | var w_width = is_ie ? document.body.clientWidth : window.innerWidth; |
---|
| 194 | var w_height = is_ie ? document.body.clientHeight + document.body.scrollTop : window.innerHeight + window.pageYOffset; |
---|
| 195 | |
---|
| 196 | if(x + 218 > w_width) |
---|
| 197 | div.style.left = w_width - (is_ie ? 198 : 218); |
---|
| 198 | else |
---|
| 199 | div.style.left = x; |
---|
| 200 | |
---|
| 201 | if(y + 131 > w_height) |
---|
| 202 | div.style.top = w_height - (is_ie ? 125 : 131); |
---|
| 203 | else |
---|
| 204 | div.style.top = y; |
---|
| 205 | |
---|
| 206 | div.style.display =''; |
---|
[320] | 207 | } |
---|
| 208 | |
---|
| 209 | function ConstructBoxMenu(_event,boxName,boxFolder){ |
---|
| 210 | |
---|
| 211 | var div = Element("div_rightbutton_folder"); |
---|
| 212 | if (div) |
---|
| 213 | div.parentNode.removeChild(div); |
---|
| 214 | |
---|
| 215 | div = document.createElement("DIV"); |
---|
| 216 | div.style.position = 'absolute'; |
---|
| 217 | div.style.zIndex = '15'; |
---|
| 218 | |
---|
| 219 | div.style.border = '1px outset BLACK'; |
---|
| 220 | div.style.background = "#EEEEE6"; |
---|
| 221 | div.id = 'div_rightbutton_folder'; |
---|
| 222 | div.style.padding = "1px"; |
---|
| 223 | div.style.fontSize = is_ie || is_gecko1_5 || is_win ? "9pt" : "11pt"; |
---|
| 224 | div.style.width = "190px"; |
---|
| 225 | div.style.height = is_win && !is_ie ? "35px" : "33px"; |
---|
| 226 | div.style.display ='none'; |
---|
| 227 | document.body.appendChild(div); |
---|
| 228 | var _tab = " "; |
---|
| 229 | var _sep = "<hr>"; |
---|
| 230 | var optionsMenu = new Array( |
---|
| 231 | _tab + get_lang("Open in new tab")+'|'+"open_folder('"+boxFolder+"', '"+boxName+"')", |
---|
| 232 | _tab + get_lang("Edit folders")+'|'+"folderbox()" |
---|
| 233 | ); |
---|
| 234 | |
---|
| 235 | for(i = 0; i < optionsMenu.length; i++){ |
---|
| 236 | optionsMenu_l = optionsMenu[i].split('|'); |
---|
| 237 | var div_l = document.createElement("DIV"); |
---|
| 238 | div_l.style.padding = "1px"; |
---|
| 239 | div_l.style.width = "188px"; |
---|
| 240 | div_l.style.cursor = 'pointer'; |
---|
| 241 | div_l.innerHTML = optionsMenu_l[0]; |
---|
| 242 | div_l.style.valign = 'top'; |
---|
| 243 | if(optionsMenu_l[0] != _sep) { |
---|
| 244 | var attr = document.createAttribute('javascript'); |
---|
| 245 | attr.value = optionsMenu_l[1]+";Element('div_rightbutton_folder').style.display = 'none';"; |
---|
| 246 | div_l.setAttributeNode(attr); |
---|
| 247 | div_l.oncontextmenu = function(e) { return false;}; |
---|
| 248 | div_l.onclick = function () {this.onmouseout();eval(this.getAttribute('javascript'));}; |
---|
| 249 | div_l.onmouseover = function () {this.style.color = 'WHITE';this.style.background = "#4a79cd";}; |
---|
| 250 | div_l.onmouseout = function () {this.style.color = 'BLACK';this.style.background = "#EEEEE6";}; |
---|
| 251 | } |
---|
| 252 | else |
---|
| 253 | div_l.style.height = "11px"; |
---|
| 254 | |
---|
| 255 | div_l.id="link_rightbutton_folder"+i; |
---|
| 256 | div.appendChild(div_l); |
---|
| 257 | } |
---|
| 258 | |
---|
| 259 | var x = _event.clientX + document.body.scrollLeft + 2; |
---|
| 260 | var y = _event.clientY + document.body.scrollTop + 2; |
---|
| 261 | |
---|
| 262 | var w_width = is_ie ? document.body.clientWidth : window.innerWidth; |
---|
| 263 | var w_height = is_ie ? document.body.clientHeight + document.body.scrollTop : window.innerHeight + window.pageYOffset; |
---|
| 264 | |
---|
| 265 | if(x + 218 > w_width) |
---|
| 266 | div.style.left = w_width - (is_ie ? 198 : 218); |
---|
| 267 | else |
---|
| 268 | div.style.left = x; |
---|
| 269 | |
---|
| 270 | if(y + 131 > w_height) |
---|
| 271 | div.style.top = w_height - (is_ie ? 125 : 131); |
---|
| 272 | else |
---|
| 273 | div.style.top = y; |
---|
| 274 | |
---|
| 275 | div.style.display =''; |
---|
[689] | 276 | } |
---|