From: eldy <> Date: Mon, 6 Jan 2003 20:54:53 +0000 (+0000) Subject: Export tooltip features in a plugin (plugin tooltips disabled by default). X-Git-Tag: AWSTATS_5_4_BETA~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e49aacb6a511594ebf67b5d9e15f0741bb971ecb;p=thirdparty%2FAWStats.git Export tooltip features in a plugin (plugin tooltips disabled by default). --- diff --git a/docs/awstats_changelog.txt b/docs/awstats_changelog.txt index 56f9ee27..c441f0f9 100644 --- a/docs/awstats_changelog.txt +++ b/docs/awstats_changelog.txt @@ -17,6 +17,9 @@ New features/improvments: - Added urlaliasbuilder.pl tool. - Added URL in possible values for ExtraSection first column. - New parameter: URLWithAnchor (set to 0 by default). +- Export tooltip features in a plugin (plugin tooltips disabled by default). +- Added average session length in Visit Duration report. +- Added percentage in Visit Duration report. Other/Documentation: - Replaced -month=year option by -month=all. @@ -24,6 +27,7 @@ Other/Documentation: wrong file name. - GeoIP memory cache code is now stored inside plugin code. - Added list of loaded plugins in AWStats copyright string. +- Minor cosmetic change (remove ShowHeader parameter). - Updated documentation. Note 1: diff --git a/wwwroot/cgi-bin/awstats.model.conf b/wwwroot/cgi-bin/awstats.model.conf index 23361e53..60767d2c 100644 --- a/wwwroot/cgi-bin/awstats.model.conf +++ b/wwwroot/cgi-bin/awstats.model.conf @@ -943,6 +943,13 @@ color_x="C1B2E2" # Background color for number of exit pages (Default = "C1B2 # Uncomment LoadPlugin lines to enable a plugin after checking that perl # modules required by the plugin are installed. +# Plugin Tooltips: +# Add some tooltips help on HTML report pages. +# Note that enabled this kind of help will increased HTML report pages size, +# so server load and bandwidth. +# +#LoadPlugin="tooltips" + # Plugin: HashFiles # Perl modules required: Storable # AWStats DNS cache files are read/saved as native hash files. This increase diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl index 66ef583a..0b5fc7a2 100644 --- a/wwwroot/cgi-bin/awstats.pl +++ b/wwwroot/cgi-bin/awstats.pl @@ -230,7 +230,7 @@ use vars qw/ @_time_p = @_time_h = @_time_k = (); @fieldlib = @keylist = (); use vars qw/ -@SessionsRange @HostAliases @AllowAccessFromWebToFollowingAuthenticatedUsers +@SessionsRange %SessionsAverage @HostAliases @AllowAccessFromWebToFollowingAuthenticatedUsers @DefaultFile @SkipDNSLookupFor @SkipHosts @SkipUserAgents @SkipFiles @OnlyHosts @OnlyFiles @@ -242,6 +242,7 @@ use vars qw/ @PluginsToLoad /; @SessionsRange=('0s-30s','30s-2mn','2mn-5mn','5mn-15mn','15mn-30mn','30mn-1h','1h+'); +%SessionsAverage=('0s-30s',15,'30s-2mn',75,'2mn-5mn',210,'5mn-15mn',600,'15mn-30mn',1350,'30mn-1h',2700,'1h+',3600); @HostAliases=(); @AllowAccessFromWebToFollowingAuthenticatedUsers=(); @DefaultFile = @SkipDNSLookupFor = (); @@ -1312,6 +1313,7 @@ sub Read_Ref_Data { if ((@RobotsSearchIDOrder_list1+@RobotsSearchIDOrder_list2+@RobotsSearchIDOrder_list3) != scalar keys %RobotsHashIDLib) { error("Not same number of records of RobotsSearchIDOrder_listx (total is ".(@RobotsSearchIDOrder_list1+@RobotsSearchIDOrder_list2+@RobotsSearchIDOrder_list3)." entries) and RobotsHashIDLib (".(scalar keys %RobotsHashIDLib)." entries) in Robots database. Check your file ".$FilePath{"robots.pm"}); } } + #------------------------------------------------------------------------------ # Function: Get the messages for a specified language # Parameters: LanguageId @@ -1370,56 +1372,9 @@ sub Read_Language_Data { close(LANG); } -#------------------------------------------------------------------------------ -# Function: Get the tooltip texts for a specified language -# Parameters: LanguageId -# Input: $DirLang $DIR -# Output: Full tooltips text -# Return: None -#------------------------------------------------------------------------------ -sub Read_Language_Tooltip { - # Check lang files in common possible directories : - # Windows : "${DIR}lang" (lang in same dir than awstats.pl) - # Debian package : "/usr/share/awstats/lang" - # Other possible directories : "./lang" - my @PossibleLangDir=("$DirLang","${DIR}lang","/usr/share/awstats/lang","./lang"); - - my $FileLang=''; - foreach my $dir (@PossibleLangDir) { - my $searchdir=$dir; - if ($searchdir && (!($searchdir =~ /\/$/)) && (!($searchdir =~ /\\$/)) ) { $searchdir .= "/"; } - if (open(LANG,"${searchdir}awstats-tt-$_[0].txt")) { $FileLang="${searchdir}awstats-tt-$_[0].txt"; last; } - } - # If file not found, we try english - if (! $FileLang) { - foreach my $dir (@PossibleLangDir) { - my $searchdir=$dir; - if ($searchdir && (!($searchdir =~ /\/$/)) && (!($searchdir =~ /\\$/)) ) { $searchdir .= "/"; } - if (open(LANG,"${searchdir}awstats-tt-en.txt")) { $FileLang="${searchdir}awstats-tt-en.txt"; last; } - } - } - if ($Debug) { debug("Call to Read_Language_Tooltip [FileLang=\"$FileLang\"]"); } - if ($FileLang) { - my $aws_PROG=ucfirst($PROG); - my $aws_VisitTimeout = $VISITTIMEOUT/10000*60; - my $aws_NbOfRobots = scalar keys %RobotsHashIDLib; - my $aws_NbOfSearchEngines = scalar keys %SearchEnginesHashIDLib; - while () { - if ($_ =~ /\ +use strict;no strict "refs"; + + + +#----------------------------------------------------------------------------- +# PLUGIN VARIABLES +#----------------------------------------------------------------------------- +# <----- +# ENTER HERE THE MINIMUM AWSTATS VERSION REQUIRED BY YOUR PLUGIN +# AND THE NAME OF ALL FUNCTIONS THE PLUGIN MANAGE. +my $PluginNeedAWStatsVersion="5.4"; +my $PluginHooksFunctions="AddHTMLBodyHeader"; +# -----> + +# <----- +# IF YOUR PLUGIN NEED GLOBAL VARIABLES, THEY MUST BE DECLARED HERE. +use vars qw/ +/; +# -----> + + + +#----------------------------------------------------------------------------- +# PLUGIN FUNTION Init_pluginname +#----------------------------------------------------------------------------- +sub Init_tooltips { + my $InitParams=shift; + my $checkversion=&Check_Plugin_Version($PluginNeedAWStatsVersion); + + # <----- + # YOU CAN ENTER HERE CODE TO INIT PLUGIN GLOBAL VARIABLES + debug(" InitParams=$InitParams",1); + $TOOLTIPWIDTH=380; # Width of tooltips + # -----> + + return ($checkversion?$checkversion:"$PluginHooksFunctions"); +} + + + +#----------------------------------------------------------------------------- +# PLUGIN FUNTION AddHTMLBodyHeader_pluginname +# UNIQUE: NO (Only one function XXX can exists for all loaded plugins) +# AddHTMLBodyHeader is called to Add HTML code at beginning of BODY section. +#----------------------------------------------------------------------------- +sub AddHTMLBodyHeader_tooltips { + # <----- + if ($FrameName ne 'mainleft') { + # Get the tooltips texts + &Read_Language_Tooltip($Lang); + } + return 1; + # -----> +} + + +#------------------------------------------------------------------------------ +# Function: Get the tooltip texts for a specified language and write it +# Parameters: LanguageId +# Input: $DirLang $DIR +# Output: Full tooltips text +# Return: None +#------------------------------------------------------------------------------ +sub Read_Language_Tooltip { + # Check lang files in common possible directories : + # Windows : "${DIR}lang" (lang in same dir than awstats.pl) + # Debian package : "/usr/share/awstats/lang" + # Other possible directories : "./lang" + my @PossibleLangDir=("$DirLang","${DIR}lang","/usr/share/awstats/lang","./lang"); + + my $FileLang=''; + foreach my $dir (@PossibleLangDir) { + my $searchdir=$dir; + if ($searchdir && (!($searchdir =~ /\/$/)) && (!($searchdir =~ /\\$/)) ) { $searchdir .= "/"; } + if (open(LANG,"${searchdir}awstats-tt-$_[0].txt")) { $FileLang="${searchdir}awstats-tt-$_[0].txt"; last; } + } + # If file not found, we try english + if (! $FileLang) { + foreach my $dir (@PossibleLangDir) { + my $searchdir=$dir; + if ($searchdir && (!($searchdir =~ /\/$/)) && (!($searchdir =~ /\\$/)) ) { $searchdir .= "/"; } + if (open(LANG,"${searchdir}awstats-tt-en.txt")) { $FileLang="${searchdir}awstats-tt-en.txt"; last; } + } + } + if ($Debug) { debug("Call to Read_Language_Tooltip [FileLang=\"$FileLang\"]"); } + if ($FileLang) { + my $aws_PROG=ucfirst($PROG); + my $aws_VisitTimeout = $VISITTIMEOUT/10000*60; + my $aws_NbOfRobots = scalar keys %RobotsHashIDLib; + my $aws_NbOfSearchEngines = scalar keys %SearchEnginesHashIDLib; + while () { + if ($_ =~ /\