summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
authorLars Hjemli <hjemli@gmail.com>2008-12-06 10:37:37 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-12-06 10:37:37 (UTC)
commit3c32fe07717f27fc891b66ccd06057fb810d03ad (patch) (unidiff)
tree04897b3eac6432c43284e7da79161e47856d078b /ui-shared.c
parent9c8be943f72b6f1bda5a31ce401899c3dd734e98 (diff)
parentab67164d6217fcda5ef3e07aefa3dd6eee6b65a3 (diff)
downloadcgit-3c32fe07717f27fc891b66ccd06057fb810d03ad.zip
cgit-3c32fe07717f27fc891b66ccd06057fb810d03ad.tar.gz
cgit-3c32fe07717f27fc891b66ccd06057fb810d03ad.tar.bz2
Merge branch 'full-log'
Conflicts: cgit.c cgit.h
Diffstat (limited to 'ui-shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-shared.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 9319881..95dfeb4 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -272,48 +272,54 @@ void cgit_tree_link(char *name, char *title, char *class, char *head,
272 char *rev, char *path) 272 char *rev, char *path)
273{ 273{
274 reporevlink("tree", name, title, class, head, rev, path); 274 reporevlink("tree", name, title, class, head, rev, path);
275} 275}
276 276
277void cgit_plain_link(char *name, char *title, char *class, char *head, 277void cgit_plain_link(char *name, char *title, char *class, char *head,
278 char *rev, char *path) 278 char *rev, char *path)
279{ 279{
280 reporevlink("plain", name, title, class, head, rev, path); 280 reporevlink("plain", name, title, class, head, rev, path);
281} 281}
282 282
283void cgit_log_link(char *name, char *title, char *class, char *head, 283void cgit_log_link(char *name, char *title, char *class, char *head,
284 char *rev, char *path, int ofs, char *grep, char *pattern) 284 char *rev, char *path, int ofs, char *grep, char *pattern,
285 int showmsg)
285{ 286{
286 char *delim; 287 char *delim;
287 288
288 delim = repolink(title, class, "log", head, path); 289 delim = repolink(title, class, "log", head, path);
289 if (rev && strcmp(rev, ctx.qry.head)) { 290 if (rev && strcmp(rev, ctx.qry.head)) {
290 html(delim); 291 html(delim);
291 html("id="); 292 html("id=");
292 html_url_arg(rev); 293 html_url_arg(rev);
293 delim = "&"; 294 delim = "&";
294 } 295 }
295 if (grep && pattern) { 296 if (grep && pattern) {
296 html(delim); 297 html(delim);
297 html("qt="); 298 html("qt=");
298 html_url_arg(grep); 299 html_url_arg(grep);
299 delim = "&"; 300 delim = "&";
300 html(delim); 301 html(delim);
301 html("q="); 302 html("q=");
302 html_url_arg(pattern); 303 html_url_arg(pattern);
303 } 304 }
304 if (ofs > 0) { 305 if (ofs > 0) {
305 html(delim); 306 html(delim);
306 html("ofs="); 307 html("ofs=");
307 htmlf("%d", ofs); 308 htmlf("%d", ofs);
309 delim = "&";
310 }
311 if (showmsg) {
312 html(delim);
313 html("showmsg=1");
308 } 314 }
309 html("'>"); 315 html("'>");
310 html_txt(name); 316 html_txt(name);
311 html("</a>"); 317 html("</a>");
312} 318}
313 319
314void cgit_commit_link(char *name, char *title, char *class, char *head, 320void cgit_commit_link(char *name, char *title, char *class, char *head,
315 char *rev) 321 char *rev)
316{ 322{
317 if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) { 323 if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) {
318 name[ctx.cfg.max_msg_len] = '\0'; 324 name[ctx.cfg.max_msg_len] = '\0';
319 name[ctx.cfg.max_msg_len - 1] = '.'; 325 name[ctx.cfg.max_msg_len - 1] = '.';
@@ -561,24 +567,26 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page)
561 url = fmt("%s/%s", url, ctx.qry.path); 567 url = fmt("%s/%s", url, ctx.qry.path);
562 html_hidden("url", url); 568 html_hidden("url", url);
563 } 569 }
564 570
565 if (incl_head && ctx.qry.head && ctx.repo->defbranch && 571 if (incl_head && ctx.qry.head && ctx.repo->defbranch &&
566 strcmp(ctx.qry.head, ctx.repo->defbranch)) 572 strcmp(ctx.qry.head, ctx.repo->defbranch))
567 html_hidden("h", ctx.qry.head); 573 html_hidden("h", ctx.qry.head);
568 574
569 if (ctx.qry.sha1) 575 if (ctx.qry.sha1)
570 html_hidden("id", ctx.qry.sha1); 576 html_hidden("id", ctx.qry.sha1);
571 if (ctx.qry.sha2) 577 if (ctx.qry.sha2)
572 html_hidden("id2", ctx.qry.sha2); 578 html_hidden("id2", ctx.qry.sha2);
579 if (ctx.qry.showmsg)
580 html_hidden("showmsg", "1");
573 581
574 if (incl_search) { 582 if (incl_search) {
575 if (ctx.qry.grep) 583 if (ctx.qry.grep)
576 html_hidden("qt", ctx.qry.grep); 584 html_hidden("qt", ctx.qry.grep);
577 if (ctx.qry.search) 585 if (ctx.qry.search)
578 html_hidden("q", ctx.qry.search); 586 html_hidden("q", ctx.qry.search);
579 } 587 }
580} 588}
581 589
582char *hc(struct cgit_cmd *cmd, const char *page) 590char *hc(struct cgit_cmd *cmd, const char *page)
583{ 591{
584 return (strcmp(cmd->name, page) ? NULL : "active"); 592 return (strcmp(cmd->name, page) ? NULL : "active");
@@ -627,25 +635,25 @@ void cgit_print_pageheader(struct cgit_context *ctx)
627 else if (ctx->cfg.index_info) 635 else if (ctx->cfg.index_info)
628 html_include(ctx->cfg.index_info); 636 html_include(ctx->cfg.index_info);
629 } 637 }
630 html("</td></tr></table>\n"); 638 html("</td></tr></table>\n");
631 639
632 html("<table class='tabs'><tr><td>\n"); 640 html("<table class='tabs'><tr><td>\n");
633 if (ctx->repo) { 641 if (ctx->repo) {
634 cgit_summary_link("summary", NULL, hc(cmd, "summary"), 642 cgit_summary_link("summary", NULL, hc(cmd, "summary"),
635 ctx->qry.head); 643 ctx->qry.head);
636 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, 644 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head,
637 ctx->qry.sha1, NULL); 645 ctx->qry.sha1, NULL);
638 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, 646 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head,
639 NULL, NULL, 0, NULL, NULL); 647 NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg);
640 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, 648 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head,
641 ctx->qry.sha1, NULL); 649 ctx->qry.sha1, NULL);
642 cgit_commit_link("commit", NULL, hc(cmd, "commit"), 650 cgit_commit_link("commit", NULL, hc(cmd, "commit"),
643 ctx->qry.head, ctx->qry.sha1); 651 ctx->qry.head, ctx->qry.sha1);
644 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, 652 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head,
645 ctx->qry.sha1, ctx->qry.sha2, NULL); 653 ctx->qry.sha1, ctx->qry.sha2, NULL);
646 if (ctx->repo->readme) 654 if (ctx->repo->readme)
647 reporevlink("about", "about", NULL, 655 reporevlink("about", "about", NULL,
648 hc(cmd, "about"), ctx->qry.head, NULL, 656 hc(cmd, "about"), ctx->qry.head, NULL,
649 NULL); 657 NULL);
650 html("</td><td class='form'>"); 658 html("</td><td class='form'>");
651 html("<form class='right' method='get' action='"); 659 html("<form class='right' method='get' action='");