summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8682e06)
raw | patch | inline | side by side (parent: 8682e06)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 11 May 2011 11:13:55 +0000 (11:13 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 11 May 2011 11:13:55 +0000 (11:13 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20804 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl | patch | blob | history | |
gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc | patch | blob | history |
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl b/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl
index ae9cf1a430bc96b04b9fc45b0db3217e37e2ffff..315b60b1c41ae23225d16dd7c6117f95fecfe466 100644 (file)
-<h3>{t}Add Partition{/t}</h3>
-<table>
- <tr>
- <td>{t}Mount point{/t}</td>
- <td>
- {if $fsType == "raid" || $fsType == "swap" || $fsType == "pv"}
- <input disabled type="text" name="mountPoint" value=" - ">
- {else}
- <input type="text" name="mountPoint" value="{$mountPoint}">
- {/if}
- </td>
- </tr>
- <tr>
- <td>{t}File system type{/t}</td>
- <td>
- <select name="fsType" onChange="document.mainform.submit();">
- {html_options options=$fsTypes selected=$fsType}
- </select>
- </td>
- </tr>
- <tr>
- <td>{t}Allowable drives{/t}</td>
- <td>
- {foreach from=$disks item=item key=key}
- <input type="checkbox" {if $disk_selected[$item]} checked {/if}
- name="disk_selected_{$item}">{$item}
- {/foreach}
- </td>
- </tr>
- <tr>
- <td>{t}Size{/t}</td>
- <td>
- <input name="size" value="{$size}">
- </td>
- </tr>
- <tr>
- <td><input type="checkbox" name="forcePrimary" {if $forcePrimary_selected} checked {/if}></td>
- <td>{t}Force to be primary partition{/t}</td>
- </tr>
- <tr>
- <td><input type="checkbox" name="encrypt" {if $encrypt_selected} checked {/if}></td>
- <td>{t}Encrypt{/t}</td>
- </tr>
-</table>
+<h3>{t}Type{/t}</h3>
+
+<input {if $selected_type==1} checked {/if} onClick="document.mainform.submit();"
+ type="radio" value="1" name="selected_type">{t}Physical partition{/t}<br>
+<input {if $selected_type==2} checked {/if} onClick="document.mainform.submit();"
+ type="radio" value="2" name="selected_type">{t}Raid device{/t}<br>
+<input {if $selected_type==3} checked {/if} onClick="document.mainform.submit();"
+ type="radio" value="3" name="selected_type">{t}LVM Valume group{/t}<br>
+<input {if $selected_type==4} checked {/if} onClick="document.mainform.submit();"
+ type="radio" value="4" name="selected_type">{t}LVM Valume{/t}<br>
<hr>
-<h3>{t}Additional size options{/t}</h3>
-<table>
- <tr>
- <td><input type="radio" name="size_options" value="0"
- onClick="document.mainform.submit();"
- {if $size_options==0} checked {/if}></td>
- <td>{t}Fixed size{/t}</td>
- </tr>
- <tr>
- <td><input type="radio" name="size_options" value="1"
- onClick="document.mainform.submit();"
- {if $size_options==1} checked {/if}></td>
- <td>{t}Fill all space up to{/t}
- <input {if $size_options != 1} disabled {/if}
- id="size_max_value"
- type="text" value="{$size_max_value}"> {t}MB{/t}
- </td>
- </tr>
- <tr>
- <td><input type="radio" name="size_options" value="2"
- onClick="document.mainform.submit();"
- {if $size_options==2} checked {/if}></td>
- <td>{t}Fill to maximum allowable size{/t}</td>
- </tr>
-</table>
+
+{if $selected_type==1}
+ <h3>{t}Add Partition{/t}</h3>
+
+ <table>
+ <tr>
+ <td>{t}Mount point{/t}</td>
+ <td>
+ {if $fsType == "raid" || $fsType == "swap" || $fsType == "pv"}
+ <input disabled type="text" name="mountPoint" value=" - ">
+ {else}
+ <input type="text" name="mountPoint" value="{$mountPoint}">
+ {/if}
+ </td>
+ </tr>
+ <tr>
+ <td>{t}File system type{/t}</td>
+ <td>
+ <select name="fsType" onChange="document.mainform.submit();">
+ {html_options options=$fsTypes selected=$fsType}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>{t}Allowable drives{/t}</td>
+ <td>
+ {foreach from=$disks item=item key=key}
+ <input type="radio" {if $used_disk == $item} checked {/if}
+ name="used_disk" value="{$item}">{$item}
+ {/foreach}
+ </td>
+ </tr>
+ <tr>
+ <td>{t}Size{/t}</td>
+ <td>
+ <input name="size" value="{$size}">
+ </td>
+ </tr>
+ <tr>
+ <td><input type="checkbox" name="forcePrimary" {if $forcePrimary_selected} checked {/if}></td>
+ <td>{t}Force to be primary partition{/t}</td>
+ </tr>
+ <tr>
+ <td><input type="checkbox" name="encrypt" {if $encrypt_selected} checked {/if}></td>
+ <td>{t}Encrypt{/t}</td>
+ </tr>
+ </table>
+
+ <hr>
+
+ <h3>{t}Additional size options{/t}</h3>
+ <table>
+ <tr>
+ <td><input type="radio" name="size_options" value="0"
+ onClick="document.mainform.submit();"
+ {if $size_options==0} checked {/if}></td>
+ <td>{t}Fixed size{/t}</td>
+ </tr>
+ <tr>
+ <td><input type="radio" name="size_options" value="1"
+ onClick="document.mainform.submit();"
+ {if $size_options==1} checked {/if}></td>
+ <td>{t}Fill all space up to{/t}
+ <input {if $size_options != 1} disabled {/if}
+ id="size_max_value"
+ type="text" value="{$size_max_value}"> {t}MB{/t}
+ </td>
+ </tr>
+ <tr>
+ <td><input type="radio" name="size_options" value="2"
+ onClick="document.mainform.submit();"
+ {if $size_options==2} checked {/if}></td>
+ <td>{t}Fill to maximum allowable size{/t}</td>
+ </tr>
+ </table>
+{/if}
<hr>
<div class="clear"></div>
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc
index b76db637c96ff32c9ea85e45bb1b014d2067dc28..b6bde4edc38a5b6bcc2ab233cdfdae29664ebbcc 100644 (file)
<?php
+
+define('PARTITION' , 1);
+define('RAID_DEVICE' , 2);
+define('VOLUME_GROUP' , 3);
+define('VOLUME' , 4);
+
+
+
class AddPartitionDialog
{
public $partitionObject;
public $disks = array();
+ public $selected_type = PARTITION;
// Partition properties
public $size = 1000;
public $fsType = 'ext3';
public $mountPoint = '';
- public $usedDisks = array();
+ public $used_disk = array();
public $forcePrimary = FALSE;
public $encrypt = FALSE;
public $size_max_value = 1000;
public $size_options = 0;
// Attributes managed by this plugin.
- public $attributes = array("size", "fsType", "mountPoint", "forcePrimary", "encrypt",
- "size_options", "size_max_value");
-
+ public $attributes = array("selected_type", "size", "fsType", "mountPoint", "forcePrimary", "encrypt",
+ "size_options", "size_max_value", "used_disk");
/*! \brief Constructs the Dialog and loads all required informations
* to be able to add partitions, raid devices, volumes groups ...
foreach($disks as $disk){
$this->disks[$disk['device']] = $disk['device'];
}
- if(!count($this->usedDisks)){
- $this->usedDisks[] = key($this->disks);
- }
+
+ // Select first disk as default.
+ $this->used_disk = key($this->disks);
}
foreach($this->attributes as $attr){
$smarty->assign($attr, $this->$attr);
}
- $used = array();
- foreach($this->disks as $disk){
- $used[$disk] = in_array($disk, $this->usedDisks);
- }
- $smarty->assign("disk_selected", $used);
foreach(array("forcePrimary", "encrypt") as $attr){
$smarty->assign("{$attr}_selected", $this->$attr != FALSE);
}
foreach(array("forcePrimary", "encrypt") as $attr){
$this->$attr = isset($_POST[$attr]);
}
-
- // Get selected disks
- $this->usedDisks = array();
- foreach($this->disks as $disk){
- if(isset($_POST['disk_selected_'.$disk])){
- $this->usedDisks[] = $disk;
- }
- }
}
$fsOptions = "";
$encrypt = $this->encrypt;
$passphrase = "";
- $disk = array_shift($this->usedDisks);
+ $disk = $this->used_disk;
// We've to create a raid disk
if($this->fsType == "raid"){