Code

fixed problem with klicking apply more than once
[gosa.git] / plugins / admin / systems / class_servRepository.inc
index 44b59d757139f99435f0c3ada98f230408df3a42..961c49a59b204dd0bd7813c9e0feb612bcf4af7b 100644 (file)
@@ -94,27 +94,11 @@ class servrepository extends plugin
     $smarty->assign("apply",        apply_filter());
     $smarty->assign("regex",        $this->regex);
 
-
-    /* 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){
-      $display= $this->show_header(_("Remove FAI repository extension."),
-          _("This server has FAI repository features enabled. You can disable them by clicking below."));
-    } else {
-      $display= $this->show_header(_("Add FAI repository extension."),
-          _("This server has FAI repository features disabled. You can enable them by clicking below."));
-      return ($display);
-    }
-
     /*
        ADD / EDIT Repository
        Dialog Handling
      */
-
     $once = false;
     if(isset($_POST['servRepository'])){
       foreach($_POST as $name => $value){
@@ -294,6 +278,13 @@ class servrepository extends plugin
   function remove_from_parent()
   {
     plugin::remove_from_parent();    
+
+     /* Remove status flag, it is not a memeber of
+        this->attributes, so ensure that it is deleted too */
+    if(!empty($this->StatusFlag)){
+      $this->attrs[$this->StatusFlag] = array();
+    }
+
     $ldap= $this->config->get_ldap_link();
     $ldap->cd ($this->config->current['BASE']);
     
@@ -413,6 +404,7 @@ class servrepository extends plugin
   {
     if($value == "none") return;
     if(!$this->initially_was_account) return;
+    if(empty($this->StatusFlag)) return;
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->dn);
     $ldap->cat($this->dn,array("objectClass"));
@@ -426,11 +418,31 @@ class servrepository extends plugin
       $attrs[$flag] = $value;
       $this->$flag = $value;
       $ldap->modify($attrs);
-      show_ldap_error($ldap->get_error());
+      show_ldap_error($ldap->get_error(), sprintf(_("Set status flag for server services/repository with dn '%s' failed."),$this->dn));
       $this->action_hook();
     }
   }
 
+
+  /* Return plugin informations for acl handling */
+  function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Repository"),
+          "plDescription" => _("Repository service"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+              "cn"            => _("Name"),
+              "Release"       => _("Releases"),
+              "ParentServer"  => _("Parent server"),
+              "Url"           => _("Url"))
+            ));
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: