Code

Fixed save_object
[gosa.git] / plugins / admin / systems / class_divListSystemService.inc
index 2835d741b7d9acadb632117a75a73edef9224929..25e2ed55212717cac9c3a36f69e19be879f9a8d4 100644 (file)
@@ -55,7 +55,7 @@ class divListSystemService extends MultiSelectWindow
     " <input class='center' type='image' align='middle' src='images/status_stop_all.png'  class='center'   
         name='stopServices' alt='"._("Stop service")."' title='"._("Stop all services")."'>&nbsp;".
     " <input class='center' type='image' align='middle' src='images/status_restart_all.png'    class='center'
-        name='resetServices' alt='"._("Reset service")."' title='"._("Reset all services")."'>&nbsp;".
+        name='restartServices' alt='"._("Restart service")."' title='"._("Restart all services")."'>&nbsp;".
     "</div>";
     $this->SetListHeader($listhead);
   }
@@ -68,42 +68,60 @@ class divListSystemService extends MultiSelectWindow
 
   function setEntries($list)
   {
+    $tmp = array();
     foreach($list as $name => $entry){
+      $tmp[$name] = $entry['Message']; 
+    }
+
+    natcasesort($tmp);
+    $tmp2 = array();
+    foreach($tmp as $name => $value){
+      $tmp2[$name] = $list[$name];
+    }
+
+    foreach($tmp2 as $name => $entry){
  
       switch($entry['Status']){
-        case ''      : $str ="";break;
+        case ''      : $str ="&nbsp;";break;
         case SERVICE_STOPPED  : $str ="<img src='images/status_stopped.png' title='"._("Stopped")."'>"; break;
         case SERVICE_STARTED  : $str ="<img src='images/status_running.png' title='"._("Started")."'>"; break;
-        case SERVICE_RESETTED : $str ="<img src='images/status_restarting.png' title='"._("Restarting")."' alt='R'>"; break;
+        case SERVICE_RESTARTED : $str ="<img src='images/status_restarting.png' title='"._("Restarting")."' alt='R'>"; break;
         default: $str= "<img src='images/select_user.png' alt='".$entry['Status']."' title='"._("User status")." : ".$entry['Status']."'>";
       }
 
+      $WasAccount = $this->parent->plugins[$name] -> initially_was_account;    
+  
       $field1 = array("string" => $str ,"attach" => "style='width:20px;'");
       $field2 = array("string" => $entry['Message'] );
 
       $actions ="";
-      if($entry['AllowStart']){
-        $actions .= "&nbsp;<input type='image' name='StartSingleService_".$name."' src='images/status_start.png'>";
+      if($entry['AllowStart'] && $WasAccount){
+        $actions .= "&nbsp;<input type='image' name='StartSingleService_".$name."' src='images/status_start.png'
+                            title='"._("Start service")."'>";
       }else{
         $actions .= "&nbsp;<img src='images/empty' width='16' alt=''>";
       }
-      if($entry['AllowStart']){
-        $actions .= "&nbsp;<input type='image' name='StopSingleService_".$name."' src='images/status_stop.png'>";
+      if($entry['AllowStart'] && $WasAccount){
+        $actions .= "&nbsp;<input type='image' name='StopSingleService_".$name."' src='images/status_stop.png'
+                            title='"._("Stop service")."'>";
       }else{
         $actions .= "&nbsp;<img src='images/empty' width='16' alt=''>";
       }
-      if($entry['AllowStart']){
-        $actions .= "&nbsp;<input type='image' name='ResetSingleService_".$name."' src='images/status_restart.png'>";
+      if($entry['AllowStart'] && $WasAccount){
+        $actions .= "&nbsp;<input type='image' name='RestartSingleService_".$name."' src='images/status_restart.png'
+                            title='"._("Restart service")."'>";
       }else{
         $actions .= "&nbsp;<img src='images/empty' width='16' alt=''>";
       }
       if($entry['AllowEdit']){
-        $actions .= "&nbsp;<input type='image' name='EditSingleService_".$name."' src='images/edit.png'>";
+        $actions .= "&nbsp;<input type='image' name='EditSingleService_".$name."' src='images/edit.png'
+                            title='"._("Edit service")."'>";
       }else{
         $actions .= "&nbsp;<img src='images/empty' width='16' alt=''>";
       }
       if($entry['AllowRemove']){
-        $actions .= "&nbsp;<input type='image' name='RemoveSingleService_".$name."' src='images/edittrash.png'>";
+        $actions .= "&nbsp;<input type='image' name='RemoveSingleService_".$name."' src='images/edittrash.png'
+                            title='"._("Remove service")."'>";
       }else{
         $actions .= "&nbsp;<img src='images/empty' width='16' alt=''>";
       }