Code

Some changes repository plugin
[gosa.git] / plugins / admin / fai / class_faiPartitionTable.inc
index 3c83b3484c2edb7b1a5170a0cc5a2d90b755d67f..fc35fd188204f1ff3cc2218af40e4c03074100bd 100644 (file)
@@ -72,10 +72,14 @@ class faiPartitionTable extends plugin
         }  
       }
     }
+    ksort($this->disks);
   }
 
   function execute()
   {
+       /* Call parent execute */
+       plugin::execute();
+
     /* Fill templating stuff */
     $smarty= get_smarty();
     $display= "";
@@ -96,6 +100,11 @@ class faiPartitionTable extends plugin
     /* Edit disk.
      * Open dialog which allows us to edit the selected entry 
      */    
+
+    if($this->dn != "new"){
+      $_SESSION['objectinfo']= $this->dn;
+    }
+
     if((isset($_POST['EditDisk']))&&(isset($_POST['disks']))){
       $usedDiskNames =array();
       foreach($this->disks  as $key=>$disk){
@@ -104,6 +113,7 @@ class faiPartitionTable extends plugin
         }
       }
       $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames,$this->disks[$_POST['disks']]); 
+      $_SESSION['objectinfo'] = $this->disks[$_POST['disks']]['dn'];
       $this->is_dialog = true;
     }
 
@@ -147,6 +157,7 @@ class faiPartitionTable extends plugin
         unset($this->dialog);
         $this->dialog = NULL;
         $this->is_dialog=false;
+        ksort($this->disks);
       }
     }
 
@@ -211,9 +222,17 @@ class faiPartitionTable extends plugin
           }
         }
         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);
+          }
         }
       }
     }
@@ -252,16 +271,6 @@ class faiPartitionTable extends plugin
   {
 
     $message= array();
-
-    $str = utf8_encode("üöä");
-    if(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description)){
-      $message[]=_("Please enter a valid description.");
-    }
-
-    if((empty($this->cn))||(preg_match("/[^a-z0-9]/i",$this->cn))){
-      $message[]=_("Please enter a valid name.");
-    }
-
     return ($message);
   }