summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
authorLars Hjemli <hjemli@gmail.com>2008-08-06 08:53:50 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-08-06 09:21:30 (UTC)
commite5da4bca54574522b28f88cab0dc8ebad9e35a73 (patch) (unidiff)
tree08e02b9e0962a12040faab27e7841a74a800ddf2 /ui-shared.c
parent02a545e63454530c1639014d3239c14ced2022c6 (diff)
downloadcgit-e5da4bca54574522b28f88cab0dc8ebad9e35a73.zip
cgit-e5da4bca54574522b28f88cab0dc8ebad9e35a73.tar.gz
cgit-e5da4bca54574522b28f88cab0dc8ebad9e35a73.tar.bz2
Implement plain view
This implements a way to access plain blobs by path (similar to the tree view) instead of by sha1. 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.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 197ee37..4408969 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -405,32 +405,34 @@ void cgit_print_age(time_t t, time_t max_relative, char *format)
405 if (secs < TM_YEAR * 2) { 405 if (secs < TM_YEAR * 2) {
406 htmlf("<span class='age-months'>%.0f months</span>", 406 htmlf("<span class='age-months'>%.0f months</span>",
407 secs * 1.0 / TM_MONTH); 407 secs * 1.0 / TM_MONTH);
408 return; 408 return;
409 } 409 }
410 htmlf("<span class='age-years'>%.0f years</span>", 410 htmlf("<span class='age-years'>%.0f years</span>",
411 secs * 1.0 / TM_YEAR); 411 secs * 1.0 / TM_YEAR);
412} 412}
413 413
414void cgit_print_http_headers(struct cgit_context *ctx) 414void cgit_print_http_headers(struct cgit_context *ctx)
415{ 415{
416 if (ctx->page.mimetype && ctx->page.charset) 416 if (ctx->page.mimetype && ctx->page.charset)
417 htmlf("Content-Type: %s; charset=%s\n", ctx->page.mimetype, 417 htmlf("Content-Type: %s; charset=%s\n", ctx->page.mimetype,
418 ctx->page.charset); 418 ctx->page.charset);
419 else if (ctx->page.mimetype) 419 else if (ctx->page.mimetype)
420 htmlf("Content-Type: %s\n", ctx->page.mimetype); 420 htmlf("Content-Type: %s\n", ctx->page.mimetype);
421 if (ctx->page.size)
422 htmlf("Content-Length: %ld\n", ctx->page.size);
421 if (ctx->page.filename) 423 if (ctx->page.filename)
422 htmlf("Content-Disposition: inline; filename=\"%s\"\n", 424 htmlf("Content-Disposition: inline; filename=\"%s\"\n",
423 ctx->page.filename); 425 ctx->page.filename);
424 htmlf("Last-Modified: %s\n", http_date(ctx->page.modified)); 426 htmlf("Last-Modified: %s\n", http_date(ctx->page.modified));
425 htmlf("Expires: %s\n", http_date(ctx->page.expires)); 427 htmlf("Expires: %s\n", http_date(ctx->page.expires));
426 html("\n"); 428 html("\n");
427} 429}
428 430
429void cgit_print_docstart(struct cgit_context *ctx) 431void cgit_print_docstart(struct cgit_context *ctx)
430{ 432{
431 html(cgit_doctype); 433 html(cgit_doctype);
432 html("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n"); 434 html("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n");
433 html("<head>\n"); 435 html("<head>\n");
434 html("<title>"); 436 html("<title>");
435 html_txt(ctx->page.title); 437 html_txt(ctx->page.title);
436 html("</title>\n"); 438 html("</title>\n");