source: trunk/expressoMail1_2/js/filter.js @ 139

Revision 139, 20.6 KB checked in by niltonneto, 16 years ago (diff)

Vide ocorrencias no Trac.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1function populatedropdown(dayfield, monthfield, yearfield){
2        var month=['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'];
3        var today=new Date()
4        var dayfield=document.getElementById(dayfield)
5        var monthfield=document.getElementById(monthfield)
6        var yearfield=document.getElementById(yearfield)
7        for (var i=0; i<31; i++)
8                dayfield.options[i]=new Option(i+1, i+1)
9        dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's day
10        for (var m=0; m<12; m++)
11        monthfield.options[m]=new Option(month[m],m)
12        monthfield.options[today.getMonth()]=new Option(month[today.getMonth()], today.getMonth(), true, true) //select today's month
13        var thisyear=today.getFullYear()
14        for (var y=0; y<7; y++){
15                yearfield.options[y]=new Option(thisyear, thisyear)
16                thisyear+=1
17        }
18        yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year
19}
20
21        function cfilter(){
22
23                this.mode_in   = "";
24                this.rulest              = new Array;
25                this.out_officeR = new Array;
26                this.email_deny  = new Array;
27                this.ac_form     = "";
28                this.ind                 = "";
29                this.email_deny  = new Array;
30                this.email_ld    = new Array;           
31                this.values = new Array("",
32                                        ",checkBox1",
33                                        ",select_size=1",
34                                        ",checkBox1,select_size=1",
35                                        ",select_rules=1",
36                                        ",checkBox1,select_rules=1",                           
37                                        ",select_size=1,select_rules=1",                               
38                                        ",checkBox1,select_size=1,select_rules=1",
39                                        ",checkBox2",                           
40                                        ",checkBox1,checkBox2",                         
41                                        ",checkBox2,select_size=1",
42                                        ",ckeckBox1,checkBox2,select_size=1",
43                                        ",checkBox2,select_rules=1",                                                                                                                                                           
44                                        ",checkBox1,checkBox2,select_rules=1",                         
45                                        ",checkBox2,select_size=1,select_rules=1",                             
46                                        ",checkBox1,checkBox2,select_size=1,select_rules=1");
47                this.BoxSelection = new Array("select_2,select_1","select_1,select_2");
48               
49        }
50       
51        cfilter.prototype.load_rules = function(){
52                var _this = this;
53                if(_this.rulest.length == 0){
54                        var handler_sieve = function(data){
55                                if(data.rule.length > 0){
56                                        for(var i=0 ; i < data.rule.length; i++){
57                                                _this.rulest[_this.rulest.length] = data.rule[i];
58                                        }
59                                }
60                                if(data.vacation.length > 0){_this.out_officeR[0] = data.vacation[0];}
61                                if(data.mode.length > 0){_this.mode_in = data.mode[0];}
62                        }
63                        if(Element('form_status') != null)
64                                Element('form_status').innerHTML = "<span style='background:#cc4444;'>&nbsp;&nbsp;<font color='WHITE'>Aguarde...</font>&nbsp;</span>";
65                        cExecute("$this.ScriptS.init_a",handler_sieve);
66                        _this.email_ldap();
67                }
68        }
69       
70        cfilter.prototype.form_m = function(){
71                Element('form_body').innerHTML = "";
72                Element('form_buttons').style.display = '';
73                filters.mount_list();
74                this.ac_form = "";             
75        }
76       
77        cfilter.prototype.form_out = function(){
78                Element('form_body').innerHTML = "";
79                Element('form_body').innerHTML = this.forms_();
80                Element('div_vacation').style.display = "";
81                this.ac_form = "old_out";               
82                this.r_rules_out();             
83        }
84       
85        cfilter.prototype.form_r = function(pos){
86                Element('form_body').innerHTML = "";
87                Element('form_body').innerHTML = this.forms_();
88                Element('div_rule').style.display = "";
89                this.ac_form = "old_rule";
90                this.ind = pos;
91                this.r_rules_form(pos);
92        }
93       
94        cfilter.prototype.email_ldap = function(){
95                var _this = this;
96                var handler_ldap = function(data){
97                        _this.email_ld[0] = data.mail != "" ? data.mail: "";
98                        _this.email_ld[1] = data.mailalter != "" ? data.mailalter: "";
99                }
100                cExecute("$this.ldap_functions.get_emails_ldap",handler_ldap);
101        }
102       
103        cfilter.prototype.sel_boxes = function(){
104                var nm_folders = tree_folders.getNodesList(cyrus_delimiter);
105                if(document.getElementById("select_mailboxes") != null){
106                        var sel_nm = document.getElementById("select_mailboxes");
107                        if(sel_nm.length > 0 ){
108                                for(var i=0; i < sel_nm.options.length; i++){
109                                        sel_nm.options[i] = null;
110                                        i--;
111                                }
112                        }
113                        for(var i=0; i < nm_folders.length; i++){
114                                if(nm_folders[i].id != "root"){
115                                        var opt = new Option(nm_folders[i].caption,nm_folders[i].id,false,true);
116                                        sel_nm[sel_nm.length] = opt;
117                                }
118                        }
119                        sel_nm[0].selected = true;
120                }
121        }
122
123        cfilter.prototype.box_select = function(param){
124                var aux = this.BoxSelection[param].split(",");
125                var ele1 = document.getElementById(aux[0]);
126                var ele2 = document.getElementById(aux[1]);
127                var noption = "";
128                if(param == 0 || param == 1){
129                        if(ele1.selectedIndex != -1){
130                                noption = new Option(ele1.value,ele1.value,false,false);
131                                ele2.options[ele2.length] = noption;
132                                ele1.options[ele1.selectedIndex] = null;
133                                ele1.selectedIndex = 0;
134                        }
135                }
136        }
137
138        cfilter.prototype.r_rules_form = function(ind){
139               
140                // hide buttons
141                Element('form_buttons').style.display = 'none';
142
143                this.sel_boxes();
144                var aux = new Array;
145                var _this = this;
146                if(this.rulest.length == 0){
147                        return false;
148                }
149                aux = _this.rulest[ind].split("&&");
150                document.getElementById("field1").value = aux[3];
151                document.getElementById("field2").value = aux[4];
152                document.getElementById("field3").value = aux[5];
153                document.getElementById("field4").value = aux[11];                             
154               
155                switch(aux[6]){
156                        case "folder":
157                                document.getElementById("radio1").checked  = true;
158                                var name_mb = aux[7];
159                                var sel_mb = document.getElementById("select_mailboxes");
160                                for(var i=0; i < sel_mb.options.length; i++){if((sel_mb.options[i].value) ==  name_mb){sel_mb.options[i].selected = true;}}
161                                break;
162                        case "address":
163                                document.getElementById("radio2").checked   = true;
164                                document.getElementById("field5").value         = aux[7];
165                                break;
166                        case "reject":
167                                 document.getElementById("radio3").checked  = true;
168                                 var text0 = aux[7].split("\\n");                                       
169                                 for(var i=0; i < text0.length; i++){document.getElementById("field6").value += text0[i] + "\n";}
170                                 break;
171                        case "discard":
172                                document.getElementById("radio4").checked       = true;
173                                break;
174                }
175                var mark_values = this.values[aux[8]].split(",");
176                for(var i=0; i < mark_values.length; i++){
177                        if( mark_values[i] == "checkBox1" || mark_values[i] == "checkBox2"){
178                                document.getElementById(mark_values[i]).checked = true;
179                        }
180                        if( mark_values[i] == "select_size=1" || mark_values[i] == "select_rules=1"){
181                                var mark_val = mark_values[i].split("=");
182                                document.getElementById(mark_val[0]).options[mark_val[1]].selected = true;
183                        }
184                }
185        }
186
187        cfilter.prototype.r_rules_out = function(){
188       
189                var _this = this;
190                if(_this.out_officeR.length == 0){
191                        return false;
192                }
193               
194                // hide buttons
195                Element('form_buttons').style.display = 'none';
196       
197                var aux = _this.out_officeR[0].split("&&");
198                var days   = aux[1];
199                var emails = aux[2];
200                var mens   = aux[3];           
201                var p_emails = new Array;
202                var d_emails = new Array;
203                               
204                var p_aux = emails.split(", ");
205                for(var i=0; i < p_aux.length; i++){
206                        p_emails[i] = p_aux[i].substr(0,(p_aux[i].length - 1));
207                        p_emails[i] = p_emails[i].substr(1,(p_aux[i].length));
208                }
209                for(var i=0; i < _this.email_ld.length; i++){
210                        d_emails[i] = _this.email_ld[i];
211                }
212
213                var el = document.getElementById("select_1");
214                var el2 = document.getElementById("select_2");
215                       
216                diff = function(vet, comp){
217                        var sel1 = new Array;
218                        for(var i=0; i < vet.length; i++){
219                                for(var j=0; j < comp.length; j++){
220                                        if(vet[i] == comp[j]){
221                                                comp.splice(j,1);
222                                                j--;
223                                        }
224                                }
225                        }
226                        var el1 = document.getElementById("select_1");
227                        var el2 = document.getElementById("select_2");
228                        for(var i=0; i < vet.length; i++){
229                                var opt = new Option(vet[i],vet[i],false,false);
230                                el1.options[el1.length] = opt;                 
231                        }
232                        for(var i=0; i < comp.length; i++){
233                                var opt = new Option(comp[i],comp[i],false,false);
234                                el2.options[el2.length] = opt;                 
235                        }
236                };     
237                diff(p_emails,d_emails);
238                document.getElementById("select_days").value = days;
239                var text    = mens.split("\\n");
240                for(var i=0; i < text.length; i++){document.getElementById("field8").value += text[i] + " ";}
241                for(var i=0; i < _this.email_ld.length; i++){
242                        d_emails[i] = _this.email_ld[i];
243                }
244
245        }
246
247        cfilter.prototype.forms_ = function(){
248                        var form   = "";
249                        form       = "<div id='div_rule' style='display:none'><table id='table_rule' border='0' cellpading='0' cellspacing='0' width='100%'>"+
250                                                 "<tr><td colspan='2'><input type='checkBox' id='checkBox1' name='checkb'>"+get_lang('Also check message against next rule') + "</td></tr>"+
251                                                 "<tr><td colspan='2'><input type='checkBox' id='checkBox2' name='checkb'>"+get_lang('Keep a copy of the message at your Inbox')+ "</td><tr>"+
252                                                 "<tr><td colspan='2'><hr size='1' width='100%'></td></tr><tr>"+
253                                                 "<td rowspan='4' width='20%'>"+get_lang('Coincident')+"<br><select id='select_rules' name='select_rules'>"+
254                        "<option value='0'>"+get_lang("with all")+"</option><option value='1'>"+get_lang("with some")+"</option>"+
255                                                 "</select></td><td>"+get_lang('The field \"From:\" of the message it contains')+".: <input type='text' id='field1' name='field1' size='35' maxlength='200'></td>"+
256                                                 "</tr><tr><td>"+get_lang('The field \"To: \" of the message it contains')+".: <input type='text' id='field2' name='field2' size='35' maxlength='200'></td>"+
257                                                 "</tr><tr><td>"+get_lang('The field \"Subject: \" of the message it contains')+".: <input type='text' id='field3' name='field3' size='35' maxlength='200'></td>"+
258                                                 "</tr><tr><td>"+get_lang('The size of the message is')+".: &nbsp<select id='select_size' name='select_size'>"+
259                                                "<option value='0'>"+get_lang("Less than")+"</option><option value='1'>"+get_lang("Greater than")+"</option>"+                                           
260                                                 "</select>&nbsp;<input type='text' id='field4' name='field4' size='8' maxlength='8'> Kb</td>"+
261                                                 "</tr><tr><td colspan='2'><hr size='1' width='100%'></td></tr>"+
262                                                 "</table><table id='table_rule1' border='0' cellpading='0' cellspacing='0' width='100%'>"+
263                                                 "<tr><td width='50%'><input type='radio' id='radio1' name='radio' value='folder'>"+get_lang('Store at')+".:</td>"+
264                                                 "<td width='50%'><select id='select_mailboxes' name='select_mailboxes'></select></td>"+
265                                                 "</tr><tr><td width='50%'><input type='radio' id='radio2' name='radio' value='address'>"+get_lang('Forward to the address')+".:</td>"+
266                                                 "<td width='50%'><input type='text' id='field5' name='field5' size='35' maxlength='70'></td>"+
267                                                 "</tr><tr><td width='50%'><input type='radio' id='radio3' name='radio' value='reject'>"+get_lang('Send a rejection message')+".:</td>"+
268                                                 "<td width='50%'><textarea id='field6' name='field6' rows='3' cols='25'></textarea></td>"+
269                                                 "</tr><tr><td colspan='2'><input type='radio' id='radio4' name='radio' value='discard'>"+get_lang('Erase the message')+"</td>"+
270                                                 "</tr></table></div><div id='div_vacation' style='display:none'>"+
271                                                 "<table id='table_vacation' border='0' cellpading='0' cellspacing='0' width='100%'>"+
272                                                 "<tr><td width='40%' valign='top'>"+get_lang('Reply sent messages to')+":<select multiple id='select_1' name='select_1' size='6' style='width:250px'></select></td>"+
273                                                 "<td width='8%'><table border='0' cellpading='0' cellspacing='0' width='100%'>"+
274                                                 "<tr><td align='right' valign='top'><br><a href=javascript:void(0) onclick='filter.box_select(0);'><<</a> <br><br></td>"+
275                                                 "</tr><tr><td align='left' valign='middle'><br><br> <a href=javascript:void(0) onclick='filter.box_select(1);'>>></a> <br></td>"+
276                                                 "</tr></table></td><td width='52%' valign='top'>"+get_lang('Emails of the account')+":<br><select multiple id='select_2' name='select_2' size='6' style='width:250px'></select>"+
277                                                 "</td></tr><tr><td colspan='3'><hr size='1' width='100%'></td>"+
278                                                 "</tr><tr><td colspan='3'><input name='type' id='interval' checked='checked' type='radio'>"+get_lang('During')+": <input type='text' id='select_days' size='3'> "+get_lang('day(s)')+"</td>"+
279                                                 "</tr><tr><td colspan='3'><input name='type' id='date' type='radio' onChange=\"populatedropdown('daydropdown', 'monthdropdown', 'yeardropdown')\">"+get_lang('Set date')+": <select id='daydropdown'></select><select id='monthdropdown'></select><select id='yeardropdown'></select></td>"+
280                                                 "</tr><tr><td colspan='3'><hr size='1' width='100%'></td></tr><tr><td colspan='3'>"+get_lang('With the following message')+".:</td>"+
281                                                 "</tr><tr><td colspan='3'><textarea id='field8' rows='3' cols='50'></textarea></td></tr></table></div>"+
282                                                 "<span align='right'><input type='button' value="+get_lang("Back")+" onclick='filter.form_m()'></span>"+
283                                                 "<span align='right'><input type='button' value="+get_lang("Save")+" onclick='filter.saved_rules()'></span>";                                           
284                return form;
285        }
286
287        cfilter.prototype.enabled_disabled = function(param){
288
289                // Rules
290                if(Element("rule_0") != null){
291                        for(var i=0; i < this.rulest.length; i++){
292                                if(Element("rule_"+i).checked){
293                                        var aux_rul = this.rulest[i].split("&&");
294                                        if(aux_rul[2] != param){
295                                                aux_rul[2] = param;                                     
296                                                var rl = "";
297                                                for(var j=0; j < aux_rul.length; j++){
298                                                        rl += aux_rul[j] + "&&";
299                                                }
300                                                rl = rl.substr(0,(rl.length - 2));
301                                                this.rulest[i] = rl;                                   
302                                        }
303                                }
304                        }
305                }
306                // Out Office
307                if(Element("out_0") != null){
308                        if(Element("out_0").checked){
309                                var aux_out = this.out_officeR[0].split("&&");
310                                if(param == "ENABLED")
311                                        aux_out[4] = "on ";
312                                else
313                                        aux_out[4] = "off";
314                                var out = "";
315                                for(var i=0; i < aux_out.length; i++){
316                                        out += aux_out[i] + "&&";
317                                }                               
318                                out = out.substr(0,(out.length - 2));
319                                this.out_officeR[0] = out;
320                        }
321                }
322                this.reload_rules();
323        }
324       
325        cfilter.prototype.new_rule = function(email){
326
327                if(this.email_deny.length > 0){
328                        for(var i=0 ; i < this.email_deny.length; i++){
329                                if(this.email_deny[i] == email){
330                                        alert(get_lang("Sender blocked!"));
331                                        return false;
332                                }
333                        }
334                }
335
336                // Verifica Email
337                var emailReg = /^[a-z][a-z-_0-9\.]+@[a-z-_=>0-9\.]+\.[a-z]{2,3}$/i
338        if(!emailReg.test(email)){
339                        alert(get_lang("Inform a valid e-mail!"));
340                        return false;
341                }
342
343                this.load_rules();
344                if(confirm(get_lang("Do you want to block this e-mail?"))){
345                        new_r = "&&ENABLED&&" + email + "&&&&&&discard&&&&0&&&&&&0";
346                        setTimeout("filter.e_newrule('" + new_r + "')",2000);           
347                        this.email_deny.push(email);
348                        write_msg(get_lang("This sender was blocked"));                                                 
349                }
350        }
351       
352        cfilter.prototype.e_newrule = function(nw_rule){
353
354                var new_rl = "";
355                if(this.rulest.length == 0){
356                        new_rl = "#rule&&1" + nw_rule;
357                }else{
358                        var aux = this.rulest[this.rulest.length -1 ].split("&&");
359                        new_rl = "#rule&&" + (parseInt(aux[1]) + parseInt(2)) + nw_rule;
360                }
361                this.rulest.push(new_rl);
362                this.saved_all();
363        }
364       
365        cfilter.prototype.delete_r = function(){
366       
367                // rule
368                var _this = this;
369                if(Element("rule_0") != null){
370                        for(var i=0; i < _this.rulest.length; i++){
371                                if(Element("rule_"+i).checked){_this.rulest[i] = "delete";}
372                        }
373                        for(var i=0; i < _this.rulest.length; i++){
374                                if(_this.rulest[i] == "delete"){_this.rulest.splice(i,1);i--;}
375                        }
376                }
377       
378                if(_this.rulest.length > 0){
379                        var cont = parseInt(1);
380                        for(var i=0; i < _this.rulest.length ; i++){
381                                var n_rulest = _this.rulest[i].split("&&");
382                                n_rulest[1] = cont;
383                                cont = cont + parseInt(2);
384                                var aux = "";
385                                for(var j=0; j < n_rulest.length; j++){aux += n_rulest[j] + "&&";}
386                                aux = aux.substr(0,(aux.length - 2));
387                                _this.rulest[i] = aux;
388                        }
389                }
390                // out office
391                if(Element("out_0") != null){
392                        if(Element("out_0").checked){_this.out_officeR.splice(0,1);}
393                }
394                _this.reload_rules();
395        }
396       
397        cfilter.prototype.reload_rules = function(){
398                this.saved_all();
399                Element('form_body').innerHTML = "";
400                this.load_rules();
401                filters.mount_list();
402        }
403
404        cfilter.prototype.saved_rules = function(){
405
406                var mount_rule = "";
407                var form = this.ac_form.split("_");
408                var n_rule = "";
409
410                if(form[1] == "rule"){
411                        mount_rule = "#rule&&";
412                        if(form[0] == "new"){
413                                n_rule = "1&&";
414                                if(this.rulest.length > 0){
415                                        aux = this.rulest[this.rulest.length - parseInt(1)].split("&&");
416                                        n_rule = (parseInt(aux[1]) + parseInt(2)) + "&&";
417                                }
418                                mount_rule += n_rule + "ENABLED&&";
419                        }else{
420                                n_rule = this.rulest[this.ind].split("&&");
421                                mount_rule += n_rule[1] + "&&";
422                                mount_rule += n_rule[2] + "&&";
423                        }
424
425                        if(LTrim(Element("field1").value) == "" && LTrim(Element("field2").value) == "" && LTrim(Element("field3").value) == "" && Element("field4").value == "")
426                        {
427                                alert(get_lang("Define some criterion to the fields From, To and Subject with more than 3 characters!"));
428                                return false;
429                        }
430
431                        if((LTrim(Element("field1").value).length <= 3) && (LTrim(Element("field2").value).length <= 3) && (LTrim(Element("field3").value).length <= 3 && Element("field4").value == "")){
432                                alert(get_lang("Define some criterion to the fields From, To and Subject with more than 3 characters!"));
433                                return false;
434                        }
435                       
436                        for(var i=1; i < 4; i++){mount_rule += LTrim(Element("field"+i).value) + "&&";}
437                        var v_checked = false;
438                        if(Element("radio1").checked){
439                                mount_rule += "folder&&";
440                                var sel_nameBox = Element("select_mailboxes");
441                                for(var i=0; i < sel_nameBox.options.length; i++){if(sel_nameBox.options[i].selected == true){mount_rule += sel_nameBox.options[i].value + "&&";}}
442                                v_checked = true;
443                        }
444                        if(Element("radio2").checked){
445                                mount_rule += "address&&";
446                                if(Element("field5").value == ""){
447                                        alert(get_lang("Inform a forwarding e-mail!"));
448                                        return false;
449                                }else{
450                                        var emailReg = /^[a-z][a-z-_0-9\.]+@[a-z-_=>0-9\.]+\.[a-z]{2,3}$/i
451                                if(emailReg.test(Element("field5").value)){
452                                                mount_rule += Element("field5").value + "&&";
453                                        }else{
454                                                alert(get_lang("Inform a valid e-mail!"));
455                                                return false;
456                                        }
457                                }
458                                v_checked = true;
459                        }
460                        if(Element("radio3").checked){
461                                mount_rule += "reject&&";
462                                if(Element("field6").value == ""){
463                                        alert(get_lang("Inform a text for rejection!"));
464                                        return false;
465                                }else{
466                                        mount_rule += Element("field6").value + "&&";
467                                }
468                                v_checked = true;
469                        }                               
470                        if(Element("radio4").checked){
471                                mount_rule += "discard&&&&";
472                                v_checked = true;
473                        }
474                        if(!v_checked){
475                                alert(get_lang("No option marked!"));
476                                return false;
477                        }
478                        var opts = "";
479                        if(Element("checkBox1").checked == true){opts += ",checkBox1";}
480                        if(Element("checkBox2").checked == true){opts += ",checkBox2";}
481                        if(Element("select_size").options[1].selected == true){opts += ",select_size=1";}
482                        if(Element("select_rules").options[1].selected == true){opts += ",select_rules=1";}
483                        for(var i=0; i < this.values.length; i++){if(this.values[i] == opts){mount_rule += i + "&&";}}
484                        mount_rule += "&&&&";
485                        if(LTrim(Element("field4").value) != ""){
486                                mount_rule += LTrim(Element("field4").value);
487                        }else{
488                                mount_rule += 0;
489                        }
490                        if(form[0] == "new")
491                                this.rulest[this.rulest.length] = mount_rule;
492                        else
493                                this.rulest[this.ind] = mount_rule;
494                }else{
495                        mount_rule = "";
496                        if (Element("date").checked){
497                                var today=new Date();
498                                var entryDate = new Date(Date.UTC(Element("yeardropdown").value, Element("monthdropdown").value, parseInt(Element("daydropdown").value)+1, 0, 0, 0));
499                                var fld_days = parseInt((entryDate.getTime()-today.getTime())/86400000);
500                                }
501                        else
502                                var fld_days = parseInt(Element("select_days").value);
503                       
504                        var fld_emails = Element("select_1");
505                        var fld_men        = Element("field8");
506                        mount_rule = "#vacation&&";
507                        if(fld_days != 0)
508                                        mount_rule += fld_days + "&&";
509                        else{
510                                alert(get_lang("Inform the days!"));
511                                return false;
512                        }
513                        if(fld_emails.options.length > 0){
514                                for(var i=0; i < fld_emails.options.length; i++){               
515                                        mount_rule += "\"" + fld_emails.options[i].value + "\", ";                     
516                                }
517                                mount_rule = mount_rule.substr(0,(mount_rule.length - 2));
518                                mount_rule += "&&";
519                                mount_rule += fld_men.value + "&&on ";
520                        }else{
521                                alert(get_lang("Inform a forwarding e-mail!"));
522                                return false;
523                        }
524                        if(LTrim(fld_men.value) == ""){
525                                alert(get_lang("Inform a message!"));
526                                return false;
527                        }
528                        this.out_officeR[0] = mount_rule;
529                }
530                Element('form_buttons').style.display = '';
531                this.reload_rules();
532        }
533
534        cfilter.prototype.close_frm= function(){
535                filters.filter_Sh['window_ffilter_ccform'].close();
536        }
537       
538        cfilter.prototype.saved_all = function(){
539                var aux_rul = "";
540                var _this = this;
541                if(_this.rulest.length > 0){
542                        for(var i=0; i < _this.rulest.length; i++){
543                                var aux = _this.rulest[i].split("&&");                         
544                                aux_rul += "_begin_##";
545                                for(var j=0 ; j < aux.length; j++){
546                                        if( (j +1) > aux.length){aux_rul += url_encode(aux[j]);}
547                                        else{aux_rul += url_encode(aux[j]) + "##";}
548                                }       
549                                aux_rul += "_end_\n";
550                        }
551                }
552                if(_this.out_officeR.length > 0){
553                                var aux = _this.out_officeR[0].split("&&");                             
554                                aux_rul += "_begin_##";
555                                for(var j=0 ; j < aux.length; j++){
556                                        if( (j +1) > aux.length){aux_rul += url_encode(aux[j]);}
557                                        else{aux_rul += url_encode(aux[j]) + "##";}
558                                }       
559                                aux_rul += "_end_\n";
560                }
561                var h_filter = function(data){
562                        if(data != "Ok"){alert("Erro : \n" + data);}
563                }
564                var args   = "$this.ScriptS.rec_rules";
565                var params = "arfilter="+aux_rul;
566                cExecute(args,h_filter,params);
567        }
568
569// build object
570   var filter;
571   filter = new cfilter();
Note: See TracBrowser for help on using the repository browser.