Code

Udpated psot checks for faiManagement
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 18 Jul 2007 07:23:06 +0000 (07:23 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 18 Jul 2007 07:23:06 +0000 (07:23 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6903 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_divListFai.inc
plugins/admin/fai/class_faiManagement.inc

index 77f84cd27050b1b1d001c4ca5f128e26dd94e302..b6fc3e3998109230811f1d9c1d9bab9b5311603f 100644 (file)
@@ -91,8 +91,11 @@ class divListFai extends MultiSelectWindow
     $str = "";
     if($position  == 2){
 
-      $r = "" != search_config($this->config->data,"faiManagement","POSTREMOVE");
-      $c = "" != search_config($this->config->data,"faiManagement","POSTCREATE");
+      /* Check if there are post commands available for fai management.
+       * If not, grey out freeze/branch and release remove buttons.
+       */
+      $r = ("" != search_config($this->config->data,"faiManagement","POSTREMOVE"));
+      $c = ("" != search_config($this->config->data,"faiManagement","POSTCREATE"));
 
       $smarty = get_smarty();
       $smarty->assign("allow_create", $c);
index 86fb0c4c99075015cc5383b7b7ca0afa9f194393..20c50d07b3d899f2e947c7c4978c90b39470cec3 100644 (file)
@@ -372,8 +372,10 @@ class faiManagement extends plugin
     if($s_action == "remove_branch"){
       $base= $this->DivListFai->selectedBranch;
 
-      $r = "" != search_config($this->config->data,"faiManagement","POSTREMOVE");
-      if($r){
+      /* Check if we have a post remove method configured
+       *  else skip this operation. (Skip:Button in the ui should be disabled in this case too)
+       */
+      if("" != search_config($this->config->data,"faiManagement","POSTREMOVE")){
 
         /* Load permissions for selected 'dn' and check if
            we're allowed to remove this 'dn' */
@@ -395,29 +397,33 @@ class faiManagement extends plugin
 
     if(isset($_POST['delete_branch_confirm'])){
 
-      $r = "" != search_config($this->config->data,"faiManagement","POSTREMOVE");
+      /* Check if we have a post remove method configured
+       *  else skip this operation. (Skip:Button in the ui should be disabled in this case too)
+       */
+      if("" != search_config($this->config->data,"faiManagement","POSTREMOVE")){
 
-      $bb =  $this->DivListFai->selectedBranch;
-      if(!isset($ldap)){
-        $ldap = $this->config->get_ldap_link();
-      }
+        $bb =  $this->DivListFai->selectedBranch;
+        if(!isset($ldap)){
+          $ldap = $this->config->get_ldap_link();
+        }
 
-      $br = $this->getBranches();
+        $br = $this->getBranches();
 
-      if(isset($br[$bb]) && $this->acl_is_removeable()){
-        $name = $br[$bb];
-        $ldap->cd($bb);
-        $ldap->recursive_remove();
-        $ldap->cd(preg_replace('/,ou=fai,ou=configs,ou=systems,/', ',ou=apps,', $bb));
-        $ldap->recursive_remove();
-        $this->DivListFai->selectedBranch = "main";
+        if(isset($br[$bb]) && $this->acl_is_removeable()){
+          $name = $br[$bb];
+          $ldap->cd($bb);
+          $ldap->recursive_remove();
+          $ldap->cd(preg_replace('/,ou=fai,ou=configs,ou=systems,/', ',ou=apps,', $bb));
+          $ldap->recursive_remove();
+          $this->DivListFai->selectedBranch = "main";
 
-        /* Post remove */
-        $this->lock_name   = $name;
-        $this->lock_dn     = $bb;
-        $this->postremove();
+          /* Post remove */
+          $this->lock_name   = $name;
+          $this->lock_dn     = $bb;
+          $this->postremove();
 
-        new log("remove","fai/".get_class($this),$br[$bb],array(),"Release removed");
+          new log("remove","fai/".get_class($this),$br[$bb],array(),"Release removed");
+        }
       }
     }
 
@@ -591,8 +597,10 @@ class faiManagement extends plugin
       Display dialog to enter new Branch name
      ****************/
 
-    $r = "" != search_config($this->config->data,"faiManagement","POSTMODIFY");
-    if($r){
+    /* Check if we have a post create method configured
+     *  else skip this operation. (Skip:Button in the ui should be disabled in this case too)
+     */
+    if("" != search_config($this->config->data,"faiManagement","POSTCREATE")){
       if(($s_action == "branch_branch")||($this->dispNewBranch)){
         $this->dispNewBranch=true;
         $smarty->assign("iframe",false);
@@ -606,8 +614,10 @@ class faiManagement extends plugin
       Display dialog to enter new Freeze name
      ****************/
 
-    $r = "" != search_config($this->config->data,"faiManagement","POSTMODIFY");
-    if($r){
+    /* Check if we have a post create method configured
+     *  else skip this operation. (Skip:Button in the ui should be disabled in this case too)
+     */
+    if("" != search_config($this->config->data,"faiManagement","POSTCREATE")){
       if(($s_action == "freeze_branch")||($this->dispNewFreeze)){
         $this->dispNewFreeze = true;
         $smarty->assign("iframe",false);