Code

updatedimport
[gosa.git] / gosa-plugins / goto / addons / goto / class_gotomasses.inc
index b7f0e6ef7eac8d17ec59de9e0c214529dbc334e2..ce00d1e933577301547fc7a029cfb9ad56295512 100644 (file)
@@ -45,6 +45,8 @@ class gotomasses extends plugin
   var $range    = 25;
   var $start    = 0;
 
+  var $recently_removed = array();
+
   function gotomasses(&$config, $dn= NULL)
   {
     /* Include config object */
@@ -121,6 +123,19 @@ class gotomasses extends plugin
     }
 
 
+    /************
+     * Import CSV file  
+     ************/
+    
+    if($s_action == "import_file"){
+      $this->dialog = new goto_import_file($this->config,$this);
+    }
+  
+    if(isset($_POST['import_abort'])){
+      $this->dialog = FALSE;
+    }
+
+
     /************
      * Handle Priority modifications  
      ************/
@@ -329,6 +344,7 @@ class gotomasses extends plugin
     }
     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(""))){
@@ -415,7 +431,7 @@ class gotomasses extends plugin
        */  
       if(TRUE){
         $action .= "<input type='image' src='images/fai_hook.png' name='log_view_".$key."' 
-          class='center' title='"._("View logs")."' alt='"._("Log view")."'>&nbsp;";
+          class='center' title='"._("View logs")."' alt='"._("View logs")."'>&nbsp;";
       }
 
       /* If PAUSED or WAITING add edit action
@@ -681,6 +697,8 @@ class gotomasses extends plugin
       $tmp = new DaemonEvent_faireboot($this->config);
       $tmp->add_targets($update_ids);
       $tmp->set_type(TRIGGERED_EVENT);
+      $this->recently_removed = $update_ids;
+      
       if(!$this->o_queue->append($tmp)){
         msg_dialog::display(_("Error"), sprintf(_("Cannot update queue entry: %s"),$id) , ERROR_DIALOG);
         return(FALSE);
@@ -771,8 +789,14 @@ class gotomasses extends plugin
     $this->entries = array();
     
     foreach($entries as $entry){
+    
+      /* Skip entries which will be removed within the next seconds */
+      if(isset($entry['MACADDRESS']) && in_array($entry['MACADDRESS'],$this->recently_removed)){
+        continue;
+      }
       $this->entries[$entry['ID']]= $entry;
     }
+    $this->recently_removed = array();
   }