summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
authorLars Hjemli <hjemli@gmail.com>2008-10-05 15:16:48 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-10-05 15:16:48 (UTC)
commitc6bea0375aa7898ea3229483741944303740801e (patch) (unidiff)
tree249000a4b85dbab2a7067042f9d835bc0a5e5f8f /ui-shared.c
parent20c895f6889a66d7cf43c67a7c22df6ef324ed5d (diff)
parent49ecbbddf0659c6409befcfe8989f92196133cda (diff)
downloadcgit-c6bea0375aa7898ea3229483741944303740801e.zip
cgit-c6bea0375aa7898ea3229483741944303740801e.tar.gz
cgit-c6bea0375aa7898ea3229483741944303740801e.tar.bz2
Merge branch 'lh/escape-urls'
* lh/escape-urls: ui-repolist + ui-shared: Use cgit_summary_link() ui-shared.c: add cgit_summary_link() ui-shared.c: use html_url_path() in repolink() html.c: add html_url_path
Diffstat (limited to 'ui-shared.c') (more/less context) (show whitespace changes)
-rw-r--r--ui-shared.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/ui-shared.c b/ui-shared.c
index a2f636c..1fc5c09 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -203,23 +203,23 @@ static char *repolink(char *title, char *class, char *page, char *head,
203 html(" class='"); 203 html(" class='");
204 html_attr(class); 204 html_attr(class);
205 html("'"); 205 html("'");
206 } 206 }
207 html(" href='"); 207 html(" href='");
208 if (ctx.cfg.virtual_root) { 208 if (ctx.cfg.virtual_root) {
209 html_attr(ctx.cfg.virtual_root); 209 html_url_path(ctx.cfg.virtual_root);
210 if (ctx.cfg.virtual_root[strlen(ctx.cfg.virtual_root) - 1] != '/') 210 if (ctx.cfg.virtual_root[strlen(ctx.cfg.virtual_root) - 1] != '/')
211 html("/"); 211 html("/");
212 html_attr(ctx.repo->url); 212 html_url_path(ctx.repo->url);
213 if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/') 213 if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/')
214 html("/"); 214 html("/");
215 if (page) { 215 if (page) {
216 html(page); 216 html_url_path(page);
217 html("/"); 217 html("/");
218 if (path) 218 if (path)
219 html_attr(path); 219 html_url_path(path);
220 } 220 }
221 } else { 221 } else {
222 html(ctx.cfg.script_name); 222 html(ctx.cfg.script_name);
223 html("?url="); 223 html("?url=");
224 html_url_arg(ctx.repo->url); 224 html_url_arg(ctx.repo->url);
225 if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/') 225 if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/')
@@ -254,12 +254,17 @@ static void reporevlink(char *page, char *name, char *title, char *class,
254 } 254 }
255 html("'>"); 255 html("'>");
256 html_txt(name); 256 html_txt(name);
257 html("</a>"); 257 html("</a>");
258} 258}
259 259
260void cgit_summary_link(char *name, char *title, char *class, char *head)
261{
262 reporevlink(NULL, name, title, class, head, NULL, NULL);
263}
264
260void cgit_tree_link(char *name, char *title, char *class, char *head, 265void cgit_tree_link(char *name, char *title, char *class, char *head,
261 char *rev, char *path) 266 char *rev, char *path)
262{ 267{
263 reporevlink("tree", name, title, class, head, rev, path); 268 reporevlink("tree", name, title, class, head, rev, path);
264} 269}
265 270
@@ -595,14 +600,13 @@ void cgit_print_pageheader(struct cgit_context *ctx)
595 html("' alt='cgit logo'/></a></td>\n"); 600 html("' alt='cgit logo'/></a></td>\n");
596 601
597 html("<td class='main'>"); 602 html("<td class='main'>");
598 if (ctx->repo) { 603 if (ctx->repo) {
599 cgit_index_link("index", NULL, NULL, NULL, 0); 604 cgit_index_link("index", NULL, NULL, NULL, 0);
600 html(" : "); 605 html(" : ");
601 reporevlink(NULL, ctx->repo->name, NULL, hc(cmd, "summary"), 606 cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL, NULL);
602 ctx->qry.head, NULL, NULL);
603 html("</td><td class='form'>"); 607 html("</td><td class='form'>");
604 html("<form method='get' action=''>\n"); 608 html("<form method='get' action=''>\n");
605 add_hidden_formfields(0, 1, ctx->qry.page); 609 add_hidden_formfields(0, 1, ctx->qry.page);
606 html("<select name='h' onchange='this.form.submit();'>\n"); 610 html("<select name='h' onchange='this.form.submit();'>\n");
607 for_each_branch_ref(print_branch_option, ctx->qry.head); 611 for_each_branch_ref(print_branch_option, ctx->qry.head);
608 html("</select> "); 612 html("</select> ");
@@ -624,14 +628,14 @@ void cgit_print_pageheader(struct cgit_context *ctx)
624 html_include(ctx->cfg.index_info); 628 html_include(ctx->cfg.index_info);
625 } 629 }
626 html("</td></tr></table>\n"); 630 html("</td></tr></table>\n");
627 631
628 html("<table class='tabs'><tr><td>\n"); 632 html("<table class='tabs'><tr><td>\n");
629 if (ctx->repo) { 633 if (ctx->repo) {
630 reporevlink(NULL, "summary", NULL, hc(cmd, "summary"), 634 cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL,
631 ctx->qry.head, NULL, NULL); 635 ctx->qry.head);
632 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, 636 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head,
633 ctx->qry.sha1, NULL); 637 ctx->qry.sha1, NULL);
634 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, 638 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head,
635 NULL, NULL, 0, NULL, NULL); 639 NULL, NULL, 0, NULL, NULL);
636 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, 640 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head,
637 ctx->qry.sha1, NULL); 641 ctx->qry.sha1, NULL);