]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Add option to hide index column
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Tue, 21 Dec 2010 20:22:47 +0000 (20:22 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Tue, 21 Dec 2010 20:22:47 +0000 (20:22 +0000)
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
ChangeLog
getconf.c
include/conf.h
include/info.h
index.c
log.c
sarg.conf

index 5218ea208a99a8f7c644de68c3ff336b0a587e4a..13fa3159625c9da030289d8cfe6c1c63afc1a1d9 100755 (executable)
@@ -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)
index e8d418ef53f4827a4aa085466669be93cf071a94..18cf308f519ab7ca62b17357c53696cbee457f80 100644 (file)
--- 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.
index 8884f8bd4c9eab2914f51bee4e282ed23c85d13d..dc019f0a8eae3de45799d5221910fb54d8395aa4 100644 (file)
--- 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;
index 852212b85256ff9771d40b968b7a87aa9949cecf..7bb87dff1090b54e8b80e5fcb4c22a0e6482128d 100755 (executable)
@@ -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];
index d8f9144a0d07f31b9f860fc79beff4a106c9bbbd..1b0c7d2630dd26923426c65f0b3245ff730eb79d 100755 (executable)
@@ -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 c439b7c265ac52f405b979c80d120deb5b2e9b6d..a685f8ead40144597a0fdcb8a0adca6213d2bdd1 100644 (file)
--- 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("<div class=\"index\"><table cellpadding=\"1\" cellspacing=\"2\">\n<tr><td></td><td></td></tr>\n",fp_ou);
-       fprintf(fp_ou,"<tr><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th></tr>\n",_("YEAR"),_("SIZE"));
+       fputs("<div class=\"index\"><table cellpadding=\"1\" cellspacing=\"2\">\n",fp_ou);
+       fprintf(fp_ou,"<tr><th class=\"header_l\">%s</th>",_("YEAR"));
+       if (IndexFields & INDEXFIELDS_DIRSIZE)
+               fprintf(fp_ou,"<th class=\"header_l\">%s</th>",_("SIZE"));
+       fputs("</tr>\n",fp_ou);
        for (y=0 ; y<nyears ; y++) {
                if (order>0)
                        year=yearsort[y];
                else
                        year=yearsort[nyears-1-y];
                sprintf(yearnum,"%04d",year);
-               fprintf(fp_ou,"<tr><td class=\"data2\"><a href=\"%s/index.html\">%s</a></td><td class=\"data2\">%s</td></tr>\n",yearnum,yearnum,get_size(outdir,yearnum));
+               fprintf(fp_ou,"<tr><td class=\"data2\"><a href=\"%s/index.html\">%s</a></td>",yearnum,yearnum);
+               if (IndexFields & INDEXFIELDS_DIRSIZE)
+                       fprintf(fp_ou,"<td class=\"data2\">%s</td>",get_size(outdir,yearnum));
+               fputs("</tr>\n",fp_ou);
                sprintf(yeardir,"%s%s",outdir,yearnum);
                // Year dir
                nmonths=0;
diff --git a/log.c b/log.c
index 869dd1fde738516f8e335af120e1cda6ab454dd8..f25a850a6f6a0390177506a7d4b64469feba20eb 100644 (file)
--- 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;
index a2a6220c22305179fe1cf329f5e4f7a758593976..6d5a7876f660e3f4c8b6e582aa64986ac7188eda 100644 (file)
--- a/sarg.conf
+++ b/sarg.conf
 #
 #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