/* * aegis - project change supervisor * Copyright (C) 2002, 2003, 2005-2008 Peter Miller * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see * . */ auto href; auto pn; pn = project_name(); auto script_name; script_name = getenv("SCRIPT_NAME"); if (script_name == "") script_name = "http://localhost/cgi-bin/aegis.cgi"; columns({width = 1000; }); print("Content-Type: text/html"); print(""); print(""); print(""); print(""); print(""); print(""); print(""); /* * Netscape 4.x has numerous CSS bugs, two of which need mentioning. * 1. If a style sheet is not present Netscape says 404 Not found, when * it should silently ignore it. 2. Style sheets who's media is not * "screen" will be ignored. Fortunately we can use (2) to get around (1). */ print(""); auto stack, depth, n; depth=0; stack[depth] = project[pn].state.name; while ("" != ( n = project[stack[depth]].state.parent_name )) { stack[++depth] = n; } while ( depth >= 0) { print(""); } print(""); print("Project " ## quote_html(pn) ## " File metrics"); print("

"); auto p; p = project[pn]; print("Project"); auto long_project_name; auto prj_name_parts; prj_name_parts = split(pn, '.'); href = script_name ## "?file@proj_menu+project@" ## quote_url(prj_name_parts[0]); long_project_name = "" ## quote_html(prj_name_parts[0]) ## ""; auto j; for (j = 1; j < count(prj_name_parts); j++) { href ##= '.' ## prj_name_parts[j]; long_project_name ##= "." ## quote_html(prj_name_parts[j]) ## ""; }; long_project_name = "“" ## long_project_name ## "”,"; /* HTTP limits lines to 510 characters */ for (j in wrap(long_project_name, 510)) print(j); print('
\n'); print("File metrics"); print("

"); print("
"); auto ps; ps = p.state.src; auto sort_col; sort_col = 0; for (j in arg) { if (j ~~ "sort_col:") sort_col = substr(j, 9, 2); } auto fh, flist, metcol, m; metcol = { }; for (fh in ps) { if (count(fh.metrics) <= 0) continue; for (m in fh.metrics) metcol[m.name] += m.value; } auto found; for (fh in ps) { if (count(fh.metrics) <= 0) continue; found = false; if (sort_col < 1) m = ""; else m = sort(keys(metcol))[sort_col - 1]; for (j in fh.metrics) { if (j.name == m) { flist[sprintf("%20.2f", j.value) ## fh.file_name] = fh; found = true; } } if (!found) flist[sprintf("%20.2f", 0) ## fh.file_name] = fh; } /* * If we are going to sort by a particular column the index to flist * needs to include both the value AND the filename so that EVERY file * is included. */ print(""); print(""); if (sort_col == 0) print(""); else { href = script_name ## "?file@proj_filme"; href ##= "+project@" ## quote_url(pn); print(""); } print(""); j = 1; for (m in sort(keys(metcol))) { print(""); ++j; } print(""); auto rownum; rownum = 0; for (fh in sort(keys(flist))) { j = flist[fh]; if (rownum % 6 < 3) print(""); else print(""); rownum++; print(""); print(""); auto met; for (m in sort(keys(metcol))) { for (met = 0; met < count(j.metrics); met++) { if (j.metrics[met].name == m) { print(""); } } } print(""); } print(""); for (m in sort(keys(metcol))) { print(""); } print("
File NameFile NameRevision"); if (j != sort_col) { href = script_name ## "?file@proj_filme+sort_col:" ## j; href ##= "+project@" ## quote_url(pn); print(""); } auto msplit, ms2; msplit = split(m, "_"); for (ms2 in msplit) print(capitalize(ms2) ## "
"); if (j != sort_col) print("
"); print("
"); href = script_name ## "?file@file_menu+" ## quote_url(j.file_name); href ##= "+project@" ## quote_url(pn); print(""); print("" ## quote_html(j.file_name) ## ""); if (j.deleted_by) { href = script_name ## "?file@chan_menu"; href ##= "+project@" ## quote_url(pn); href ##= "+change@" ## j.deleted_by; print("
Deleted by change"); print("" ## j.deleted_by ## "."); } if (j.about_to_be_created_by) { href = script_name ## "?file@chan_menu"; href ##= "+project@" ## quote_url(pn); href ##= "+change@" ## j.about_to_be_created_by; print("
About to be created by change"); print("" ## j.about_to_be_created_by ## "."); } if (j.locked_by) { href = script_name ## "?file@chan_menu"; href ##= "+project@" ## quote_url(pn); href ##= "+change@" ## j.locked_by; print("
Locked by change"); print("" ## j.locked_by ## "."); } if (j.about_to_be_copied_by) { href = script_name ## "?file@chan_menu"; href ##= "+project@" ## quote_url(pn); href ##= "+change@" ## j.about_to_be_copied_by; print("
About to be copied by change"); print("" ## j.about_to_be_copied_by ## "."); } if (j.move != "") { href = script_name ## "?file@file_menu+" ## quote_url(j.move); href ##= "+project@" ## quote_url(pn); print("
Moved " ## (j.action == create ? "from" : "to")); print(""); print("" ## quote_html(j.move) ## ""); } print("
"); if (j.edit_origin.revision != "" && j.edit.revision != "") { if (j.edit_origin.revision == j.edit.revision) print(j.edit.revision); else print(j.edit_origin.revision ## " -> " ## j.edit.revision); } else if (j.edit_origin.revision != "") print(j.edit_origin.revision); else if (j.edit.revision != "") print(j.edit.revision); print(""); print(sprintf("%4.2f", j.metrics[met].value)); print("


"); print("Listed " ## rownum ## " of " ## count(keys(ps)) ## " files."); print("


Total:
Average:


"); print(sprintf("%4.2f", metcol[m]) ## "
"); print(sprintf("%4.2f", metcol[m] / rownum) ## "
"); print("
"); print("
"); print("
"); print("
"); print("A similar report may be obtained from the command line, with one of"); print("
ael pf -p " ## quote_html(pn)); print("aer proj_files -p " ## quote_html(pn) ## "
"); print("
"); print("
"); print("

["); print("Project List"); print("|"); href = script_name ## "?file@proj_menu+project@" ## quote_url(pn); print("Project Menu"); print("|"); href = script_name ## "?file@changes+project@" ## quote_url(pn); print("Change List"); print("]

"); print("
"); print("This page was generated " ## now() ## "."); print("");