summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b5136d9)
raw | patch | inline | side by side (parent: b5136d9)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 12 May 2011 14:04:51 +0000 (14:04 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 12 May 2011 14:04:51 +0000 (14:04 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20819 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto/admin/systems/goto/Device/class_DevicePartition.inc | patch | blob | history |
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 4c6ae408072143364ad56d8eed726190a2f2b0cc..eb2350524ac9025b609c474946e6d4e9d6f77b0c 100644 (file)
// Add raids
foreach($raids as $id => $raid){
$str = "{$seps[1]}{$raidImg} {$raid['name']} ({$raid['level']})";
+ $delImg = image('images/lists/trash.png', "delete_raid_{$id}", _("Remove raid device"));
$devsStr = "";
foreach($raid['devices'] as $devName){
'',
$devsStr,
$fsType,
- $fsOptions
+ $fsOptions,
+ '',
+ $delImg
));
}
}
// Add volume groups
foreach($volumeGroups as $id => $vg){
$str = "{$seps[1]}{$volumeGroupImg} {$vg['name']}";
+ $delImg = image('images/lists/trash.png', "delete_vg_{$id}", _("Remove volume group"));
// Build up a list of all used partitions
$partStr = "";
$partStr = rtrim($partStr, ", ");
// Add entry to the list.
- $lData[] = array("data" => array($str, '', '', $partStr));
+ $lData[] = array("data" => array($str, '', '', $partStr, '', '','',$delImg));
// Add volumes
- foreach($volumes as $volume){
+ foreach($volumes as $vid => $volume){
+ $delImg = image('images/lists/trash.png', "delete_v_{$vid}", _("Remove volume"));
if($volume['volGroup'] == $vg['name']){
$str = "{$seps[2]}{$volumeImg} {$volume['name']}";
$lData[] = array("data" => array(
$this->__convertPartSize($volume['size']),
'',
$volume['fsType'],
- $volume['fsOptions']
+ $volume['fsOptions'],
+ '',
+ $delImg
));
function save_object()
{
+ // Create a map whcih points to the correct remove method for each device.
+ $map = array();
+ $map['part'] = array('func' => 'delPartition', 'name' => _("Partition"));
+ $map['raid'] = array('func' => 'delRaidDevice', 'name' => _("Raid device"));
+ $map['disk'] = array('func' => 'delDisk', 'name' => _("Disk"));
+ $map['vg'] = array('func' => 'delVolumeGroup', 'name' => _("Volume group"));
+ $map['v'] = array('func' => 'delVolume', 'name' => _("Volume"));
+
+ // Walk through posts and search for remove requests.
foreach($_POST as $name => $value){
-
- // Remove paritions
- if(preg_match("/^delete_part_[0-9]*$/", $name)){
- $id = preg_replace("/^delete_part_/i", "", $name) + 0;
- @$this->object->delPartition($id);
- if(!$this->object->success()){
- $msg = sprintf(_("Failed to remove partition: %s"), $this->object->getError());
- msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
- }
- }
-
- // Remove disks
- if(preg_match("/^delete_disk_[0-9]*$/", $name)){
- $id = preg_replace("/^delete_disk_/i", "", $name) + 0;
- @$this->object->delDisk($id);
- if(!$this->object->success()){
- $msg = sprintf(_("Failed to remove disk: %s"), $this->object->getError());
- msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
+ foreach($map as $type => $data){
+
+ // Remove paritions
+ if(preg_match("/^delete_{$type}_[0-9]*$/", $name)){
+ $id = preg_replace("/^delete_{$type}_/i", "", $name) + 0;
+ $func = $data['func'];
+ @$this->object->$func($id);
+ if(!$this->object->success()){
+ $msg = sprintf(_("Failed to remove '%s': %s"), $data['name'], $this->object->getError());
+ msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
+ }
}
}
}