Skip to content

Commit

Permalink
show checked boxes for summary lines from DB
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Sep 15, 2012
1 parent 86a4081 commit b5b119f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions cgi/out.pl
Expand Up @@ -122,7 +122,7 @@
max_size => 150 * 1048576,
} );
# my $data = $cache->get($cache_key);
my $date;
my $data;
if (defined $data){
print $data;
} else {
Expand Down Expand Up @@ -153,8 +153,8 @@ sub irclog_output {
}
$t->param(BASE_URL => $base_url);
my $self_url = $base_url . "/$channel/$date";
my $db = $dbh->prepare('SELECT id, nick, timestamp, line FROM irclog '
. 'WHERE day = ? AND channel = ? AND NOT spam ORDER BY id');
my $db = $dbh->prepare('SELECT id, nick, timestamp, line, in_summary FROM '
. 'irclog WHERE day = ? AND channel = ? AND NOT spam ORDER BY id');
$db->execute($date, $full_channel);


Expand Down Expand Up @@ -188,6 +188,7 @@ sub irclog_output {
my $nick = decode('utf8', ($row[1]));
my $timestamp = $row[2];
my $message = $row[3];
my $in_summary = $row[4];
next if $message =~ m/^\s*\[off\]/i;

push @msg, message_line( {
Expand All @@ -200,6 +201,7 @@ sub irclog_output {
colors => \@colors,
self_url => $self_url,
channel => $channel,
in_summary => $in_summary,
},
\$c,
);
Expand Down
2 changes: 1 addition & 1 deletion cgi/template/line.tmpl
Expand Up @@ -5,7 +5,7 @@
</TMPL_IF>
<td class="time" id="i_<TMPL_VAR ID>"><a href="<TMPL_VAR BASE_URL><TMPL_VAR CHANNEL>/<TMPL_VAR DATE>#i_<TMPL_VAR ID>"><TMPL_VAR TIME></a></td>
<td class="summary"><input type="checkbox" name="in_summary_<TMPL_VAR
LINE_NUMBER>" value="<TMPL_VAR IN_SUMMARY>" /></td>
ID>" <TMPL_IF IN_SUMMARY>checked="checked"</TMPL_IF> /></td>
<td class="nick<TMPL_IF NICK_CLASS> <TMPL_VAR NICK_CLASS></TMPL_IF>"><TMPL_VAR NICK></td>
<td class="msg<TMPL_IF MSG_CLASS> <TMPL_VAR MSG_CLASS></TMPL_IF> <TMPL_VAR NAME=SEARCH_FOUND DEFAULT=''>"><TMPL_VAR NAME=MESSAGE ESCAPE=0></td>
</tr>
1 change: 1 addition & 0 deletions lib/IrcLog/WWW.pm
Expand Up @@ -497,6 +497,7 @@ sub message_line {
$args_ref->{nick},
),
LINE_NUMBER => ++$args_ref->{line_number},
IN_SUMMARY => $args_ref->{in_summary},
);
$h{DATE} = $args_ref->{date} if $args_ref->{date};
$h{SEARCH_FOUND} = 'search_found' if ($args_ref->{search_found});
Expand Down

0 comments on commit b5b119f

Please sign in to comment.