Code

Updated image path in mimtype template.
[gosa.git] / gosa-plugins / goto / admin / mimetypes / class_divListMimeTypes.inc
index b324a8a8349e9874e278d4422ec928bb3b0d978b..6cc6e6df85d1227368a25b6ded23c384db83b5fd 100644 (file)
@@ -67,7 +67,7 @@ class divListMimeTypes extends MultiSelectWindow
       $releases = $this->parent->getReleases();
       $smarty->assign("mime_release" , $releases[$this->parent->mime_release]);
       $smarty->assign("mime_base"    , $releases[$this->parent->mime_base]);
-      $smarty->assign("branchimage","images/branch.png");
+      $smarty->assign("branchimage","plugins/goto/images/branch.png");
       $smarty->assign("mime_releases", $releases);
       $str = $smarty->fetch(get_template_path('release_select.tpl', TRUE));
     }
@@ -78,66 +78,16 @@ class divListMimeTypes extends MultiSelectWindow
   /* Create list header, with create / copy & paste etc*/
   function GenHeader()
   {
-
-
     /* Add default header */
     $listhead = MultiSelectWindow::get_default_header(false);
     if(!$this->parent->IsReleaseManagementActivated()){
 
-      /* Prepare departments,
-         which are shown in the listbox on top of the listbox
-       */
-      $options= "";
-
       /* Get all departments within this subtree */
       $ui= get_userinfo();
       $first = "";
       $found = FALSE;
       $base = $this->config->current['BASE'];
-
-      /* Add 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();
-      $tdeps= $ui->get_module_departments($this->module);
-      $ids = $this->config->idepartments;
-      $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
-           */
-          if(empty($first)) {
-            $first = $dep['dn'];
-          }
-
-          $value = $ids[$dep];
-          if ($this->selectedBase == $dep){
-            $found = TRUE;
-            $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-          } else {
-            $options.= "<option value='".$dep."'>$value</option>";
-          }
-        }
-      }
-
-      /* The currently used base is not visible with your acl setup.
-       * Set base to first useable base.
-       */
-      if(!$found){
-        $this->selectedBase = $first;
-      }
+      $options  = $this->create_department_list($this->module);
 
       /* And at least add a department selection box */
       $listhead .=  _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
@@ -148,8 +98,8 @@ class divListMimeTypes extends MultiSelectWindow
 
     /* Get acls */
     $ui       = get_userinfo();
-    $acl      = $ui->get_permissions($this->parent->mime_base,"mimetypes/mimetype");
-    $acl_all  = $ui->has_complete_category_acls($this->parent->mime_base,"mimetypes") ;
+    $acl      = $ui->get_permissions($this->parent->acl_base,"mimetypes/mimetype");
+    $acl_all  = $ui->has_complete_category_acls($this->parent->acl_base,"mimetypes") ;
 
 
     /* If this is true we add an additional seperator. Just look a few lines below */  
@@ -162,7 +112,7 @@ class divListMimeTypes extends MultiSelectWindow
     if(preg_match("/c/",$acl)) {
       $s .= "..|<img src='images/lists/new.png' alt='' border='0' class='center'>".
         "&nbsp;"._("Create")."|\n";
-      $s.= "...|<input class='center' type='image' src='images/list_new_mime.png' alt=''>".
+      $s.= "...|<input class='center' type='image' src='plugins/goto/images/list_new_mime.png' alt=''>".
         "&nbsp;"._("Mime type")."|mime_new|\n";
       $s.= "..|---|\n";
     }
@@ -199,7 +149,7 @@ class divListMimeTypes extends MultiSelectWindow
     /* Create links */
     $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
     $userimg  = "<img class='center' src='plugins/groups/images/groups.png' alt='User'    title='%s'>";
-    $mimeimg  = "<img class='center' src='images/select_mimetype.png' alt='A'  title='"._("Mime type")."'>";
+    $mimeimg  = "<img class='center' src='plugins/goto/images/select_mimetype.png' alt='A'  title='"._("Mime type")."'>";
     $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
 
     /* set Page header */
@@ -214,6 +164,10 @@ class divListMimeTypes extends MultiSelectWindow
 
     foreach($list as $key => $val){
 
+      /* Check FAI state 
+       */  
+      $FAIstate = $val['FAIstate'][0];
+
       $ui       = get_userinfo();
       $acl      = $ui->get_permissions($val['dn'],"mimetypes/mimetype");
       $acl_all  = $ui->has_complete_category_acls($val['dn'],"mimetypes") ;
@@ -221,23 +175,35 @@ class divListMimeTypes extends MultiSelectWindow
       $action = "";
 
       /* Add copy & cut functionality */
-      $action.= $this->parent->get_copypaste_action($val['dn'],"mimetypes","mimetype");
+      if(!preg_match("/freeze/i",$FAIstate)){
+        $action.= $this->parent->get_copypaste_action($val['dn'],"mimetypes","mimetype");
+      }else{
+        $action.= "<img src='images/empty.png' class='center' alt=''>&nbsp;";
+        $action.= "<img src='images/empty.png' class='center' alt=''>&nbsp;";
+      }
 
       $action.= "<input class='center' type='image'
         src='images/lists/edit.png' alt='"._("edit")."' name='mime_edit_%KEY%' title='"._("Edit this entry")."'>";
 
       /* Add snapshot icon */
-      $action.= $this->parent->get_snapshot_action($val['dn'],$this->module);
+      if(!preg_match("/freeze/i",$FAIstate)){
+        $action.= $this->parent->get_snapshot_action($val['dn'],$this->module);
+      }else{
+        $action.= "<img src='images/empty.png' class='center' alt=''>&nbsp;";
+        $action.= "<img src='images/empty.png' class='center' alt=''>&nbsp;";
+      }
 
       /* Add delete button */
-      if(preg_match("/d/",$acl)){
+      if(preg_match("/freeze/i",$FAIstate)){
+        $action .= "<img src='plugins/goto/images/freeze.png' class='center' alt='!' title='"._("Freezed")."'>";
+      }elseif(preg_match("/d/",$acl)){
         $action.= "<input class='center' type='image'
           src='images/lists/trash.png' alt='"._("delete")."' name='mime_del_%KEY%' title='"._("Delete this entry")."'>";
       }else{
         $action.= "<img src='images/empty.png' alt='&nbsp;' class='center'>";
       }
 
-      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
+      $title = "title='".preg_replace('/ /', '&nbsp;', LDAP::fix($val['dn']))."'";
 
       if(!isset($val['description'][0])){
         $desc = "";
@@ -277,7 +243,7 @@ class divListMimeTypes extends MultiSelectWindow
     $num_obj_str = _("Number of listed mimetypes");
     $num_dep_str = _("Number of listed departments");
 
-    $str = "<img class='center' src='images/select_mimetype.png'
+    $str = "<img class='center' src='plugins/goto/images/select_mimetype.png'
               title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
     $str.= "<img class='center' src='images/lists/folder.png'
               title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";