summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 515c3aa)
raw | patch | inline | side by side (parent: 515c3aa)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 11 May 2011 12:36:45 +0000 (12:36 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 11 May 2011 12:36:45 +0000 (12:36 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20805 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 315b60b1c41ae23225d16dd7c6117f95fecfe466..9070b012d9fa44ec55454c8397d545b41fed583a 100644 (file)
<tr>
<td>{t}Mount point{/t}</td>
<td>
- {if $fsType == "raid" || $fsType == "swap" || $fsType == "pv"}
- <input disabled type="text" name="mountPoint" value=" - ">
+ {if $p_fsType == "raid" || $p_fsType == "swap" || $p_fsType == "pv"}
+ <input disabled type="text" name="p_mountPoint" value=" - ">
{else}
- <input type="text" name="mountPoint" value="{$mountPoint}">
+ <input type="text" name="p_mountPoint" value="{$p_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 name="p_fsType" onChange="document.mainform.submit();">
+ {html_options options=$fsTypes selected=$p_fsType}
</select>
</td>
</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}
+ <input type="radio" {if $p_used_disk == $item} checked {/if}
+ name="p_used_disk" value="{$item}">{$item}
{/foreach}
</td>
</tr>
<tr>
<td>{t}Size{/t}</td>
<td>
- <input name="size" value="{$size}">
+ <input name="p_size" value="{$p_size}">
</td>
</tr>
<tr>
- <td><input type="checkbox" name="forcePrimary" {if $forcePrimary_selected} checked {/if}></td>
+ <td><input type="checkbox" name="p_forcePrimary" {if $p_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><input type="checkbox" name="p_encrypt" {if $p_encrypt_selected} checked {/if}></td>
<td>{t}Encrypt{/t}</td>
</tr>
</table>
<h3>{t}Additional size options{/t}</h3>
<table>
<tr>
- <td><input type="radio" name="size_options" value="0"
+ <td><input type="radio" name="p_size_options" value="0"
onClick="document.mainform.submit();"
- {if $size_options==0} checked {/if}></td>
+ {if $p_size_options==0} checked {/if}></td>
<td>{t}Fixed size{/t}</td>
</tr>
<tr>
- <td><input type="radio" name="size_options" value="1"
+ <td><input type="radio" name="p_size_options" value="1"
onClick="document.mainform.submit();"
- {if $size_options==1} checked {/if}></td>
+ {if $p_size_options==1} checked {/if}></td>
<td>{t}Fill all space up to{/t}
- <input {if $size_options != 1} disabled {/if}
+ <input {if $p_size_options != 1} disabled {/if}
id="size_max_value"
- type="text" value="{$size_max_value}"> {t}MB{/t}
+ type="text" value="{$p_size_max_value}"> {t}MB{/t}
</td>
</tr>
<tr>
- <td><input type="radio" name="size_options" value="2"
+ <td><input type="radio" name="p_size_options" value="2"
onClick="document.mainform.submit();"
- {if $size_options==2} checked {/if}></td>
+ {if $p_size_options==2} checked {/if}></td>
<td>{t}Fill to maximum allowable size{/t}</td>
</tr>
</table>
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 b6bde4edc38a5b6bcc2ab233cdfdae29664ebbcc..acbff6e5face2a3371367a4d114f942f30b9c004 100644 (file)
public $selected_type = PARTITION;
// Partition properties
- public $size = 1000;
- public $fsType = 'ext3';
- public $mountPoint = '';
- public $used_disk = array();
- public $forcePrimary = FALSE;
- public $encrypt = FALSE;
- public $size_max_value = 1000;
- public $size_options = 0;
+ public $p_size = 1000;
+ public $p_fsType = 'ext3';
+ public $p_mountPoint = '';
+ public $p_used_disk = array();
+ public $p_forcePrimary = FALSE;
+ public $p_encrypt = FALSE;
+ public $p_size_max_value = 1000;
+ public $p_size_options = 0;
// Attributes managed by this plugin.
- public $attributes = array("selected_type", "size", "fsType", "mountPoint", "forcePrimary", "encrypt",
- "size_options", "size_max_value", "used_disk");
+ public $attributes = array("selected_type");
+ public $p_attributes = array("p_size", "p_fsType", "p_mountPoint", "p_forcePrimary", "p_encrypt",
+ "p_size_options", "p_size_max_value", "p_used_disk");
/*! \brief Constructs the Dialog and loads all required informations
* to be able to add partitions, raid devices, volumes groups ...
}
// Select first disk as default.
- $this->used_disk = key($this->disks);
+ $this->p_used_disk = key($this->disks);
}
function execute()
{
$smarty = get_smarty();
+
+ // Assign base attributes
foreach($this->attributes as $attr){
$smarty->assign($attr, $this->$attr);
}
- foreach(array("forcePrimary", "encrypt") as $attr){
+
+ // Assign partition attributes.
+ $attrs = $bool_attrs = array();
+ switch($this->selected_type){
+ case PARTITION: {
+ $attrs = $this->p_attributes;
+ $bool_attrs = array("p_forcePrimary", "p_encrypt");
+ break;
+ }
+ }
+
+ // Assign properties to smarty.
+ foreach($attrs as $attr){
+ $smarty->assign($attr, $this->$attr);
+ }
+ foreach($bool_attrs as $attr){
$smarty->assign("{$attr}_selected", $this->$attr != FALSE);
}
$smarty->assign('fsTypes', $this->fsTypes);
- $smarty->assign('size', $this->size);
$smarty->assign('disks', $this->disks);
return($smarty->fetch(get_template_path("goto/Device/AddPartitionDialog.tpl", TRUE)));
}
*/
function save_object()
{
+ // Assign partition attributes.
+ $attrs = $bool_attrs = array();
+ switch($this->selected_type){
+ case PARTITION: {
+ $attrs = $this->p_attributes;
+ $bool_attrs = array("p_forcePrimary", "p_encrypt");
+ break;
+ }
+ }
+
// Get posted string values
- foreach($this->attributes as $attr){
+ $attrs = array_merge($attrs, $this->attributes);
+ foreach($attrs as $attr){
if(isset($_POST[$attr])){
$this->$attr = get_post($attr);
}
}
// Get boolean values
- foreach(array("forcePrimary", "encrypt") as $attr){
+ foreach($bool_attrs as $attr){
$this->$attr = isset($_POST[$attr]);
}
}
}
// Collect options
- $size = $this->size;
+ $size = $this->p_size;
$maxSize = NULL;
- if($this->size_options == 2){
- $maxSize = $this->size_max_value;
+ if($this->p_size_options == 2){
+ $maxSize = $this->p_size_max_value;
}
- $grow = $this->size_options == 1;
+ $grow = $this->p_size_options == 1;
$format = FALSE;
$boot = FALSE;
- $primary = $this->forcePrimary;
- $fsType = $this->fsType;
+ $primary = $this->p_forcePrimary;
+ $fsType = $this->p_fsType;
$fsOptions = "";
- $encrypt = $this->encrypt;
+ $encrypt = $this->p_encrypt;
$passphrase = "";
- $disk = $this->used_disk;
+ $disk = $this->p_used_disk;
// We've to create a raid disk
- if($this->fsType == "raid"){
+ if($this->p_fsType == "raid"){
$target="raid.";
$id = 0;
while($id < 100 && in_array($target.str_pad($id, 2, '0', STR_PAD_LEFT) , $usedTargets)){
}else
// We've to create a raid disk
- if($this->fsType == "pv"){
+ if($this->p_fsType == "pv"){
$target="pv.";
$id = 0;
while($id < 100 && in_array($target.str_pad($id, 2, '0', STR_PAD_LEFT) , $usedTargets)){