source: trunk/expressoMail1_2/js/filters.js @ 197

Revision 197, 7.1 KB checked in by niltonneto, 16 years ago (diff)

Ticket #147: Revisão da internacionalização
Ticket #152: Melhoria no Fora de Escritório
Implementação da funcao write_msg com a opção de não apagar aviso.
Implementação da funcao clean_msg para limpar aviso.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1        function cfilterSh(){
2                this.filter_Sh   = new Array;
3                this.qvfaf               = "";
4               
5                // Images
6                this.grp_open_img = new Image();
7                this.grp_open_img.src = 'templates/default/images/filtro/group_open.gif';
8                this.grp_close_img = new Image();
9                this.grp_close_img.src = 'templates/default/images/filtro/group_close.gif';
10                this.filter_img = new Image();
11                this.filter_img.src = 'templates/default/images/filtro/filters.gif';
12                this.for_email_img = new Image();
13                this.for_email_img.src = 'templates/default/images/filtro/answered.gif';
14        }               
15
16        cfilterSh.prototype.Forms = function(){
17       
18                var form = document.createElement("DIV");
19                form.id  = "window_ffilter_ccform";
20                form.style.visibility = "hidden";
21                form.style.position = "absolute";
22                form.style.left = "0px";
23                form.style.top  = "0px";
24                form.style.width = "0px";
25                form.style.height = "0px";
26                document.body.appendChild(form);
27
28                var form_cont = document.createElement("SPAN");
29                form_cont.id = "form_status";
30                form_cont.style.display = "";                   
31                form_cont.style.position = "absolute";
32                form_cont.style.top = "10px";
33                form_cont.style.left = "600px";
34                form_cont.innerHTML = "";
35                form.appendChild(form_cont);
36               
37                var form_buttons = document.createElement("DIV");
38                form_buttons.id = "form_buttons";
39                form_buttons.style.position = "absolute";
40                form_buttons.style.display = "";
41                form_buttons.style.top = "320px";
42                form_buttons.style.left = "5px";
43                form_buttons.style.width = "655px";
44                form_buttons.innerHTML = "<input type='button' value="+get_lang("Enable")+" onclick='filter.enabled_disabled(\"ENABLED\");'>"+
45                                                                 "&nbsp;<input type='button' value="+get_lang("Disable")+" onclick='filter.enabled_disabled(\"DISABLED\");'>"+ 
46                                                                 "&nbsp;<input type='button' value="+get_lang("Remove")+" onclick='filter.delete_r();'>"+
47                                                                 "&nbsp;<input type='button' value="+get_lang("Close")+" onclick='filter.close_frm();'>";
48
49                form.appendChild(form_buttons);
50               
51                var form_body = document.createElement("DIV");
52                form_body.id = "form_body";
53                form_body.style.position = "absolute";
54                form_body.style.left = "5px";
55                form_body.style.top = "5px";
56                form_body.style.width = "668px";
57                form_body.style.height = "310px";
58                form_body.style.borderStyle = "outset";
59                form_body.style.borderColor = "black";
60                form_body.style.borderWidth = "1px";
61                form_body.style.overflow = "auto";
62                form.appendChild(form_body);   
63
64                this.showWindow(form);
65                filter.load_rules();
66                this.list_rules();                     
67       
68        }
69
70        cfilterSh.prototype.list_rules = function(){
71                if(filter.rulest.length == 0)
72                        setTimeout("filters.mount_list()",2500);
73                else
74                        this.mount_list();
75        }
76
77        cfilterSh.prototype.mount_list = function(){
78
79                Element('form_status').innerHTML = "";
80                var list = "";
81                // rules
82                if(filter.rulest.length == 0){
83                        list = "<img id='set_rules_img' src='"+this.grp_close_img.src+"' border='0'>&nbsp;<span><b>"+get_lang('list of the filters') + " - ( " + filter.rulest.length + " ) </b></span> - " + "<a href='javascript:filters.n_rule()'>" + get_lang("new rule") + "</a>";         
84                }else{
85                        list = "<img id='set_rules_img' src='"+this.grp_open_img.src+"' onclick=filters.hidden(\"set_rules\") border='0'>&nbsp;<span><b>"+get_lang('list of the filters') + " - ( " + filter.rulest.length + " ) </b></span> - " + "<a href='javascript:filters.n_rule()'>" + get_lang("new rule") + "</a>";
86                        list += "<div id='set_rules'>";
87                        for(var i=0; i < filter.rulest.length; i++){
88                                list += "<input id=rule_"+i+" type='checkBox'>&nbsp;<img src='"+this.filter_img.src+"' width='16' height='16' border='0'>&nbsp;" + get_lang("Rule")+" : " + parseInt(i+1) + " -- " + this.vl_rule(filter.rulest[i],i) + "<br>";
89                        }
90                }
91                list += "</div><br>";
92                // out office
93                if(!filter.out_officeR){
94                        list += "<img id='set_out_img' src='"+this.grp_close_img.src+"' border='0'>&nbsp;";
95                        list += "<span><b>"+get_lang('out office') + " - ( 0 ) </b></span> " + "<a href='javascript:filters.n_out_office()'>" + get_lang("new rule") + "</a>";                 
96                }else{
97                        list += "<img id='set_out_img' src='"+this.grp_open_img.src+"' onclick=filters.hidden(\"set_out\") border='0'>&nbsp;";
98                        list += "<span><b>"+get_lang('out office') + " - ( 1 )</b></span>";
99                        list += "<div id='set_out'>";
100                        list += "<input id='out_0' type='checkBox'><img id='set_out_form_email_img' src='"+this.for_email_img.src+"' border='0'>";
101                        list += " " + this.vl_outOffice(filter.out_officeR) + " " ;
102                        list += "</div>";
103                }
104                Element("form_body").innerHTML = list;
105        }
106       
107        cfilterSh.prototype.vl_rule = function(rule,pos){
108                var aux = rule.split("&&");
109                return " <a href='javascript:void(0)' onclick=filter.form_r('"+pos+"')><b>" + get_lang("Status") + " : </b>" + "<font color='red'>" + get_lang(aux[2]) + "</font>" + " - <b>" + get_lang("E-mail rule") + ":</b> " + aux[3] + " - <b>" + get_lang("Action") + ":</b> " + aux[6] + "</a>";
110        }
111       
112        cfilterSh.prototype.vl_outOffice = function(outOffice){         
113                var aux = outOffice.split("&&");
114                return get_lang("Rule") + " - <a href='javascript:void(0)' onclick=filter.form_out()> " + "<b>" + get_lang("Status") + " : </b><font color='red'>" + (aux[4] == "off" ? get_lang("Disabled") : get_lang("Enabled")) + "</font></a>";
115        }
116       
117        cfilterSh.prototype.n_rule = function(){
118                Element('form_body').innerHTML = "";
119                Element('form_body').innerHTML = filter.forms_();       
120                Element('div_rule').style.display = "";
121                filter.ac_form = "new_rule";
122                Element('form_buttons').style.display = 'none';
123                filter.sel_boxes();
124
125        }
126
127        cfilterSh.prototype.n_out_office = function(){
128                Element('form_body').innerHTML = "";
129                Element('form_body').innerHTML = filter.forms_();       
130                Element('div_vacation').style.display = "";                     
131                Element('form_buttons').style.display = 'none';
132                filter.ac_form = "new_out";     
133                }
134
135        cfilterSh.prototype.hidden = function(el){
136                var _this = this;
137                Element(el).style.display = "none";
138                Element(el+"_img").src = _this.grp_close_img.src;
139                Element(el+"_img").onclick = function(){filters.un_hidden(el);}
140        }
141
142        cfilterSh.prototype.un_hidden = function(el){
143                var _this = this;
144                Element(el).style.display = "";
145                Element(el+"_img").src = _this.grp_open_img.src;
146                Element(el+"_img").onclick = function(){filters.hidden(el);}
147        }
148
149        cfilterSh.prototype.showWindow = function (div){
150                if(! this.filter_Sh[div.id]) {
151                        div.style.width = "680px";
152                        div.style.height = "345px";
153                        div.style.visibility = "hidden";
154                        div.style.position = "absolute";
155                        div.style.zIndex = "10000";                     
156                        var title = ':: ' + get_lang('Filters management') + ' - ' + get_lang('Filters maintenance') + ':: ';
157                        var wHeight = div.offsetHeight + "px";
158                        var wWidth =  div.offsetWidth   + "px";
159
160                        win = new dJSWin({                     
161                                id: 'filter'+div.id,
162                                content_id: div.id,
163                                width: wWidth,
164                                height: wHeight,
165                                title_color: '#3978d6',
166                                bg_color: '#eee',
167                                title: title,                                           
168                                title_text_color: 'white',
169                                button_x_img: '../phpgwapi/images/winclose.gif',
170                                border: true });
171                       
172                        this.filter_Sh[div.id] = win;
173                        win.draw();
174                }else{
175                        div.innerHTML = '';
176                        win = this.filter_Sh[div.id];
177                        filter.form_m();                       
178                }
179                win.open();
180        }
181
182///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
183// build object
184        var filters;
185        filters = new cfilterSh();
Note: See TracBrowser for help on using the repository browser.