Преглед изворни кода

Added 'show_activetimes' and 'show_bignumbers' options

Morten Brix Pedersen пре 25 година
родитељ
комит
f03426ad33
3 измењених фајлова са 37 додато и 24 уклоњено
  1. 6 0
      docs/CONFIG-README
  2. 2 0
      modules/Pisg.pm
  3. 29 24
      modules/Pisg/HTMLGenerator.pm

+ 6 - 0
docs/CONFIG-README

@@ -115,6 +115,12 @@ timeoffset          A time offset on the stats page - if your country has
                     are being generated, then for example set '+1' to add
                     one hour to the stats.
 
+show_activetimes    1 or 0, this enables/disables the 'Most Active Tiems'
+                    section, default is enabled.
+
+show_bignumbers     1 or 0, enable/disable 'Big Numbers' and 'Other
+                    interesting numbers', default is enabled.
+
 show_wpl            1 or 0, this enables pisg to show 'words per line' for
                     each person in 'most active nicks'
 

+ 2 - 0
modules/Pisg.pm

@@ -150,6 +150,8 @@ sub get_default_config_settings
 
         # Stats settings
 
+        show_activetimes => 1,
+        show_bignumbers => 1,
         show_linetime => 0,
         show_time => 1,
         show_words => 0,

+ 29 - 24
modules/Pisg/HTMLGenerator.pm

@@ -56,21 +56,25 @@ sub create_html
     $self->{cfg}->{headwidth} = $self->{cfg}->{tablewidth} - 4;
     $self->_htmlheader();
     $self->_pageheader();
-    $self->_activetimes();
+    if ($self->{cfg}->{show_activetimes}) {
+        $self->_activetimes();
+    }
     $self->_activenicks();
 
-    $self->_headline($self->_template_text('bignumtopic'));
-    _html("<table width=\"$self->{cfg}->{tablewidth}\">\n"); # Needed for sections
-    $self->_questions();
-    $self->_shoutpeople();
-    $self->_capspeople();
-    $self->_violent();
-    $self->_mostsmiles();
-    $self->_mostsad();
-    $self->_linelengths();
-    $self->_mostwords();
-    $self->_mostwordsperline();
-    _html("</table>"); # Needed for sections
+    if ($self->{cfg}->{show_bignumbers}) {
+        $self->_headline($self->_template_text('bignumtopic'));
+        _html("<table width=\"$self->{cfg}->{tablewidth}\">\n"); # Needed for sections
+        $self->_questions();
+        $self->_shoutpeople();
+        $self->_capspeople();
+        $self->_violent();
+        $self->_mostsmiles();
+        $self->_mostsad();
+        $self->_linelengths();
+        $self->_mostwords();
+        $self->_mostwordsperline();
+        _html("</table>"); # Needed for sections
+    }
 
     if ($self->{cfg}->{show_muw}) {
         $self->_mostusedword();
@@ -84,16 +88,18 @@ sub create_html
         $self->_mosturls();
     }
 
-    $self->_headline($self->_template_text('othernumtopic'));
-    _html("<table width=\"$self->{cfg}->{tablewidth}\">\n"); # Needed for sections
-    $self->_gotkicks();
-    $self->_mostkicks();
-    $self->_mostop();
-    $self->_mostactions();
-    $self->_mostmonologues();
-    $self->_mostjoins();
-    $self->_mostfoul();
-    _html("</table>"); # Needed for sections
+    if ($self->{cfg}->{show_bignumbers}) {
+        $self->_headline($self->_template_text('othernumtopic'));
+        _html("<table width=\"$self->{cfg}->{tablewidth}\">\n"); # Needed for sections
+        $self->_gotkicks();
+        $self->_mostkicks();
+        $self->_mostop();
+        $self->_mostactions();
+        $self->_mostmonologues();
+        $self->_mostjoins();
+        $self->_mostfoul();
+        _html("</table>"); # Needed for sections
+    }
 
     $self->_headline($self->_template_text('latesttopic'));
     _html("<table width=\"$self->{cfg}->{tablewidth}\">\n"); # Needed for sections
@@ -449,7 +455,6 @@ sub _activenicks
     my $remain = $self->{cfg}->{activenicks} + $toshow;
 
     unless ($toshow > $nicks) {
-        print "\ttest\n";
 
         _html("<br><b><i>" . $self->_template_text('nottop') . "</i></b><table><tr>");
         for (my $c = $self->{cfg}->{activenicks}; $c < $remain; $c++) {