diff --git a/plugins/admin/fai/class_faiPartitionTable.inc b/plugins/admin/fai/class_faiPartitionTable.inc
index 1d78d57219a9e839694d7e617708b2dd12808847..f6adfeb34f8aae34c3072253f33598490213b228 100644 (file)
function execute()
{
+ /* Call parent execute */
+ plugin::execute();
+
/* Fill templating stuff */
$smarty= get_smarty();
$display= "";
/* Edit disk.
* Open dialog which allows us to edit the selected entry
*/
- $_SESSION['objectinfo'] = $this->dn;
+
+ if($this->dn != "new"){
+ $_SESSION['objectinfo']= $this->dn;
+ }
+
if((isset($_POST['EditDisk']))&&(isset($_POST['disks']))){
$usedDiskNames =array();
+
+ $Udisk = $_POST['disks'][0];
+
foreach($this->disks as $key=>$disk){
- if($key != $_POST['disks']){
+ if($key != $Udisk){
$usedDiskNames[]= $key;
}
}
- $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames,$this->disks[$_POST['disks']]);
- $_SESSION['objectinfo'] = $this->disks[$_POST['disks']]['dn'];
+ $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames,$this->disks[$Udisk]);
+ $_SESSION['objectinfo'] = $this->disks[$Udisk]['dn'];
$this->is_dialog = true;
}
* Assign delete status for all its partitions
*/
if((isset($_POST['DelDisk']))&&(!empty($_POST['disks']))){
- $disk = $_POST['disks'];
- if($this->disks[$disk]['status']=="edited"){
- $this->disks[$disk."-delete"]=$this->disks[$disk];
- unset($this->disks[$disk]);
- $disk = $disk."-delete";
- $this->disks[$disk]['status']="delete";
- foreach($this->disks[$disk]['partitions'] as $name => $value ){
- if($value['status']=="edited"){
- $this->disks[$disk]['partitions'][$name]['status']="delete";
- }else{
- unset($this->disks[$disk]['partitions'][$name]);
+
+ foreach($_POST['disks'] as $disk) {
+ if($this->disks[$disk]['status']=="edited"){
+ $this->disks[$disk."-delete"]=$this->disks[$disk];
+ unset($this->disks[$disk]);
+ $disk = $disk."-delete";
+ $this->disks[$disk]['status']="delete";
+ foreach($this->disks[$disk]['partitions'] as $name => $value ){
+ if($value['status']=="edited"){
+ $this->disks[$disk]['partitions'][$name]['status']="delete";
+ }else{
+ unset($this->disks[$disk]['partitions'][$name]);
+ }
}
+ }else{
+ unset($this->disks[$disk]);
}
- }else{
- unset($this->disks[$disk]);
}
}
}
}
if(!empty($disk['description'])){
- $a_return[$key]= $disk['cn']." [".$disk['description']."], ".sprintf(_("%s partition(s)"), $cnt);
+ if($cnt == 1){
+ $a_return[$key]= $disk['cn']." [".$disk['description']."], ".sprintf(_("%s partition"), $cnt);
+ }else{
+ $a_return[$key]= $disk['cn']." [".$disk['description']."], ".sprintf(_("%s partition(s)"), $cnt);
+ }
}else{
- $a_return[$key]= $disk['cn'].", ".sprintf(_("%s partition(s)"), $cnt);
+ if($cnt == 1){
+ $a_return[$key]= $disk['cn'].", ".sprintf(_("%s partition"), $cnt);
+ }else{
+ $a_return[$key]= $disk['cn'].", ".sprintf(_("%s partition(s)"), $cnt);
+ }
}
}
}