? .git ? bot_log_search.patch Index: bot_log/bot_log.css =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/bot/bot_log/Attic/bot_log.css,v retrieving revision 1.1.2.2.2.1 diff -u -p -r1.1.2.2.2.1 bot_log.css --- bot_log/bot_log.css 26 Apr 2008 01:32:31 -0000 1.1.2.2.2.1 +++ bot_log/bot_log.css 17 May 2010 21:06:17 -0000 @@ -25,11 +25,20 @@ margin-top: 1em; } -#bot-log-filter-form .container-inline .container-inline { +#bot-log-filter-form #edit-bot-log-submit { + margin-top: 10px; +} + +#bot-log-filter-form .fieldset-content div, +#bot-log-filter-form .fieldset-content label { + display: inline; +} + +#edit-bot-log-search-terms-wrapper { margin-left: 1em; } -#bot-log-filter-form #edit-bot-log-submit { - margin: 0; +#edit-bot-log-date-date-wrapper { + margin-left: 1em; margin-right: 1em; -} +} \ No newline at end of file Index: bot_log/bot_log.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/bot/bot_log/Attic/bot_log.module,v retrieving revision 1.1.2.7.2.9 diff -u -p -r1.1.2.7.2.9 bot_log.module --- bot_log/bot_log.module 10 May 2010 12:38:27 -0000 1.1.2.7.2.9 +++ bot_log/bot_log.module 17 May 2010 21:06:17 -0000 @@ -222,7 +222,7 @@ function bot_log_insert($type, $channel, * @return $html * A themed log for display. */ -function bot_log_day($channel = NULL, $day = NULL) { +function bot_log_day($channel = NULL, $day = NULL, $field = NULL, $terms = NULL) { $output = NULL; // if there's no channel... @@ -241,9 +241,13 @@ function bot_log_day($channel = NULL, $d $day = $day ? $day : gmdate('Y-m-d'); $day_start = strtotime("$day GMT"); $day_end = $day_start + (60 * 60 * 24); - // see bot_log_irc_msg_quit() for why we use a regexp on channels for lookups. - $results = db_query("SELECT * FROM {bot_log} WHERE channel REGEXP '.*#%s( |$)' AND (timestamp >= %d AND timestamp <= %d) ORDER BY id", $channel, $day_start, $day_end); + if (isset($field) && isset($terms)) { // We're searching for a clue! + $results = db_query("SELECT * FROM {bot_log} WHERE channel REGEXP '.*#%s( |$)' AND (timestamp >= %d AND timestamp <= %d) AND %s LIKE '%%%s%%' ORDER BY id", $channel, $day_start, $day_end, $field, $terms); + } + else { + $results = db_query("SELECT * FROM {bot_log} WHERE channel REGEXP '.*#%s( |$)' AND (timestamp >= %d AND timestamp <= %d) ORDER BY id", $channel, $day_start, $day_end); + } $logs = array(); while ($result = db_fetch_array($results)) { $logs[] = $result; } $output .= theme('bot_log_day', $channel, $day, $logs); return $output; @@ -363,18 +367,66 @@ function bot_log_filter_form(&$form_stat $date = $date ? strtotime($date) : time(); $day_before_date = date('Y-m-d', $date - (60 * 60 * 24)); $day_after_date = date('Y-m-d', $date + (60 * 60 * 24)); + + $field = arg(4); + $terms = arg(5); + + $url_after = $channel . '/' . $day_after_date; + $url_before = $channel . '/' . $day_before_date; + + // Keep the links persistent, respecting the filter we set up. + if (isset($field)) { + $url_after .= '/' . $field; + $url_before .= '/' . $field; + } + if (isset($terms)) { + $url_after .= '/' . $terms; + $url_before .= '/' . $terms; + } + $form['bot_log_channel'] = array( + '#type' => 'hidden', + '#value' => $channel, + ); $form['bot_log_date'] = array( + '#type' => 'fieldset', + '#title' => t('Date'), + '#collapsible' => TRUE, + '#collapsed' => FALSE, + '#tree' => TRUE, + ); + $form['bot_log_date']['before'] = array( + '#type' => 'markup', + '#value' => '‹ ' . l($day_before_date, 'bot/log/' . $url_before), + ); + $form['bot_log_date']['date'] = array( '#default_value' => array('year' => date('Y', $date), 'month'=> date('n', $date),'day' => date('j', $date)), - '#prefix' => '