Forráskód Böngészése

Tilføj nye templates til mouse-over (title)

Morten Brix Pedersen 24 éve
szülő
commit
5e2481f872
2 módosított fájl, 28 hozzáadás és 10 törlés
  1. 12 0
      lang.txt
  2. 16 10
      modules/Pisg/HTMLGenerator.pm

+ 12 - 0
lang.txt

@@ -146,6 +146,12 @@ today = "Today"
 pagetitle1 = "[:channel] @ [:network] stats by [:maintainer]"
 pagetitle2 = "Statistics generated on "
 pagetitle3 = "During this [:days]-day reporting period, a total of <b>[:nicks]</b> different nicks were represented on [:channel]."
+
+# Mouse-over titles
+pisghomepage = "Go to the pisg homepage"
+authorhomepage = "Go to the authors homepage"
+newwindow = "Open in new window:"
+mailto = "Mail to"
 </lang>
 
 ### German
@@ -399,6 +405,12 @@ today = "I dag"
 pagetitle1 = "[:channel] @ [:network] statistikker af [:maintainer]"
 pagetitle2 = "Statistikker genereret "
 pagetitle3 = "Igennem denne [:days]-dages periode, har der været <b>[:nicks]</b> forskellige nicks på [:channel]."
+
+# Mouse-over titles
+pisghomepage = "Gå til pisg hjemmesiden"
+authorhomepage = "Gå til forfatterens hjemmeside"
+newwindow = "Åben i nyt vindue:"
+mailto = "Mail til"
 </lang>
 
 ### French

+ 16 - 10
modules/Pisg/HTMLGenerator.pm

@@ -14,7 +14,7 @@ sub new
         cfg => $args{cfg},
         stats => $args{stats},
         users => $args{users},
-        tmps => $args{tmps}
+        tmps => $args{tmps},
     };
 
     # Import common functions in Pisg::Common
@@ -243,10 +243,12 @@ sub get_time
 sub _htmlfooter
 {
     my $self = shift;
+    my $pisg_hp = $self->_template_text('pisghomepage');
+    my $author_hp = $self->_template_text('authorhomepage');
     print OUTPUT <<HTML;
 <span class="small">
-Stats generated by <a href="http://pisg.sourceforge.net/" title="Go to the pisg homepage" class="background">pisg</a> v$self->{cfg}->{version}<br />
-pisg by <a href="http://www.wtf.dk/hp/" title="Go to the authors homepage" class="background">Morten Brix Pedersen</a> and others<br />
+Stats generated by <a href="http://pisg.sourceforge.net/" title="$pisg_hp" class="background">pisg</a> v$self->{cfg}->{version}<br />
+pisg by <a href="http://www.wtf.dk/hp/" title="$author_hp" class="background">Morten Brix Pedersen</a> and others<br />
 Stats generated in $self->{stats}->{processtime}
 </span>
 </div>
@@ -427,11 +429,11 @@ sub _activenicks
         }
 
         # Convert URLs and e-mail addys to links
-        $randomline = _replace_links($randomline);
+        $randomline = $self->_replace_links($randomline);
 
         # Add a link to the nick if there is any
         if ($self->{users}->{userlinks}{$nick}) {
-            $visiblenick = _replace_links($self->{users}->{userlinks}{$nick}, $nick);
+            $visiblenick = $self->_replace_links($self->{users}->{userlinks}{$nick}, $nick);
         }
 
         my $color = $self->generate_colors($c);
@@ -1304,7 +1306,7 @@ sub _lasttopics
             next if ($topic_seen{$topic});
             $topic_seen{$topic} = 1;
 
-            $topic = _replace_links($topic);
+            $topic = $self->_replace_links($topic);
             # Strip off the quotes (')
             $topic =~ s/^\'(.*)\'$/$1/;
 
@@ -1580,18 +1582,22 @@ sub _legend
 sub _replace_links
 {
     # Sub to replace urls and e-mail addys to links
+    my $self = shift;
     my $str = shift;
     my $nick = shift;
 
     # Regular expressions are taken from match_urls() and match_email() in
     # Common.pm
 
+    my $texturl = $self->_template_text("newwindow");
+    my $textmail = $self->_template_text("mailto");
+
     if ($nick) {
-        $str =~ s/(http|https|ftp|telnet|news)(:\/\/[-a-zA-Z0-9_\/~]+\.[-a-zA-Z0-9.,_~=:&amp;@%?#\/+]+)/<a href="$1$2" target="_blank" title="Open in new window: $1$2">$nick<\/a>/g;
-        $str =~ s/([-a-zA-Z0-9._]+@[-a-zA-Z0-9_]+\.[-a-zA-Z0-9._]+)/<a href="mailto:$1" title="Mail to $nick">$nick<\/a>/g;
+        $str =~ s/(http|https|ftp|telnet|news)(:\/\/[-a-zA-Z0-9_\/~]+\.[-a-zA-Z0-9.,_~=:&amp;@%?#\/+]+)/<a href="$1$2" target="_blank" title="$texturl $1$2">$nick<\/a>/g;
+        $str =~ s/([-a-zA-Z0-9._]+@[-a-zA-Z0-9_]+\.[-a-zA-Z0-9._]+)/<a href="mailto:$1" title="$textmail $nick">$nick<\/a>/g;
     } else {
-        $str =~ s/(http|https|ftp|telnet|news)(:\/\/[-a-zA-Z0-9_\/~]+\.[-a-zA-Z0-9.,_~=:&amp;@%?#\/+]+)/<a href="$1$2" target="_blank" title="Open in new window: $1$2">$1$2<\/a>/g;
-        $str =~ s/([-a-zA-Z0-9._]+@[-a-zA-Z0-9_]+\.[-a-zA-Z0-9._]+)/<a href="mailto:$1" title="Mail to $1">$1<\/a>/g;
+        $str =~ s/(http|https|ftp|telnet|news)(:\/\/[-a-zA-Z0-9_\/~]+\.[-a-zA-Z0-9.,_~=:&amp;@%?#\/+]+)/<a href="$1$2" target="_blank" title="$texturl $1$2">$1$2<\/a>/g;
+        $str =~ s/([-a-zA-Z0-9._]+@[-a-zA-Z0-9_]+\.[-a-zA-Z0-9._]+)/<a href="mailto:$1" title="$textmail $1">$1<\/a>/g;
     }
     return $str;
 }