Commit 498be2c7 authored by Leigh Stoller's avatar Leigh Stoller

Rework project approval to be easier to deal with, and to allow

a text message to go in the email message.
parent 45dcc291
This diff is collapsed.
...@@ -10,50 +10,30 @@ include("defs.php3"); ...@@ -10,50 +10,30 @@ include("defs.php3");
# #
# Only known and logged in users can do this. # Only known and logged in users can do this.
# #
$uid = "";
if (ereg("php3\?([[:alnum:]]+)", $REQUEST_URI, $Vals)) {
$uid=$Vals[1];
addslashes($uid);
}
else {
unset($uid);
}
LOGGEDINORDIE($uid); LOGGEDINORDIE($uid);
echo "<center><h1>Approve New Projects</h1></center>\n";
# #
# Of course verify that this uid has admin privs! # Of course verify that this uid has admin privs!
# #
$query_result = mysql_db_query($TBDBNAME, $isadmin = ISADMIN($uid);
"SELECT admin from users where uid='$uid' and admin='1'" ); if (! $isadmin) {
if (! $query_result) {
$err = mysql_error();
TBERROR("Database Error getting admin status for $uid: $err\n", 1);
}
if (mysql_num_rows($query_result) == 0) {
USERERROR("You do not have admin privledges to approve projects!", 1); USERERROR("You do not have admin privledges to approve projects!", 1);
} }
echo "<center><h1>Approve a Project</h1></center>\n";
# #
# Look in the projects table to see which projects have not been approved. # Check to make sure thats this is a valid PID.
# Present a menu of options to either approve or deny the projects.
# Approving a project implies approving the project leader. Denying a project
# implies denying the project leader account, when there is just a single
# project pending for that project leader.
# #
$query_result = mysql_db_query($TBDBNAME, $query_result = mysql_db_query($TBDBNAME,
"SELECT * from projects where approved='0'"); "SELECT * FROM projects WHERE pid=\"$pid\"");
if (! $query_result) {
$err = mysql_error();
TBERROR("Database Error getting unapproved project list: $err\n", 1);
}
if (mysql_num_rows($query_result) == 0) { if (mysql_num_rows($query_result) == 0) {
USERERROR("There are no projects to approve!", 1); USERERROR("The project $pid is not a valid project.", 1);
} }
$row = mysql_fetch_array($query_result);
echo "For each project waiting to be approved, you may select on of the echo "<center><h3>You have the following choices:</h3></center>
following choices:
<table align=center border=0> <table align=center border=0>
<tr> <tr>
<td>Deny</td> <td>Deny</td>
...@@ -73,6 +53,12 @@ echo "For each project waiting to be approved, you may select on of the ...@@ -73,6 +53,12 @@ echo "For each project waiting to be approved, you may select on of the
<td>Approve the project</td> <td>Approve the project</td>
</tr> </tr>
<tr>
<td>More Info</td>
<td>-</td>
<td>Ask for more info</td>
</tr>
<tr> <tr>
<td>Postpone</td> <td>Postpone</td>
<td>-</td> <td>-</td>
...@@ -80,90 +66,165 @@ echo "For each project waiting to be approved, you may select on of the ...@@ -80,90 +66,165 @@ echo "For each project waiting to be approved, you may select on of the
</tr> </tr>
</table>\n"; </table>\n";
echo "<center>
<h3>Project Information</h3>
</center>
<table align=center border=1>\n";
$proj_created = $row[created];
$proj_expires = $row[expires];
$proj_name = $row[name];
$proj_URL = $row[URL];
$proj_head_uid = $row[head_uid];
$proj_pcs = $row[num_pcs];
$proj_sharks = $row[num_sharks];
$proj_why = $row[why];
$control_node = $row[control_node];
# #
# Now build a table with a bunch of selections. The thing to note about the # Generate the table.
# form inside this table is that the selection fields are constructed with #
# name= on the fly, from the uid of the user to be approved. In other words: echo "<tr>
<td>Name: </td>
<td class=\"left\">$pid</td>
</tr>\n";
echo "<tr>
<td>Long Name: </td>
<td class=\"left\">$proj_name</td>
</tr>\n";
echo "<tr>
<td>Project Head: </td>
<td class=\"left\">$proj_head_uid</td>
</tr>\n";
echo "<tr>
<td>URL: </td>
<td class=\"left\">
<A href='$proj_URL'>$proj_URL</A></td>
</tr>\n";
echo "<tr>
<td>#PCs: </td>
<td class=\"left\">$proj_pcs</td>
</tr>\n";
echo "<tr>
<td>#Sharks: </td>
<td class=\"left\">$proj_sharks</td>
</tr>\n";
echo "<tr>
<td>Created: </td>
<td class=\"left\">$proj_created</td>
</tr>\n";
echo "<tr>
<td colspan='2'>Why?</td>
</tr>\n";
echo "<tr>
<td colspan='2' width=600>$proj_why</td>
</tr>\n";
echo "</table>\n";
$userinfo_result = mysql_db_query($TBDBNAME,
"SELECT * from users where uid=\"$proj_head_uid\"");
$row = mysql_fetch_array($userinfo_result);
$usr_expires = $row[usr_expires];
$usr_email = $row[usr_email];
$usr_addr = $row[usr_addr];
$usr_name = $row[usr_name];
$usr_phone = $row[usr_phone];
$usr_passwd = $row[usr_pswd];
$usr_title = $row[usr_title];
$usr_affil = $row[usr_affil];
echo "<center>
<h3>Project Leader Information</h3>
</center>
<table align=center border=1>\n";
echo "<tr>
<td>Username:</td>
<td>$proj_head_uid</td>
</tr>\n";
echo "<tr>
<td>Full Name:</td>
<td>$usr_name</td>
</tr>\n";
echo "<tr>
<td>Email Address:</td>
<td>$usr_email</td>
</tr>\n";
echo "<tr>
<td>Expiration date:</td>
<td>$usr_expires</td>
</tr>\n";
echo "<tr>
<td>Mailing Address:</td>
<td>$usr_addr</td>
</tr>\n";
echo "<tr>
<td>Phone #:</td>
<td>$usr_phone</td>
</tr>\n";
echo "<tr>
<td>Title/Position:</td>
<td>$usr_title</td>
</tr>\n";
echo "<tr>
<td>Institutional Affiliation:</td>
<td>$usr_affil</td>
</tr>\n";
echo "</table>\n";
# #
# project menu # Now put up the menu choice along with a text box for an email message.
# name=testbed$$approval value=approve,deny,murder,postpone
# #
# so that we can go through the entire list of post variables, looking echo "<center>
# for these. The alternative is to work backwards, and I don't like that. <h3>What would you like to do?</h3>
# </center>
echo "<table width=\"100%\" border=2 cellpadding=0 cellspacing=2 <table align=center border=1>
align='center'>\n"; <form action='approveproject.php3?uid=$uid&pid=$pid' method='post'>\n";
echo "<tr> echo "<tr>
<td rowspan=2>Project</td> <td align=center>
<td rowspan=2>User</td> <select name=approval>
<td rowspan=2>Action</td> <option value='postpone'>Postpone</option>
<td>User Name</td> <option value='approve'>Approve</option>
<td>Title</td> <option value='moreinfo'>More Info</option>
<td>User Affil</td> <option value='deny'>Deny</option>
<td>E-mail</td> <option value='destroy'>Destroy</option>
</tr> </select>
<tr> </td>
<td>Proj Name</td> </tr>\n";
<td>URL</td>
<td>Proj Affil</td>
<td>Phone</td> echo "<tr>
</tr>\n"; <td>Use the text box to add a message to the email notification.</td>
</tr>\n";
echo "<form action='approveproject.php3?$uid' method='post'>\n";
while ($projectrow = mysql_fetch_array($query_result)) {
$pid = $projectrow[pid];
$headuid = $projectrow[head_uid];
$Purl = $projectrow[URL];
$Pname = $projectrow[name];
$Paffil = $projectrow[affil];
$userinfo_result = mysql_db_query($TBDBNAME,
"SELECT * from users where uid=\"$headuid\"");
$row = mysql_fetch_array($userinfo_result);
$name = $row[usr_name];
$email = $row[usr_email];
$title = $row[usr_title];
$affil = $row[usr_affil];
$addr = $row[usr_addr];
$addr2 = $row[usr_addr2];
$city = $row[usr_city];
$state = $row[usr_state];
$zip = $row[usr_zip];
$phone = $row[usr_phone];
echo "<tr>
<td colspan=7> </td>
</tr>
<tr>
<td rowspan=2>
<A href='showproject.php3?uid=$uid&pid=$pid'>$pid</A></td>
<td rowspan=2>$headuid</td>
<td rowspan=2>
<select name=\"$pid\$\$approval\">
<option value='postpone'>Postpone</option>
<option value='approve'>Approve</option>
<option value='deny'>Deny</option>
<option value='destroy'>Destroy</option>
</select>
</td>\n";
echo " <td>$name</td>
<td>$title</td>
<td>$affil</td>
<td>$email</td>
</tr>\n";
echo "<tr>
<td>$Pname</td>
<td>$Purl</td>
<td>$Paffil</td>
<td>$phone</td>
</tr>\n";
}
echo "<tr> echo "<tr>
<td align=center colspan=7> <td align=center class=left>
<textarea name=message rows=5 cols=60></textarea>
</td>
</tr>\n";
echo "<tr>
<td align=center colspan=2>
<b><input type='submit' value='Submit' name='OK'></td> <b><input type='submit' value='Submit' name='OK'></td>
</tr> </tr>
</form> </form>
...@@ -171,4 +232,3 @@ echo "<tr> ...@@ -171,4 +232,3 @@ echo "<tr>
?> ?>
</body> </body>
</html> </html>
<html>
<head>
<title>New Project Approval List</title>
<link rel='stylesheet' href='tbstyle.css' type='text/css'>
</head>
<body>
<?php
include("defs.php3");
#
# Only known and logged in users can do this. uid came in with the URI.
#
LOGGEDINORDIE($uid);
echo "<center><h1>Approve New Projects List</h1></center>\n";
#
# Of course verify that this uid has admin privs!
#
$isadmin = ISADMIN($uid);
if (! $isadmin) {
USERERROR("You do not have admin privledges to approve projects!", 1);
}
#
# Look in the projects table to see which projects have not been approved.
# Present a menu of options to either approve or deny the projects.
# Approving a project implies approving the project leader. Denying a project
# implies denying the project leader account, when there is just a single
# project pending for that project leader.
#
$query_result = mysql_db_query($TBDBNAME,
"SELECT * from projects where approved='0'");
if (! $query_result) {
$err = mysql_error();
TBERROR("Database Error getting unapproved project list: $err\n", 1);
}
if (mysql_num_rows($query_result) == 0) {
USERERROR("There are no projects to approve!", 1);
}
echo "Below is the list of projects waiting for approval or denial. Click
on a particular project to act on it, and you will be zapped to a
page with more information about the project, and your options menu.
<p>\n";
echo "<table width=\"100%\" border=2 cellpadding=0 cellspacing=2
align='center'>\n";
echo "<tr>
<td rowspan=2>Act</td>
<td rowspan=2>Project Info</td>
<td rowspan=2>User</td>
<td>User Name</td>
<td>Title</td>
<td>E-mail</td>
</tr>
<tr>
<td>Proj Name</td>
<td>User Affil</td>
<td>Phone</td>
</tr>\n";
while ($projectrow = mysql_fetch_array($query_result)) {
$pid = $projectrow[pid];
$headuid = $projectrow[head_uid];
$Purl = $projectrow[URL];
$Pname = $projectrow[name];
$Paffil = $projectrow[affil];
$userinfo_result = mysql_db_query($TBDBNAME,
"SELECT * from users where uid=\"$headuid\"");
$row = mysql_fetch_array($userinfo_result);
$name = $row[usr_name];
$email = $row[usr_email];
$title = $row[usr_title];
$affil = $row[usr_affil];
$addr = $row[usr_addr];
$addr2 = $row[usr_addr2];
$city = $row[usr_city];
$state = $row[usr_state];
$zip = $row[usr_zip];
$phone = $row[usr_phone];
echo "<tr>
<td height=15 colspan=6></td>
</tr>
<tr>
<td align=center rowspan=2>
<A href='approveproject_form.php3?uid=$uid&pid=$pid'>
<img alt=\"o\" src=\"redball.gif\"></A></td>
<td rowspan=2>
<A href='showproject.php3?uid=$uid&pid=$pid'>$pid</A></td>
<td rowspan=2>$headuid</td>
<td>$name</td>
<td>$title</td>
<td>$email</td>
</tr>\n";
echo "<tr>
<td>$Pname</td>
<td>$affil</td>
<td>$phone</td>
</tr>\n";
}
echo "</table>\n";
?>
</body>
</html>
...@@ -97,7 +97,7 @@ if (isset($uid)) { ...@@ -97,7 +97,7 @@ if (isset($uid)) {
if ($status == "active") { if ($status == "active") {
if ($admin) { if ($admin) {
echo "<A href='approveproject_form.php3?$uid'> echo "<A href='approveproject_list.php3?uid=$uid'>
New Project Approval</A><p>\n"; New Project Approval</A><p>\n";
} }
if ($trusted) { if ($trusted) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment