summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9ff39e3)
raw | patch | inline | side by side (parent: 9ff39e3)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 27 Nov 2007 11:50:27 +0000 (11:50 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 27 Nov 2007 11:50:27 +0000 (11:50 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7907 594d385d-05f5-0310-b6e9-bd551577e9d8
contrib/mysql/logging/logging.sql | patch | blob | history | |
plugins/addons/logview/class_gosa_logview.inc | patch | blob | history | |
plugins/addons/logview/gosa_log_contents.tpl | patch | blob | history |
index 856758e9f2b4b2c859e76f843b8f32fec84fdf40..e61472d8b186ade3a870235447d4f2ed69305fc1 100644 (file)
`changes` blob NOT NULL,
`result` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
- KEY `action` (`action`),
KEY `timestamp` (`timestamp`)
+ KEY `action` (`action`),
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
diff --git a/plugins/addons/logview/class_gosa_logview.inc b/plugins/addons/logview/class_gosa_logview.inc
index a48d5ffe356486b5bb93b04861b879c45a721754..b6f182a8044fc4d263a8e7605343fb5d1b37086c 100644 (file)
new log("debug","logview","",array(),@mysql_error());
} else {
-
-
- $start = $date_select_[$this->time];
-
- $sql_regex =trim(preg_replace("/\*/","%",$this->regex));
- $sql_regex = "%".trim($sql_regex,"%")."%";
-
- /* Order setting */
+ /* Prepare order setting */
if ($this->sort_direction == "down"){
$desc= "DESC";
$sort_sign = "<img src='images/sort_down.png' alt='\/' class='center' title='down' border=0>";
$desc= "";
$sort_sign = "<img src='images/sort_up.png' alt='/\' class='center' title='up' border=0>";
}
- $end= date ("YmdHis",time());
- $query_base= " FROM
- gosa_log
- WHERE
- timestamp <= $end AND timestamp >= $start
- AND
- result like '".$sql_regex."' OR user like '".$sql_regex."' ";
+ /* Get start time */
+ $start = $date_select_[$this->time];
+
+ /* Prepare search filter */
+ $sql_regex =trim(preg_replace("/\*/","%",$this->regex));
+ $sql_regex = "%".trim($sql_regex,"%")."%";
+ /* Create search filter */
+ $query_base= "FROM gosa_log WHERE timestamp >= $start ";
+
+ /* Append action filter */
if($this->action != "!ALL"){
- $query_base .="
- AND
- action like '".$this->action."'
- ";
- }
+ $query_base .=" AND action like '".$this->action."' ";
+ }
+
+ /* Append search filter */
+ if($sql_regex != "%%"){
+ $query_base .=" AND ( result like '".$sql_regex."' OR user like '".$sql_regex."') ";
+ }
/* Get number of entries */
- $query= "SELECT COUNT(*)".$query_base.";";
+ $query= "SELECT COUNT(`user`) ".$query_base.";";
$result = mysql_query($query);
if(!$result){
new log("debug","logview","",array(),@mysql_error());
}
$line= mysql_fetch_array($result, MYSQL_ASSOC);
- $count= $line['COUNT(*)'];
+ $count= $line['COUNT(`user`)'];
if ($count > 25){
$smarty->assign("range_selector", range_selector($count, $this->start, $this->range,"EntriesPerPage"));
} else {
$smarty->assign("range_selector", "");
}
- /* Query results */
- $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.";";
+ /* Query results that will be displayed */
+ $query= "SELECT * ".$query_base." 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);
-
if(!$result){
new log("debug","logview","",array(),@mysql_error());
}
+
+ echo "<pre>".$query."</pre>";
+
/* Display results */
$mod= 0;
$res.=" <td title='".$line['objecttype']."'>".$line['objecttype']."</td>";
$res.=" <td title='".$line['object']."'>".preg_replace("/,/",", ",$object)."</td>";
$res.=" <td>".$line['result']."</td>";
- if($line['repeated'] == 1){
- $res.=" <td>-</td>";
- }else{
- $res.=" <td>".($line['repeated']-1)."</td>";
- }
+# if($line['repeated'] == 1){
+# $res.=" <td>-</td>";
+# }else{
+# $res.=" <td>".($line['repeated']-1)."</td>";
+# }
$res.=" </tr>\n";
}
mysql_close($link);
diff --git a/plugins/addons/logview/gosa_log_contents.tpl b/plugins/addons/logview/gosa_log_contents.tpl
index f10d978063a60728cd936006ca938220e1814793..5d71d8103d84cea736e181ea7fdd92d17ef2adcb 100644 (file)
<td><a href="main.php{$plug}&sort=3&direction={$direction}">{t}Object type{/t} {$mode3}</a></td>
<td><a href="main.php{$plug}&sort=4&direction={$direction}">{t}Object{/t} {$mode4}</a></td>
<td><a href="main.php{$plug}&sort=5&direction={$direction}">{t}Message{/t} {$mode5}</a></td>
- <td><a href="main.php{$plug}&sort=6&direction={$direction}">{t}Repeated{/t} {$mode6}</a></td>
</tr>
{$search_result}
</table>