1 /* ui-repolist.c: functions for generating the repolist page
3 * Copyright (C) 2006 Lars Hjemli
5 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text)
11 void cgit_print_repolist(struct cacheitem *item)
13 struct repoinfo *repo;
15 char *last_group = NULL;
17 cgit_print_docstart(cgit_root_title, item);
18 cgit_print_pageheader(cgit_root_title, 0);
20 html("<table class='list nowrap'>");
21 html("<tr class='nohover'>"
22 "<th class='left'>Name</th>"
23 "<th class='left'>Description</th>"
24 "<th class='left'>Owner</th>"
25 "<th class='left'>Links</th></tr>\n");
27 for (i=0; i<cgit_repolist.count; i++) {
28 repo = &cgit_repolist.repos[i];
29 if ((last_group == NULL && repo->group != NULL) ||
30 (last_group != NULL && repo->group == NULL) ||
31 (last_group != NULL && repo->group!= NULL &&
32 strcmp(repo->group, last_group))) {
33 html("<tr><td colspan='4' class='repogroup'>");
34 html_txt(repo->group);
36 last_group = repo->group;
39 html_link_open(cgit_repourl(repo->url), NULL, NULL);
43 html_ntxt(cgit_max_repodesc_len, repo->desc);
45 html_txt(repo->owner);
47 html_link_open(cgit_pageurl(repo->name, "commit", NULL),
48 "Commit: display last commit", NULL);
50 html_link_open(cgit_pageurl(repo->name, "diff", NULL),
51 "Diff: see changes introduced by last commit", NULL);
53 html_link_open(cgit_pageurl(repo->name, "log", NULL),
54 "Log: show history of the main branch", NULL);
56 html_link_open(cgit_pageurl(repo->name, "tree", NULL),
57 "Tree: browse the files in the main branch", NULL);