]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Add an option to sort the topsites by time
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Sun, 28 Nov 2010 15:41:03 +0000 (15:41 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Sun, 28 Nov 2010 15:41:03 +0000 (15:41 +0000)
This option is not identical to the dynamic sort as it selects the top
sites from the entire list and only displays the requested number of
entries. Then the dynamic sort only offers to sort the truncated list.

ChangeLog
getconf.c
include/conf.h
sarg.conf
topsites.c

index eda38c6e00ec1972de632f9406c80871dc29b77a..f7c8c78317305f9ef6fb295eccd54a9f11376e1e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@ Nov-28-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.
 
 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 2640696bf52e1a04f0bbd27efabfc3518f59e255..3d08446f23d4d594b231d5b9558f373891872003 100644 (file)
--- a/getconf.c
+++ b/getconf.c
@@ -168,6 +168,7 @@ struct sort_list topsite_sort[]=
 {
    {"BYTES",TOPSITE_SORT_BYTES},
    {"CONNECT",TOPSITE_SORT_CONNECT},
+   {"TIME",TOPSITE_SORT_TIME},
 };
 
 struct sort_list user_sort[]=
index f3d4cb06e79a87da8c8cd861b8a4b0b99574f181..852212b85256ff9771d40b968b7a87aa9949cecf 100755 (executable)
@@ -255,6 +255,7 @@ int mkstemps(char *template, int suffixlen);
 #define TOPSITE_SORT_REVERSE SORT_REVERSE
 #define TOPSITE_SORT_BYTES   0x0002UL
 #define TOPSITE_SORT_CONNECT 0x0004UL
+#define TOPSITE_SORT_TIME    0x0008UL
 
 #define USER_SORT_REVERSE SORT_REVERSE
 #define USER_SORT_BYTES   0x0002UL
index 6164f06458fca1164ab84c4603aecbd666370ca8..a2a6220c22305179fe1cf329f5e4f7a758593976 100644 (file)
--- a/sarg.conf
+++ b/sarg.conf
 #
 #topsites_num 100
 
-# TAG: topsites_sort_order CONNECT|BYTES A|D
+# TAG: topsites_sort_order CONNECT|BYTES|TIME A|D
 #      Sort for topsites report, where A=Ascendent, D=Descendent
 #
 #topsites_sort_order CONNECT D
index 98d76ae99709591f0e4999b91d86902ba9e0e638..0ae966e56b0ba21d5ee847f14ee8a25390d95a56 100644 (file)
@@ -155,8 +155,12 @@ void topsites(void)
 
    if((TopsitesSort & TOPSITE_SORT_CONNECT) != 0) {
       sortf="-k 1,1 -k 2,2";
-   } else {
+   } else if((TopsitesSort & TOPSITE_SORT_BYTES) != 0) {
       sortf="-k 2,2 -k 1,1";
+   } else if((TopsitesSort & TOPSITE_SORT_TIME) != 0) {
+      sortf="-k 3,3";
+   } else {
+      sortf="-k 2,2 -k 1,1"; //default is BYTES
    }
    if((TopsitesSort & TOPSITE_SORT_REVERSE) != 0) {
       sortt="-r";