Code

Added additional comments.
[gosa.git] / gosa-core / include / class_listing.inc
index d1a2d3d1361be8ef52ab2c5f1ca849811a8a9329..37efe409d57c98598959e78a68e7a572df0c69ee 100644 (file)
@@ -164,7 +164,7 @@ class listing {
     // Fill objectTypes from departments and xml definition
     $types = departmentManagement::get_support_departments();
     foreach ($types as $class => $data) {
-      $this->objectTypes[]= array("label" => $data['TITLE'],
+      $this->objectTypes[$data['OC']]= array("label" => $data['TITLE'],
                                   "objectClass" => $data['OC'],
                                   "image" => $data['IMG']);
     }
@@ -174,12 +174,14 @@ class listing {
         $this->xmlData['definition']['objectType']= array($this->xmlData['definition']['objectType']);
       }
       foreach ($this->xmlData['definition']['objectType'] as $index => $otype) {
-        $this->objectTypes[]= $this->xmlData['definition']['objectType'][$index];
+        $tmp = $this->xmlData['definition']['objectType'][$index];
+        $this->objectTypes[$tmp['objectClass']]= $tmp;
         if (isset($this->xmlData['definition']['objectType'][$index]['category'])){
           $this->categories[]= $otype['category'];
         }
       }
     }
+    $this->objectTypes = array_values($this->objectTypes);
 
     // Parse layout per column
     $this->colprops= $this->parseLayout($this->xmlData['table']['layout']);
@@ -271,7 +273,7 @@ class listing {
     // Some browsers don't have the ability do do scrollable table bodies, filter them
     // here.
     $switch= false;
-    if (preg_match('/(Opera|Konqueror|Safari|msie)/i', $_SERVER['HTTP_USER_AGENT'])){
+    if (preg_match('/(Opera|Konqueror|Safari)/i', $_SERVER['HTTP_USER_AGENT'])){
       $switch= true;
     }
 
@@ -284,8 +286,8 @@ class listing {
       $height= $this->height;
     }
     
-    $result.= "<div class='listContainer' id='d_scrollbody' style='border-top:1px solid #B0B0B0;border-right:1px solid #B0B0B0;width:100%;min-height:".($height+25)."px;'>\n";
-    $result.= "<table summary='$this->headline' style='width:100%; table-layout:fixed' cellspacing='0' cellpadding='0' id='t_scrolltable'>\n";
+    $result.= "<div class='listContainer' id='d_scrollbody' style='min-height:".($height+25)."px;'>\n";
+    $result.= "<table summary='$this->headline' style='width:100%;table-layout:fixed' cellspacing='0' cellpadding='0' id='t_scrolltable'>\n";
     $this->numColumns= count($this->colprops) + ($this->multiSelect?1:0);
 
     // Build list header
@@ -307,7 +309,7 @@ class listing {
 
     // No results? Just take an empty colspanned row
     if (count($this->entries) + count($this->departments) == 0) {
-      $result.= "<tr class='rowxp0'><td class='list1nohighlight' colspan='$this->numColumns' style='height:100%;border-right:0px;width:100%;'>&nbsp;</td></tr>";
+      $result.= "<tr><td class='list1nohighlight' colspan='$this->numColumns' style='height:100%;border-right:0px;width:100%;'>&nbsp;</td></tr>";
     }
 
     // Line color alternation
@@ -320,7 +322,7 @@ class listing {
       // Fill with department browser if configured this way
       $departmentIterator= new departmentSortIterator($this->departments, $this->sortDirection[$this->sortColumn]);
       foreach ($departmentIterator as $row => $entry){
-        $result.="<tr class='rowxp".($alt&1)."'>";
+        $result.="<tr>";
 
         // Render multi select if needed
         if ($this->multiSelect) {
@@ -380,10 +382,10 @@ class listing {
     // Complete list by sorting entries for _sort$index and appending them to the output
     $entryIterator= new listingSortIterator($this->entries, $this->sortDirection[$this->sortColumn], "_sort".$this->sortColumn, $this->sortType);
     foreach ($entryIterator as $row => $entry){
-      $alt++;
-      $result.="<tr class='rowxp".($alt&1)."'>\n";
+      $result.="<tr>\n";
       $result.= $entry['_rendered'];
       $result.="</tr>\n";
+      $alt++;
     }
 
     // Need to fill the list if it's not full (nobody knows why this is 22 ;-))
@@ -472,6 +474,10 @@ class listing {
     // Take care of base selector
     if ($this->baseMode) {
       $this->baseSelector->update();
+      // Check if a wrong base was supplied
+      if(!$this->baseSelector->checkLastBaseUpdate()){
+         msg_dialog::display(_("Error"), msgPool::check_base(), ERROR_DIALOG);
+      }
     }
 
     // Save base
@@ -1246,7 +1252,7 @@ class listing {
           $checkAcl= "";
 
           // Category or detailed permission?
-          if (strpos('/', $module) === false) {
+          if (strpos($module, '/') !== false) {
             if (preg_match('/([a-zA-Z0-9]+):([rwcdm]+)/', $sAcl, $m) ) {
               $checkAcl= $ui->get_permissions($dn, $module, $m[1]);
               $sAcl= $m[2];
@@ -1294,6 +1300,7 @@ class listing {
     // Populate base selector if already present
     if ($this->baseSelector && $this->baseMode) {
       $this->baseSelector->setBases($this->bases);
+      $this->baseSelector->update(TRUE);
     }
   }