Add new/pending STRs to account page.

Fix auth bug - was resetting the cookies to the wrong value.

Add common STR definitions file.

Add DB building script.
This commit is contained in:
Michael R Sweet 2004-05-18 01:39:00 +00:00
parent af85dc116d
commit ad1ac4b2eb
6 changed files with 184 additions and 84 deletions

View File

@ -1,7 +1,8 @@
<?php
//
// "$Id: account.php,v 1.1 2004/05/17 20:28:52 mike Exp $"
// "$Id: account.php,v 1.2 2004/05/18 01:39:00 mike Exp $"
//
// Account management page...
//
//
@ -9,6 +10,9 @@
//
include_once "phplib/html.php";
include_once "phplib/common.php";
include_once "phplib/str.php";
if ($argc == 1 && $argv[0] == "X")
auth_logout();
@ -38,10 +42,65 @@ switch ($op)
print("<h1>New/Pending</h1>\n");
$email = db_escape($_COOKIE["FROM"]);
print("<h2>New/Pending Articles:</h2>\n");
print("<p>No new/pending articles found.</p>\n");
print("<h2>New/Pending STRs:</h2>\n");
$result = db_query("SELECT * FROM str WHERE status >= $STR_STATUS_PENDING "
."AND (manager_email == '' OR manager_email = '$email') "
."ORDER BY status DESC, priority DESC, scope DESC, "
."modify_date");
$count = db_count($result);
if ($count == 0)
print("<p>No new/pending STRs found.</p>\n");
else
{
html_start_table(array("Id", "Priority", "Status", "Scope",
"Summary", "Version", "Last Updated",
"Assigned To"));
while ($row = db_next($result))
{
$date = date("M d, Y", $row['modify_date']);
$summary = htmlspecialchars($row['summary'], ENT_QUOTES);
$summabbr = htmlspecialchars(abbreviate($row['summary'], 80), ENT_QUOTES);
$prtext = $priority_text[$row['priority']];
$sttext = $status_text[$row['status']];
$sctext = $scope_text[$row['scope']];
html_start_row();
print("<td nowrap>"
."<a href='str.php?L$row[id]$options' alt='STR #$row[id]: $summary'>"
."$row[id]</a></td>"
."<td align='center'>$prtext</td>"
."<td align='center'>$sttext</td>"
."<td align='center'>$sctext</td>"
."<td align='center'><a href='str.php?L$row[id]$options' "
."alt='STR #$row[id]: $summary'>$summabbr</a></td>"
."<td align='center'>$row[str_version]</td>"
."<td align='center'>$date</td>");
if ($row['manager_email'] != "")
$email = sanitize_email($row['manager_email']);
else
$email = "<i>Unassigned</i>";
print("<td align='center'>$email</td>");
html_end_row();
}
html_end_table();
}
db_free($result);
html_footer();
break;
@ -86,6 +145,6 @@ switch ($op)
//
// End of "$Id: account.php,v 1.1 2004/05/17 20:28:52 mike Exp $".
// End of "$Id: account.php,v 1.2 2004/05/18 01:39:00 mike Exp $".
//
?>

5
www/data/makedb Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
sqlite mxml.db <mxml.sql
chmod 666 mxml.db
chmod 777 .

View File

@ -1,6 +1,6 @@
<?
//
// "$Id: auth.php,v 1.3 2004/05/17 21:04:16 mike Exp $"
// "$Id: auth.php,v 1.4 2004/05/18 01:39:00 mike Exp $"
//
// Authentication functions for PHP pages...
//
@ -60,7 +60,7 @@ auth_current()
if ($cookie[1] == $sid)
{
// Refresh the cookies so they don't expire...
setcookie("SID", $sid, time() + 90 * 86400, "/");
setcookie("SID", "$cookie[0]:$sid", time() + 90 * 86400, "/");
setcookie("FROM", $row['email'], time() + 90 * 86400, "/");
// Set globals...
@ -137,6 +137,6 @@ auth_logout()
//
// End of "$Id: auth.php,v 1.3 2004/05/17 21:04:16 mike Exp $".
// End of "$Id: auth.php,v 1.4 2004/05/18 01:39:00 mike Exp $".
//
?>

View File

@ -1,6 +1,6 @@
<?php
//
// "$Id: html.php,v 1.4 2004/05/17 20:28:52 mike Exp $"
// "$Id: html.php,v 1.5 2004/05/18 01:39:00 mike Exp $"
//
// PHP functions for standardized HTML output...
//
@ -106,9 +106,9 @@ html_header($title = "") // I - Additional document title
."<tr class='header' height='40'>"
."<td valign='top'><img src='images/top-left.gif' width='15' height='15' "
."alt=''/></td>"
."<td width='100%'><img src='images/logo.gif' width='39' height='32' "
."alt='Mini-XML' align='middle'/> "
."[&nbsp;<a href='index.php'>Home</a> | "
."<td><img src='images/logo.gif' width='39' height='32' "
."alt='Mini-XML' align='middle'/>&nbsp;&nbsp;&nbsp;</td>"
."<td width='100%'>[&nbsp;<a href='index.php'>Home</a> | "
."<a href='documentation.php'>Documentation</a> | "
."<a href='software.php'>Download</a> | "
."<a href='faq.php'>FAQ</a> | "
@ -127,7 +127,7 @@ html_header($title = "") // I - Additional document title
."</tr>\n");
print("<tr class='page' height='100%'><td></td>"
."<td colspan='2' valign='top'>"
."<td colspan='3' valign='top'>"
."<table width='100%' height='100%' border='0' cellpadding='5' "
."cellspacing='0'><tr><td valign='top'>");
}
@ -144,7 +144,7 @@ html_footer()
print("<tr class='header'>"
."<td valign='bottom'><img src='images/bottom-left.gif' width='15' "
."height='15' alt=''/></td>"
."<td colspan='2'><small> <br />"
."<td colspan='3'><small> <br />"
."Copyright 2003-2004 by Michael Sweet. This library is free "
."software; you can redistribute it and/or modify it "
."under the terms of the GNU Library General Public "

86
www/phplib/str.php Normal file
View File

@ -0,0 +1,86 @@
<?php
//
// "$Id: str.php,v 1.1 2004/05/18 01:39:00 mike Exp $"
//
// Common STR definitions...
//
// This file should be included using "include_once"...
//
//
// STR constants...
//
$STR_PROJECT = "Mini-XML"; // Title of project
$STR_EMAIL = "mxml@easysw.com"; // Default notification address
$STR_PAGE_MAX = 10; // Max STRs per page
$STR_STATUS_RESOLVED = 1;
$STR_STATUS_UNRESOLVED = 2;
$STR_STATUS_ACTIVE = 3;
$STR_STATUS_PENDING = 4;
$STR_STATUS_NEW = 5;
$STR_PRIORITY_RFE = 1;
$STR_PRIORITY_LOW = 2;
$STR_PRIORITY_MODERATE = 3;
$STR_PRIORITY_HIGH = 4;
$STR_PRIORITY_CRITICAL = 5;
$STR_SCOPE_UNIT = 1;
$STR_SCOPE_FUNCTION = 2;
$STR_SCOPE_SOFTWARE = 3;
//
// String definitions for STR constants...
//
$status_text = array(
1 => "Resolved",
2 => "Unresolved",
3 => "Active",
4 => "Pending",
5 => "New"
);
$status_long = array(
1 => "1 - Closed w/Resolution",
2 => "2 - Closed w/o Resolution",
3 => "3 - Active",
4 => "4 - Pending",
5 => "5 - New"
);
$priority_text = array(
1 => "RFE",
2 => "LOW",
3 => "MODERATE",
4 => "HIGH",
5 => "CRITICAL"
);
$priority_long = array(
1 => "1 - Request for Enhancement, e.g. asking for a feature",
2 => "2 - Low, e.g. a documentation error or undocumented side-effect",
3 => "3 - Moderate, e.g. unable to compile the software",
4 => "4 - High, e.g. key functionality not working",
5 => "5 - Critical, e.g. nothing working at all"
);
$scope_text = array(
1 => "MACH",
2 => "OS",
3 => "ALL"
);
$scope_long = array(
1 => "1 - Specific to a machine",
2 => "2 - Specific to an operating system",
3 => "3 - Applies to all machines and operating systems"
);
//
// End of "$Id: str.php,v 1.1 2004/05/18 01:39:00 mike Exp $".
//
?>

View File

@ -1,31 +1,27 @@
<?php
//
// "$Id: str.php,v 1.5 2004/05/18 01:39:00 mike Exp $"
//
// Software Trouble Report page...
//
// Contents:
//
// notify_creator() - Notify creator of a STR of changes...
//
//
// Include necessary headers...
//
// Standard stuff...
include_once "phplib/html.php";
include_once "phplib/common.php";
include_once "phplib/str.php";
// STR constants...
$STR_PROJECT = "Mini-XML"; // Title of project
$STR_EMAIL = "mxml@easysw.com"; // Default notification address
$STR_PAGE_MAX = 10; // Max STRs per page
$STR_STATUS_RESOLVED = 1;
$STR_STATUS_UNRESOLVED = 2;
$STR_STATUS_ACTIVE = 3;
$STR_STATUS_PENDING = 4;
$STR_STATUS_NEW = 5;
$STR_PRIORITY_RFE = 1;
$STR_PRIORITY_LOW = 2;
$STR_PRIORITY_MODERATE = 3;
$STR_PRIORITY_HIGH = 4;
$STR_PRIORITY_CRITICAL = 5;
$STR_SCOPE_UNIT = 1;
$STR_SCOPE_FUNCTION = 2;
$STR_SCOPE_SOFTWARE = 3;
//
// String definitions for various things...
//
$managers = array(
"mike" => "Michael Sweet <mike@easysw.com>"
);
@ -67,53 +63,9 @@ $versions = array(
"Web Site"
);
$status_text = array(
1 => "Resolved",
2 => "Unresolved",
3 => "Active",
4 => "Pending",
5 => "New"
);
$status_long = array(
1 => "1 - Closed w/Resolution",
2 => "2 - Closed w/o Resolution",
3 => "3 - Active",
4 => "4 - Pending",
5 => "5 - New"
);
$priority_text = array(
1 => "RFE",
2 => "LOW",
3 => "MODERATE",
4 => "HIGH",
5 => "CRITICAL"
);
$priority_long = array(
1 => "1 - Request for Enhancement, e.g. asking for a feature",
2 => "2 - Low, e.g. a documentation error or undocumented side-effect",
3 => "3 - Moderate, e.g. unable to compile the software",
4 => "4 - High, e.g. key functionality not working",
5 => "5 - Critical, e.g. nothing working at all"
);
$scope_text = array(
1 => "M",
2 => "OS",
3 => "ALL"
);
$scope_long = array(
1 => "1 - Specific to a machine",
2 => "2 - Specific to an operating system",
3 => "3 - Applies to all machines and operating systems"
);
//
// 'notify_creator()' - Notify creator of an STR of changes...
// 'notify_creator()' - Notify creator of a STR of changes...
//
function
@ -840,17 +792,12 @@ switch ($op)
"Summary", "Version", "Last Updated",
"Assigned To"));
if ($LOGIN_USER)
$sumlen = 80;
else
$sumlen = 40;
db_seek($result, $index);
for ($i = 0; $i < $STR_PAGE_MAX && $row = db_next($result); $i ++)
{
$date = date("M d, Y", $row['modify_date']);
$summary = htmlspecialchars($row['summary'], ENT_QUOTES);
$summabbr = htmlspecialchars(abbreviate($row['summary'], $sumlen), ENT_QUOTES);
$summabbr = htmlspecialchars(abbreviate($row['summary'], 80), ENT_QUOTES);
$prtext = $priority_text[$row['priority']];
$sttext = $status_text[$row['status']];
$sctext = $scope_text[$row['scope']];
@ -976,7 +923,7 @@ switch ($op)
print("</form>");
print("<p>"
."M = Machine, "
."MACH = Machine, "
."OS = Operating System."
."</p>\n");
}
@ -1894,4 +1841,7 @@ switch ($op)
break;
}
//
// End of "$Id: str.php,v 1.5 2004/05/18 01:39:00 mike Exp $".
//
?>