+static void print_header(void)
+{
+ char *logo = NULL, *logo_link = NULL;
+
+ html("<table id='header'>\n");
+ html("<tr>\n");
+
+ if (ctx.repo && ctx.repo->logo && *ctx.repo->logo)
+ logo = ctx.repo->logo;
+ else
+ logo = ctx.cfg.logo;
+ if (ctx.repo && ctx.repo->logo_link && *ctx.repo->logo_link)
+ logo_link = ctx.repo->logo_link;
+ else
+ logo_link = ctx.cfg.logo_link;
+ if (logo && *logo) {
+ html("<td class='logo' rowspan='2'><a href='");
+ if (logo_link && *logo_link)
+ html_attr(logo_link);
+ else
+ html_attr(cgit_rooturl());
+ html("'><img src='");
+ html_attr(logo);
+ html("' alt='cgit logo'/></a></td>\n");
+ }
+
+ html("<td class='main'>");
+ if (ctx.repo) {
+ cgit_index_link("index", NULL, NULL, NULL, NULL, 0, 1);
+ html(" : ");
+ cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL);
+ if (ctx.env.authenticated) {
+ html("</td><td class='form'>");
+ html("<form method='get' action=''>\n");
+ cgit_add_hidden_formfields(0, 1, ctx.qry.page);
+ html("<select name='h' onchange='this.form.submit();'>\n");
+ for_each_branch_ref(print_branch_option, ctx.qry.head);
+ html("</select> ");
+ html("<input type='submit' name='' value='switch'/>");
+ html("</form>");
+ }
+ } else
+ html_txt(ctx.cfg.root_title);
+ html("</td></tr>\n");
+
+ html("<tr><td class='sub'>");
+ if (ctx.repo) {
+ html_txt(ctx.repo->desc);
+ html("</td><td class='sub right'>");
+ html_txt(ctx.repo->owner);
+ } else {
+ if (ctx.cfg.root_desc)
+ html_txt(ctx.cfg.root_desc);
+ else if (ctx.cfg.index_info)
+ html_include(ctx.cfg.index_info);
+ }
+ html("</td></tr></table>\n");
+}
+
+void cgit_print_pageheader(void)
+{
+ html("<div id='cgit'>");
+ if (!ctx.env.authenticated || !ctx.cfg.noheader)
+ print_header();
+
+ html("<table class='tabs'><tr><td>\n");
+ if (ctx.env.authenticated && ctx.repo) {
+ if (ctx.repo->readme.nr)
+ reporevlink("about", "about", NULL,
+ hc("about"), ctx.qry.head, NULL,
+ NULL);
+ cgit_summary_link("summary", NULL, hc("summary"),
+ ctx.qry.head);
+ cgit_refs_link("refs", NULL, hc("refs"), ctx.qry.head,
+ ctx.qry.sha1, NULL);
+ cgit_log_link("log", NULL, hc("log"), ctx.qry.head,
+ NULL, ctx.qry.vpath, 0, NULL, NULL,
+ ctx.qry.showmsg);
+ cgit_tree_link("tree", NULL, hc("tree"), ctx.qry.head,
+ ctx.qry.sha1, ctx.qry.vpath);
+ cgit_commit_link("commit", NULL, hc("commit"),
+ ctx.qry.head, ctx.qry.sha1, ctx.qry.vpath);
+ cgit_diff_link("diff", NULL, hc("diff"), ctx.qry.head,
+ ctx.qry.sha1, ctx.qry.sha2, ctx.qry.vpath);
+ if (ctx.repo->max_stats)
+ cgit_stats_link("stats", NULL, hc("stats"),
+ ctx.qry.head, ctx.qry.vpath);
+ html("</td><td class='form'>");
+ html("<form class='right' method='get' action='");
+ if (ctx.cfg.virtual_root)
+ html_url_path(cgit_fileurl(ctx.qry.repo, "log",
+ ctx.qry.vpath, NULL));