diff options
Diffstat (limited to 'ui-shared.c')
-rw-r--r-- | ui-shared.c | 303 |
1 files changed, 151 insertions, 152 deletions
diff --git a/ui-shared.c b/ui-shared.c index 0838e18..070971f 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -436,59 +436,58 @@ void cgit_stats_link(const char *name, const char *title, const char *class, | |||
436 | reporevlink("stats", name, title, class, head, NULL, path); | 436 | reporevlink("stats", name, title, class, head, NULL, path); |
437 | } | 437 | } |
438 | 438 | ||
439 | static void cgit_self_link(char *name, const char *title, const char *class, | 439 | static void cgit_self_link(char *name, const char *title, const char *class) |
440 | struct cgit_context *ctx) | 440 | { |
441 | { | 441 | if (!strcmp(ctx.qry.page, "repolist")) |
442 | if (!strcmp(ctx->qry.page, "repolist")) | 442 | cgit_index_link(name, title, class, ctx.qry.search, ctx.qry.sort, |
443 | cgit_index_link(name, title, class, ctx->qry.search, ctx->qry.sort, | 443 | ctx.qry.ofs); |
444 | ctx->qry.ofs); | 444 | else if (!strcmp(ctx.qry.page, "summary")) |
445 | else if (!strcmp(ctx->qry.page, "summary")) | 445 | cgit_summary_link(name, title, class, ctx.qry.head); |
446 | cgit_summary_link(name, title, class, ctx->qry.head); | 446 | else if (!strcmp(ctx.qry.page, "tag")) |
447 | else if (!strcmp(ctx->qry.page, "tag")) | 447 | cgit_tag_link(name, title, class, ctx.qry.head, |
448 | cgit_tag_link(name, title, class, ctx->qry.head, | 448 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL); |
449 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL); | 449 | else if (!strcmp(ctx.qry.page, "tree")) |
450 | else if (!strcmp(ctx->qry.page, "tree")) | 450 | cgit_tree_link(name, title, class, ctx.qry.head, |
451 | cgit_tree_link(name, title, class, ctx->qry.head, | 451 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, |
452 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 452 | ctx.qry.path); |
453 | ctx->qry.path); | 453 | else if (!strcmp(ctx.qry.page, "plain")) |
454 | else if (!strcmp(ctx->qry.page, "plain")) | 454 | cgit_plain_link(name, title, class, ctx.qry.head, |
455 | cgit_plain_link(name, title, class, ctx->qry.head, | 455 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, |
456 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 456 | ctx.qry.path); |
457 | ctx->qry.path); | 457 | else if (!strcmp(ctx.qry.page, "log")) |
458 | else if (!strcmp(ctx->qry.page, "log")) | 458 | cgit_log_link(name, title, class, ctx.qry.head, |
459 | cgit_log_link(name, title, class, ctx->qry.head, | 459 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, |
460 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 460 | ctx.qry.path, ctx.qry.ofs, |
461 | ctx->qry.path, ctx->qry.ofs, | 461 | ctx.qry.grep, ctx.qry.search, |
462 | ctx->qry.grep, ctx->qry.search, | 462 | ctx.qry.showmsg); |
463 | ctx->qry.showmsg); | 463 | else if (!strcmp(ctx.qry.page, "commit")) |
464 | else if (!strcmp(ctx->qry.page, "commit")) | 464 | cgit_commit_link(name, title, class, ctx.qry.head, |
465 | cgit_commit_link(name, title, class, ctx->qry.head, | 465 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, |
466 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 466 | ctx.qry.path, 0); |
467 | ctx->qry.path, 0); | 467 | else if (!strcmp(ctx.qry.page, "patch")) |
468 | else if (!strcmp(ctx->qry.page, "patch")) | 468 | cgit_patch_link(name, title, class, ctx.qry.head, |
469 | cgit_patch_link(name, title, class, ctx->qry.head, | 469 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, |
470 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 470 | ctx.qry.path); |
471 | ctx->qry.path); | 471 | else if (!strcmp(ctx.qry.page, "refs")) |
472 | else if (!strcmp(ctx->qry.page, "refs")) | 472 | cgit_refs_link(name, title, class, ctx.qry.head, |
473 | cgit_refs_link(name, title, class, ctx->qry.head, | 473 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, |
474 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 474 | ctx.qry.path); |
475 | ctx->qry.path); | 475 | else if (!strcmp(ctx.qry.page, "snapshot")) |
476 | else if (!strcmp(ctx->qry.page, "snapshot")) | 476 | cgit_snapshot_link(name, title, class, ctx.qry.head, |
477 | cgit_snapshot_link(name, title, class, ctx->qry.head, | 477 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, |
478 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 478 | ctx.qry.path); |
479 | ctx->qry.path); | 479 | else if (!strcmp(ctx.qry.page, "diff")) |
480 | else if (!strcmp(ctx->qry.page, "diff")) | 480 | cgit_diff_link(name, title, class, ctx.qry.head, |
481 | cgit_diff_link(name, title, class, ctx->qry.head, | 481 | ctx.qry.sha1, ctx.qry.sha2, |
482 | ctx->qry.sha1, ctx->qry.sha2, | 482 | ctx.qry.path, 0); |
483 | ctx->qry.path, 0); | 483 | else if (!strcmp(ctx.qry.page, "stats")) |
484 | else if (!strcmp(ctx->qry.page, "stats")) | 484 | cgit_stats_link(name, title, class, ctx.qry.head, |
485 | cgit_stats_link(name, title, class, ctx->qry.head, | 485 | ctx.qry.path); |
486 | ctx->qry.path); | ||
487 | else { | 486 | else { |
488 | /* Don't known how to make link for this page */ | 487 | /* Don't known how to make link for this page */ |
489 | repolink(title, class, ctx->qry.page, ctx->qry.head, ctx->qry.path); | 488 | repolink(title, class, ctx.qry.page, ctx.qry.head, ctx.qry.path); |
490 | html("><!-- cgit_self_link() doesn't know how to make link for page '"); | 489 | html("><!-- cgit_self_link() doesn't know how to make link for page '"); |
491 | html_txt(ctx->qry.page); | 490 | html_txt(ctx.qry.page); |
492 | html("' -->"); | 491 | html("' -->"); |
493 | html_txt(name); | 492 | html_txt(name); |
494 | html("</a>"); | 493 | html("</a>"); |
@@ -632,39 +631,39 @@ void cgit_print_age(time_t t, time_t max_relative, const char *format) | |||
632 | secs * 1.0 / TM_YEAR); | 631 | secs * 1.0 / TM_YEAR); |
633 | } | 632 | } |
634 | 633 | ||
635 | void cgit_print_http_headers(struct cgit_context *ctx) | 634 | void cgit_print_http_headers(void) |
636 | { | 635 | { |
637 | if (ctx->env.no_http && !strcmp(ctx->env.no_http, "1")) | 636 | if (ctx.env.no_http && !strcmp(ctx.env.no_http, "1")) |
638 | return; | 637 | return; |
639 | 638 | ||
640 | if (ctx->page.status) | 639 | if (ctx.page.status) |
641 | htmlf("Status: %d %s\n", ctx->page.status, ctx->page.statusmsg); | 640 | htmlf("Status: %d %s\n", ctx.page.status, ctx.page.statusmsg); |
642 | if (ctx->page.mimetype && ctx->page.charset) | 641 | if (ctx.page.mimetype && ctx.page.charset) |
643 | htmlf("Content-Type: %s; charset=%s\n", ctx->page.mimetype, | 642 | htmlf("Content-Type: %s; charset=%s\n", ctx.page.mimetype, |
644 | ctx->page.charset); | 643 | ctx.page.charset); |
645 | else if (ctx->page.mimetype) | 644 | else if (ctx.page.mimetype) |
646 | htmlf("Content-Type: %s\n", ctx->page.mimetype); | 645 | htmlf("Content-Type: %s\n", ctx.page.mimetype); |
647 | if (ctx->page.size) | 646 | if (ctx.page.size) |
648 | htmlf("Content-Length: %zd\n", ctx->page.size); | 647 | htmlf("Content-Length: %zd\n", ctx.page.size); |
649 | if (ctx->page.filename) | 648 | if (ctx.page.filename) |
650 | htmlf("Content-Disposition: inline; filename=\"%s\"\n", | 649 | htmlf("Content-Disposition: inline; filename=\"%s\"\n", |
651 | ctx->page.filename); | 650 | ctx.page.filename); |
652 | if (!ctx->env.authenticated) | 651 | if (!ctx.env.authenticated) |
653 | html("Cache-Control: no-cache, no-store\n"); | 652 | html("Cache-Control: no-cache, no-store\n"); |
654 | htmlf("Last-Modified: %s\n", http_date(ctx->page.modified)); | 653 | htmlf("Last-Modified: %s\n", http_date(ctx.page.modified)); |
655 | htmlf("Expires: %s\n", http_date(ctx->page.expires)); | 654 | htmlf("Expires: %s\n", http_date(ctx.page.expires)); |
656 | if (ctx->page.etag) | 655 | if (ctx.page.etag) |
657 | htmlf("ETag: \"%s\"\n", ctx->page.etag); | 656 | htmlf("ETag: \"%s\"\n", ctx.page.etag); |
658 | html("\n"); | 657 | html("\n"); |
659 | if (ctx->env.request_method && !strcmp(ctx->env.request_method, "HEAD")) | 658 | if (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD")) |
660 | exit(0); | 659 | exit(0); |
661 | } | 660 | } |
662 | 661 | ||
663 | void cgit_print_docstart(struct cgit_context *ctx) | 662 | void cgit_print_docstart(void) |
664 | { | 663 | { |
665 | if (ctx->cfg.embedded) { | 664 | if (ctx.cfg.embedded) { |
666 | if (ctx->cfg.header) | 665 | if (ctx.cfg.header) |
667 | html_include(ctx->cfg.header); | 666 | html_include(ctx.cfg.header); |
668 | return; | 667 | return; |
669 | } | 668 | } |
670 | 669 | ||
@@ -673,37 +672,37 @@ void cgit_print_docstart(struct cgit_context *ctx) | |||
673 | html("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n"); | 672 | html("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n"); |
674 | html("<head>\n"); | 673 | html("<head>\n"); |
675 | html("<title>"); | 674 | html("<title>"); |
676 | html_txt(ctx->page.title); | 675 | html_txt(ctx.page.title); |
677 | html("</title>\n"); | 676 | html("</title>\n"); |
678 | htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); | 677 | htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); |
679 | if (ctx->cfg.robots && *ctx->cfg.robots) | 678 | if (ctx.cfg.robots && *ctx.cfg.robots) |
680 | htmlf("<meta name='robots' content='%s'/>\n", ctx->cfg.robots); | 679 | htmlf("<meta name='robots' content='%s'/>\n", ctx.cfg.robots); |
681 | html("<link rel='stylesheet' type='text/css' href='"); | 680 | html("<link rel='stylesheet' type='text/css' href='"); |
682 | html_attr(ctx->cfg.css); | 681 | html_attr(ctx.cfg.css); |
683 | html("'/>\n"); | 682 | html("'/>\n"); |
684 | if (ctx->cfg.favicon) { | 683 | if (ctx.cfg.favicon) { |
685 | html("<link rel='shortcut icon' href='"); | 684 | html("<link rel='shortcut icon' href='"); |
686 | html_attr(ctx->cfg.favicon); | 685 | html_attr(ctx.cfg.favicon); |
687 | html("'/>\n"); | 686 | html("'/>\n"); |
688 | } | 687 | } |
689 | if (host && ctx->repo && ctx->qry.head) { | 688 | if (host && ctx.repo && ctx.qry.head) { |
690 | struct strbuf sb = STRBUF_INIT; | 689 | struct strbuf sb = STRBUF_INIT; |
691 | strbuf_addf(&sb, "h=%s", ctx->qry.head); | 690 | strbuf_addf(&sb, "h=%s", ctx.qry.head); |
692 | 691 | ||
693 | html("<link rel='alternate' title='Atom feed' href='"); | 692 | html("<link rel='alternate' title='Atom feed' href='"); |
694 | html(cgit_httpscheme()); | 693 | html(cgit_httpscheme()); |
695 | html_attr(cgit_hosturl()); | 694 | html_attr(cgit_hosturl()); |
696 | html_attr(cgit_fileurl(ctx->repo->url, "atom", ctx->qry.vpath, | 695 | html_attr(cgit_fileurl(ctx.repo->url, "atom", ctx.qry.vpath, |
697 | sb.buf)); | 696 | sb.buf)); |
698 | html("' type='application/atom+xml'/>\n"); | 697 | html("' type='application/atom+xml'/>\n"); |
699 | strbuf_release(&sb); | 698 | strbuf_release(&sb); |
700 | } | 699 | } |
701 | if (ctx->cfg.head_include) | 700 | if (ctx.cfg.head_include) |
702 | html_include(ctx->cfg.head_include); | 701 | html_include(ctx.cfg.head_include); |
703 | html("</head>\n"); | 702 | html("</head>\n"); |
704 | html("<body>\n"); | 703 | html("<body>\n"); |
705 | if (ctx->cfg.header) | 704 | if (ctx.cfg.header) |
706 | html_include(ctx->cfg.header); | 705 | html_include(ctx.cfg.header); |
707 | } | 706 | } |
708 | 707 | ||
709 | void cgit_print_docend() | 708 | void cgit_print_docend() |
@@ -767,47 +766,47 @@ void cgit_add_hidden_formfields(int incl_head, int incl_search, | |||
767 | } | 766 | } |
768 | } | 767 | } |
769 | 768 | ||
770 | static const char *hc(struct cgit_context *ctx, const char *page) | 769 | static const char *hc(const char *page) |
771 | { | 770 | { |
772 | return strcmp(ctx->qry.page, page) ? NULL : "active"; | 771 | return strcmp(ctx.qry.page, page) ? NULL : "active"; |
773 | } | 772 | } |
774 | 773 | ||
775 | static void cgit_print_path_crumbs(struct cgit_context *ctx, char *path) | 774 | static void cgit_print_path_crumbs(char *path) |
776 | { | 775 | { |
777 | char *old_path = ctx->qry.path; | 776 | char *old_path = ctx.qry.path; |
778 | char *p = path, *q, *end = path + strlen(path); | 777 | char *p = path, *q, *end = path + strlen(path); |
779 | 778 | ||
780 | ctx->qry.path = NULL; | 779 | ctx.qry.path = NULL; |
781 | cgit_self_link("root", NULL, NULL, ctx); | 780 | cgit_self_link("root", NULL, NULL); |
782 | ctx->qry.path = p = path; | 781 | ctx.qry.path = p = path; |
783 | while (p < end) { | 782 | while (p < end) { |
784 | if (!(q = strchr(p, '/'))) | 783 | if (!(q = strchr(p, '/'))) |
785 | q = end; | 784 | q = end; |
786 | *q = '\0'; | 785 | *q = '\0'; |
787 | html_txt("/"); | 786 | html_txt("/"); |
788 | cgit_self_link(p, NULL, NULL, ctx); | 787 | cgit_self_link(p, NULL, NULL); |
789 | if (q < end) | 788 | if (q < end) |
790 | *q = '/'; | 789 | *q = '/'; |
791 | p = q + 1; | 790 | p = q + 1; |
792 | } | 791 | } |
793 | ctx->qry.path = old_path; | 792 | ctx.qry.path = old_path; |
794 | } | 793 | } |
795 | 794 | ||
796 | static void print_header(struct cgit_context *ctx) | 795 | static void print_header(void) |
797 | { | 796 | { |
798 | char *logo = NULL, *logo_link = NULL; | 797 | char *logo = NULL, *logo_link = NULL; |
799 | 798 | ||
800 | html("<table id='header'>\n"); | 799 | html("<table id='header'>\n"); |
801 | html("<tr>\n"); | 800 | html("<tr>\n"); |
802 | 801 | ||
803 | if (ctx->repo && ctx->repo->logo && *ctx->repo->logo) | 802 | if (ctx.repo && ctx.repo->logo && *ctx.repo->logo) |
804 | logo = ctx->repo->logo; | 803 | logo = ctx.repo->logo; |
805 | else | 804 | else |
806 | logo = ctx->cfg.logo; | 805 | logo = ctx.cfg.logo; |
807 | if (ctx->repo && ctx->repo->logo_link && *ctx->repo->logo_link) | 806 | if (ctx.repo && ctx.repo->logo_link && *ctx.repo->logo_link) |
808 | logo_link = ctx->repo->logo_link; | 807 | logo_link = ctx.repo->logo_link; |
809 | else | 808 | else |
810 | logo_link = ctx->cfg.logo_link; | 809 | logo_link = ctx.cfg.logo_link; |
811 | if (logo && *logo) { | 810 | if (logo && *logo) { |
812 | html("<td class='logo' rowspan='2'><a href='"); | 811 | html("<td class='logo' rowspan='2'><a href='"); |
813 | if (logo_link && *logo_link) | 812 | if (logo_link && *logo_link) |
@@ -820,104 +819,104 @@ static void print_header(struct cgit_context *ctx) | |||
820 | } | 819 | } |
821 | 820 | ||
822 | html("<td class='main'>"); | 821 | html("<td class='main'>"); |
823 | if (ctx->repo) { | 822 | if (ctx.repo) { |
824 | cgit_index_link("index", NULL, NULL, NULL, NULL, 0); | 823 | cgit_index_link("index", NULL, NULL, NULL, NULL, 0); |
825 | html(" : "); | 824 | html(" : "); |
826 | cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL, NULL); | 825 | cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); |
827 | if (ctx->env.authenticated) { | 826 | if (ctx.env.authenticated) { |
828 | html("</td><td class='form'>"); | 827 | html("</td><td class='form'>"); |
829 | html("<form method='get' action=''>\n"); | 828 | html("<form method='get' action=''>\n"); |
830 | cgit_add_hidden_formfields(0, 1, ctx->qry.page); | 829 | cgit_add_hidden_formfields(0, 1, ctx.qry.page); |
831 | html("<select name='h' onchange='this.form.submit();'>\n"); | 830 | html("<select name='h' onchange='this.form.submit();'>\n"); |
832 | for_each_branch_ref(print_branch_option, ctx->qry.head); | 831 | for_each_branch_ref(print_branch_option, ctx.qry.head); |
833 | html("</select> "); | 832 | html("</select> "); |
834 | html("<input type='submit' name='' value='switch'/>"); | 833 | html("<input type='submit' name='' value='switch'/>"); |
835 | html("</form>"); | 834 | html("</form>"); |
836 | } | 835 | } |
837 | } else | 836 | } else |
838 | html_txt(ctx->cfg.root_title); | 837 | html_txt(ctx.cfg.root_title); |
839 | html("</td></tr>\n"); | 838 | html("</td></tr>\n"); |
840 | 839 | ||
841 | html("<tr><td class='sub'>"); | 840 | html("<tr><td class='sub'>"); |
842 | if (ctx->repo) { | 841 | if (ctx.repo) { |
843 | html_txt(ctx->repo->desc); | 842 | html_txt(ctx.repo->desc); |
844 | html("</td><td class='sub right'>"); | 843 | html("</td><td class='sub right'>"); |
845 | html_txt(ctx->repo->owner); | 844 | html_txt(ctx.repo->owner); |
846 | } else { | 845 | } else { |
847 | if (ctx->cfg.root_desc) | 846 | if (ctx.cfg.root_desc) |
848 | html_txt(ctx->cfg.root_desc); | 847 | html_txt(ctx.cfg.root_desc); |
849 | else if (ctx->cfg.index_info) | 848 | else if (ctx.cfg.index_info) |
850 | html_include(ctx->cfg.index_info); | 849 | html_include(ctx.cfg.index_info); |
851 | } | 850 | } |
852 | html("</td></tr></table>\n"); | 851 | html("</td></tr></table>\n"); |
853 | } | 852 | } |
854 | 853 | ||
855 | void cgit_print_pageheader(struct cgit_context *ctx) | 854 | void cgit_print_pageheader(void) |
856 | { | 855 | { |
857 | html("<div id='cgit'>"); | 856 | html("<div id='cgit'>"); |
858 | if (!ctx->env.authenticated || !ctx->cfg.noheader) | 857 | if (!ctx.env.authenticated || !ctx.cfg.noheader) |
859 | print_header(ctx); | 858 | print_header(); |
860 | 859 | ||
861 | html("<table class='tabs'><tr><td>\n"); | 860 | html("<table class='tabs'><tr><td>\n"); |
862 | if (ctx->env.authenticated && ctx->repo) { | 861 | if (ctx.env.authenticated && ctx.repo) { |
863 | cgit_summary_link("summary", NULL, hc(ctx, "summary"), | 862 | cgit_summary_link("summary", NULL, hc("summary"), |
864 | ctx->qry.head); | 863 | ctx.qry.head); |
865 | cgit_refs_link("refs", NULL, hc(ctx, "refs"), ctx->qry.head, | 864 | cgit_refs_link("refs", NULL, hc("refs"), ctx.qry.head, |
866 | ctx->qry.sha1, NULL); | 865 | ctx.qry.sha1, NULL); |
867 | cgit_log_link("log", NULL, hc(ctx, "log"), ctx->qry.head, | 866 | cgit_log_link("log", NULL, hc("log"), ctx.qry.head, |
868 | NULL, ctx->qry.vpath, 0, NULL, NULL, | 867 | NULL, ctx.qry.vpath, 0, NULL, NULL, |
869 | ctx->qry.showmsg); | 868 | ctx.qry.showmsg); |
870 | cgit_tree_link("tree", NULL, hc(ctx, "tree"), ctx->qry.head, | 869 | cgit_tree_link("tree", NULL, hc("tree"), ctx.qry.head, |
871 | ctx->qry.sha1, ctx->qry.vpath); | 870 | ctx.qry.sha1, ctx.qry.vpath); |
872 | cgit_commit_link("commit", NULL, hc(ctx, "commit"), | 871 | cgit_commit_link("commit", NULL, hc("commit"), |
873 | ctx->qry.head, ctx->qry.sha1, ctx->qry.vpath, 0); | 872 | ctx.qry.head, ctx.qry.sha1, ctx.qry.vpath, 0); |
874 | cgit_diff_link("diff", NULL, hc(ctx, "diff"), ctx->qry.head, | 873 | cgit_diff_link("diff", NULL, hc("diff"), ctx.qry.head, |
875 | ctx->qry.sha1, ctx->qry.sha2, ctx->qry.vpath, 0); | 874 | ctx.qry.sha1, ctx.qry.sha2, ctx.qry.vpath, 0); |
876 | if (ctx->repo->max_stats) | 875 | if (ctx.repo->max_stats) |
877 | cgit_stats_link("stats", NULL, hc(ctx, "stats"), | 876 | cgit_stats_link("stats", NULL, hc("stats"), |
878 | ctx->qry.head, ctx->qry.vpath); | 877 | ctx.qry.head, ctx.qry.vpath); |
879 | if (ctx->repo->readme.nr) | 878 | if (ctx.repo->readme.nr) |
880 | reporevlink("about", "about", NULL, | 879 | reporevlink("about", "about", NULL, |
881 | hc(ctx, "about"), ctx->qry.head, NULL, | 880 | hc("about"), ctx.qry.head, NULL, |
882 | NULL); | 881 | NULL); |
883 | html("</td><td class='form'>"); | 882 | html("</td><td class='form'>"); |
884 | html("<form class='right' method='get' action='"); | 883 | html("<form class='right' method='get' action='"); |
885 | if (ctx->cfg.virtual_root) | 884 | if (ctx.cfg.virtual_root) |
886 | html_url_path(cgit_fileurl(ctx->qry.repo, "log", | 885 | html_url_path(cgit_fileurl(ctx.qry.repo, "log", |
887 | ctx->qry.vpath, NULL)); | 886 | ctx.qry.vpath, NULL)); |
888 | html("'>\n"); | 887 | html("'>\n"); |
889 | cgit_add_hidden_formfields(1, 0, "log"); | 888 | cgit_add_hidden_formfields(1, 0, "log"); |
890 | html("<select name='qt'>\n"); | 889 | html("<select name='qt'>\n"); |
891 | html_option("grep", "log msg", ctx->qry.grep); | 890 | html_option("grep", "log msg", ctx.qry.grep); |
892 | html_option("author", "author", ctx->qry.grep); | 891 | html_option("author", "author", ctx.qry.grep); |
893 | html_option("committer", "committer", ctx->qry.grep); | 892 | html_option("committer", "committer", ctx.qry.grep); |
894 | html_option("range", "range", ctx->qry.grep); | 893 | html_option("range", "range", ctx.qry.grep); |
895 | html("</select>\n"); | 894 | html("</select>\n"); |
896 | html("<input class='txt' type='text' size='10' name='q' value='"); | 895 | html("<input class='txt' type='text' size='10' name='q' value='"); |
897 | html_attr(ctx->qry.search); | 896 | html_attr(ctx.qry.search); |
898 | html("'/>\n"); | 897 | html("'/>\n"); |
899 | html("<input type='submit' value='search'/>\n"); | 898 | html("<input type='submit' value='search'/>\n"); |
900 | html("</form>\n"); | 899 | html("</form>\n"); |
901 | } else if (ctx->env.authenticated) { | 900 | } else if (ctx.env.authenticated) { |
902 | site_link(NULL, "index", NULL, hc(ctx, "repolist"), NULL, NULL, 0); | 901 | site_link(NULL, "index", NULL, hc("repolist"), NULL, NULL, 0); |
903 | if (ctx->cfg.root_readme) | 902 | if (ctx.cfg.root_readme) |
904 | site_link("about", "about", NULL, hc(ctx, "about"), | 903 | site_link("about", "about", NULL, hc("about"), |
905 | NULL, NULL, 0); | 904 | NULL, NULL, 0); |
906 | html("</td><td class='form'>"); | 905 | html("</td><td class='form'>"); |
907 | html("<form method='get' action='"); | 906 | html("<form method='get' action='"); |
908 | html_attr(cgit_rooturl()); | 907 | html_attr(cgit_rooturl()); |
909 | html("'>\n"); | 908 | html("'>\n"); |
910 | html("<input type='text' name='q' size='10' value='"); | 909 | html("<input type='text' name='q' size='10' value='"); |
911 | html_attr(ctx->qry.search); | 910 | html_attr(ctx.qry.search); |
912 | html("'/>\n"); | 911 | html("'/>\n"); |
913 | html("<input type='submit' value='search'/>\n"); | 912 | html("<input type='submit' value='search'/>\n"); |
914 | html("</form>"); | 913 | html("</form>"); |
915 | } | 914 | } |
916 | html("</td></tr></table>\n"); | 915 | html("</td></tr></table>\n"); |
917 | if (ctx->env.authenticated && ctx->qry.vpath) { | 916 | if (ctx.env.authenticated && ctx.qry.vpath) { |
918 | html("<div class='path'>"); | 917 | html("<div class='path'>"); |
919 | html("path: "); | 918 | html("path: "); |
920 | cgit_print_path_crumbs(ctx, ctx->qry.vpath); | 919 | cgit_print_path_crumbs(ctx.qry.vpath); |
921 | html("</div>"); | 920 | html("</div>"); |
922 | } | 921 | } |
923 | html("<div class='content'>"); | 922 | html("<div class='content'>"); |