summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
authorLars Hjemli <hjemli@gmail.com>2007-07-22 22:11:15 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-07-22 22:27:32 (UTC)
commiteb45342e735818b3c68cbab9b61b23e79ae74418 (patch) (unidiff)
tree43fed08927a2118a22cf686ee58b8d464233cd5d /ui-shared.c
parent1d4aaff696ee1b9085dda0f0f3d84d9d20d96db0 (diff)
downloadcgit-eb45342e735818b3c68cbab9b61b23e79ae74418.zip
cgit-eb45342e735818b3c68cbab9b61b23e79ae74418.tar.gz
cgit-eb45342e735818b3c68cbab9b61b23e79ae74418.tar.bz2
cgit_print_snapshot_links: use url to specify snapshot name
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.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c
index ca2ee82..5c5bcf3 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -182,96 +182,102 @@ static void reporevlink(char *page, char *name, char *title, char *class,
182 html("id="); 182 html("id=");
183 html_attr(rev); 183 html_attr(rev);
184 } 184 }
185 html("'>"); 185 html("'>");
186 html_txt(name); 186 html_txt(name);
187 html("</a>"); 187 html("</a>");
188} 188}
189 189
190void cgit_tree_link(char *name, char *title, char *class, char *head, 190void cgit_tree_link(char *name, char *title, char *class, char *head,
191 char *rev, char *path) 191 char *rev, char *path)
192{ 192{
193 reporevlink("tree", name, title, class, head, rev, path); 193 reporevlink("tree", name, title, class, head, rev, path);
194} 194}
195 195
196void cgit_log_link(char *name, char *title, char *class, char *head, 196void cgit_log_link(char *name, char *title, char *class, char *head,
197 char *rev, char *path, int ofs) 197 char *rev, char *path, int ofs)
198{ 198{
199 char *delim; 199 char *delim;
200 200
201 delim = repolink(title, class, "log", head, path); 201 delim = repolink(title, class, "log", head, path);
202 if (rev && strcmp(rev, cgit_query_head)) { 202 if (rev && strcmp(rev, cgit_query_head)) {
203 html(delim); 203 html(delim);
204 html("id="); 204 html("id=");
205 html_attr(rev); 205 html_attr(rev);
206 delim = "&"; 206 delim = "&";
207 } 207 }
208 if (ofs > 0) { 208 if (ofs > 0) {
209 html(delim); 209 html(delim);
210 html("ofs="); 210 html("ofs=");
211 htmlf("%d", ofs); 211 htmlf("%d", ofs);
212 } 212 }
213 html("'>"); 213 html("'>");
214 html_txt(name); 214 html_txt(name);
215 html("</a>"); 215 html("</a>");
216} 216}
217 217
218void cgit_commit_link(char *name, char *title, char *class, char *head, 218void cgit_commit_link(char *name, char *title, char *class, char *head,
219 char *rev) 219 char *rev)
220{ 220{
221 if (strlen(name) > cgit_max_msg_len && cgit_max_msg_len >= 15) { 221 if (strlen(name) > cgit_max_msg_len && cgit_max_msg_len >= 15) {
222 name[cgit_max_msg_len] = '\0'; 222 name[cgit_max_msg_len] = '\0';
223 name[cgit_max_msg_len - 1] = '.'; 223 name[cgit_max_msg_len - 1] = '.';
224 name[cgit_max_msg_len - 2] = '.'; 224 name[cgit_max_msg_len - 2] = '.';
225 name[cgit_max_msg_len - 3] = '.'; 225 name[cgit_max_msg_len - 3] = '.';
226 } 226 }
227 reporevlink("commit", name, title, class, head, rev, NULL); 227 reporevlink("commit", name, title, class, head, rev, NULL);
228} 228}
229 229
230void cgit_snapshot_link(char *name, char *title, char *class, char *head,
231 char *rev, char *archivename)
232{
233 reporevlink("snapshot", name, title, class, head, rev, archivename);
234}
235
230void cgit_diff_link(char *name, char *title, char *class, char *head, 236void cgit_diff_link(char *name, char *title, char *class, char *head,
231 char *new_rev, char *old_rev, char *path) 237 char *new_rev, char *old_rev, char *path)
232{ 238{
233 char *delim; 239 char *delim;
234 240
235 delim = repolink(title, class, "diff", head, path); 241 delim = repolink(title, class, "diff", head, path);
236 if (new_rev && strcmp(new_rev, cgit_query_head)) { 242 if (new_rev && strcmp(new_rev, cgit_query_head)) {
237 html(delim); 243 html(delim);
238 html("id="); 244 html("id=");
239 html_attr(new_rev); 245 html_attr(new_rev);
240 delim = "&amp;"; 246 delim = "&amp;";
241 } 247 }
242 if (old_rev) { 248 if (old_rev) {
243 html(delim); 249 html(delim);
244 html("id2="); 250 html("id2=");
245 html_attr(old_rev); 251 html_attr(old_rev);
246 } 252 }
247 html("'>"); 253 html("'>");
248 html_txt(name); 254 html_txt(name);
249 html("</a>"); 255 html("</a>");
250} 256}
251 257
252void cgit_object_link(struct object *obj) 258void cgit_object_link(struct object *obj)
253{ 259{
254 char *page, *arg, *url; 260 char *page, *arg, *url;
255 261
256 if (obj->type == OBJ_COMMIT) { 262 if (obj->type == OBJ_COMMIT) {
257 cgit_commit_link(fmt("commit %s", sha1_to_hex(obj->sha1)), NULL, NULL, 263 cgit_commit_link(fmt("commit %s", sha1_to_hex(obj->sha1)), NULL, NULL,
258 cgit_query_head, sha1_to_hex(obj->sha1)); 264 cgit_query_head, sha1_to_hex(obj->sha1));
259 return; 265 return;
260 } else if (obj->type == OBJ_TREE) { 266 } else if (obj->type == OBJ_TREE) {
261 page = "tree"; 267 page = "tree";
262 arg = "id"; 268 arg = "id";
263 } else { 269 } else {
264 page = "blob"; 270 page = "blob";
265 arg = "id"; 271 arg = "id";
266 } 272 }
267 273
268 url = cgit_pageurl(cgit_query_repo, page, 274 url = cgit_pageurl(cgit_query_repo, page,
269 fmt("%s=%s", arg, sha1_to_hex(obj->sha1))); 275 fmt("%s=%s", arg, sha1_to_hex(obj->sha1)));
270 html_link_open(url, NULL, NULL); 276 html_link_open(url, NULL, NULL);
271 htmlf("%s %s", typename(obj->type), 277 htmlf("%s %s", typename(obj->type),
272 sha1_to_hex(obj->sha1)); 278 sha1_to_hex(obj->sha1));
273 html_link_close(); 279 html_link_close();
274} 280}
275 281
276void cgit_print_date(time_t secs, char *format) 282void cgit_print_date(time_t secs, char *format)
277{ 283{