Code

Added timeout to GOsa::log mysql connections.
[gosa.git] / gosa-core / include / class_listing.inc
index 7d8138348388885a26eeb771b6259af2ca87dbc7..e0ca916ef09189fa7e64a337fc6435643e90a057 100644 (file)
@@ -140,6 +140,9 @@ class listing {
     }
     $this->categories= array();
     if (isset($this->xmlData['definition']['objectType'])) {
+      if(isset($this->xmlData['definition']['objectType']['label'])) {
+        $this->xmlData['definition']['objectType']= array($this->xmlData['definition']['objectType']);
+      }
       foreach ($this->xmlData['definition']['objectType'] as $index => $otype) {
         $this->objectTypes[]= $this->xmlData['definition']['objectType'][$index];
         if (isset($this->xmlData['definition']['objectType'][$index]['category'])){
@@ -308,8 +311,8 @@ class listing {
     }
 
     // Need to fill the list if it's not full (nobody knows why this is 22 ;-))
-    $emptyListStyle= (count($this->entries) + count($deps) == 0)?"border:0;":"";
-    if (count($this->entries) + count($deps) < 22) {
+    $emptyListStyle= (count($this->entries) + $deps == 0)?"border:0;":"";
+    if ((count($this->entries) + $deps) < 22) {
       $result.= "<tr>";
       for ($i= 0; $i<$this->numColumns; $i++) {
         if ($i == 0) {
@@ -373,6 +376,9 @@ class listing {
     global $config;
     $ui= get_userinfo();
 
+    // Reset object counter
+    $this->objectTypeCount= array();
+
     // Do not do anything if this is not our PID
     if(isset($_REQUEST['PID']) && $_REQUEST['PID'] != $this->pid) {
       return;
@@ -508,6 +514,10 @@ class listing {
     // Watch out for filters and prepare to execute them
     $data= $this->processElementFilter($data, $config, $row);
 
+    // Replace all non replaced %{...} instances because they
+    // are non resolved attributes or filters
+    $data= preg_replace('/%{[^}]+}/', '&nbsp;', $data);
+
     return $data;
   }
 
@@ -894,7 +904,7 @@ class listing {
     $actions= &$this->xmlData['actionmenu']['action'];
     $result= "<input type='hidden' name='act' id='actionmenu' value=''>".
              "<ul class='level1' id='root'><li><a href='#'>Aktionen&nbsp;<img ".
-             "border=0 src='images/lists/sort-down.png'></a>";
+             "border=0 class='center' src='images/lists/sort-down.png'></a>";
 
     // Build ul/li list
     $result.= $this->recurseActions($actions);
@@ -919,7 +929,7 @@ class listing {
       // Fill image if set
       $img= "";
       if (isset($action['image'])){
-        $img= "<img border=0 src='".$action['image']."'>&nbsp;";
+        $img= "<img border='0' class='center' src='".$action['image']."'>&nbsp;";
       }
 
       if ($action['type'] == "separator"){
@@ -980,7 +990,7 @@ class listing {
       // Every ACL has to pass
       foreach ($acls as $acl) {
         $module= $this->module;
-        $acllist= array();
+        $aclList= array();
 
         // Split for category and plugins if needed
         // match for "[rw]" style entries
@@ -1270,9 +1280,9 @@ class listing {
     // If there is a daemon registered, draw the menu entries
     if(class_available("DaemonEvent")){
       $events= DaemonEvent::get_event_types_by_category($this->categories);
-      if(count($events['BY_CLASS'])){
+      if(isset($events['BY_CLASS']) && count($events['BY_CLASS'])){
         foreach($events['BY_CLASS'] as $name => $event){
-          $result.= "<li$separator><a href='#' onClick='document.getElementById(\"actionmenu\").value= \"$name\";mainform.submit();'><img src='".$event['MenuImage']."' alt='' border='0' class='center'>&nbsp;".$event['s_Menu_Name']."</a></li>";
+          $result.= "<li$separator><a href='#' onClick='document.getElementById(\"actionmenu\").value=\"$name\";mainform.submit();'>".$event['MenuImage']."&nbsp;".$event['s_Menu_Name']."</a></li>";
           $separator= "";
         }
       }