summaryrefslogtreecommitdiff
path: root/modules/watchdog
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-01-24 08:18:26 +0000
committerDries Buytaert <dries@buytaert.net>2006-01-24 08:18:26 +0000
commitaf43886456ebd248b8972e3050e78009efe4f521 (patch)
treefff50106e2cea872417f4017c623706f3046668c /modules/watchdog
parent100db62511e973c077bca9c04c6ea77545461d69 (diff)
downloadbrdo-af43886456ebd248b8972e3050e78009efe4f521.tar.gz
brdo-af43886456ebd248b8972e3050e78009efe4f521.tar.bz2
- Patch #33861 by Morbus et al: clean up the watchdog view.
Diffstat (limited to 'modules/watchdog')
-rw-r--r--modules/watchdog/watchdog.module27
1 files changed, 17 insertions, 10 deletions
diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module
index 4f19dce27..3c66a7564 100644
--- a/modules/watchdog/watchdog.module
+++ b/modules/watchdog/watchdog.module
@@ -156,20 +156,27 @@ function watchdog_event($id) {
$output = '';
$result = db_query('SELECT w.*, u.name, u.uid FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid WHERE w.wid = %d', $id);
if ($watchdog = db_fetch_object($result)) {
- $output .= '<table border="1" cellpadding="2" cellspacing="2">';
- $output .= ' <tr><th>'. t('Type') .'</th><td>' . t($watchdog->type) . '</td></tr>';
- $output .= ' <tr><th>'. t('Date') .'</th><td>'. format_date($watchdog->timestamp, 'large') .'</td></tr>';
- $output .= ' <tr><th>'. t('User') .'</th><td>'. theme('username', $watchdog) .'</td></tr>';
- $output .= ' <tr><th>'. t('Location') ."</th><td>". l($watchdog->location, $watchdog->location) ."</td></tr>";
- $output .= ' <tr><th>'. t('Referrer') ."</th><td>". l($watchdog->referer, $watchdog->referer) ."</td></tr>";
- $output .= ' <tr><th>'. t('Message') ."</th><td>$watchdog->message</td></tr>";
- $output .= ' <tr><th>'. t('Severity') .'</th><td>'. $severity[$watchdog->severity] .'</td></tr>';
- $output .= ' <tr><th>'. t('Hostname') ."</th><td>$watchdog->hostname</td></tr>";
- $output .= '</table>';
+ $header = array(t('Type'), t('Date'), t('User'), t('Location'), t('Referrer'), t('Message'), t('Severity'), t('Hostname'));
+ $data = array(t($watchdog->type), format_date($watchdog->timestamp, 'large'), theme('username', $watchdog), l($watchdog->location, $watchdog->location), l($watchdog->referer, $watchdog->referer), $watchdog->message, $severity[$watchdog->severity], $watchdog->hostname);
+ $output = theme('watchdog_event', $header, $data);
}
return $output;
}
+function theme_watchdog_event($header, $data) {
+ $output = '';
+ $output .= '<table class="watchdog-event">';
+
+ $n = count($header);
+ for ($i = 0; $i < $n; $i++) {
+ $output .= '<tr class="' . ($i % 2 == 0 ? 'even' : 'odd') . '"><th>' . $header[$i] . '</th><td>' . $data[$i] . '</td></tr>';
+ }
+
+ $output .= '</table>';
+
+ return $output;
+}
+
function _watchdog_get_message_types() {
$types = array();