]> gitweb.ps.run Git - ps-cgit/blob - ui-repolist.c
Merge branch 'virtual-url'
[ps-cgit] / ui-repolist.c
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
11 void 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         if (cgit_index_header) {
21                 html("<tr class='nohover'><td colspan='4' class='include-block'>");
22                 html_include(cgit_index_header);
23                 html("</td></tr>");
24         }
25         html("<tr class='nohover'>"
26              "<th class='left'>Name</th>"
27              "<th class='left'>Description</th>"
28              "<th class='left'>Owner</th>"
29              "<th class='left'>Links</th></tr>\n");
30
31         for (i=0; i<cgit_repolist.count; i++) {
32                 repo = &cgit_repolist.repos[i];
33                 html("<tr><td>");
34                 html_link_open(cgit_repourl(repo->url), NULL, NULL);
35                 html_txt(repo->name);
36                 html_link_close();
37                 html("</td><td>");
38                 html_ntxt(cgit_max_repodesc_len, repo->desc);
39                 html("</td><td>");
40                 html_txt(repo->owner);
41                 html("</td><td>");
42                 html_link_open(cgit_pageurl(repo->name, "commit", NULL),
43                                "Commit: display last commit", NULL);
44                 html("C</a> ");
45                 html_link_open(cgit_pageurl(repo->name, "diff", NULL),
46                                "Diff: see changes introduced by last commit", NULL);
47                 html("D</a> ");
48                 html_link_open(cgit_pageurl(repo->name, "log", NULL),
49                                "Log: show history of the main branch", NULL);
50                 html("L</a> ");
51                 html_link_open(cgit_pageurl(repo->name, "tree", NULL),
52                                "Tree: browse the files in the main branch", NULL);
53                 html("T</a>");
54                 html("</td></tr>\n");
55         }
56         html("</table>");
57         cgit_print_docend();
58 }