summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
authorLars Hjemli <hjemli@gmail.com>2008-02-16 12:56:09 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-02-16 12:56:09 (UTC)
commitd1f3bbe9d22029f45a77bb938c176ccc0c827d46 (patch) (unidiff)
tree3f1741c012763cbc5485f31377abdd9241fbac6b /ui-shared.c
parentb228d4ff82a65fdcd4a7364759fe36a0bdda5978 (diff)
downloadcgit-d1f3bbe9d22029f45a77bb938c176ccc0c827d46.zip
cgit-d1f3bbe9d22029f45a77bb938c176ccc0c827d46.tar.gz
cgit-d1f3bbe9d22029f45a77bb938c176ccc0c827d46.tar.bz2
Move cgit_repo into cgit_context
This removes the global variable which is used to keep track of the currently selected repository, and adds a new variable in the cgit_context structure. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-shared.c') (more/less context) (ignore 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
@@ -140,10 +140,10 @@ static char *repolink(char *title, char *class, char *page, char *head,
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("/");
@@ -152,10 +152,10 @@ static char *repolink(char *title, char *class, char *page, char *head,
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("/");
@@ -163,9 +163,9 @@ static char *repolink(char *title, char *class, char *page, char *head,
163 html_attr(path); 163 html_attr(path);
164 } 164 }
165 delim = "&amp;"; 165 delim = "&amp;";
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 = "&amp;"; 171 delim = "&amp;";
@@ -445,9 +445,9 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page)
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);
@@ -477,14 +477,14 @@ void cgit_print_pageheader(char *title, int show_search)
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);
@@ -500,15 +500,15 @@ void cgit_print_pageheader(char *title, int show_search)
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);