1/*
2 *	aegis - project change supervisor
3 *	Copyright (C) 1997, 1998, 2002, 2003, 2005-2008 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
20auto script_name;
21script_name = getenv("SCRIPT_NAME");
22if (script_name == "")
23	script_name = "http://localhost/cgi-bin/aegis.cgi";
24
25columns({width = 1000; });
26print("Content-Type: text/html");
27print("");
28print("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\""
29	## "\"http://www.w3.org/TR/REC-html40/loose.dtd\">");
30print("<html><head>");
31print("<meta name=\"ROBOTS\" content=\"NOINDEX, NOFOLLOW\">");
32print("<meta name=\"GENERATOR\" content=\"" ## script_name ## "\">");
33print("<meta http-equiv=\"Content-Type\" "
34	## "content=\"text/html; charset=ISO-8859-1\">");
35print("<style type=\"text/css\"> "
36	## "tr.even-group { background-color: #CCCCCC; }"
37	## "body { background-color: white; }"
38	## "</style>");
39/*
40 * Netscape 4.x has numerous CSS bugs, two of which need mentioning.
41 * 1. If a style sheet is nopt present Netscape says 404 Not found, when
42 * it should silently ignore it.  2. Style sheets who's media is not
43 * "screen" will be ignored.  Fortunately we can use (2) to get around (1).
44 */
45print("<link rel=\"stylesheet\" type=\"text/css\" href=\"/aedefault.css\" "
46	## "media=\"all\">");
47print("<title>");
48print("Project List");
49print ("</title></head><body><h1 align=center>");
50print("Project List");
51print("</h1>");
52print("<div class=\"information\">");
53print("<table align=center>");
54print("<tr class=\"even-group\"><th>Project</th><th>Description</th></tr>");
55
56auto name, p, prev_proj, odd;
57prev_proj = 0;
58odd = false;
59for (name in sort(keys(project)))
60{
61	p = project[name];
62	auto a;
63	a = split(name, ".");
64	if (a[0] != prev_proj)
65	    odd = !odd;
66	prev_proj = a[0];
67
68	/*
69	 * Reading the p.state value (it is deferred) may result
70	 * in "permision denied" so we need to catch the
71	 * exception as it goes past.  Use the error as the
72	 * description.
73	 */
74	auto description, ok;
75	ok = true;
76	try
77		description = quote_html(p.state.description);
78	catch (description)
79	{
80		description = quote_html(description);
81		ok = false;
82	}
83	if (odd)
84	    print("<tr class=\"odd-group\">");
85	else
86	    print("<tr class=\"even-group\">");
87	print("<td valign=top>");
88	if (ok)
89	{
90		auto href;
91
92		href = script_name ## "?file@proj_menu";
93		href ##= "+project@" ## quote_url(name);
94		print("<a href=\"" ## href ## "\">");
95	}
96	print(quote_html(name));
97	if (ok)
98		print("</a>");
99	print("</td><td valign=top>");
100	auto part;
101	print("<div class=\"project-description\">");
102	for (part in wrap_html(description, 80))
103		print(part);
104	print("</div><i>");
105	for (part in wrap(p.directory, 60))
106		print(quote_html(part));
107	print("</i></td></tr>");
108}
109print("<tr><td colspan=2>");
110print("Listed " ## count(keys(project)) ## " projects.");
111print("</td></tr>");
112print("</table>");
113print("</div>");
114
115print("<hr>");
116print("<div class =\"report-cmd\">");
117print("A similar report may be obtained from the command line, with");
118print("<blockquote><samp>ael p</samp></blockquote>");
119print("</div>");
120print("<hr>");
121print("This page was generated " ## now() ## ".");
122print("</body></html>");
123