Commit dfda3405 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Some minor restructuring of the show routines, and better linking to

user and project information.
parent e7689709
......@@ -91,7 +91,9 @@ while ($projectrow = mysql_fetch_array($query_result)) {
<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 rowspan=2>
<A href='showuser.php3?uid=$uid&target_uid=$headuid'>
$headuid</A></td>
<td>$name</td>
<td>$title</td>
<td>$email</td>
......
......@@ -203,6 +203,24 @@ if ($retval) {
}
echo "</XMP>\n";
#
# Lets dump the log file also.
#
$fp = fopen($logname, "r");
if ($fp) {
echo "<br><h2>
Logfile as follows:
</h2>
<br>\n";
echo "<XMP>\n";
while ($line = fgets($fp, 1024)) {
echo "$line";
}
echo "</XMP>\n";
fclose($fp);
}
$query_result = mysql_db_query($TBDBNAME,
"DELETE FROM experiments WHERE eid='$exp_id' and pid=\"$exp_pid\"");
......
<?php
include("defs.php3");
include("showstuff.php3");
#
# Standard Testbed Header
......@@ -96,7 +97,9 @@ echo "<tr>
echo "<tr>
<td>Experiment Head: </td>
<td class=\"left\">$exp_head</td>
<td class=\"left\">
<A href='showuser.php3?uid=$uid&target_uid=$exp_head'>
$exp_head</td>
</tr>\n";
echo "<tr>
......@@ -163,65 +166,11 @@ if (mysql_num_rows($reserved_result)) {
#
# Lets dump the project information too.
#
$query_result = mysql_db_query($TBDBNAME,
"SELECT * FROM projects WHERE pid=\"$exp_pid\"");
if (! $query_result) {
$err = mysql_error();
TBERROR("Database Error getting info for project $exp_pid: $err\n", 1);
}
$row = mysql_fetch_array($query_result);
#
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_affil = $row[affil];
$proj_addr = $row[addr];
$proj_head_uid = $row[head_uid];
$control_node = $row[control_node];
#
# Generate the table.
#
echo "<tr>
<td>Name: </td>
<td class=\"left\">$exp_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>Created: </td>
<td class=\"left\">$proj_created</td>
</tr>\n";
echo "<tr>
<td>Expires: </td>
<td class=\"left\">$proj_expires</td>
</tr>\n";
echo "</table>
</center>\n";
SHOWPROJECT($exp_pid, $uid);
#
# Standard Testbed Footer
......
<?php
include("defs.php3");
include("showstuff.php3");
#
# Standard Testbed Header
......@@ -50,7 +51,10 @@ if (!$isadmin) {
}
}
include("showproject_dump.php3");
echo "<center>
<h3>Project Information</h3>
</center>\n";
SHOWPROJECT($pid, $uid);
echo "</center>\n";
......
......@@ -58,7 +58,8 @@ while ($projectrow = mysql_fetch_array($query_result)) {
echo "<tr>
<td><A href='showproject.php3?uid=$uid&pid=$pid'>$pid</A></td>
<td>$Pname</td>
<td>$headuid</td>
<td><A href='showuser.php3?uid=$uid&target_uid=$headuid'>
$headuid</A></td>
<td>$Paffil</td>
</tr>\n";
}
......
<?php
#
# This is an included file. No headers or footers.
#
# Functions to dump out various things.
#
#
# A project
#
function SHOWPROJECT($pid, $thisuid) {
global $TBDBNAME;
$query_result = mysql_db_query($TBDBNAME,
"SELECT * FROM projects WHERE pid=\"$pid\"");
if (mysql_num_rows($query_result) == 0) {
USERERROR("The project $pid is not a valid project.", 1);
}
$row = mysql_fetch_array($query_result);
echo "<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_members = $row[num_members];
$proj_pcs = $row[num_pcs];
$proj_sharks = $row[num_sharks];
$proj_why = $row[why];
$control_node = $row[control_node];
#
# Generate the table.
#
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\">
<A href='showuser.php3?uid=$thisuid&target_uid=$proj_head_uid'>
$proj_head_uid</A></td>
</tr>\n";
echo "<tr>
<td>URL: </td>
<td class=\"left\">
<A href='$proj_URL'>$proj_URL</A></td>
</tr>\n";
echo "<tr>
<td>#Project Members: </td>
<td class=\"left\">$proj_members</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>Expires: </td>
<td class=\"left\">$proj_expires</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";
}
#
# A User
#
function SHOWUSER($uid) {
global $TBDBNAME;
$userinfo_result = mysql_db_query($TBDBNAME,
"SELECT * from users where uid=\"$uid\"");
$row = mysql_fetch_array($userinfo_result);
$usr_expires = $row[usr_expires];
$usr_email = $row[usr_email];
$usr_URL = $row[usr_URL];
$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 "<table align=center border=1>\n";
echo "<tr>
<td>Username:</td>
<td>$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>Home Page URL:</td>
<td><A href='$usr_URL'>$usr_URL</A></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";
}
#
# This is an included file.
#
?>
<?php
include("defs.php3");
include("showstuff.php3");
#
# Standard Testbed Header
#
PAGEHEADER("Show User Information");
#
# Note the difference with which this page gets it arguments!
# I invoke it using GET arguments, so uid and pid are are defined
# without having to find them in URI (like most of the other pages
# find the uid).
#
#
# Only known and logged in users can do this.
#
LOGGEDINORDIE($uid);
$isadmin = ISADMIN($uid);
#
# Verify form arguments.
#
if (!isset($target_uid) ||
strcmp($target_uid, "") == 0) {
USERERROR("You must provide a User ID.", 1);
}
#
# Check to make sure thats this is a valid UID.
#
$query_result = mysql_db_query($TBDBNAME,
"SELECT * FROM users WHERE uid=\"$target_uid\"");
if (mysql_num_rows($query_result) == 0) {
USERERROR("The project $pid is not a valid user", 1);
}
#
# Verify that this uid is a member of one of the projects that the
# target_uid is in.
#
if (!$isadmin) {
$query_result = mysql_db_query($TBDBNAME,
"select proj_memb.* from proj_memb ".
"left join proj_memb as foo ".
"on proj_memb.pid=foo.pid and proj_memb.uid='$target_uid' ".
"where foo.uid='$uid'");
if (mysql_num_rows($query_result) == 0) {
USERERROR("You are not in the same Project as $target_uid.", 1);
}
}
echo "<center>
<h3>User Information</h3>
</center>\n";
SHOWUSER($target_uid);
echo "</center>\n";
#
# Standard Testbed Footer
#
PAGEFOOTER();
?>
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