X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/7a4e7c8ffbacfad5ac83ad20426d7911c2eacdeb..d5a43b429a4248a02e3a403f76fff0cbae92ef32:/ui-repolist.c diff --git a/ui-repolist.c b/ui-repolist.c index dead1bf..1ae22aa 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -110,12 +110,13 @@ void print_sort_header(const char *title, const char *sort) htmlf("'>%s", title); } -void print_header(int columns) +void print_header() { html(""); print_sort_header("Name", "name"); print_sort_header("Description", "desc"); - print_sort_header("Owner", "owner"); + if (ctx.cfg.enable_index_owner) + print_sort_header("Owner", "owner"); print_sort_header("Idle", "idle"); if (ctx.cfg.enable_index_links) html("Links"); @@ -128,10 +129,10 @@ void print_pager(int items, int pagelen, char *search, char *sort) int i, ofs; char *class = NULL; html("
"); - for(i = 0, ofs = 0; ofs < items; i++, ofs = i * pagelen) { + for (i = 0, ofs = 0; ofs < items; i++, ofs = i * pagelen) { class = (ctx.qry.ofs == ofs) ? "current" : NULL; - cgit_index_link(fmt("[%d]", i+1), fmt("Page %d", i+1), class, - search, sort, ofs); + cgit_index_link(fmt("[%d]", i + 1), fmt("Page %d", i + 1), + class, search, sort, ofs); } html("
"); } @@ -239,13 +240,15 @@ int sort_repolist(char *field) void cgit_print_repolist() { - int i, columns = 4, hits = 0, header = 0; + int i, columns = 3, hits = 0, header = 0; char *last_section = NULL; char *section; int sorted = 0; if (ctx.cfg.enable_index_links) - columns++; + ++columns; + if (ctx.cfg.enable_index_owner) + ++columns; ctx.page.title = ctx.cfg.root_title; cgit_print_http_headers(&ctx); @@ -255,13 +258,13 @@ void cgit_print_repolist() if (ctx.cfg.index_header) html_include(ctx.cfg.index_header); - if(ctx.qry.sort) + if (ctx.qry.sort) sorted = sort_repolist(ctx.qry.sort); else if (ctx.cfg.section_sort) sort_repolist("section"); html(""); - for (i=0; i ctx.qry.ofs + ctx.cfg.max_repo_count) continue; if (!header++) - print_header(columns); + print_header(); section = ctx.repo->section; if (section && !strcmp(section, "")) section = NULL; @@ -294,8 +297,10 @@ void cgit_print_repolist() html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc); html_link_close(); html(""); if (ctx.cfg.enable_index_links) {
"); - html_txt(ctx.repo->owner); - html(""); + if (ctx.cfg.enable_index_owner) { + html_txt(ctx.repo->owner); + html(""); + } print_modtime(ctx.repo); html("