blob: 872458983361fb5917b3b8b2aaea84aeb1ea5163 [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 Hjemli5877c492007-05-18 22:48:22 +020015 char *last_group = NULL;
Lars Hjemli74620f12006-12-11 16:48:03 +010016
Lars Hjemli74620f12006-12-11 16:48:03 +010017 cgit_print_docstart(cgit_root_title, item);
Lars Hjemlie39d7382006-12-28 02:01:49 +010018 cgit_print_pageheader(cgit_root_title, 0);
Lars Hjemli74620f12006-12-11 16:48:03 +010019
Lars Hjemlic43f1242006-12-22 01:44:32 +010020 html("<table class='list nowrap'>");
Lars Hjemli777faf72007-01-28 00:39:26 +010021 html("<tr class='nohover'>"
Lars Hjemlic43f1242006-12-22 01:44:32 +010022 "<th class='left'>Name</th>"
23 "<th class='left'>Description</th>"
Lars Hjemli8f6f8c32007-05-16 02:12:06 +020024 "<th class='left'>Owner</th>"
25 "<th class='left'>Links</th></tr>\n");
Lars Hjemli74620f12006-12-11 16:48:03 +010026
Lars Hjemlice1c7332007-02-03 15:02:55 +010027 for (i=0; i<cgit_repolist.count; i++) {
28 repo = &cgit_repolist.repos[i];
Lars Hjemli5877c492007-05-18 22:48:22 +020029 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))) {
Lars Hjemli2aef89e2007-05-18 23:17:09 +020033 html("<tr class='nohover'><td colspan='4' class='repogroup'>");
Lars Hjemli5877c492007-05-18 22:48:22 +020034 html_txt(repo->group);
35 html("</td></tr>");
36 last_group = repo->group;
37 }
Lars Hjemli74620f12006-12-11 16:48:03 +010038 html("<tr><td>");
Lars Hjemlice1c7332007-02-03 15:02:55 +010039 html_link_open(cgit_repourl(repo->url), NULL, NULL);
40 html_txt(repo->name);
Lars Hjemli74620f12006-12-11 16:48:03 +010041 html_link_close();
42 html("</td><td>");
Lars Hjemlic1ad6cb2007-05-16 10:45:45 +020043 html_ntxt(cgit_max_repodesc_len, repo->desc);
Lars Hjemli74620f12006-12-11 16:48:03 +010044 html("</td><td>");
Lars Hjemlice1c7332007-02-03 15:02:55 +010045 html_txt(repo->owner);
Lars Hjemli8f6f8c32007-05-16 02:12:06 +020046 html("</td><td>");
47 html_link_open(cgit_pageurl(repo->name, "commit", NULL),
48 "Commit: display last commit", NULL);
49 html("C</a> ");
50 html_link_open(cgit_pageurl(repo->name, "diff", NULL),
51 "Diff: see changes introduced by last commit", NULL);
52 html("D</a> ");
53 html_link_open(cgit_pageurl(repo->name, "log", NULL),
54 "Log: show history of the main branch", NULL);
55 html("L</a> ");
56 html_link_open(cgit_pageurl(repo->name, "tree", NULL),
57 "Tree: browse the files in the main branch", NULL);
58 html("T</a>");
Lars Hjemli74620f12006-12-11 16:48:03 +010059 html("</td></tr>\n");
60 }
Lars Hjemli74620f12006-12-11 16:48:03 +010061 html("</table>");
62 cgit_print_docend();
63}