Code

Updated terminal copy & paste
[gosa.git] / plugins / admin / mimetypes / class_divListMimeTypes.inc
index 0d961ba4b1cdcdc0a71be48f67e0a8e0845dab54..87b7bbaa4524b4e7c499c026164720767303b1b7 100755 (executable)
@@ -96,20 +96,26 @@ class divListMimeTypes extends MultiSelectWindow
     $first = "";
     $found = FALSE;
     $base = $this->config->current['BASE'];
-    $deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-        array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH);
 
     /* Add base */
-    $deps[] = array("dn"=>$this->config->current['BASE']);
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
 
     /* Load possible departments */
-    $ui   = get_userinfo();
+    $ui= get_userinfo();
     $tdeps= $ui->get_module_departments($this->module);
-
     $ids = $this->config->idepartments;
-
-    foreach($deps as $dep){
-      if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
 
         /* Keep first base dn in mind, we could need this
          *  info if no valid base was found
@@ -117,12 +123,13 @@ class divListMimeTypes extends MultiSelectWindow
         if(empty($first)) {
           $first = $dep['dn'];
         }
-    
-        $value = $ids[$dep['dn']];
-        if ($this->selectedBase == $dep['dn']){
-          $options.= "<option selected='selected' value='".$dep['dn']."'>$value</option>";
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
         } else {
-          $options.= "<option value='".$dep['dn']."'>$value</option>";
+          $options.= "<option value='".$dep."'>$value</option>";
         }
       }
     }
@@ -183,6 +190,14 @@ class divListMimeTypes extends MultiSelectWindow
     $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/edittrash.png'
         title='"._("Remove selected mimetype")."' alt='"._("Remove mimetype")."' name='remove_multiple_mimetypes'>&nbsp;";
 
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler)){
+      $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/editcopy.png'
+        title='"._("Copy selected object")."' alt='"._("Copy object")."' name='multiple_copy_mimetypes'>&nbsp;";
+      $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/editcut.png'
+        title='"._("cut selected object")."' alt='"._("Cut object")."' name='multiple_cut_mimetypes'>&nbsp;";
+    }
+
     $listhead .="</div>";;
 
     $this->SetListHeader($listhead);