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
@@ -528,49 +528,64 @@ void cgit_print_pageheader(struct cgit_context *ctx)
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/>");
+ }
+}