Code

Updated branch handling.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 9 Jul 2007 12:55:58 +0000 (12:55 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 9 Jul 2007 12:55:58 +0000 (12:55 +0000)
Hide release options when post methods are missing

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6776 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index d76abb3586279b4ec57c93b752c2766dd3b8d907..03fd36442fbf9edb3d72e690fd42927f1ef1a569 100644 (file)
         <table summary="" style="width:100%;">
      <tr>
       <td>
-    <input type="image" align="middle" value="branch" name="branch_branch" src="images/branch_small.png">
-    &nbsp;
-    {t}Create new branch{/t}
-    <br>
-    <input type="image" align="middle" value="freeze" name="freeze_branch" src="images/closedlock.png">
-    &nbsp;
-    {t}Create new locked branch{/t}
-    {if $selectedBranch != "main"}
+       {if $allow_remove}
+               <input type="image" align="middle" value="branch" name="branch_branch" src="images/branch_small.png">
+               &nbsp;
+               {t}Create new branch{/t}
+               <br>
+               <input type="image" align="middle" value="freeze" name="freeze_branch" src="images/closedlock.png">
+               &nbsp;
+               {t}Create new locked branch{/t}
+       {/if}
+    {if $selectedBranch != "main" && $allow_remove}
     <br>
-    <input type="image" align="middle" value="delete" name="remove_branch" src="images/edittrash.png">
+           <input type="image" align="middle" value="delete" name="remove_branch" src="images/edittrash.png">
     &nbsp;
     {t}Delete current release{/t}
     {/if}
index 41dd8dcdfbcd1a3473483cdee56662488aa2ca47..79b98c166cd2e4e3e4d69cff96756f06fb39fcfa 100644 (file)
@@ -75,10 +75,17 @@ class divListFai extends MultiSelectWindow
     $this->AddRegex   ("Regex",     _("Display users matching"),"*" , true);
   }
 
-  function AddUserBoxToFilter($position){
+  function AddUserBoxToFilter($position)
+  {
     $str = "";
     if($position  == 2){
+
+      $r = "" != search_config($this->config->data,"faiManagement","POSTREMOVE");
+      $c = "" != search_config($this->config->data,"faiManagement","POSTCREATE");
+
       $smarty = get_smarty();
+      $smarty->assign("allow_create", $c);
+      $smarty->assign("allow_remove", $r);
       $smarty->assign("selectedBranch",$this->selectedBranch);
       $smarty->assign("branchimage","images/branch.png");
       $smarty->assign("branches",$this->AvailableBranches);
index 77ebbda94b147f0b1ce38aebe6c184f95be7d313..1b199d8b9a68aee721b55dbb795755b8fe6ca3f7 100644 (file)
@@ -268,17 +268,22 @@ class faiManagement extends plugin
     /* Remove branch 
      */
     if($s_action == "remove_branch"){
-      $base= $this->DivListFai->selectedBranch;
 
-      /* Load permissions for selected 'dn' and check if
-         we're allowed to remove this 'dn' */
-      $acl= get_permissions ($this->DivListFai->selectedBase, $this->ui->subtreeACL);
-      $this->acl= get_module_permission($acl, "FAIclass", $base);
-      if (chkacl($this->acl, "delete") == ""){
-        $smarty->assign("info", sprintf(_("You're about to delete a fai branch / freeze  '%s'."), $this->DivListFai->selectedBranch));
-        return($smarty->fetch(get_template_path('remove_branch.tpl',TRUE)));
-      } else {
-        print_red (_("You are not allowed to delete this release!"));
+      $r = "" != search_config($this->config->data,"faiManagement","POSTREMOVE");
+      if($r){
+
+        $base= $this->DivListFai->selectedBranch;
+
+        /* Load permissions for selected 'dn' and check if
+           we're allowed to remove this 'dn' */
+        $acl= get_permissions ($this->DivListFai->selectedBase, $this->ui->subtreeACL);
+        $this->acl= get_module_permission($acl, "FAIclass", $base);
+        if (chkacl($this->acl, "delete") == ""){
+          $smarty->assign("info", sprintf(_("You're about to delete a fai branch / freeze  '%s'."), $this->DivListFai->selectedBranch));
+          return($smarty->fetch(get_template_path('remove_branch.tpl',TRUE)));
+        } else {
+          print_red (_("You are not allowed to delete this release!"));
+        }
       }
     }
 
@@ -288,6 +293,9 @@ class faiManagement extends plugin
      ****************/
 
     if(isset($_POST['delete_branch_confirm'])){
+
+      $r = "" != search_config($this->config->data,"faiManagement","POSTREMOVE");
+
       $bb =  $this->DivListFai->selectedBranch;
       if(!isset($ldap)){
         $ldap = $this->config->get_ldap_link();
@@ -310,6 +318,7 @@ class faiManagement extends plugin
         $this->postremove();
       }
     }
+  }
 
 
     /****************
@@ -450,27 +459,34 @@ class faiManagement extends plugin
       Display dialog to enter new Branch name
      ****************/
 
-    $acl= get_permissions ($this->DivListFai->selectedBase, $this->ui->subtreeACL);
-    $this->acl= get_module_permission($acl, "FAIclass", $this->DivListFai->selectedBase);
-    if((($s_action == "branch_branch")||($this->dispNewBranch)) && chkacl($this->acl,"FAIclass") == ""){
-      $this->dispNewBranch=true;
-      $smarty->assign("iframe",false);
-                 $display      .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
-      return($display);
+    $c = "" != search_config($this->config->data,"faiManagement","POSTCREATE");
+
+    if($c){
+      $acl= get_permissions ($this->DivListFai->selectedBase, $this->ui->subtreeACL);
+      $this->acl= get_module_permission($acl, "FAIclass", $this->DivListFai->selectedBase);
+      if((($s_action == "branch_branch")||($this->dispNewBranch)) && chkacl($this->acl,"FAIclass") == ""){
+        $this->dispNewBranch=true;
+        $smarty->assign("iframe",false);
+        $display       .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
+        return($display);
+      }
     }
-   
+
     /****************
       Display dialog to enter new Freeze name
      ****************/
 
-    $acl= get_permissions ($this->DivListFai->selectedBase, $this->ui->subtreeACL);
-    $this->acl= get_module_permission($acl, "FAIclass", $this->DivListFai->selectedBase);
-    if((($s_action == "freeze_branch")||($this->dispNewFreeze)) && chkacl($this->acl,"FAIclass") == ""){
-      $this->dispNewFreeze = true;
-      $smarty->assign("iframe",false);
-                 $display      .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
-      return($display);
+    $c = "" != search_config($this->config->data,"faiManagement","POSTCREATE");
+
+    if($c){
+      $acl= get_permissions ($this->DivListFai->selectedBase, $this->ui->subtreeACL);
+      $this->acl= get_module_permission($acl, "FAIclass", $this->DivListFai->selectedBase);
+      if((($s_action == "freeze_branch")||($this->dispNewFreeze)) && chkacl($this->acl,"FAIclass") == ""){
+        $this->dispNewFreeze = true;
+        $smarty->assign("iframe",false);
+        $display       .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
+        return($display);
+      }
     }