foreach my $key (keys %NoLoadPlugin) { if ($NoLoadPlugin{$key} < 0) { push @PluginsToLoad, $key; } }
if ($Debug) { debug("Call to Read_Plugins with list: ".join(',',@PluginsToLoad)); }
foreach my $plugininfo (@PluginsToLoad) {
- if ($NoLoadPlugin{$plugininfo} && $NoLoadPlugin{$plugininfo} > 0) {
- if ($Debug) { debug(" Plugin load for '$plugininfo' has been disabled from command line"); }
- next;
- }
my @loadplugin=split(/\s+/,$plugininfo,2);
my $pluginfile=$loadplugin[0]; $pluginfile =~ s/\.pm$//i;
+ # Check if we plugin is not disabled
+ if ($NoLoadPlugin{$pluginfile} && $NoLoadPlugin{$pluginfile} > 0) {
+ if ($Debug) { debug(" Plugin load for '$pluginfile' has been disabled from parameters"); }
+ next;
+ }
my $pluginparam=$loadplugin[1]||'';
$pluginfile =~ /([^\/\\]*)$/;
my $pluginname=$1;
# Allowed option
my @AllowedCLIArgs=('migrate','config',
'logfile','output','runascli','update',
-'staticlinks','staticlinksext','noloadplugin','forceloadplugin',
+'staticlinks','staticlinksext','noloadplugin','loadplugin',
'hostfilter','urlfilter','refererpagesfilter',
'lang','month','year','framename','debug',
'showsteps','showdropped','showcorrupted','showunknownorigin',
if ($QueryString =~ /(^|&)framename=([^&]+)/i) { $FrameName="$2"; }
if ($QueryString =~ /(^|&)debug=(\d+)/i) { $Debug=$2; }
if ($QueryString =~ /(^|&)updatefor=(\d+)/i) { $UpdateFor=$2; }
-if ($QueryString =~ /(^|&)noloadplugin=([^&]+)/i) { foreach (split(/,/,$2)) { $NoLoadPlugin{"$_"}=1; } }
-if ($QueryString =~ /(^|&)forceloadplugin=([^&]+)/i) { foreach (split(/,/,$2)) { $NoLoadPlugin{"$_"}=-1; } }
+if ($QueryString =~ /(^|&)noloadplugin=([^&]+)/i) { foreach (split(/,/,$2)) { $NoLoadPlugin{"$_"}=1; } }
+if ($QueryString =~ /(^|&)loadplugin=([^&]+)/i) { foreach (split(/,/,$2)) { $NoLoadPlugin{"$_"}=-1; } }
if ($QueryString =~ /(^|&)limitflush=(\d+)/i) { $LIMITFLUSH=$2; }
# Get/Define output
if ($QueryString =~ /(^|&)output(=[^&]*|)(.*)&output(=[^&]*|)(&|$)/i) { error("Only 1 output option is allowed","","",1); }
# Print AWStats and Perl version
if ($Debug) {
+ if ($ENV{'GATEWAY_INTERFACE'}) { print "\n"; } # To end the HTTP header and see all debug
debug(ucfirst($PROG)." - $VERSION - Perl $^X $]",1);
debug("QUERY_STRING=$QueryString",2);
debug("HTMLOutput=".join(',',keys %HTMLOutput),1);
my $PluginHooksFunctions="ShowGraph";
# ----->
+# <-----
+# IF YOUR PLUGIN NEED GLOBAL VARIABLES, THEY MUST BE DECLARED HERE.
+use vars qw/
+$DirClasses
+/;
+# ----->
#-----------------------------------------------------------------------------
# <-----
# ENTER HERE CODE TO DO INIT PLUGIN ACTIONS
+ $DirClasses=$InitParams;
# ----->
return ($checkversion?$checkversion:"$PluginHooksFunctions");
else { error("Unknown type parameter in ShowGraph_graphapplet function"); }
# print "<applet code=\"AWGraphApplet.class\" codebase=\"/classes\" width=\"$graphwidth\" height=\"$graphheight\">\n";
- print "<applet name=\"$type\" archive=\"awgraphapplet.jar\" code=\"AWGraphApplet.class\" codebase=\"/classes\" width=\"$graphwidth\" height=\"$graphheight\" alt= \"Your browser does not support Java correctly. Change browser or disable AWStats graphapplet plugin.\">\n";
+ 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";
print <<EOF;
<param name="title" value="$title" />
<param name="special" value="$type" />
<param name="barsize" value="$barsize" />
<param name="background_color" value="$color_Background" />
<param name="border_color" value="$color_Background" />
+<param name="special_color" value="$color_weekend" />
EOF
print "<param name=\"nbblocks\" value=\"".(scalar @$blocklabel)."\" />\n";
print "<param name=\"b_fontsize\" value=\"$blockfontsize\" />\n";
public AWGraphApplet()\r
{\r
special = "Not yet defined";
+ textVertSpacing = 0;\r
b_fontsize = 11;\r
blockSpacing = 5;\r
valSpacing = 0;\r
maxLabelWidth = 0;\r
background_color = Color.white;\r
border_color = Color.white;\r
+ special_color = Color.gray;\r
backgraph_colorl = Color.decode("#F6F6F6");\r
backgraph_colorm = Color.decode("#EDEDED");\r
backgraph_colorh = Color.decode("#E0E0E0");\r
if (s != null) { background_color = Color.decode("#"+s); }
s = getParameter("border_color");
if (s != null) { border_color = Color.decode("#"+s); }
+ s = getParameter("special_color");
+ if (s != null) { special_color = Color.decode("#"+s); }
Log("bblocks "+nbblocks);
Log("nbvalues "+nbvalues);
Log("barsize "+barsize);
- font = new Font("Verdana", 0, b_fontsize);\r
+ font = new Font("Verdana,Arial,Helvetica", 0, b_fontsize);\r
+ fontb = new Font("Verdana,Arial,Helvetica", Font.BOLD, b_fontsize);
fontmetrics = getFontMetrics(font);
blabels = new String[nbblocks];
{
// background and border
bfr.setColor(background_color);\r
- bfr.fillRect(0, 0, getSize().width - 1, getSize().height - 1);\r
+ bfr.fillRect(0, 0, getSize().width, getSize().height);\r
bfr.setColor(border_color);\r
- bfr.drawRect(0, 0, getSize().width - 1, getSize().height - 1);\r
+ bfr.drawRect(0, 0, getSize().width, getSize().height);\r
// draw the bars and their titles
if(orientation == HORIZONTAL) { paintHorizontal(bfr); }
private synchronized void paintVertical(Graphics g)
{
- Font font1 = new java.awt.Font("Verdana", 0, b_fontsize);
- FontMetrics fontmetrics = getFontMetrics(font1);
g.setColor(Color.black);
- g.setFont(font1);
+ g.setFont(font);
int shift=10;
int allbarwidth=(((nbvalues*(valWidth+valSpacing))+blockSpacing)*nbblocks);
int allbarheight=barsize;
int axepointx=(getSize().width-allbarwidth)/2 - 2*shift;
- int axepointy = getSize().height - (2*fontmetrics.getHeight()) - fontmetrics.getDescent();
+ int axepointy = getSize().height - (2*fontmetrics.getHeight()) - textVertSpacing;
int cx=axepointx;
int cy=axepointy;
// Draw the block label
// Log("Write block j="+j+" with cx="+cx);
- cy = getSize().height - fontmetrics.getHeight() - fontmetrics.getDescent();
+ cy = getSize().height - fontmetrics.getHeight() - textVertSpacing;
g.setColor(Color.black);
// Check if bold or highlight
- int bold=0; int highlight=0;
- if (blabels[j].indexOf(":")>0) { bold=1; blabels[j]=remove(blabels[j],":"); }
- if (blabels[j].indexOf("!")>0) { highlight=1; blabels[j]=remove(blabels[j],"!"); }
-
- String as[] = split(blabels[j], "\247", 0);\r
+ int bold=0; int highlight=0; String label=blabels[j];
+ if (blabels[j].indexOf(":")>0) { bold=1; label=remove(blabels[j],":"); }
+ if (blabels[j].indexOf("!")>0) { highlight=1; label=remove(blabels[j],"!"); }
+
+ if (bold==1) { g.setFont(fontb); }
+ String as[] = split(label, "\247", 0);\r
+ if (highlight==1) {
+ g.setColor(special_color);
+ g.fillRect(cx-Math.max(-1+blockSpacing>>1,0),cy-fontmetrics.getHeight(),(nbvalues*(valWidth+valSpacing))+Math.max(blockSpacing-2,0)+1,((fontmetrics.getHeight()+textVertSpacing)*as.length)+2);
+ g.setColor(Color.black);
+ }
for (int i=0; i<as.length; i++) {
- int cxoffset=((nbvalues*(valWidth+valSpacing))-fontmetrics.stringWidth(as[i]))>>1;
+ int cxoffset=((nbvalues*(valWidth+valSpacing))-fontmetrics.stringWidth(as[i]))>>1;
if (cxoffset<0) { cxoffset=0; }
- g.drawString(as[i], cx+cxoffset, cy);
- cy+=fontmetrics.getHeight()-2;
+ g.drawString(as[i], cx+cxoffset, cy);
+ cy+=fontmetrics.getHeight()+textVertSpacing;
}
+ if (bold==1) { g.setFont(font); }
// Loop on each value
for (int i = 0; i < nbvalues; i++) {
- cy = getSize().height - fontmetrics.getHeight() - fontmetrics.getDescent() - 4;
+ cy = getSize().height - fontmetrics.getHeight() - textVertSpacing - 4;
cy -= fontmetrics.getHeight() - 4;
// draw the shadow and bar
public synchronized String[][] getParameterInfo()
{
String[][] as = {
- {"version", "string", "AWGraphApplet 1.0"},
+ {"version", "string", "AWGraphApplet "+VERSION},
{"copyright", "string", "GPL"},
{"title", "string", title}
};
private static final int STRIPED = 1;
private static final int DEBUG = 3;
private static final int SHIFTBAR = 3;
- private static final String VERSION = "1.0";
+ private static final String VERSION = "1.1";
private String title;
private String special;
private Font font;
+ private Font fontb;
private FontMetrics fontmetrics;
private int orientation;
private int barsize;
private String blabels[];
private int b_fontsize;
private int blockSpacing;
+ private int textVertSpacing;
private int nbvalues;
private Color colors[];
private int maxLabelWidth;
private Color background_color;
private Color border_color;
+ private Color special_color;
private Color backgraph_colorl;
private Color backgraph_colorm;
private Color backgraph_colorh;