123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- % layout 'logbot';
- % use List::Util qw( any uniq );
- % use LogBot::Util qw( time_to_ymd time_to_datestr );
- % use LogBot::Web::Util qw( url_for_channel );
- % my $last_channel = $ch eq '' ? $last_c : $ch;
- <div id="search-form">
- <form action="/" method="get" name="search">
- <div class="search-field">
- <div class="search-label">Query</div>
- <div class="search-input">
- <input type="text" name="q" id="search-query" placeholder="Search" value="<%= $q %>">
- </div>
- </div>
- <div class="search-field">
- <div class="search-label">Channels</div>
- <div class="search-input">
- <div>
- <div class="search-option">
- <input type="radio" id="search-channel-all" name="ch" value="" <%= 'checked' if $ch eq '' %>>
- <label for="search-channel-all">All channels</label>
- </div>
- % if ($last_channel) {
- <div class="search-option">
- <input type="radio" id="search-channel-single" name="ch" value="<%= substr($last_channel, 1) %>" <%= 'checked' if $ch %>>
- <label for="search-channel-single"><%= $last_channel %></label>
- </div>
- % }
- <div class="search-option">
- <input type="radio" id="search-channel-custom" name="ch" value="c" <%= 'checked' if @$chs %>>
- <label for="search-channel-custom">Specific Channels</label>
- </div>
- </div>
- <div id="search-channel-multi" class="default-display-none">
- <select name="chs" id="search-channels" multiple size="5">
- % foreach my $channel (@$channels) {
- <option <%= 'selected' if any { $_ eq $channel->{name} } @$chs %>><%= $channel->{name} %></option>
- % }
- </select>
- </div>
- </div>
- </div>
- <div class="search-field">
- <div class="search-label">When</div>
- <div class="search-input">
- <div>
- <div class="search-option">
- <input type="radio" id="search-when-all" name="w" value="a" <%= 'checked' if $w eq 'a' %>>
- <label for="search-when-all">All Time</label>
- </div>
- <div class="search-option">
- <input type="radio" id="search-when-recently" name="w" value="r" <%= 'checked' if $w eq 'r' %>>
- <label for="search-when-recently" title="Within the last three months">Recently</label>
- </div>
- <div class="search-option">
- <input type="radio" id="search-when-custom" name="w" value="c" <%= 'checked' if $w eq 'c' %>>
- <label for="search-when-custom">Specific Range</label>
- </div>
- </div>
- <div id="search-when-range" class="default-display-none">
- <div class="search-option">
- Between <input type="text" id="search-when-from" name="f" value="<%= $f %>">
- </div>
- <div class="search-option">
- and <input type="text" id="search-when-to" name="t" value="<%= $t %>">
- </div>
- </div>
- </div>
- </div>
- <div class="search-field">
- <div class="search-label">Who</div>
- <div class="search-input">
- <input type="text" id="search-who" name="n" placeholder="Anybody" value="<%= $n %>">
- <div class="search-option">
- <input type="checkbox" id="search-ignore-bots" name="i" value="1" <%= 'checked' if $i %>>
- <label for="search-ignore-bots">Exclude Bots</label>
- </div>
- </div>
- </div>
- <div class="search-field">
- <div class="search-label">Using</div>
- <div class="search-input">
- <div class="search-option">
- <input type="radio" id="search-using-ft" name="ft" value="y" <%= 'checked' if $ft eq 'y' %>>
- <label for="search-using-ft">Natural Language</label>
- </div>
- <div class="search-option">
- <input type="radio" id="search-using-like" name="ft" value="n" <%= 'checked' if $ft eq 'n' %>>
- <label for="search-using-like">Exact Match (Slower)</label>
- </div>
- </div>
- </div>
- <div class="search-field">
- <div class="search-label"></div>
- <div class="search-input">
- <input type="submit" id="search-form-submit" value="Search">
- </div>
- </div>
- % if ($c->param('debug')) {
- <input type="hidden" name="debug" value="1">
- % }
- </form>
- </div>
- % if ($c->param('debug')) {
- <pre id="debug"><%= $debug %></pre>
- % }
- % if ($log_count) {
- <div id="search-count" class="notification is-bordered">
- Found <%= 'more than' if $limited %> <%= $log_count %>
- <%= 'recent' if $w eq 'r' %>
- result<%= 's' unless $log_count == 1 %><%= ' in ' . $ch if $ch ne '' %>.
- </div>
- % }
- %= include 'shared/nick_styles', nick_hashes => $nick_hashes
- <div id="search-logs">
- % foreach my $date_block (@$logs) {
- % my $date = time_to_ymd($date_block->{date});
- % my $channels = $date_block->{channels};
- <div class="date"><%= time_to_datestr($date_block->{date}) %></div>
- <ul>
- % foreach my $channel (sort keys %$channels) {
- <li class="channel"><a href="<%= url_for_channel( channel => $channel, date => $date ) %>"><%= $channel %></a></li>
- % foreach my $event (@{ $channels->{$channel} }) {
- %= include 'shared/event', event => $event, search => 1, search => 1, channel => $channel, date => $date
- % }
- % }
- </ul>
- % }
- % if ($searched && !$log_count) {
- <div class="notification is-bordered">
- No <%= 'recent' if $w eq 'r' %> results found<%= ' in ' . $ch if $ch ne '' %>.
- </div>
- % }
- </div>
|