summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
authorLars Hjemli <hjemli@gmail.com>2007-02-08 12:53:13 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-02-08 12:58:58 (UTC)
commitab2ab95f09994560f62fd631f07d3b6e3577aa6e (patch) (unidiff)
tree846763c1bcb78bd27dc37c99e5f6d703ca5ab179 /ui-shared.c
parent14d360df60f059b9b5b045fc6df1eec6f0966d9a (diff)
downloadcgit-ab2ab95f09994560f62fd631f07d3b6e3577aa6e.zip
cgit-ab2ab95f09994560f62fd631f07d3b6e3577aa6e.tar.gz
cgit-ab2ab95f09994560f62fd631f07d3b6e3577aa6e.tar.bz2
Add support for snapshots
Make a link from the commit viewer to a snapshot of the corresponding tree. Currently only zip-format is supported. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-shared.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 3322561..172499c 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -123,24 +123,35 @@ void cgit_print_pageheader(char *title, int show_search)
123 html("'>"); 123 html("'>");
124 if (!cgit_virtual_root) { 124 if (!cgit_virtual_root) {
125 if (cgit_query_repo) 125 if (cgit_query_repo)
126 html_hidden("r", cgit_query_repo); 126 html_hidden("r", cgit_query_repo);
127 if (cgit_query_page) 127 if (cgit_query_page)
128 html_hidden("p", cgit_query_page); 128 html_hidden("p", cgit_query_page);
129 } 129 }
130 if (cgit_query_head) 130 if (cgit_query_head)
131 html_hidden("h", cgit_query_head); 131 html_hidden("h", cgit_query_head);
132 if (cgit_query_sha1) 132 if (cgit_query_sha1)
133 html_hidden("id", cgit_query_sha1); 133 html_hidden("id", cgit_query_sha1);
134 if (cgit_query_sha2) 134 if (cgit_query_sha2)
135 html_hidden("id2", cgit_query_sha2); 135 html_hidden("id2", cgit_query_sha2);
136 html("<input type='text' name='q' value='"); 136 html("<input type='text' name='q' value='");
137 html_attr(cgit_query_search); 137 html_attr(cgit_query_search);
138 html("'/></form>"); 138 html("'/></form>");
139 } 139 }
140 if (cgit_query_repo) 140 if (cgit_query_repo)
141 htmlf("<a href='%s'>", cgit_repourl(cgit_query_repo)); 141 htmlf("<a href='%s'>", cgit_repourl(cgit_query_repo));
142 html_txt(title); 142 html_txt(title);
143 if (cgit_query_repo) 143 if (cgit_query_repo)
144 html("</a>"); 144 html("</a>");
145 html("</td></tr><tr><td id='content'>"); 145 html("</td></tr><tr><td id='content'>");
146} 146}
147
148void cgit_print_snapshot_start(const char *mimetype, const char *filename,
149 struct cacheitem *item)
150{
151 htmlf("Content-Type: %s\n", mimetype);
152 htmlf("Content-Disposition: inline; filename=\"%s\"\n", filename);
153 htmlf("Last-Modified: %s\n", http_date(item->st.st_mtime));
154 htmlf("Expires: %s\n", http_date(item->st.st_mtime +
155 ttl_seconds(item->ttl)));
156 html("\n");
157}