author | Lars Hjemli <hjemli@gmail.com> | 2008-04-13 10:48:44 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-04-13 10:48:44 (UTC) |
commit | 76ba6287bfb533baca7285b107b5d975581d449d (patch) (unidiff) | |
tree | 22445a77f5b87280ec980f9b4da5a511f1f27faf | |
parent | 4a842288260a0b0c4a3d4032d441f7fd2afee699 (diff) | |
parent | 28d781f34b2c2d4c2b994ef3953d1cf37d8f28f0 (diff) | |
download | cgit-76ba6287bfb533baca7285b107b5d975581d449d.zip cgit-76ba6287bfb533baca7285b107b5d975581d449d.tar.gz cgit-76ba6287bfb533baca7285b107b5d975581d449d.tar.bz2 |
Merge branch 'lh/layout'
* lh/layout:
Make repository search case insensitive
Remove 'patch' link from tab, add to commit view
Implement minimal freetext search in the repolist
More layout fixes
Minor fixup in tree-view css
Reintroduce the branch switcher
Add fixed link to index page from repo header
Include diff in commit view
Replace sidebar/logo
-rw-r--r-- | cgit.css | 190 | ||||
-rw-r--r-- | cgit.h | 7 | ||||
-rw-r--r-- | cgit.png | bin | 5406 -> 1840 bytes | |||
-rw-r--r-- | ui-commit.c | 14 | ||||
-rw-r--r-- | ui-repolist.c | 51 | ||||
-rw-r--r-- | ui-shared.c | 154 | ||||
-rw-r--r-- | ui-shared.h | 2 |
7 files changed, 238 insertions, 180 deletions
@@ -1,165 +1,164 @@ | |||
1 | body, table { | 1 | body, table { |
2 | padding: 0em; | 2 | padding: 0em; |
3 | margin: 0em; | 3 | margin: 0em; |
4 | } | 4 | } |
5 | 5 | ||
6 | body { | 6 | body { |
7 | font-family: sans; | 7 | font-family: sans; |
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 | ||
14 | a { | ||
15 | color: blue; | ||
16 | text-decoration: none; | ||
17 | } | ||
18 | |||
19 | a:hover { | ||
20 | text-decoration: underline; | ||
21 | } | ||
22 | |||
14 | table { | 23 | table { |
15 | border-collapse: collapse; | 24 | border-collapse: collapse; |
16 | } | 25 | } |
17 | 26 | ||
18 | h2 { | 27 | table#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 | ||
25 | h3 { | 32 | table#header td.logo { |
26 | margin-top: 0em; | 33 | width: 96px; |
27 | font-size: 100%; | ||
28 | font-weight: normal; | ||
29 | } | 34 | } |
30 | 35 | ||
31 | h4 { | 36 | table#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 | ||
38 | a { | 41 | table#header td.main a { |
39 | color: #600; | 42 | color: #000; |
40 | text-decoration: none; | ||
41 | } | 43 | } |
42 | 44 | ||
43 | a:hover { | 45 | table#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 | ||
48 | table.list { | 52 | table#header td.form form, |
49 | border: none; | 53 | table#header td.form input, |
50 | border-collapse: collapse; | 54 | table#header td.form select { |
55 | font-size: 90%; | ||
51 | } | 56 | } |
52 | 57 | ||
53 | table.list tr { | 58 | table#header td.sub { |
54 | background: white; | 59 | color: #777; |
60 | border-top: solid 1px #ccc; | ||
61 | padding-left: 10px; | ||
55 | } | 62 | } |
56 | 63 | ||
57 | table.list tr:hover { | 64 | table.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 | ||
61 | table.list tr.nohover:hover { | 72 | table.tabs td { |
62 | background: white; | 73 | padding: 0px 1em; |
74 | vertical-align: bottom; | ||
63 | } | 75 | } |
64 | 76 | ||
65 | table.list th { | 77 | table.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 | ||
72 | table.list td { | 83 | table.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 | ||
77 | img { | 88 | table.tabs td.form { |
78 | border: none; | 89 | text-align: right; |
79 | } | 90 | } |
80 | 91 | ||
81 | table#layout { | 92 | table.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 | ||
87 | td#sidebar { | 97 | table.tabs td.form input, |
88 | vertical-align: top; | 98 | table.tabs td.form select { |
89 | width: 162px; | 99 | font-size: 90%; |
90 | padding: 0px 0px 0px 0px; | ||
91 | margin: 0px; | ||
92 | } | 100 | } |
93 | 101 | ||
94 | td#sidebar table { | 102 | div.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 | ||
102 | td#sidebar table.sidebar td.sidebar { | 109 | |
103 | padding: 4px; | 110 | table.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 | ||
110 | div#logo { | 116 | table.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 | ||
121 | td#sidebar h1 { | 120 | table.list tr:hover { |
122 | font-size: 10pt; | 121 | background: #eee; |
123 | font-weight: bold; | ||
124 | margin: 8px 0px 0px 0px; | ||
125 | } | 122 | } |
126 | 123 | ||
127 | td#sidebar h1.first { | 124 | table.list tr.nohover:hover { |
128 | margin-top: 0px; | 125 | background: white; |
129 | } | 126 | } |
130 | 127 | ||
131 | td#sidebar a.menu { | 128 | table.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 | ||
138 | td#sidebar a.menu:hover { | 138 | table.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 | ||
143 | td#sidebar select { | 143 | table.list td a { |
144 | width: 100%; | 144 | color: black; |
145 | margin: 2px 0px 0px 0px; | ||
146 | } | 145 | } |
147 | 146 | ||
148 | td#sidebar form { | 147 | img { |
149 | text-align: right; | 148 | border: none; |
150 | } | 149 | } |
151 | 150 | ||
152 | input#switch-btn { | 151 | input#switch-btn { |
153 | margin: 2px 0px 0px 0px; | 152 | margin: 2px 0px 0px 0px; |
154 | } | 153 | } |
155 | 154 | ||
156 | td#sidebar input.txt { | 155 | td#sidebar input.txt { |
157 | width: 100%; | 156 | width: 100%; |
158 | margin: 2px 0px 0px 0px; | 157 | margin: 2px 0px 0px 0px; |
159 | } | 158 | } |
160 | 159 | ||
161 | table#grid { | 160 | table#grid { |
162 | margin: 0px; | 161 | margin: 0px; |
163 | } | 162 | } |
164 | 163 | ||
165 | td#content { | 164 | td#content { |
@@ -188,40 +187,39 @@ table#downloads th { | |||
188 | div#blob { | 187 | div#blob { |
189 | border: solid 1px black; | 188 | border: solid 1px black; |
190 | } | 189 | } |
191 | 190 | ||
192 | div.error { | 191 | div.error { |
193 | color: red; | 192 | color: red; |
194 | font-weight: bold; | 193 | font-weight: bold; |
195 | margin: 1em 2em; | 194 | margin: 1em 2em; |
196 | } | 195 | } |
197 | 196 | ||
198 | a.ls-blob, a.ls-dir, a.ls-mod { | 197 | a.ls-blob, a.ls-dir, a.ls-mod { |
199 | font-family: monospace; | 198 | font-family: monospace; |
200 | } | 199 | } |
201 | 200 | ||
202 | td.ls-size { | 201 | td.ls-size { |
203 | text-align: right; | 202 | text-align: right; |
204 | } | ||
205 | |||
206 | td.ls-size { | ||
207 | font-family: monospace; | 203 | font-family: monospace; |
204 | width: 10em; | ||
208 | } | 205 | } |
209 | 206 | ||
210 | td.ls-mode { | 207 | td.ls-mode { |
211 | font-family: monospace; | 208 | font-family: monospace; |
209 | width: 10em; | ||
212 | } | 210 | } |
213 | 211 | ||
214 | table.blob { | 212 | table.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 | } |
218 | 216 | ||
219 | table.blob td.no { | 217 | table.blob td.no { |
220 | border-right: solid 1px black; | 218 | border-right: solid 1px black; |
221 | color: black; | 219 | color: black; |
222 | background-color: #eee; | 220 | background-color: #eee; |
223 | text-align: right; | 221 | text-align: right; |
224 | } | 222 | } |
225 | 223 | ||
226 | table.blob td.no a { | 224 | table.blob td.no a { |
227 | color: black; | 225 | color: black; |
@@ -344,33 +342,33 @@ div.diffstat-summary { | |||
344 | color: #888; | 342 | color: #888; |
345 | padding-top: 0.5em; | 343 | padding-top: 0.5em; |
346 | } | 344 | } |
347 | 345 | ||
348 | table.diff { | 346 | table.diff { |
349 | width: 100%; | 347 | width: 100%; |
350 | } | 348 | } |
351 | 349 | ||
352 | table.diff td { | 350 | table.diff td { |
353 | font-family: monospace; | 351 | font-family: monospace; |
354 | white-space: pre; | 352 | white-space: pre; |
355 | } | 353 | } |
356 | 354 | ||
357 | table.diff td div.head { | 355 | table.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 | ||
363 | table.diff td div.hunk { | 361 | table.diff td div.hunk { |
364 | color: #009; | 362 | color: #009; |
365 | } | 363 | } |
366 | 364 | ||
367 | table.diff td div.add { | 365 | table.diff td div.add { |
368 | color: green; | 366 | color: green; |
369 | } | 367 | } |
370 | 368 | ||
371 | table.diff td div.del { | 369 | table.diff td div.del { |
372 | color: red; | 370 | color: red; |
373 | } | 371 | } |
374 | 372 | ||
375 | .sha1 { | 373 | .sha1 { |
376 | font-family: monospace; | 374 | font-family: monospace; |
@@ -379,43 +377,43 @@ table.diff td div.del { | |||
379 | 377 | ||
380 | .left { | 378 | .left { |
381 | text-align: left; | 379 | text-align: left; |
382 | } | 380 | } |
383 | 381 | ||
384 | .right { | 382 | .right { |
385 | text-align: right; | 383 | text-align: right; |
386 | } | 384 | } |
387 | 385 | ||
388 | table.list td.repogroup { | 386 | table.list td.repogroup { |
389 | font-style: italic; | 387 | font-style: italic; |
390 | color: #888; | 388 | color: #888; |
391 | } | 389 | } |
392 | 390 | ||
393 | a.button { | 391 | a.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 | ||
402 | a.button:hover { | 402 | a.button:hover { |
403 | text-decoration: none; | 403 | text-decoration: underline; |
404 | color: #333; | ||
405 | background-color: #ccc; | ||
406 | } | 404 | } |
407 | 405 | ||
408 | a.primary { | 406 | a.primary { |
409 | font-size: 100%; | 407 | font-size: 100%; |
410 | } | 408 | } |
411 | 409 | ||
412 | a.secondary { | 410 | a.secondary { |
413 | font-size: 90%; | 411 | font-size: 90%; |
414 | } | 412 | } |
415 | 413 | ||
416 | td.toplevel-repo { | 414 | td.toplevel-repo { |
417 | 415 | ||
418 | } | 416 | } |
419 | 417 | ||
420 | table.list td.sublevel-repo { | 418 | table.list td.sublevel-repo { |
421 | padding-left: 1.5em; | 419 | padding-left: 1.5em; |
@@ -208,17 +208,24 @@ extern int cgit_diff_files(const unsigned char *old_sha1, | |||
208 | extern void cgit_diff_tree(const unsigned char *old_sha1, | 208 | extern void cgit_diff_tree(const unsigned char *old_sha1, |
209 | const unsigned char *new_sha1, | 209 | const unsigned char *new_sha1, |
210 | filepair_fn fn, const char *prefix); | 210 | filepair_fn fn, const char *prefix); |
211 | 211 | ||
212 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); | 212 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); |
213 | 213 | ||
214 | extern char *fmt(const char *format,...); | 214 | extern char *fmt(const char *format,...); |
215 | 215 | ||
216 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); | 216 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); |
217 | extern struct taginfo *cgit_parse_tag(struct tag *tag); | 217 | extern struct taginfo *cgit_parse_tag(struct tag *tag); |
218 | extern void cgit_parse_url(const char *url); | 218 | extern void cgit_parse_url(const char *url); |
219 | 219 | ||
220 | extern const char *cgit_repobasename(const char *reponame); | 220 | extern const char *cgit_repobasename(const char *reponame); |
221 | 221 | ||
222 | extern int cgit_parse_snapshots_mask(const char *str); | 222 | extern 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 | */ | ||
228 | extern char *strcasestr(const char *haystack, const char *needle); | ||
229 | |||
230 | |||
224 | #endif /* CGIT_H */ | 231 | #endif /* CGIT_H */ |
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 | |||
@@ -1,27 +1,28 @@ | |||
1 | /* ui-commit.c: generate commit view | 1 | /* ui-commit.c: generate commit view |
2 | * | 2 | * |
3 | * Copyright (C) 2006 Lars Hjemli | 3 | * Copyright (C) 2006 Lars Hjemli |
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 "html.h" | 10 | #include "html.h" |
11 | #include "ui-shared.h" | 11 | #include "ui-shared.h" |
12 | #include "ui-diff.h" | ||
12 | 13 | ||
13 | static int files, slots; | 14 | static int files, slots; |
14 | static int total_adds, total_rems, max_changes; | 15 | static int total_adds, total_rems, max_changes; |
15 | static int lines_added, lines_removed; | 16 | static int lines_added, lines_removed; |
16 | static char *curr_rev; | 17 | static char *curr_rev; |
17 | 18 | ||
18 | static struct fileinfo { | 19 | static struct fileinfo { |
19 | char status; | 20 | char status; |
20 | unsigned char old_sha1[20]; | 21 | unsigned char old_sha1[20]; |
21 | unsigned char new_sha1[20]; | 22 | unsigned char new_sha1[20]; |
22 | unsigned short old_mode; | 23 | unsigned short old_mode; |
23 | unsigned short new_mode; | 24 | unsigned short new_mode; |
24 | char *old_path; | 25 | char *old_path; |
25 | char *new_path; | 26 | char *new_path; |
26 | unsigned int added; | 27 | unsigned int added; |
27 | unsigned int removed; | 28 | unsigned int removed; |
@@ -161,32 +162,38 @@ void cgit_print_commit(char *hex) | |||
161 | 162 | ||
162 | html("<table summary='commit info' class='commit-info'>\n"); | 163 | html("<table summary='commit info' class='commit-info'>\n"); |
163 | html("<tr><th>author</th><td>"); | 164 | html("<tr><th>author</th><td>"); |
164 | html_txt(info->author); | 165 | html_txt(info->author); |
165 | html(" "); | 166 | html(" "); |
166 | html_txt(info->author_email); | 167 | html_txt(info->author_email); |
167 | html("</td><td class='right'>"); | 168 | html("</td><td class='right'>"); |
168 | cgit_print_date(info->author_date, FMT_LONGDATE); | 169 | cgit_print_date(info->author_date, FMT_LONGDATE); |
169 | html("</td></tr>\n"); | 170 | html("</td></tr>\n"); |
170 | html("<tr><th>committer</th><td>"); | 171 | html("<tr><th>committer</th><td>"); |
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) { |
183 | parent = lookup_commit_reference(p->item->object.sha1); | 190 | parent = lookup_commit_reference(p->item->object.sha1); |
184 | if (!parent) { | 191 | if (!parent) { |
185 | html("<tr><td colspan='3'>"); | 192 | html("<tr><td colspan='3'>"); |
186 | cgit_print_error("Error reading parent commit"); | 193 | cgit_print_error("Error reading parent commit"); |
187 | html("</td></tr>"); | 194 | html("</td></tr>"); |
188 | continue; | 195 | continue; |
189 | } | 196 | } |
190 | html("<tr><th>parent</th>" | 197 | html("<tr><th>parent</th>" |
191 | "<td colspan='2' class='sha1'>"); | 198 | "<td colspan='2' class='sha1'>"); |
192 | cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL, | 199 | cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL, |
@@ -205,24 +212,25 @@ void cgit_print_commit(char *hex) | |||
205 | html("</table>\n"); | 212 | html("</table>\n"); |
206 | html("<div class='commit-subject'>"); | 213 | html("<div class='commit-subject'>"); |
207 | html_txt(info->subject); | 214 | html_txt(info->subject); |
208 | html("</div>"); | 215 | html("</div>"); |
209 | html("<div class='commit-msg'>"); | 216 | html("<div class='commit-msg'>"); |
210 | html_txt(info->msg); | 217 | html_txt(info->msg); |
211 | html("</div>"); | 218 | html("</div>"); |
212 | if (!(commit->parents && commit->parents->next && commit->parents->next->next)) { | 219 | if (!(commit->parents && commit->parents->next && commit->parents->next->next)) { |
213 | html("<div class='diffstat-header'>Diffstat</div>"); | 220 | html("<div class='diffstat-header'>Diffstat</div>"); |
214 | html("<table summary='diffstat' class='diffstat'>"); | 221 | html("<table summary='diffstat' class='diffstat'>"); |
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 | |||
@@ -31,63 +31,86 @@ static void print_modtime(struct cgit_repo *repo) | |||
31 | { | 31 | { |
32 | char *path; | 32 | char *path; |
33 | struct stat s; | 33 | struct stat s; |
34 | 34 | ||
35 | path = fmt("%s/%s", repo->path, ctx.cfg.agefile); | 35 | path = fmt("%s/%s", repo->path, ctx.cfg.agefile); |
36 | if (stat(path, &s) == 0) { | 36 | if (stat(path, &s) == 0) { |
37 | cgit_print_age(read_agefile(path), -1, NULL); | 37 | cgit_print_age(read_agefile(path), -1, NULL); |
38 | return; | 38 | return; |
39 | } | 39 | } |
40 | 40 | ||
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 | ||
47 | void cgit_print_repolist() | 47 | int 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'>"); | 62 | void 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 | ||
80 | void 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); |
84 | html_txt(ctx.repo->group); | 107 | html_txt(ctx.repo->group); |
85 | html("</td></tr>"); | 108 | html("</td></tr>"); |
86 | last_group = ctx.repo->group; | 109 | last_group = ctx.repo->group; |
87 | } | 110 | } |
88 | htmlf("<tr><td class='%s'>", | 111 | htmlf("<tr><td class='%s'>", |
89 | ctx.repo->group ? "sublevel-repo" : "toplevel-repo"); | 112 | ctx.repo->group ? "sublevel-repo" : "toplevel-repo"); |
90 | html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL); | 113 | html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL); |
91 | html_txt(ctx.repo->name); | 114 | html_txt(ctx.repo->name); |
92 | html_link_close(); | 115 | html_link_close(); |
93 | html("</td><td>"); | 116 | html("</td><td>"); |
@@ -97,18 +120,20 @@ void cgit_print_repolist() | |||
97 | html("</td><td>"); | 120 | html("</td><td>"); |
98 | print_modtime(ctx.repo); | 121 | print_modtime(ctx.repo); |
99 | html("</td>"); | 122 | html("</td>"); |
100 | if (ctx.cfg.enable_index_links) { | 123 | if (ctx.cfg.enable_index_links) { |
101 | html("<td>"); | 124 | html("<td>"); |
102 | html_link_open(cgit_repourl(ctx.repo->url), | 125 | html_link_open(cgit_repourl(ctx.repo->url), |
103 | NULL, "button"); | 126 | NULL, "button"); |
104 | html("summary</a>"); | 127 | html("summary</a>"); |
105 | cgit_log_link("log", NULL, "button", NULL, NULL, NULL, | 128 | cgit_log_link("log", NULL, "button", NULL, NULL, NULL, |
106 | 0, NULL, NULL); | 129 | 0, NULL, NULL); |
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 | |||
@@ -1,25 +1,26 @@ | |||
1 | /* ui-shared.c: common web output functions | 1 | /* ui-shared.c: common web output functions |
2 | * | 2 | * |
3 | * Copyright (C) 2006 Lars Hjemli | 3 | * Copyright (C) 2006 Lars Hjemli |
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 | ||
12 | const char cgit_doctype[] = | 13 | const 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 | ||
16 | static char *http_date(time_t t) | 17 | static char *http_date(time_t t) |
17 | { | 18 | { |
18 | static char day[][4] = | 19 | static char day[][4] = |
19 | {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; | 20 | {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; |
20 | static char month[][4] = | 21 | static char month[][4] = |
21 | {"Jan", "Feb", "Mar", "Apr", "May", "Jun", | 22 | {"Jan", "Feb", "Mar", "Apr", "May", "Jun", |
22 | "Jul", "Aug", "Sep", "Oct", "Now", "Dec"}; | 23 | "Jul", "Aug", "Sep", "Oct", "Now", "Dec"}; |
23 | struct tm *tm = gmtime(&t); | 24 | struct tm *tm = gmtime(&t); |
24 | return fmt("%s, %02d %s %04d %02d:%02d:%02d GMT", day[tm->tm_wday], | 25 | return fmt("%s, %02d %s %04d %02d:%02d:%02d GMT", day[tm->tm_wday], |
25 | tm->tm_mday, month[tm->tm_mon], 1900+tm->tm_year, | 26 | tm->tm_mday, month[tm->tm_mon], 1900+tm->tm_year, |
@@ -375,33 +376,33 @@ void cgit_print_docstart(struct cgit_context *ctx) | |||
375 | html("<head>\n"); | 376 | html("<head>\n"); |
376 | html("<title>"); | 377 | html("<title>"); |
377 | html_txt(ctx->page.title); | 378 | html_txt(ctx->page.title); |
378 | html("</title>\n"); | 379 | html("</title>\n"); |
379 | htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); | 380 | htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); |
380 | if (ctx->cfg.robots && *ctx->cfg.robots) | 381 | if (ctx->cfg.robots && *ctx->cfg.robots) |
381 | htmlf("<meta name='robots' content='%s'/>\n", ctx->cfg.robots); | 382 | htmlf("<meta name='robots' content='%s'/>\n", ctx->cfg.robots); |
382 | html("<link rel='stylesheet' type='text/css' href='"); | 383 | html("<link rel='stylesheet' type='text/css' href='"); |
383 | html_attr(ctx->cfg.css); | 384 | html_attr(ctx->cfg.css); |
384 | html("'/>\n"); | 385 | html("'/>\n"); |
385 | html("</head>\n"); | 386 | html("</head>\n"); |
386 | html("<body>\n"); | 387 | html("<body>\n"); |
387 | } | 388 | } |
388 | 389 | ||
389 | void cgit_print_docend() | 390 | void 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 | ||
394 | int print_branch_option(const char *refname, const unsigned char *sha1, | 395 | int 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; |
398 | html_option(name, name, ctx.qry.head); | 399 | html_option(name, name, ctx.qry.head); |
399 | return 0; | 400 | return 0; |
400 | } | 401 | } |
401 | 402 | ||
402 | int print_archive_ref(const char *refname, const unsigned char *sha1, | 403 | int print_archive_ref(const char *refname, const unsigned char *sha1, |
403 | int flags, void *cb_data) | 404 | int flags, void *cb_data) |
404 | { | 405 | { |
405 | struct tag *tag; | 406 | struct tag *tag; |
406 | struct taginfo *info; | 407 | struct taginfo *info; |
407 | struct object *obj; | 408 | struct object *obj; |
@@ -452,123 +453,140 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page) | |||
452 | if (incl_head && strcmp(ctx.qry.head, ctx.repo->defbranch)) | 453 | if (incl_head && strcmp(ctx.qry.head, ctx.repo->defbranch)) |
453 | html_hidden("h", ctx.qry.head); | 454 | html_hidden("h", ctx.qry.head); |
454 | 455 | ||
455 | if (ctx.qry.sha1) | 456 | if (ctx.qry.sha1) |
456 | html_hidden("id", ctx.qry.sha1); | 457 | html_hidden("id", ctx.qry.sha1); |
457 | if (ctx.qry.sha2) | 458 | if (ctx.qry.sha2) |
458 | html_hidden("id2", ctx.qry.sha2); | 459 | html_hidden("id2", ctx.qry.sha2); |
459 | 460 | ||
460 | if (incl_search) { | 461 | if (incl_search) { |
461 | if (ctx.qry.grep) | 462 | if (ctx.qry.grep) |
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 | ||
469 | char *hc(struct cgit_cmd *cmd, const char *page) | ||
470 | { | ||
471 | return (strcmp(cmd->name, page) ? NULL : "active"); | ||
472 | } | ||
473 | |||
468 | void cgit_print_pageheader(struct cgit_context *ctx) | 474 | void 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 | ||
561 | void cgit_print_filemode(unsigned short mode) | 579 | void cgit_print_filemode(unsigned short mode) |
562 | { | 580 | { |
563 | if (S_ISDIR(mode)) | 581 | if (S_ISDIR(mode)) |
564 | html("d"); | 582 | html("d"); |
565 | else if (S_ISLNK(mode)) | 583 | else if (S_ISLNK(mode)) |
566 | html("l"); | 584 | html("l"); |
567 | else if (S_ISGITLINK(mode)) | 585 | else if (S_ISGITLINK(mode)) |
568 | html("m"); | 586 | html("m"); |
569 | else | 587 | else |
570 | html("-"); | 588 | html("-"); |
571 | html_fileperm(mode >> 6); | 589 | html_fileperm(mode >> 6); |
572 | html_fileperm(mode >> 3); | 590 | html_fileperm(mode >> 3); |
573 | html_fileperm(mode); | 591 | html_fileperm(mode); |
574 | } | 592 | } |
diff --git a/ui-shared.h b/ui-shared.h index 94de884..76c2b1f 100644 --- a/ui-shared.h +++ b/ui-shared.h | |||
@@ -1,32 +1,34 @@ | |||
1 | #ifndef UI_SHARED_H | 1 | #ifndef UI_SHARED_H |
2 | #define UI_SHARED_H | 2 | #define UI_SHARED_H |
3 | 3 | ||
4 | extern char *cgit_repourl(const char *reponame); | 4 | extern char *cgit_repourl(const char *reponame); |
5 | extern char *cgit_fileurl(const char *reponame, const char *pagename, | 5 | extern char *cgit_fileurl(const char *reponame, const char *pagename, |
6 | const char *filename, const char *query); | 6 | const char *filename, const char *query); |
7 | extern char *cgit_pageurl(const char *reponame, const char *pagename, | 7 | extern char *cgit_pageurl(const char *reponame, const char *pagename, |
8 | const char *query); | 8 | const char *query); |
9 | 9 | ||
10 | extern void cgit_tree_link(char *name, char *title, char *class, char *head, | 10 | extern void cgit_tree_link(char *name, char *title, char *class, char *head, |
11 | char *rev, char *path); | 11 | char *rev, char *path); |
12 | extern void cgit_log_link(char *name, char *title, char *class, char *head, | 12 | extern 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); |
15 | extern void cgit_commit_link(char *name, char *title, char *class, char *head, | 15 | extern void cgit_commit_link(char *name, char *title, char *class, char *head, |
16 | char *rev); | 16 | char *rev); |
17 | extern void cgit_patch_link(char *name, char *title, char *class, char *head, | ||
18 | char *rev); | ||
17 | extern void cgit_refs_link(char *name, char *title, char *class, char *head, | 19 | extern void cgit_refs_link(char *name, char *title, char *class, char *head, |
18 | char *rev, char *path); | 20 | char *rev, char *path); |
19 | extern void cgit_snapshot_link(char *name, char *title, char *class, | 21 | extern void cgit_snapshot_link(char *name, char *title, char *class, |
20 | char *head, char *rev, char *archivename); | 22 | char *head, char *rev, char *archivename); |
21 | extern void cgit_diff_link(char *name, char *title, char *class, char *head, | 23 | extern 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); |
23 | extern void cgit_object_link(struct object *obj); | 25 | extern void cgit_object_link(struct object *obj); |
24 | 26 | ||
25 | extern void cgit_print_error(char *msg); | 27 | extern void cgit_print_error(char *msg); |
26 | extern void cgit_print_date(time_t secs, char *format); | 28 | extern void cgit_print_date(time_t secs, char *format); |
27 | extern void cgit_print_age(time_t t, time_t max_relative, char *format); | 29 | extern void cgit_print_age(time_t t, time_t max_relative, char *format); |
28 | extern void cgit_print_http_headers(struct cgit_context *ctx); | 30 | extern void cgit_print_http_headers(struct cgit_context *ctx); |
29 | extern void cgit_print_docstart(struct cgit_context *ctx); | 31 | extern void cgit_print_docstart(struct cgit_context *ctx); |
30 | extern void cgit_print_docend(); | 32 | extern void cgit_print_docend(); |
31 | extern void cgit_print_pageheader(struct cgit_context *ctx); | 33 | extern void cgit_print_pageheader(struct cgit_context *ctx); |
32 | extern void cgit_print_filemode(unsigned short mode); | 34 | extern void cgit_print_filemode(unsigned short mode); |