Ticket #1056: sieve_filters.diff

File sieve_filters.diff, 2.7 KB (added by amuller, 14 years ago)
  • inc/class.ScriptS.inc.php

     
    6060         
    6161                        $aux = $this->SieveS->putscript($this->scriptfile, $this->createScript()); 
    6262                        if(!$aux){ 
    63                                 // Caso de erro, grava dentro da variável errstr; 
    64                                 $this->errstr = "O arquivo não foi criado"; 
     63                                $this->errstr = "Error: file not created"; 
     64                                return $this->errstr; 
    6565                        } 
    6666                        // Mata a variavel; 
    6767                        unset($aux); 
     
    6969                        $aux = $this->SieveS->activatescript($this->scriptfile); 
    7070                         
    7171                        if(!$aux){ 
    72                                 // Caso de erro, grava dentro da variavel errstr; 
    73                                 $this->errstr = "O arquivo não foi ativado"; 
     72                                $this->errstr = "Error: error to activate file"; 
     73                                return $this->errstr; 
    7474                        } 
    7575                        else{ 
    7676                                $this->reply = $this->SieveS->getscript(); 
     
    8383                //Fecha a conexao 
    8484                $this->SieveS->close(); 
    8585                         
    86                 if($this->rules){                
     86                if($this->rules) 
    8787                        return $this->rules; 
    88                 }else{ 
    89                         return $this->errstr; 
    90                 } 
    9188                         
    9289        } 
    9390         
     
    9895                $newr3  = array(); 
    9996         
    10097                $var_decode = rawurldecode($params['arfilter']); 
     98                $var_decode = preg_replace('/\n\./', '.', $var_decode); 
    10199                 
    102100                $narray  = explode("_end_",$var_decode); 
    103101 
  • js/filter.js

     
    1010 
    1111        function cfilter(){ 
    1212 
     13                this.criticalError = false; 
    1314                this.mode_in   = ""; 
    1415                this.rulest              = new Array; 
    1516                this.rulesVoip   = new Array; 
     
    4546                var _this = this; 
    4647                var cont1 = parseInt(0); 
    4748                var cont2 = parseInt(0); 
    48                                  
     49         
    4950                if( _this.rulest.length == 0 ) 
    5051                { 
    5152                        var handler_sieve = function(data) 
    5253                        { 
     54                                if (data.indexOf('Error:') == 0) 
     55                                { 
     56                                        _this.criticalError = true; 
     57                                        alert(data); 
     58                                } 
     59                                else 
     60                                try{ 
    5361                                if(data.rule.length > 0){ 
    5462                                        for(var i=0 ; i < data.rule.length; i++) 
    5563                                        { 
     
    6371                                _this.out_officeR = data.vacation[0]; 
    6472                                _this.out_officeR = _this.out_officeR ? trim(_this.out_officeR.toString().replace("\n","")) : ""; 
    6573                                if(data.mode.length > 0){_this.mode_in = data.mode[0];} 
     74                                } 
     75                                catch(e){ 
     76                                        _this.criticalError = true; 
     77                                        alert("Expresso:"+e.description); 
     78                                } 
    6679                        } 
    6780                        if(Element('form_status') != null) 
    6881                                Element('form_status').innerHTML = "<span style='background:#cc4444;'>&nbsp;&nbsp;<font color='WHITE'>Aguarde...</font>&nbsp;</span>"; 
     
    746759                } 
    747760                var args   = "$this.ScriptS.rec_rules"; 
    748761                var params = "arfilter="+aux_rul; 
    749                 cExecute(args,h_filter,params); 
     762                if(!_this.criticalError) 
     763                        cExecute(args,h_filter,params); 
    750764        } 
    751765 
    752766// build object