summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ca55fae)
raw | patch | inline | side by side (parent: ca55fae)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 7 Mar 2007 14:01:42 +0000 (14:01 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 7 Mar 2007 14:01:42 +0000 (14:01 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5756 594d385d-05f5-0310-b6e9-bd551577e9d8
18 files changed:
index bca523f2c9a84df06f383d7780e42adeaf2b3d5c..a8f9aa740e24a1066dae7eca9ae4f8531c8b0659 100644 (file)
{
foreach($this->pap as $key => $obj){
- if(in_array(get_class($obj),array("sieve_if","sieve_vacation"))){
+ if(in_array(get_class($obj),array("sieve_if","sieve_elsif","sieve_vacation","sieve_comment","sieve_reject","sieve_fileinto","sieve_require","sieve_redirect"))){
$this->pap[$key]->save_object();
}
}
index 0b8c5caadfc8f68d4c91e397148b2b5794b442f5..c488aca1400ab0eb26515703911d3b6ec9e501f2 100644 (file)
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]);
$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>";
- return($str);
+ $smarty = get_smarty();
+ $smarty->assign("Name", $name);
+ $smarty->assign("Contents", $this->get_as_html());
+ return($smarty->fetch(get_template_path("templates/element_if_else.tpl",TRUE,dirname(__FILE__))));
}
index 1c62f35fa0bf62c6283a15bbe59c6d5211e93121..ae082422cb979853e584ec142ec7b965e5a3f577 100644 (file)
<?php
-
+/* Sieve else tag */
class sieve_elsif extends sieve_if
{
var $TYPE = "elsif";
}
+/* Sieve comment tag */
class sieve_comment
{
var $data = "";
+ var $object_id= -1;
function get_sieve_script_part()
{
return($this->data."\n");
}
- function sieve_comment($data)
+ function sieve_comment($data,$object_id)
{
+ $this->object_id = $object_id;
foreach($data['ELEMENTS'] as $node){
$this->data .= $node['text'];
}
}
+ function save_object()
+ {
+ if(isset($_POST['comment_'.$this->object_id])){
+ $cm = $_POST['comment_'.$this->object_id];
+ $this->data = "/*".$cm."*/";
+ }
+ }
+
function execute()
{
- $str ="<table cellspacing=0 width='100%'><tr><td style='width:100%;background-color:#DDFFDD;'>"._("Comment");
- $str .="<input type='text' name='comment_' value='".$this->data."'>";
- $str .="</td></tr></table>";
- return($str);
+ $Comment = $this->data;
+
+ /* Remove comment tags */
+ if(preg_match("/^#/",$Comment)){
+ $Comment = preg_replace("/^#/","",$Comment);
+ }elseif(preg_match("#\/\*#",$Comment)){
+ $Comment = preg_replace("#^\/\*#","",$Comment);
+ $Comment = preg_replace("#\*\/$#","",$Comment);
+ }
+
+ /* Create html object */
+ $smarty = get_smarty();
+ $smarty->assign("Comment",$Comment);
+ $smarty->assign("ID",$this->object_id);
+ return($smarty->fetch(get_template_path("templates/element_comment.tpl",TRUE,dirname(__FILE__))));
}
}
class sieve_require
-
{
var $data = array();
-
- function sieve_require($data)
+ var $object_id = -1;
+
+ function sieve_require($data,$object_id)
{
+ $this->object_id = $object_id;
foreach($data['ELEMENTS'] as $node ){
if(in_array($node['class'],array("quoted-string","text"))){
$this->data[] = preg_replace("/\"/","",$node['text']);
}
}
+ function save_object()
+ {
+ /* Get the values should check for, they are seperated by , */
+ if(isset($_POST['require_'.$this->object_id])){
+ $vls = stripslashes($_POST['require_'.$this->object_id]);
+ $tmp = array();
+
+ $tmp2 = split(",",$vls);
+ foreach($tmp2 as $val){
+ $tmp[] = "\"".trim(preg_replace("/\"/","",$val))."\"";
+ }
+ $this->data = $tmp;
+ }
+ }
+
function get_sieve_script_part()
{
$tmp = sieve_create_strings($this->data);
function execute()
{
- $str = "<table cellspacing=0 width='100%'><tr><td style='width:100%;background-color:#DDDDFF;'>"._("Script includes");
- foreach($this->data as $req){
- $str .= " <i>".$req."</i>";
+ $Require = "";
+ foreach($this->data as $key){
+ $Require .= $key.", ";
}
- $str .="</td></tr></table>";
- return($str);
+ $Require = preg_replace("/,$/","",trim($Require));
+
+ $smarty = get_smarty();
+ $smarty->assign("Require",$Require);
+ $smarty->assign("ID",$this->object_id);
+ return($smarty->fetch(get_template_path("templates/element_require.tpl",TRUE,dirname(__FILE__))));
}
}
function execute()
{
- $str = "<table cellspacing=0 width='100%'><tr><td style='width:100%;background-color:red;'>"._("Discard message");
- $str .="</td></tr></table>";
- return($str);
+ $smarty = get_smarty();
+ return($smarty->fetch(get_template_path("templates/element_discard.tpl",TRUE,dirname(__FILE__))));
}
}
class sieve_reject
{
var $data = array();
+ var $object_id = -1;
- function sieve_reject($data)
+ function save_object()
+ {
+ if(isset($_POST['reject_message_'.$this->object_id])){
+ $msg = stripslashes($_POST['reject_message_'.$this->object_id]);
+
+ $this->data = $msg;
+ }
+ }
+
+ 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"))){
function execute()
{
- $str = "<table cellspacing=0 width='100%'><tr><td style='width:100%;background-color:gray;'>"._("Reject mail");
- $str .= " <textarea name='test' style='width:90%'>".$this->data."</textarea>";
- $str .="</td></tr></table>";
- return($str);
+ $smarty = get_smarty();
+ $smarty->assign("ID",$this->object_id);
+ $smarty->assign("Message",$this->data);
+ return($smarty->fetch(get_template_path("templates/element_reject.tpl",TRUE,dirname(__FILE__))));
}
}
class sieve_redirect
{
var $data = array();
+ var $object_id = -1;
- function sieve_redirect($data)
+ function save_object()
+ {
+ if(isset($_POST['redirect_to_'.$this->object_id])){
+ $rt = stripslashes($_POST['redirect_to_'.$this->object_id]);
+
+ $tmp = array();
+ $tmp2 = split(",",$rt);
+ foreach($tmp2 as $val){
+ $tmp[] = "\"".trim(preg_replace("/\"/","",$val))."\"";
+ }
+ $this->data = $tmp;
+ }
+ }
+
+ function sieve_redirect($data,$object_id)
{
foreach($data['ELEMENTS'] as $node ){
if(in_array($node['class'],array("quoted-string","text"))){
function execute()
{
- $str = "<table cellspacing=0 width='100%'><tr><td style='width:100%;background-color:brown;'>"._("Redirect to");
- foreach($this->data as $dest){
- $str .= "<input type='text' name='bal' value='".$dest."'><br> ";
+ $values = "";
+ foreach($this->data as $key){
+ $values .= $key.", ";
}
- $str .="</td></tr></table>";
- return($str);
+ $values = preg_replace("/,$/","",trim($values));
+
+ $smarty = get_smarty();
+ $smarty->assign("Destinations" , $values);
+ $smarty->assign("ID" , $this->object_id);
+ return($smarty->fetch(get_template_path("templates/element_redirect.tpl",TRUE,dirname(__FILE__))));
}
}
class sieve_fileinto
{
- var $data = array();
+ var $data = array();
+ var $object_id= -1;
+ var $options = array();
- function sieve_fileinto($data)
+ function save_object()
{
+ $mbs = $this->get_mail_boxes();
+
+ if(isset($_POST['fileinto_'.$this->object_id])){
+ $mb = $_POST['fileinto_'.$this->object_id];
+
+ if(isset($mbs[$mb])) {
+ $this->data[0] = $mb;
+ }
+ }
+ }
+
+ function sieve_fileinto($data,$object_id)
+ {
+ $this->object_id = $object_id;
foreach($data['ELEMENTS'] as $node ){
if(in_array($node['class'],array("quoted-string","text"))){
$this->data[] = preg_replace("/\"/","",$node['text']);
function execute()
{
- $str = "<table cellspacing=0 width='100%'><tr><td style='width:100%;background-color:green;'>"._("File into");
- $str .= "<select name='test'>";
- foreach($this->data as $folder){
- $str .= "<option>".$folder."</option>";
- }
- $str .= "</select>";
- $str .="</td></tr></table>";
+ $smarty = get_smarty();
+ $smarty->assign("Selected",$this->data[0]);
+ $smarty->assign("Boxes", $this->get_mail_boxes());
+ $smarty->assign("ID", $this->object_id);
+ return($smarty->fetch(get_template_path("templates/element_fileinto.tpl",TRUE,dirname(__FILE__))));
+ }
- return($str);
+ function get_mail_boxes()
+ {
+ return(array("not","impplemented/yet"));
}
}
}
}
-
function execute()
{
$Addresses = "";
$Addresses .= $key.", ";
}
$Addresses = preg_replace("/,$/","",trim($Addresses));
-
$smarty = get_smarty();
$smarty->assign("Reason",$this->reason);
$smarty->assign("Addresses",$Addresses);
{
function execute()
{
- return("<table cellspacing=0 width='100%'>
- <tr>
- <td style='width:20px;'>
- <img alt='' src='images/forward.png' class='center'>
- </td>
- <td style='background-color:#BBBBBB;border: solid 2px #FFFFFF;'>");
+ $smarty = get_smarty();
+ return($smarty->fetch(get_template_path("templates/element_block_start.tpl",TRUE,dirname(__FILE__))));
}
+
function get_sieve_script_part()
{
return("{\n");
}
-
}
class sieve_block_end
{
function execute()
{
- return(" </td>
- </tr>
- </table>");
+ $smarty = get_smarty();
+ return($smarty->fetch(get_template_path("templates/element_block_end.tpl",TRUE,dirname(__FILE__))));
}
function get_sieve_script_part()
{
return("}\n");
}
-
}
/* This class handles the keep statement */
{
function execute()
{
- $str = "<table cellspacing=0 width='100%'>
- <tr>
- <td style='width:100%;background-color:green;'>".
- _("Keep message");
- $str .=" </td>
- </tr>
- </table>";
- return($str);
+ $smarty = get_smarty();
+ return($smarty->fetch(get_template_path("templates/element_keep.tpl",TRUE,dirname(__FILE__))));
}
function get_sieve_script_part()
{
{
function execute()
{
- $str = "<table cellspacing=0 width='100%'>
- <tr>
- <td style='width:100%;background-color:orange;'>".
- _("Stop here");
- $str .=" </td>
- </tr>
- </table>";
- return($str);
+ $smarty = get_smarty();
+ return($smarty->fetch(get_template_path("templates/element_stop.tpl",TRUE,dirname(__FILE__))));
}
function get_sieve_script_part()
index a4e811ab2ed39784cd21f6b3bc8fbe67c0dbb44d..4a79f35da6a327496366be868d9ac785d77b06d9 100644 (file)
<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'>
+ <td style=' text-align:center;
+ vertical-align: middle;
+ width:45px;
+ background-color: #BDBDBD;
+ border: solid 1px #EEEEEE
+ '>
{if $Inverse}
<input type='submit' name='toggle_inverse_{$ID}' value='{t}Not{/t}'>
{else}
index 7eebc2ec82573a91da955f2321c0f6b69a86a22b..bdef028fc00ca3113002769532f9f5eb21b52440 100644 (file)
<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'>
+ <td style=' text-align:center;
+ vertical-align: middle;
+ width:45px;
+ background-color: #AAAAAA;
+ border: solid 1px #EEEEEE
+ '>
{if $Inverse}
<input type='submit' name='toggle_inverse_{$ID}' value='{t}Not{/t}'>
{else}
diff --git a/include/sieve/templates/element_block_end.tpl b/include/sieve/templates/element_block_end.tpl
--- /dev/null
@@ -0,0 +1,3 @@
+ </td>
+ </tr>
+</table>
diff --git a/include/sieve/templates/element_block_start.tpl b/include/sieve/templates/element_block_start.tpl
--- /dev/null
@@ -0,0 +1,8 @@
+<table cellspacing=0 width='100%'>
+ <tr>
+ <td style='width:20px; vertical-align:top;'>
+ <img alt='' src='images/forward.png' class='center'>
+ </td>
+ <td style=' background-color:#BBBBBB;
+ border: solid 1px #DDDDDD;
+ '>
diff --git a/include/sieve/templates/element_comment.tpl b/include/sieve/templates/element_comment.tpl
--- /dev/null
@@ -0,0 +1,12 @@
+<table cellspacing=0 style='width:100%;background-color:#EEEEEE;'>
+ <tr>
+ <td>
+ <b>{t}Comment{/t}</b>
+ </td>
+ </tr>
+ <tr>
+ <td style='padding-left:20px;'>
+ <textarea name='comment_{$ID}' style='width:100%;height:30px'>{$Comment}</textarea>
+ </td>
+ </tr>
+</table>
diff --git a/include/sieve/templates/element_discard.tpl b/include/sieve/templates/element_discard.tpl
--- /dev/null
@@ -0,0 +1,7 @@
+<table cellspacing=0 width='100%'>
+ <tr>
+ <td style='width:100%;background-color:#ffcd77;'>
+ <b>{t}Discard message{/t}</b>
+ </td>
+ </tr>
+</table>
diff --git a/include/sieve/templates/element_exists.tpl b/include/sieve/templates/element_exists.tpl
index 626cf875cb25190d7bbe8dbb73869ac7be5666b9..f8eb322031351a27da2c7397a759a65616d4a9b5 100644 (file)
<table cellspacing=0 cellpadding=2 style='background-color:#EEEEDD;width:100%; border: solid 1px #CCCCCC'>
<tr>
- <td style='vertical-align:top;'>
- <b>{t}Exists{/t}</b>
+ <td style='vertical-align:top; width:20%'>
{if $LastError != ""}
<font color='red'>{$LastError}</font>
<br>
{/if}
{if $Inverse}
- {t}If header attribute does not exists{/t}
+ <input type='submit' name='toggle_inverse_{$ID}' value='{t}Not{/t}'>
{else}
- {t}If header attribute(s) exists{/t}
+ <input type='submit' name='toggle_inverse_{$ID}' value='{t}-{/t}'>
{/if}
+
+ {t}If header attribute(s) exists{/t}
</td>
<td>
- <textarea style='width:300px;height:30px;' name='Values_{$ID}'>{$Values}</textarea>
+ <textarea style='width:99%;height:20px;' name='Values_{$ID}'>{$Values}</textarea>
</td>
- <td>
- <input type='submit'>
- </td>
</tr>
</table>
diff --git a/include/sieve/templates/element_fileinto.tpl b/include/sieve/templates/element_fileinto.tpl
--- /dev/null
@@ -0,0 +1,10 @@
+<table cellspacing=0 width='100%'>
+ <tr>
+ <td style='width:100%;background-color: #99c2ff;'>
+ {t}Move mail into folder{/t}
+ <select name='fileinto_{$ID}'>
+ {html_options options=$Boxes selected=$Selected}
+ </select>
+ </td>
+ </tr>
+</table>
diff --git a/include/sieve/templates/element_if_else.tpl b/include/sieve/templates/element_if_else.tpl
--- /dev/null
@@ -0,0 +1,8 @@
+<table cellspacing=0 width='100%'>
+ <tr>
+ <td style='width:100%;background-color:#ffb23a; padding:5px;'>
+ {$Name}
+ {$Contents}
+ </td>
+ </tr>
+</table>
diff --git a/include/sieve/templates/element_keep.tpl b/include/sieve/templates/element_keep.tpl
--- /dev/null
@@ -0,0 +1,7 @@
+<table cellspacing=0 width='100%'>
+ <tr>
+ <td style='width:100%;background-color:#aeff80;'>
+ <b>{t}Keep message{/t}</b>
+ </td>
+ </tr>
+</table>
diff --git a/include/sieve/templates/element_redirect.tpl b/include/sieve/templates/element_redirect.tpl
--- /dev/null
@@ -0,0 +1,13 @@
+<table cellspacing=0 width='100%' style='background-color: #8cff80'>
+ <tr>
+ <td>
+ <b>{t}Redirect{/t}</b>
+ {t}Redirect mail to following recipients{/t}<b>
+ </td>
+ </tr>
+ <tr>
+ <td style='padding-left:20px;'>
+ <textarea name='redirect_to_{$ID}' style='width:100%; height:30px;'>{$Destinations}</textarea>
+ </td>
+ </tr>
+</table>
diff --git a/include/sieve/templates/element_reject.tpl b/include/sieve/templates/element_reject.tpl
--- /dev/null
@@ -0,0 +1,13 @@
+<table cellspacing=0 width='100%' style='background-color: #ffba4d'>
+ <tr>
+ <td style='width:100%;'>
+ <b>{t}Reject mail{/t}</b>
+
+ </td>
+ </tr>
+ <tr>
+ <td style='padding-left:20px;'>
+ <textarea name='reject_message_{$ID}' style='width:100%'>{$Message}</textarea>
+ </td>
+ </tr>
+</table>
diff --git a/include/sieve/templates/element_require.tpl b/include/sieve/templates/element_require.tpl
--- /dev/null
@@ -0,0 +1,12 @@
+<table cellspacing=0 style='width:100%;background-color:#abffab;'>
+ <tr>
+ <td>
+ <b>{t}Require{/t}</b>
+ </td>
+ </tr>
+ <tr>
+ <td style='padding-left:20px'>
+ <input type='text' name='require_{$ID}' style='width:100%' value='{$Require}'>
+ </td>
+ </tr>
+</table>
diff --git a/include/sieve/templates/element_stop.tpl b/include/sieve/templates/element_stop.tpl
--- /dev/null
@@ -0,0 +1,8 @@
+<table cellspacing=0 width='100%'>
+ <tr>
+ <td style='width:100%;background-color:#ff9999;'>
+ <b>{t}Stop{/t}</b><br>
+ {t}Stop execution here!{/t}
+ </td>
+ </tr>
+</table>
diff --git a/include/sieve/templates/element_vacation.tpl b/include/sieve/templates/element_vacation.tpl
index 4cb133a8b15829d0e0bda345de10150160e261e9..ed6e2b0727e340bc440ac6085da60676a3a17d5b 100644 (file)
{if $Expert}
<tr>
- <td>
+ <td style='width:20%'>
+ <b>{t}Vacation Message{/t}</b>
+ </td>
+ <td style='text-align:right; vertical-align:top;'>
+ <input type='submit' name='Toggle_Expert_{$ID}' value='{t}Normal mode{/t}'>
+ </td>
+ </tr>
+ <tr>
+ <td >
{t}Release date{/t}
+ </td>
+ <td>
<input type='text' name='vacation_release_{$ID}' value='{$Days}'>
-
+ {t}days{/t}
</td>
+ </tr>
+ <tr>
<td>
{t}Receiver{/t}
</td>
- <td style='width:50%;'>
+ <td>
<textarea name='vacation_receiver_{$ID}' style='width:100%;height:20px;'>{$Addresses}</textarea>
</td>
- <td style='text-align:right; vertical-align:top;'>
- <input type='submit' name='Toggle_Expert_{$ID}' value='{t}Normal mode{/t}'>
- </td>
</tr>
<tr>
- <td colspan="4">
+ <td colspan="2">
<textarea name='vacation_reason_{$ID}' style='width:100%;height:60px;'>{$Reason}</textarea>
</td>
</tr>
{else}
<tr>
- <td>
- <textarea name='vacation_reason_{$ID}' style='width:100%;height:60px;'>{$Reason}</textarea>
- </td>
+ <td>
+ <b>{t}Vacation Message{/t}</b>
+ </td>
<td width='10%' style='vertical-align:top;'>
<input type='submit' name='Toggle_Expert_{$ID}' value='{t}Expert mode{/t}'>
</td>
</tr>
+ <tr>
+ <td colspan=2>
+ <textarea name='vacation_reason_{$ID}' style='width:100%;height:60px;'>{$Reason}</textarea>
+ </td>
+ </tr>
{/if}
</table>