summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
Unidiff
Diffstat (limited to 'ui-shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-shared.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 8827fff..0f65474 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -693,96 +693,97 @@ static void print_header(struct cgit_context *ctx)
693 html_include(ctx->cfg.index_info); 693 html_include(ctx->cfg.index_info);
694 } 694 }
695 html("</td></tr></table>\n"); 695 html("</td></tr></table>\n");
696} 696}
697 697
698void cgit_print_pageheader(struct cgit_context *ctx) 698void cgit_print_pageheader(struct cgit_context *ctx)
699{ 699{
700 struct cgit_cmd *cmd = cgit_get_cmd(ctx); 700 struct cgit_cmd *cmd = cgit_get_cmd(ctx);
701 701
702 if (!cmd && ctx->repo) 702 if (!cmd && ctx->repo)
703 fallback_cmd = "summary"; 703 fallback_cmd = "summary";
704 704
705 html("<div id='cgit'>"); 705 html("<div id='cgit'>");
706 if (!ctx->cfg.noheader) 706 if (!ctx->cfg.noheader)
707 print_header(ctx); 707 print_header(ctx);
708 708
709 html("<table class='tabs'><tr><td>\n"); 709 html("<table class='tabs'><tr><td>\n");
710 if (ctx->repo) { 710 if (ctx->repo) {
711 cgit_summary_link("summary", NULL, hc(cmd, "summary"), 711 cgit_summary_link("summary", NULL, hc(cmd, "summary"),
712 ctx->qry.head); 712 ctx->qry.head);
713 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, 713 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head,
714 ctx->qry.sha1, NULL); 714 ctx->qry.sha1, NULL);
715 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, 715 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head,
716 NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg); 716 NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg);
717 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, 717 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head,
718 ctx->qry.sha1, NULL); 718 ctx->qry.sha1, NULL);
719 cgit_commit_link("commit", NULL, hc(cmd, "commit"), 719 cgit_commit_link("commit", NULL, hc(cmd, "commit"),
720 ctx->qry.head, ctx->qry.sha1, 0); 720 ctx->qry.head, ctx->qry.sha1, 0);
721 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, 721 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head,
722 ctx->qry.sha1, ctx->qry.sha2, NULL, 0); 722 ctx->qry.sha1, ctx->qry.sha2, NULL, 0);
723 if (ctx->repo->max_stats) 723 if (ctx->repo->max_stats)
724 cgit_stats_link("stats", NULL, hc(cmd, "stats"), 724 cgit_stats_link("stats", NULL, hc(cmd, "stats"),
725 ctx->qry.head, NULL); 725 ctx->qry.head, NULL);
726 if (ctx->repo->readme) 726 if (ctx->repo->readme)
727 reporevlink("about", "about", NULL, 727 reporevlink("about", "about", NULL,
728 hc(cmd, "about"), ctx->qry.head, NULL, 728 hc(cmd, "about"), ctx->qry.head, NULL,
729 NULL); 729 NULL);
730 html("</td><td class='form'>"); 730 html("</td><td class='form'>");
731 html("<form class='right' method='get' action='"); 731 html("<form class='right' method='get' action='");
732 if (ctx->cfg.virtual_root) 732 if (ctx->cfg.virtual_root)
733 html_url_path(cgit_fileurl(ctx->qry.repo, "log", 733 html_url_path(cgit_fileurl(ctx->qry.repo, "log",
734 ctx->qry.path, NULL)); 734 ctx->qry.path, NULL));
735 html("'>\n"); 735 html("'>\n");
736 cgit_add_hidden_formfields(1, 0, "log"); 736 cgit_add_hidden_formfields(1, 0, "log");
737 html("<select name='qt'>\n"); 737 html("<select name='qt'>\n");
738 html_option("grep", "log msg", ctx->qry.grep); 738 html_option("grep", "log msg", ctx->qry.grep);
739 html_option("author", "author", ctx->qry.grep); 739 html_option("author", "author", ctx->qry.grep);
740 html_option("committer", "committer", ctx->qry.grep); 740 html_option("committer", "committer", ctx->qry.grep);
741 html_option("range", "range", ctx->qry.grep);
741 html("</select>\n"); 742 html("</select>\n");
742 html("<input class='txt' type='text' size='10' name='q' value='"); 743 html("<input class='txt' type='text' size='10' name='q' value='");
743 html_attr(ctx->qry.search); 744 html_attr(ctx->qry.search);
744 html("'/>\n"); 745 html("'/>\n");
745 html("<input type='submit' value='search'/>\n"); 746 html("<input type='submit' value='search'/>\n");
746 html("</form>\n"); 747 html("</form>\n");
747 } else { 748 } else {
748 site_link(NULL, "index", NULL, hc(cmd, "repolist"), NULL, 0); 749 site_link(NULL, "index", NULL, hc(cmd, "repolist"), NULL, 0);
749 if (ctx->cfg.root_readme) 750 if (ctx->cfg.root_readme)
750 site_link("about", "about", NULL, hc(cmd, "about"), 751 site_link("about", "about", NULL, hc(cmd, "about"),
751 NULL, 0); 752 NULL, 0);
752 html("</td><td class='form'>"); 753 html("</td><td class='form'>");
753 html("<form method='get' action='"); 754 html("<form method='get' action='");
754 html_attr(cgit_rooturl()); 755 html_attr(cgit_rooturl());
755 html("'>\n"); 756 html("'>\n");
756 html("<input type='text' name='q' size='10' value='"); 757 html("<input type='text' name='q' size='10' value='");
757 html_attr(ctx->qry.search); 758 html_attr(ctx->qry.search);
758 html("'/>\n"); 759 html("'/>\n");
759 html("<input type='submit' value='search'/>\n"); 760 html("<input type='submit' value='search'/>\n");
760 html("</form>"); 761 html("</form>");
761 } 762 }
762 html("</td></tr></table>\n"); 763 html("</td></tr></table>\n");
763 html("<div class='content'>"); 764 html("<div class='content'>");
764} 765}
765 766
766void cgit_print_filemode(unsigned short mode) 767void cgit_print_filemode(unsigned short mode)
767{ 768{
768 if (S_ISDIR(mode)) 769 if (S_ISDIR(mode))
769 html("d"); 770 html("d");
770 else if (S_ISLNK(mode)) 771 else if (S_ISLNK(mode))
771 html("l"); 772 html("l");
772 else if (S_ISGITLINK(mode)) 773 else if (S_ISGITLINK(mode))
773 html("m"); 774 html("m");
774 else 775 else
775 html("-"); 776 html("-");
776 html_fileperm(mode >> 6); 777 html_fileperm(mode >> 6);
777 html_fileperm(mode >> 3); 778 html_fileperm(mode >> 3);
778 html_fileperm(mode); 779 html_fileperm(mode);
779} 780}
780 781
781void cgit_print_snapshot_links(const char *repo, const char *head, 782void cgit_print_snapshot_links(const char *repo, const char *head,
782 const char *hex, int snapshots) 783 const char *hex, int snapshots)
783{ 784{
784 const struct cgit_snapshot_format* f; 785 const struct cgit_snapshot_format* f;
785 char *prefix; 786 char *prefix;
786 char *filename; 787 char *filename;
787 unsigned char sha1[20]; 788 unsigned char sha1[20];
788 789