summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.css190
-rw-r--r--cgit.h7
-rw-r--r--cgit.pngbin5406 -> 1840 bytes
-rw-r--r--ui-commit.c14
-rw-r--r--ui-repolist.c51
-rw-r--r--ui-shared.c154
-rw-r--r--ui-shared.h2
7 files changed, 238 insertions, 180 deletions
diff --git a/cgit.css b/cgit.css
index 17c2712..8f3d00c 100644
--- a/cgit.css
+++ b/cgit.css
@@ -8,148 +8,147 @@ body {
8 font-size: 10pt; 8 font-size: 10pt;
9 color: #333; 9 color: #333;
10 background: white; 10 background: white;
11 padding: 4px; 11 padding: 4px;
12} 12}
13 13
14a {
15 color: blue;
16 text-decoration: none;
17}
18
19a:hover {
20 text-decoration: underline;
21}
22
14table { 23table {
15 border-collapse: collapse; 24 border-collapse: collapse;
16} 25}
17 26
18h2 { 27table#header {
19 font-size: 120%; 28 width: 100%;
20 font-weight: bold; 29 margin-bottom: 1em;
21 margin-top: 0em;
22 margin-bottom: 0.25em;
23} 30}
24 31
25h3 { 32table#header td.logo {
26 margin-top: 0em; 33 width: 96px;
27 font-size: 100%;
28 font-weight: normal;
29} 34}
30 35
31h4 { 36table#header td.main {
32 margin-top: 1.5em; 37 font-size: 250%;
33 margin-bottom: 0.1em; 38 padding-left: 10px;
34 font-size: 100%;
35 font-weight: bold;
36} 39}
37 40
38a { 41table#header td.main a {
39 color: #600; 42 color: #000;
40 text-decoration: none;
41} 43}
42 44
43a:hover { 45table#header td.form {
44 background-color: #ddd; 46 text-align: right;
45 text-decoration: none; 47 vertical-align: bottom;
48 padding-right: 1em;
49 padding-bottom: 2px;
46} 50}
47 51
48table.list { 52table#header td.form form,
49 border: none; 53table#header td.form input,
50 border-collapse: collapse; 54table#header td.form select {
55 font-size: 90%;
51} 56}
52 57
53table.list tr { 58table#header td.sub {
54 background: white; 59 color: #777;
60 border-top: solid 1px #ccc;
61 padding-left: 10px;
55} 62}
56 63
57table.list tr:hover { 64table.tabs {
58 background: #f8f8f8; 65 /* border-bottom: solid 2px #ccc; */
66 border-collapse: collapse;
67 margin-top: 2em;
68 margin-bottom: 0px;
69 width: 100%;
59} 70}
60 71
61table.list tr.nohover:hover { 72table.tabs td {
62 background: white; 73 padding: 0px 1em;
74 vertical-align: bottom;
63} 75}
64 76
65table.list th { 77table.tabs td a {
66 font-weight: bold; 78 padding: 2px 0.75em;
67 border-bottom: solid 1px #777; 79 color: #777;
68 padding: 0.1em 0.5em 0.1em 0.5em; 80 font-size: 110%;
69 vertical-align: baseline;
70} 81}
71 82
72table.list td { 83table.tabs td a.active {
73 border: none; 84 color: #000;
74 padding: 0.1em 0.5em 0.1em 0.5em; 85 background-color: #ccc;
75} 86}
76 87
77img { 88table.tabs td.form {
78 border: none; 89 text-align: right;
79} 90}
80 91
81table#layout { 92table.tabs td.form form {
82 border-collapse: collapse; 93 padding-bottom: 2px;
83 border: none; 94 font-size: 90%;
84 margin: 0px;
85} 95}
86 96
87td#sidebar { 97table.tabs td.form input,
88 vertical-align: top; 98table.tabs td.form select {
89 width: 162px; 99 font-size: 90%;
90 padding: 0px 0px 0px 0px;
91 margin: 0px;
92} 100}
93 101
94td#sidebar table { 102div.content {
95 border-collapse: separate;
96 border-spacing: 0px;
97 margin: 0px; 103 margin: 0px;
98 padding: 0px; 104 padding: 2em;
99 background-color: #ccc; 105 border-top: solid 3px #ccc;
106 border-bottom: solid 3px #ccc;
100} 107}
101 108
102td#sidebar table.sidebar td.sidebar { 109
103 padding: 4px; 110table.list {
104 border-top: solid 1px #eee; 111 width: 100%;
105 border-left: solid 1px #eee; 112 border: none;
106 border-right: solid 1px #aaa; 113 border-collapse: collapse;
107 border-bottom: solid 1px #aaa;
108} 114}
109 115
110div#logo { 116table.list tr {
111 margin: 0px; 117 background: white;
112 padding: 4px 0px 4px 0px;
113 text-align: center;
114 background-color: #ccc;
115 border-top: solid 1px #eee;
116 border-left: solid 1px #eee;
117 border-right: solid 1px #aaa;
118 border-bottom: solid 1px #aaa;
119} 118}
120 119
121td#sidebar h1 { 120table.list tr:hover {
122 font-size: 10pt; 121 background: #eee;
123 font-weight: bold;
124 margin: 8px 0px 0px 0px;
125} 122}
126 123
127td#sidebar h1.first { 124table.list tr.nohover:hover {
128 margin-top: 0px; 125 background: white;
129} 126}
130 127
131td#sidebar a.menu { 128table.list th {
132 display: block; 129 font-weight: bold;
133 background-color: #ccc; 130 /* color: #888;
134 padding: 0.1em 0.5em; 131 border-top: dashed 1px #888;
135 text-decoration: none; 132 border-bottom: dashed 1px #888;
133 */
134 padding: 0.1em 0.5em 0.05em 0.5em;
135 vertical-align: baseline;
136} 136}
137 137
138td#sidebar a.menu:hover { 138table.list td {
139 background-color: #bbb; 139 border: none;
140 text-decoration: none; 140 padding: 0.1em 0.5em 0.1em 0.5em;
141} 141}
142 142
143td#sidebar select { 143table.list td a {
144 width: 100%; 144 color: black;
145 margin: 2px 0px 0px 0px;
146} 145}
147 146
148td#sidebar form { 147img {
149 text-align: right; 148 border: none;
150} 149}
151 150
152input#switch-btn { 151input#switch-btn {
153 margin: 2px 0px 0px 0px; 152 margin: 2px 0px 0px 0px;
154} 153}
155 154
@@ -198,20 +197,19 @@ div.error {
198a.ls-blob, a.ls-dir, a.ls-mod { 197a.ls-blob, a.ls-dir, a.ls-mod {
199 font-family: monospace; 198 font-family: monospace;
200} 199}
201 200
202td.ls-size { 201td.ls-size {
203 text-align: right; 202 text-align: right;
204}
205
206td.ls-size {
207 font-family: monospace; 203 font-family: monospace;
204 width: 10em;
208} 205}
209 206
210td.ls-mode { 207td.ls-mode {
211 font-family: monospace; 208 font-family: monospace;
209 width: 10em;
212} 210}
213 211
214table.blob { 212table.blob {
215 margin-top: 0.5em; 213 margin-top: 0.5em;
216 border-top: solid 1px black; 214 border-top: solid 1px black;
217} 215}
@@ -354,13 +352,13 @@ table.diff td {
354 white-space: pre; 352 white-space: pre;
355} 353}
356 354
357table.diff td div.head { 355table.diff td div.head {
358 font-weight: bold; 356 font-weight: bold;
359 margin-top: 1em; 357 margin-top: 1em;
360 background-color: #eee; 358 color: black;
361} 359}
362 360
363table.diff td div.hunk { 361table.diff td div.hunk {
364 color: #009; 362 color: #009;
365} 363}
366 364
@@ -389,23 +387,23 @@ table.list td.repogroup {
389 font-style: italic; 387 font-style: italic;
390 color: #888; 388 color: #888;
391} 389}
392 390
393a.button { 391a.button {
394 font-size: 80%; 392 font-size: 80%;
395 color: #aaa; 393 color: #33c;
394/*
396 background-color: #eee; 395 background-color: #eee;
397 border: solid 1px #aaa; 396 border: solid 1px #aaa;
398 padding: 0em 0.5em;
399 margin: 0.1em 0.25em; 397 margin: 0.1em 0.25em;
398*/
399 padding: 0em 0.5em;
400} 400}
401 401
402a.button:hover { 402a.button:hover {
403 text-decoration: none; 403 text-decoration: underline;
404 color: #333;
405 background-color: #ccc;
406} 404}
407 405
408a.primary { 406a.primary {
409 font-size: 100%; 407 font-size: 100%;
410} 408}
411 409
diff --git a/cgit.h b/cgit.h
index ee8c716..a3b6535 100644
--- a/cgit.h
+++ b/cgit.h
@@ -218,7 +218,14 @@ extern struct taginfo *cgit_parse_tag(struct tag *tag);
218extern void cgit_parse_url(const char *url); 218extern void cgit_parse_url(const char *url);
219 219
220extern const char *cgit_repobasename(const char *reponame); 220extern const char *cgit_repobasename(const char *reponame);
221 221
222extern int cgit_parse_snapshots_mask(const char *str); 222extern int cgit_parse_snapshots_mask(const char *str);
223 223
224/* libgit.a either links against or compiles its own implementation of
225 * strcasestr(), and we'd like to reuse it. Simply re-declaring it
226 * seems to do the trick.
227 */
228extern char *strcasestr(const char *haystack, const char *needle);
229
230
224#endif /* CGIT_H */ 231#endif /* CGIT_H */
diff --git a/cgit.png b/cgit.png
index 22f7e95..d7f70bc 100644
--- a/cgit.png
+++ b/cgit.png
Binary files differ
diff --git a/ui-commit.c b/ui-commit.c
index 8019e36..dd36cc0 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -6,12 +6,13 @@
6 * (see COPYING for full license text) 6 * (see COPYING for full license text)
7 */ 7 */
8 8
9#include "cgit.h" 9#include "cgit.h"
10#include "html.h" 10#include "html.h"
11#include "ui-shared.h" 11#include "ui-shared.h"
12#include "ui-diff.h"
12 13
13static int files, slots; 14static int files, slots;
14static int total_adds, total_rems, max_changes; 15static int total_adds, total_rems, max_changes;
15static int lines_added, lines_removed; 16static int lines_added, lines_removed;
16static char *curr_rev; 17static char *curr_rev;
17 18
@@ -171,12 +172,18 @@ void cgit_print_commit(char *hex)
171 html_txt(info->committer); 172 html_txt(info->committer);
172 html(" "); 173 html(" ");
173 html_txt(info->committer_email); 174 html_txt(info->committer_email);
174 html("</td><td class='right'>"); 175 html("</td><td class='right'>");
175 cgit_print_date(info->committer_date, FMT_LONGDATE); 176 cgit_print_date(info->committer_date, FMT_LONGDATE);
176 html("</td></tr>\n"); 177 html("</td></tr>\n");
178 html("<tr><th>commit</th><td colspan='2' class='sha1'>");
179 tmp = sha1_to_hex(commit->object.sha1);
180 cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp);
181 html(" (");
182 cgit_patch_link("patch", NULL, NULL, NULL, tmp);
183 html(")</td></tr>\n");
177 html("<tr><th>tree</th><td colspan='2' class='sha1'>"); 184 html("<tr><th>tree</th><td colspan='2' class='sha1'>");
178 tmp = xstrdup(hex); 185 tmp = xstrdup(hex);
179 cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL, 186 cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL,
180 ctx.qry.head, tmp, NULL); 187 ctx.qry.head, tmp, NULL);
181 html("</td></tr>\n"); 188 html("</td></tr>\n");
182 for (p = commit->parents; p ; p = p->next) { 189 for (p = commit->parents; p ; p = p->next) {
@@ -215,14 +222,15 @@ void cgit_print_commit(char *hex)
215 max_changes = 0; 222 max_changes = 0;
216 cgit_diff_commit(commit, inspect_filepair); 223 cgit_diff_commit(commit, inspect_filepair);
217 for(i = 0; i<files; i++) 224 for(i = 0; i<files; i++)
218 print_fileinfo(&items[i]); 225 print_fileinfo(&items[i]);
219 html("</table>"); 226 html("</table>");
220 html("<div class='diffstat-summary'>"); 227 html("<div class='diffstat-summary'>");
221 htmlf("%d files changed, %d insertions, %d deletions (", 228 htmlf("%d files changed, %d insertions, %d deletions",
222 files, total_adds, total_rems); 229 files, total_adds, total_rems);
223 cgit_diff_link("show diff", NULL, NULL, ctx.qry.head, hex, 230 cgit_print_diff(ctx.qry.sha1,
224 NULL, NULL); 231 sha1_to_hex(commit->parents->item->object.sha1),
232 NULL);
225 html(")</div>"); 233 html(")</div>");
226 } 234 }
227 cgit_free_commitinfo(info); 235 cgit_free_commitinfo(info);
228} 236}
diff --git a/ui-repolist.c b/ui-repolist.c
index eeeaf3d..7a7e95a 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -41,43 +41,66 @@ static void print_modtime(struct cgit_repo *repo)
41 path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch); 41 path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch);
42 if (stat(path, &s) != 0) 42 if (stat(path, &s) != 0)
43 return; 43 return;
44 cgit_print_age(s.st_mtime, -1, NULL); 44 cgit_print_age(s.st_mtime, -1, NULL);
45} 45}
46 46
47void cgit_print_repolist() 47int is_match(struct cgit_repo *repo)
48{ 48{
49 int i, columns = 4; 49 if (!ctx.qry.search)
50 char *last_group = NULL; 50 return 1;
51 51 if (repo->url && strcasestr(repo->url, ctx.qry.search))
52 if (ctx.cfg.enable_index_links) 52 return 1;
53 columns++; 53 if (repo->name && strcasestr(repo->name, ctx.qry.search))
54 54 return 1;
55 ctx.page.title = ctx.cfg.root_title; 55 if (repo->desc && strcasestr(repo->desc, ctx.qry.search))
56 cgit_print_http_headers(&ctx); 56 return 1;
57 cgit_print_docstart(&ctx); 57 if (repo->owner && strcasestr(repo->owner, ctx.qry.search))
58 cgit_print_pageheader(&ctx); 58 return 1;
59 return 0;
60}
59 61
60 html("<table summary='repository list' class='list nowrap'>"); 62void print_header(int columns)
63{
61 if (ctx.cfg.index_header) { 64 if (ctx.cfg.index_header) {
62 htmlf("<tr class='nohover'><td colspan='%d' class='include-block'>", 65 htmlf("<tr class='nohover'><td colspan='%d' class='include-block'>",
63 columns); 66 columns);
64 html_include(ctx.cfg.index_header); 67 html_include(ctx.cfg.index_header);
65 html("</td></tr>"); 68 html("</td></tr>");
66 } 69 }
67 html("<tr class='nohover'>" 70 html("<tr class='nohover'>"
68 "<th class='left'>Name</th>" 71 "<th class='left'>Name</th>"
69 "<th class='left'>Description</th>" 72 "<th class='left'>Description</th>"
70 "<th class='left'>Owner</th>" 73 "<th class='left'>Owner</th>"
71 "<th class='left'>Idle</th>"); 74 "<th class='left'>Idle</th>");
72 if (ctx.cfg.enable_index_links) 75 if (ctx.cfg.enable_index_links)
73 html("<th>Links</th>"); 76 html("<th class='left'>Links</th>");
74 html("</tr>\n"); 77 html("</tr>\n");
78}
75 79
80void cgit_print_repolist()
81{
82 int i, columns = 4, hits = 0, header = 0;
83 char *last_group = NULL;
84
85 if (ctx.cfg.enable_index_links)
86 columns++;
87
88 ctx.page.title = ctx.cfg.root_title;
89 cgit_print_http_headers(&ctx);
90 cgit_print_docstart(&ctx);
91 cgit_print_pageheader(&ctx);
92
93 html("<table summary='repository list' class='list nowrap'>");
76 for (i=0; i<cgit_repolist.count; i++) { 94 for (i=0; i<cgit_repolist.count; i++) {
77 ctx.repo = &cgit_repolist.repos[i]; 95 ctx.repo = &cgit_repolist.repos[i];
96 if (!is_match(ctx.repo))
97 continue;
98 if (!header++)
99 print_header(columns);
100 hits++;
78 if ((last_group == NULL && ctx.repo->group != NULL) || 101 if ((last_group == NULL && ctx.repo->group != NULL) ||
79 (last_group != NULL && ctx.repo->group == NULL) || 102 (last_group != NULL && ctx.repo->group == NULL) ||
80 (last_group != NULL && ctx.repo->group != NULL && 103 (last_group != NULL && ctx.repo->group != NULL &&
81 strcmp(ctx.repo->group, last_group))) { 104 strcmp(ctx.repo->group, last_group))) {
82 htmlf("<tr class='nohover'><td colspan='%d' class='repogroup'>", 105 htmlf("<tr class='nohover'><td colspan='%d' class='repogroup'>",
83 columns); 106 columns);
@@ -107,8 +130,10 @@ void cgit_print_repolist()
107 cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL); 130 cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL);
108 html("</td>"); 131 html("</td>");
109 } 132 }
110 html("</tr>\n"); 133 html("</tr>\n");
111 } 134 }
112 html("</table>"); 135 html("</table>");
136 if (!hits)
137 cgit_print_error("No repositories found");
113 cgit_print_docend(); 138 cgit_print_docend();
114} 139}
diff --git a/ui-shared.c b/ui-shared.c
index aa65988..bb08c4a 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -4,12 +4,13 @@
4 * 4 *
5 * Licensed under GNU General Public License v2 5 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text) 6 * (see COPYING for full license text)
7 */ 7 */
8 8
9#include "cgit.h" 9#include "cgit.h"
10#include "cmd.h"
10#include "html.h" 11#include "html.h"
11 12
12const char cgit_doctype[] = 13const char cgit_doctype[] =
13"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" 14"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"
14" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; 15" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
15 16
@@ -385,13 +386,13 @@ void cgit_print_docstart(struct cgit_context *ctx)
385 html("</head>\n"); 386 html("</head>\n");
386 html("<body>\n"); 387 html("<body>\n");
387} 388}
388 389
389void cgit_print_docend() 390void cgit_print_docend()
390{ 391{
391 html("</td>\n</tr>\n</table>\n</body>\n</html>\n"); 392 html("</div>\n</body>\n</html>\n");
392} 393}
393 394
394int print_branch_option(const char *refname, const unsigned char *sha1, 395int print_branch_option(const char *refname, const unsigned char *sha1,
395 int flags, void *cb_data) 396 int flags, void *cb_data)
396{ 397{
397 char *name = (char *)refname; 398 char *name = (char *)refname;
@@ -462,103 +463,120 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page)
462 html_hidden("qt", ctx.qry.grep); 463 html_hidden("qt", ctx.qry.grep);
463 if (ctx.qry.search) 464 if (ctx.qry.search)
464 html_hidden("q", ctx.qry.search); 465 html_hidden("q", ctx.qry.search);
465 } 466 }
466} 467}
467 468
469char *hc(struct cgit_cmd *cmd, const char *page)
470{
471 return (strcmp(cmd->name, page) ? NULL : "active");
472}
473
468void cgit_print_pageheader(struct cgit_context *ctx) 474void cgit_print_pageheader(struct cgit_context *ctx)
469{ 475{
470 static const char *default_info = "This is cgit, a fast webinterface for git repositories"; 476 struct cgit_cmd *cmd = cgit_get_cmd(ctx);
471 int header = 0;
472 char *url;
473 477
474 html("<table id='layout' summary=''>\n"); 478 html("<table id='header'>\n");
475 html("<tr><td id='sidebar'>\n"); 479 html("<tr>\n");
476 html("<table class='sidebar' cellspacing='0' summary=''>\n"); 480 html("<td class='logo' rowspan='2'><a href='");
477 html("<tr><td class='sidebar'>\n<a href='"); 481 if (ctx->cfg.logo_link)
478 html_attr(cgit_rooturl()); 482 html_attr(ctx->cfg.logo_link);
479 htmlf("'><img src='%s' alt='cgit'/></a>\n", 483 else
480 ctx->cfg.logo); 484 html_attr(cgit_rooturl());
481 html("</td></tr>\n<tr><td class='sidebar'>\n"); 485 html("'><img src='");
482 if (ctx->repo) { 486 html_attr(ctx->cfg.logo);
483 html("<h1 class='first'>"); 487 html("'/></a></td>\n");
484 html_txt(strrpart(ctx->repo->name, 20));
485 html("</h1>\n");
486 html_txt(ctx->repo->desc);
487 if (ctx->repo->owner) {
488 html("<h1>owner</h1>\n");
489 html_txt(ctx->repo->owner);
490 }
491 html("<h1>navigate</h1>\n");
492 reporevlink(NULL, "summary", NULL, "menu", ctx->qry.head,
493 NULL, NULL);
494 cgit_log_link("log", NULL, "menu", ctx->qry.head, NULL, NULL,
495 0, NULL, NULL);
496 cgit_tree_link("tree", NULL, "menu", ctx->qry.head,
497 ctx->qry.sha1, NULL);
498 cgit_commit_link("commit", NULL, "menu", ctx->qry.head,
499 ctx->qry.sha1);
500 cgit_diff_link("diff", NULL, "menu", ctx->qry.head,
501 ctx->qry.sha1, ctx->qry.sha2, NULL);
502 cgit_patch_link("patch", NULL, "menu", ctx->qry.head,
503 ctx->qry.sha1);
504
505 for_each_ref(print_archive_ref, &header);
506
507 if (ctx->repo->clone_url || ctx->cfg.clone_prefix) {
508 html("<h1>clone</h1>\n");
509 if (ctx->repo->clone_url)
510 url = ctx->repo->clone_url;
511 else
512 url = fmt("%s%s", ctx->cfg.clone_prefix,
513 ctx->repo->url);
514 html("<a class='menu' href='");
515 html_attr(url);
516 html("' title='");
517 html_attr(url);
518 html("'>\n");
519 html_txt(strrpart(url, 20));
520 html("</a>\n");
521 }
522 488
523 html("<h1>branch</h1>\n"); 489 html("<td class='main'>");
490 if (ctx->repo) {
491/*
492 html("<a href='");
493 html_attr(cgit_rooturl());
494 html("'>index</a> : ");
495*/
496 reporevlink(NULL, ctx->repo->name, NULL, hc(cmd, "summary"),
497 ctx->qry.head, NULL, NULL);
498 html(" : ");
499 html_txt(ctx->qry.page);
500 html("</td><td class='form'>");
524 html("<form method='get' action=''>\n"); 501 html("<form method='get' action=''>\n");
525 add_hidden_formfields(0, 1, ctx->qry.page); 502 add_hidden_formfields(0, 1, ctx->qry.page);
526 // html("<table summary='branch selector' class='grid'><tr><td id='branch-dropdown-cell'>");
527 html("<select name='h' onchange='this.form.submit();'>\n"); 503 html("<select name='h' onchange='this.form.submit();'>\n");
528 for_each_branch_ref(print_branch_option, ctx->qry.head); 504 for_each_branch_ref(print_branch_option, ctx->qry.head);
529 html("</select>\n"); 505 html("</select> ");
530 // html("</td><td>"); 506 html("<input type='submit' name='' value='switch'/>");
531 html("<noscript><input type='submit' id='switch-btn' value='switch'/></noscript>\n"); 507 html("</form>");
532 // html("</td></tr></table>"); 508 } else
533 html("</form>\n"); 509 html_txt(ctx->cfg.root_title);
510 html("</td>\n");
511
512 html("<tr><td class='sub'");
513 if (ctx->repo) {
514 html(" colspan='2'>");
515 html_txt(ctx->repo->desc);
516 }
517/*
518 else if (ctx->cfg.root_subtitle)
519 html_txt(ctx->cfg.root_subtitle);
520*/
521 else {
522 html(">");
523 html_txt("a fast webinterface for the git dscm");
524 }
525 html("</td></tr>\n");
534 526
535 html("<h1>search</h1>\n"); 527 html("</tr>\n");
536 html("<form method='get' action='"); 528 html("</table>\n");
529
530 html("<table class='tabs'><tr><td>\n");
531 if (ctx->repo) {
532 reporevlink(NULL, "summary", NULL, hc(cmd, "summary"),
533 ctx->qry.head, NULL, NULL);
534 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head,
535 ctx->qry.sha1, NULL);
536 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head,
537 NULL, NULL, 0, NULL, NULL);
538 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head,
539 ctx->qry.sha1, NULL);
540 cgit_commit_link("commit", NULL, hc(cmd, "commit"),
541 ctx->qry.head, ctx->qry.sha1);
542 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head,
543 ctx->qry.sha1, ctx->qry.sha2, NULL);
544 html("</td><td class='form'>");
545 html("<form class='right' method='get' action='");
537 if (ctx->cfg.virtual_root) 546 if (ctx->cfg.virtual_root)
538 html_attr(cgit_fileurl(ctx->qry.repo, "log", 547 html_attr(cgit_fileurl(ctx->qry.repo, "log",
539 ctx->qry.path, NULL)); 548 ctx->qry.path, NULL));
540 html("'>\n"); 549 html("'>\n");
541 add_hidden_formfields(1, 0, "log"); 550 add_hidden_formfields(1, 0, "log");
542 html("<select name='qt'>\n"); 551 html("<select name='qt'>\n");
543 html_option("grep", "log msg", ctx->qry.grep); 552 html_option("grep", "log msg", ctx->qry.grep);
544 html_option("author", "author", ctx->qry.grep); 553 html_option("author", "author", ctx->qry.grep);
545 html_option("committer", "committer", ctx->qry.grep); 554 html_option("committer", "committer", ctx->qry.grep);
546 html("</select>\n"); 555 html("</select>\n");
547 html("<input class='txt' type='text' name='q' value='"); 556 html("<input class='txt' type='text' size='10' name='q' value='");
548 html_attr(ctx->qry.search); 557 html_attr(ctx->qry.search);
549 html("'/>\n"); 558 html("'/>\n");
559 html("<input type='submit' value='search'/>\n");
550 html("</form>\n"); 560 html("</form>\n");
551 } else { 561 } else {
552 if (!ctx->cfg.index_info || html_include(ctx->cfg.index_info)) 562 html("<a class='active' href='");
553 html(default_info); 563 html_attr(cgit_rooturl());
564 html("'>index</a>\n");
565 html("</td><td class='form'>");
566 html("<form method='get' action='");
567 html_attr(cgit_rooturl());
568 html("'>\n");
569 html("<input type='text' name='q' size='10' value='");
570 html_attr(ctx->qry.search);
571 html("'/>\n");
572 html("<input type='submit' value='search'/>\n");
573 html("</form>");
554 } 574 }
555 575 html("</td></tr></table>\n");
556 html("</td></tr></table></td>\n"); 576 html("<div class='content'>");
557
558 html("<td id='content'>\n");
559} 577}
560 578
561void cgit_print_filemode(unsigned short mode) 579void cgit_print_filemode(unsigned short mode)
562{ 580{
563 if (S_ISDIR(mode)) 581 if (S_ISDIR(mode))
564 html("d"); 582 html("d");
diff --git a/ui-shared.h b/ui-shared.h
index 94de884..76c2b1f 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -11,12 +11,14 @@ extern void cgit_tree_link(char *name, char *title, char *class, char *head,
11 char *rev, char *path); 11 char *rev, char *path);
12extern void cgit_log_link(char *name, char *title, char *class, char *head, 12extern void cgit_log_link(char *name, char *title, char *class, char *head,
13 char *rev, char *path, int ofs, char *grep, 13 char *rev, char *path, int ofs, char *grep,
14 char *pattern); 14 char *pattern);
15extern void cgit_commit_link(char *name, char *title, char *class, char *head, 15extern void cgit_commit_link(char *name, char *title, char *class, char *head,
16 char *rev); 16 char *rev);
17extern void cgit_patch_link(char *name, char *title, char *class, char *head,
18 char *rev);
17extern void cgit_refs_link(char *name, char *title, char *class, char *head, 19extern void cgit_refs_link(char *name, char *title, char *class, char *head,
18 char *rev, char *path); 20 char *rev, char *path);
19extern void cgit_snapshot_link(char *name, char *title, char *class, 21extern void cgit_snapshot_link(char *name, char *title, char *class,
20 char *head, char *rev, char *archivename); 22 char *head, char *rev, char *archivename);
21extern void cgit_diff_link(char *name, char *title, char *class, char *head, 23extern void cgit_diff_link(char *name, char *title, char *class, char *head,
22 char *new_rev, char *old_rev, char *path); 24 char *new_rev, char *old_rev, char *path);