author | Lars Hjemli <hjemli@gmail.com> | 2006-12-15 23:33:28 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2006-12-15 23:33:28 (UTC) |
commit | 148fb9622c6a96021e572d1a372e38896506031f (patch) (unidiff) | |
tree | 2bfde276f3fed3b3a42afbdd90a64c98d0502ae3 /ui-shared.c | |
parent | 9a8f88658d51aeb86a79ac1121de13562ad2601f (diff) | |
download | cgit-148fb9622c6a96021e572d1a372e38896506031f.zip cgit-148fb9622c6a96021e572d1a372e38896506031f.tar.gz cgit-148fb9622c6a96021e572d1a372e38896506031f.tar.bz2 |
Move cgit_print_date into ui-shared, reuse in ui-summary
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-shared.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c index cb8a8df..1a6c127 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -39,48 +39,60 @@ void cgit_print_error(char *msg) | |||
39 | html_txt(msg); | 39 | html_txt(msg); |
40 | html("</div>\n"); | 40 | html("</div>\n"); |
41 | } | 41 | } |
42 | 42 | ||
43 | char *cgit_repourl(const char *reponame) | 43 | char *cgit_repourl(const char *reponame) |
44 | { | 44 | { |
45 | if (cgit_virtual_root) { | 45 | if (cgit_virtual_root) { |
46 | return fmt("%s/%s/", cgit_virtual_root, reponame); | 46 | return fmt("%s/%s/", cgit_virtual_root, reponame); |
47 | } else { | 47 | } else { |
48 | return fmt("?r=%s", reponame); | 48 | return fmt("?r=%s", reponame); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | char *cgit_pageurl(const char *reponame, const char *pagename, | 52 | char *cgit_pageurl(const char *reponame, const char *pagename, |
53 | const char *query) | 53 | const char *query) |
54 | { | 54 | { |
55 | if (cgit_virtual_root) { | 55 | if (cgit_virtual_root) { |
56 | return fmt("%s/%s/%s/?%s", cgit_virtual_root, reponame, | 56 | return fmt("%s/%s/%s/?%s", cgit_virtual_root, reponame, |
57 | pagename, query); | 57 | pagename, query); |
58 | } else { | 58 | } else { |
59 | return fmt("?r=%s&p=%s&%s", reponame, pagename, query); | 59 | return fmt("?r=%s&p=%s&%s", reponame, pagename, query); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | |||
64 | void cgit_print_date(unsigned long secs) | ||
65 | { | ||
66 | char buf[32]; | ||
67 | struct tm *time; | ||
68 | |||
69 | time = gmtime(&secs); | ||
70 | strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", time); | ||
71 | html_txt(buf); | ||
72 | |||
73 | } | ||
74 | |||
63 | void cgit_print_docstart(char *title, struct cacheitem *item) | 75 | void cgit_print_docstart(char *title, struct cacheitem *item) |
64 | { | 76 | { |
65 | html("Content-Type: text/html; charset=utf-8\n"); | 77 | html("Content-Type: text/html; charset=utf-8\n"); |
66 | htmlf("Last-Modified: %s\n", http_date(item->st.st_mtime)); | 78 | htmlf("Last-Modified: %s\n", http_date(item->st.st_mtime)); |
67 | htmlf("Expires: %s\n", http_date(item->st.st_mtime + | 79 | htmlf("Expires: %s\n", http_date(item->st.st_mtime + |
68 | ttl_seconds(item->ttl))); | 80 | ttl_seconds(item->ttl))); |
69 | html("\n"); | 81 | html("\n"); |
70 | html(cgit_doctype); | 82 | html(cgit_doctype); |
71 | html("<html>\n"); | 83 | html("<html>\n"); |
72 | html("<head>\n"); | 84 | html("<head>\n"); |
73 | html("<title>"); | 85 | html("<title>"); |
74 | html_txt(title); | 86 | html_txt(title); |
75 | html("</title>\n"); | 87 | html("</title>\n"); |
76 | htmlf("<meta name='generator' content='cgit v%s'/>\n", cgit_version); | 88 | htmlf("<meta name='generator' content='cgit v%s'/>\n", cgit_version); |
77 | html("<link rel='stylesheet' type='text/css' href='"); | 89 | html("<link rel='stylesheet' type='text/css' href='"); |
78 | html_attr(cgit_css); | 90 | html_attr(cgit_css); |
79 | html("'/>\n"); | 91 | html("'/>\n"); |
80 | html("</head>\n"); | 92 | html("</head>\n"); |
81 | html("<body>\n"); | 93 | html("<body>\n"); |
82 | } | 94 | } |
83 | 95 | ||
84 | void cgit_print_docend() | 96 | void cgit_print_docend() |
85 | { | 97 | { |
86 | html("</body>\n</html>\n"); | 98 | html("</body>\n</html>\n"); |