Commit b5f0251f authored by Leigh B. Stoller's avatar Leigh B. Stoller

Just for Mac, make the group selection in the begin experiment page

a dropdown menu. Required some changes to TBProjList command return
format, which required changes in newgroup and newimageid.
parent 924a3907
......@@ -37,12 +37,10 @@ echo "<form enctype=\"multipart/form-data\"
#
echo "<tr>
<td colspan=2>*Select Project:</td>";
echo " <td><select name=\"exp_pid\">";
for ($i = 0; $i < count($projlist); $i++) {
$project = $projlist[$i];
echo "<option value=\"$project\">$project</option>\n";
}
echo " <td><select name=exp_pid>";
while (list($project) = each($projlist)) {
echo "<option value='$project'>$project </option>\n";
}
echo " </select>";
echo " </td>
</tr>\n";
......@@ -122,10 +120,22 @@ echo "<tr>
# Select a group
#
echo "<tr>
<td colspan=2>Group[<b>3</b>]:</td>
<td><input type=\"text\" name=\"exp_gid\"
size=$TBDB_GIDLEN maxlength=$TBDB_GIDLEN>
</td>
<td colspan=2>Group[<b>3</b>]:</td>\n";
echo " <td><select name=exp_gid>
<option selected value=''>Default Group </option>\n";
reset($projlist);
while (list($project, $grouplist) = each($projlist)) {
for ($i = 0; $i < count($grouplist); $i++) {
$group = $grouplist[$i];
if (strcmp($project, $group)) {
echo "<option value='$group'>$project/$group
</option>\n";
}
}
}
echo " </select>
</td>
</tr>\n";
echo "<tr>
......@@ -153,7 +163,8 @@ echo "<h4><blockquote><blockquote><blockquote>
Priority, which indicates that we can swap you out before high
priority experiments.
<dt>[3]
<dd>Leave blank to use the default group for the project.
<dd>Leave as the default group, or pick a subgroup that
corresponds to the project you selected.
<dt>[4]
<dd>Check this if you want to create a
<a href='$TBDOCBASE/tutorial/tutorial.php3#BatchMode'>
......
......@@ -255,7 +255,6 @@ function TBProjAccessCheck($uid, $pid, $gid, $access_type)
$mintrust = $TBDB_TRUST_USER;
}
elseif ($access_type == $TB_PROJECT_MAKEGROUP ||
$access_type == $TB_PROJECT_EDITGROUP ||
$access_type == $TB_PROJECT_DELGROUP) {
$mintrust = $TBDB_TRUST_PROJROOT;
}
......@@ -270,8 +269,9 @@ function TBProjAccessCheck($uid, $pid, $gid, $access_type)
$access_type == $TB_PROJECT_CREATEEXPT) {
$mintrust = $TBDB_TRUST_LOCALROOT;
}
elseif ($access_type == $TB_PROJECT_ADDUSER) {
if ($gid == $pid) {
elseif ($access_type == $TB_PROJECT_ADDUSER ||
$access_type == $TB_PROJECT_EDITGROUP) {
if (strcmp($gid, $pid) == 0) {
$mintrust = $TBDB_TRUST_PROJROOT;
}
else {
......@@ -758,6 +758,28 @@ function TBProjLeader($pid, &$projleader)
return 1;
}
#
# Return Group Leader.
#
# usage TBGroupLeader($pid, $gid, &$groupleader)
# returns 1 if valid
# returns 0 if not valid
#
function TBGroupLeader($pid, $gid, &$groupleader)
{
$query_result =
DBQueryFatal("select leader from groups ".
"where pid='$pid' and gid='$gid'");
if (mysql_num_rows($query_result) == 0) {
return 0;
}
$row = mysql_fetch_array($query_result);
$groupleader = $row[leader];
return 1;
}
#
# Return Experiment Leader.
#
......@@ -786,6 +808,8 @@ function TBExpLeader($pid, $eid, &$expleader)
# to be totally general would require too many DB operations. Not worth
# the effort or the expense.
#
# Returns an indexed array (by pid) of lists (of gids).
#
function TBProjList($uid, $access_type)
{
global $TB_PROJECT_CREATEEXPT;
......@@ -812,7 +836,7 @@ function TBProjList($uid, $access_type)
}
$query_result =
DBQueryFatal("SELECT distinct pid FROM group_membership ".
DBQueryFatal("SELECT distinct pid,gid FROM group_membership ".
"WHERE uid='$uid' and $trust_clause");
if (mysql_num_rows($query_result) == 0) {
......@@ -821,9 +845,11 @@ function TBProjList($uid, $access_type)
$i = 0;
while ($row = mysql_fetch_array($query_result)) {
$pid = $row[pid];
$pid = $row['pid'];
$gid = $row['gid'];
$result[$pid][] = $gid;
$result[$i] = $pid;
$i++;
}
return $result;
......
......@@ -60,11 +60,10 @@ else {
<td>*Select Project:</td>";
echo " <td><select name=pid>";
for ($i = 0; $i < count($projlist); $i++) {
$pid = $projlist[$i];
echo " <option value='$pid'>$pid</option>\n";
while (list($project) = each($projlist)) {
echo "<option value='$project'>$project </option>\n";
}
echo " </select>";
echo " </td>
</tr>\n";
......@@ -100,6 +99,12 @@ echo "<tr>
</form>
</table>\n";
echo "<br><center>
Important <a href=docwrapper.php3?docname=groups.html#SECURITY'>
security issues</a> are discussed in the
<a href='docwrapper.php3?docname=groups.html'>Groups Tutorial</a>.
</center>\n";
#
# Standard Testbed Footer
#
......
......@@ -102,11 +102,9 @@ echo "<tr>
echo "<tr>
<td>*Select Project:</td>";
echo " <td><select name=pid>";
for ($i = 0; $i < count($projlist); $i++) {
$pid = $projlist[$i];
echo "<option value='$pid'>$pid</option>\n";
}
while (list($project) = each($projlist)) {
echo "<option value='$project'>$project </option>\n";
}
if ($isadmin) {
echo "<option value=none>None</option>\n";
}
......
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