summaryrefslogtreecommitdiffabout
path: root/ui-repolist.c
authorLars Hjemli <hjemli@gmail.com>2009-09-13 20:02:07 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2009-09-13 20:02:07 (UTC)
commit92f6940975f6771f3a08d497c02575ee5bdc79da (patch) (unidiff)
treec1c538b24e50be3bf63356acf246cda76b91c519 /ui-repolist.c
parent5f12e45fe3338095916a444ff106dd9fc9991d84 (diff)
parentee554849ac7209fa8f7486327ec9f3b370e4c876 (diff)
downloadcgit-92f6940975f6771f3a08d497c02575ee5bdc79da.zip
cgit-92f6940975f6771f3a08d497c02575ee5bdc79da.tar.gz
cgit-92f6940975f6771f3a08d497c02575ee5bdc79da.tar.bz2
Merge branch 'lh/repo-scan'
Diffstat (limited to 'ui-repolist.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-repolist.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/ui-repolist.c b/ui-repolist.c
index 7c7aa9b..3ef2e99 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -138,2 +138,14 @@ static int cmp(const char *s1, const char *s2)
138 138
139static int sort_section(const void *a, const void *b)
140{
141 const struct cgit_repo *r1 = a;
142 const struct cgit_repo *r2 = b;
143 int result;
144
145 result = cmp(r1->section, r2->section);
146 if (!result)
147 result = cmp(r1->name, r2->name);
148 return result;
149}
150
139static int sort_name(const void *a, const void *b) 151static int sort_name(const void *a, const void *b)
@@ -180,2 +192,3 @@ struct sortcolumn {
180struct sortcolumn sortcolumn[] = { 192struct sortcolumn sortcolumn[] = {
193 {"section", sort_section},
181 {"name", sort_name}, 194 {"name", sort_name},
@@ -205,3 +218,4 @@ void cgit_print_repolist()
205 int i, columns = 4, hits = 0, header = 0; 218 int i, columns = 4, hits = 0, header = 0;
206 char *last_group = NULL; 219 char *last_section = NULL;
220 char *section;
207 int sorted = 0; 221 int sorted = 0;
@@ -221,2 +235,4 @@ void cgit_print_repolist()
221 sorted = sort_repolist(ctx.qry.sort); 235 sorted = sort_repolist(ctx.qry.sort);
236 else
237 sort_repolist("section");
222 238
@@ -234,15 +250,18 @@ void cgit_print_repolist()
234 print_header(columns); 250 print_header(columns);
251 section = ctx.repo->section;
252 if (section && !strcmp(section, ""))
253 section = NULL;
235 if (!sorted && 254 if (!sorted &&
236 ((last_group == NULL && ctx.repo->group != NULL) || 255 ((last_section == NULL && section != NULL) ||
237 (last_group != NULL && ctx.repo->group == NULL) || 256 (last_section != NULL && section == NULL) ||
238 (last_group != NULL && ctx.repo->group != NULL && 257 (last_section != NULL && section != NULL &&
239 strcmp(ctx.repo->group, last_group)))) { 258 strcmp(section, last_section)))) {
240 htmlf("<tr class='nohover'><td colspan='%d' class='repogroup'>", 259 htmlf("<tr class='nohover'><td colspan='%d' class='reposection'>",
241 columns); 260 columns);
242 html_txt(ctx.repo->group); 261 html_txt(section);
243 html("</td></tr>"); 262 html("</td></tr>");
244 last_group = ctx.repo->group; 263 last_section = section;
245 } 264 }
246 htmlf("<tr><td class='%s'>", 265 htmlf("<tr><td class='%s'>",
247 !sorted && ctx.repo->group ? "sublevel-repo" : "toplevel-repo"); 266 !sorted && section ? "sublevel-repo" : "toplevel-repo");
248 cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); 267 cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL);