1 //
2 // aegis - project change supervisor
3 // Copyright (C) 2003-2008, 2011, 2012 Peter Miller
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see
17 // <http://www.gnu.org/licenses/>.
18 //
19
20 #include <common/ac/stdio.h>
21
22 #include <common/str_list.h>
23 #include <libaegis/change.h>
24 #include <libaegis/cstate.fmtgen.h>
25 #include <libaegis/emit/project.h>
26 #include <libaegis/http.h>
27 #include <libaegis/os.h>
28 #include <libaegis/project.h>
29 #include <libaegis/rss.h>
30
31 #include <aeget/get/project/menu.h>
32
33
34 void
get_project_menu(project * pp,string_ty *,string_list_ty *)35 get_project_menu(project *pp, string_ty *, string_list_ty *)
36 {
37 html_header(pp, 0);
38
39 printf("<title>Project ");
40 html_encode_string(project_name_get(pp));
41 printf("</title></head><body>\n");
42 html_header_ps(pp, 0);
43 printf("<h1 align=center>\n");
44 emit_project_but1(pp);
45 printf("\n</h1>\n");
46
47 change::pointer cp = pp->change_get();
48 cstate_ty *cstate_data = cp->cstate_get();
49
50 if (cstate_data->brief_description)
51 {
52 printf("<div class=\"brief-description\">\n");
53 printf("<h2>Brief Description</h2>\n");
54 html_encode_string(cstate_data->brief_description);
55 printf("\n</div>\n");
56 }
57
58 if (cstate_data->description)
59 {
60 printf("<div class=\"description\">\n");
61 printf("<h2>Description</h2>\n");
62 html_encode_string(cstate_data->description);
63 printf("\n</div>\n");
64 }
65
66 printf("<div class=\"information\">\n");
67 printf("<h2>Information Available</h2>\n");
68 printf("<dl>\n");
69
70 //
71 // Links to sub branches.
72 //
73 if
74 (
75 cstate_data->branch
76 &&
77 cstate_data->branch->sub_branch
78 &&
79 cstate_data->branch->sub_branch->length
80 )
81 {
82 printf("<dt>Branches<dd>");
83 cstate_branch_sub_branch_list_ty *bp = cstate_data->branch->sub_branch;
84 for (size_t j = 0; j < bp->length; ++j)
85 {
86 if (j)
87 printf(",\n");
88 printf("<a href=\"%s/", http_script_name());
89 html_escape_string(project_name_get(pp));
90 long n = magic_zero_decode(bp->list[j]);
91 printf(".%ld/?menu\">", n);
92 html_encode_string(project_name_get(pp));
93 printf(".%ld</a>", n);
94 }
95 printf("\n<p>\n");
96 }
97
98 printf("<dt>");
99 emit_project_href(pp);
100 printf("Baseline</a><dd>\n");
101 printf("This item will provide you with access to the files in\n");
102 printf("the project baseline.\n");
103 if (!pp->is_a_trunk())
104 {
105 printf("The immediate baseline and all ancestor baselines are\n");
106 printf("unioned and presented as a single directory tree.\n");
107 }
108 printf("<p>\n");
109 printf("If you wish to download the sources using\n");
110 printf("“wget -r” or similar, use the\n<i>");
111 emit_project_href(pp, "file+contents+noindex+nolinks+noderived");
112 printf("no navigation links</a></i> variant.\n");
113 printf("<p>\n");
114
115 printf("<dt>");
116 emit_project_href(pp, "aedist");
117 printf("Download</a><dd>\n");
118 printf("This item allows you to download the project in Aegis' own\n");
119 printf("transfer format. It preserves much of the meta-data for\n");
120 printf("the project. You unpack this format using the <i>aedist\n");
121 printf("-receive</i> command.\n");
122 if (!pp->is_a_trunk())
123 {
124 printf("You can also download the branch as a change set, see the ");
125 emit_change_href(pp->change_get(), "menu");
126 printf("corresponding change</a>'s ");
127 emit_change_href(pp->change_get(), "download");
128 printf("download</a> page.\n");
129 }
130 printf("<p>\n");
131
132 printf("<dt>");
133 emit_project_href(pp, "changes");
134 printf("Changes</a><dd>\n");
135 printf("This item will provide you with a list of changes to this\n");
136 printf("project, including those which have not yet commenced, those\n");
137 printf("in progress, and those which have been completed.\n");
138
139 printf("<p>\n");
140 printf("Change lists are also available broken down by change state:\n");
141
142 printf("<table>\n");
143 printf("<tr><td><ul><li>\n");
144 emit_project_href(pp, "changes+awaiting_development");
145 printf("awaiting development</a>");
146 printf("</ul></td><td>\n");
147 nstring rss_filename = rss_feed_filename(pp, "awaiting_development");
148 if (!rss_filename.empty())
149 {
150 emit_rss_icon_with_link(pp, os_basename(rss_filename));
151 }
152 printf("</td></tr>\n");
153
154 printf("<tr><td><ul><li>\n");
155 emit_project_href(pp, "changes+being_developed");
156 printf("being developed</a>");
157 printf("</ul></td><td>\n");
158 rss_filename = rss_feed_filename(pp, "being_developed");
159 if (!rss_filename.empty())
160 {
161 emit_rss_icon_with_link(pp, os_basename(rss_filename));
162 }
163 printf("</td></tr>\n");
164
165 printf("<tr><td><ul><li>\n");
166 emit_project_href(pp, "changes+awaiting_review");
167 printf("awaiting review</a>");
168 printf("</ul></td><td>\n");
169 rss_filename = rss_feed_filename(pp, "awaiting_review");
170 if (!rss_filename.empty())
171 {
172 emit_rss_icon_with_link(pp, os_basename(rss_filename));
173 }
174 printf("</td></tr>\n\n");
175
176 printf("<tr><td><ul><li>\n");
177 emit_project_href(pp, "changes+being_reviewed");
178 printf("being reviewed</a>");
179 printf("</ul></td><td>\n");
180 rss_filename = rss_feed_filename(pp, "being_reviewed");
181 if (!rss_filename.empty())
182 {
183 emit_rss_icon_with_link(pp, os_basename(rss_filename));
184 }
185 printf("</td></tr>\n");
186
187 printf("<tr><td><ul><li>\n");
188 emit_project_href(pp, "changes+awaiting_integration");
189 printf("awaiting integration</a>");
190 printf("</ul></td><td>\n");
191 rss_filename = rss_feed_filename(pp, "awaiting_integration");
192 if (!rss_filename.empty())
193 {
194 emit_rss_icon_with_link(pp, os_basename(rss_filename));
195 }
196 printf("</td></tr>\n");
197
198 printf("<tr><td><ul><li>\n");
199 emit_project_href(pp, "changes+being_integrated");
200 printf("being integrated</a>");
201 printf("</ul></td><td>\n");
202 rss_filename = rss_feed_filename(pp, "being_integrated");
203 if (!rss_filename.empty())
204 {
205 emit_rss_icon_with_link(pp, os_basename(rss_filename));
206 }
207 printf("</td></tr>\n\n");
208
209 printf("<tr><td><ul><li>\n");
210 emit_project_href(pp, "changes+completed");
211 printf("completed</a>");
212 printf("</ul></td><td>\n");
213 rss_filename = rss_feed_filename(pp, "completed");
214 if (!rss_filename.empty())
215 {
216 emit_rss_icon_with_link(pp, os_basename(rss_filename));
217 }
218 printf("</td></tr>\n\n");
219
220 printf("<tr><td><ul><li>\n");
221 emit_project_href(pp, "changes+not+completed");
222 printf("not completed</a>\n");
223 printf("</ul></td><td>\n");
224 printf("</td></tr>\n");
225
226 printf("</table>\n");
227 printf("<p>\n");
228
229 printf("<dt>");
230 emit_project_href(pp, "inventory");
231 printf("Change Set Inventory</a><dd>\n");
232 printf("This item allows you to obtain a list of all available\n");
233 printf("change sets and their corresponding UUIDs. This may be\n");
234 printf("used to automate downloading of change sets not yet in\n");
235 printf("your repository.<p>\n");
236
237 printf("<dt>");
238 emit_project_href(pp, "staff");
239 printf("Staff</a><dd>\n");
240 printf("This item will provide you with a list of staff\n");
241 printf("involved in the project, both past and present. The\n");
242 printf("list includes some statistics about the activities\n");
243 printf("performed by the staff.\n");
244 printf("<p>\n");
245
246 printf("<dt>");
247 emit_project_href(pp, "statistics");
248 printf("Statistics</a><dd>\n");
249 printf("This item will provide you with some statistics about\n");
250 printf("changes within the project. The statistics include\n");
251 printf("change causes, file activity and file types.\n");
252 printf("<p>\n");
253
254 printf("<dt>");
255 emit_project_href(pp, "files");
256 printf("Files</a><dd>\n");
257 printf("This item will provide you with a listing of the files\n");
258 printf("which are the project master source. Links are provided to\n");
259 printf("individual file information.\n");
260 if (!pp->is_a_trunk())
261 {
262 printf("To view only those files changed by this branch, see the ");
263 emit_change_href(pp->change_get(), "menu");
264 printf("corresponding change</a>'s ");
265 emit_change_href(pp->change_get(), "files");
266 printf("file list</a>.\n");
267 }
268 printf("<p>\n");
269
270 printf("<dt>\n");
271 emit_project_href(pp, "file+metrics");
272 printf("File Metrics</a><dd>\n");
273 printf("This item will provide you with a listing of the files\n");
274 printf("with file metrics. There are no default metrics; each\n");
275 printf("project defines its own metrics. Links are provided\n");
276 printf("to individual file information.<p>\n");
277
278 printf("<dt>\n");
279 emit_project_href(pp, "file+activity");
280 printf("File Activity</a><dd>\n");
281 printf("This item will provide you with a listing of files\n");
282 printf("which are actively being modified. The list includes\n");
283 printf("who is working on the changes, and a brief description\n");
284 printf("of each change. Where a file is common to more than\n");
285 printf("one change, all changes are listed against the file.\n");
286 printf("<p>\n");
287
288 printf("<dt>");
289 emit_project_href(pp, "file+conflict");
290 printf("File Conflict</a><dd>\n");
291 printf("This item will provide you with a listing of changes which\n");
292 printf("are actively modifying files <strong>if</strong> more than\n");
293 printf("<em>one</em> change is modifying the file at the same time.\n");
294 printf("<p>\n");
295
296 printf("<dt>");
297 emit_project_href(pp, "file+history");
298 printf("File History</a><dd>\n");
299 printf("This item will provide you with a listing of files and\n");
300 printf("the order in which all completed changes affected them.\n");
301 printf("The ");
302 emit_project_href(pp, "history+detailed");
303 printf("detailed version</a> can take a long time to generate.\n");
304 printf("<p>\n");
305
306 printf("<dt>");
307 emit_project_href(pp, "project+history");
308 printf("History</a><dd>\n");
309 printf("This item will provide you with a listing of completed\n");
310 printf("changes in the order in which they were completed.\n");
311 printf("<p>\n");
312
313 printf("<dt>");
314 emit_project_href(pp, "project+integration-histogram");
315 printf("Integration Histogram</a><dd>\n");
316 printf("This item will provide you with a histogram of changes\n");
317 printf("completed over time.\n");
318 printf("<p>\n");
319
320 printf("<dt>");
321 emit_project_href(pp, "project+progress");
322 printf("Progress Histogram</a><dd>\n");
323 printf("This item will provide you with a histogram of change\n");
324 printf("state transitions over time. This shows you work\n");
325 printf("progressing through the process and contributing\n");
326 printf("towards project progress.\n");
327 printf("<p>\n");
328
329 printf("<dt>");
330 emit_project_href(pp, "project+change-cause");
331 printf("Change Cause Histogram</a><dd>\n");
332 printf("This item will provide you with a histogram of change\n");
333 printf("causes over time. Only completed changes are shown.\n");
334 printf("<p>\n");
335
336 printf("<dt>");
337 emit_project_href(pp, "file+cause-density");
338 printf("Change Cause by File</a><dd>\n");
339 printf("This item will provide you with a histogram of change\n");
340 printf("causes against the files changed. Only completed\n");
341 printf("changes are shown.\n");
342 printf("</dl>\n");
343 printf("</div>\n");
344
345 printf("<hr>\n");
346 printf("<p align=center class=\"navbar\">[\n");
347 printf("<a href=\"%s/\">Project List</a>\n", http_script_name());
348 printf("]</p>\n");
349
350 html_footer(pp, 0);
351 }
352
353
354 // vim: set ts=8 sw=4 et :
355