Code

Fixed a couple of static/non-static error messages
[gosa.git] / plugins / admin / systems / class_goVirusServer.inc
index ca9bbf0a6bab10850e39f4894ab79a4e7c04d0b3..f91c5f5ae92272aaa9f3113803ae480c0bdccd96 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 
-require_once("class_goService.inc");
-
 class govirusserver extends goService{
        
   /* This plugin only writes its objectClass */
@@ -18,7 +16,6 @@ class govirusserver extends goService{
   var $cn               = "";
   var $avStatus         = "";
 
-  var $dialog           = NULL;
   var $ui               = NULL;
 
   var $Flags            = array("D","S","A","E");
@@ -39,11 +36,12 @@ class govirusserver extends goService{
   var $avUser                       = "";
   var $avHttpProxyURL               = "";
   var $avDatabaseMirror             = "";
+  var $view_logged  =FALSE;
 
-  function govirusserver($config,$dn, $parent= NULL)
+  function govirusserver(&$config,$dn, $parent= NULL)
   {
     /* Init class */
-    plugin::plugin($config,$dn, $parent);
+    goService::goService($config,$dn, $parent);
     $this->DisplayName = _("Anti virus");
 
     /* Get userinfo & acls */
@@ -63,37 +61,21 @@ class govirusserver extends goService{
   {
     $smarty = get_smarty(); 
 
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+
     /* Set acls */
     $tmp = $this->plInfo();
     foreach($tmp['plProvidedAcls'] as $name => $translation) { 
       $smarty->assign($name."ACL",$this->getacl($name));
     }
 
-    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;
-    }
+    $display = "";
+    $smarty->assign("servtabs",FALSE);
+    $this->is_account = true;
 
     /* Assign smarty vars */
     foreach($this->attributes as $attr){
@@ -162,8 +144,10 @@ class govirusserver extends goService{
     }
     if($this->initially_was_account){
       $this->handle_post_events("modify");
+      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
     }else{
       $this->handle_post_events("add");
+      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
     }
 
     show_ldap_error($ldap->get_error(), sprintf(_("Saving of server services/anti virus with dn '%s' failed."),$this->dn));
@@ -187,6 +171,12 @@ class govirusserver extends goService{
       }
     }
 
+    foreach(array("avUser"=>_("Database user"),"avHttpProxyURL"=>_("Http proxy URL"),"avDatabaseMirror"=>_("Database mirror")) as $attr => $name){
+      if(!preg_match("/^[a-z0-9:_\-\.\/]*$/",$this->$attr)){
+        $message[] = sprintf(_("Please specify a valid value for '%s'."),$name);
+      }
+    }
+  
     return($message);
   }
   
@@ -215,23 +205,27 @@ class govirusserver extends goService{
   {
     $fields       = goService::getListEntry();
     $fields['AllowEdit']    = true;
+    $fields['Message']      = _("Anti virus");
     return($fields);
   }
 
 
   /* Return plugin informations for acl handling */ 
-  function plInfo()
+  static function plInfo()
   {
     return (array(
           "plShortName"   => _("Anti virus"),
-          "plDescription" => _("Anti virus service"),
+          "plDescription" => _("Anti virus")." ("._("Services").")",
           "plSelfModify"  => FALSE,
           "plDepends"     => array(),
-          "plPriority"    => 0,
+          "plPriority"    => 96,
           "plSection"     => array("administration"),
           "plCategory"    => array("server"),
           "plProvidedAcls"=> array(
 
+          "start"         => _("Start"),
+          "stop"          => _("Stop"),
+          "restart"       => _("Restart"),
 
           "avFlagsD"         =>_("Enable debugging"),
           "avFlagsS"         =>_("Enable mail scanning"),