[2] | 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 = "0px"; |
---|
| 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 | " <input type='button' value="+get_lang("Disable")+" onclick='filter.enabled_disabled(\"DISABLED\");'>"+ |
---|
[53] | 46 | " <input type='button' value="+get_lang("Remove")+" onclick='filter.delete_r();'>"+ |
---|
| 47 | " <input type='button' value="+get_lang("Close")+" onclick='filter.close_frm();'>"; |
---|
[2] | 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'> <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'> <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++){ |
---|
[128] | 88 | list += "<input id=rule_"+i+" type='checkBox'> <img src='"+this.filter_img.src+"' width='16' height='16' border='0'> " + get_lang("Rule")+" : " + parseInt(i+1) + " -- " + this.vl_rule(filter.rulest[i],i) + "<br>"; |
---|
[2] | 89 | } |
---|
| 90 | } |
---|
| 91 | list += "</div><br>"; |
---|
| 92 | // out office |
---|
| 93 | if(filter.out_officeR.length == 0){ |
---|
| 94 | list += "<img id='set_out_img' src='"+this.grp_close_img.src+"' border='0'> "; |
---|
| 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'> "; |
---|
| 98 | list += "<span><b>"+get_lang('out office') + " - ( " + filter.out_officeR.length + " )</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[0]) + " " ; |
---|
| 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("&&"); |
---|
[53] | 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>"; |
---|
[2] | 110 | } |
---|
| 111 | |
---|
| 112 | cfilterSh.prototype.vl_outOffice = function(outOffice){ |
---|
| 113 | var aux = outOffice.split("&&"); |
---|
[53] | 114 | return " <a href='javascript:void(0)' onclick=filter.form_out()><b>" + get_lang("Answer messages from") + " :</b>" + aux[2] + "- <b>" + get_lang("Status") + " : </b>" + "<font color='red'>" + aux[4] + "</font>" + "- <b>" + get_lang("message") + ":</b> " + aux[3] + "</a>"; |
---|
[2] | 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 | var el2 = document.getElementById("select_2"); |
---|
| 134 | for(var i=0; i < filter.email_ld.length; i++){ |
---|
| 135 | var opt = new Option(filter.email_ld[i],filter.email_ld[i],false,false); |
---|
| 136 | el2.options[el2.length] = opt; |
---|
| 137 | } |
---|
| 138 | } |
---|
| 139 | |
---|
| 140 | cfilterSh.prototype.hidden = function(el){ |
---|
| 141 | var _this = this; |
---|
| 142 | Element(el).style.display = "none"; |
---|
| 143 | Element(el+"_img").src = _this.grp_close_img.src; |
---|
| 144 | Element(el+"_img").onclick = function(){filters.un_hidden(el);} |
---|
| 145 | } |
---|
| 146 | |
---|
| 147 | cfilterSh.prototype.un_hidden = function(el){ |
---|
| 148 | var _this = this; |
---|
| 149 | Element(el).style.display = ""; |
---|
| 150 | Element(el+"_img").src = _this.grp_open_img.src; |
---|
| 151 | Element(el+"_img").onclick = function(){filters.hidden(el);} |
---|
| 152 | } |
---|
| 153 | |
---|
| 154 | cfilterSh.prototype.showWindow = function (div){ |
---|
| 155 | if(! this.filter_Sh[div.id]) { |
---|
| 156 | div.style.width = "680px"; |
---|
| 157 | div.style.height = "345px"; |
---|
| 158 | div.style.visibility = "hidden"; |
---|
| 159 | div.style.position = "absolute"; |
---|
| 160 | div.style.zIndex = "10000"; |
---|
[61] | 161 | var title = ':: ' + get_lang('Filters management') + ' - ' + get_lang('Filters maintenance') + ':: '; |
---|
[2] | 162 | var wHeight = div.offsetHeight + "px"; |
---|
| 163 | var wWidth = div.offsetWidth + "px"; |
---|
| 164 | |
---|
| 165 | win = new dJSWin({ |
---|
| 166 | id: 'filter'+div.id, |
---|
| 167 | content_id: div.id, |
---|
| 168 | width: wWidth, |
---|
| 169 | height: wHeight, |
---|
| 170 | title_color: '#3978d6', |
---|
| 171 | bg_color: '#eee', |
---|
| 172 | title: title, |
---|
| 173 | title_text_color: 'white', |
---|
| 174 | button_x_img: '../phpgwapi/images/winclose.gif', |
---|
| 175 | border: true }); |
---|
| 176 | |
---|
| 177 | this.filter_Sh[div.id] = win; |
---|
| 178 | win.draw(); |
---|
| 179 | }else{ |
---|
| 180 | div.innerHTML = ''; |
---|
| 181 | win = this.filter_Sh[div.id]; |
---|
| 182 | filter.form_m(); |
---|
| 183 | } |
---|
| 184 | win.open(); |
---|
| 185 | } |
---|
| 186 | |
---|
| 187 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 188 | // build object |
---|
| 189 | var filters; |
---|
| 190 | filters = new cfilterSh(); |
---|