1/* 2 * aegis - project change supervisor 3 * Copyright (C) 1997, 1998, 2002-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"; 24auto pn; 25pn = project_name(); 26 27auto fn; 28if (count(arg)) 29 fn = arg[0]; 30else 31 fn = "aegis.conf"; 32 33columns({width = 1000; }); 34print("Content-Type: text/html"); 35print(""); 36print("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\""); 37print(" \"http://www.w3.org/TR/REC-html40/loose.dtd\">"); 38 39print("<html><head>"); 40print("<meta name=\"ROBOTS\" content=\"NOINDEX, NOFOLLOW\">"); 41print("<meta name=\"GENERATOR\" content=\"" ## script_name ## "\">"); 42print("<meta http-equiv=\"Content-Type\" " 43 ## "content=\"text/html; charset=ISO-8859-1\">"); 44print("<style type=\"text/css\"> " 45 ## "tr.even-group { background-color: #CCCCCC; } " 46 ## "body { background-color: white; } " 47 ## "</style>"); 48/* 49 * Netscape 4.x has numerous CSS bugs, two of which need mentioning. 50 * 1. If a style sheet is not present Netscape says 404 Not found, when 51 * it should silently ignore it. 2. Style sheets who's media is not 52 * "screen" will be ignored. Fortunately we can use (2) to get around (1). 53 */ 54print("<link rel=\"stylesheet\" type=\"text/css\" href=\"/aedefault.css\" " 55 ## "media=\"all\">"); 56auto stack, depth, n; 57depth=0; 58stack[depth] = project[pn].state.name; 59while ("" != (n = project[stack[depth]].state.parent_name)) 60{ 61 stack[++depth] = n; 62} 63while (depth >= 0) 64{ 65 print("<link rel=\"stylesheet\" type=\"text/css\" href=\"/" ## 66 stack[depth--] ## ".css\" " ## "media=\"all\">"); 67} 68print("<title>"); 69 70print("Project " ## quote_html(pn) ## ","); 71print("File Menu"); 72print("</title></head><body><h1 align=center>"); 73 74auto href; 75print("<a href=\"" ## script_name ## "\">Project</a>"); 76auto long_project_name; 77auto prj_name_parts; 78prj_name_parts = split(pn, '.'); 79href = script_name ## "?file@proj_menu+project@" 80 ## quote_url(prj_name_parts[0]); 81long_project_name = "<a href=\"" ## href ## "\" >" 82 ## quote_html(prj_name_parts[0]) ## "</a>"; 83auto j; 84for (j = 1; j < count(prj_name_parts); j++) 85{ 86 href ##= '.' ## prj_name_parts[j]; 87 long_project_name ##= ".<a href=\"" ## href ## "\" >" 88 ## quote_html(prj_name_parts[j]) ## "</a>"; 89}; 90long_project_name = "“" ## long_project_name ## "”,<br>"; 91/* HTTP limits lines to 510 characters */ 92for (j in wrap(long_project_name, 510)) 93 print(j); 94 95auto ps; 96ps = project[pn].state.branch; 97 98auto cn, cs; 99if (change_number_set()) 100{ 101 cn = change_number(); 102 cs = ps.change[cn]; 103} 104 105print("File “" ## quote_html(fn) ## "”"); 106print("</h1>"); 107 108print("<div class=\"information\">"); 109print("<dl>"); 110 111print("<dt>"); 112href = script_name ## "?file@file_activ+" ## quote_url(fn); 113href ##= "+project@" ## quote_url(pn); 114if (change_number_set()) 115 href ##= "+change@" ## cn; 116print("<a href=\"" ## href ## "\">File Activity</a>"); 117print("<dd>"); 118print("This item will provide you with a listing of changes which are"); 119print("actively modifying this file. The list includes who is working"); 120print("on the changes, and a brief description of each change. Where a"); 121print("file is common to more than one change, all changes are listed"); 122print("against the file."); 123 124print("<dt>"); 125href = script_name ## "?file@file_cflct+" ## quote_url(fn); 126href ##= "+project@" ## quote_url(pn); 127if (change_number_set()) 128 href ##= "+change@" ## cn; 129print("<a href=\"" ## href ## "\">File Conflict</a>"); 130print("<dd>"); 131print("This item will provide you with a listing of changes which are"); 132print("actively modifying this file <strong>if</strong> more than"); 133print("<em>one</em> change is modifying the file."); 134 135href = script_name ## "?file@file_hstry+" ## quote_url(fn); 136href ##= "+project@" ## quote_url(pn); 137print("<dt><a href=\"" ## href ## "\">"); 138print("File History"); 139print("</a><dd>"); 140print("This item will provide you with a listing of all completed"); 141print("changes which affected this file in the past. This report"); 142print("can take a long time to generate."); 143 144auto tps; 145tps = project[pn].state; 146auto i; 147auto deleted_by; 148deleted_by = ""; 149for (i in tps.src) 150{ 151 if (i.file_name == fn) 152 { 153 deleted_by=i.deleted_by; 154 break; 155 } 156} 157 158auto action; 159action=""; 160for (i in cs.src) 161{ 162 if (i.file_name == fn) 163 { 164 action = i.action; 165 break; 166 } 167} 168 169auto baseline_file_exists; 170baseline_file_exists = false; 171print("<dt>"); 172if (deleted_by != "") 173{ 174 print("Baseline"); 175 print("<dd>"); 176 print("The file no longer exists in the baseline."); 177 href = script_name ## "?file@chan_menu"; 178 href ##= "+project@" ## quote_url(pn); 179 href ##= "+change@" ## deleted_by; 180 181 print("It was deleted in change "); 182 print("<a href=\"" ## href ## "\">" ## deleted_by ## "</a>"); 183} 184else if (change_number_set() && cs.state != "completed" && action == "create") 185{ 186 print("Baseline"); 187 print("<dd>"); 188 print("The file does not yet exist in the baseline."); 189 print("It is created by this change, which is not yet integrated"); 190} 191else 192{ 193 href = script_name ## "?file@pre+" ## quote_url(fn); 194 href ##= "+project@" ## quote_url(pn); 195 print("<a href=\"" ## href ## "\">Baseline</a>"); 196 print("<dd>"); 197 print("This item will show you the contents of the file in the project"); 198 print("baseline, the <strong>current</strong> master version."); 199 baseline_file_exists = true; 200} 201 202if (change_number_set()) 203{ 204 if (cs.state != "completed") 205 { 206 print("<dt>"); 207 href = script_name ## "?file@pre+" ## quote_url(fn); 208 href ##= "+project@" ## quote_url(pn); 209 href ##= "+change@" ## cn; 210 print("<a href=\"" ## href ## "\">Change " ## 211 change_number() ## "</a>"); 212 print("<dd>"); 213 print("This item will show you the contents of the file"); 214 print("in change " ## cn ## "."); 215 } 216 else 217 { 218 auto delta; 219 delta=cs.delta_number; 220 221 if (action == "create") 222 { 223 print("<dt>"); 224 print("Pre Change " ## cn); 225 print("<dd>"); 226 print("The file did not exist prior to this change."); 227 } 228 else 229 { 230 auto d; 231 d = delta -1; 232 print("<dt>"); 233 href = script_name ## "?file@pre+" ## "delta@" ## d ## "+"; 234 href ##= quote_url(fn); 235 href ##= "+project@" ## quote_url(pn); 236 print("<a href=\"" ## href ## "\">Pre Change " ## 237 change_number() ## "</a>"); 238 print("<dd>"); 239 print("This item will show you the how the contents of the file"); 240 print("in the project baseline looked <strong>before</strong>"); 241 print("change " ## cn ## " was integrated."); 242 } 243 244 print("<dt>"); 245 if (action != "remove") 246 { 247 href = script_name ## "?file@pre+" ## "delta@" ## delta ## "+"; 248 href ##= quote_url(fn); 249 href ##= "+project@" ## quote_url(pn); 250 print("<a href=\"" ## href ## "\">Post Change " ## 251 change_number() ## "</a>"); 252 print("<dd>"); 253 print("This item will show you the how the contents of the file"); 254 print("in the project baseline looked <strong>after</strong>"); 255 print("change " ## cn ## " was integrated."); 256 } 257 else 258 { 259 print("Post Change " ## change_number()); 260 print("<dd>"); 261 print("The file was removed from the project in this change."); 262 } 263 } 264 if (cs.state != "awaiting_development") 265 { 266 auto pre_d, post_d; 267 pre_d = delta -1; 268 post_d = delta; 269 270 print("<dt>File Differences</dt>"); 271 print("<dd>This item will show you differences between the various"); 272 print("versions of the file."); 273 print("<table align=center>"); 274 print("<tr>"); 275 print("<td></td>"); 276 277 if (cs.state == "completed") 278 { 279 if (action != "create") 280 print("<td width=\"100\" align=\"center\">Before</td>"); 281 if (action != "remove") 282 print("<td width=\"100\" align=\"center\">After</td>"); 283 } 284 else 285 print("<td width=\"100\" align=\"center\">Change</td>"); 286 287 if (baseline_file_exists) 288 { 289 print("<td width=\"100\" align=\"center\">Baseline</td>"); 290 } 291 292 print("</tr>"); 293 294 if (cs.state == "completed") 295 { 296 if (action != "create") 297 { 298 print("<tr>"); 299 print("<td>Before</td>"); 300 print("<td align=\"center\">*</td>"); 301 302 if (action != "remove") 303 { 304 href = script_name ## "?file@diff+"; 305 href ##= "delta1@" ## pre_d ## "+"; 306 href ##= "delta2@" ## post_d ## "+"; 307 href ##= quote_url(fn); 308 href ##= "+project@" ## quote_url(pn); 309 310 print("<td align=\"center\"><a href=\"" ## href ## 311 "\">diff</a></td>"); 312 } 313 if (baseline_file_exists) 314 { 315 href = script_name ## "?file@diff+"; 316 href ##= "delta1@" ## pre_d ## "+"; 317 href ##= "delta2@" ## "baseline" ## "+"; 318 href ##= quote_url(fn); 319 href ##= "+project@" ## quote_url(pn); 320 print("<td align=\"center\"><a href=\"" ## href ## 321 "\">diff</a></td>"); 322 } 323 print("</tr>"); 324 } 325 if (action != "remove") 326 { 327 print("<tr>"); 328 print("<td>After</td>"); 329 if (action != "create") 330 { 331 href = script_name ## "?file@diff+"; 332 href ##= "delta1@" ## post_d ## "+"; 333 href ##= "delta2@" ## pre_d ## "+"; 334 href ##= quote_url(fn); 335 href ##= "+project@" ## quote_url(pn); 336 print("<td align=\"center\"><a href=\"" ## href ## 337 "\">diff</a></td>"); 338 } 339 print("<td align=\"center\">*</td>"); 340 if (baseline_file_exists) 341 { 342 href = script_name ## "?file@diff+"; 343 href ##= "delta1@" ## post_d ## "+"; 344 href ##= "delta2@" ## "baseline" ## "+"; 345 href ##= quote_url(fn); 346 href ##= "+project@" ## quote_url(pn); 347 print("<td align=\"center\"><a href=\"" ## href ## 348 "\">diff</a></td>"); 349 } 350 print("</tr>"); 351 } 352 } 353 if (cs.state != "completed") 354 { 355 print("<tr>"); 356 print("<td>Change</td>"); 357 print("<td align=\"center\">*</td>"); 358 359 if (baseline_file_exists) 360 { 361 href = script_name ## "?file@diff+"; 362 href ##= "delta1@" ## "change" ## "+"; 363 href ##= "delta2@" ## "baseline" ## "+"; 364 href ##= quote_url(fn); 365 href ##= "+project@" ## quote_url(pn); 366 href ##= "+change@" ## change_number(); 367 368 print("<td align=\"center\"><a href=\"" ## href ## 369 "\">diff</a></td>"); 370 } 371 print("</tr>"); 372 } 373 374 if (baseline_file_exists) 375 { 376 print("<tr>"); 377 print("<td>Baseline</td>"); 378 379 if (cs.state == "completed") 380 { 381 if (action != "create") 382 { 383 href = script_name ## "?file@diff+"; 384 href ##= "delta1@" ## "baseline" ## "+"; 385 href ##= "delta2@" ## pre_d ## "+"; 386 href ##= quote_url(fn); 387 href ##= "+project@" ## quote_url(pn); 388 print("<td align=\"center\"><a href=\"" ## href ## 389 "\">diff</a></td>"); 390 } 391 href = script_name ## "?file@diff+"; 392 href ##= "delta1@" ## "baseline" ## "+"; 393 href ##= "delta2@" ## post_d ## "+"; 394 href ##= quote_url(fn); 395 href ##= "+project@" ## quote_url(pn); 396 print("<td align=\"center\"><a href=\"" ## href ## 397 "\">diff</a></td>"); 398 } 399 else 400 { 401 href = script_name ## "?file@diff+"; 402 href ##= "delta1@" ## "baseline" ## "+"; 403 href ##= "delta2@" ## "change" ## "+"; 404 href ##= quote_url(fn); 405 href ##= "+project@" ## quote_url(pn); 406 href ##= "+change@" ## change_number(); 407 408 print("<td align=\"center\"><a href=\"" ## href ## 409 "\">diff</a></td>"); 410 } 411 412 print("<td align=\"center\">*</td>"); 413 print("</tr>"); 414 } 415 print("</table>"); 416 print("</dd>"); 417 } 418} 419 420print("</dl>"); 421print("</div>"); 422 423print("<hr>"); 424print("<p align=center class=\"navbar\">["); 425print("<a href=\"" ## script_name ## "\">Project List</a> |"); 426href = script_name ## "?file@proj_menu+project@" ## quote_url(pn); 427print("<a href=\"" ## href ## "\">Project Menu</a> |"); 428href = script_name ## "?file@changes+project@" ## quote_url(pn); 429print("<a href=\"" ## href ## "\">Change List</a> |"); 430if (change_number_set()) 431{ 432 href = script_name ## "?file@chan_menu+project@" ## quote_url(pn) 433 ## "+change@" ## cn ; 434 print("<a href=\"" ## href ## "\">Change Menu</a> |"); 435 href = script_name ## "?file@file_list+project@" ## quote_url(pn) 436 ## "+change@" ## cn ; 437 print("<a href=\"" ## href ## "\">File List</a>"); 438 439} 440else 441{ 442 href = script_name ## "?file@file_list+project@" ## quote_url(pn); 443 print("<a href=\"" ## href ## "\">File List</a>"); 444} 445print("]</p>"); 446 447print("<hr>"); 448print("This page was generated " ## now() ## "."); 449print("</body></html>"); 450