aboutsummaryrefslogtreecommitdiffstats
path: root/cgit.c
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2008-12-06 17:38:19 +0100
committerLars Hjemli <hjemli@gmail.com>2008-12-06 17:38:19 +0100
commitf86a23ff537258d36bf8f1876fa7a4bede6673d8 (patch)
tree8328d415416058cdc5b0fd2c6564ddcab5766c7a /cgit.c
parentCGIT 0.8.1 (diff)
downloadcgit-f86a23ff537258d36bf8f1876fa7a4bede6673d8.tar.xz
cgit-f86a23ff537258d36bf8f1876fa7a4bede6673d8.zip
Add a 'stats' page to each repo
This new page, which is disabled by default, can be used to print some statistics about the number of commits per period in the repository, where period can be either weeks, months, quarters or years. The function can be activated globally by setting 'enable-stats=1' in cgitrc and disabled for individual repos by setting 'repo.enable-stats=0'. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to '')
-rw-r--r--cgit.c6
-rw-r--r--cgit.css77
2 files changed, 83 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c
index c82587b..22b6d7c 100644
--- a/cgit.c
+++ b/cgit.c
@@ -54,6 +54,8 @@ void config_cb(const char *name, const char *value)
ctx.cfg.enable_log_filecount = atoi(value);
else if (!strcmp(name, "enable-log-linecount"))
ctx.cfg.enable_log_linecount = atoi(value);
+ else if (!strcmp(name, "enable-stats"))
+ ctx.cfg.enable_stats = atoi(value);
else if (!strcmp(name, "cache-size"))
ctx.cfg.cache_size = atoi(value);
else if (!strcmp(name, "cache-root"))
@@ -112,6 +114,8 @@ void config_cb(const char *name, const char *value)
ctx.repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value);
else if (ctx.repo && !strcmp(name, "repo.enable-log-linecount"))
ctx.repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value);
+ else if (ctx.repo && !strcmp(name, "repo.enable-stats"))
+ ctx.repo->enable_stats = ctx.cfg.enable_stats && atoi(value);
else if (ctx.repo && !strcmp(name, "repo.module-link"))
ctx.repo->module_link= xstrdup(value);
else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) {
@@ -154,6 +158,8 @@ static void querystring_cb(const char *name, const char *value)
ctx.qry.name = xstrdup(value);
} else if (!strcmp(name, "mimetype")) {
ctx.qry.mimetype = xstrdup(value);
+ } else if (!strcmp(name, "period")) {
+ ctx.qry.period = xstrdup(value);
}
}
diff --git a/cgit.css b/cgit.css
index a37d218..ef30fbf 100644
--- a/cgit.css
+++ b/cgit.css
@@ -456,3 +456,80 @@ div.footer {
font-size: 80%;
color: #ccc;
}
+table.stats {
+ border: solid 1px black;
+ border-collapse: collapse;
+}
+
+table.stats th {
+ text-align: left;
+ padding: 1px 0.5em;
+ background-color: #eee;
+ border: solid 1px black;
+}
+
+table.stats td {
+ text-align: right;
+ padding: 1px 0.5em;
+ border: solid 1px black;
+}
+
+table.stats td.total {
+ font-weight: bold;
+ text-align: left;
+}
+
+table.stats td.sum {
+ color: #c00;
+ font-weight: bold;
+/* background-color: #eee; */
+}
+
+table.stats td.left {
+ text-align: left;
+}
+
+table.vgraph {
+ border-collapse: separate;
+ border: solid 1px black;
+ height: 200px;
+}
+
+table.vgraph th {
+ background-color: #eee;
+ font-weight: bold;
+ border: solid 1px white;
+ padding: 1px 0.5em;
+}
+
+table.vgraph td {
+ vertical-align: bottom;
+ padding: 0px 10px;
+}
+
+table.vgraph div.bar {
+ background-color: #eee;
+}
+
+table.hgraph {
+ border: solid 1px black;
+ width: 800px;
+}
+
+table.hgraph th {
+ background-color: #eee;
+ font-weight: bold;
+ border: solid 1px black;
+ padding: 1px 0.5em;
+}
+
+table.hgraph td {
+ vertical-align: center;
+ padding: 2px 2px;
+}
+
+table.hgraph div.bar {
+ background-color: #eee;
+ height: 1em;
+}
+