From 9aaa3361935cd82b6d2ce6f03355dc8cd2644256 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Marchal?= Date: Tue, 21 Dec 2010 20:22:47 +0000 Subject: [PATCH] Add option to hide index column The directory size column of the index sorted by date can be hidden with the new index_fields option in sarg.conf. This option is added because it was reported that the computing of the directory size may be very slow. See the feature request: http://sourceforge.net/tracker/index.php?func=detail&aid=3141177&group_id=68910&atid=522794 --- CMakeLists.txt | 2 +- ChangeLog | 3 ++- getconf.c | 7 +++++++ include/conf.h | 5 +++++ include/info.h | 2 +- index.c | 12 +++++++++--- log.c | 1 + sarg.conf | 6 ++++++ 8 files changed, 32 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5218ea2..13fa315 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ PROJECT(sarg C) SET(sarg_VERSION 2) SET(sarg_REVISION "3.2-pre1") SET(sarg_BUILD "") -SET(sarg_BUILDDATE "Nov-29-2010") +SET(sarg_BUILDDATE "Dec-21-2010") INCLUDE(AddFileDependencies) INCLUDE(CheckIncludeFile) diff --git a/ChangeLog b/ChangeLog index e8d418e..18cf308 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,12 @@ SARG ChangeLog -Nov-29-2010 Version 2.3.2-pre1 +Dec-21-2010 Version 2.3.2-pre1 - Add support for sorttable.js (http://www.kryogenix.org/code/browser/sorttable/) to dynamically sort some tables (thanks to Éric). - Add the two command line options --lastlog and --keeplogs to set the number of reports to keep or to keep all the reports respectively (thanks to Emmanuel Lacour for the suggestion). - Report the user ID in the e-mail report. - Add an option to sort the top sites by time. - Delete unused files from the directory containing the user report (thanks to alf-man). + - Add the index_fields option to hide the directory size column in the index sorted by date. Sep-18-2010 Version 2.3.1 - Remove the distinct printf for the alpha architecture as it doesn't work anymore and is not necessary anyway. diff --git a/getconf.c b/getconf.c index 8884f8b..dc019f0 100644 --- a/getconf.c +++ b/getconf.c @@ -119,6 +119,11 @@ static struct param_list index_tree_values[]= {"file",INDEX_TREE_FILE,~INDEX_TREE_FILE}, }; +static struct param_list indexfields_values[]= +{ + {"DIRSIZE",INDEXFIELDS_DIRSIZE,0}, +}; + static struct param_list ntml_userformat_values[]= { {"user",NTLMUSERFORMAT_USER,~NTLMUSERFORMAT_USER}, @@ -545,6 +550,8 @@ static void parmtest(char *buf) if (getparam_list("index",SET_LIST(index_values),buf,&Index)>0) return; + if (getparam_list("index_fields",SET_LIST(indexfields_values),buf,&IndexFields)>0) return; + if (getparam_bool("overwrite_report",buf,&OverwriteReport)>0) return; if (getparam_list("records_without_userid",SET_LIST(recnouser_values),buf,&RecordsWithoutUser)>0) return; diff --git a/include/conf.h b/include/conf.h index 852212b..7bb87df 100755 --- a/include/conf.h +++ b/include/conf.h @@ -225,6 +225,8 @@ int mkstemps(char *template, int suffixlen); #define INDEX_TREE_DATE 0x0001UL #define INDEX_TREE_FILE 0x0002UL +#define INDEXFIELDS_DIRSIZE 0x0001UL + #define NTLMUSERFORMAT_USER 0x0001UL #define NTLMUSERFORMAT_DOMAINUSER 0x0002UL @@ -382,7 +384,10 @@ char wwwDocumentRoot[MAXLEN]; char ExternalCSSFile[MAXLEN]; char BlockIt[255]; unsigned long int NtlmUserFormat; +//! How to display the index of the reports. unsigned long int IndexTree; +//! The columns to show in the index of the reports. +unsigned long int IndexFields; bool UserAuthentication; char AuthUserTemplateFile[1024]; char val1[MAXLEN]; diff --git a/include/info.h b/include/info.h index d8f9144..1b0c7d2 100755 --- a/include/info.h +++ b/include/info.h @@ -1,3 +1,3 @@ -#define VERSION PACKAGE_VERSION" Nov-29-2010" +#define VERSION PACKAGE_VERSION" Dec-21-2010" #define PGM PACKAGE_NAME #define URL "http://sarg.sourceforge.net" diff --git a/index.c b/index.c index c439b7c..a685f8e 100644 --- a/index.c +++ b/index.c @@ -140,15 +140,21 @@ static void make_date_index(void) } write_html_header(fp_ou,0,ngettext("SARG report","SARG reports",nyears),HTML_JS_NONE); close_html_header(fp_ou); - fputs("
\n\n",fp_ou); - fprintf(fp_ou,"\n",_("YEAR"),_("SIZE")); + fputs("
%s%s
\n",fp_ou); + fprintf(fp_ou,"",_("YEAR")); + if (IndexFields & INDEXFIELDS_DIRSIZE) + fprintf(fp_ou,"",_("SIZE")); + fputs("\n",fp_ou); for (y=0 ; y0) year=yearsort[y]; else year=yearsort[nyears-1-y]; sprintf(yearnum,"%04d",year); - fprintf(fp_ou,"\n",yearnum,yearnum,get_size(outdir,yearnum)); + fprintf(fp_ou,"",yearnum,yearnum); + if (IndexFields & INDEXFIELDS_DIRSIZE) + fprintf(fp_ou,"",get_size(outdir,yearnum)); + fputs("\n",fp_ou); sprintf(yeardir,"%s%s",outdir,yearnum); // Year dir nmonths=0; diff --git a/log.c b/log.c index 869dd1f..f25a850 100644 --- a/log.c +++ b/log.c @@ -277,6 +277,7 @@ int main(int argc,char *argv[]) strcpy(Ulimit,"20000"); NtlmUserFormat=NTLMUSERFORMAT_DOMAINUSER; IndexTree=INDEX_TREE_FILE; + IndexFields=INDEXFIELDS_DIRSIZE; strcpy(RealtimeTypes,"GET,PUT,CONNECT"); RealtimeUnauthRec=REALTIME_UNAUTH_REC_SHOW; RedirectorFilterOutDate=true; diff --git a/sarg.conf b/sarg.conf index a2a6220..6d5a787 100644 --- a/sarg.conf +++ b/sarg.conf @@ -202,6 +202,12 @@ # #index_tree file +# TAG: index_fields +# The columns to show in the index of the reports +# Columns are: dirsize +# +#index_fields dirsize + # TAG: overwrite_report yes|no # yes - if report date already exist then will be overwrited. # no - if report date already exist then will be renamed to filename.n, filename.n+1 -- 2.39.5
%s%s
%s%s
%s%s