source: trunk/expressoMail1_2/js/doiMenuData.js @ 2

Revision 2, 6.6 KB checked in by niltonneto, 17 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1_icon_dir="templates/default/images/menu/";
2
3function 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 (
11                                                        "preferences_mail()|"+get_lang("Preferences")+"|preferences.gif",
12                                                        "search_emails()|"+get_lang("Search")+"|search.gif",
13                                                        "filterbox()|"+get_lang("Edit filters")+"|filters.gif",
14                                                        "folderbox()|"+get_lang("Edit folders")+"|editfolders.gif",
15                                                        "sharebox()|"+get_lang("Share mailbox")+"|editfolders.gif",
16                                                        "empty_trash_imap()|"+get_lang("Empty trash")+"|trash.gif"
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");
87                _td.innerHTML = "<img height=\"16px\" src=\"templates/default/images/menu/"+item[2]+"\">&nbsp;"+item[1]+"&nbsp;";
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
129function openListUsers(border_id) {
130        connector.loadScript("QuickCatalogSearch");
131        QuickCatalogSearch.showCatalogList(border_id);
132}
133
134function 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 = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
152                var _sep = "<hr>";
153                var optionsMenu = new Array(
154                        _tab + get_lang("Mark as")+"&nbsp;"+get_lang('seen')+'|'+"set_messages_flag('seen','get_selected_messages')",
155                        _tab + get_lang("Mark as")+"&nbsp;"+get_lang('unseen')+'|'+"set_messages_flag('unseen','get_selected_messages')",
156                        _tab + get_lang("Mark as")+"&nbsp;"+get_lang('important')+'|'+"set_messages_flag('flagged','get_selected_messages')",
157                        _tab + get_lang("Mark as")+"&nbsp;"+get_lang('normal')+'|'+"set_messages_flag('unflagged','get_selected_messages')",
158                        _sep,
159                        _tab + get_lang("Move to")+" ... |wfolders.makeWindow('', 'move_to')",
160                        _tab + get_lang("Delete")+"|"+"delete_msgs('null','selected','null')",
161                        _tab + get_lang("Export")+"|"+"export_all_selected_msgs()"
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 ='';
207}
Note: See TracBrowser for help on using the repository browser.