var rules_limit = 3000; function cfilterSh(){ this.filter_Sh = new Array; this.qvfaf = ""; // Images this.grp_open_img = new Image(); this.grp_open_img.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/filtro/group_open.gif'; this.grp_close_img = new Image(); this.grp_close_img.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/filtro/group_close.gif'; this.filter_img = new Image(); this.filter_img.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/filtro/filters.gif'; this.for_email_img = new Image(); this.for_email_img.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/filtro/answered.gif'; this.telephone_voip = new Image(); this.telephone_voip.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/filtro/telephone_voip.jpg'; } 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 = "block"; 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); if ( filter.rulest.length > 0 ) this.list_rules(); else filter.load_rules(this.list_rules); } cfilterSh.prototype.list_rules = function(){ if(filter.criticalError) return false; else filters.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 += "
"; } 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 += "
"; } list += "
"; // Voip if(preferences.voip_email_redirect) { if( filter.rulesVoip.length == 0) { list += " " + get_lang('Phone Warnings List') + " - ( " + filter.rulesVoip.length + " ) - " + "" + get_lang("new rule") + ""; } else { if ( filter.rulest.length < rules_limit ) //Limit of rules list += " " + get_lang('Phone Warnings List') + " - ( " + filter.rulesVoip.length + " ) - " + "" + get_lang("new rule") + ""; else list += " " + get_lang('Phone Warnings List') + " - ( " + filter.rulesVoip.length + " ) - " + get_lang("You have reached the maximum number of rules"); list += "
"; for(var i= 0; i < filter.rulesVoip.length; i++) { list += "  " + get_lang("Rule")+" : " + parseInt(i+1) + " -- " + this.vl_rule(filter.rulesVoip[i],i,'voip') + "
"; } list += "
"; } } Element("form_body").innerHTML = list; } cfilterSh.prototype.vl_rule = function(rule,pos,type) { var fields = rule.split("&&"); if(type == 'voip') return " " + get_lang("Status") + " : " + "" + get_lang(fields[2]) + "" + " - " + fields[3] + " " + get_lang("Subject") + ": " + fields[5] + ""; else{ var _criteria = " "; if (fields[3].length > 0) _criteria = ""+get_lang("is from")+":"+fields[3]; if (fields[4].length > 0) _criteria += ""+get_lang("is to")+":"+fields[4]; if (fields[5].length > 0) _criteria += ""+get_lang("subject is")+":"+fields[5]; if (parseInt(fields[11]) > 0) { if(fields[8] == "2") _criteria += ""+get_lang("size is over than")+":"+fields[11]; else _criteria += ""+get_lang("size is under than")+":"+fields[11]; } var _action = " "; if (fields[6] == 'folder') _action = get_lang("Store at")+" "+(fields[7].split("/"))[1]; else _action = get_lang(fields[6]); return " " + get_lang("Status") + " : " + "" + get_lang(fields[2]) + "" + " - " + get_lang("if email") + " " + _criteria + " - " + get_lang("Action") + ": " + _action + ""; } } 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 = "block"; 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 = "block"; Element('form_buttons').style.display = 'none'; filter.ac_form = "new_out"; } cfilterSh.prototype.n_voipFilter = function() { Element('form_body').innerHTML = ""; Element('form_body').innerHTML = filter.forms_(); Element('div_voipFilter').style.display = "block"; Element('form_buttons').style.display = 'none'; filter.ac_form = "new_voip"; } function visibleRulesFalse(el) { Element(el).style.display = "none"; Element(el+"_img").src = filters.grp_close_img.src; Element(el+"_img").onclick = function(){visibleRulesTrue(el);}; } function visibleRulesTrue(el) { Element(el).style.display = ""; Element(el+"_img").src = filters.grp_open_img.src; Element(el+"_img").onclick = function(){visibleRulesFalse(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();