From af43886456ebd248b8972e3050e78009efe4f521 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 24 Jan 2006 08:18:26 +0000 Subject: - Patch #33861 by Morbus et al: clean up the watchdog view. --- modules/watchdog.module | 27 +++++++++++++++++---------- modules/watchdog/watchdog.module | 27 +++++++++++++++++---------- 2 files changed, 34 insertions(+), 20 deletions(-) (limited to 'modules') diff --git a/modules/watchdog.module b/modules/watchdog.module index 4f19dce27..3c66a7564 100644 --- a/modules/watchdog.module +++ b/modules/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 .= ''; - $output .= ' '; - $output .= ' '; - $output .= ' '; - $output .= ' "; - $output .= ' "; - $output .= ' "; - $output .= ' '; - $output .= ' "; - $output .= '
'. t('Type') .'' . t($watchdog->type) . '
'. t('Date') .''. format_date($watchdog->timestamp, 'large') .'
'. t('User') .''. theme('username', $watchdog) .'
'. t('Location') ."". l($watchdog->location, $watchdog->location) ."
'. t('Referrer') ."". l($watchdog->referer, $watchdog->referer) ."
'. t('Message') ."$watchdog->message
'. t('Severity') .''. $severity[$watchdog->severity] .'
'. t('Hostname') ."$watchdog->hostname
'; + $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 .= ''; + + $n = count($header); + for ($i = 0; $i < $n; $i++) { + $output .= ''; + } + + $output .= '
' . $header[$i] . '' . $data[$i] . '
'; + + return $output; +} + function _watchdog_get_message_types() { $types = array(); 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 .= ''; - $output .= ' '; - $output .= ' '; - $output .= ' '; - $output .= ' "; - $output .= ' "; - $output .= ' "; - $output .= ' '; - $output .= ' "; - $output .= '
'. t('Type') .'' . t($watchdog->type) . '
'. t('Date') .''. format_date($watchdog->timestamp, 'large') .'
'. t('User') .''. theme('username', $watchdog) .'
'. t('Location') ."". l($watchdog->location, $watchdog->location) ."
'. t('Referrer') ."". l($watchdog->referer, $watchdog->referer) ."
'. t('Message') ."$watchdog->message
'. t('Severity') .''. $severity[$watchdog->severity] .'
'. t('Hostname') ."$watchdog->hostname
'; + $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 .= ''; + + $n = count($header); + for ($i = 0; $i < $n; $i++) { + $output .= ''; + } + + $output .= '
' . $header[$i] . '' . $data[$i] . '
'; + + return $output; +} + function _watchdog_get_message_types() { $types = array(); -- cgit v1.2.3