/[irc-logger]/trunk/bin/irc-logger.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bin/irc-logger.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 64 by dpavlin, Fri Jun 8 12:12:45 2007 UTC revision 65 by dpavlin, Fri Jun 8 12:17:35 2007 UTC
# Line 855  hr { border: 1px dashed #ccc; height: 1p Line 855  hr { border: 1px dashed #ccc; height: 1p
855  .col-3 { background: #ff9999 }  .col-3 { background: #ff9999 }
856  .col-4 { background: #ff66ff }  .col-4 { background: #ff66ff }
857  */  */
858    .calendar { border: 1px solid red; width: 100%; }
859    .month { border: 0px; width: 100%; }
860  _END_OF_STYLE_  _END_OF_STYLE_
861    
862  my $max_color = 4;  my $max_color = 4;
# Line 907  sub root_handler { Line 909  sub root_handler {
909                  qq{<p>};                  qq{<p>};
910          if ($request->url =~ m#/history#) {          if ($request->url =~ m#/history#) {
911                  my $sth = $dbh->prepare(qq{                  my $sth = $dbh->prepare(qq{
912                          select date(time) as date,count(*) as nr                          select date(time) as date,count(*) as nr,sum(length(message)) as len
913                                  from log                                  from log
914                                  group by date(time)                                  group by date(time)
915                                  order by date(time) desc                                  order by date(time) desc
916                  });                  });
917                  $sth->execute();                  $sth->execute();
918                  my ($l_yyyy,$l_mm) = (0,0);                  my ($l_yyyy,$l_mm) = (0,0);
919                    $html .= qq{<table class="calendar"><tr>};
920                  my $cal;                  my $cal;
921                    my $ord = 0;
922                  while (my $row = $sth->fetchrow_hashref) {                  while (my $row = $sth->fetchrow_hashref) {
923                          # this is probably PostgreSQL specific, expects ISO date                          # this is probably PostgreSQL specific, expects ISO date
924                          my ($yyyy,$mm,$dd) = split(/-/, $row->{date});                          my ($yyyy,$mm,$dd) = split(/-/, $row->{date});
925                          if ($yyyy != $l_yyyy || $mm != $l_mm) {                          if ($yyyy != $l_yyyy || $mm != $l_mm) {
926                                  $html .= $cal->as_HTML() if ($cal);                                  if ( $cal ) {
927                                            $html .= qq{<td valign="top">} . $cal->as_HTML() . qq{</td>};
928                                            $ord++;
929                                            $html .= qq{</tr><tr>} if ( $ord % 3 == 0 );
930                                    }
931                                  $cal = new HTML::CalendarMonthSimple('month'=>$mm,'year'=>$yyyy);                                  $cal = new HTML::CalendarMonthSimple('month'=>$mm,'year'=>$yyyy);
932                                  $cal->border(2);                                  $cal->border(1);
933                                    $cal->width('30%');
934                                    $cal->cellheight('5em');
935                                    $cal->tableclass('month');
936                                    #$cal->cellclass('day');
937                                    $cal->sunday('SUN');
938                                    $cal->saturday('SAT');
939                                    $cal->weekdays('MON','TUE','WED','THU','FRI');
940                                  ($l_yyyy,$l_mm) = ($yyyy,$mm);                                  ($l_yyyy,$l_mm) = ($yyyy,$mm);
941                          }                          }
942                          $cal->setcontent($dd, qq{                          $cal->setcontent($dd, qq{
943                                  <a href="/?date=$row->{date}">$row->{nr}</a>                                  <a href="/?date=$row->{date}">$row->{nr}</a><br/>$row->{len}
944                          });                          });
945                            
946                  }                  }
947                  $html .= $cal->as_HTML() if ($cal);                  $html .= qq{<td valign="top">} . $cal->as_HTML() . qq{</td></tr></table>};
948    
949          } else {          } else {
950                  $html .= join("</p><p>",                  $html .= join("</p><p>",

Legend:
Removed from v.64  
changed lines
  Added in v.65

  ViewVC Help
Powered by ViewVC 1.1.26