Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 297
- Log:
Updated to AWStats 7.0.
- Author:
- rool
- Date:
- Fri Mar 18 13:33:29 +0000 2011
- Size:
- 5105 Bytes
- Properties:
- Property svn:executable is set
1 | #!/usr/bin/perl |
2 | #----------------------------------------------------------------------------- |
3 | # GraphApplet AWStats plugin |
4 | # Allow AWStats to replace bar graphs with an Applet (awgraphapplet) that draw |
5 | # 3D graphs instead. |
6 | #----------------------------------------------------------------------------- |
7 | # Perl Required Modules: None |
8 | #----------------------------------------------------------------------------- |
9 | # $Revision: 1.10 $ - $Author: manolamancha $ - $Date: 2010/05/11 12:33:48 $ |
10 | |
11 | |
12 | # <----- |
13 | # ENTER HERE THE USE COMMAND FOR ALL REQUIRED PERL MODULES |
14 | # -----> |
15 | #use strict; |
16 | no strict "refs"; |
17 | |
18 | |
19 | |
20 | #----------------------------------------------------------------------------- |
21 | # PLUGIN VARIABLES |
22 | #----------------------------------------------------------------------------- |
23 | # <----- |
24 | # ENTER HERE THE MINIMUM AWSTATS VERSION REQUIRED BY YOUR PLUGIN |
25 | # AND THE NAME OF ALL FUNCTIONS THE PLUGIN MANAGE. |
26 | my $PluginNeedAWStatsVersion="6.0"; |
27 | my $PluginHooksFunctions="ShowGraph"; |
28 | # -----> |
29 | |
30 | # <----- |
31 | # IF YOUR PLUGIN NEED GLOBAL VARIABLES, THEY MUST BE DECLARED HERE. |
32 | use vars qw/ |
33 | $DirClasses |
34 | /; |
35 | # -----> |
36 | |
37 | |
38 | #----------------------------------------------------------------------------- |
39 | # PLUGIN FUNCTION: Init_pluginname |
40 | #----------------------------------------------------------------------------- |
41 | sub Init_graphapplet { |
42 | my $InitParams=shift; |
43 | my $checkversion=&Check_Plugin_Version($PluginNeedAWStatsVersion); |
44 | |
45 | # <----- |
46 | # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS |
47 | $DirClasses=$InitParams; |
48 | # -----> |
49 | |
50 | return ($checkversion?$checkversion:"$PluginHooksFunctions"); |
51 | } |
52 | |
53 | |
54 | #------------------------------------------------------- |
55 | # PLUGIN FUNCTION: ShowGraph_pluginname |
56 | # UNIQUE: YES (Only one plugin using this function can be loaded) |
57 | # Add the code for call to applet awgraphapplet |
58 | # Parameters: $title $type $showmonthstats \@blocklabel,\@vallabel,\@valcolor,\@valmax,\@valtotal |
59 | # Input: None |
60 | # Output: HTML code for awgraphapplet insertion |
61 | # Return: 0 OK, 1 Error |
62 | #------------------------------------------------------- |
63 | sub ShowGraph_graphapplet() { |
64 | my $title=shift; |
65 | my $type=shift; |
66 | my $showmonthstats=shift; |
67 | my $blocklabel=shift; |
68 | my $vallabel=shift; |
69 | my $valcolor=shift; |
70 | my $valmax=shift; |
71 | my $valtotal=shift; |
72 | my $valaverage=shift; |
73 | my $valdata=shift; |
74 | |
75 | my $graphwidth=780; |
76 | my $graphheight=400; |
77 | my $blockspacing=5; |
78 | my $valspacing=1; |
79 | my $valwidth=5; |
80 | my $barsize=0; |
81 | my $blockfontsize=11; |
82 | if ($type eq 'month') { $graphwidth=540; $graphheight=160; $blockspacing=8; $valspacing=0; $valwidth=6; $barsize=$BarHeight; $blockfontsize=11; } |
83 | elsif ($type eq 'daysofmonth') { $graphwidth=640; $graphheight=160; $blockspacing=3; $valspacing=0; $valwidth=4; $barsize=$BarHeight; $blockfontsize=9; } |
84 | elsif ($type eq 'daysofweek') { $graphwidth=300; $graphheight=160; $blockspacing=10; $valspacing=0; $valwidth=6; $barsize=$BarHeight; $blockfontsize=10; } |
85 | elsif ($type eq 'hours') { $graphwidth=600; $graphheight=160; $blockspacing=4; $valspacing=0; $valwidth=6; $barsize=$BarHeight; $blockfontsize=11; } |
86 | else { debug("Unknown type parameter in ShowGraph_graphapplet function: $type", 1); return 0; } |
87 | |
88 | # print "<applet code=\"AWGraphApplet.class\" codebase=\"/classes\" width=\"$graphwidth\" height=\"$graphheight\">\n"; |
89 | print "<applet name=\"$type\" archive=\"awgraphapplet.jar\" code=\"AWGraphApplet.class\" codebase=\"".($DirClasses||"/")."\" width=\"$graphwidth\" height=\"$graphheight\" alt= \"Your browser does not support Java correctly. Change browser or disable AWStats graphapplet plugin.\">\n"; |
90 | print <<EOF; |
91 | <param name="title" value="$title" /> |
92 | <param name="special" value="$type" /> |
93 | <param name="orientation" value="vertical" /> |
94 | <param name="barsize" value="$barsize" /> |
95 | <param name="background_color" value="$color_Background" /> |
96 | <param name="border_color" value="$color_Background" /> |
97 | <param name="special_color" value="$color_weekend" /> |
98 | EOF |
99 | print "<param name=\"nbblocks\" value=\"".(scalar @$blocklabel)."\" />\n"; |
100 | print "<param name=\"b_fontsize\" value=\"$blockfontsize\" />\n"; |
101 | foreach my $i (1..(scalar @$blocklabel)) { |
102 | print "<param name=\"b${i}_label\" value=\"".@$blocklabel[$i-1]."\" />\n"; |
103 | } |
104 | print "<param name=\"nbvalues\" value=\"".(scalar @$vallabel)."\" />\n"; |
105 | foreach my $i (1..(scalar @$vallabel)) { |
106 | print "<param name=\"v${i}_label\" value=\"".@$vallabel[$i-1]."\" />\n"; |
107 | print "<param name=\"v${i}_color\" value=\"".@$valcolor[$i-1]."\" />\n"; |
108 | print "<param name=\"v${i}_max\" value=\"".@$valmax[$i-1]."\" />\n"; |
109 | print "<param name=\"v${i}_total\" value=\"".@$valtotal[$i-1]."\" />\n"; |
110 | print "<param name=\"v${i}_average\" value=\"".@$valaverage[$i-1]."\" />\n"; |
111 | } |
112 | print <<EOF; |
113 | <param name="blockSpacing" value="$blockspacing" /> |
114 | <param name="valSpacing" value="$valspacing" /> |
115 | <param name="valwidth" value="$valwidth" /> |
116 | EOF |
117 | foreach my $j (1..(scalar @$blocklabel)) { |
118 | my $b=''; |
119 | foreach my $i (0..(scalar @$vallabel)-1) { $b.=@$valdata[($j-1)*(scalar @$vallabel)+$i]." "; } |
120 | $b=~s/\s$//; |
121 | print "<param name=\"b${j}\" value=\"$b\" />\n"; |
122 | } |
123 | print "</applet><br />\n"; |
124 | |
125 | return 0; |
126 | } |
127 | |
128 | |
129 | |
130 | 1; # Do not remove this line |