Przeglądaj źródła

Add new 'urlhistory' option

Morten Brix Pedersen 25 lat temu
rodzic
commit
80e51d911a
3 zmienionych plików z 29 dodań i 8 usunięć
  1. 13 4
      docs/CONFIG-README
  2. 1 0
      modules/Pisg.pm
  3. 15 4
      modules/Pisg/HTMLGenerator.pm

+ 13 - 4
docs/CONFIG-README

@@ -115,6 +115,9 @@ logdir              If you specify a path to a directory here, then pisg will
                     logfiles in it and create 1 HTML file from it. Useful
                     with eggdrops.
 
+prefix              Works when logdir is set, only analyse files in logdirs
+                    prefixed by xxx
+
 timeoffset          A time offset on the stats page - if your country has
                     a different timezone than the machine where the stats
                     are being generated, then for example set '+1' to add
@@ -238,14 +241,20 @@ maxquote            Maximum value of letters for a random quote
 wordlength          The minimum number of chars an interesting word may be
                     (in 'most referenced words')
 
-activenicks         Number of nicks to show in the 'top 25'
+activenicks         Number of nicks to show in 'most active nicks'
+                    (default 25)
 
 activenicks2        Nicks to show in 'these didnt make it...'
+                    (default 30)
+
+topichistory        Maximum number of topics to show in 'latest topics'
+                    (default 3)
 
-topichistory        How many topics to show in 'latest topics'
+urlhistory          Maximum number of URLs to show in 'most referenced URLs'
+                    (default 5)
 
-nicktracking        Track nickchanges and create aliases [1 or 0, enabled
-                    by default]
+nicktracking        1 or 0, track nickchanges and create aliases?
+                    (default 1)
 
 
 WORD OPTIONS

+ 1 - 0
modules/Pisg.pm

@@ -185,6 +185,7 @@ sub get_default_config_settings
         activenicks => 25,
         activenicks2 => 30,
         topichistory => 3,
+        urlhistory => 5,
         nicktracking => 0,
         charset => 'iso-8859-1',
 

+ 15 - 4
modules/Pisg/HTMLGenerator.pm

@@ -363,6 +363,7 @@ sub _activenicks
     . ($self->{cfg}->{show_words} ? "<td bgcolor=\"$self->{cfg}->{tdtop}\"><b>".$self->_template_text('show_words')."</b></td>" : "")
     . ($self->{cfg}->{show_wpl} ? "<td bgcolor=\"$self->{cfg}->{tdtop}\"><b>".$self->_template_text('show_wpl')."</b></td>" : "")
     . ($self->{cfg}->{show_cpl} ? "<td bgcolor=\"$self->{cfg}->{tdtop}\"><b>".$self->_template_text('show_cpl')."</b></td>" : "")
+    . ($self->{cfg}->{show_lastseen} ? "<td bgcolor=\"$self->{cfg}->{tdtop}\"><b>".$self->_template_text('show_lastseen')."</b></td>" : "")
     . ($self->{cfg}->{show_randquote} ? "<td bgcolor=\"$self->{cfg}->{tdtop}\"><b>".$self->_template_text('randquote')."</b></td>" : "")
     );
 
@@ -418,13 +419,20 @@ sub _activenicks
         my $col_g  = sprintf "%0.2x", abs int(((($t_g - $f_g) / $self->{cfg}->{activenicks}) * +$c) + $f_g);
         my $col_r  = sprintf "%0.2x", abs int(((($t_r - $f_r) / $self->{cfg}->{activenicks}) * +$c) + $f_r);
 
-
-        my $bgcolor;
+        my $bgcolor = $self->{cfg}->{rankc};
         if ($i == 1) {
             $bgcolor = $self->{cfg}->{hi_rankc};
+        } 
+
+        my $lastseen = $self->{stats}->{days} - $self->{stats}->{lastvisited}{$nick};
+        if ($lastseen == 0) {
+            $lastseen = $self->_template_text('today');
+        } elsif ($lastseen == 1) {
+            $lastseen = "$lastseen " .$self->_template_text('lastseen1');
         } else {
-            $bgcolor = $self->{cfg}->{rankc};
+            $lastseen = "$lastseen " .$self->_template_text('lastseen2');
         }
+        
             
         _html("<tr><td bgcolor=\"$bgcolor\" align=\"left\">");
 
@@ -447,6 +455,9 @@ sub _activenicks
         . ($self->{cfg}->{show_cpl} ?
         "<td bgcolor=\"#$col_r$col_g$col_b\">".sprintf("%.1f",$ch/$line)."</td>"
         : "")
+        . ($self->{cfg}->{show_lastseen} ?
+        "<td bgcolor=\"#$col_r$col_g$col_b\">$lastseen</td>"
+        : "")
         . ($self->{cfg}->{show_randquote} ?
         "<td bgcolor=\"#$col_r$col_g$col_b\">\"$randomline\"</td>"
         : "")
@@ -1479,7 +1490,7 @@ sub _mosturls
         _html("<td bgcolor=\"$self->{cfg}->{tdtop}\"><b>" . $self->_template_text('numberuses') . "</b></td>");
         _html("<td bgcolor=\"$self->{cfg}->{tdtop}\"><b>" . $self->_template_text('lastused') . "</b></td>");
 
-        for(my $i = 0; $i < 5; $i++) {
+        for(my $i = 0; $i < $self->{cfg}->{urlhistory}; $i++) {
             last unless $i < @sorturls;
             my $a = $i + 1;
             my $sorturl  = $sorturls[$i];