-rw-r--r-- | ui-repolist.c | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/ui-repolist.c b/ui-repolist.c index 3e97ca9..eeeaf3d 100644 --- a/ui-repolist.c +++ b/ui-repolist.c | |||
@@ -8,5 +8,7 @@ | |||
8 | 8 | ||
9 | #include "cgit.h" | ||
10 | #include <time.h> | 9 | #include <time.h> |
11 | 10 | ||
11 | #include "cgit.h" | ||
12 | #include "html.h" | ||
13 | #include "ui-shared.h" | ||
12 | 14 | ||
@@ -27,3 +29,3 @@ time_t read_agefile(char *path) | |||
27 | 29 | ||
28 | static void print_modtime(struct repoinfo *repo) | 30 | static void print_modtime(struct cgit_repo *repo) |
29 | { | 31 | { |
@@ -32,3 +34,3 @@ static void print_modtime(struct repoinfo *repo) | |||
32 | 34 | ||
33 | path = fmt("%s/%s", repo->path, cgit_agefile); | 35 | path = fmt("%s/%s", repo->path, ctx.cfg.agefile); |
34 | if (stat(path, &s) == 0) { | 36 | if (stat(path, &s) == 0) { |
@@ -44,3 +46,3 @@ static void print_modtime(struct repoinfo *repo) | |||
44 | 46 | ||
45 | void cgit_print_repolist(struct cacheitem *item) | 47 | void cgit_print_repolist() |
46 | { | 48 | { |
@@ -49,13 +51,15 @@ void cgit_print_repolist(struct cacheitem *item) | |||
49 | 51 | ||
50 | if (cgit_enable_index_links) | 52 | if (ctx.cfg.enable_index_links) |
51 | columns++; | 53 | columns++; |
52 | 54 | ||
53 | cgit_print_docstart(cgit_root_title, item); | 55 | ctx.page.title = ctx.cfg.root_title; |
54 | cgit_print_pageheader(cgit_root_title, 0); | 56 | cgit_print_http_headers(&ctx); |
57 | cgit_print_docstart(&ctx); | ||
58 | cgit_print_pageheader(&ctx); | ||
55 | 59 | ||
56 | html("<table summary='repository list' class='list nowrap'>"); | 60 | html("<table summary='repository list' class='list nowrap'>"); |
57 | if (cgit_index_header) { | 61 | if (ctx.cfg.index_header) { |
58 | htmlf("<tr class='nohover'><td colspan='%d' class='include-block'>", | 62 | htmlf("<tr class='nohover'><td colspan='%d' class='include-block'>", |
59 | columns); | 63 | columns); |
60 | html_include(cgit_index_header); | 64 | html_include(ctx.cfg.index_header); |
61 | html("</td></tr>"); | 65 | html("</td></tr>"); |
@@ -67,3 +71,3 @@ void cgit_print_repolist(struct cacheitem *item) | |||
67 | "<th class='left'>Idle</th>"); | 71 | "<th class='left'>Idle</th>"); |
68 | if (cgit_enable_index_links) | 72 | if (ctx.cfg.enable_index_links) |
69 | html("<th>Links</th>"); | 73 | html("<th>Links</th>"); |
@@ -72,28 +76,28 @@ void cgit_print_repolist(struct cacheitem *item) | |||
72 | for (i=0; i<cgit_repolist.count; i++) { | 76 | for (i=0; i<cgit_repolist.count; i++) { |
73 | cgit_repo = &cgit_repolist.repos[i]; | 77 | ctx.repo = &cgit_repolist.repos[i]; |
74 | if ((last_group == NULL && cgit_repo->group != NULL) || | 78 | if ((last_group == NULL && ctx.repo->group != NULL) || |
75 | (last_group != NULL && cgit_repo->group == NULL) || | 79 | (last_group != NULL && ctx.repo->group == NULL) || |
76 | (last_group != NULL && cgit_repo->group != NULL && | 80 | (last_group != NULL && ctx.repo->group != NULL && |
77 | strcmp(cgit_repo->group, last_group))) { | 81 | strcmp(ctx.repo->group, last_group))) { |
78 | htmlf("<tr class='nohover'><td colspan='%d' class='repogroup'>", | 82 | htmlf("<tr class='nohover'><td colspan='%d' class='repogroup'>", |
79 | columns); | 83 | columns); |
80 | html_txt(cgit_repo->group); | 84 | html_txt(ctx.repo->group); |
81 | html("</td></tr>"); | 85 | html("</td></tr>"); |
82 | last_group = cgit_repo->group; | 86 | last_group = ctx.repo->group; |
83 | } | 87 | } |
84 | htmlf("<tr><td class='%s'>", | 88 | htmlf("<tr><td class='%s'>", |
85 | cgit_repo->group ? "sublevel-repo" : "toplevel-repo"); | 89 | ctx.repo->group ? "sublevel-repo" : "toplevel-repo"); |
86 | html_link_open(cgit_repourl(cgit_repo->url), NULL, NULL); | 90 | html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL); |
87 | html_txt(cgit_repo->name); | 91 | html_txt(ctx.repo->name); |
88 | html_link_close(); | 92 | html_link_close(); |
89 | html("</td><td>"); | 93 | html("</td><td>"); |
90 | html_ntxt(cgit_max_repodesc_len, cgit_repo->desc); | 94 | html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc); |
91 | html("</td><td>"); | 95 | html("</td><td>"); |
92 | html_txt(cgit_repo->owner); | 96 | html_txt(ctx.repo->owner); |
93 | html("</td><td>"); | 97 | html("</td><td>"); |
94 | print_modtime(cgit_repo); | 98 | print_modtime(ctx.repo); |
95 | html("</td>"); | 99 | html("</td>"); |
96 | if (cgit_enable_index_links) { | 100 | if (ctx.cfg.enable_index_links) { |
97 | html("<td>"); | 101 | html("<td>"); |
98 | html_link_open(cgit_repourl(cgit_repo->url), | 102 | html_link_open(cgit_repourl(ctx.repo->url), |
99 | NULL, "button"); | 103 | NULL, "button"); |