From 1a64fd2f83affda41fb9903b7c299d35170bfc05 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sun, 6 Mar 2011 23:57:26 +0100 Subject: html.c: add html_intoption() This is similar to html_option, but for int values. Signed-off-by: Lars Hjemli diff --git a/html.c b/html.c index a60bc13..ae1cef9 100644 --- a/html.c +++ b/html.c @@ -211,6 +211,14 @@ void html_option(const char *value, const char *text, const char *selected_value html("\n"); } +void html_intoption(int value, const char *text, int selected_value) +{ + htmlf(""); +} + void html_link_open(const char *url, const char *title, const char *class) { html("\n"); html("author"); html_txt(info->author); @@ -64,11 +65,6 @@ void cgit_print_commit(char *hex, const char *prefix) cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, prefix, 0); html(" ("); cgit_patch_link("patch", NULL, NULL, NULL, tmp, prefix); - html(") ("); - if ((ctx.qry.ssdiff && !ctx.cfg.ssdiff) || (!ctx.qry.ssdiff && ctx.cfg.ssdiff)) - cgit_commit_link("unidiff", NULL, NULL, ctx.qry.head, tmp, prefix, 1); - else - cgit_commit_link("side-by-side diff", NULL, NULL, ctx.qry.head, tmp, prefix, 1); html(")\n"); html("tree"); tmp = xstrdup(hex); @@ -139,7 +135,7 @@ void cgit_print_commit(char *hex, const char *prefix) tmp = sha1_to_hex(commit->parents->item->object.sha1); else tmp = NULL; - cgit_print_diff(ctx.qry.sha1, tmp, prefix); + cgit_print_diff(ctx.qry.sha1, tmp, prefix, 0); } strbuf_release(¬es); cgit_free_commitinfo(info); diff --git a/ui-diff.c b/ui-diff.c index a7bc667..b7767b3 100644 --- a/ui-diff.c +++ b/ui-diff.c @@ -167,7 +167,7 @@ static void inspect_filepair(struct diff_filepair *pair) void cgit_print_diffstat(const unsigned char *old_sha1, const unsigned char *new_sha1, const char *prefix) { - int i, save_context = ctx.qry.context; + int i; html("
"); cgit_diff_link("Diffstat", NULL, NULL, ctx.qry.head, ctx.qry.sha1, @@ -177,19 +177,6 @@ void cgit_print_diffstat(const unsigned char *old_sha1, html_txt(prefix); html("')"); } - html(" ("); - ctx.qry.context = (save_context > 0 ? save_context : 3) << 1; - cgit_self_link("more", NULL, NULL, &ctx); - html("/"); - ctx.qry.context = (save_context > 3 ? save_context : 3) >> 1; - cgit_self_link("less", NULL, NULL, &ctx); - ctx.qry.context = save_context; - html(" context)"); - html(" ("); - ctx.qry.ignorews = (ctx.qry.ignorews + 1) % 2; - cgit_self_link(ctx.qry.ignorews ? "ignore" : "show", NULL, NULL, &ctx); - ctx.qry.ignorews = (ctx.qry.ignorews + 1) % 2; - html(" whitespace changes)"); html("
"); html(""); max_changes = 0; @@ -278,19 +265,6 @@ static void header(unsigned char *sha1, char *path1, int mode1, html(""); } -static void print_ssdiff_link() -{ - if (!strcmp(ctx.qry.page, "diff")) { - if (use_ssdiff) - cgit_diff_link("Unidiff", NULL, NULL, ctx.qry.head, - ctx.qry.sha1, ctx.qry.sha2, ctx.qry.path, 1); - else - cgit_diff_link("Side-by-side diff", NULL, NULL, - ctx.qry.head, ctx.qry.sha1, - ctx.qry.sha2, ctx.qry.path, 1); - } -} - static void filepair_cb(struct diff_filepair *pair) { unsigned long old_size = 0; @@ -330,7 +304,56 @@ static void filepair_cb(struct diff_filepair *pair) cgit_ssdiff_footer(); } -void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefix) +void cgit_print_diff_ctrls() +{ + int i, curr; + + html("
"); + html("diff options"); + html("
"); + cgit_add_hidden_formfields(1, 0, ctx.qry.page); + html("
"); + html(""); + html(""); + html(""); + html(""); + html(""); + html(""); + html(""); + html(""); + html(""); + html(""); + html("
context:"); + html(""); + html("
space:"); + html(""); + html("
mode:"); + html("
"); + html(""); + html("
"); + html(""); + html(""); +} + +void cgit_print_diff(const char *new_rev, const char *old_rev, + const char *prefix, int show_ctrls) { enum object_type type; unsigned long size; @@ -369,7 +392,9 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefi if ((ctx.qry.ssdiff && !ctx.cfg.ssdiff) || (!ctx.qry.ssdiff && ctx.cfg.ssdiff)) use_ssdiff = 1; - print_ssdiff_link(); + if (show_ctrls) + cgit_print_diff_ctrls(); + cgit_print_diffstat(old_rev_sha1, new_rev_sha1, prefix); if (use_ssdiff) { diff --git a/ui-diff.h b/ui-diff.h index 12d0c62..0161ffb 100644 --- a/ui-diff.h +++ b/ui-diff.h @@ -1,11 +1,13 @@ #ifndef UI_DIFF_H #define UI_DIFF_H +extern void cgit_print_diff_ctrls(); + extern void cgit_print_diffstat(const unsigned char *old_sha1, const unsigned char *new_sha1); extern void cgit_print_diff(const char *new_hex, const char *old_hex, - const char *prefix); + const char *prefix, int show_ctrls); extern struct diff_filespec *cgit_get_current_old_file(void); extern struct diff_filespec *cgit_get_current_new_file(void); -- cgit v0.10.1 From 1b5c336cc99f01a0f8d6668cbfc9273f49a6be25 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 7 Mar 2011 00:00:24 +0100 Subject: ui-stats.c: create a control panel for stat options Signed-off-by: Lars Hjemli 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) top = ctx->qry.ofs; if (!top) top = 10; + + html("
"); + html("stat options"); + html("
"); + cgit_add_hidden_formfields(1, 0, "stats"); + html(""); + if (ctx->repo->max_stats > 1) { + html(""); + html(""); + } + html(""); + html(""); + html("
Period:
Authors:
"); + html(""); + html("
"); + html("
"); + html("
"); htmlf("

Commits per author per %s", period->name); if (ctx->qry.path) { html(" (path '"); @@ -393,30 +420,6 @@ void cgit_show_stats(struct cgit_context *ctx) html("')"); } html("

"); - - html("
"); - cgit_add_hidden_formfields(1, 0, "stats"); - if (ctx->repo->max_stats > 1) { - html("Period: "); - html("

"); - } - html("Authors: "); - html(""); - html(""); - html(""); - html("
"); print_authors(&authors, top, period); } -- cgit v0.10.1