summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
Side-by-side diff
Diffstat (limited to 'ui-shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-shared.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 2596023..aa65988 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -480,97 +480,112 @@ void cgit_print_pageheader(struct cgit_context *ctx)
ctx->cfg.logo);
html("</td></tr>\n<tr><td class='sidebar'>\n");
if (ctx->repo) {
html("<h1 class='first'>");
html_txt(strrpart(ctx->repo->name, 20));
html("</h1>\n");
html_txt(ctx->repo->desc);
if (ctx->repo->owner) {
html("<h1>owner</h1>\n");
html_txt(ctx->repo->owner);
}
html("<h1>navigate</h1>\n");
reporevlink(NULL, "summary", NULL, "menu", ctx->qry.head,
NULL, NULL);
cgit_log_link("log", NULL, "menu", ctx->qry.head, NULL, NULL,
0, NULL, NULL);
cgit_tree_link("tree", NULL, "menu", ctx->qry.head,
ctx->qry.sha1, NULL);
cgit_commit_link("commit", NULL, "menu", ctx->qry.head,
ctx->qry.sha1);
cgit_diff_link("diff", NULL, "menu", ctx->qry.head,
ctx->qry.sha1, ctx->qry.sha2, NULL);
cgit_patch_link("patch", NULL, "menu", ctx->qry.head,
ctx->qry.sha1);
for_each_ref(print_archive_ref, &header);
if (ctx->repo->clone_url || ctx->cfg.clone_prefix) {
html("<h1>clone</h1>\n");
if (ctx->repo->clone_url)
url = ctx->repo->clone_url;
else
url = fmt("%s%s", ctx->cfg.clone_prefix,
ctx->repo->url);
html("<a class='menu' href='");
html_attr(url);
html("' title='");
html_attr(url);
html("'>\n");
html_txt(strrpart(url, 20));
html("</a>\n");
}
html("<h1>branch</h1>\n");
html("<form method='get' action=''>\n");
add_hidden_formfields(0, 1, ctx->qry.page);
// html("<table summary='branch selector' class='grid'><tr><td id='branch-dropdown-cell'>");
html("<select name='h' onchange='this.form.submit();'>\n");
for_each_branch_ref(print_branch_option, ctx->qry.head);
html("</select>\n");
// html("</td><td>");
html("<noscript><input type='submit' id='switch-btn' value='switch'/></noscript>\n");
// html("</td></tr></table>");
html("</form>\n");
html("<h1>search</h1>\n");
html("<form method='get' action='");
if (ctx->cfg.virtual_root)
html_attr(cgit_fileurl(ctx->qry.repo, "log",
ctx->qry.path, NULL));
html("'>\n");
add_hidden_formfields(1, 0, "log");
html("<select name='qt'>\n");
html_option("grep", "log msg", ctx->qry.grep);
html_option("author", "author", ctx->qry.grep);
html_option("committer", "committer", ctx->qry.grep);
html("</select>\n");
html("<input class='txt' type='text' name='q' value='");
html_attr(ctx->qry.search);
html("'/>\n");
html("</form>\n");
} else {
if (!ctx->cfg.index_info || html_include(ctx->cfg.index_info))
html(default_info);
}
html("</td></tr></table></td>\n");
html("<td id='content'>\n");
}
void cgit_print_filemode(unsigned short mode)
{
if (S_ISDIR(mode))
html("d");
else if (S_ISLNK(mode))
html("l");
else if (S_ISGITLINK(mode))
html("m");
else
html("-");
html_fileperm(mode >> 6);
html_fileperm(mode >> 3);
html_fileperm(mode);
}
-/* vim:set sw=8: */
+void cgit_print_snapshot_links(const char *repo, const char *head,
+ const char *hex, int snapshots)
+{
+ const struct cgit_snapshot_format* f;
+ char *filename;
+
+ for (f = cgit_snapshot_formats; f->suffix; f++) {
+ if (!(snapshots & f->bit))
+ continue;
+ filename = fmt("%s-%s%s", cgit_repobasename(repo), hex,
+ f->suffix);
+ cgit_snapshot_link(filename, NULL, NULL, (char *)head,
+ (char *)hex, filename);
+ html("<br/>");
+ }
+}