summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 77a475f)
raw | patch | inline | side by side (parent: 77a475f)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 15 Mar 2007 09:51:45 +0000 (09:51 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 15 Mar 2007 09:51:45 +0000 (09:51 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5785 594d385d-05f5-0310-b6e9-bd551577e9d8
index d9a70f3b9084bb41fb45d63bbc11c79f23c1bd95..1663fdf4082e6a170803552d1a6024f97f610921 100644 (file)
}
break;
}
+
+ /*******************
+ * True / False
+ *******************/
+
+ case "true" :
+ case "fasle" :
+ {
+ /* Can't fail anyway */
+ break;
+ }
/*******************
* Default
{
if(isset($data['LastError']) && !empty($data['LastError'])){
$ret[] = $data['LastError'];
-
- echo "'".$data['LastError']."' ".$key."<br>" ;
}
}
}
diff --git a/include/sieve/class_sieveElement_Reject.inc b/include/sieve/class_sieveElement_Reject.inc
index e930456fd8a0dd69c851f410f2629177526756ed..6c0a6f5b6472e79db98467dc77837dfb36886bb7 100644 (file)
class sieve_reject
{
- var $data = array();
+ var $data = "";
var $object_id = -1;
function sieve_reject($data,$object_id)
{
$this->object_id = $object_id;
- $str = "";
- foreach($data['ELEMENTS'] as $node ){
- if(in_array($node['class'],array("quoted-string","text","multi-line"))){
- if($node['class'] == "multi-line"){
- $str .= preg_replace("/^text:[ \n\r]*/","",$node['text']);
- $str = preg_replace("/[ \n\r]*\.[ \n\r]*$/","",$str);
- }else{
- $str .= $node['text'];
+ /* If the given data is emtpy
+ * (This is the case when we add new elements in the ui)
+ * Set a default text.
+ */
+ if($data == NULL){
+ $this->data = _("Your reject text here");
+ }else{
+
+ /* Get reject text */
+ $str = "";
+ foreach($data['ELEMENTS'] as $node ){
+ if(in_array($node['class'],array("quoted-string","text","multi-line"))){
+
+ if($node['class'] == "multi-line"){
+ $str .= preg_replace("/^text:[ \n\r]*/","",$node['text']);
+ $str = preg_replace("/[ \n\r]*\.[ \n\r]*$/","",$str);
+ }else{
+ $str .= $node['text'];
+ }
}
}
+ $this->data = preg_replace("/\"/","",$str);
}
- $this->data = preg_replace("/\"/","",$str);
}
function get_sieve_script_part()
{
return("reject ".sieve_create_strings($this->data).";\n");
}
-
+
function execute()
{
/* check if this will be a
return($str);
}
}
-
-
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/include/sieve/class_sieveElement_Vacation.inc b/include/sieve/class_sieveElement_Vacation.inc
index ec3250d4842c526a10c69678ea111c037f010c51..f2a562fcaaf518ccc820a70de711c825c734d129 100644 (file)
if($this->days){
$str.= ":days ".$this->days;
}
- $str .= ":addresses ".sieve_create_strings($this->addresses);
- if($this->subject){
- $str.= ":subject ".sieve_create_strings($this->subject);
+
+ if(count($this->addresses)){
+ $str .= ":addresses ".sieve_create_strings($this->addresses);
+ if($this->subject){
+ $str.= ":subject ".sieve_create_strings($this->subject);
+ }
}
if($this->mime){
$str.= ":mime ".sieve_create_strings($this->mime);
$tmp = array();
$tmp2 = split(",",$vr);
foreach($tmp2 as $val){
- $tmp[] = "\"".trim(preg_replace("/\"/","",$val))."\"";
+ $ad = trim(preg_replace("/\"/","",$val));
+ if(!empty($ad)){
+ $tmp[] = "\"".$ad."\"";
+ }
}
$this->addresses = $tmp;
}
function check()
{
- return(array()) ;
+ $msgs = array();
+ $err = FALSE;
+ foreach($this->addresses as $addr){
+ if(!is_email(preg_replace("/\"/","",$addr))){
+ $err = true;
+ }
+ }
+ if($err){
+ $msgs[] = _("Alternative sender addresse must be valid email addresses.");
+ }
+ return($msgs);
}
function execute()
$Addresses = preg_replace("/,$/","",trim($Addresses));
$smarty = get_smarty();
+ $smarty->assign("LastError",$this->check());
+ $smarty->assign("LastErrorCnt",count($this->check()));
$smarty->assign("Reason",$this->reason);
$smarty->assign("Addresses",$Addresses);
$smarty->assign("Subject",$this->subject);
diff --git a/include/sieve/templates/element_vacation.tpl b/include/sieve/templates/element_vacation.tpl
index ed6e2b0727e340bc440ac6085da60676a3a17d5b..837267805c6d2e852501d52bd2170dadcfb42450 100644 (file)
+{if $LastErrorCnt != 0}
+ <table style='width:100%;'>
+ <tr>
+ <td style='width:40px; background-color: #FF0000; text-align:center; border: dotted 3px #ff7c1c'>
+ <img src='images/warning.png' alt='{t}Error{/t}'>
+ </td>
+ <td>
+{/if}
<table cellspacing=0 cellpadding=2 style='background-color:#EEEEDD;width:100%; border: solid 1px #CCCCCC'>
+ {foreach from=$LastError item=val key=key}
+ <tr>
+ <td colspan=4>
+ <font color='red'><b>{$LastError[$key]}</b></font>
+ </td>
+ </tr>
+ {/foreach}
{if $Expert}
<tr>
<td style='width:20%'>
</tr>
<tr>
<td>
- {t}Receiver{/t}
+ {t}Alternative sender addresses{/t}
</td>
<td>
<textarea name='vacation_receiver_{$ID}' style='width:100%;height:20px;'>{$Addresses}</textarea>
{/if}
</table>
+{if $LastErrorCnt != 0}
+
+ </td>
+ </tr>
+ </table>
+{/if}
+
+