Code

Added copy via groups
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Jan 2010 09:17:15 +0000 (09:17 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Jan 2010 09:17:15 +0000 (09:17 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15096 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/fai/class_faiManagement.inc
gosa-plugins/fai/admin/fai/faiGroupHandle.tpl

index 5d8d114500b8c562a1b0fdc2b0f4d57ace24cb23..e3de7caaac3daa2241ee61d7eea795013c78ac4d 100644 (file)
@@ -128,15 +128,33 @@ class faiManagement extends management
     // Collect real dns, the listed objects are grouped by their cn
     $headpage = $this->getHeadpage();
     if($action == "copy"){
-      foreach($target as $t){
-        $entry = $headpage->getEntry($t);
 
-        // Check for valid FAI objects
-        if(in_array('FAKE_OC_FAI', $entry['objectClass'])){
-          foreach($entry['GROUPS'] as $g){
-            $type = $this->get_type($g);
-            $this->cpHandler->add_to_queue($g['dn'],"copy",$type[0],$type[2],'fai',$this);
-            @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$dn,"Entry copied!");
+      if(count($target) == 1){
+
+        // We just want to copy a single FAI object, let the user choose entries from the FAI-Group
+        $entry = $headpage->getEntry($target[0]);
+        if(count($entry['GROUPS']) == 1){
+          $data = array_pop($entry['GROUPS']);
+          $type = $this->get_type($data);
+          $this->cpHandler->add_to_queue($g['dn'],"copy",$type[0],$type[2],'fai',$this);
+          @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$g['dn'],"Entry copied!");
+        }else{
+          $this->dialogObject = new faiGroupHandle($entry['GROUPS'],"copy");
+        }
+        
+      }else{
+
+        // More than one group was selected, expect that the user wants to copy the complete groups.
+        foreach($target as $t){
+          $entry = $headpage->getEntry($t);
+
+          // Check for valid FAI objects
+          if(in_array('FAKE_OC_FAI', $entry['objectClass'])){
+            foreach($entry['GROUPS'] as $g){
+              $type = $this->get_type($g);
+              $this->cpHandler->add_to_queue($g['dn'],"copy",$type[0],$type[2],'fai',$this);
+              @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$g['dn'],"Entry copied!");
+            }
           }
         }
       }
@@ -452,7 +470,19 @@ class faiManagement extends management
     }elseif($this->dialogObject instanceOf faiGroupHandle && $this->dialogObject->get_mode() == "remove"){
       $this->dialogObject->save_object();
       $to_delete = $entry = $this->dialogObject->get_selected();
+      if(count($to_delete)) $this->closeDialogs();
       return($this->removeFAIObjects($to_delete));
+    }elseif($this->dialogObject instanceOf faiGroupHandle && $this->dialogObject->get_mode() == "copy"){
+      $this->dialogObject->save_object();
+      $entries = $entry = $this->dialogObject->get_selected();
+      if(count($entries)){
+        foreach($entries as $entry){
+          $type = $this->get_type($entry);
+          $this->cpHandler->add_to_queue($entry['dn'],"copy",$type[0],$type[2],'fai',$this);
+          @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$entry['dn'],"Entry copied!");
+        }
+        $this->closeDialogs();
+      }
     }
   }
 
index 7410399e4dc612fb67fbfac49a869238cd7114db..80a16f07536da0176c8d1a1142d2d7173e9e8ef7 100644 (file)
                                class='center'>
                </td>
                <td style='width:150px;'>{$types.$key.NAME}</td>
-               <td><i>({$item.description})</i>
+               <td><i>({$item.description.0})</i>
                </td>
        </tr>
 {/foreach}
 </table>
 
-{elseif $mode == "cut"}
-
-<b>{t}Select the object you want to cut:{/t}</b>
-<br>
-<br>
-<table>
-{foreach from=$FAI_group item=item key=key}
-       <tr>
-               <td>
-                       {if $item.freezed}
-                               <img src="images/lists/locked.png" class='center'>
-                       {else}
-                               <input type='checkbox' name='{$mode}_{$key}'
-                       {if $item.selected} checked {/if}>
-                       {/if}
-               </td>
-               <td>
-                       <img src='{$types.$key.IMG}' alt='{$types.$key.KZL}' title='{$types.$key.NAME}'
-                               class='center'>
-               </td>
-               <td style='width:150px;'>{$types.$key.NAME}</td>
-               <td><i>({$item.description})</i> </td>
-       </tr>
-{/foreach}
-</table>
 {/if}
 <br>
 <br>