Code

Added repeated field
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 4 Jun 2007 12:34:42 +0000 (12:34 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 4 Jun 2007 12:34:42 +0000 (12:34 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6533 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/addons/logview/class_gosa_logview.inc
plugins/addons/logview/gosa_log_contents.tpl

index 92c572559246d06efbbb71ffd81835f698eaf7ce..41903b60e9415f4a08957aa48d3fe1fac2995354 100644 (file)
@@ -20,7 +20,7 @@ class gosa_logview extends plugin
   var $sort   = 2;
 
   var $sort_direction = "down";
-  var $fields         = array("action","timestamp","user","result");
+  var $fields         = array("action","timestamp","user","result","repeated");
   var $range          = 25;
   var $view_logged    = FALSE;
 
@@ -83,6 +83,7 @@ class gosa_logview extends plugin
     $smarty->assign("mode1", "");
     $smarty->assign("mode2", "");
     $smarty->assign("mode3", "");
+    $smarty->assign("mode4", "");
 
     /* Assign select option content */
     foreach( array("server", "action", "time", "regex") as $type){
@@ -234,7 +235,7 @@ class gosa_logview extends plugin
         }
 
         /* Query results */
-        $query= "SELECT *".$query_base." ORDER BY ".$this->fields[$this->sort]." $desc LIMIT ".$this->start.",".$this->range.";";
+        $query= "SELECT count(`action`) as 'repeated',`user`,`result`,`timestamp`,`action`,`action`,`objecttype`,`object`".$query_base." GROUP BY `action`,`result`,`timestamp` ORDER BY ".$this->fields[$this->sort]." $desc LIMIT ".$this->start.",".$this->range.";";
         @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__, $query, "Database query");
         $result = @mysql_query($query);
 
@@ -259,6 +260,7 @@ class gosa_logview extends plugin
           $res.="   <td>".date("H:i:s d.m.Y",$line['timestamp'])."</td>";
           $res.="   <td title='".$line['object']."'>".preg_replace("/,/",", ",$line['user'])."</td>"; 
           $res.="   <td>".$line['result']."</td>";
+          $res.="   <td>".$line['repeated']."</td>";
           $res.=" </tr>\n";
         }
         mysql_close($link);
@@ -326,7 +328,7 @@ class gosa_logview extends plugin
       }
 
       $this->sort= (int)$_GET['sort'];
-      if ($this->sort < 0 || $this->sort > 3){
+      if ($this->sort < 0 || $this->sort > 4){
         $this->sort= 0;
       }
     }
index f2c4b34082e21e0c14d50841d9cf381c14eb2978..992aef986c259d3daa7431902a507be8bb39725b 100644 (file)
@@ -83,6 +83,7 @@
    <td><a href=main.php{$plug}&amp;sort=2&amp;direction={$direction}>{t}Date{/t} {$mode2}</a></td>
    <td><a href=main.php{$plug}&amp;sort=1&amp;direction={$direction}>{t}User{/t} {$mode1}</a></td>
    <td><a href=main.php{$plug}&amp;sort=3&amp;direction={$direction}>{t}Message{/t} {$mode3}</a></td>
+   <td><a href=main.php{$plug}&amp;sort=4&amp;direction={$direction}>{t}Repeated{/t} {$mode4}</a></td>
   </tr>
   {$search_result}
  </table>