X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/7f08e03941c40a56fb1b5b3df62aa819fb2d6554..b1e172acca870e7999f2d2d917db7b4c42aa05b3:/ui-repolist.c
diff --git a/ui-repolist.c b/ui-repolist.c
index 943eaab..2a910bd 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -43,8 +43,10 @@ static int get_repo_modtime(const struct cgit_repo *repo, time_t *mtime)
path = fmt("%s/%s", repo->path, ctx.cfg.agefile);
if (stat(path, &s) == 0) {
*mtime = read_agefile(path);
- r->mtime = *mtime;
- return 1;
+ if (*mtime) {
+ r->mtime = *mtime;
+ return 1;
+ }
}
path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch ?
@@ -102,18 +104,19 @@ 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 | ");
@@ -123,11 +126,14 @@ void print_header(int columns)
void print_pager(int items, int pagelen, char *search, char *sort)
{
- int i;
+ int i, ofs;
+ char *class = NULL;
html("");
}
@@ -155,7 +161,7 @@ static int sort_section(const void *a, const void *b)
result = cmp(r1->section, r2->section);
if (!result) {
- if (!strcmp(ctx.cfg.section_sort, "age")) {
+ if (!strcmp(ctx.cfg.repository_sort, "age")) {
// get_repo_modtime caches the value in r->mtime, so we don't
// have to worry about inefficiencies here.
if (get_repo_modtime(r1, &t) && get_repo_modtime(r2, &t))
@@ -234,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);
@@ -252,7 +260,7 @@ void cgit_print_repolist()
if(ctx.qry.sort)
sorted = sort_repolist(ctx.qry.sort);
- else
+ else if (ctx.cfg.section_sort)
sort_repolist("section");
html("");
@@ -266,7 +274,7 @@ void cgit_print_repolist()
if (hits > 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;
@@ -289,8 +297,10 @@ void cgit_print_repolist()
html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc);
html_link_close();
html("| ");
- html_txt(ctx.repo->owner);
- html(" | ");
+ if (ctx.cfg.enable_index_owner) {
+ html_txt(ctx.repo->owner);
+ html(" | ");
+ }
print_modtime(ctx.repo);
html(" | ");
if (ctx.cfg.enable_index_links) {