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 if (cgit_index_header) {
22 html("<tr class='nohover'><td colspan='4' class='include-block'>");
23 html_include(cgit_index_header);
26 html("<tr class='nohover'>"
27 "<th class='left'>Name</th>"
28 "<th class='left'>Description</th>"
29 "<th class='left'>Owner</th>"
30 "<th class='left'>Links</th></tr>\n");
32 for (i=0; i<cgit_repolist.count; i++) {
33 repo = &cgit_repolist.repos[i];
34 if ((last_group == NULL && repo->group != NULL) ||
35 (last_group != NULL && repo->group == NULL) ||
36 (last_group != NULL && repo->group!= NULL &&
37 strcmp(repo->group, last_group))) {
38 html("<tr class='nohover'><td colspan='4' class='repogroup'>");
39 html_txt(repo->group);
41 last_group = repo->group;
44 html_link_open(cgit_repourl(repo->url), NULL, NULL);
48 html_ntxt(cgit_max_repodesc_len, repo->desc);
50 html_txt(repo->owner);
52 html_link_open(cgit_pageurl(repo->name, "commit", NULL),
53 "Commit: display last commit", NULL);
55 html_link_open(cgit_pageurl(repo->name, "diff", NULL),
56 "Diff: see changes introduced by last commit", NULL);
58 html_link_open(cgit_pageurl(repo->name, "log", NULL),
59 "Log: show history of the main branch", NULL);
61 html_link_open(cgit_pageurl(repo->name, "tree", NULL),
62 "Tree: browse the files in the main branch", NULL);