summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
Unidiff
Diffstat (limited to 'ui-shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-shared.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ui-shared.c b/ui-shared.c
index ee3f6fe..1fc5c09 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -574,95 +574,94 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page)
574 if (incl_search) { 574 if (incl_search) {
575 if (ctx.qry.grep) 575 if (ctx.qry.grep)
576 html_hidden("qt", ctx.qry.grep); 576 html_hidden("qt", ctx.qry.grep);
577 if (ctx.qry.search) 577 if (ctx.qry.search)
578 html_hidden("q", ctx.qry.search); 578 html_hidden("q", ctx.qry.search);
579 } 579 }
580} 580}
581 581
582char *hc(struct cgit_cmd *cmd, const char *page) 582char *hc(struct cgit_cmd *cmd, const char *page)
583{ 583{
584 return (strcmp(cmd->name, page) ? NULL : "active"); 584 return (strcmp(cmd->name, page) ? NULL : "active");
585} 585}
586 586
587void cgit_print_pageheader(struct cgit_context *ctx) 587void cgit_print_pageheader(struct cgit_context *ctx)
588{ 588{
589 struct cgit_cmd *cmd = cgit_get_cmd(ctx); 589 struct cgit_cmd *cmd = cgit_get_cmd(ctx);
590 590
591 html("<table id='header'>\n"); 591 html("<table id='header'>\n");
592 html("<tr>\n"); 592 html("<tr>\n");
593 html("<td class='logo' rowspan='2'><a href='"); 593 html("<td class='logo' rowspan='2'><a href='");
594 if (ctx->cfg.logo_link) 594 if (ctx->cfg.logo_link)
595 html_attr(ctx->cfg.logo_link); 595 html_attr(ctx->cfg.logo_link);
596 else 596 else
597 html_attr(cgit_rooturl()); 597 html_attr(cgit_rooturl());
598 html("'><img src='"); 598 html("'><img src='");
599 html_attr(ctx->cfg.logo); 599 html_attr(ctx->cfg.logo);
600 html("' alt='cgit logo'/></a></td>\n"); 600 html("' alt='cgit logo'/></a></td>\n");
601 601
602 html("<td class='main'>"); 602 html("<td class='main'>");
603 if (ctx->repo) { 603 if (ctx->repo) {
604 cgit_index_link("index", NULL, NULL, NULL, 0); 604 cgit_index_link("index", NULL, NULL, NULL, 0);
605 html(" : "); 605 html(" : ");
606 reporevlink(NULL, ctx->repo->name, NULL, hc(cmd, "summary"), 606 cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL, NULL);
607 ctx->qry.head, NULL, NULL);
608 html("</td><td class='form'>"); 607 html("</td><td class='form'>");
609 html("<form method='get' action=''>\n"); 608 html("<form method='get' action=''>\n");
610 add_hidden_formfields(0, 1, ctx->qry.page); 609 add_hidden_formfields(0, 1, ctx->qry.page);
611 html("<select name='h' onchange='this.form.submit();'>\n"); 610 html("<select name='h' onchange='this.form.submit();'>\n");
612 for_each_branch_ref(print_branch_option, ctx->qry.head); 611 for_each_branch_ref(print_branch_option, ctx->qry.head);
613 html("</select> "); 612 html("</select> ");
614 html("<input type='submit' name='' value='switch'/>"); 613 html("<input type='submit' name='' value='switch'/>");
615 html("</form>"); 614 html("</form>");
616 } else 615 } else
617 html_txt(ctx->cfg.root_title); 616 html_txt(ctx->cfg.root_title);
618 html("</td></tr>\n"); 617 html("</td></tr>\n");
619 618
620 html("<tr><td class='sub'>"); 619 html("<tr><td class='sub'>");
621 if (ctx->repo) { 620 if (ctx->repo) {
622 html_txt(ctx->repo->desc); 621 html_txt(ctx->repo->desc);
623 html("</td><td class='sub right'>"); 622 html("</td><td class='sub right'>");
624 html_txt(ctx->repo->owner); 623 html_txt(ctx->repo->owner);
625 } else { 624 } else {
626 if (ctx->cfg.root_desc) 625 if (ctx->cfg.root_desc)
627 html_txt(ctx->cfg.root_desc); 626 html_txt(ctx->cfg.root_desc);
628 else if (ctx->cfg.index_info) 627 else if (ctx->cfg.index_info)
629 html_include(ctx->cfg.index_info); 628 html_include(ctx->cfg.index_info);
630 } 629 }
631 html("</td></tr></table>\n"); 630 html("</td></tr></table>\n");
632 631
633 html("<table class='tabs'><tr><td>\n"); 632 html("<table class='tabs'><tr><td>\n");
634 if (ctx->repo) { 633 if (ctx->repo) {
635 reporevlink(NULL, "summary", NULL, hc(cmd, "summary"), 634 cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL,
636 ctx->qry.head, NULL, NULL); 635 ctx->qry.head);
637 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, 636 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head,
638 ctx->qry.sha1, NULL); 637 ctx->qry.sha1, NULL);
639 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, 638 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head,
640 NULL, NULL, 0, NULL, NULL); 639 NULL, NULL, 0, NULL, NULL);
641 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, 640 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head,
642 ctx->qry.sha1, NULL); 641 ctx->qry.sha1, NULL);
643 cgit_commit_link("commit", NULL, hc(cmd, "commit"), 642 cgit_commit_link("commit", NULL, hc(cmd, "commit"),
644 ctx->qry.head, ctx->qry.sha1); 643 ctx->qry.head, ctx->qry.sha1);
645 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, 644 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head,
646 ctx->qry.sha1, ctx->qry.sha2, NULL); 645 ctx->qry.sha1, ctx->qry.sha2, NULL);
647 if (ctx->repo->readme) 646 if (ctx->repo->readme)
648 reporevlink("about", "about", NULL, 647 reporevlink("about", "about", NULL,
649 hc(cmd, "about"), ctx->qry.head, NULL, 648 hc(cmd, "about"), ctx->qry.head, NULL,
650 NULL); 649 NULL);
651 html("</td><td class='form'>"); 650 html("</td><td class='form'>");
652 html("<form class='right' method='get' action='"); 651 html("<form class='right' method='get' action='");
653 if (ctx->cfg.virtual_root) 652 if (ctx->cfg.virtual_root)
654 html_attr(cgit_fileurl(ctx->qry.repo, "log", 653 html_attr(cgit_fileurl(ctx->qry.repo, "log",
655 ctx->qry.path, NULL)); 654 ctx->qry.path, NULL));
656 html("'>\n"); 655 html("'>\n");
657 add_hidden_formfields(1, 0, "log"); 656 add_hidden_formfields(1, 0, "log");
658 html("<select name='qt'>\n"); 657 html("<select name='qt'>\n");
659 html_option("grep", "log msg", ctx->qry.grep); 658 html_option("grep", "log msg", ctx->qry.grep);
660 html_option("author", "author", ctx->qry.grep); 659 html_option("author", "author", ctx->qry.grep);
661 html_option("committer", "committer", ctx->qry.grep); 660 html_option("committer", "committer", ctx->qry.grep);
662 html("</select>\n"); 661 html("</select>\n");
663 html("<input class='txt' type='text' size='10' name='q' value='"); 662 html("<input class='txt' type='text' size='10' name='q' value='");
664 html_attr(ctx->qry.search); 663 html_attr(ctx->qry.search);
665 html("'/>\n"); 664 html("'/>\n");
666 html("<input type='submit' value='search'/>\n"); 665 html("<input type='submit' value='search'/>\n");
667 html("</form>\n"); 666 html("</form>\n");
668 } else { 667 } else {