Index: trunk/wikistats/squids/SquidReportArchive.pl |
— | — | @@ -2836,9 +2836,9 @@ |
2837 | 2837 | if ($mimetype2 =~ /image\/(?:png|jpeg|gif)/) |
2838 | 2838 | { $mimetype2 .= "<br><small>(img)</small> " ; } |
2839 | 2839 | if ($columns == 1) |
2840 | | - { $mimetype2 = "<font color=#008000>$mimetype2</font" ; } |
| 2840 | + { $mimetype2 = "<font color=#008000>$mimetype2</font>" ; } |
2841 | 2841 | if (($columns >= 2) && ($columns <= 4)) |
2842 | | - { $mimetype2 = "<font color=#900000>$mimetype2</font" ; } |
| 2842 | + { $mimetype2 = "<font color=#900000>$mimetype2</font>" ; } |
2843 | 2843 | ($mime1,$mime2) = split ('\/', $mimetype2, 2) ; |
2844 | 2844 | $header2 .= "<th class=c>$mime1<br>$mime2</th>\n" ; |
2845 | 2845 | } |
— | — | @@ -2856,10 +2856,8 @@ |
2857 | 2857 | $total = &FormatCount ($total) ; |
2858 | 2858 | $total_images = $images_domain {$domain} ; |
2859 | 2859 | $total_images1 += $total_images ; |
2860 | | - $total_images = &FormatCount ($total_images) ; |
2861 | | - $total_images = "<font color=#900000>" . &FormatCount ($total_images) . "</font>" ; |
2862 | 2860 | |
2863 | | - $html .= &ShowCountBold ($total) . &ShowCountBold ($total_images) . "\n" ; |
| 2861 | + $html .= &ShowCountBold ($total) . &ShowCountBold ($total_images,"#900000") . "\n" ; |
2864 | 2862 | $columns = 0 ; |
2865 | 2863 | foreach $mimetype (@mimetypes_sorted) |
2866 | 2864 | { |
— | — | @@ -2869,12 +2867,11 @@ |
2870 | 2868 | |
2871 | 2869 | $count = &FormatCount ($counts_dm {"$domain,$mimetype"}) ; |
2872 | 2870 | if ($columns == 1) |
2873 | | - { $count = "<font color=#008000>$count</font" ; } |
2874 | | - if (($columns >= 2) && ($columns <= 4)) |
2875 | | - { $count = "<font color=#900000>$count</font" ; } |
2876 | | - if ($count eq "") |
2877 | | - { $count = " " ; } |
2878 | | - $html .= &ShowCount ($count) . "\n" ; |
| 2871 | + { $html .= &ShowCount ($count,"#008000") . "\n" ; } |
| 2872 | + elsif (($columns >= 2) && ($columns <= 4)) |
| 2873 | + { $html .= &ShowCount ($count,"#900000") . "\n" ; } |
| 2874 | + else |
| 2875 | + { $html .= &ShowCount ($count) . "\n" ; } |
2879 | 2876 | } |
2880 | 2877 | $html .= "</tr>\n" ; |
2881 | 2878 | $rows++ ; |
— | — | @@ -2888,8 +2885,7 @@ |
2889 | 2886 | |
2890 | 2887 | $total_mimes1 = &FormatCount ($total_mimes) ; |
2891 | 2888 | $total_images1 = &FormatCount ($total_images1) ; |
2892 | | - $total_images1 = "<font color=#900000>" . &FormatCount ($total_images1) . "</font>" ; |
2893 | | - $html .= "<tr><th colspan=2 class=l>Total</th>" . &ShowCountBold ($total_mimes1) . &ShowCountBold ($total_images1) . "\n" ; |
| 2889 | + $html .= "<tr><th colspan=2 class=l>Total</th>" . &ShowCountBold ($total_mimes1) . &ShowCountBold ($total_images1,"#900000") . "\n" ; |
2894 | 2890 | $columns = 0 ; |
2895 | 2891 | foreach $mimetype (@mimetypes_sorted) |
2896 | 2892 | { |
— | — | @@ -2899,10 +2895,11 @@ |
2900 | 2896 | |
2901 | 2897 | $count = &FormatCount ($mimetypes {$mimetype}) ; |
2902 | 2898 | if ($columns == 1) |
2903 | | - { $count = "<font color=#008000>$count</font" ; } |
| 2899 | + { $html .= &ShowCountBold ($count,"#008000") . "\n" ; } |
2904 | 2900 | if (($columns >= 2) && ($columns <= 4)) |
2905 | | - { $count = "<font color=#900000>$count</font" ; } |
2906 | | - $html .= &ShowCountBold ($count) . "\n" ; |
| 2901 | + { $html .= &ShowCountBold ($count,"#900000") . "\n" ; } |
| 2902 | + else |
| 2903 | + { $html .= &ShowCountBold ($count) . "\n" ; } |
2907 | 2904 | } |
2908 | 2905 | $html .= "</tr>\n" ; |
2909 | 2906 | |
— | — | @@ -2925,9 +2922,8 @@ |
2926 | 2923 | $html .= "<tr><td class=l>" . ucfirst($domain) . "</td><td class=l>$language</td>\n" ; |
2927 | 2924 | |
2928 | 2925 | $total = &FormatCount ($total) ; |
2929 | | - $total_images = $images_project {$project} ; |
2930 | | - $total_images = "<font color=#900000>" . &FormatCount ($total_images) . "</font>" ; |
2931 | | - $html .= &ShowCountBold ($total) . &ShowCountBold ($total_images) . "\n" ; |
| 2926 | + $total_images = &FormatCount ($images_project {$project}) ; |
| 2927 | + $html .= &ShowCountBold ($total) . &ShowCountBold ($total_images,"#900000") . "\n" ; |
2932 | 2928 | |
2933 | 2929 | $columns = 0 ; |
2934 | 2930 | foreach $mimetype (@mimetypes_sorted) |
— | — | @@ -2938,12 +2934,11 @@ |
2939 | 2935 | |
2940 | 2936 | $count = &FormatCount ($counts_pm {"$project,$mimetype"}) ; |
2941 | 2937 | if ($columns == 1) |
2942 | | - { $count = "<font color=#008000>$count</font" ; } |
| 2938 | + { $html .= &ShowCount ($count,"#008000") ; } |
2943 | 2939 | if (($columns >= 2) && ($columns <= 4)) |
2944 | | - { $count = "<font color=#900000>$count</font" ; } |
2945 | | -# if ($count eq "") |
2946 | | -# { $count = " " ; } |
2947 | | - $html .= &ShowCount ($count) . "\n" ; |
| 2940 | + { $html .= &ShowCount ($count,"#900000") ; } |
| 2941 | + else |
| 2942 | + { $html .= &ShowCount ($count) . "\n" ; } |
2948 | 2943 | } |
2949 | 2944 | $html .= "</tr>\n" ; |
2950 | 2945 | $rows++ ; |
— | — | @@ -4672,7 +4667,7 @@ |
4673 | 4668 | # $html .= "<tr>" . |
4674 | 4669 | # # "<td class=hc><b>${MPVE}'s<br>Per<br>I U</b></td>" . |
4675 | 4670 | # "<td colspan=99 class=hc><b>Share in Global Monthly $views_edits</b><br><small><font color=#808080>red and blue bars have different scale</font></small></td></tr>\n" ; |
4676 | | - $html .= "<tr><td class=hr><b>Country</b></td><td class=hc><b>Region</b><br><img src='http://stats.wikimedia.org/Location_of_Continents2.gif'></td><td class=hc><b>N/S</b></td><td class=hc colspan=2><small><font color=#404040>absolute count and edits per internet user</font></small></td><td class=hl colspan=2><small>share of global total<font color=#808080><p>note:blue and red bars have different scale</font></small></td></tr>\n" ; |
| 4671 | + $html .= "<tr><td class=hr><b>Country</b></td><td class=hc><b>Region</b><br><img src='http://stats.wikimedia.org/Location_of_Continents2.gif'></td><td class=hc><b>N/S</b></td><td class=hc colspan=2><small><font color=#404040>absolute count and monthly ${views_edits}s per internet user</font></small></td><td class=hl colspan=2><small>share of global total<font color=#808080><p>note:blue and red bars have different scale</font></small></td></tr>\n" ; |
4677 | 4672 | $html .= "<tr><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th colspan=2> </th></tr>\n" ; |
4678 | 4673 | $html .= "</thead><tbody>\nTOTAL\nREGIONS\n" ; |
4679 | 4674 | |
— | — | @@ -5563,7 +5558,7 @@ |
5564 | 5559 | |
5565 | 5560 | $perc =~ s/(\.\d)0/$1/ ; # 0.10% -> 0.1% |
5566 | 5561 | if ($show_logcount && ($requests_this_language < 5 * $months_recently)) # show in grey to discuss threshold on foundation-l |
5567 | | - { $perc = "<font color=#800000>$perc</font" ; } |
| 5562 | + { $perc = "<font color=#800000>$perc</font>" ; } |
5568 | 5563 | |
5569 | 5564 | $html .= "<tr><th class=l class=small nowrap>$language</th>" . |
5570 | 5565 | ($show_logcount ? "<td class=r>$requests_this_language</td>" : "") . |
— | — | @@ -5777,7 +5772,7 @@ |
5778 | 5773 | { |
5779 | 5774 | my $count = shift ; |
5780 | 5775 | if ($count eq "") |
5781 | | - { return (" ") ; } |
| 5776 | + { return ("0") ; } |
5782 | 5777 | if ($count < 1) |
5783 | 5778 | { return ("1") ; } |
5784 | 5779 | $count =~ s/^(\d{1,3})(\d\d\d)$/$1,$2/ ; |
— | — | @@ -5788,26 +5783,31 @@ |
5789 | 5784 | |
5790 | 5785 | sub ShowCount # qqq2 |
5791 | 5786 | { |
5792 | | - my ($num) = @_ ; |
| 5787 | + my ($num,$color) = @_ ; |
5793 | 5788 | $num =~ s/,//g ; |
5794 | 5789 | |
5795 | | - if ($num eq ' ') # to do: remove 's from perl code, send 0 instead, formatting in javascript |
5796 | | - { $num = 0 ; } |
| 5790 | + if (($num eq ' ') || ($num == 0))# to do: remove 's from perl code, send 0 instead, formatting in javascript |
| 5791 | + { $num = '-' ; } |
| 5792 | + else |
| 5793 | + { |
| 5794 | + if ($num =~ /^[\d\.]+$/) # numeric string |
| 5795 | + { $num *= 1000 ; } |
5797 | 5796 | |
5798 | | - if ($num =~ /^[\d\.]+$/) # numeric string |
5799 | | - { $num *= 1000 ; } |
| 5797 | + if ($num =~ /\D/) # contains non-digit ? enclose in double quotes |
| 5798 | + { $num ="\"$num\"" ; } |
5800 | 5799 | |
5801 | | - if ($num =~ /\D/) # contains non-digit ? enclose in double quotes |
5802 | | - { $num ="\"$num\"" ; } |
5803 | | - |
5804 | | - $num = "<script>showCount($num);</script>" ; |
5805 | | - return ("<td class=r>$num</td>") ; |
| 5800 | + $num = "<script>showCount($num);</script>" ; |
| 5801 | + } |
| 5802 | + if ($color eq '') |
| 5803 | + { return ("<td class=r>$num</td>") ; } |
| 5804 | + else |
| 5805 | + { return ("<td class=r><font color=$color>$num</font></td>") ; } |
5806 | 5806 | } |
5807 | 5807 | |
5808 | 5808 | sub ShowCountBold |
5809 | 5809 | { |
5810 | | - my ($num) = @_ ; |
5811 | | - $num = &ShowCount ($num) ; |
| 5810 | + my ($num,$color) = @_ ; |
| 5811 | + $num = &ShowCount ($num,$color) ; |
5812 | 5812 | $num =~ s/td/th/g ; |
5813 | 5813 | return ($num) ; |
5814 | 5814 | } |