aboutsummaryrefslogtreecommitdiffstats
path: root/ui-shared.c
diff options
context:
space:
mode:
authorGravatar Lars Hjemli <hjemli@gmail.com>2007-06-30 03:32:08 (JST)
committerGravatar Lars Hjemli <hjemli@gmail.com>2007-06-30 03:32:08 (JST)
commit16a3d2779ccd56bf7954d98da547247d8796544b (patch)
tree86d2ed41adc3de842c7518d614ea49ca0200e4d2 /ui-shared.c
parentf69250358a74efa5d7d9c562b2cdd80fad1430f1 (diff)
parent103940fe6b0914dc42b8b033d1d328f38135ca5f (diff)
downloadcgit-16a3d2779ccd56bf7954d98da547247d8796544b.zip
cgit-16a3d2779ccd56bf7954d98da547247d8796544b.tar.gz
Merge branch 'lh/menu'
* lh/menu: Add ofs argument to cgit_log_link and use it in ui-log.c Add trim_end() and use it to remove trailing slashes from repo paths Do not include current path in the "tree" menu link Add setting to enable/disable extra links on index page Change S/L/T to summary/log/tree Change "files" to "tree" Include querystring as part of cached filename for repo summary page Add more menuitems on repo pages
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c71
1 files changed, 55 insertions, 16 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 110c696..d4376ce 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -111,20 +111,24 @@ static char *repolink(char *title, char *class, char *page, char *head,
111 html_attr(cgit_repo->url); 111 html_attr(cgit_repo->url);
112 if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/') 112 if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/')
113 html("/"); 113 html("/");
114 html(page); 114 if (page) {
115 html("/"); 115 html(page);
116 if (path) 116 html("/");
117 html_attr(path); 117 if (path)
118 html_attr(path);
119 }
118 } else { 120 } else {
119 html(cgit_script_name); 121 html(cgit_script_name);
120 html("?url="); 122 html("?url=");
121 html_attr(cgit_repo->url); 123 html_attr(cgit_repo->url);
122 if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/') 124 if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/')
123 html("/"); 125 html("/");
124 html(page); 126 if (page) {
125 html("/"); 127 html(page);
126 if (path) 128 html("/");
127 html_attr(path); 129 if (path)
130 html_attr(path);
131 }
128 delim = "&amp;"; 132 delim = "&amp;";
129 } 133 }
130 if (head && strcmp(head, cgit_repo->defbranch)) { 134 if (head && strcmp(head, cgit_repo->defbranch)) {
@@ -159,9 +163,25 @@ void cgit_tree_link(char *name, char *title, char *class, char *head,
159} 163}
160 164
161void cgit_log_link(char *name, char *title, char *class, char *head, 165void cgit_log_link(char *name, char *title, char *class, char *head,
162 char *rev, char *path) 166 char *rev, char *path, int ofs)
163{ 167{
164 reporevlink("log", name, title, class, head, rev, path); 168 char *delim;
169
170 delim = repolink(title, class, "log", head, path);
171 if (rev && strcmp(rev, cgit_query_head)) {
172 html(delim);
173 html("id=");
174 html_attr(rev);
175 delim = "&";
176 }
177 if (ofs > 0) {
178 html(delim);
179 html("ofs=");
180 htmlf("%d", ofs);
181 }
182 html("'>");
183 html_txt(name);
184 html("</a>");
165} 185}
166 186
167void cgit_commit_link(char *name, char *title, char *class, char *head, 187void cgit_commit_link(char *name, char *title, char *class, char *head,
@@ -279,19 +299,38 @@ void cgit_print_docend()
279void cgit_print_pageheader(char *title, int show_search) 299void cgit_print_pageheader(char *title, int show_search)
280{ 300{
281 html("<table id='layout'>"); 301 html("<table id='layout'>");
282 html("<tr><td id='header'>"); 302 html("<tr><td id='header'><a href='");
283 html(cgit_root_title); 303 html_attr(cgit_rooturl());
284 html("</td><td id='logo'>"); 304 html("'>");
305 html_txt(cgit_root_title);
306 html("</a></td><td id='logo'>");
285 html("<a href='"); 307 html("<a href='");
286 html_attr(cgit_logo_link); 308 html_attr(cgit_logo_link);
287 htmlf("'><img src='%s' alt='logo'/></a>", cgit_logo); 309 htmlf("'><img src='%s' alt='logo'/></a>", cgit_logo);
288 html("</td></tr>"); 310 html("</td></tr>");
289 html("<tr><td id='crumb'>"); 311 html("<tr><td id='crumb'>");
290 htmlf("<a href='%s'>root</a>", cgit_rooturl());
291 if (cgit_query_repo) { 312 if (cgit_query_repo) {
292 htmlf(" : <a href='%s'>", cgit_repourl(cgit_repo->url));
293 html_txt(cgit_repo->name); 313 html_txt(cgit_repo->name);
294 htmlf("</a> : %s", title); 314 html(" (");
315 html_txt(cgit_query_head);
316 html(") : &nbsp;");
317 reporevlink(NULL, "summary", NULL, NULL, cgit_query_head,
318 NULL, NULL);
319 html(" ");
320 cgit_log_link("log", NULL, NULL, cgit_query_head,
321 cgit_query_sha1, cgit_query_path, 0);
322 html(" ");
323 cgit_tree_link("tree", NULL, NULL, cgit_query_head,
324 cgit_query_sha1, NULL);
325 html(" ");
326 cgit_commit_link("commit", NULL, NULL, cgit_query_head,
327 cgit_query_sha1);
328 html(" ");
329 cgit_diff_link("diff", NULL, NULL, cgit_query_head,
330 cgit_query_sha1, cgit_query_sha2,
331 cgit_query_path);
332 } else {
333 html_txt("Index of repositories");
295 } 334 }
296 html("</td>"); 335 html("</td>");
297 html("<td id='search'>"); 336 html("<td id='search'>");