Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.161 diff -u -p -r1.161 bootstrap.inc --- includes/bootstrap.inc 25 Apr 2007 21:34:31 -0000 1.161 +++ includes/bootstrap.inc 28 Apr 2007 20:27:33 -0000 @@ -37,6 +37,8 @@ define('CACHE_AGGRESSIVE', 2); /** * * Severity levels, as defined in RFC 3164 http://www.faqs.org/rfcs/rfc3164.html + * @see watchdog + * @see watchdog_severity_levels */ define('WATCHDOG_EMERG', 0); // Emergency: system is unusable define('WATCHDOG_ALERT', 1); // Alert: action must be taken immediately @@ -657,6 +659,8 @@ function request_uri() { * The severity of the message, as per RFC 3164 * @param $link * A link to associate with the message. + * + * @see watchdog_severity_levels */ function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) { global $user, $base_root; Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.636 diff -u -p -r1.636 common.inc --- includes/common.inc 27 Apr 2007 07:42:54 -0000 1.636 +++ includes/common.inc 28 Apr 2007 20:27:35 -0000 @@ -2616,3 +2616,22 @@ function drupal_parse_info_file($filenam return $info; } + +/** + * @return + * Array of the possible severity levels for log messages. + * + * @see watchdog + */ +function watchdog_severity_levels() { + return array( + WATCHDOG_EMERG => t('emergency'), + WATCHDOG_ALERT => t('alert'), + WATCHDOG_CRITICAL => t('critical'), + WATCHDOG_ERROR => t('error'), + WATCHDOG_WARNING => t('warning'), + WATCHDOG_NOTICE => t('notice'), + WATCHDOG_INFO => t('info'), + WATCHDOG_DEBUG => t('debug'), + ); +} Index: modules/dblog/dblog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.module,v retrieving revision 1.3 diff -u -p -r1.3 dblog.module --- modules/dblog/dblog.module 24 Apr 2007 13:53:11 -0000 1.3 +++ modules/dblog/dblog.module 28 Apr 2007 20:27:35 -0000 @@ -32,7 +32,7 @@ function dblog_help($section) { */ function dblog_theme() { return array( - 'dblog_form_overview' => array( + 'dblog_filters' => array( 'arguments' => array('form' => NULL), ), ); @@ -122,38 +122,24 @@ function dblog_user($op, &$edit, &$user) } } -function dblog_form_overview() { - $names['all'] = t('all messages'); - foreach (_dblog_get_message_types() as $type) { - $names[$type] = t('!type messages', array('!type' => t($type))); - } - - if (empty($_SESSION['dblog_overview_filter'])) { - $_SESSION['dblog_overview_filter'] = 'all'; - } - - $form['filter'] = array( - '#type' => 'select', - '#title' => t('Filter by message type'), - '#options' => $names, - '#default_value' => $_SESSION['dblog_overview_filter'] - ); - $form['submit'] = array('#type' => 'submit', '#value' => t('Filter')); - $form['#redirect'] = FALSE; - - return $form; -} /** * Menu callback; displays a listing of log messages. */ function dblog_overview() { + $filter = dblog_build_filter_query(); $rows = array(); - $icons = array(WATCHDOG_NOTICE => '', - WATCHDOG_WARNING => theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning')), - WATCHDOG_ERROR => theme('image', 'misc/watchdog-error.png', t('error'), t('error'))); - $classes = array(WATCHDOG_NOTICE => 'dblog-notice', WATCHDOG_WARNING => 'dblog-warning', WATCHDOG_ERROR => 'dblog-error'); + $icons = array( + WATCHDOG_NOTICE => '', + WATCHDOG_WARNING => theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning')), + WATCHDOG_ERROR => theme('image', 'misc/watchdog-error.png', t('error'), t('error')), + ); + $classes = array( + WATCHDOG_NOTICE => 'dblog-notice', + WATCHDOG_WARNING => 'dblog-warning', + WATCHDOG_ERROR => 'dblog-error', + ); - $output = drupal_get_form('dblog_form_overview'); + $output = drupal_get_form('dblog_filter_form'); $header = array( ' ', @@ -161,14 +147,13 @@ function dblog_overview() { array('data' => t('Date'), 'field' => 'w.wid', 'sort' => 'desc'), t('Message'), array('data' => t('User'), 'field' => 'u.name'), - array('data' => t('Operations')) + array('data' => t('Operations')), ); $sql = "SELECT w.wid, w.uid, w.severity, w.type, w.timestamp, w.message, w.variables, w.link, u.name FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid"; $tablesort = tablesort_sql($header); - $type = $_SESSION['dblog_overview_filter']; - if ($type != 'all') { - $result = pager_query($sql ." WHERE w.type = '%s'". $tablesort, 50, 0, NULL, $type); + if (!empty($filter['where'])) { + $result = pager_query($sql . " WHERE ". $filter['where'] . $tablesort, 50, 0, NULL, $filter['args']); } else { $result = pager_query($sql . $tablesort, 50); @@ -228,19 +213,11 @@ function dblog_top($type) { return $output; } -function theme_dblog_form_overview($form) { - return '