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 = "0px";
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{
list = " "+get_lang('list of the filters') + " - ( " + filter.rulest.length + " ) - " + "" + get_lang("new rule") + "";
list += "
";
for(var i=0; i < filter.rulest.length; i++){
list += "
Regra : " + parseInt(i+1) + " -- " + this.vl_rule(filter.rulest[i],i) + "
";
}
}
list += "
";
// out office
if(filter.out_officeR.length == 0){
list += " ";
list += ""+get_lang('out office') + " - ( 0 ) " + "" + get_lang("new rule") + "";
}else{
list += " ";
list += ""+get_lang('out office') + " - ( " + filter.out_officeR.length + " )";
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("rule of the email") + ": " + aux[3] + " - " + get_lang("Action") + ": " + aux[6] + "";
}
cfilterSh.prototype.vl_outOffice = function(outOffice){
var aux = outOffice.split("&&");
return " " + get_lang("to answer messages of") + " :" + aux[2] + "- " + get_lang("Status") + " : " + "" + aux[4] + "" + "- " + get_lang("message") + ": " + aux[3] + "";
}
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";
var el2 = document.getElementById("select_2");
for(var i=0; i < filter.email_ld.length; i++){
var opt = new Option(filter.email_ld[i],filter.email_ld[i],false,false);
el2.options[el2.length] = opt;
}
}
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('Management of filters') + ' - ' + get_lang('maintenance of filters') + ':: ';
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();