Code

Udpated FAI handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 9 Jul 2007 13:01:49 +0000 (13:01 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 9 Jul 2007 13:01:49 +0000 (13:01 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6779 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 642c9420e7a5d91c4c9218b4c7a1d0d78b94fc1b..2211b034718bc83793094e5b1cc3141b3b123150 100644 (file)
         <table summary="" style="width:100%;">
      <tr>
       <td>
-    <input type="image" align="middle" value="branch" name="branch_branch" src="images/branch_small.png" class="center" />
-    &nbsp;
-    {t}Create new branch{/t}
-    <br>
-    <input type="image" align="middle" value="freeze" name="freeze_branch" src="images/closedlock.png" class="center" />
-    &nbsp;
-    {t}Create new locked branch{/t}
-    {if $selectedBranch != "main"}
-    <br>
-    <input type="image" align="middle" value="delete" name="remove_branch" src="images/edittrash.png" />
-    &nbsp;
-    {t}Delete current release{/t}
+
+        {if $allow_create}
+               <input type="image" align="middle" value="branch" name="branch_branch" src="images/branch_small.png" class="center" />
+               &nbsp;
+               {t}Create new branch{/t}
+               <br>
+               <input type="image" align="middle" value="freeze" name="freeze_branch" src="images/closedlock.png" class="center" />
+               &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" />
+               &nbsp;
+               {t}Delete current release{/t}
     {/if}
       </td>
      </tr>
index e4831a17b84ccb8387fdc1061f1e162ca15ffc0b..77f84cd27050b1b1d001c4ca5f128e26dd94e302 100644 (file)
@@ -86,10 +86,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 1922b2aadf0e27d2ce4033b9dec16bf8a9eef020..a991b1d8def8aa7b11eac491875ef908410d06d1 100644 (file)
@@ -372,15 +372,19 @@ class faiManagement extends plugin
     if($s_action == "remove_branch"){
       $base= $this->DivListFai->selectedBranch;
 
-      /* Load permissions for selected 'dn' and check if
-         we're allowed to remove this 'dn' */
-      $this->set_acl_base($base);
-      if($this->acl_is_removeable()){
-
-        $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){
+
+        /* Load permissions for selected 'dn' and check if
+           we're allowed to remove this 'dn' */
+        $this->set_acl_base($base);
+        if($this->acl_is_removeable()){
+
+          $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!"));
+        }
       }
     }
 
@@ -390,6 +394,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();
@@ -413,6 +420,7 @@ class faiManagement extends plugin
         new log("remove","fai/".get_class($this),$br[$bb],array(),"Release removed");
       }
     }
+  }
 
 
     /****************
@@ -584,23 +592,29 @@ class faiManagement extends plugin
       Display dialog to enter new Branch name
      ****************/
 
-    if(($s_action == "branch_branch")||($this->dispNewBranch)){
-      $this->dispNewBranch=true;
-      $smarty->assign("iframe",false);
-                 $display      .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
-      return($display);
+    $r = "" != search_config($this->config->data,"faiManagement","POSTMODIFY");
+    if($r){
+      if(($s_action == "branch_branch")||($this->dispNewBranch)){
+        $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
      ****************/
 
-    if(($s_action == "freeze_branch")||($this->dispNewFreeze)){
-      $this->dispNewFreeze = true;
-      $smarty->assign("iframe",false);
-                 $display      .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
-      return($display);
+    $r = "" != search_config($this->config->data,"faiManagement","POSTMODIFY");
+    if($r){
+      if(($s_action == "freeze_branch")||($this->dispNewFreeze)){
+        $this->dispNewFreeze = true;
+        $smarty->assign("iframe",false);
+        $display       .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
+        return($display);
+      }
     }