about summary refs log tree commit diff
path: root/cgit.c
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2009-01-27 20:16:37 +0100
committerLars Hjemli <hjemli@gmail.com>2009-01-27 20:16:37 +0100
commit7710178e45dee61e85ea77c4221309ce8c086f95 (patch)
tree281c5251777308f18c05d323183b28470445f4bc /cgit.c
parentMerge branch 'stable' (diff)
parentui-stats.c: reuse cgit_add_hidden_formfields() (diff)
downloadcgit-pink-7710178e45dee61e85ea77c4221309ce8c086f95.tar.gz
cgit-pink-7710178e45dee61e85ea77c4221309ce8c086f95.zip
Merge branch 'lh/stats'
Conflicts:
	cgit.c
	cgit.css
	cgit.h
	ui-tree.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to '')
-rw-r--r--cgit.c8
-rw-r--r--cgit.css76
2 files changed, 84 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c
index f35f605..608cab6 100644
--- a/cgit.c
+++ b/cgit.c
@@ -12,6 +12,7 @@
 #include "configfile.h"
 #include "html.h"
 #include "ui-shared.h"
+#include "ui-stats.h"
 #include "scan-tree.h"
 
 const char *cgit_version = CGIT_VERSION;
@@ -54,6 +55,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, "max-stats"))
+		ctx.cfg.max_stats = cgit_find_stats_period(value, NULL);
 	else if (!strcmp(name, "cache-size"))
 		ctx.cfg.cache_size = atoi(value);
 	else if (!strcmp(name, "cache-root"))
@@ -112,6 +115,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.max-stats"))
+		ctx.repo->max_stats = cgit_find_stats_period(value, NULL);
 	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) {
@@ -158,6 +163,8 @@ static void querystring_cb(const char *name, const char *value)
 		ctx.qry.sort = xstrdup(value);
 	} else if (!strcmp(name, "showmsg")) {
 		ctx.qry.showmsg = atoi(value);
+	} else if (!strcmp(name, "period")) {
+		ctx.qry.period = xstrdup(value);
 	}
 }
 
@@ -181,6 +188,7 @@ static void prepare_context(struct cgit_context *ctx)
 	ctx->cfg.max_lock_attempts = 5;
 	ctx->cfg.max_msg_len = 80;
 	ctx->cfg.max_repodesc_len = 80;
+	ctx->cfg.max_stats = 0;
 	ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s";
 	ctx->cfg.renamelimit = -1;
 	ctx->cfg.robots = "index, nofollow";
diff --git a/cgit.css b/cgit.css
index f19446d..e8214de 100644
--- a/cgit.css
+++ b/cgit.css
@@ -495,3 +495,79 @@ a.deco {
 	background-color: #ff8888;
 	border: solid 1px #770000;
 }
+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;
+}