summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
Unidiff
Diffstat (limited to 'ui-shared.c') (more/less context) (show whitespace changes)
-rw-r--r--ui-shared.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/ui-shared.c b/ui-shared.c
index b96237d..b9f487a 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -132,48 +132,48 @@ static char *repolink(char *title, char *class, char *page, char *head,
132 html("'"); 132 html("'");
133 } 133 }
134 if (class) { 134 if (class) {
135 html(" class='"); 135 html(" class='");
136 html_attr(class); 136 html_attr(class);
137 html("'"); 137 html("'");
138 } 138 }
139 html(" href='"); 139 html(" href='");
140 if (ctx.cfg.virtual_root) { 140 if (ctx.cfg.virtual_root) {
141 html_attr(ctx.cfg.virtual_root); 141 html_attr(ctx.cfg.virtual_root);
142 if (ctx.cfg.virtual_root[strlen(ctx.cfg.virtual_root) - 1] != '/') 142 if (ctx.cfg.virtual_root[strlen(ctx.cfg.virtual_root) - 1] != '/')
143 html("/"); 143 html("/");
144 html_attr(cgit_repo->url); 144 html_attr(ctx.repo->url);
145 if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/') 145 if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/')
146 html("/"); 146 html("/");
147 if (page) { 147 if (page) {
148 html(page); 148 html(page);
149 html("/"); 149 html("/");
150 if (path) 150 if (path)
151 html_attr(path); 151 html_attr(path);
152 } 152 }
153 } else { 153 } else {
154 html(ctx.cfg.script_name); 154 html(ctx.cfg.script_name);
155 html("?url="); 155 html("?url=");
156 html_attr(cgit_repo->url); 156 html_attr(ctx.repo->url);
157 if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/') 157 if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/')
158 html("/"); 158 html("/");
159 if (page) { 159 if (page) {
160 html(page); 160 html(page);
161 html("/"); 161 html("/");
162 if (path) 162 if (path)
163 html_attr(path); 163 html_attr(path);
164 } 164 }
165 delim = "&"; 165 delim = "&";
166 } 166 }
167 if (head && strcmp(head, cgit_repo->defbranch)) { 167 if (head && strcmp(head, ctx.repo->defbranch)) {
168 html(delim); 168 html(delim);
169 html("h="); 169 html("h=");
170 html_attr(head); 170 html_attr(head);
171 delim = "&"; 171 delim = "&";
172 } 172 }
173 return fmt("%s", delim); 173 return fmt("%s", delim);
174} 174}
175 175
176static void reporevlink(char *page, char *name, char *title, char *class, 176static void reporevlink(char *page, char *name, char *title, char *class,
177 char *head, char *rev, char *path) 177 char *head, char *rev, char *path)
178{ 178{
179 char *delim; 179 char *delim;
@@ -437,25 +437,25 @@ int print_archive_ref(const char *refname, const unsigned char *sha1,
437 437
438void add_hidden_formfields(int incl_head, int incl_search, char *page) 438void add_hidden_formfields(int incl_head, int incl_search, char *page)
439{ 439{
440 char *url; 440 char *url;
441 441
442 if (!ctx.cfg.virtual_root) { 442 if (!ctx.cfg.virtual_root) {
443 url = fmt("%s/%s", ctx.qry.repo, page); 443 url = fmt("%s/%s", ctx.qry.repo, page);
444 if (ctx.qry.path) 444 if (ctx.qry.path)
445 url = fmt("%s/%s", url, ctx.qry.path); 445 url = fmt("%s/%s", url, ctx.qry.path);
446 html_hidden("url", url); 446 html_hidden("url", url);
447 } 447 }
448 448
449 if (incl_head && strcmp(ctx.qry.head, cgit_repo->defbranch)) 449 if (incl_head && strcmp(ctx.qry.head, ctx.repo->defbranch))
450 html_hidden("h", ctx.qry.head); 450 html_hidden("h", ctx.qry.head);
451 451
452 if (ctx.qry.sha1) 452 if (ctx.qry.sha1)
453 html_hidden("id", ctx.qry.sha1); 453 html_hidden("id", ctx.qry.sha1);
454 if (ctx.qry.sha2) 454 if (ctx.qry.sha2)
455 html_hidden("id2", ctx.qry.sha2); 455 html_hidden("id2", ctx.qry.sha2);
456 456
457 if (incl_search) { 457 if (incl_search) {
458 if (ctx.qry.grep) 458 if (ctx.qry.grep)
459 html_hidden("qt", ctx.qry.grep); 459 html_hidden("qt", ctx.qry.grep);
460 if (ctx.qry.search) 460 if (ctx.qry.search)
461 html_hidden("q", ctx.qry.search); 461 html_hidden("q", ctx.qry.search);
@@ -469,54 +469,54 @@ void cgit_print_pageheader(char *title, int show_search)
469 char *url; 469 char *url;
470 470
471 html("<table id='layout' summary=''>\n"); 471 html("<table id='layout' summary=''>\n");
472 html("<tr><td id='sidebar'>\n"); 472 html("<tr><td id='sidebar'>\n");
473 html("<table class='sidebar' cellspacing='0' summary=''>\n"); 473 html("<table class='sidebar' cellspacing='0' summary=''>\n");
474 html("<tr><td class='sidebar'>\n<a href='"); 474 html("<tr><td class='sidebar'>\n<a href='");
475 html_attr(cgit_rooturl()); 475 html_attr(cgit_rooturl());
476 htmlf("'><img src='%s' alt='cgit'/></a>\n", 476 htmlf("'><img src='%s' alt='cgit'/></a>\n",
477 ctx.cfg.logo); 477 ctx.cfg.logo);
478 html("</td></tr>\n<tr><td class='sidebar'>\n"); 478 html("</td></tr>\n<tr><td class='sidebar'>\n");
479 if (ctx.qry.repo) { 479 if (ctx.qry.repo) {
480 html("<h1 class='first'>"); 480 html("<h1 class='first'>");
481 html_txt(strrpart(cgit_repo->name, 20)); 481 html_txt(strrpart(ctx.repo->name, 20));
482 html("</h1>\n"); 482 html("</h1>\n");
483 html_txt(cgit_repo->desc); 483 html_txt(ctx.repo->desc);
484 if (cgit_repo->owner) { 484 if (ctx.repo->owner) {
485 html("<h1>owner</h1>\n"); 485 html("<h1>owner</h1>\n");
486 html_txt(cgit_repo->owner); 486 html_txt(ctx.repo->owner);
487 } 487 }
488 html("<h1>navigate</h1>\n"); 488 html("<h1>navigate</h1>\n");
489 reporevlink(NULL, "summary", NULL, "menu", ctx.qry.head, 489 reporevlink(NULL, "summary", NULL, "menu", ctx.qry.head,
490 NULL, NULL); 490 NULL, NULL);
491 cgit_log_link("log", NULL, "menu", ctx.qry.head, NULL, NULL, 491 cgit_log_link("log", NULL, "menu", ctx.qry.head, NULL, NULL,
492 0, NULL, NULL); 492 0, NULL, NULL);
493 cgit_tree_link("tree", NULL, "menu", ctx.qry.head, 493 cgit_tree_link("tree", NULL, "menu", ctx.qry.head,
494 ctx.qry.sha1, NULL); 494 ctx.qry.sha1, NULL);
495 cgit_commit_link("commit", NULL, "menu", ctx.qry.head, 495 cgit_commit_link("commit", NULL, "menu", ctx.qry.head,
496 ctx.qry.sha1); 496 ctx.qry.sha1);
497 cgit_diff_link("diff", NULL, "menu", ctx.qry.head, 497 cgit_diff_link("diff", NULL, "menu", ctx.qry.head,
498 ctx.qry.sha1, ctx.qry.sha2, NULL); 498 ctx.qry.sha1, ctx.qry.sha2, NULL);
499 cgit_patch_link("patch", NULL, "menu", ctx.qry.head, 499 cgit_patch_link("patch", NULL, "menu", ctx.qry.head,
500 ctx.qry.sha1); 500 ctx.qry.sha1);
501 501
502 for_each_ref(print_archive_ref, &header); 502 for_each_ref(print_archive_ref, &header);
503 503
504 if (cgit_repo->clone_url || ctx.cfg.clone_prefix) { 504 if (ctx.repo->clone_url || ctx.cfg.clone_prefix) {
505 html("<h1>clone</h1>\n"); 505 html("<h1>clone</h1>\n");
506 if (cgit_repo->clone_url) 506 if (ctx.repo->clone_url)
507 url = cgit_repo->clone_url; 507 url = ctx.repo->clone_url;
508 else 508 else
509 url = fmt("%s%s", ctx.cfg.clone_prefix, 509 url = fmt("%s%s", ctx.cfg.clone_prefix,
510 cgit_repo->url); 510 ctx.repo->url);
511 html("<a class='menu' href='"); 511 html("<a class='menu' href='");
512 html_attr(url); 512 html_attr(url);
513 html("' title='"); 513 html("' title='");
514 html_attr(url); 514 html_attr(url);
515 html("'>\n"); 515 html("'>\n");
516 html_txt(strrpart(url, 20)); 516 html_txt(strrpart(url, 20));
517 html("</a>\n"); 517 html("</a>\n");
518 } 518 }
519 519
520 html("<h1>branch</h1>\n"); 520 html("<h1>branch</h1>\n");
521 html("<form method='get' action=''>\n"); 521 html("<form method='get' action=''>\n");
522 add_hidden_formfields(0, 1, ctx.qry.page); 522 add_hidden_formfields(0, 1, ctx.qry.page);