Code

Added multi deletion for Partition Tables
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 11 Jan 2006 09:44:20 +0000 (09:44 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 11 Jan 2006 09:44:20 +0000 (09:44 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2443 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiPartitionTable.inc
plugins/admin/fai/faiPartitionTable.tpl

index fc35fd188204f1ff3cc2218af40e4c03074100bd..f6adfeb34f8aae34c3072253f33598490213b228 100644 (file)
@@ -107,13 +107,16 @@ class faiPartitionTable extends plugin
 
     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;
     }
 
@@ -165,21 +168,23 @@ class faiPartitionTable extends plugin
      * 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]);
       }
     }
 
index 0389b6f13e4147a53255ea5915af7a51053717f1..feb0f443f1cb68890848c93bfe439190a10af03a 100644 (file)
@@ -37,7 +37,7 @@
                                <table width="100%" summary="">
                                <tr>
                                        <td>
-                                               <select name="disks" title="{t}Choose a disk to delete or edit{/t}" style="width:100%" size="20" id="SubObject">
+                                               <select name="disks[]" title="{t}Choose a disk to delete or edit{/t}" style="width:100%" size="20" id="SubObject" multiple>
                                                        {html_options values=$diskKeys output=$disks}
                                                </select><br>
                                                <input type="submit" name="AddDisk"     value="{t}Add{/t}"              title="{t}Add{/t}">