Code

Updated FAI partition stuff
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 7 Aug 2009 08:41:59 +0000 (08:41 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 7 Aug 2009 08:41:59 +0000 (08:41 +0000)
-Do not allow to edit the new style partitions when they are freezed

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

gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc
gosa-plugins/fai/admin/fai/class_faiPartition.inc
gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc
gosa-plugins/fai/admin/fai/faiPartition.tpl

index 577a2365b24f8d01fffbdccb24921f571d3d282b..2975fe0c072e775c4b5a5458488982ee4985dfee 100644 (file)
@@ -530,10 +530,18 @@ class faiDiskEntry extends plugin
       $opt    =array(
           "string" => "<i>".preg_replace('/, $/',"",$opt)."</i>");
 
-      $action =array(
-          "string" => "<input type='image' src='images/lists/edit.png' name='EditPartition_".$key."'>".
-                      "<input type='image' src='images/lists/trash.png' name='RemovePartition_".$key."'>",
-          "attach" => "style='width:40px; border-right: 0px;'");
+      if(!preg_match("/freeze/", $this->FAIstate)){
+        $action =array(
+            "string" => "<input type='image' src='images/lists/edit.png' name='EditPartition_".$key."'>".
+            "<input type='image' src='images/lists/trash.png' name='RemovePartition_".$key."'>",
+            "attach" => "style='width:40px; border-right: 0px;'");
+      }else{
+        $action =array(
+            "string" => "<input type='image' src='images/lists/edit.png' name='EditPartition_".$key."'>",
+            "attach" => "style='width:40px; border-right: 0px;'");
+      }
+
+      
 
       if($this->FAIdiskType == "lvm"){ 
         $fields = array($cn,$desc,$mntp,$opt,$size, $action);
index e0ecbd3b240734165a7c59753df4eb0f57b3cb5e..a6b5ed8ffea2dbcb23cc802a8f1c6330e78a2b00 100644 (file)
@@ -212,6 +212,7 @@ class faiPartition extends plugin
 
     $smarty->assign("FAIfsTypes", $FAIfsTypes);
     $smarty->assign("cn", $this->cn);
+    $smarty->assign("freeze", preg_match("/freeze/i",$this->parent->FAIstate));
 
     $smarty->assign("plist",$this->getRaidlist());
     $smarty->assign("physicalPartitionList",$this->getPartitionlist());
index d40bb8215330344e46dbcd65b9678da14fa1fba0..4f3c269aa214ae452a51a27464217b276671c6db 100644 (file)
@@ -170,20 +170,18 @@ class faiPartitionTable extends plugin
     }
 
     /* New Listhandling */
-    if (!preg_match("/freeze/i", $this->FAIstate)){
-      foreach($_POST as $name => $value){
-        if(preg_match("/^edit_[^_]*_/",$name)){
-          $s_entry = preg_replace("/^edit_/","",$name);
-          $s_entry = base64_decode(preg_replace("/_.*/","",$s_entry));
-          $s_action = "edit"; 
-          break;
-        }
-        if(preg_match("/^delete_[^_]*_/",$name)){
-          $s_entry = preg_replace("/^delete_/","",$name);
-          $s_entry = base64_decode(preg_replace("/_.*/","",$s_entry));
-          $s_action = "remove";
-          break;
-        }
+    foreach($_POST as $name => $value){
+      if(preg_match("/^edit_[^_]*_/",$name)){
+        $s_entry = preg_replace("/^edit_/","",$name);
+        $s_entry = base64_decode(preg_replace("/_.*/","",$s_entry));
+        $s_action = "edit"; 
+        break;
+      }
+      if (!preg_match("/freeze/i", $this->FAIstate) && preg_match("/^delete_[^_]*_/",$name)){
+        $s_entry = preg_replace("/^delete_/","",$name);
+        $s_entry = base64_decode(preg_replace("/_.*/","",$s_entry));
+        $s_action = "remove";
+        break;
       }
     }
 
@@ -411,7 +409,7 @@ class faiPartitionTable extends plugin
         if($disk['status'] != "delete"){
 
           $act .= "<input type='image' src='images/lists/edit.png'   name='edit_%s'    title='"._("edit")."' alt='"._("edit")."'>";
-          if(preg_match("/d/",$acl)){
+          if(preg_match("/d/",$acl) && !preg_match("/freeze/", $this->FAIstate)){
             $act .="<input type='image' src='images/lists/trash.png' name='delete_%s'  title='"._("delete")."' alt='"._("delete")."'>";
           }
 
index fc2da49fd6af24b7f63582bb039767e1e5896c3d..7e63d61c1193101708a7702624f7100c532560b5 100644 (file)
 <input type='hidden' name='faiPartition' value='1'>
 <p class='seperator'>&nbsp;</p>
 <div style='text-align:right; width:100%; padding:5px'>
+  {if !$freeze}
   <input type='submit' name='PartitionSave' value='{msgPool type=okButton}'>
   &nbsp;
+  {/if}
   <input type='submit' name='PartitionCancel' value='{msgPool type=cancelButton}'>
 </div>