Code

Closes #283
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 28 Nov 2007 10:12:23 +0000 (10:12 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 28 Nov 2007 10:12:23 +0000 (10:12 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7927 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 2285737e5567c3d9c0f318292b0bad55dfc4ea08..addb5a7a2921c6c7f8da3d3081107a412f24f18c 100644 (file)
      <tr>
       <td>
     {if $allow_create}
-        <input type="image" align="middle" value="branch" name="branch_branch" src="images/branch_small.png">
-        &nbsp;
-        {t}Create new branch{/t}
+        <input class="center" type="image" name="branch_branch" src="images/branch_small.png">
+        <a href="?plug={$plug_id}&act=branch_branch">{t}Create new branch{/t}</a>
         <br>
-        <input type="image" align="middle" value="freeze" name="freeze_branch" src="images/freeze.png">
+        <input class="center" type="image" name="freeze_branch" src="images/freeze.png">
+               <a href="?plug={$plug_id}&act=freeze_branch">{t}Create new locked branch{/t}</a>
     {else}
         <img src="images/branch_small_grey.png" alt='{t}Branch{/t}' class='center'>
-        &nbsp;
         {t}Create new branch{/t}
         <br>
         <img src="images/freeze_grey.png" alt='{t}Freeze{/t}' class='center'>
+               {t}Create new locked branch{/t}
     {/if}
-    &nbsp;
-    {t}Create new locked branch{/t}
 
     {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}
+        <input class="center" type="image" name="remove_branch" src="images/edittrash.png">
+           <a href="?plug={$plug_id}&act=remove_branch">{t}Delete current release{/t}</a>
     {/if}
       </td>
      </tr>
index c2ae1b9b56f6dcdc9f4eb393b13ea824ddc9ef10..b42bac3480f8d6a84b06e8333d8a078a4c988ed5 100644 (file)
@@ -103,6 +103,11 @@ class divListFai extends MultiSelectWindow
       $smarty->assign("selectedBranch",$this->selectedBranch);
       $smarty->assign("branchimage","images/branch.png");
       $smarty->assign("branches",$this->AvailableBranches);
+      $plug_id = 0;       
+      if(isset($_GET['plug'])){
+        $plug_id = $_GET['plug'];
+      }
+      $smarty->assign("plug_id",$plug_id);
       $str = $smarty->fetch(get_template_path('branch_selector.tpl', TRUE));
     }
     return($str);
index 67446d5e43680236dad965d03f51a7b437e57d57..f7004efa28e715e5d11955f04a1637d4f14ebf80 100644 (file)
@@ -118,6 +118,16 @@ class faiManagement extends plugin
                        $s_entry = $_GET['edit_entry'];
                        $s_action = "edit";
                }
+
+    if(isset($_GET['act']) && $_GET['act'] == "freeze_branch"){
+      $s_action = "freeze_branch";
+    }
+    if(isset($_GET['act']) && $_GET['act'] == "branch_branch"){
+      $s_action = "branch_branch";
+    }
+    if(isset($_GET['act']) && $_GET['act'] == "remove_branch"){
+      $s_action = "remove_branch";
+    }
     
     if((isset($_POST['CancelBranchName'])) || (isset($_POST['CloseIFrame']))){
       $this->dispNewBranch = false;
@@ -494,7 +504,9 @@ class faiManagement extends plugin
      ****************/
 
     if(isset($_GET['PerformBranch'])){
-
+    
+      $base= $this->DivListFai->selectedBranch;
+      $this->set_acl_base($base);
       if(!$this->acl_is_createable()){
         print_red(_("You are not allowed to create a new branch."));
       }else{
@@ -626,10 +638,16 @@ class faiManagement extends plugin
      */
     if("" != $this->config->search("faiManagement", "POSTCREATE",array('menu','tabs'))){
       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);
+        $base= $this->DivListFai->selectedBranch;
+        $this->set_acl_base($base);
+        if(!$this->acl_is_createable()){
+          print_red(_("You are not allowed to create a new branch."));
+        }else{
+          $this->dispNewBranch=true;
+          $smarty->assign("iframe",false);
+          $display     .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
+          return($display);
+        }
       } 
     }
 
@@ -643,10 +661,16 @@ class faiManagement extends plugin
      */
     if("" != $this->config->search("faiManagement", "POSTCREATE",array('menu','tabs'))){
       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);
+        $base= $this->DivListFai->selectedBranch;
+        $this->set_acl_base($base);
+        if(!$this->acl_is_createable()){
+          print_red(_("You are not allowed to create a new branch."));
+        }else{
+          $this->dispNewFreeze = true;
+          $smarty->assign("iframe",false);
+          $display     .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
+          return($display);
+        }
       }
     }
 
@@ -840,7 +864,7 @@ class faiManagement extends plugin
   /* Get available branches for current base */
   function getBranches($base = false,$prefix = "")
   {
-    $ret = array("main"=>"/");
+    $ret = array("/"=>"main");
     $ldap = $this->config->get_ldap_link();
     if(!$base){
       $base= $_SESSION['CurrentMainBase'];
@@ -851,6 +875,7 @@ class faiManagement extends plugin
     }
     natcasesort($ret);
     $ret = array_flip($ret);
+
     return ($ret);
   }