From: hickert Date: Tue, 1 Aug 2006 07:00:15 +0000 (+0000) Subject: Made new service tabs (Spam / Virus) compatible with serverservice and servtabs X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6fde18535ed86bea1e460fdade5ee01787f58cf9;p=gosa.git Made new service tabs (Spam / Virus) compatible with serverservice and servtabs git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4354 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_goSpamServer.inc b/plugins/admin/systems/class_goSpamServer.inc index de52e2064..b0a61d6fa 100644 --- a/plugins/admin/systems/class_goSpamServer.inc +++ b/plugins/admin/systems/class_goSpamServer.inc @@ -87,23 +87,32 @@ class gospamserver extends plugin{ function execute() { - /* Do we need to flip is_account state? */ - if (isset($_POST['modify_state'])) { - $this->is_account = !$this->is_account; - } - - /* Show tab dialog headers */ - if ($this->is_account) { - /* call Add Acoount to add account */ - $display = $this->show_header(_("Remove spamassassin extension"), - _("This server has spamassassin features enabled. You can disable them by clicking below.")); - } else { - /* call remove Account */ - $display = $this->show_header(_("Add spamassassin service"), - _("This server has spamassassin features disabled. You can enable them by clicking below.")); - return ($display); - } + $smarty = get_smarty(); + if(get_class($this->parent) == "servtabs"){ + $smarty->assign("servtabs",true); + /* Do we need to flip is_account state? */ + if (isset($_POST['modify_state'])) { + $this->is_account = !$this->is_account; + } + + /* Show tab dialog headers */ + if ($this->is_account) { + /* call Add Acoount to add account */ + $display = $this->show_header(_("Remove spamassassin extension"), + _("This server has spamassassin features enabled. You can disable them by clicking below.")); + } else { + /* call remove Account */ + $display = $this->show_header(_("Add spamassassin service"), + _("This server has spamassassin features disabled. You can enable them by clicking below.")); + return ($display); + } + }else{ + $this->is_account =true; + $display =""; + $smarty->assign("servtabs",false); + } + /* Add new trusted network */ if(isset($_POST['AddNewTrust'])){ $this->AddTrust($_POST['NewTrustName']); @@ -168,7 +177,6 @@ class gospamserver extends plugin{ } /* Assign smarty vars */ - $smarty = get_smarty(); foreach($this->attributes as $attr){ $smarty->assign($attr,$this->$attr); $smarty->assign($attr."ACL",chkacl($this->acl,$attr)); @@ -204,6 +212,13 @@ class gospamserver extends plugin{ $smarty->assign("divRules",$DivRules->DrawList()); $smarty->assign("TrustedNetworks",$this->TrustedNetworks); + /* Create Spam score select box entries */ + $tmp = array(); + for($i = 0 ; $i <= 20 ; $i ++ ){ + $tmp[$i] = $i; + } + $smarty->assign("SpamScore",$tmp); + return($display.$smarty->fetch(get_template_path("goSpamServer.tpl",TRUE,dirname(__FILE__)))); } @@ -356,12 +371,12 @@ class gospamserver extends plugin{ */ /* For newer service management dialogs */ - /*function getListEntry() + function getListEntry() { $this->updateStatusState(); $flag = $this->StatusFlag; $fields['Status'] = $this->$flag; - $fields['Message'] = _("spamassassin"); + $fields['Message'] = _("Spamassassin"); $fields['AllowStart'] = true; $fields['AllowStop'] = true; $fields['AllowRestart'] = true; @@ -388,25 +403,25 @@ class gospamserver extends plugin{ } function action_hook($add_attrs= array()) { - /* Find postcreate entries for this class * / + /* Find postcreate entries for this class */ $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK"); if ($command == "" && isset($this->config->data['TABS'])){ $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK"); } if ($command != ""){ - /* Walk through attribute list * / + /* Walk through attribute list */ foreach ($this->attributes as $attr){ if (!is_array($this->$attr)){ $command= preg_replace("/%$attr/", $this->$attr, $command); } } $command= preg_replace("/%dn/", $this->dn, $command); - /* Additional attributes * / + /* Additional attributes */ foreach ($add_attrs as $name => $value){ $command= preg_replace("/%$name/", $value, $command); } - /* If there are still some %.. in our command, try to fill these with some other class vars * / + /* If there are still some %.. in our command, try to fill these with some other class vars */ if(preg_match("/%/",$command)){ $attrs = get_object_vars($this); foreach($attrs as $name => $value){ @@ -427,7 +442,7 @@ class gospamserver extends plugin{ } } - /* Directly save new status flag * / + /* Directly save new status flag */ function setStatus($value) { if($value == "none") return; @@ -451,8 +466,6 @@ class gospamserver extends plugin{ } - */ - } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/systems/class_goVirusServer.inc b/plugins/admin/systems/class_goVirusServer.inc index 3cd2469cf..7b334597b 100644 --- a/plugins/admin/systems/class_goVirusServer.inc +++ b/plugins/admin/systems/class_goVirusServer.inc @@ -14,7 +14,7 @@ class govirusserver extends plugin{ var $DisplayName = ""; var $dn = NULL; var $cn = ""; - var $saStatus = ""; + var $avStatus = ""; var $dialog = NULL; var $ui = NULL; @@ -39,7 +39,7 @@ class govirusserver extends plugin{ var $avHttpProxyURL = ""; var $avDatabaseMirror = ""; - function gvirusserver($config,$dn) + function govirusserver($config,$dn) { /* Init class */ plugin::plugin($config,$dn); @@ -64,25 +64,34 @@ class govirusserver extends plugin{ function execute() { - /* Do we need to flip is_account state? */ - if (isset($_POST['modify_state'])) { - $this->is_account = !$this->is_account; - } - - /* Show tab dialog headers */ - if ($this->is_account) { - /* call Add Acoount to add account */ - $display = $this->show_header(_("Remove anti virus extension"), - _("This server has anti virus features enabled. You can disable them by clicking below.")); - } else { - /* call remove Account */ - $display = $this->show_header(_("Add anti virus service"), - _("This server has anti virus features disabled. You can enable them by clicking below.")); - return ($display); + $smarty = get_smarty(); + if(get_class($this->parent) == "servtabs"){ + + $smarty->assign("servtabs",TRUE); + + /* Do we need to flip is_account state? */ + if (isset($_POST['modify_state'])) { + $this->is_account = !$this->is_account; + } + + /* Show tab dialog headers */ + if ($this->is_account) { + /* call Add Acoount to add account */ + $display = $this->show_header(_("Remove anti virus extension"), + _("This server has anti virus features enabled. You can disable them by clicking below.")); + } else { + /* call remove Account */ + $display = $this->show_header(_("Add anti virus service"), + _("This server has anti virus features disabled. You can enable them by clicking below.")); + return ($display); + } + }else{ + $display = ""; + $smarty->assign("servtabs",FALSE); + $this->is_account = true; } /* Assign smarty vars */ - $smarty = get_smarty(); foreach($this->attributes as $attr){ $smarty->assign($attr,$this->$attr); $smarty->assign($attr."ACL",chkacl($this->acl,$attr)); @@ -183,12 +192,6 @@ class govirusserver extends plugin{ } } - - - - - - return($message); } @@ -209,40 +212,9 @@ class govirusserver extends plugin{ } - /* Return plugin informations for acl handling - function plInfo() - { - return (array( - "plShortName" => _("Anti virus"), - "plDescription" => _("Anti virus service"), - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 0, - "plSection" => array("administration"), - "plCategory" => array("server"), - "plProvidedAcls"=> array( - - - "avFlagsD" =>_("Enable debugging"), - "avFlagsS" =>_("Enable mail scanning"), - "avFlagsA" =>_("Enable scanning of archives"), - "avFlagsE" =>_("Block encrypted archives"), - - "avMaxThreads" =>_("Maximum threads"), -// "avMaxDirectoryRecursions" =>_(""), -// "avUser" =>_(""), - "avArchiveMaxFileSize" =>_("Maximum file size"), - "avArchiveMaxRecursion" =>_("Maximum recursions"), - "avArchiveMaxCompressionRatio" =>_("Maximum compression ratio"), - "avDatabaseMirror" =>_("Database mirror"), - "avChecksPerDay" =>_("Checks per day"), - "avHttpProxyURL" =>_("Http proxy URL")) - )); - } - */ /* For newer service management dialogs */ - /*function getListEntry() + function getListEntry() { $this->updateStatusState(); $flag = $this->StatusFlag; @@ -272,27 +244,28 @@ class govirusserver extends plugin{ $this->$flag = $attrs[$flag][0]; } } + function action_hook($add_attrs= array()) { - /* Find postcreate entries for this class * / + /* Find postcreate entries for this class */ $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK"); if ($command == "" && isset($this->config->data['TABS'])){ $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK"); } if ($command != ""){ - /* Walk through attribute list * / + /* Walk through attribute list */ foreach ($this->attributes as $attr){ if (!is_array($this->$attr)){ $command= preg_replace("/%$attr/", $this->$attr, $command); } } $command= preg_replace("/%dn/", $this->dn, $command); - /* Additional attributes * / + /* Additional attributes */ foreach ($add_attrs as $name => $value){ $command= preg_replace("/%$name/", $value, $command); } - /* If there are still some %.. in our command, try to fill these with some other class vars * / + /* If there are still some %.. in our command, try to fill these with some other class vars */ if(preg_match("/%/",$command)){ $attrs = get_object_vars($this); foreach($attrs as $name => $value){ @@ -313,7 +286,7 @@ class govirusserver extends plugin{ } } - /* Directly save new status flag * / + /* Directly save new status flag */ function setStatus($value) { if($value == "none") return; @@ -336,9 +309,37 @@ class govirusserver extends plugin{ } } + /* Return plugin informations for acl handling + function plInfo() + { + return (array( + "plShortName" => _("Anti virus"), + "plDescription" => _("Anti virus service"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 0, + "plSection" => array("administration"), + "plCategory" => array("server"), + "plProvidedAcls"=> array( - */ + "avFlagsD" =>_("Enable debugging"), + "avFlagsS" =>_("Enable mail scanning"), + "avFlagsA" =>_("Enable scanning of archives"), + "avFlagsE" =>_("Block encrypted archives"), + + "avMaxThreads" =>_("Maximum threads"), +// "avMaxDirectoryRecursions" =>_(""), +// "avUser" =>_(""), + "avArchiveMaxFileSize" =>_("Maximum file size"), + "avArchiveMaxRecursion" =>_("Maximum recursions"), + "avArchiveMaxCompressionRatio" =>_("Maximum compression ratio"), + "avDatabaseMirror" =>_("Database mirror"), + "avChecksPerDay" =>_("Checks per day"), + "avHttpProxyURL" =>_("Http proxy URL")) + )); + } + */ } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/systems/goSpamServer.tpl b/plugins/admin/systems/goSpamServer.tpl index 745ff497d..8952c8373 100644 --- a/plugins/admin/systems/goSpamServer.tpl +++ b/plugins/admin/systems/goSpamServer.tpl @@ -16,7 +16,9 @@ {t}Required score{/t} - + @@ -91,3 +93,15 @@ + +{if !$servtabs} +

 

+

+

+ +   + +
+

+{/if} + diff --git a/plugins/admin/systems/goVirusServer.tpl b/plugins/admin/systems/goVirusServer.tpl index 70544dc3d..f2a468679 100644 --- a/plugins/admin/systems/goVirusServer.tpl +++ b/plugins/admin/systems/goVirusServer.tpl @@ -116,3 +116,14 @@ +{if !$servtabs} +

 

+

+

+ +   + +
+

+{/if} +