*/
#include "cgit.h"
+#include "ui-repolist.h"
#include "html.h"
#include "ui-shared.h"
#include <strings.h>
-time_t read_agefile(char *path)
+static time_t read_agefile(char *path)
{
time_t result;
size_t size;
cgit_print_age(t, -1, NULL);
}
-int is_match(struct cgit_repo *repo)
+static int is_match(struct cgit_repo *repo)
{
if (!ctx.qry.search)
return 1;
return 0;
}
-int is_in_url(struct cgit_repo *repo)
+static int is_in_url(struct cgit_repo *repo)
{
if (!ctx.qry.url)
return 1;
return 0;
}
-void print_sort_header(const char *title, const char *sort)
+static void print_sort_header(const char *title, const char *sort)
{
htmlf("<th class='left'><a href='%s?s=%s", cgit_rooturl(), sort);
if (ctx.qry.search) {
htmlf("'>%s</a></th>", title);
}
-void print_header(int columns)
+static void print_header()
{
html("<tr class='nohover'>");
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("<th class='left'>Links</th>");
}
-void print_pager(int items, int pagelen, char *search, char *sort)
+static void print_pager(int items, int pagelen, char *search, char *sort)
{
int i, ofs;
char *class = NULL;
- html("<div class='pager'>");
- for(i = 0, ofs = 0; ofs < items; i++, ofs = i * pagelen) {
+ html("<ul class='pager'>");
+ 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);
+ html("<li>");
+ cgit_index_link(fmt("[%d]", i + 1), fmt("Page %d", i + 1),
+ class, search, sort, ofs);
+ html("</li>");
}
- html("</div>");
+ html("</ul>");
}
static int cmp(const char *s1, const char *s2)
{NULL, NULL}
};
-int sort_repolist(char *field)
+static int sort_repolist(char *field)
{
struct sortcolumn *column;
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);
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("<table summary='repository list' class='list nowrap'>");
- for (i=0; i<cgit_repolist.count; i++) {
+ for (i = 0; i < cgit_repolist.count; i++) {
ctx.repo = &cgit_repolist.repos[i];
if (!(is_match(ctx.repo) && is_in_url(ctx.repo)))
continue;
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;
html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc);
html_link_close();
html("</td><td>");
- html_txt(ctx.repo->owner);
- html("</td><td>");
+ if (ctx.cfg.enable_index_owner) {
+ html_txt(ctx.repo->owner);
+ html("</td><td>");
+ }
print_modtime(ctx.repo);
html("</td>");
if (ctx.cfg.enable_index_links) {