summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--ui-shared.c6
-rw-r--r--ui-shared.h3
2 files changed, 5 insertions, 4 deletions
diff --git a/ui-shared.c b/ui-shared.c
index a5eb25f..1bb30c2 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -546,25 +546,25 @@ int print_archive_ref(const char *refname, const unsigned char *sha1,
546 html("<h1>download</h1>\n"); 546 html("<h1>download</h1>\n");
547 *header = 1; 547 *header = 1;
548 } 548 }
549 url = cgit_pageurl(ctx.qry.repo, "blob", 549 url = cgit_pageurl(ctx.qry.repo, "blob",
550 fmt("id=%s&amp;path=%s", sha1_to_hex(fileid), 550 fmt("id=%s&amp;path=%s", sha1_to_hex(fileid),
551 buf)); 551 buf));
552 html_link_open(url, NULL, "menu"); 552 html_link_open(url, NULL, "menu");
553 html_txt(strlpart(buf, 20)); 553 html_txt(strlpart(buf, 20));
554 html_link_close(); 554 html_link_close();
555 return 0; 555 return 0;
556} 556}
557 557
558void add_hidden_formfields(int incl_head, int incl_search, char *page) 558void cgit_add_hidden_formfields(int incl_head, int incl_search, char *page)
559{ 559{
560 char *url; 560 char *url;
561 561
562 if (!ctx.cfg.virtual_root) { 562 if (!ctx.cfg.virtual_root) {
563 url = fmt("%s/%s", ctx.qry.repo, page); 563 url = fmt("%s/%s", ctx.qry.repo, page);
564 if (ctx.qry.path) 564 if (ctx.qry.path)
565 url = fmt("%s/%s", url, ctx.qry.path); 565 url = fmt("%s/%s", url, ctx.qry.path);
566 html_hidden("url", url); 566 html_hidden("url", url);
567 } 567 }
568 568
569 if (incl_head && ctx.qry.head && ctx.repo->defbranch && 569 if (incl_head && ctx.qry.head && ctx.repo->defbranch &&
570 strcmp(ctx.qry.head, ctx.repo->defbranch)) 570 strcmp(ctx.qry.head, ctx.repo->defbranch))
@@ -601,25 +601,25 @@ void cgit_print_pageheader(struct cgit_context *ctx)
601 html_attr(cgit_rooturl()); 601 html_attr(cgit_rooturl());
602 html("'><img src='"); 602 html("'><img src='");
603 html_attr(ctx->cfg.logo); 603 html_attr(ctx->cfg.logo);
604 html("' alt='cgit logo'/></a></td>\n"); 604 html("' alt='cgit logo'/></a></td>\n");
605 605
606 html("<td class='main'>"); 606 html("<td class='main'>");
607 if (ctx->repo) { 607 if (ctx->repo) {
608 cgit_index_link("index", NULL, NULL, NULL, 0); 608 cgit_index_link("index", NULL, NULL, NULL, 0);
609 html(" : "); 609 html(" : ");
610 cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL, NULL); 610 cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL, NULL);
611 html("</td><td class='form'>"); 611 html("</td><td class='form'>");
612 html("<form method='get' action=''>\n"); 612 html("<form method='get' action=''>\n");
613 add_hidden_formfields(0, 1, ctx->qry.page); 613 cgit_add_hidden_formfields(0, 1, ctx->qry.page);
614 html("<select name='h' onchange='this.form.submit();'>\n"); 614 html("<select name='h' onchange='this.form.submit();'>\n");
615 for_each_branch_ref(print_branch_option, ctx->qry.head); 615 for_each_branch_ref(print_branch_option, ctx->qry.head);
616 html("</select> "); 616 html("</select> ");
617 html("<input type='submit' name='' value='switch'/>"); 617 html("<input type='submit' name='' value='switch'/>");
618 html("</form>"); 618 html("</form>");
619 } else 619 } else
620 html_txt(ctx->cfg.root_title); 620 html_txt(ctx->cfg.root_title);
621 html("</td></tr>\n"); 621 html("</td></tr>\n");
622 622
623 html("<tr><td class='sub'>"); 623 html("<tr><td class='sub'>");
624 if (ctx->repo) { 624 if (ctx->repo) {
625 html_txt(ctx->repo->desc); 625 html_txt(ctx->repo->desc);
@@ -651,25 +651,25 @@ void cgit_print_pageheader(struct cgit_context *ctx)
651 cgit_stats_link("stats", NULL, hc(cmd, "stats"), 651 cgit_stats_link("stats", NULL, hc(cmd, "stats"),
652 ctx->qry.head, NULL); 652 ctx->qry.head, NULL);
653 if (ctx->repo->readme) 653 if (ctx->repo->readme)
654 reporevlink("about", "about", NULL, 654 reporevlink("about", "about", NULL,
655 hc(cmd, "about"), ctx->qry.head, NULL, 655 hc(cmd, "about"), ctx->qry.head, NULL,
656 NULL); 656 NULL);
657 html("</td><td class='form'>"); 657 html("</td><td class='form'>");
658 html("<form class='right' method='get' action='"); 658 html("<form class='right' method='get' action='");
659 if (ctx->cfg.virtual_root) 659 if (ctx->cfg.virtual_root)
660 html_url_path(cgit_fileurl(ctx->qry.repo, "log", 660 html_url_path(cgit_fileurl(ctx->qry.repo, "log",
661 ctx->qry.path, NULL)); 661 ctx->qry.path, NULL));
662 html("'>\n"); 662 html("'>\n");
663 add_hidden_formfields(1, 0, "log"); 663 cgit_add_hidden_formfields(1, 0, "log");
664 html("<select name='qt'>\n"); 664 html("<select name='qt'>\n");
665 html_option("grep", "log msg", ctx->qry.grep); 665 html_option("grep", "log msg", ctx->qry.grep);
666 html_option("author", "author", ctx->qry.grep); 666 html_option("author", "author", ctx->qry.grep);
667 html_option("committer", "committer", ctx->qry.grep); 667 html_option("committer", "committer", ctx->qry.grep);
668 html("</select>\n"); 668 html("</select>\n");
669 html("<input class='txt' type='text' size='10' name='q' value='"); 669 html("<input class='txt' type='text' size='10' name='q' value='");
670 html_attr(ctx->qry.search); 670 html_attr(ctx->qry.search);
671 html("'/>\n"); 671 html("'/>\n");
672 html("<input type='submit' value='search'/>\n"); 672 html("<input type='submit' value='search'/>\n");
673 html("</form>\n"); 673 html("</form>\n");
674 } else { 674 } else {
675 site_link(NULL, "index", NULL, hc(cmd, "repolist"), NULL, 0); 675 site_link(NULL, "index", NULL, hc(cmd, "repolist"), NULL, 0);
diff --git a/ui-shared.h b/ui-shared.h
index e3fae64..1524dc3 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -35,14 +35,15 @@ extern void cgit_stats_link(char *name, char *title, char *class, char *head,
35extern void cgit_object_link(struct object *obj); 35extern void cgit_object_link(struct object *obj);
36 36
37extern void cgit_print_error(char *msg); 37extern void cgit_print_error(char *msg);
38extern void cgit_print_date(time_t secs, char *format, int local_time); 38extern void cgit_print_date(time_t secs, char *format, int local_time);
39extern void cgit_print_age(time_t t, time_t max_relative, char *format); 39extern void cgit_print_age(time_t t, time_t max_relative, char *format);
40extern void cgit_print_http_headers(struct cgit_context *ctx); 40extern void cgit_print_http_headers(struct cgit_context *ctx);
41extern void cgit_print_docstart(struct cgit_context *ctx); 41extern void cgit_print_docstart(struct cgit_context *ctx);
42extern void cgit_print_docend(); 42extern void cgit_print_docend();
43extern void cgit_print_pageheader(struct cgit_context *ctx); 43extern void cgit_print_pageheader(struct cgit_context *ctx);
44extern void cgit_print_filemode(unsigned short mode); 44extern void cgit_print_filemode(unsigned short mode);
45extern void cgit_print_snapshot_links(const char *repo, const char *head, 45extern void cgit_print_snapshot_links(const char *repo, const char *head,
46 const char *hex, int snapshots); 46 const char *hex, int snapshots);
47 47extern void cgit_add_hidden_formfields(int incl_head, int incl_search,
48 char *page);
48#endif /* UI_SHARED_H */ 49#endif /* UI_SHARED_H */