showproject.php3 3.4 KB
Newer Older
1
2
<?php
include("defs.php3");
3
include("showstuff.php3");
4

5
6
7
8
9
10
#
# Standard Testbed Header
#
PAGEHEADER("Show Project Information");


11
12
13
14
15
16
17
18
19
20
#
# 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.
#
21
$uid = GETLOGIN();
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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.
#
$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);
}

#
# Verify that this uid is a member of the project for the experiment
# being displayed, or is an admin person.
#
if (!$isadmin) {
    $query_result = mysql_db_query($TBDBNAME,
	"SELECT pid FROM proj_memb WHERE uid=\"$uid\" and pid=\"$pid\"");
    if (mysql_num_rows($query_result) == 0) {
        USERERROR("You are not a member of Project $pid.", 1);
    }
}

55
56
57
58
echo "<center>
      <h3>Project Information</h3>
      </center>\n";
SHOWPROJECT($pid, $uid);
59

60
61
62
63
#
# A list of project members.
#
$query_result = mysql_db_query($TBDBNAME,
64
65
66
	"SELECT p.*,u.* FROM proj_memb as p ".
	"left join users as u on u.uid=p.uid ".
        "WHERE pid=\"$pid\"");
67
68
69
70
71
72
if (mysql_num_rows($query_result)) {
    echo "<center>
          <h3>Project Members</h3>
          </center>
          <table align=center border=1>\n";

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
    echo "<tr>
              <td align=center>Name</td>
              <td align=center>UID</td>
              <td align=center>Privs</td>
              <td align=center>Approved?</td>
          </tr>\n";

    while ($row = mysql_fetch_array($query_result)) {
        $target_uid = $row[uid];
	$usr_name   = $row[usr_name];
	$status     = $row[status];
	$trust      = $row[trust];

	if (strcmp($trust, "local_root") == 0 ||
	    strcmp($trust, "group_root") == 0) {
	    $trust = "root";
	}
	
        echo "<tr>
                  <td>$usr_name</td>
                  <td>
                    <A href='showuser.php3?target_uid=$target_uid'>
                       $target_uid</A>
96
                  </td>
97
98
99
100
101
102
103
104
105
106
107
108
                  <td>$trust</td>\n";
	    
	if (strcmp($status, "active") == 0 ||
	    strcmp($status, "unverified") == 0) {
	    echo "<td align=center>
                      <img alt=\"Y\" src=\"greenball.gif\"></td>\n";
	}
	else {
	    echo "<td align=center>
                      <img alt=\"N\" src=\"redball.gif\"></td>\n";
	}
	echo "</tr>\n";
109
110
111
112
113
    }

    echo "</table>\n";
}

114
115
116
117
118
119
120
121
122
123
124
125
126
127
#
# A list of project experiments.
#
$query_result = mysql_db_query($TBDBNAME,
	"SELECT eid,expt_name FROM experiments WHERE pid=\"$pid\"");
if (mysql_num_rows($query_result)) {
    echo "<center>
          <h3>Project Experiments</h3>
          </center>
          <table align=center border=1>\n";

    while ($row = mysql_fetch_row($query_result)) {
        $eid  = $row[0];
        $name = $row[1];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
128
129
	if (!$name)
	    $name = "--";
130
131
        echo "<tr>
                  <td>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
132
                      <A href='showexp.php3?exp_pideid=$pid\$\$$eid'>$eid</a>
133
                      </td>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
134
                  <td>$name</td>
135
136
137
138
139
140
              </tr>\n";
    }

    echo "</table>\n";
}

141
142
143
144
145
146
echo "</center>\n";

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