summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0d1d9fa)
raw | patch | inline | side by side (parent: 0d1d9fa)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 11 May 2011 10:43:34 +0000 (10:43 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 11 May 2011 10:43:34 +0000 (10:43 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20803 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc | patch | blob | history | |
gosa-plugins/goto/admin/systems/goto/Device/class_DevicePartition.inc | patch | blob | history |
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 e36708de5d82df43126fabb86f6aeabf12cfac05..b76db637c96ff32c9ea85e45bb1b014d2067dc28 100644 (file)
public $partitionObject;
public $disks = array();
+ // Partition properties
public $size = 1000;
public $fsType = 'ext3';
public $mountPoint = '';
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");
+
+ /*! \brief Constructs the Dialog and loads all required informations
+ * to be able to add partitions, raid devices, volumes groups ...
+ * @param Config The GOsa configuration object.
+ * @param remoteObject The remote partition object.
+ */
function __construct($config, $partitionObject)
{
$this->partitionObject = &$partitionObject;
if(!count($this->usedDisks)){
$this->usedDisks[] = key($this->disks);
}
-
}
+
+ /*! \brief Generates the HTML output for this plugin.
+ * @return String HTML content of the plugin.
+ */
function execute()
{
$smarty = get_smarty();
$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);
}
$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)));
}
+
+ /*! \brief Saves posted values.
+ */
function save_object()
{
// Get posted string values
}
}
+
+ /*! \brief Stores the changes back to the remote table model.
+ * @return TRUE on success else false.
+ */
function save()
{
// Get all currently used partitions
$usedTargets[] = $part['target'];
}
+ // Collect options
+ $size = $this->size;
+ $maxSize = NULL;
+ if($this->size_options == 2){
+ $maxSize = $this->size_max_value;
+ }
+ $grow = $this->size_options == 1;
+ $format = FALSE;
+ $boot = FALSE;
+ $primary = $this->forcePrimary;
+ $fsType = $this->fsType;
+ $fsOptions = "";
+ $encrypt = $this->encrypt;
+ $passphrase = "";
+ $disk = array_shift($this->usedDisks);
+
// We've to create a raid disk
if($this->fsType == "raid"){
$target="raid.";
$id ++;
}
$target = $target.str_pad($id, 2, '0', STR_PAD_LEFT);
-
- // Get first selected disk
- $disk = array_shift($this->usedDisks);
- $this->partitionObject->addPartition($target,$this->size +0, NULL, FALSE, TRUE, FALSE, FALSE,
- NULL, NULL , FALSE, NULL, $disk);
- return($this->partitionObject->success());
+ $fsType = $fsOptions = NULL;
}else
// We've to create a raid disk
$id ++;
}
$target = $target.str_pad($id, 2, '0', STR_PAD_LEFT);
-
- // Get first selected disk
- $disk = array_shift($this->usedDisks);
- $this->partitionObject->addPartition($target,$this->size +0, NULL, FALSE, TRUE, FALSE, FALSE,
- NULL, NULL , FALSE, NULL, $disk);
- return($this->partitionObject->success());
+ $fsType = $fsOptions = NULL;
}else{
// Add normal-physical partition
$target = $this->mountPoint;
- $disk = array_shift($this->usedDisks);
- $this->partitionObject->addPartition($target,$this->size +0, NULL, FALSE, TRUE, FALSE, FALSE,
- NULL, NULL , FALSE, NULL, $disk);
- return($this->partitionObject->success());
+ if($fsType == "swap"){
+ $target = "swap";
+ }
}
+
+ // Add partition to remote model
+ $this->partitionObject->addPartition($target,$size, $maxSize, $grow, $format, $boot, $primary,
+ $fsType, $fsOptions , $encrypt, $passphrase, $disk);
+ return($this->partitionObject->success());
}
}
?>
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 cc3c2d5ec8080c1d24b6df19ae2c3d3490a8db50..4bba04eed59c8543374e251ad0155b0a0e52b002 100644 (file)
function execute()
{
+ /*****
+ * Handle add-partition dialog
+ *****/
if(isset($_POST['create_partition'])){
$this->addDialog = new AddPartitionDialog($this->config, $this->object);
}
}
+ /*****
+ * Fill listing
+ *****/
// Receive list informations
$disks = $this->object->getDisks();
function save()
{
- return("");
+ return($this->object->dump());
}
function __convertPartSize($size)