Code

Fixed save_object
[gosa.git] / plugins / admin / systems / class_serverService.inc
index bfdb7373c2f2b8ad04b7d008e95f577241e6bd8a..8f1058a9216942844c60daa40ac5e1f940cfaf25 100644 (file)
@@ -2,11 +2,11 @@
 
 define("START_SERVICE",1);
 define("STOP_SERVICE",2);
-define("RESET_SERVICE",3);
+define("RESTART_SERVICE",3);
 
 define("SERVICE_STOPPED",_("Stop"));
 define("SERVICE_STARTED",_("Start"));
-define("SERVICE_RESETTED",_("Restart"));
+define("SERVICE_RESTARTED",_("Restart"));
 
 define("ALL_SERVICES",100);
 
@@ -60,12 +60,12 @@ class ServerService extends plugin
     $PossiblePosts = array("addNewService"  => "", 
                            "startServices"  => "",
                            "stopServices"   => "",
-                           "resetServices"  => "",
+                           "restartServices"  => "",
                            "removeServices" => "",
 
                            "StartSingleService"  => "/^StartSingleService_(.*)_[xy]$/",
                            "StopSingleService"   => "/^StopSingleService_(.*)_[xy]$/",
-                           "ResetSingleService"  => "/^ResetSingleService_(.*)_[xy]$/",
+                           "RestartSingleService"  => "/^RestartSingleService_(.*)_[xy]$/",
                            "RemoveSingleService" => "/^RemoveSingleService_(.*)_[xy]$/",
                            "EditSingleService"   => "/^EditSingleService_(.*)_[xy]$/");
 
@@ -88,10 +88,9 @@ class ServerService extends plugin
     /* Handle state changes for services */
     $map =  array( "startServices"          => array("type" => START_SERVICE , "service" => ALL_SERVICES),
                       "stopServices"          => array("type" => STOP_SERVICE  , "service" => ALL_SERVICES),
-                      "resetServices"         => array("type" => RESET_SERVICE , "service" => ALL_SERVICES),
-                      "StartSingleService"    => array("type" => START_SERVICE , "service" => $s_entry),
+                      "restartServices"         => array("type" => RESTART_SERVICE , "service" => ALL_SERVICES),                      "StartSingleService"    => array("type" => START_SERVICE , "service" => $s_entry),
                       "StopSingleService"     => array("type" => STOP_SERVICE , "service" => $s_entry),
-                      "ResetSingleService"    => array("type" => RESET_SERVICE , "service" => $s_entry));
+                      "RestartSingleService"    => array("type" => RESTART_SERVICE , "service" => $s_entry));
     if(isset($map[$s_action])){
       $type     = $map[$s_action]['type'];
       $service  = $map[$s_action]['service'];
@@ -150,7 +149,7 @@ class ServerService extends plugin
 
     /* Abort dialog */
     if(isset($_POST['SaveService'])){
-
+      $this->dialog->save_object();
       $msgs = $this->dialog->check();
       if(count($msgs)){
         foreach($msgs as $msg){
@@ -158,6 +157,10 @@ class ServerService extends plugin
         }
       }else{
         $this->plugins[$this->current] = $this->dialog;
+        $tmp  = get_object_vars($this->dialog);
+        foreach($tmp as $name => $value){
+          $this->plugins[$this->current]->$name = $value;
+        }
         $this->current = "";
         $this->dialog = NULL;
         $this->backup = NULL;
@@ -166,7 +169,7 @@ class ServerService extends plugin
 
 
     /* Abort dialog */
-    if(isset($_POST['SaveServiceAdd'])){
+    if((isset($_POST['SaveServiceAdd'])) && (!empty($_POST['ServiceName']))){
       $serv = $_POST['ServiceName'];    
       $this->plugins[$serv]->is_account = true;
       $this->dialog  = $this->plugins[$serv];
@@ -263,8 +266,8 @@ class ServerService extends plugin
       $action = SERVICE_STARTED;
     }elseif($method== STOP_SERVICE){
       $action = SERVICE_STOPPED;
-    }elseif($method == RESET_SERVICE){
-      $action = SERVICE_RESETTED;
+    }elseif($method == RESTART_SERVICE){
+      $action = SERVICE_RESTARTED;
     }else{
       print_red(sprintf(_("The specified method '%s' can't executed for services."),$action));
       return;
@@ -272,7 +275,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);
         }
       }