aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Hjemli2011-03-07 00:00:24 +0100
committerLars Hjemli2011-03-07 00:00:24 +0100
commit1b5c336cc99f01a0f8d6668cbfc9273f49a6be25 (patch)
treea0166791f437413d141c3415c5e2451be75411fb
parent962a24892feb9e3d69542bcf0a219dc14836e921 (diff)
downloadcgit-1b5c336cc99f01a0f8d6668cbfc9273f49a6be25.tar.gz
cgit-1b5c336cc99f01a0f8d6668cbfc9273f49a6be25.tar.bz2
cgit-1b5c336cc99f01a0f8d6668cbfc9273f49a6be25.zip
ui-stats.c: create a control panel for stat options
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r--ui-stats.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/ui-stats.c b/ui-stats.c
index 2a0c174..36e17d9 100644
--- a/ui-stats.c
+++ b/ui-stats.c
@@ -386,6 +386,33 @@ void cgit_show_stats(struct cgit_context *ctx)
386 top = ctx->qry.ofs; 386 top = ctx->qry.ofs;
387 if (!top) 387 if (!top)
388 top = 10; 388 top = 10;
389
390 html("<div class='cgit-panel'>");
391 html("<b>stat options</b>");
392 html("<form method='get' action=''>");
393 cgit_add_hidden_formfields(1, 0, "stats");
394 html("<table><tr><td colspan='2'/></tr>");
395 if (ctx->repo->max_stats > 1) {
396 html("<tr><td class='label'>Period:</td>");
397 html("<td class='ctrl'><select name='period' onchange='this.form.submit();'>");
398 for (i = 0; i < ctx->repo->max_stats; i++)
399 html_option(fmt("%c", periods[i].code),
400 periods[i].name, fmt("%c", period->code));
401 html("</select></td></tr>");
402 }
403 html("<tr><td class='label'>Authors:</td>");
404 html("<td class='ctrl'><select name='ofs' onchange='this.form.submit();'>");
405 html_intoption(10, "10", top);
406 html_intoption(25, "25", top);
407 html_intoption(50, "50", top);
408 html_intoption(100, "100", top);
409 html_intoption(-1, "all", top);
410 html("</select></td><tr>");
411 html("<tr><td/><td class='ctrl'>");
412 html("<noscript><input type='submit' value='Reload'/></noscript>");
413 html("</td></tr></table>");
414 html("</form>");
415 html("</div>");
389 htmlf("<h2>Commits per author per %s", period->name); 416 htmlf("<h2>Commits per author per %s", period->name);
390 if (ctx->qry.path) { 417 if (ctx->qry.path) {
391 html(" (path '"); 418 html(" (path '");
@@ -393,30 +420,6 @@ void cgit_show_stats(struct cgit_context *ctx)
393 html("')"); 420 html("')");
394 } 421 }
395 html("</h2>"); 422 html("</h2>");
396
397 html("<form method='get' action='' style='float: right; text-align: right;'>");
398 cgit_add_hidden_formfields(1, 0, "stats");
399 if (ctx->repo->max_stats > 1) {
400 html("Period: ");
401 html("<select name='period' onchange='this.form.submit();'>");
402 for (i = 0; i < ctx->repo->max_stats; i++)
403 htmlf("<option value='%c'%s>%s</option>",
404 periods[i].code,
405 period == &periods[i] ? " selected" : "",
406 periods[i].name);
407 html("</select><br/><br/>");
408 }
409 html("Authors: ");
410 html("");
411 html("<select name='ofs' onchange='this.form.submit();'>");
412 htmlf("<option value='10'%s>10</option>", top == 10 ? " selected" : "");
413 htmlf("<option value='25'%s>25</option>", top == 25 ? " selected" : "");
414 htmlf("<option value='50'%s>50</option>", top == 50 ? " selected" : "");
415 htmlf("<option value='100'%s>100</option>", top == 100 ? " selected" : "");
416 htmlf("<option value='-1'%s>All</option>", top == -1 ? " selected" : "");
417 html("</select>");
418 html("<noscript>&nbsp;&nbsp;<input type='submit' value='Reload'/></noscript>");
419 html("</form>");
420 print_authors(&authors, top, period); 423 print_authors(&authors, top, period);
421} 424}
422 425