var rules_limit = 200; function cfilterSh(){ this.filter_Sh = new Array; this.qvfaf = ""; // Images this.grp_open_img = new Image(); this.grp_open_img.src = 'templates/default/images/filtro/group_open.gif'; this.grp_close_img = new Image(); this.grp_close_img.src = 'templates/default/images/filtro/group_close.gif'; this.filter_img = new Image(); this.filter_img.src = 'templates/default/images/filtro/filters.gif'; this.for_email_img = new Image(); this.for_email_img.src = 'templates/default/images/filtro/answered.gif'; } cfilterSh.prototype.Forms = function(){ var form = document.createElement("DIV"); form.id = "window_ffilter_ccform"; form.style.visibility = "hidden"; form.style.position = "absolute"; form.style.left = "0px"; form.style.top = "0px"; form.style.width = "0px"; form.style.height = "0px"; document.body.appendChild(form); var form_cont = document.createElement("SPAN"); form_cont.id = "form_status"; form_cont.style.display = ""; form_cont.style.position = "absolute"; form_cont.style.top = "10px"; form_cont.style.left = "600px"; form_cont.innerHTML = ""; form.appendChild(form_cont); var form_buttons = document.createElement("DIV"); form_buttons.id = "form_buttons"; form_buttons.style.position = "absolute"; form_buttons.style.display = ""; form_buttons.style.top = "320px"; form_buttons.style.left = "5px"; form_buttons.style.width = "655px"; form_buttons.innerHTML = ""+ " "+ " "+ " "; form.appendChild(form_buttons); var form_body = document.createElement("DIV"); form_body.id = "form_body"; form_body.style.position = "absolute"; form_body.style.left = "5px"; form_body.style.top = "5px"; form_body.style.width = "668px"; form_body.style.height = "310px"; form_body.style.borderStyle = "outset"; form_body.style.borderColor = "black"; form_body.style.borderWidth = "1px"; form_body.style.overflow = "auto"; form.appendChild(form_body); this.showWindow(form); filter.load_rules(); this.list_rules(); } cfilterSh.prototype.list_rules = function(){ if(filter.rulest.length == 0) setTimeout("filters.mount_list()",2500); else this.mount_list(); } cfilterSh.prototype.mount_list = function(){ Element('form_status').innerHTML = ""; var list = ""; // rules if(filter.rulest.length == 0){ list = " "+get_lang('list of the filters') + " - ( " + filter.rulest.length + " ) - " + "" + get_lang("new rule") + ""; }else{ if (filter.rulest.length < rules_limit ) //Limit of rules list = " "+get_lang('list of the filters') + " - ( " + filter.rulest.length + " ) - " + "" + get_lang("new rule") + ""; else list = " "+get_lang('list of the filters') + " - ( " + filter.rulest.length + " ) - " + get_lang("You have reached the maximum number of rules"); list += "
"; for(var i=0; i < filter.rulest.length; i++){ list += "  " + get_lang("Rule")+" : " + parseInt(i+1) + " -- " + this.vl_rule(filter.rulest[i],i) + "
"; } } list += "

"; // out office if(!filter.out_officeR){ list += " "; list += ""+get_lang('out office') + " - ( 0 ) " + "" + get_lang("new rule") + ""; }else{ list += " "; list += ""+get_lang('out office') + " - ( 1 )"; list += "
"; list += ""; list += " " + this.vl_outOffice(filter.out_officeR) + " " ; list += "
"; } Element("form_body").innerHTML = list; } cfilterSh.prototype.vl_rule = function(rule,pos){ var aux = rule.split("&&"); return " " + get_lang("Status") + " : " + "" + get_lang(aux[2]) + "" + " - " + get_lang("E-mail rule") + ": " + aux[3] + " - " + get_lang("Action") + ": " + aux[6] + ""; } cfilterSh.prototype.vl_outOffice = function(outOffice){ var aux = outOffice.split("&&"); return get_lang("Rule") + " - " + "" + get_lang("Status") + " : " + (aux[4] == "off" ? get_lang("Disabled") : get_lang("Enabled")) + ""; } cfilterSh.prototype.n_rule = function(){ Element('form_body').innerHTML = ""; Element('form_body').innerHTML = filter.forms_(); Element('div_rule').style.display = ""; filter.ac_form = "new_rule"; Element('form_buttons').style.display = 'none'; filter.sel_boxes(); } cfilterSh.prototype.n_out_office = function(){ Element('form_body').innerHTML = ""; Element('form_body').innerHTML = filter.forms_(); Element('div_vacation').style.display = ""; Element('form_buttons').style.display = 'none'; filter.ac_form = "new_out"; } cfilterSh.prototype.hidden = function(el){ var _this = this; Element(el).style.display = "none"; Element(el+"_img").src = _this.grp_close_img.src; Element(el+"_img").onclick = function(){filters.un_hidden(el);} } cfilterSh.prototype.un_hidden = function(el){ var _this = this; Element(el).style.display = ""; Element(el+"_img").src = _this.grp_open_img.src; Element(el+"_img").onclick = function(){filters.hidden(el);} } cfilterSh.prototype.showWindow = function (div){ if(! this.filter_Sh[div.id]) { div.style.width = "680px"; div.style.height = "345px"; div.style.visibility = "hidden"; div.style.position = "absolute"; div.style.zIndex = "10000"; var title = ':: ' + get_lang('Filters management') + ' - ' + get_lang('Filters maintenance') + ':: '; var wHeight = div.offsetHeight + "px"; var wWidth = div.offsetWidth + "px"; win = new dJSWin({ id: 'filter'+div.id, content_id: div.id, width: wWidth, height: wHeight, title_color: '#3978d6', bg_color: '#eee', title: title, title_text_color: 'white', button_x_img: '../phpgwapi/images/winclose.gif', border: true }); this.filter_Sh[div.id] = win; win.draw(); }else{ div.innerHTML = ''; win = this.filter_Sh[div.id]; filter.form_m(); } win.open(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // build object var filters; filters = new cfilterSh();