summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f3a9054)
raw | patch | inline | side by side (parent: f3a9054)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 13 Mar 2007 14:08:10 +0000 (14:08 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 13 Mar 2007 14:08:10 +0000 (14:08 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5776 594d385d-05f5-0310-b6e9-bd551577e9d8
index 1816f92b74695e5b4279a1d8eec2b7f218aa8ef5..826817b88778fd5c649ee4abf2656356de6d9130 100644 (file)
var $add_new = FALSE;
var $add_new_id = 0;
- var $add_type = "up";
+ var $add_type = "top";
var $add_element_type = "";
/* Create a html interface for the current sieve filter
if($this->add_new && isset($_POST['select_new_element_type'])){
- $ele = new $this->add_element_type(array(),microtime());
-
- $this->pap[] = $ele;
- $this->add_new = FALSE;
+ $ele = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()));
+ $start = $end = array();
+ $found = false;
+
+ if($this->add_type == "top"){
+ foreach($this->pap as $key => $obj){
+ if($obj->object_id == $this->add_new_id){
+ $found = true;
+ }
+ if(!$found){
+ $start[] = $obj;
+ }else{
+ $end[] = $obj;
+ }
+ }
+ }else{
+ foreach($this->pap as $key => $obj){
+ if(!$found){
+ $start[] = $obj;
+ }else{
+ $end[] = $obj;
+ }
+ if($obj->object_id == $this->add_new_id){
+ $found = true;
+ }
+ }
+ }
+
+ if($found){
+ $new = array();
+ foreach($start as $obj){
+ $new[] = $obj;
+ }
+ $new[] = $ele;
+ foreach($end as $obj){
+ $new[] = $obj;
+ }
+ $this->pap = $new;
+ $this->add_new = FALSE;
+ }else{
+ print_red(_("Something went wrong while adding a new entry."));
+ }
}
if($this->add_new){
diff --git a/include/sieve/class_sieveElement_Block_End.inc b/include/sieve/class_sieveElement_Block_End.inc
index 403585f8923663c668feee150d13e7bba6ea0ac4..8f5739f1c187f86937b3f83980e589d3942d61c9 100644 (file)
class sieve_block_end
{
+ var $object_id= -1;
+
+ function sieve_block_end($data = NULL,$object_id)
+ {
+ $this->object_id = $object_id;
+ }
+
function execute()
{
$smarty = get_smarty();
diff --git a/include/sieve/class_sieveElement_Block_Start.inc b/include/sieve/class_sieveElement_Block_Start.inc
index 799f1fa84d77bccedfaddce7a72c252bdec0062b..fc924ce8fdd31cd0e3d920c53f4a6dd8f658a6e8 100644 (file)
class sieve_block_start
{
+ var $object_id= -1;
+
+ function sieve_block_start($data = NULL,$object_id)
+ {
+ $this->object_id = $object_id;
+ }
+
function execute()
{
$smarty = get_smarty();
diff --git a/include/sieve/class_sieveElement_Comment.inc b/include/sieve/class_sieveElement_Comment.inc
index d3f6747dd5eaa7f18c968030473524688990e394..0b718b80489b401cf5b21ae011f1e88c6cdb5990 100644 (file)
function sieve_comment($data,$object_id)
{
$this->object_id = $object_id;
+
+ if($data == NULL){
+ $data = array('ELEMENTS' => array(array('class' => "quoted-string" ,"text" => _("Your comment here"))));
+ }
+
foreach($data['ELEMENTS'] as $node){
$this->data .= $node['text'];
}
}
+ function check()
+ {
+ return(array()) ;
+ }
+
function save_object()
{
if(isset($_POST['comment_'.$this->object_id])){
diff --git a/include/sieve/class_sieveElement_Discard.inc b/include/sieve/class_sieveElement_Discard.inc
index 5998164b6de7ae57c4f50d3cfcd0b6d0cd4dc8e2..504fe4adb059265326e7b07442a0df3ed910a777 100644 (file)
{
return("discard;\n");
}
+ function check()
+ {
+ return(array()) ;
+ }
+
function save_object()
{
diff --git a/include/sieve/class_sieveElement_Fileinto.inc b/include/sieve/class_sieveElement_Fileinto.inc
index e595250aa581d54d773a9f7391e7bdfd429fd396..c15dc444ca27c33546c46a436ede7195df8775a9 100644 (file)
return($str);
}
+ function check()
+ {
+ return(array());
+ }
+
function get_mail_boxes()
{
return(array("not"=>"not","impplemented/yet"=>"impplemented/yet"));
diff --git a/include/sieve/class_sieveElement_Redirect.inc b/include/sieve/class_sieveElement_Redirect.inc
index 13b851e72af79d3681d155d5610c866d6e2ac50e..de599151e03105acf9e2bfe599604e316d45bb4a 100644 (file)
{
var $data = array();
var $object_id = -1;
-
+ var $LastError ="";
+
function save_object()
{
if(isset($_POST['redirect_to_'.$this->object_id])){
}
+ function check()
+ {
+ $msgs = array();
+
+ if(!is_email(preg_replace("/\"/","",$this->data))){
+ $msgs[] =_("Please specify a valid email address.");
+ }
+
+ return($msgs);
+ }
+
function sieve_redirect($data,$object_id)
{
+ $this->object_id = $object_id;
+
+ if($data == NULL){
+ $data = array('ELEMENTS' => array(array('class' => "quoted-string" ,"text" => _("Put a mail address here"))));
+ }
+
foreach($data['ELEMENTS'] as $node ){
if(in_array($node['class'],array("quoted-string","text"))){
$this->data = $node['text'];
$smarty = get_smarty();
$smarty->assign("ID", $this->object_id);
$smarty->assign("Destinations" , $values);
+ $smarty->assign("LastError" , $this->check());
+ $smarty->assign("LastErrorCnt" , count($this->check()));
$object_container = $smarty->fetch(get_template_path("templates/object_container.tpl",TRUE,dirname(__FILE__)));
$object= $smarty->fetch(get_template_path("templates/element_redirect.tpl",TRUE,dirname(__FILE__)));
$str = preg_replace("/%%OBJECT_CONTENT%%/",$object,$object_container);
diff --git a/include/sieve/class_sieveElement_Reject.inc b/include/sieve/class_sieveElement_Reject.inc
index 0d5423845dab7bb7e97687fe2429c1a566f2f78b..e930456fd8a0dd69c851f410f2629177526756ed 100644 (file)
}
}
+ function check()
+ {
+ return(array());
+ }
+
function sieve_reject($data,$object_id)
{
$this->object_id = $object_id;
diff --git a/include/sieve/class_sieveElement_Vacation.inc b/include/sieve/class_sieveElement_Vacation.inc
index 182f023df054447028e5c249e1b476563ce2f296..95e6ef216e45d965c9a42bd2e0500055c8b61c6e 100644 (file)
$this->reason = "\"".trim(preg_replace("/\"/","",$vr))."\"";
}
}
+
+ function check()
+ {
+ return(array()) ;
+ }
+
function execute()
{
$Addresses = "";
index cfbbb748ec2520d443a5d2751e14df5ab754cf23..22db80a40ceda5b74155206f5672806960142bfe 100644 (file)
$this->scripts[$this->current_script]['EDITED'] = TRUE;
$this->current_handler = NULL;
}else{
- print_a($chk);
print_red(_("Please fix all errors before saving."));
}
}
diff --git a/include/sieve/templates/element_redirect.tpl b/include/sieve/templates/element_redirect.tpl
index bf624d913900026ca735eceb8d867298100208f0..b2864f77d3b613f4fc0c489fc47cdc111ecb67be 100644 (file)
-{if $LastError != ""}
+{if $LastErrorCnt != 0}
<table style='width:100%;'>
<tr>
<td style='width:40px; background-color: #FF0000; text-align:center; border: dotted 3px #ff7c1c'>
<td>
<b>{t}Redirect{/t}</b>
{t}Redirect mail to following recipients{/t}
-
- {if $LastError != ""}
- <br>
- <font color='red'><b>{$LastError}</b></font>
- {/if}
</td>
</tr>
+
+ {foreach from=$LastError item=val key=key}
+ <tr>
+ <td colspan=4>
+ <font color='red'><b>{$LastError[$key]}</b></font>
+ </td>
+ </tr>
+
+ {/foreach}
+
<tr>
<td style='padding-left:20px;'>
<textarea name='redirect_to_{$ID}' style='width:100%; height:30px;'>{$Destinations}</textarea>
</tr>
</table>
-{if $LastError != ""}
+{if $LastErrorCnt != 0}
</td>
</tr>