Code

Added sorting to service list
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 8 Jun 2006 04:13:04 +0000 (04:13 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 8 Jun 2006 04:13:04 +0000 (04:13 +0000)
only show action icons if service was saved

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3683 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_divListSystemService.inc
plugins/admin/systems/class_serverService.inc

index 7ba7bcf447fb5db29ff086e0d895df0cf4a8f670..f50af48dad5462f96c3da124877a1dcd5d9655a0 100644 (file)
@@ -69,32 +69,44 @@ class divListSystemService extends MultiSelectWindow
   function setEntries($list)
   {
     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_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']){
+      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']){
+      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']){
+      if($entry['AllowStart'] && $WasAccount){
         $actions .= "&nbsp;<input type='image' name='RestartSingleService_".$name."' src='images/status_restart.png'
                             title='"._("Restart service")."'>";
       }else{
index fab65db6903dddd93331b83bab288ca9c389629c..f88ea34861080dcc2ffa32cc64a4817829f9c54a 100644 (file)
@@ -271,7 +271,7 @@ class ServerService extends plugin
     
     if($service == ALL_SERVICES){
       foreach($this->plugins as $name => $obj){
-        if($this->plugins[$name]->is_account){
+        if($this->plugins[$name]->initially_was_account && $this->plugins[$name]->is_account){
           $this->plugins[$name]->setStatus($action);
         }
       }