From 689a61f199c604dcabd0434c4d8e68d5f5148425 Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Wed, 23 Aug 2006 18:16:45 +0000
Subject: [PATCH] - 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.

---
 modules/watchdog/watchdog.module | 53 ++++++++++++++++++++++----------
 1 file changed, 36 insertions(+), 17 deletions(-)

diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module
index f93a2cd2a03f..d941e774f7d5 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;
 }
 
-- 
GitLab