index 03934e4603e8bf963a60a520f5a60caf6956fab3..4c61ca676729c75536d519f266aef809938c5fac 100644 (file)
/* Add special match type for count and value */
if(in_array($data['Match_type'], array(":value",":count")) && !empty($data['Match_type_value'])) {
- $script .= $data['Match_type_value']." ";
+ $script .= sieve_create_strings($data['Match_type_value'])." ";
}
$script .= sieve_create_strings($data['Key_List']);
/* Add special match type for count and value */
if(in_array($data['Match_type'], array(":value",":count")) && !empty($data['Match_type_value'])) {
- $script .= $data['Match_type_value']." ";
+ $script .= sieve_create_strings($data['Match_type_value'])." ";
}
$script .= sieve_create_strings($data['Key_List']);
/* Add special match type for count and value */
if(in_array($data['Match_type'], array(":value",":count")) && !empty($data['Match_type_value'])) {
- $script .= $data['Match_type_value']." ";
+ $script .= sieve_create_strings($data['Match_type_value'])." ";
}
$script .= sieve_create_strings($data['Key_List']);
case "exists" :
{
+ /* Toggle Inverse ? */
+ if(isset($_POST['toggle_inverse_'.$element_id])){
+ $parsed[$key]['Inverse'] = !$parsed[$key]['Inverse'];
+ }
+
/* get list of match values */
if(isset($_POST['Values_'.$element_id])){
$vls = stripslashes($_POST['Values_'.$element_id]);
case "allof" :
{
+ if(isset($_POST['toggle_inverse_'.$element_id])){
+ $parsed[$key]['Inverse'] = !$parsed[$key]['Inverse'];
+ }
foreach($data as $key2 => $dat){
if(($key2 === "Inverse") && ($key2 == "Inverse")){
continue;
case "anyof" :
{
+ if(isset($_POST['toggle_inverse_'.$element_id])){
+ $parsed[$key]['Inverse'] = !$parsed[$key]['Inverse'];
+ }
foreach($data as $key2 => $dat){
if(($key2 === "Inverse") && ($key2 == "Inverse")){
continue;
$name .= " - "._("Else");
}
- /* Create new html block */
- $str ="<table cellspacing=0 width='100%'>
- <tr>
- <td style='width:100%;background-color:#DDDDDD; padding:5px; border: solid 2px #AAAAAA;'>".
- $name;
- $str .= $this->get_as_html();
- $str .= " </td>
- </tr>
- </table>";
+ $smarty = get_smarty();
+ $smarty->assign("ID", $this->id);
+
+ /* Only display navigation elements if necessary */
+ if($this->TYPE == "if"){
+ $object_container = $smarty->fetch(get_template_path("templates/object_container.tpl",TRUE,dirname(__FILE__)));
+ }else{
+ $object_container = $smarty->fetch(get_template_path("templates/object_container_clear.tpl",TRUE,dirname(__FILE__)));
+ }
+
+ $smarty->assign("Name", $name);
+ $smarty->assign("Contents", $this->get_as_html());
+ $object = $smarty->fetch(get_template_path("templates/element_if_else.tpl",TRUE,dirname(__FILE__)));
+
+
+
+ $str = preg_replace("/%%OBJECT_CONTENT%%/",$object,$object_container);
+
+
return($str);
}
break;
}
+
+ /*******************
+ * Envelope
+ *******************/
+
case "envelope":
{
$address_parts = $this->address_parts;
$smarty->assign("match_type", $data['Match_type']);
$smarty->assign("operator" , preg_replace("/\"/","",$data['Match_type_value']));
$smarty->assign("comparator", $data['Comparator']);
-
$keys = "";
foreach($data['Key_List'] as $key){
- $keys .= $key."\n";
+ $keys .= $key.", ";
}
-
+ $keys = preg_replace("/,$/","",trim($keys));
+
$values = "";
foreach($data['Value_List'] as $key){
- $values .= $key."\n";
+ $values .= $key.", ";
}
+ $values = preg_replace("/,$/","",trim($values));
$smarty->assign("keys",$keys);
$smarty->assign("values",$values);
-
$smarty->assign("ID" , $element_id);
$ret .= $smarty->fetch(get_template_path("templates/element_envelope.tpl",TRUE,dirname(__FILE__)));
break;
}
+
+ /*******************
+ * Address
+ *******************/
+
case "address" :
{
$address_parts = $this->address_parts;
case "allof" :
{
- $ret = "<table width='100%' cellspacing=0 cellpadding=0>
- <tr>
- <td style='text-align:center; vertical-align: middle; width:45px;
- background-color: #BDBDBD; border: solid 1px #EEEEEE'>".
- "<b>".$str_inverse._("All of")."</b>".
- "<img alt='' class='center' src='images/select_ogroup.png'>".
- "</td>";
- $ret.= " <td style='background-color:#BDBDBD ; border: solid 1px #EEEEEE'>";
-
+ $Contents = "";
foreach($data as $key => $dat){
if(($key === "Inverse") && ($key == "Inverse")){
continue;
}
- $ret.= $this->get_as_html($dat, ($id +1),$key);
+ $Contents .= $this->get_as_html($dat, ($id +1),$key);
}
- $ret.= " </td>
- </tr>
- </table>";
+ $smarty = get_smarty();
+ $smarty->assign("Inverse",$Inverse);
+ $smarty->assign("Contents",$Contents);
+ $smarty->assign("ID" , $element_id);
+ $ret .= $smarty->fetch(get_template_path("templates/element_allof.tpl",TRUE,dirname(__FILE__)));
break ;
}
case "anyof" :
{
- $ret = "<table width='100%' cellspacing=0 cellpadding=0>
- <tr>
- <td style='text-align:center; vertical-align: middle; width:45px;
- background-color: #AAAAAA; border: solid 1px #EEEEEE'>".
- "<b>".$str_inverse._("Any of")."</b>".
- "<img alt='' class='center' src='images/select_department.png'>".
- "</td>";
- $ret.= " <td style='background-color: #AAAAAA ; border: solid 1px #EEEEEE'>";
+ $Contents = "";
foreach($data as $key => $dat){
if(($key === "Inverse") && ($key == "Inverse")){
continue;
}
- $ret.= $this->get_as_html($dat, ($id + 1),$key);
+ $Contents .= $this->get_as_html($dat, ($id +1),$key);
}
+ $smarty = get_smarty();
+ $smarty->assign("Inverse",$Inverse);
+ $smarty->assign("Contents",$Contents);
+ $smarty->assign("ID" , $element_id);
+ $ret .= $smarty->fetch(get_template_path("templates/element_anyof.tpl",TRUE,dirname(__FILE__)));
+ break ;
+ }
+ 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>";
- break ;
}
- 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>";
-
- }
}
}
return($ret);