showproject.php3 4.18 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
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.
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
37
38
$query_result = 
    DBQueryFatal("SELECT * FROM projects WHERE pid='$pid'");
39
40
41
42
43
if (mysql_num_rows($query_result) == 0) {
  USERERROR("The project $pid is not a valid project.", 1);
}

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

50
SHOWPROJECT($pid, $uid);
51

52
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
53
# A list of project members (from the default group).
54
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
55
56
57
$query_result =
    DBQueryFatal("SELECT m.*,u.* FROM group_membership as m ".
		 "left join users as u on u.uid=m.uid ".
58
		 "WHERE pid='$pid' and gid='$pid' order by u.uid");
59
60
61
62
63
64
if (mysql_num_rows($query_result)) {
    echo "<center>
          <h3>Project Members</h3>
          </center>
          <table align=center border=1>\n";

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
    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];
	$trust      = $row[trust];

        echo "<tr>
                  <td>$usr_name</td>
                  <td>
                    <A href='showuser.php3?target_uid=$target_uid'>
                       $target_uid</A>
82
                  </td>
83
                  <td>$trust</td>\n";
84
85

	if (TBTrustConvert($trust) != $TBDB_TRUST_NONE) {
86
87
88
89
90
91
92
93
	    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";
94
95
96
97
98
    }

    echo "</table>\n";
}

99
100
101
#
# A list of project experiments.
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
102
$query_result =
103
    DBQueryFatal("SELECT eid,expt_name FROM experiments WHERE pid='$pid' order by eid");
104
105
106
107
108
109
110
111
112
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
113
114
	if (!$name)
	    $name = "--";
115
116
        echo "<tr>
                  <td>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
117
                      <A href='showexp.php3?pid=$pid&eid=$eid'>$eid</a>
118
                      </td>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
119
                  <td>$name</td>
120
121
122
123
124
125
              </tr>\n";
    }

    echo "</table>\n";
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#
# 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>
              <td align=center>GID</td>
              <td align=center>Desription</td>
              <td align=center>Leader</td>
          </tr>\n";

    while ($row = mysql_fetch_array($query_result)) {
        $gid      = $row[gid];
        $desc     = $row[description];
	$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
164
       <A href='newgroup_form.php3?pid=$pid'>Create</a> a new Group?
Leigh B. Stoller's avatar
Leigh B. Stoller committed
165
166
      </center>\n";

167
168
169
170
171
if ($isadmin) {
    echo "<p>
          <A href='deleteproject.php3?pid=$pid'>
             <font color=Red>Delete this project?</font></a>\n";
}
172
173
174
175
176

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