summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-08-23 18:16:45 +0000
committerDries Buytaert <dries@buytaert.net>2006-08-23 18:16:45 +0000
commit689a61f199c604dcabd0434c4d8e68d5f5148425 (patch)
tree3feedec15bf4f6690c08679e12b68e8853f22560
parent7270a08ef063bcc14d3d57c67fb2a24f612b91ee (diff)
downloadbrdo-689a61f199c604dcabd0434c4d8e68d5f5148425.tar.gz
brdo-689a61f199c604dcabd0434c4d8e68d5f5148425.tar.bz2
- Patch #78105 by nicki: Since the new table header feature has been committed to cvs (http://drupal.org/node/76741), this patch is to demonstrate the new functionality of defining a table cell as a heading, by removing the custom theme theme_watchdog_event and replacing it with the standard theme_table on the watchdog event details node (admin/log/event/1234) as per Morbis Iff's suggestion.
-rw-r--r--modules/watchdog/watchdog.module53
1 files changed, 36 insertions, 17 deletions
diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module
index f93a2cd2a..d941e774f 100644
--- a/modules/watchdog/watchdog.module
+++ b/modules/watchdog/watchdog.module
@@ -177,24 +177,43 @@ 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)) {
- $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>';
+ $rows = array(
+ array(
+ array('data' => t('Type'), 'header' => TRUE),
+ t($watchdog->type),
+ ),
+ array(
+ array('data' => t('Date'), 'header' => TRUE),
+ format_date($watchdog->timestamp, 'large'),
+ ),
+ array(
+ array('data' => t('User'), 'header' => TRUE),
+ theme('username', $watchdog),
+ ),
+ array(
+ array('data' => t('Location'), 'header' => TRUE),
+ l($watchdog->location, $watchdog->location),
+ ),
+ array(
+ array('data' => t('Referrer'), 'header' => TRUE),
+ l($watchdog->referer, $watchdog->referer),
+ ),
+ array(
+ array('data' => t('Message'), 'header' => TRUE),
+ $watchdog->message,
+ ),
+ array(
+ array('data' => t('Severity'), 'header' => TRUE),
+ $severity[$watchdog->severity],
+ ),
+ array(
+ array('data' => t('Hostname'), 'header' => TRUE),
+ $watchdog->hostname,
+ ),
+ );
+ $attributes = array('class' => 'watchdog-event');
+ $output = theme('table', array(), $rows, $attributes);
}
-
- $output .= '</table>';
-
return $output;
}