From 4d34a6cf6558f6eb3c970c8a52ec59beebd2cb79 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 12 May 2011 09:36:12 +0000 Subject: [PATCH] Do not allow to format or encrypt 'swap', 'pv.' or 'raid.' disks git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20814 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../systems/goto/Device/AddPartitionDialog.tpl | 14 +++++++++++++- .../goto/Device/class_AddPartitionDialog.inc | 12 ++++++++---- .../systems/goto/Device/class_DevicePartition.inc | 10 +++++++--- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl b/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl index 03597c8c6..8e077657e 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl +++ b/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl @@ -183,7 +183,19 @@ {t}Encrypt{/t} - + {if $p_fsType == "raid" || $p_fsType == "swap" || $p_fsType == "pv"} + + {else} + + {/if} + + + {t}Format{/t} + {if $p_fsType == "raid" || $p_fsType == "swap" || $p_fsType == "pv"} + + {else} + + {/if} 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 ce55f3564..cef1e124c 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc @@ -48,6 +48,7 @@ class AddPartitionDialog // Partition properties public $p_size = 1000; + public $p_format = FALSE; public $p_fsType = 'ext3'; public $p_mountPoint = ''; public $p_used_disk = array(); @@ -61,7 +62,7 @@ class AddPartitionDialog // Partitions attributes public $p_attributes = array("p_size", "p_fsType", "p_mountPoint", "p_forcePrimary", "p_encrypt", - "p_size_options", "p_size_max_value", "p_used_disk"); + "p_size_options", "p_size_max_value", "p_used_disk", "p_format"); // Raid device attributes public $r_attributes = array("r_fsType", "r_mountPoint", "r_raidLevel", "r_partitions", @@ -144,7 +145,7 @@ class AddPartitionDialog switch($this->selected_type){ case PARTITION: { $attrs = $this->p_attributes; - $bool_attrs = array("p_forcePrimary", "p_encrypt"); + $bool_attrs = array("p_forcePrimary", "p_encrypt", "p_format"); break; } case RAID_DEVICE: { @@ -198,7 +199,7 @@ class AddPartitionDialog switch($this->selected_type){ case PARTITION: { $attrs = $this->p_attributes; - $bool_attrs = array("p_forcePrimary", "p_encrypt"); + $bool_attrs = array("p_forcePrimary", "p_encrypt", "p_format"); break; } case RAID_DEVICE: { @@ -372,7 +373,7 @@ class AddPartitionDialog $maxSize = $this->p_size_max_value; } $grow = $this->p_size_options == 1; - $format = FALSE; + $format = $this->p_format == 1; $boot = FALSE; $primary = $this->p_forcePrimary; $fsType = $this->p_fsType; @@ -390,6 +391,7 @@ class AddPartitionDialog } $target = $target.str_pad($id, 2, '0', STR_PAD_LEFT); $fsType = $fsOptions = NULL; + $encrypt = $format = FALSE; }else // We've to create a raid disk @@ -401,12 +403,14 @@ class AddPartitionDialog } $target = $target.str_pad($id, 2, '0', STR_PAD_LEFT); $fsType = $fsOptions = NULL; + $encrypt = $format = FALSE; }else{ // Add normal-physical partition $target = $this->p_mountPoint; if($fsType == "swap"){ $target = "swap"; + $encrypt = $format = FALSE; } } diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_DevicePartition.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_DevicePartition.inc index 4f18a8bbf..d955479b5 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_DevicePartition.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_DevicePartition.inc @@ -41,7 +41,8 @@ class DevicePartition $this->entryList->setEditable(false); $this->entryList->setWidth("100%"); $this->entryList->setHeight("400px"); - $this->entryList->setHeader(array(_("Type"),_("Target"),_("Size"),_("Uses device")." / "._("Used by"),_("Filesystem"), _("Options"))); + $this->entryList->setHeader(array(_("Type"),_("Target"),_("Size"),_("Uses device")." / "._("Used by"), + _("Filesystem"), _("Options"), _("Format"), "-")); $this->entryList->setColspecs(array('*','*','*', '*')); $this->entryList->setAcl('rwcdm'); $this->entryList->setReorderable(FALSE); @@ -231,6 +232,8 @@ class DevicePartition $fsType = trim($fsType); } + $formatImg = ($part['format']) ? image('images/true.png') : ""; + // Add entry to the listing $lData[] = array("data" => array( $str, @@ -238,14 +241,15 @@ class DevicePartition $this->__convertPartSize($part['size']), $device, $fsType, - $part['fsOptions'])); + $part['fsOptions'], + $formatImg)); } } } } // Updated columns length for all entries to avoid render errors. - $length = 6; + $length = 8; foreach($lData as $id => $entry){ while(count($lData[$id]['data']) < $length){ $lData[$id]['data'][] = ''; -- 2.30.2