From a25c007b88c2fabd7ae336b2b64b1e99aa828806 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 30 Mar 2007 07:15:53 +0000 Subject: [PATCH] Use a template for the management dialog. Updated error messages git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5934 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/sieve/class_sieveManagement.inc | 46 ++++++++++++++++--------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/include/sieve/class_sieveManagement.inc b/include/sieve/class_sieveManagement.inc index 0c58e79c5..fb6778ba6 100644 --- a/include/sieve/class_sieveManagement.inc +++ b/include/sieve/class_sieveManagement.inc @@ -41,7 +41,7 @@ class sieveManagement extends plugin var $create_script = FALSE; /* To add new elements we need to know - * Where to the element -> add_new_id + * Where to add the element -> add_new_id * Whould we add above or below this id -> add_above_below * What kind of element should we add -> add_element_type */ @@ -60,16 +60,21 @@ class sieveManagement extends plugin */ function sieveManagement($config,$dn,$parent,$uattrib) { + /* Check given parameter */ + if(!isset($parent->$uattrib)){ + trigger_error("Sieve Management implementation error. Parameter 4 must be part of the given parent element."); + } + $this->uattrib = $uattrib; $this->parent = $parent; plugin::plugin($config,$dn); /* Get sieve */ if(!$this->sieve_handle = $this->get_sieve()){ - print_red( - sprintf( - _("Can't log into SIEVE server. Server says '%s'."), - to_string($this->Sieve_Error))); +# print_red( + # sprintf( + # _("Can't log into SIEVE server. Server says '%s'."), + # to_string($this->Sieve_Error))); return; } @@ -661,18 +666,25 @@ class sieveManagement extends plugin "attach" => "style='border-right:0px; width:70px;'"); $List ->AddEntry(array($field1,$field2,$field3,$field4,$field6)); } - - $display ="

Sieve script management

"; - $display .= _("Be careful. All your changes will be saved directly to sieve, if you use the save button below."); - $display .= "
"; - $display .= $List->DrawList(); - - $display .= "

\n"; - $display .= "\n"; - $display .= " \n"; - $display .= "\n"; - $display .= "

"; - return($display);; + + /* If the uattrib is empty (Attribute to use for atuthentification with sieve) + * Display a message that a connection can't be established right now. + */ + $uattrib = $this->uattrib; + $smarty = get_smarty(); + + + if(!$this->get_sieve()){ + $smarty->assign("Sieve_Error",sprintf( + _("Can't log into SIEVE server. Server says '%s'."), + to_string($this->Sieve_Error))); + }else{ + $smarty->assign("Sieve_Error",""); + } + + $smarty->assign("uattrib_empty",empty($this->parent->$uattrib)); + $smarty->assign("List",$List->DrawList()); + return($smarty->fetch(get_template_path("templates/management.tpl",TRUE,dirname(__FILE__)))); } -- 2.30.2