index 9df232b5d8ee90d7d39ab6489f021223de35e3d0..05f4895141ed53d8f739a4e24f7e1888d3b6964b 100644 (file)
var $comparators = array();
var $match_types = array();
var $operators = array();
-
+ var $parent = NULL;
/* Initialize class
* $elements contains all tokens that belongs to this if/else tag
* $object_id cotains an unique tag id, to be able to create uniqe html post names
*/
- function sieve_if($elements,$object_id)
+ function sieve_if($elements,$object_id,$parent)
{
+ $this->parent = $parent;
+
/* Possible address parts we can select */
$this->address_parts = array(
":all" => _("Complete adress")." ("._("Default").")",
*******************/
case "true" :
- case "fasle" :
+ case "false" :
{
/* Can't fail anyway */
break;
}
/* Add allof/anyof tag */
- $script.= " ".$key." ( ";
+ if($Inverse){
+ $script .= "not ";
+ }
+ $script.= $key." ( ";
/* Add each test parameter */
foreach($data as $key2 => $dat){
$values["Address_Part"] = ":all";
}
$data[$type]=$values;
+
+ $this->parent->add_require("relational");
+ if($type == "envelope"){
+ $this->parent->add_require("envelope");
+ }
+
+
break;
}
case "allof" :
{
$tmp= array(
"Inverse" => FALSE,
- "Match_type" => ":contains",
- "Value_List" => array(1,"M"));
+ "Match_type" => ":over",
+ "Value_List" => array("1M"));
$tmp['LastError'] = "";
$data[$type] = $tmp;
$parsed[$key]['LastError'] = _("Invalid operator given.");
}
$parsed[$key]['Comparator'] = $cp;
+
+ if($cp == "i;ascii-numeric"){
+ $this->parent->add_require("comparator-i;ascii-numeric");
+ }
}
/* In case of :count and :value match types
$Units = array( "M" => _("Megabyte") ,
"K" => _("Kilobyte"));
+ /* Toggle Inverse ? */
+ if(isset($_POST['toggle_inverse_'.$element_id])){
+ $parsed[$key]['Inverse'] = !$parsed[$key]['Inverse'];
+ }
+
/* Reset error */
$parsed[$key]['LastError'] ="";
}
default :
{
- $ret = "<table width='100%' cellspacing=0 cellpadding=0>
- <tr>
- <td style='background-color: #FEDCA9 ; border: solid 1px #EEEEEE'>";
- $ret.= $key."<br>";
- $ret.= " </td>
- </tr>
- </table>";
+ trigger_error(_("Unhandled switch type"));
}
}
}