diff options
author | Dries Buytaert <dries@buytaert.net> | 2002-12-29 18:31:46 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2002-12-29 18:31:46 +0000 |
commit | 62fa5541dd2d865620a958722781f345af5f69f6 (patch) | |
tree | a3d7b18e8c7c1ff3ad87b9861260efcd3cb3165c | |
parent | c9ca1c6c80edf558effbb9924cfde82d8e141206 (diff) | |
download | brdo-62fa5541dd2d865620a958722781f345af5f69f6.tar.gz brdo-62fa5541dd2d865620a958722781f345af5f69f6.tar.bz2 |
- Added pager support to watchdog. Based on modified patch from Moshe.
-rw-r--r-- | modules/watchdog.module | 10 | ||||
-rw-r--r-- | modules/watchdog/watchdog.module | 10 |
2 files changed, 16 insertions, 4 deletions
diff --git a/modules/watchdog.module b/modules/watchdog.module index 9bd1de201..d09ab9e16 100644 --- a/modules/watchdog.module +++ b/modules/watchdog.module @@ -45,7 +45,7 @@ function watchdog_overview($type) { $color = array(user => "#FFEEAA", message => "#FFFFFF", special => "#A49FFF", warning => "#FFAA22", httpd => "#99DD99", error => "#EE4C4C"); $query = array(user => "WHERE type = 'user'", regular => "WHERE type = 'message'", special => "WHERE type = 'special'", warning => "WHERE type = 'warning'", error => "WHERE type = 'error'", httpd => "WHERE type = 'httpd'"); - $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.uid = u.uid ". ($type ? $query[$type] : "") ." ORDER BY timestamp DESC LIMIT 1000"); + $result = pager_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.uid = u.uid ". ($type ? $query[$type] : "") ." ORDER BY w.timestamp DESC", 100); $output .= "<table>"; $output .= " <tr><th>" . t("date") . "</th><th>" . t("message") . "</th><th>" . t("user") . "</th><th>" . t("operations") . "</th></tr>"; @@ -54,13 +54,19 @@ function watchdog_overview($type) { $output .= " <tr bgcolor=\"$background\"><td nowrap=\"nowrap\">". format_date($watchdog->timestamp, "small") ."</td><td>". substr(strip_tags($watchdog->message), 0, 64) ."</td><td align=\"center\">". format_name($watchdog) ."</a></td><td align=\"center\">". la(t("details"), array("mod" => "watchdog", "op" => "view", "id" => $watchdog->wid)) ."</td></tr>"; } } + + if ($pager = pager_display(NULL, 100, 0, "admin")) { + $output .= " <tr><td align=\"center\" colspan=\"4\">$pager</td></tr>"; + } + $output .= "</table>"; return $output; } function watchdog_view($id) { - $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.uid = u.uid WHERE w.wid = '$id'"); + + $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT 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\">"; diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module index 9bd1de201..d09ab9e16 100644 --- a/modules/watchdog/watchdog.module +++ b/modules/watchdog/watchdog.module @@ -45,7 +45,7 @@ function watchdog_overview($type) { $color = array(user => "#FFEEAA", message => "#FFFFFF", special => "#A49FFF", warning => "#FFAA22", httpd => "#99DD99", error => "#EE4C4C"); $query = array(user => "WHERE type = 'user'", regular => "WHERE type = 'message'", special => "WHERE type = 'special'", warning => "WHERE type = 'warning'", error => "WHERE type = 'error'", httpd => "WHERE type = 'httpd'"); - $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.uid = u.uid ". ($type ? $query[$type] : "") ." ORDER BY timestamp DESC LIMIT 1000"); + $result = pager_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.uid = u.uid ". ($type ? $query[$type] : "") ." ORDER BY w.timestamp DESC", 100); $output .= "<table>"; $output .= " <tr><th>" . t("date") . "</th><th>" . t("message") . "</th><th>" . t("user") . "</th><th>" . t("operations") . "</th></tr>"; @@ -54,13 +54,19 @@ function watchdog_overview($type) { $output .= " <tr bgcolor=\"$background\"><td nowrap=\"nowrap\">". format_date($watchdog->timestamp, "small") ."</td><td>". substr(strip_tags($watchdog->message), 0, 64) ."</td><td align=\"center\">". format_name($watchdog) ."</a></td><td align=\"center\">". la(t("details"), array("mod" => "watchdog", "op" => "view", "id" => $watchdog->wid)) ."</td></tr>"; } } + + if ($pager = pager_display(NULL, 100, 0, "admin")) { + $output .= " <tr><td align=\"center\" colspan=\"4\">$pager</td></tr>"; + } + $output .= "</table>"; return $output; } function watchdog_view($id) { - $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.uid = u.uid WHERE w.wid = '$id'"); + + $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT 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\">"; |