]> git.tokkee.org Git - gosa.git/commitdiff

Code

Added import
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 29 Jan 2010 14:48:42 +0000 (14:48 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 29 Jan 2010 14:48:42 +0000 (14:48 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15452 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/addons/goto/class_gotomasses.inc
gosa-plugins/goto/addons/goto/deploy-list.xml

index bd3e4bbef5c44ea33de103ff56cd4266bbd513c2..e42b46478ff06083e925ee533dd91c23c4795c19 100644 (file)
@@ -77,10 +77,35 @@ class gotomasses extends management
     $this->registerAction('prioDown',   "prioDown");
     $this->registerAction('prioUp',     "prioUp");
     $this->registerAction('prioPause',  "prioPause");
+    $this->registerAction('prioResume', "prioResume");
     $this->registerAction('processNow', "processNow");
     $this->registerAction('viewLogs',   "viewLogs");
     $this->registerAction('abort',      "abortEvent");
     $this->registerAction('saveEventDialog',   "saveEventDialog");
+    $this->registerAction('halt', 'newEntry');
+    $this->registerAction('reboot', 'newEntry');
+    $this->registerAction('wakeup', 'newEntry');
+    $this->registerAction('update', 'newEntry');
+    $this->registerAction('lock', 'newEntry');
+    $this->registerAction('activate', 'newEntry');
+    $this->registerAction('reinstall', 'newEntry');
+    $this->registerAction('import', 'importEvents');
+  }
+
+  function newEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
+  {
+    if($this->acl_is_writeable("")){
+      $type = "DaemonEvent_".$action;
+      if(isset($this->events['BY_CLASS'][$type])){
+        $e_data = $this->events['BY_CLASS'][$type];
+        $this->dialogObject = new $e_data['CLASS_NAME']($this->config);
+      }
+    }
+  }
+
+  function importEvents()
+  {
+    $this->dialogObject = new goto_import_file($this->config,$this);
   }
 
   static function filterHostName($mac, $name ="")
@@ -325,18 +350,28 @@ class gotomasses extends management
   function prioPause($action="",$target=array(),$all=array())
   {
     $this->pause_queue_entries($target);
-#    $this->resume_queue_entries($target);
+  }
+
+  function prioResume($action="",$target=array(),$all=array())
+  {
+    $this->resume_queue_entries($target);
   }
 
   function processNow($action="",$target=array(),$all=array())
   {
     $this->execute_queue_entries($target);
-#    $this->abort_queue_entries($target);
   }
 
   function viewLogs($action="",$target=array(),$all=array())
   {
-    print_a($all);
+    if(count($target) == 1){
+      $id =  $target[0];
+      $type = FALSE;
+      $headpage = $this->getHeadpage();
+      $tmp = $headpage->getEntry($id);
+      $entry = $tmp['EVENT'];
+      $this->dialogObject = new gotoLogView($this->config,"",$entry,$this);
+    }
   }
 
   function saveEventDialog()
@@ -403,6 +438,7 @@ class gotomasses extends management
     if(isset($_POST['abort_event_dialog'])) $action['action'] = "cancel";
     if(isset($_POST['delete_multiple_confirm'])) $action['action'] = "removeConfirmed";
     if(isset($_POST['delete_cancel'])) $action['action'] = "cancel";
+    if(isset($_POST['import_abort'])) $action['action'] = "cancel";
     return($action);
   }
 
@@ -416,49 +452,8 @@ class gotomasses extends management
   function _execute()
   {
 
-    /************
-     * Import CSV file  
-     ************/
-
-    if($s_action == "import_file" && $this->acl_is_writeable("")){
-      $this->dialog = new goto_import_file($this->config,$this);
-    }
-
-    if(isset($_POST['import_abort'])){
-      $this->dialog = FALSE;
-    }
-
-
     /************
      * ADD 
-     ************/
-
-    if(preg_match("/^add_event_/",$s_action) && $this->acl_is_writeable("")){
-      $type = preg_replace("/^add_event_/","",$s_action);
-      if(isset($this->events['BY_CLASS'][$type])){
-        $e_data = $this->events['BY_CLASS'][$type];
-        $this->dialog = new $e_data['CLASS_NAME']($this->config);
-      }
-    }
-
-    /************
-     * LOG VIEW
-     ************/
-
-    if($s_action == "logview"  && $this->acl_is_readable("")){  
-      $id =  $s_entry;
-      $type = FALSE;
-      if(isset($this->entries[$id])){
-        $event = $this->entries[$s_entry];
-        $this->dialog = new gotoLogView($this->config,"",$event,$this);
-      }
-    }
-
-
-    /************
-    /************
-     * EDIT 
-     ************/
 
     /* Display dialogs if currently opened */
     if(is_object($this->dialog)){
@@ -472,23 +467,6 @@ class gotomasses extends management
       }
     }
 
-   if($this->acl_is_writeable("")){
-     foreach($this->events['SCHEDULED'] as $name =>  $event){
-       $s.= "...|".$event['MenuImage']."&nbsp;".$event['s_Menu_Name']."|add_event_".$name."\n";
-     }
-   }
-   if($this->acl_is_removeable()){
-     $s.= "..|---|\n";
-     $s.= "..|<img src='images/lists/import.png' alt='' border='0' class='center'>&nbsp;"._("Import")."|import_file\n";
-     $s.= "..|<img src='images/lists/trash.png' alt='' border='0' class='center'>&nbsp;"._("Remove")."|remove_multiple\n";
-   }
-   if(preg_match("/w/",$this->getacl(""))){
-     $s.= "..|---|\n";
-     $s.= "..|<img alt='"._("Resume")."' src='images/status_start.png' border='0' class='center'>&nbsp;"._("Resume")."|resume_all\n";
-     $s.= "..|<img alt='"._("Pause")."' src='images/status_pause.png' border='0' class='center'>&nbsp;"._("Pause")."|pause_all\n";
-     $s.= "..|<img alt='"._("Abort")."' src='images/small_error.png'  border='0' class='center'>&nbsp;"._("Abort")."|abort_process_all\n";
-     $s.= "..|<img alt='"._("Execute")."' src='images/rocket.png'       border='0' class='center'>&nbsp;"._("Execute")."|execute_process_all\n";
-   }
 
    $divlist->SetDropDownHeaderMenu($s);
 
@@ -719,10 +697,6 @@ class gotomasses extends management
    */
   private function resume_queue_entries($ids)
   {
-    if(!count($ids)){
-      return;
-    }
-
     /* Entries are resumed by setting the status to 
      *  'waiting'
      */
@@ -732,7 +706,10 @@ class gotomasses extends management
      *  allows resuming.
      */
     $update_ids = array();
-    foreach($this->o_queue->get_entries_by_id($ids) as $entry){
+    $headpage = $this->getHeadpage();
+    foreach($ids as $id){
+      $tmp = $headpage->getEntry($id);
+      $entry = $tmp['EVENT'];
       if(isset($entry['STATUS']) && preg_match("/paused/",$entry['STATUS'])){
         $update_ids[] = $entry['ID'];
       }
@@ -755,10 +732,6 @@ class gotomasses extends management
    */
   private function execute_queue_entries($ids)
   {
-    if(!count($ids)){
-      return;
-    }
-
     /* Execution is forced by updating the status to 
      *  waiting and setting the timestamp to current time.
      */
@@ -768,7 +741,10 @@ class gotomasses extends management
     /* Only allow execution of paused or waiting entries 
      */
     $update_ids = array();
-    foreach($this->o_queue->get_entries_by_id($ids) as $entry){
+    $headpage = $this->getHeadpage();
+    foreach($ids as $id){
+      $tmp = $headpage->getEntry($id);
+      $entry = $tmp['EVENT'];
       if(in_array($entry['STATUS'],array("paused","waiting"))){
         $update_ids[] = $entry['ID'];
       }
@@ -791,10 +767,6 @@ class gotomasses extends management
    */
   private function pause_queue_entries($ids)
   {
-    if(!count($ids)){
-      return;
-    }
-
     /* Entries are paused by setting the status to 
      *  something different from 'waiting'.
      * We simply use 'paused'.
@@ -805,7 +777,10 @@ class gotomasses extends management
      *  check if the status allows pausing.
      */ 
     $update_ids = array();
-    foreach($this->o_queue->get_entries_by_id($ids) as $entry){
+    $headpage = $this->getHeadpage();
+    foreach($ids as $id){
+      $tmp = $headpage->getEntry($id);
+      $entry = $tmp['EVENT']; 
       if(isset($entry['STATUS']) && preg_match("/waiting/",$entry['STATUS'])){
         $update_ids[] = $entry['ID'];
       }
index 13528cdeb2f102c25fa5b87268a8316ca3fec334..d747d80254354d209911f4d65d125560e4a24691 100644 (file)
     <action>
      <type>sub</type>
      <image>images/lists/new.png</image>
-     <label>Create</label>
+     <label>Add</label>
 
      <action>
-      <name>new</name>
+      <name>halt</name>
       <type>entry</type>
-      <image>plugins/users/images/list_new_user.png</image>
-      <label>User</label>
+      <image>images/lists/off.png</image>
+      <label>Shut down</label>
      </action>
 
      <action>
-      <name>new_template</name>
+      <name>reboot</name>
       <type>entry</type>
-      <image>plugins/users/images/select_template.png</image>
-      <label>Template</label>
+      <image>images/lists/reload.png</image>
+      <label>Restart</label>
      </action>
-    </action>
-
-    <action>
-      <type>separator</type>
-    </action>
-
-    <action>
-      <name>edit</name>
-      <type>entry</type>
-      <image>images/lists/edit.png</image>
-      <label>Edit</label>
-    </action>
 
-    <action>
-      <name>remove</name>
+     <action>
+      <name>wakeup</name>
       <type>entry</type>
-      <image>images/lists/trash.png</image>
-      <label>Remove</label>
-    </action>
+      <image>images/lists/on.png</image>
+      <label>Wake up</label>
+     </action>
 
-    <action>
-      <name>password</name>
+     <action>
+      <name>update</name>
       <type>entry</type>
-      <image>plugins/users/images/list_password.png</image>
-      <label>Change password</label>
-    </action>
-
-    <action>
-      <type>separator</type>
-    </action>
+      <image>plugins/goto/images/update.png</image>
+      <label>Software update</label>
+     </action>
 
-    <action>
-      <name>lockUsers</name>
+     <action>
+      <name>lock</name>
       <type>entry</type>
       <image>images/lists/locked.png</image>
-      <acl>uniBonnAccount/password[w]</acl>
-      <label>Lock users</label>
-    </action>
+      <label>Lock</label>
+     </action>
 
-    <action>
-      <name>unlockUsers</name>
+     <action>
+      <name>activate</name>
       <type>entry</type>
       <image>images/lists/unlocked.png</image>
-      <acl>uniBonnAccount/password[w]</acl>
-      <label>Unlock users</label>
-    </action>
+      <label>Unlock</label>
+     </action>
 
-    <action>
-      <name>sendMessage</name>
+     <action>
+      <name>reinstall</name>
       <type>entry</type>
-      <depends>DaemonEvent_notify</depends>
-      <image>plugins/goto/images/notify.png</image>
-      <label>Send message</label>
-    </action>
-
-    <action>
-      <type>separator</type>
+      <image>plugins/goto/images/reinstall.png</image>
+      <label>Reinstall</label>
+     </action>
     </action>
+  
+  
+     <action>
+      <name>import</name>
+      <type>entry</type>
+      <image>images/lists/import.png</image>
+      <label>Import</label>
+     </action>
 
-    <action>
-      <name>templatize</name>
+     <action>
+      <name>remove</name>
       <type>entry</type>
-      <image>plugins/users/images/wizard.png</image>
-      <label>Apply template</label>
-    </action>
+      <image>images/lists/trash.png</image>
+      <label>Remove</label>
+     </action>
 
     <action>
       <type>separator</type>
     </action>
 
-    <action>
-      <type>exporter</type>
-    </action>
+     <action>
+      <name>prioResume</name>
+      <type>entry</type>
+      <image>images/status_start.png</image>
+      <label>Resume</label>
+     </action>
 
-    <action>
-      <type>separator</type>
-    </action>
+     <action>
+      <name>prioPause</name>
+      <type>entry</type>
+      <image>images/status_pause.png</image>
+      <label>Pause</label>
+     </action>
 
-    <action>
-      <type>copypaste</type>
-    </action>
+     <action>
+      <name>abort</name>
+      <type>entry</type>
+      <image>images/small_error.png</image>
+      <label>Abort</label>
+     </action>
 
-    <action>
-      <type>snapshot</type>
-    </action>
+     <action>
+      <name>processNow</name>
+      <type>entry</type>
+      <image>images/rocket.png</image>
+      <label>Execute</label>
+     </action>
 
   </actionmenu>
 
       <label>Pause</label>
     </action>
 
+    <action>
+      <name>prioResume</name>
+      <type>entry</type>
+      <objectclass>FAKE_OC__prioResume</objectclass>
+      <image>images/status_start.png</image>
+      <label>Resume</label>
+    </action>
+
     <action>
       <name>processNow</name>
       <type>entry</type>