summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9bec9c8)
raw | patch | inline | side by side (parent: 9bec9c8)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 30 Jul 2009 11:39:41 +0000 (11:39 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 30 Jul 2009 11:39:41 +0000 (11:39 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13963 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc b/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc
index 694045765ef5582d0f420b3cb9a742d7ede0f27c..9d5f8c943535e55920a8df92817a29a1e2094c34 100644 (file)
var $partitions = array();
var $UsedAttrs = array("cn","description","FAIpartitionType",
- "FAIpartitionNr","FAIfsType","FAImountPoint","FAIpartitionSize","FAIfsTuneOptions",
- "FAIfsCreateOptions",
- "FAImountOptions","FAIfsOptions","FAIpartitionFlags","FAIdiskOption");
+ "FAIpartitionNr","FAIfsType","FAImountPoint","FAIpartitionSize",
+ "FAIfsTuneOptions", "FAIfsCreateOptions", "FAImountOptions",
+ "FAIfsOptions","FAIpartitionFlags","FAIdiskOption");
var $is_edit = false;
var $old_cn = "";
var $deletePartitions = array();
var $fstabkey = "device";
var $disklabel = "msdos";
-
var $FAIstate = "";
var $FAIdiskType = "disk";
{
plugin::plugin ($config, $dn);
-
// Set default attributes
$this->parent = $parent;
$this->FAIdiskType = $type;
$this->status = "new";
-
// If disk is not empty, then we are going to edit
// an existing disk, load disk info now.
if (preg_match("/^bootable:/", $option)){
$bootable = split(",", trim(preg_replace("/^bootable:/","",$option),","));
foreach($bootable as $bootflag){
- $this->partitions[$bootflag]['bootable'] = TRUE;
+ if(isset($this->partitions[$bootflag])){
+ $this->partitions[$bootflag]['bootable'] = TRUE;
+ }
}
continue;
}
if (preg_match("/^resize:/", $option)){
$resize = split(",", trim(preg_replace("/^resize:/","",$option),","));
foreach($resize as $id){
- $this->partitions[$id]['resize'] = TRUE;
+ if(isset($this->partitions[$bootflag])){
+ $this->partitions[$id]['resize'] = TRUE;
+ }
}
continue;
}
if (preg_match("/^preserve_always:/", $option)){
$preserve = split(",", trim(preg_replace("/^preserve_always:/","",$option),","));
foreach($preserve as $presflag){
- $this->partitions[$presflag]['preserve'] = TRUE;
- $this->partitions[$presflag]['preserveType'] = 'always';
+ if(isset($this->partitions[$bootflag])){
+ $this->partitions[$presflag]['preserve'] = TRUE;
+ $this->partitions[$presflag]['preserveType'] = 'always';
+ }
}
continue;
}
if (preg_match("/^preserve_reinstall:/", $option)){
$preserve = split(",", trim(preg_replace("/^preserve_reinstall:/","",$option),","));
foreach($preserve as $presflag){
- $this->partitions[$presflag]['preserve'] = TRUE;
- $this->partitions[$presflag]['preserveType'] = 'reinstall';
+ if(isset($this->partitions[$bootflag])){
+ $this->partitions[$presflag]['preserve'] = TRUE;
+ $this->partitions[$presflag]['preserveType'] = 'reinstall';
+ }
}
continue;
}
if($this->dialog instanceOf plugin && isset($_POST['PartitionSave'])){
$this->dialog->save_object();
$attrs = $this->dialog->save();
- if(isset($attrs['FAIpartitionNr'])){
+ if(isset($attrs['FAIpartitionNr']) && $attrs['FAIpartitionNr'] != ""){
$this->partitions[$attrs['FAIpartitionNr']] = $attrs;
}else{
- $this->partitions[] = $attrs;
+ $attrs['FAIpartitionNr'] = count($this->partitions) + 1;
+ $attrs['cn'] = &$attrs['FAIpartitionNr'];
+ $this->partitions[$attrs['FAIpartitionNr']] = $attrs;
}
$this->dialog = null;
}
diff --git a/gosa-plugins/fai/admin/fai/class_faiPartition.inc b/gosa-plugins/fai/admin/fai/class_faiPartition.inc
index 72942a65d14017215293efe93711ec7b29772861..ced852af98433b793288bc7957509c42c218189e 100644 (file)
{
$this->parent = $parent;
+ $this->status = "new";
+
+ // Load attributes from existing partition
+ if($object){
- foreach($this->attributes as $attr){
- if(isset($object[$attr])){
- $this->$attr = $object[$attr];
+ foreach($this->attributes as $attr){
+ if(isset($object[$attr])){
+ $this->$attr = $object[$attr];
+ }
}
- }
- $this->status = $object['status'];
- $this->FAIdiskType = $type;
-
- if($type == "disk"){
-
- /* Prepare size attribute
- * This attribute may represent a range, a fixed value
- * or a percentage.
- * fixed is just a number * 500MB
- * range * 500MB-1TB
- * remaining * -
- */
- // Fixed
- if(preg_match("/^[0-9]*(KB|MB|GB|TB|PB|%)$/",$this->FAIpartitionSize)){
- $this->sizeStart = preg_replace("/^([0-9]*)(KB|MB|GB|TB|PB|%)$/","\\1",$this->FAIpartitionSize);
- $this->sizeStart_Type = preg_replace("/^([0-9]*)(KB|MB|GB|TB|PB|%)$/","\\2",$this->FAIpartitionSize);
- $this->FAIpartitionSizeType = "fixed";
- }else
-
- // Dynamic range
- if(preg_match("/^[0-9]*(KB|MB|GB|TB|PB|%)-[0-9]*(KB|MB|GB|TB|PB|%)$/",$this->FAIpartitionSize)){
- $this->sizeStart = preg_replace("/^([0-9]*)(KB|MB|GB|TB|PB|%).*$/","\\1",$this->FAIpartitionSize);
- $this->sizeStart_Type = preg_replace("/^([0-9]*)(KB|MB|GB|TB|PB|%).*$/","\\2",$this->FAIpartitionSize);
- $this->sizeStop = preg_replace("/^[^\-]*\-([0-9]*)(KB|MB|GB|TB|PB|%)$/","\\1",$this->FAIpartitionSize);
- $this->sizeStop_Type = preg_replace("/^[^\-]*\-([0-9]*)(KB|MB|GB|TB|PB|%)$/","\\2",$this->FAIpartitionSize);
- $this->FAIpartitionSizeType = "dynamic";
- }else
-
- // Dynamic range
- if(preg_match("/^\-$/",$this->FAIpartitionSize)){
- $this->FAIpartitionSizeType = "remaining";
+ $this->status = $object['status'];
+ $this->FAIdiskType = $type;
+
+ if($type == "disk"){
+
+ /* Prepare size attribute
+ * This attribute may represent a range, a fixed value
+ * or a percentage.
+ * fixed is just a number * 500MB
+ * range * 500MB-1TB
+ * remaining * -
+ */
+ // Fixed
+ if(preg_match("/^[0-9]*(KB|MB|GB|TB|PB|%)$/",$this->FAIpartitionSize)){
+ $this->sizeStart = preg_replace("/^([0-9]*)(KB|MB|GB|TB|PB|%)$/","\\1",$this->FAIpartitionSize);
+ $this->sizeStart_Type = preg_replace("/^([0-9]*)(KB|MB|GB|TB|PB|%)$/","\\2",$this->FAIpartitionSize);
+ $this->FAIpartitionSizeType = "fixed";
+ }else
+
+ // Dynamic range
+ if(preg_match("/^[0-9]*(KB|MB|GB|TB|PB|%)-[0-9]*(KB|MB|GB|TB|PB|%)$/",$this->FAIpartitionSize)){
+ $this->sizeStart = preg_replace("/^([0-9]*)(KB|MB|GB|TB|PB|%).*$/","\\1",$this->FAIpartitionSize);
+ $this->sizeStart_Type = preg_replace("/^([0-9]*)(KB|MB|GB|TB|PB|%).*$/","\\2",$this->FAIpartitionSize);
+ $this->sizeStop = preg_replace("/^[^\-]*\-([0-9]*)(KB|MB|GB|TB|PB|%)$/","\\1",$this->FAIpartitionSize);
+ $this->sizeStop_Type = preg_replace("/^[^\-]*\-([0-9]*)(KB|MB|GB|TB|PB|%)$/","\\2",$this->FAIpartitionSize);
+ $this->FAIpartitionSizeType = "dynamic";
+ }else
+
+ // Dynamic range
+ if(preg_match("/^\-$/",$this->FAIpartitionSize)){
+ $this->FAIpartitionSizeType = "remaining";
- }
+ }
- /* Check for encrypted partitions
- */
- if(preg_match("/:encrypt$/",$this->FAImountPoint)){
- $this->FAImountPoint = preg_replace("/:encrypt/","",$this->FAImountPoint);
- $this->encrypted = TRUE;
- }
-
- }elseif($type == "raid"){
-
- $usedDisks = split(",",$this->FAIpartitionSize);
- foreach($usedDisks as $disk){
- $name = preg_replace("/:.*$/","",$disk);
- $spare = preg_match("/:spare/",$disk);
- $missing = preg_match("/:missing/",$disk);
- $this->raidDevices[$name] =
- array(
- "name" => $name,
- "spare" => $spare,
- "missing" => $missing);
+ /* Check for encrypted partitions
+ */
+ if(preg_match("/:encrypt$/",$this->FAImountPoint)){
+ $this->FAImountPoint = preg_replace("/:encrypt/","",$this->FAImountPoint);
+ $this->encrypted = TRUE;
+ }
+
+ }elseif($type == "raid"){
+
+ $usedDisks = split(",",$this->FAIpartitionSize);
+ foreach($usedDisks as $disk){
+ $name = preg_replace("/:.*$/","",$disk);
+ $spare = preg_match("/:spare/",$disk);
+ $missing = preg_match("/:missing/",$disk);
+ $this->raidDevices[$name] =
+ array(
+ "name" => $name,
+ "spare" => $spare,
+ "missing" => $missing);
+ }
}
}
}
diff --git a/gosa-plugins/fai/admin/fai/faiDiskEntry.tpl b/gosa-plugins/fai/admin/fai/faiDiskEntry.tpl
index 1dc9916a9b6399bffbfb1cc116d69e7ed4018c20..b1de5061ea52ab5c3cc893426d095630fa7701b8 100644 (file)
<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}
- </td><td>
+
+ <table>
+ <tr>
+ <td>
+ <LABEL for="DISKcn">{t}Name{/t}</LABEL>{$must}
+ </td>
+ <td>
{render acl=$DISKcnACL}
- <input value="{$DISKcn}" size="45" maxlength="80" name="DISKcn" id="DISKcn">
+ <input value="{$DISKcn}" size="45" maxlength="80" name="DISKcn" id="DISKcn">
{/render}
- </td>
- </tr>
- <tr>
- <td><LABEL for="fstabkey">
- {t}FSTAB key{/t}
- </td><td>
+ </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>
+ <select name="fstabkey" size="1">
+ {html_options options=$fstabkeys selected=$fstabkey}
+ </select>
{/render}
- </td>
- </tr>
- </table>
- </td>
+ </td>
+ </tr>
+ </table>
+
+ </td>
<td>
- <table>
- <tr>
- <td>
-<LABEL for="DISKdescription">
- {t}Description{/t}
- </LABEL>
- </td><td>
+
+ <table>
+ <tr>
+ <td>
+ <LABEL for="DISKdescription"> {t}Description{/t}</LABEL>
+ </td>
+ <td>
{render acl=$DISKdescriptionACL}
- <input value="{$DISKdescription}" size="45" maxlength="80" name="DISKdescription" id="DISKdescription">
+ <input value="{$DISKdescription}" size="45" maxlength="80"
+ name="DISKdescription" id="DISKdescription">
{/render}
- </td>
- </tr>
- <tr>
- <td><LABEL for="disklabel">
- {t}Disk label{/t}
- </td><td>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <LABEL for="disklabel">{t}Disk label{/t}</LABEL>
+ </td>
+ <td>
{render acl=$DISKFAIdiskOptionACL}
- <select name="disklabel" size="1">
- {html_options options=$disklabels selected=$disklabel}
- </select>
+ <select name="disklabel" size="1">
+ {html_options options=$disklabels selected=$disklabel}
+ </select>
{/render}
- </td>
- </tr>
- </table>
+ </td>
+ </tr>
+ </table>
+
+ </td>
</tr>
</table>
<br>
diff --git a/gosa-plugins/fai/admin/fai/faiPartition.tpl b/gosa-plugins/fai/admin/fai/faiPartition.tpl
index 34d78945b1fcdf4f5aad6eabfde4e7949ae588ec..1d33862d6ded4321d312072192899fe8ec402326 100644 (file)
</td>
</tr>
-{if $FAIdiskType == "disk"}
+{if $FAIdiskType == "disk" || $FAIdiskType == "lvm"}
<tr>
<td>{t}Size{/t}</td>
</tr>
{/if}
-{if $FAIdiskType == "raid" || $FAIdiskType == "disk"}
-
<tr>
<td>
{t}Filesystem{/t}
</td>
</tr>
-{/if}
-
-
-
<!-- Table cell sizing -->
<tr>
<td colspan=2 style='width:50%;'></td>