Changeset 3018 for branches/2.2/expressoMail1_2/js/filter.js
- Timestamp:
- 07/08/10 17:52:20 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/expressoMail1_2/js/filter.js
r1546 r3018 11 11 function cfilter(){ 12 12 13 this.criticalError = false; 13 14 this.mode_in = ""; 14 15 this.rulest = new Array; … … 41 42 42 43 43 cfilter.prototype.load_rules = function( )44 cfilter.prototype.load_rules = function(posHandler, param) 44 45 { 45 46 var _this = this; 46 47 var cont1 = parseInt(0); 47 48 var cont2 = parseInt(0); 48 49 49 50 if( _this.rulest.length == 0 ) 50 51 { 51 52 var handler_sieve = function(data) 52 53 { 54 if (data.toString().indexOf('Error:') == 0) 55 { 56 _this.criticalError = true; 57 alert(get_lang('The filters service is out of service, try again later...')); 58 } 59 else 60 try{ 53 61 if(data.rule.length > 0){ 54 62 for(var i=0 ; i < data.rule.length; i++) … … 64 72 _this.out_officeR = _this.out_officeR ? trim(_this.out_officeR.toString().replace("\n","")) : ""; 65 73 if(data.mode.length > 0){_this.mode_in = data.mode[0];} 74 } 75 catch(e){ 76 _this.criticalError = true; 77 alert(get_lang('The filters service is out of service, try again later...')); 78 } 79 if (typeof(posHandler) == 'function') 80 posHandler(param); 66 81 } 67 82 if(Element('form_status') != null) … … 381 396 this.reload_rules(); 382 397 } 383 384 cfilter.prototype.new_rule = function(email){ 385 386 if(this.email_deny.length > 0){ 387 for(var i=0 ; i < this.email_deny.length; i++){ 388 if(this.email_deny[i] == email){ 389 alert(get_lang("Sender blocked")+"!"); 390 return false; 391 } 392 } 393 } 394 395 // Verifica Email 396 var emailReg = /^[a-z][a-z-_0-9\.]+@[a-z-_=>0-9\.]+\.[a-z]{2,3}$/i 397 if(!emailReg.test(email)){ 398 alert(get_lang("Inform a valid e-mail!")); 399 return false; 400 } 401 402 this.load_rules(); 403 if(confirm(get_lang("Do you want to block this e-mail?"))){ 404 new_r = "&&ENABLED&&" + email + "&&&&&&discard&&&&0&&&&&&0"; 405 // setTimeout("filter.e_newrule('" + new_r + "')",2000); 406 if (filter.e_newrule(new_r)){ 407 this.email_deny.push(email); 408 write_msg(get_lang("The sender was blocked")); 409 }else 410 write_msg(get_lang("You have reached the maximum number of rules")); 411 } 412 } 413 398 399 cfilter.prototype.new_rule = function(email){ 400 401 var createFilter = function (param){ 402 if (filter.criticalError){ 403 alert(get_lang('The filters service is out of service, try again later...')); 404 return false; 405 } 406 if(filter.rulest.length > 0){ 407 var blockedReg = new RegExp('#rule&&[0-9]+&&ENABLED&&'+param+'&&&&&&discard&&&&0&&&&&&0'); 408 for(var i=0 ; i < filter.rulest.length; i++){ 409 if(blockedReg.test(filter.rulest[i])){ 410 alert(get_lang("Sender blocked")+"!"); 411 return false; 412 } 413 } 414 } 415 if(confirm(get_lang("Do you want to block this e-mail?"))){ 416 new_r = "&&ENABLED&&" + param + "&&&&&&discard&&&&0&&&&&&0"; 417 //setTimeout("filter.e_newrule('" + new_r + "')",2000); 418 if (filter.e_newrule(new_r)){ 419 filter.email_deny.push(new_r); 420 write_msg(get_lang("The sender was blocked")); 421 }else 422 write_msg(get_lang("You have reached the maximum number of rules")); 423 } 424 }; 425 if ( filter.rulest.length > 0 ) 426 createFilter(email); 427 else 428 this.load_rules( createFilter, email ); 429 } 430 414 431 cfilter.prototype.e_newrule = function(nw_rule) 415 432 { … … 747 764 var args = "$this.ScriptS.rec_rules"; 748 765 var params = "arfilter="+aux_rul; 749 cExecute(args,h_filter,params); 766 if(!_this.criticalError) 767 cExecute(args,h_filter,params); 750 768 } 751 769
Note: See TracChangeset
for help on using the changeset viewer.