summaryrefslogtreecommitdiffabout
authorJohan Herland <johan@herland.net>2010-06-09 23:09:27 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2010-06-19 08:40:22 (UTC)
commitc8e3295469bd3b8e38a9ea4478d517d3861e6c93 (patch) (unidiff)
tree0dc6078a7a2a9a5706b9ed11c4083682ccb0ffca
parent0ff143df7043b7dd87c31c50fa875bc96d1a7779 (diff)
downloadcgit-c8e3295469bd3b8e38a9ea4478d517d3861e6c93.zip
cgit-c8e3295469bd3b8e38a9ea4478d517d3861e6c93.tar.gz
cgit-c8e3295469bd3b8e38a9ea4478d517d3861e6c93.tar.bz2
ui-shared: Replace ctx.qry.path with ctx.qry.vpath
In all cases where ui-shared uses ctx.qry.path, it is done so in the context of a in-project path, and not in the context in which the 'refs' page or the 'clone'-related functionality uses ctx.qry.path. Make this explicit by using ctx.qry.vpath instead. This path introduces no fundamental difference in functionality except for fixing some minor bugs, for example the Atom feed reference from a "$repo/refs/heads/" page. Note that the usage of ctx.qry.path in the other ui-<page>.c files is ok, since that code presumably is only executed in the context of its own <page>, so the correct interpretation of ctx.qry.path is never in question. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ui-shared.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 137e469..3d5030b 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -521,33 +521,33 @@ void cgit_print_docstart(struct cgit_context *ctx)
521 html("</title>\n"); 521 html("</title>\n");
522 htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); 522 htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version);
523 if (ctx->cfg.robots && *ctx->cfg.robots) 523 if (ctx->cfg.robots && *ctx->cfg.robots)
524 htmlf("<meta name='robots' content='%s'/>\n", ctx->cfg.robots); 524 htmlf("<meta name='robots' content='%s'/>\n", ctx->cfg.robots);
525 html("<link rel='stylesheet' type='text/css' href='"); 525 html("<link rel='stylesheet' type='text/css' href='");
526 html_attr(ctx->cfg.css); 526 html_attr(ctx->cfg.css);
527 html("'/>\n"); 527 html("'/>\n");
528 if (ctx->cfg.favicon) { 528 if (ctx->cfg.favicon) {
529 html("<link rel='shortcut icon' href='"); 529 html("<link rel='shortcut icon' href='");
530 html_attr(ctx->cfg.favicon); 530 html_attr(ctx->cfg.favicon);
531 html("'/>\n"); 531 html("'/>\n");
532 } 532 }
533 if (host && ctx->repo) { 533 if (host && ctx->repo) {
534 html("<link rel='alternate' title='Atom feed' href='"); 534 html("<link rel='alternate' title='Atom feed' href='");
535 html(cgit_httpscheme()); 535 html(cgit_httpscheme());
536 html_attr(cgit_hosturl()); 536 html_attr(cgit_hosturl());
537 html_attr(cgit_fileurl(ctx->repo->url, "atom", ctx->qry.path, 537 html_attr(cgit_fileurl(ctx->repo->url, "atom", ctx->qry.vpath,
538 fmt("h=%s", ctx->qry.head))); 538 fmt("h=%s", ctx->qry.head)));
539 html("' type='application/atom+xml'/>\n"); 539 html("' type='application/atom+xml'/>\n");
540 } 540 }
541 if (ctx->cfg.head_include) 541 if (ctx->cfg.head_include)
542 html_include(ctx->cfg.head_include); 542 html_include(ctx->cfg.head_include);
543 html("</head>\n"); 543 html("</head>\n");
544 html("<body>\n"); 544 html("<body>\n");
545 if (ctx->cfg.header) 545 if (ctx->cfg.header)
546 html_include(ctx->cfg.header); 546 html_include(ctx->cfg.header);
547} 547}
548 548
549void cgit_print_docend() 549void cgit_print_docend()
550{ 550{
551 html("</div> <!-- class=content -->\n"); 551 html("</div> <!-- class=content -->\n");
552 if (ctx.cfg.embedded) { 552 if (ctx.cfg.embedded) {
553 html("</div> <!-- id=cgit -->\n"); 553 html("</div> <!-- id=cgit -->\n");
@@ -608,34 +608,34 @@ int print_archive_ref(const char *refname, const unsigned char *sha1,
608 url = cgit_pageurl(ctx.qry.repo, "blob", 608 url = cgit_pageurl(ctx.qry.repo, "blob",
609 fmt("id=%s&amp;path=%s", sha1_to_hex(fileid), 609 fmt("id=%s&amp;path=%s", sha1_to_hex(fileid),
610 buf)); 610 buf));
611 html_link_open(url, NULL, "menu"); 611 html_link_open(url, NULL, "menu");
612 html_txt(strlpart(buf, 20)); 612 html_txt(strlpart(buf, 20));
613 html_link_close(); 613 html_link_close();
614 return 0; 614 return 0;
615} 615}
616 616
617void cgit_add_hidden_formfields(int incl_head, int incl_search, 617void cgit_add_hidden_formfields(int incl_head, int incl_search,
618 const char *page) 618 const char *page)
619{ 619{
620 char *url; 620 char *url;
621 621
622 if (!ctx.cfg.virtual_root) { 622 if (!ctx.cfg.virtual_root) {
623 url = fmt("%s/%s", ctx.qry.repo, page); 623 url = fmt("%s/%s", ctx.qry.repo, page);
624 if (ctx.qry.path) 624 if (ctx.qry.vpath)
625 url = fmt("%s/%s", url, ctx.qry.path); 625 url = fmt("%s/%s", url, ctx.qry.vpath);
626 html_hidden("url", url); 626 html_hidden("url", url);
627 } 627 }
628 628
629 if (incl_head && ctx.qry.head && ctx.repo->defbranch && 629 if (incl_head && ctx.qry.head && ctx.repo->defbranch &&
630 strcmp(ctx.qry.head, ctx.repo->defbranch)) 630 strcmp(ctx.qry.head, ctx.repo->defbranch))
631 html_hidden("h", ctx.qry.head); 631 html_hidden("h", ctx.qry.head);
632 632
633 if (ctx.qry.sha1) 633 if (ctx.qry.sha1)
634 html_hidden("id", ctx.qry.sha1); 634 html_hidden("id", ctx.qry.sha1);
635 if (ctx.qry.sha2) 635 if (ctx.qry.sha2)
636 html_hidden("id2", ctx.qry.sha2); 636 html_hidden("id2", ctx.qry.sha2);
637 if (ctx.qry.showmsg) 637 if (ctx.qry.showmsg)
638 html_hidden("showmsg", "1"); 638 html_hidden("showmsg", "1");
639 639
640 if (incl_search) { 640 if (incl_search) {
641 if (ctx.qry.grep) 641 if (ctx.qry.grep)
@@ -715,33 +715,33 @@ void cgit_print_pageheader(struct cgit_context *ctx)
715 ctx->qry.sha1, NULL); 715 ctx->qry.sha1, NULL);
716 cgit_commit_link("commit", NULL, hc(ctx, "commit"), 716 cgit_commit_link("commit", NULL, hc(ctx, "commit"),
717 ctx->qry.head, ctx->qry.sha1, 0); 717 ctx->qry.head, ctx->qry.sha1, 0);
718 cgit_diff_link("diff", NULL, hc(ctx, "diff"), ctx->qry.head, 718 cgit_diff_link("diff", NULL, hc(ctx, "diff"), ctx->qry.head,
719 ctx->qry.sha1, ctx->qry.sha2, NULL, 0); 719 ctx->qry.sha1, ctx->qry.sha2, NULL, 0);
720 if (ctx->repo->max_stats) 720 if (ctx->repo->max_stats)
721 cgit_stats_link("stats", NULL, hc(ctx, "stats"), 721 cgit_stats_link("stats", NULL, hc(ctx, "stats"),
722 ctx->qry.head, NULL); 722 ctx->qry.head, NULL);
723 if (ctx->repo->readme) 723 if (ctx->repo->readme)
724 reporevlink("about", "about", NULL, 724 reporevlink("about", "about", NULL,
725 hc(ctx, "about"), ctx->qry.head, NULL, 725 hc(ctx, "about"), ctx->qry.head, NULL,
726 NULL); 726 NULL);
727 html("</td><td class='form'>"); 727 html("</td><td class='form'>");
728 html("<form class='right' method='get' action='"); 728 html("<form class='right' method='get' action='");
729 if (ctx->cfg.virtual_root) 729 if (ctx->cfg.virtual_root)
730 html_url_path(cgit_fileurl(ctx->qry.repo, "log", 730 html_url_path(cgit_fileurl(ctx->qry.repo, "log",
731 ctx->qry.path, NULL)); 731 ctx->qry.vpath, NULL));
732 html("'>\n"); 732 html("'>\n");
733 cgit_add_hidden_formfields(1, 0, "log"); 733 cgit_add_hidden_formfields(1, 0, "log");
734 html("<select name='qt'>\n"); 734 html("<select name='qt'>\n");
735 html_option("grep", "log msg", ctx->qry.grep); 735 html_option("grep", "log msg", ctx->qry.grep);
736 html_option("author", "author", ctx->qry.grep); 736 html_option("author", "author", ctx->qry.grep);
737 html_option("committer", "committer", ctx->qry.grep); 737 html_option("committer", "committer", ctx->qry.grep);
738 html("</select>\n"); 738 html("</select>\n");
739 html("<input class='txt' type='text' size='10' name='q' value='"); 739 html("<input class='txt' type='text' size='10' name='q' value='");
740 html_attr(ctx->qry.search); 740 html_attr(ctx->qry.search);
741 html("'/>\n"); 741 html("'/>\n");
742 html("<input type='submit' value='search'/>\n"); 742 html("<input type='submit' value='search'/>\n");
743 html("</form>\n"); 743 html("</form>\n");
744 } else { 744 } else {
745 site_link(NULL, "index", NULL, hc(ctx, "repolist"), NULL, 0); 745 site_link(NULL, "index", NULL, hc(ctx, "repolist"), NULL, 0);
746 if (ctx->cfg.root_readme) 746 if (ctx->cfg.root_readme)
747 site_link("about", "about", NULL, hc(ctx, "about"), 747 site_link("about", "about", NULL, hc(ctx, "about"),