showproject.php3 3.42 KB
Newer Older
1
<?php
Leigh B. Stoller's avatar
Leigh B. Stoller committed
2 3 4 5 6
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
7
include("defs.php3");
8
include("showstuff.php3");
9

10 11 12 13 14 15
#
# Standard Testbed Header
#
PAGEHEADER("Show Project Information");


16 17 18 19 20 21 22 23 24 25
#
# 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 end experiments.
#
26
$uid = GETLOGIN();
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
LOGGEDINORDIE($uid);

$isadmin = ISADMIN($uid);

#
# Verify form arguments.
# 
if (!isset($pid) ||
    strcmp($pid, "") == 0) {
    USERERROR("You must provide a project ID.", 1);
}

#
# Check to make sure thats this is a valid PID.
#
42 43
if (! TBValidProject($pid)) {
    USERERROR("The project '$pid' is not a valid project.", 1);
44 45 46
}

#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
47
# Verify that this uid is a member of the project being displayed.
48
#
49 50
if (! TBProjAccessCheck($uid, $pid, $pid, $TB_PROJECT_READINFO)) {
    USERERROR("You are not a member of Project $pid.", 1);
51 52
}

53 54 55 56
#
# A list of project experiments.
#
$query_result =
57 58 59 60 61
    DBQueryFatal("select e.*,count(r.node_id) from experiments as e ".
		 "left join reserved as r on e.pid=r.pid and e.eid=r.eid ".
		 "where e.pid='$pid' ".
		 "group by e.eid order by e.state,e.eid");

62 63 64 65
if (mysql_num_rows($query_result)) {
    echo "<center>
          <h3>Project Experiments</h3>
          </center>
66 67 68
          <table align=center border=1 cellpadding=2 cellspacing=2>\n";

    echo "<tr>
Chad Barb's avatar
 
Chad Barb committed
69 70 71 72
              <th>EID</th>
              <th>State</th>
              <th>Nodes</th>
              <th>Description</th>
73 74 75 76 77 78
          </tr>\n";

    while ($projrow = mysql_fetch_array($query_result)) {
	$eid  = $projrow[eid];
	$state= $projrow[state];
	$nodes= $projrow["count(r.node_id)"];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
79
	$name = stripslashes($projrow[expt_name]);
80 81 82
	if ($projrow[swap_requests] > 0) {
	  $state .= "&nbsp;(idle)";
	}
83 84

        echo "<tr>
85 86 87 88 89
                 <td><A href='showexp.php3?pid=$pid&eid=$eid'>$eid</A></td>
		 <td>$state</td>
                 <td>$nodes</td>
                 <td>$name</td>
             </tr>\n";
90 91 92
    }
    echo "</table>\n";
}
93

94
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
95
# A list of project members (from the default group).
96
#
97
SHOWGROUPMEMBERS($pid, $pid, 0);
98

Leigh B. Stoller's avatar
Leigh B. Stoller committed
99 100 101 102 103 104 105 106 107 108 109 110
#
# A list of project Groups (if more than just the default).
#
$query_result =
    DBQueryFatal("SELECT * FROM groups WHERE pid='$pid'");
if (mysql_num_rows($query_result)) {
    echo "<center>
          <h3>Project Groups</h3>
          </center>
          <table align=center border=1>\n";

    echo "<tr>
Chad Barb's avatar
 
Chad Barb committed
111 112 113
              <th>GID</th>
              <th>Desription</th>
              <th>Leader</th>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
114 115 116 117
          </tr>\n";

    while ($row = mysql_fetch_array($query_result)) {
        $gid      = $row[gid];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
118
        $desc     = stripslashes($row[description]);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
	$leader   = $row[leader];

        echo "<tr>
                  <td>
                      <A href='showgroup.php3?pid=$pid&gid=$gid'>$gid</a>
                      </td>

                  <td>$desc</td>

	          <td><A href='showuser.php3?target_uid=$leader'>$leader</A>
                      </td>
              </tr>\n";
    }

    echo "</table>\n";
}

echo "<p><center>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
137
       <A href='newgroup_form.php3?pid=$pid'>Create</a> a new Group?
Leigh B. Stoller's avatar
Leigh B. Stoller committed
138 139
      </center>\n";

140 141
SHOWPROJECT($pid, $uid);

142 143 144 145 146
if ($isadmin) {
    echo "<p>
          <A href='deleteproject.php3?pid=$pid'>
             <font color=Red>Delete this project?</font></a>\n";
}
147 148 149 150 151

#
# Standard Testbed Footer
# 
PAGEFOOTER();
152
?>