Code

Partition changes.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 28 Jul 2009 12:06:38 +0000 (12:06 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 28 Jul 2009 12:06:38 +0000 (12:06 +0000)
-Uh that stuff is a bit confusing - just a commit of my changes.

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

gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc
gosa-plugins/fai/admin/fai/class_faiLvmEntry.inc
gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc
gosa-plugins/fai/admin/fai/faiLvmEntry.tpl [new file with mode: 0644]

index 19f85219cc85c0a26710988b4873a3ab39ee21bc..69253f5fe5440912a179294829788025b55646a3 100644 (file)
@@ -207,6 +207,28 @@ class faiDiskEntry extends plugin
 
   function generateParts()
   {
+
+    $divlist = new divSelectBox("DiskEntries"); 
+    foreach($this->partitions as $key => $part){
+     
+
+      $number =array("string" => $part['FAIpartitionNr']);
+      $size   =array("string" => $part['FAIpartitionSize']);
+      $mntp   =array("string" => $part['FAImountPoint']);
+      $fstype =array("string" => $part['FAIfsType']);
+      $type   =array("string" => $part['FAIpartitionType']);
+      
+      $desc   =array("string" => $part['description']);
+      $opt    =array("string" => $part['FAImountOptions']);
+      $fsopt  =array("string" => $part['FAIfsOptions']);
+      $flags  =array("string" => $part['FAIpartitionFlags']);
+
+    
+      $fields = array($number,$mntp,$size,$fstype,$type);
+      $divlist->AddEntry($fields);
+    }
+    return($divlist->DrawList());    
+
     /* Define Arrays with allowed syntax */
     $PartitionTypes   = array("primary"=>_("primary"),"logical"=>_("logical"));
     $FAIfsTypes       = array("ext2","ext3","xfs","swap","reiser","dosfat16","winfat32");
index 23ae1066c91cf492756aa64ee164e83bed2040ec..bc15c3d5cd82f7597a9cf94f7605a8fedba5dcf9 100644 (file)
@@ -26,8 +26,9 @@ class faiLvmEntry extends plugin
   function __construct (&$config, $dn= NULL,$usedDiskNames=array(),$disk=false)
   {
     plugin::plugin ($config, $dn);
-    $this->UsedAttrs  = array("cn","description","FAIpartitionType","FAIpartitionNr","FAIfsType","FAImountPoint","FAIpartitionSize",
-                         "FAImountOptions","FAIfsOptions","FAIpartitionFlags");
+    $this->UsedAttrs  = array("cn","description","FAIpartitionType",
+        "FAIpartitionNr","FAIfsType","FAImountPoint","FAIpartitionSize",
+        "FAImountOptions","FAIfsOptions","FAIpartitionFlags");
 
     /* Default status is new */
     $this->status = "new";    
@@ -35,7 +36,7 @@ class faiLvmEntry extends plugin
     /* We want to edit an entry */
     if($disk){
 
-      /* Set disk status */      
+      /* Set disk status, eg removed. */      
       $this->status = $disk['status'];
 
       /* Walk through partitions */
@@ -97,7 +98,6 @@ class faiLvmEntry extends plugin
       } else {
         $this->fstabkey= "device";
       }
-
     }
   }
 
@@ -198,10 +198,14 @@ class faiLvmEntry extends plugin
     $smarty->assign("disklabels", array("msdos" => "MSDOS", "gpt" => "GPT"));
     $smarty->assign("fstabkey", $this->fstabkey);
     $smarty->assign("disklabel", $this->disklabel);
+
+    // Create divlist 
+    $divlist = new divSelectBox("lvmDisks");
+    $smarty->assign("clist", $this->generateParts().$divlist->DrawList());
  
     /* Fetch template and show the result
      */
-    $display.= $smarty->fetch(get_template_path('faiDiskEntry.tpl', TRUE));
+    $display.= $smarty->fetch(get_template_path('faiLvmEntry.tpl', TRUE));
     return($display);
   }
 
index 866ff64a2d7fec240e9d645ab4edc7294ed21df8..8146b5cfe04e8cc99466f68c4d62a112fa4d0b1d 100644 (file)
@@ -283,16 +283,35 @@ class faiPartitionTable extends plugin
           $dn = "new";
         }
 
-        if ($this->FAIpartitionMethod == "setup-storage") {
-          $this->dialog = new faiDiskEntry($this->config,$this->dn,$usedDiskNames,$this->disks[$Udisk]); 
-        } else {
-          $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames,$this->disks[$Udisk]); 
+        if(isset($this->disks[$Udisk]['FAIdiskType'])){
+          switch($this->disks[$Udisk]['FAIdiskType']){
+            case 'raid': 
+              $this->dialog = new faiRaidEntry(
+                $this->config,$this->dn,$usedDiskNames,$this->disks[$Udisk]); 
+              break;
+            case 'lvm': 
+              $this->dialog = new faiLvmEntry(
+                $this->config,$this->dn,$usedDiskNames,$this->disks[$Udisk]); 
+              break;
+            case 'disk': 
+              $this->dialog = new faiDiskEntry(
+                $this->config,$this->dn,$usedDiskNames,$this->disks[$Udisk]); 
+              break;
+            case 'old': 
+              $this->dialog = new faiPartitionTableEntry(
+                  $this->config,$this->dn,$usedDiskNames,$this->disks[$Udisk]); 
+              break;
+          }
+        }else{
+          $this->dialog = new faiPartitionTableEntry(
+              $this->config,$this->dn,$usedDiskNames,$this->disks[$Udisk]); 
+        }
+        if($this->dialog){
+          $this->dialog->set_acl_base($this->acl_base_for_current_object($dn));
+          $this->dialog->set_acl_category("fai");
+          $this->dialog->FAIstate = $this->FAIstate;
+          $this->is_dialog = true;
         }
-        $this->dialog->set_acl_base($this->acl_base_for_current_object($dn));
-        $this->dialog->set_acl_category("fai");
-        $this->dialog->FAIstate = $this->FAIstate;
-
-        $this->is_dialog = true;
       }
     }
 
diff --git a/gosa-plugins/fai/admin/fai/faiLvmEntry.tpl b/gosa-plugins/fai/admin/fai/faiLvmEntry.tpl
new file mode 100644 (file)
index 0000000..36783fb
--- /dev/null
@@ -0,0 +1,75 @@
+<input type="hidden" name="LvmFrameSubmitted" value="1">
+
+<h2>
+  <img class="center" alt="" src="plugins/fai/images/fai_partitionTable.png" 
+    align="middle" title="{t}Generic{/t}">&nbsp;{t}Device{/t}
+</h2>
+<table style='width:100%' summary="">
+       <tr>
+               <td style='width:50%;border-right:1px solid #909090;'>
+
+      <table>
+        <tr>
+          <td>
+            <LABEL for="DISKcn">{t}Name{/t}</LABEL>{$must}&nbsp;
+          </td>
+          <td>
+{render acl=$DISKcnACL}
+            <input value="{$DISKcn}" size="45" maxlength="80" name="DISKcn" id="DISKcn">
+{/render}
+                     </td>
+        </tr>
+        <tr>
+                     <td>
+            <LABEL for="fstabkey">{t}FSTAB key{/t}</LABEL>
+          </td>
+          <td>
+{render acl=$DISKFAIdiskOptionACL}
+            <select name="fstabkey" size="1">
+               {html_options options=$fstabkeys selected=$fstabkey}
+            </select>
+{/render}
+                   </td>
+        </tr>
+      </table>
+    </td>
+               <td style='vertical-align:top;'>
+      <table>
+        <tr>
+          <td>
+            <LABEL for="DISKdescription">&nbsp;{t}Description{/t}</LABEL>&nbsp;
+          </td>
+          <td>
+{render acl=$DISKdescriptionACL}
+                             <input value="{$DISKdescription}" size="45" maxlength="80" 
+              name="DISKdescription" id="DISKdescription">
+{/render}
+                     </td>
+        </tr>
+      </table>
+    </td>
+       </tr>
+</table>
+<br>
+<p class="seperator">&nbsp;</p>
+<h2>{t}Combined partitions{/t}</h2>
+
+{$clist}
+
+<br>
+<p class="seperator">&nbsp;</p>
+<br>
+
+<div style="align:right;" align="right">
+{if !$freeze}
+       <input type="submit" name="SaveDisk" value="{msgPool type=saveButton}">
+{/if}
+<input type="submit" name="CancelDisk" value="{msgPool type=cancelButton}" >
+</div>
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('DISK_cn');
+  -->
+</script>
+