diff options
author | Lars Hjemli <hjemli@gmail.com> | 2006-12-12 00:48:03 (JST) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2006-12-12 00:49:18 (JST) |
commit | 74620f12e4f7e91cb0a0b4ca731e07272d1b65f6 (patch) | |
tree | 2e4db980535682c0a606d425b2937126d4b2c09b /cgit.c | |
parent | 5a106eb09b9b5e189b96cc736046a92b054f6c7f (diff) | |
download | cgit-74620f12e4f7e91cb0a0b4ca731e07272d1b65f6.zip cgit-74620f12e4f7e91cb0a0b4ca731e07272d1b65f6.tar.gz |
Move functions for repolist output into ui-repolist.c
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'cgit.c')
-rw-r--r-- | cgit.c | 69 |
1 files changed, 0 insertions, 69 deletions
@@ -84,26 +84,6 @@ void cgit_querystring_cb(const char *name, const char *value) | |||
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | char *cgit_repourl(const char *reponame) | ||
88 | { | ||
89 | if (cgit_virtual_root) { | ||
90 | return fmt("%s/%s/", cgit_virtual_root, reponame); | ||
91 | } else { | ||
92 | return fmt("?r=%s", reponame); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | char *cgit_pageurl(const char *reponame, const char *pagename, | ||
97 | const char *query) | ||
98 | { | ||
99 | if (cgit_virtual_root) { | ||
100 | return fmt("%s/%s/%s/?%s", cgit_virtual_root, reponame, | ||
101 | pagename, query); | ||
102 | } else { | ||
103 | return fmt("?r=%s&p=%s&%s", reponame, pagename, query); | ||
104 | } | ||
105 | } | ||
106 | |||
107 | static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, | 87 | static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, |
108 | int flags, void *cb_data) | 88 | int flags, void *cb_data) |
109 | { | 89 | { |
@@ -134,55 +114,6 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, | |||
134 | return 0; | 114 | return 0; |
135 | } | 115 | } |
136 | 116 | ||
137 | static void cgit_print_repolist(struct cacheitem *item) | ||
138 | { | ||
139 | DIR *d; | ||
140 | struct dirent *de; | ||
141 | struct stat st; | ||
142 | char *name; | ||
143 | |||
144 | chdir(cgit_root); | ||
145 | cgit_print_docstart(cgit_root_title, item); | ||
146 | cgit_print_pageheader(cgit_root_title); | ||
147 | |||
148 | if (!(d = opendir("."))) { | ||
149 | cgit_print_error(fmt("Unable to scan repository directory: %s", | ||
150 | strerror(errno))); | ||
151 | cgit_print_docend(); | ||
152 | return; | ||
153 | } | ||
154 | |||
155 | html("<h2>Repositories</h2>\n"); | ||
156 | html("<table class='list'>"); | ||
157 | html("<tr><th>Name</th><th>Description</th><th>Owner</th></tr>\n"); | ||
158 | while ((de = readdir(d)) != NULL) { | ||
159 | if (de->d_name[0] == '.') | ||
160 | continue; | ||
161 | if (stat(de->d_name, &st) < 0) | ||
162 | continue; | ||
163 | if (!S_ISDIR(st.st_mode)) | ||
164 | continue; | ||
165 | |||
166 | cgit_repo_name = cgit_repo_desc = cgit_repo_owner = NULL; | ||
167 | name = fmt("%s/info/cgit", de->d_name); | ||
168 | if (cgit_read_config(name, cgit_repo_config_cb)) | ||
169 | continue; | ||
170 | |||
171 | html("<tr><td>"); | ||
172 | html_link_open(cgit_repourl(de->d_name), NULL, NULL); | ||
173 | html_txt(cgit_repo_name); | ||
174 | html_link_close(); | ||
175 | html("</td><td>"); | ||
176 | html_txt(cgit_repo_desc); | ||
177 | html("</td><td>"); | ||
178 | html_txt(cgit_repo_owner); | ||
179 | html("</td></tr>\n"); | ||
180 | } | ||
181 | closedir(d); | ||
182 | html("</table>"); | ||
183 | cgit_print_docend(); | ||
184 | } | ||
185 | |||
186 | static void cgit_print_branches() | 117 | static void cgit_print_branches() |
187 | { | 118 | { |
188 | html("<table class='list'>"); | 119 | html("<table class='list'>"); |