ui-repolist.c (view raw)
1/* ui-repolist.c: functions for generating the repolist page
2 *
3 * Copyright (C) 2006 Lars Hjemli
4 *
5 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text)
7 */
8
9#include "cgit.h"
10
11void cgit_print_repolist(struct cacheitem *item)
12{
13 struct repoinfo *repo;
14 int i;
15
16 cgit_print_docstart(cgit_root_title, item);
17 cgit_print_pageheader(cgit_root_title, 0);
18
19 html("<table class='list nowrap'>");
20 html("<tr class='nohover'>"
21 "<th class='left'>Name</th>"
22 "<th class='left'>Description</th>"
23 "<th class='left'>Owner</th>"
24 "<th class='left'>Links</th></tr>\n");
25
26 for (i=0; i<cgit_repolist.count; i++) {
27 repo = &cgit_repolist.repos[i];
28 html("<tr><td>");
29 html_link_open(cgit_repourl(repo->url), NULL, NULL);
30 html_txt(repo->name);
31 html_link_close();
32 html("</td><td>");
33 html_txt(repo->desc);
34 html("</td><td>");
35 html_txt(repo->owner);
36 html("</td><td>");
37 html_link_open(cgit_pageurl(repo->name, "commit", NULL),
38 "Commit: display last commit", NULL);
39 html("C</a> ");
40 html_link_open(cgit_pageurl(repo->name, "diff", NULL),
41 "Diff: see changes introduced by last commit", NULL);
42 html("D</a> ");
43 html_link_open(cgit_pageurl(repo->name, "log", NULL),
44 "Log: show history of the main branch", NULL);
45 html("L</a> ");
46 html_link_open(cgit_pageurl(repo->name, "tree", NULL),
47 "Tree: browse the files in the main branch", NULL);
48 html("T</a>");
49 html("</td></tr>\n");
50 }
51 html("</table>");
52 cgit_print_docend();
53}