blob: 8e367a2e34e386944bf9b2915c68945f1f886acb [file] [log] [blame]
Lars Hjemli74620f12006-12-11 16:48:03 +01001/* 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{
Lars Hjemlice1c7332007-02-03 15:02:55 +010013 struct repoinfo *repo;
14 int i;
Lars Hjemli74620f12006-12-11 16:48:03 +010015
Lars Hjemli74620f12006-12-11 16:48:03 +010016 cgit_print_docstart(cgit_root_title, item);
Lars Hjemlie39d7382006-12-28 02:01:49 +010017 cgit_print_pageheader(cgit_root_title, 0);
Lars Hjemli74620f12006-12-11 16:48:03 +010018
Lars Hjemlic43f1242006-12-22 01:44:32 +010019 html("<table class='list nowrap'>");
Lars Hjemlide69ce02007-05-19 00:00:25 +020020 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 }
Lars Hjemli777faf72007-01-28 00:39:26 +010025 html("<tr class='nohover'>"
Lars Hjemlic43f1242006-12-22 01:44:32 +010026 "<th class='left'>Name</th>"
27 "<th class='left'>Description</th>"
Lars Hjemli8f6f8c32007-05-16 02:12:06 +020028 "<th class='left'>Owner</th>"
29 "<th class='left'>Links</th></tr>\n");
Lars Hjemli74620f12006-12-11 16:48:03 +010030
Lars Hjemlice1c7332007-02-03 15:02:55 +010031 for (i=0; i<cgit_repolist.count; i++) {
32 repo = &cgit_repolist.repos[i];
Lars Hjemli74620f12006-12-11 16:48:03 +010033 html("<tr><td>");
Lars Hjemlice1c7332007-02-03 15:02:55 +010034 html_link_open(cgit_repourl(repo->url), NULL, NULL);
35 html_txt(repo->name);
Lars Hjemli74620f12006-12-11 16:48:03 +010036 html_link_close();
37 html("</td><td>");
Lars Hjemlic1ad6cb2007-05-16 10:45:45 +020038 html_ntxt(cgit_max_repodesc_len, repo->desc);
Lars Hjemli74620f12006-12-11 16:48:03 +010039 html("</td><td>");
Lars Hjemlice1c7332007-02-03 15:02:55 +010040 html_txt(repo->owner);
Lars Hjemli8f6f8c32007-05-16 02:12:06 +020041 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>");
Lars Hjemli74620f12006-12-11 16:48:03 +010054 html("</td></tr>\n");
55 }
Lars Hjemli74620f12006-12-11 16:48:03 +010056 html("</table>");
57 cgit_print_docend();
58}