Code

Updated Copy & Paste for Workstations
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 12 Jun 2007 10:34:03 +0000 (10:34 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 12 Jun 2007 10:34:03 +0000 (10:34 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6568 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/ogroups/class_divListOGroup.inc
plugins/admin/ogroups/class_ogroup.inc
plugins/admin/ogroups/class_ogroupManagement.inc
plugins/admin/ogroups/class_termgroup.inc
plugins/admin/systems/class_workstationStartup.inc

index 32276f8969df7250911423ed45cde8cc7f08a3d3..8489aed068d563ab6f41199db3807864faa5b206 100755 (executable)
@@ -185,7 +185,10 @@ class divListOGroup extends MultiSelectWindow
     /* Multiple options */
     $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/edittrash.png'
         title='"._("Remove selected object groups")."' alt='"._("Remove object groups")."' name='remove_multiple_ogroups'>&nbsp;";
-
+    $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/editcopy.png'
+        title='"._("Copy selected object group")."' alt='"._("Copy object groups")."' name='multiple_copy_ogroups'>&nbsp;";
+    $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/editcut.png'
+        title='"._("cut selected object group")."' alt='"._("Cut object groups")."' name='multiple_cut_ogroups'>&nbsp;";
     $listhead .="</div>";
 
     $this->SetListHeader($listhead);
index db39046c49f64da9f323206fcf751ec16a79d978..1a5db9bca3162789803ffcf7918338b605357f0f 100644 (file)
@@ -684,6 +684,36 @@ class ogroup extends plugin
     $this->handle_post_events("remove");
   }
 
+  
+  function PrepareForCopyPaste($source)
+  {
+    /* Update available object types */
+    if(isset($source['gosaGroupObjects'][0])){
+      $this->gosaGroupObjects =  $source['gosaGroupObjects'][0];
+    }
+
+    /* Reload tabs */
+    $this->parent->reload($this->gosaGroupObjects );
+   
+    /* Reload plugins */ 
+    foreach($this->parent->by_object as $name => $class ){
+      if(get_class($this) != $name) {
+        $this->parent->by_object[$name]->PrepareForCopyPaste($source);
+      }
+    }
+
+    /* Load member objects */
+    if (isset($source['member'])){
+      foreach ($source['member'] as $key => $value){
+        if ("$key" != "count"){
+          $value= @LDAP::convert($value);
+          $this->member["$value"]= "$value";
+        }
+      }
+    }
+
+  }
+
 
   function getCopyDialog()
   {
index 14f9d9f97ef32540864659651ec9f2c68da3525b..34cf7b7b2cdfde0f4b30f92b0ce1093a7ea74cb4 100644 (file)
@@ -33,6 +33,7 @@ class ogroupManagement extends plugin
 
   var $CopyPasteHandler = NULL;
   var $DivListOGroup    = NULL;
+  var $start_pasting_copied_objects = FALSE;
 
   function ogroupManagement ($config, $dn= NULL)
   {
@@ -88,6 +89,10 @@ class ogroupManagement extends plugin
         $s_entry  = preg_replace("/^cut_/i","",$key);
       }elseif(preg_match("/^remove_multiple_ogroups/",$key)){
         $s_action="del_multiple";
+      }elseif(preg_match("/^multiple_cut_ogroups/",$key)){
+        $s_action = "cut_multiple";
+      }elseif(preg_match("/^multiple_copy_ogroups/",$key)){
+        $s_action = "copy_multiple";
       }elseif(preg_match("/_group_edit_/",$key)){
         $type = preg_replace("/_group_edit_.*$/","",$key);
         $s_action="edit";
@@ -109,12 +114,13 @@ class ogroupManagement extends plugin
      ****************/
 
     /* Display the copy & paste dialog, if it is currently open */
-    $ret = $this->copyPasteHandling($s_action,$s_entry);
+    $ret = $this->copyPasteHandling_from_queue($s_action);
     if($ret){
       return($ret);
     }
 
-    /****************
+
+    /***************
       Create a new object group 
      ****************/
 
@@ -529,54 +535,53 @@ class ogroupManagement extends plugin
   }
 
 
-  function copyPasteHandling($s_action,$s_entry)
+  function copyPasteHandling_from_queue($s_action)
   {
-    if($this->CopyPasteHandler){
-
-      /* Paste copied/cutted object in here
-       */
-      if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){
-        $this->CopyPasteHandler->save_object();
-        $this->CopyPasteHandler->SetVar("base", $this->DivListOGroup->selectedBase);
-        return($this->CopyPasteHandler->execute());
-      }
 
-      /* Copy current object to CopyHandler
-       */
-      if($s_action == "copy"){
-    
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
 
-        $this->CopyPasteHandler->Clear();
-        $dn       =   $this->ogrouplist[$s_entry]['dn'];
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
 
-        /* Check acls */
-        $acl_all= $this->ui->has_complete_category_acls($dn,"ogroups");
-        if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-          $obj      =   new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn);
-          $objNew   =   new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], "new");
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->ogrouplist[$id]['dn'];
 
-          $types_of_tabs = $obj->by_object['ogroup']->gosaGroupObjects;
-          $objNew->by_object['ogroup']->gosaGroupObjects = $types_of_tabs;    
-          $objNew->reload($types_of_tabs);
-
-          $this->CopyPasteHandler->Copy($obj,$objNew);
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy","ogrouptabs","OGROUPTABS","ogroups");
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut","ogrouptabs","OGROUPTABS","ogroups");
         }
       }
+    }
 
-      /* Copy current object to CopyHandler
-       */
-      if($s_action == "cut"){
-        $this->CopyPasteHandler->Clear();
-        $dn       =   $this->ogrouplist[$s_entry]['dn'];
-
-        /* Check acls */
-        $acl_all= $this->ui->has_complete_category_acls($dn,"ogroups");
-        if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-          $obj      =   new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn);
-          $this->CopyPasteHandler->Cut($obj);
-        }
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListOGroup->selectedBase);
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
       }
     }
+    /* Automatically disable status for pasting */
+    if(!$this->CopyPasteHandler->entries_queued()){
+      $this->start_pasting_copied_objects = FALSE;
+    }
+    return("");
   }
 
 
index aa913640d9b6c06fe069b46a1527d232d5d2923f..2c759829e891250265451d489ef753d79655277b 100644 (file)
@@ -399,8 +399,33 @@ class termgroup extends plugin
           ));
   }
 
+  function PrepareForCopyPaste($source)
+  {
+    /* Create used ntp server array */
+    $this->gotoNtpServer= array();
 
+    if(isset($source['gotoNtpServer'])){
+      $this->inheritTimeServer = false;
+      unset($source['gotoNtpServer']['count']);
+      foreach($source['gotoNtpServer'] as $server){
+        $this->gotoNtpServer[$server] = $server;
+      }
+    }
 
+    /* Set inherit checkbox state */
+    if(in_array("default",$this->gotoNtpServer)){
+      $this->inheritTimeServer = true;
+      $this->gotoNtpServer=array();
+    }
+
+    /* Create available ntp options */
+    $this->gotoNtpServers = $this->config->data['SERVERS']['NTP'];
+    foreach($this->gotoNtpServers as $key => $server){
+      if($server == "default"){
+        unset($this->gotoNtpServers[$key]);
+      }
+    }
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 6991b3bb728d8c5326f53378bf215070c53140f2..ab20b1b9e2a624e8cbabebdf1d923ddfb6f657bd 100644 (file)
@@ -1159,6 +1159,23 @@ class workstartup extends plugin
   }
 
 
+  function PrepareForCopyPaste($source)
+  {
+      /* Get arrays */
+    foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){
+      if (isset($source["$val"]["count"])){
+        for ($i= 0; $i<$source["count"]; $i++){
+          if (isset($source["$val"][$i])){
+            array_push($this->$val, $source["$val"][$i]);
+          }
+        }
+      }
+      sort ($this->$val);
+      $this->$val= array_unique($this->$val);
+    }
+
+  }
+
   /* Return plugin informations for acl handling */ 
   function plInfo()
   {