Code

Updated event generation
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 5 Mar 2008 12:53:45 +0000 (12:53 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 5 Mar 2008 12:53:45 +0000 (12:53 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9352 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/class_terminalGeneric.inc
gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc

index a47f19b50228f89aee639f08cba683756c495a5f..3b4f67d733ff62db07ceb4d899337fda0d1caabd 100644 (file)
@@ -44,11 +44,7 @@ class termgeneric extends plugin
       "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser");
   var $objectclasses= array("top", "gotoTerminal", "GOhard");
 
-  var $mapActions   = array("reboot"          => "",
-                            "rescan"          => "",
-                            "wake"            => "",
-                            "memcheck"        => "memcheck",
-                            "sysinfo"         => "sysinfo");
+  var $validActions   = array("reboot" => "", "rescan" => "", "wake" => "", "memcheck" => "", "sysinfo" => "");
 
   var $fai_activated = FALSE;
   var $view_logged = FALSE;
@@ -163,17 +159,8 @@ class termgeneric extends plugin
       $this->is_account= !$this->is_account;
     }
 
-    if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate") && isset($this->mapActions[$_POST['saction']])){
-
-
-
-     /* Check given action */
-      $mapEvent = array("wake"           => "wakeup",
-                        "instant_update" => "update");
+    if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate") && isset($this->validActions[$_POST['saction']])){
       $action = $_POST['saction'];
-      if(isset($mapEvent[$action])){
-        $action = $mapEvent[$action];
-      }
 
       /* Check if we have an DaemonEvent for this action */
       if(class_available("DaemonEvent_".$action)){
@@ -190,22 +177,10 @@ class termgeneric extends plugin
           }
         }
       }else{
-
-        msg_dialog::display(_("Missing Daemon Event"),
-                    sprintf(_("The requested action does not exists '%s' Sending event manually."),"DaemonEvent_".$action),ERROR_DIALOG);
-
-        /* No event found, send action manually.
-         */
-        $method= "gosa";
-        $action= $_POST['saction'];
-        if ($action == "reinstall" || $action == "update" || $action == "instant_update"){
-          $method= "job";
-        }
-
-        gosaSupportDaemon::send("${method}_trigger_action_".$action,
-            $this->netConfigDNS->macAddress,
-            array("macAddress" => $this->netConfigDNS->macAddress));
+        msg_dialog::display(_("Event error"),
+                    sprintf(_("Event '%s' is not available!"),$action),ERROR_DIALOG);
       }
+
     }
 
     /* Base select dialog */
index 78a6c374ee1a88fdb2b953518bc4c9f214be53af..8f5ac5eca81898f0c72b54cbdb474122b7a9dbef 100644 (file)
@@ -46,16 +46,8 @@ class workgeneric extends plugin
       "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "l","FAIscript");
   var $objectclasses= array("top", "gotoWorkstation", "GOhard");
 
-  var $mapActions   = array("reboot"          => "",
-                            "localboot"       => "localboot",
-                            "halt"            => "",
-                            "update"          => "softupdate",
-                            "reinstall"       => "install",
-                            "rescan"          => "",
-                            "wake"            => "",
-                            "memcheck"        => "memcheck",
-                            "sysinfo"         => "sysinfo");
-
+  var $validActions   = array("reboot" => "", "localboot" => "", "halt" => "", "update" => "", "reinstall" => "",
+                            "rescan" => "", "wake" => "", "memcheck" => "", "sysinfo" => "");
   
   var $fai_activated = FALSE;
 
@@ -175,7 +167,7 @@ class workgeneric extends plugin
       }
     }
 
-    if ((isset($_POST['action'])) && ($this->acl_is_writeable("FAIstate")) && isset($this->mapActions[$_POST['saction']]) ){
+    if ((isset($_POST['action'])) && ($this->acl_is_writeable("FAIstate")) && isset($this->validActions[$_POST['saction']]) ){
       $action= $_POST['saction'];
 
       /* Check if we have an DaemonEvent for this action */ 
@@ -192,8 +184,12 @@ class workgeneric extends plugin
                   $o_queue->get_error()),ERROR_DIALOG);
           }
         }
+      } else {
+        msg_dialog::display(_("Event error"),
+                    sprintf(_("Event '%s' is not available!"),$action),ERROR_DIALOG);
       }
 
+
     }
 
     /* Do we represent a valid terminal? */