summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 76c4c4c)
raw | patch | inline | side by side (parent: 76c4c4c)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 8 Mar 2007 13:54:42 +0000 (13:54 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 8 Mar 2007 13:54:42 +0000 (13:54 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5759 594d385d-05f5-0310-b6e9-bd551577e9d8
index 28ac518bd9bce6075f48a2356254bce04d4ed3d5..9499fd6416135bd576254eef51f8dda75ea26fc9 100644 (file)
{
$tmp ="";
if(count($this->pap)){
- $tmp = "#Generated by GOsa - Gonicus System Administrator\n";
$buffer = "";
foreach($this->pap as $part) {
if(get_class($part) == "sieve_block_end"){
$buffer = substr($buffer,0,strlen($buffer)-(strlen(SIEVE_INDENT_TAB)));
}
$tmp2 = $part->get_sieve_script_part();
- $tmp3 = split("\n",$tmp2);
- foreach($tmp3 as $str){
- $str2 = trim($str);
- if(empty($str2)) continue;
- $tmp.= $buffer.$str."\n";
+
+ if(get_class($part) == "sieve_reject"){
+ $tmp.=$tmp2;
+ }else{
+
+ $tmp3 = split("\n",$tmp2);
+ foreach($tmp3 as $str){
+ $str2 = trim($str);
+ if(empty($str2)) continue;
+ $tmp.= $buffer.$str."\n";
+ }
}
if(get_class($part) == "sieve_block_start"){
$buffer .= SIEVE_INDENT_TAB;
}
}
}
+ if(!preg_match("/Generated by GOsa - Gonicus System Administrator/",$tmp)){
+ $tmp = "#Generated by GOsa - Gonicus System Administrator \n ".$tmp;
+ }
return($tmp);
}
}
$ret = "[".$ret."]";
}
}else{
- $ret = "\"".$data."\"";
+
+ $Multiline = preg_match("/\n/",$data);
+ $data = preg_replace("/\r/","",$data);;
+
+ if($Multiline){
+ $ret = "text: \r\n".$data."\r\n.\r\n";
+ }else{
+ $ret = "\"".$data."\"";
+ }
}
$ret = preg_replace("/\"\"/","\"",$ret);
+ $ret = preg_replace("/\n/","\r\n",$ret);
+
return($ret);
}
index 3e22bb1d0ee8c6a3a2aae7b6662fa35da5e54a50..2a7fc37d2e77a0b7aec019bc1cdeeb4293a679d3 100644 (file)
}
}
}
-
array_push($this->tokens_, array(
'class' => 'script-end',
'text' => 'script-end',
'quoted-string' => '"(?:\\[\\"]|[^\x00"])*"',
'number' => '[[:digit:]]+(?:[KMG])?(?=\b)',
'comment' => '(?:\/\*(?:[^\*]|\*(?=[^\/]))*\*\/|#[^\r\n]*\r?\n)',
- 'multi-line' => 'text:[ \t]*(?:#[^\r\n]*)?\r?\n(\.[^\r\n]+\r?\n|[^\.]*\r?\n)*\.\r?\n',
+# 'multi-line' => 'text:[ \t]*(?:#[^\r\n]*)?\r?\n(\.[^\r\n]+\r?\n|[^\.]*\r?\n)*\.\r?\n',
+ 'multi-line' => 'text:[^;]*',
'identifier' => '[[:alpha:]_][[:alnum:]_]*(?=\b)',
'unknown token' => '[^ \r\n\t]+'
);
}
-?>
\ No newline at end of file
+?>
index 80e893ebc9bb6af397d74229fc87ed3ca939f026..e37d5c6313541234afa95c7d207867dbcef42ea4 100644 (file)
'valid_after' => array('require', 'if', 'elsif', 'else', 'reject', 'fileinto', 'redirect', 'stop', 'keep', 'discard'),
'arguments' => array(
array('class' => 'string', 'occurrences' => '1', 'values' => array(
- array('occurrences' => '1', 'regex' => '".*"', 'name' => 'reason')
+ array('occurrences' => '1', 'regex' => '.*', 'name' => 'reason')
))
)
);
index 42ab948f9b8808a7a7d07ad8da3066fad90bbb62..199e03bc7cd8381a82cfa435fa645828c8d85e72 100644 (file)
var $data = array();
var $object_id = -1;
+
function save_object()
{
if(isset($_POST['reject_message_'.$this->object_id])){
$this->object_id = $object_id;
$str = "";
foreach($data['ELEMENTS'] as $node ){
- if(in_array($node['class'],array("quoted-string","text"))){
- $str .= $node['text'];
+ 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);
function get_sieve_script_part()
{
- return("reject ".sieve_create_strings($this->data)."\n");
+ return("reject ".sieve_create_strings($this->data).";\n");
}
function execute()
{
+ /* check if this will be a
+ * - single string ""
+ * - or a multi line text: ... ;
+ */
+ $Multiline = preg_match("/\n/",$this->data);
+
$smarty = get_smarty();
$smarty->assign("ID",$this->object_id);
+ $smarty->assign("Multiline",$Multiline);
$smarty->assign("Message",$this->data);
return($smarty->fetch(get_template_path("templates/element_reject.tpl",TRUE,dirname(__FILE__))));
}
}
}
+
function sieve_redirect($data,$object_id)
{
foreach($data['ELEMENTS'] as $node ){
}
}
+
function get_sieve_script_part()
{
$tmp = "";
foreach($this->data as $dat){
$tmp.= "\"".$dat."\", ";
}
- $tmp = "[".preg_replace("/,$/","",trim($tmp))."]";
+ $tmp = preg_replace("/,$/","",trim($tmp));
$tmp = preg_replace ("/\"\"/","\"",$tmp);
- return("redirect ".$tmp."\n");
+ return("redirect ".$tmp.";\n");
}
-
+
+
function execute()
{
$values = "";
foreach($this->data as $dat){
$tmp.= "\"".$dat."\", ";
}
- $tmp = "[".preg_replace("/,$/","",trim($tmp))."]";
+ $tmp = preg_replace("/,$/","",trim($tmp));
$tmp = preg_replace ("/\"\"/","\"",$tmp);
- return("fileinto ".$tmp."\n");
+ return("fileinto ".$tmp.";\n");
}
function execute()
if($this->mime){
$str.= ":mime ".sieve_create_strings($this->mime);
}
- $str .= " ".sieve_create_strings($this->reason);
- return($str."\n");
+ $str .= "\n ".sieve_create_strings($this->reason);
+ return($str." ; \n");
}
index 4784011debc98d82186e748fdbf6297acc7882a3..ea355b2e3937a2c08108555cc388d385942807ab 100644 (file)
$ret = $p->parse($script);
if(!$ret){
$this->scripts[$key]['MSG'] = "<font color='red'>".$p->status_text."</font>";
- $this->scripts[$key]['STATUS'] = _("Parse failed");
+ $this->scripts[$key]['STATUS'] = _("Parse failed")."<font color='red'>".$p->status_text."</font>";
}else{
$this->scripts[$key]['STATUS'] = _("Parse successful");
}
foreach($this->scripts as $key => $script){
if($script['EDITED']){
$data = $script['PARSER']->get_sieve_script();
- if(!$this->sieve_handle->sieve_sendscript($script['NAME']."1", $data)){
+ if(!$this->sieve_handle->sieve_sendscript($script['NAME'], $data)){
gosa_log("Failed to save sieve script named '".$script['NAME']."': ".to_string($this->sieve_handle->error_raw));
$everything_went_fine = FALSE;
print_red(to_string($this->sieve_handle->error_raw));
diff --git a/include/sieve/templates/element_reject.tpl b/include/sieve/templates/element_reject.tpl
index 28483346f8988b579db87444d01e3cfbd1bccff3..f5cd572a66aa3920ab16481bf51d18a9fd602c63 100644 (file)
<td style='width:100%;'>
<b>{t}Reject mail{/t}</b>
+ {if $Multiline}
+ {t}This will be a multiline text element{/t}
+ {else}
+ {t}this will be stored as single string{/t}
+ {/if}
</td>
</tr>
<tr>
<td style='padding-left:20px;'>
- <textarea name='reject_message_{$ID}' style='width:100%'>{$Message}</textarea>
+ <textarea name='reject_message_{$ID}' style='width:100%;height:100px;' >{$Message}</textarea>
</td>
</tr>
</table>