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

#
# Standard Testbed Header
#
12
PAGEHEADER("Create a Project Group");
Leigh Stoller's avatar
Leigh Stoller committed
13 14 15 16 17 18 19 20 21 22

#
# Only known and logged in users.
#
$uid = GETLOGIN();
LOGGEDINORDIE($uid);

#
# Verify page arguments.
# 
23 24
if (!isset($pid) || strcmp($pid, "") == 0) {
    unset($pid);
Leigh Stoller's avatar
Leigh Stoller committed
25

26 27 28 29 30 31 32 33 34
    #
    # See what projects the uid can do this in.
    #
    $projlist = TBProjList($uid, $TB_PROJECT_MAKEGROUP);

    if (! count($projlist)) {
	USERERROR("You do not appear to be a member of any Projects in which ".
		  "you have permission to create new groups.", 1);
    }
Leigh Stoller's avatar
Leigh Stoller committed
35
}
36 37 38 39 40 41 42 43 44 45
else {
    #
    # Verify permission for specific group.
    #
    if (! TBProjAccessCheck($uid, $pid, 0, $TB_PROJECT_MAKEGROUP)) {
	USERERROR("You do not have permission to create groups in ".
		  "project $pid!", 1);
    }
}

Leigh Stoller's avatar
Leigh Stoller committed
46 47 48 49 50 51 52 53 54

echo "<form action=newgroup.php3 method=post>
      <table align=center border=1> 
      <tr>
        <td align=center colspan=2>
           <em>(Fields marked with * are required)</em>
        </td>
      </tr>\n";

55 56 57 58 59 60 61 62 63 64 65 66 67
if (isset($pid)) {
    echo "<tr>
              <td>Project:</td>
              <td class=left>
                  <input name=group_pid type=readonly value='$pid'>
              </td>
          </tr>\n";
}
else {
    echo "<tr>
              <td>*Select Project:</td>";
    echo "    <td><select name=pid>";

68 69
    while (list($project) = each($projlist)) {
	echo "<option value='$project'>$project </option>\n";
70
    }
71

72 73 74 75
    echo "       </select>";
    echo "    </td>
          </tr>\n";
}
Leigh Stoller's avatar
Leigh Stoller committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106

echo "<tr>
          <td>*Group Name (no blanks, lowercase):</td>
          <td class=left>
              <input name=group_id type=text size=$TBDB_GIDLEN
                     maxlength=$TBDB_GIDLEN>
          </td>
      </tr>\n";

echo "<tr>
          <td>*Group Description:</td>
          <td class=left>
              <input name=group_description type=text size=50>
          </td>
      </tr>\n";

echo "<tr>
          <td>*Group Leader (Emulab userid):</td>
          <td class=left>
              <input name=group_leader type=text value='$uid'
	             size=$TBDB_UIDLEN maxlength=$TBDB_UIDLEN>
          </td>
      </tr>\n";

echo "<tr>
         <td align=center colspan=2>
            <b><input type=submit value=Submit></b></td>
      </tr>
      </form>
      </table>\n";

107 108 109 110 111 112
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";

Leigh Stoller's avatar
Leigh Stoller committed
113 114 115 116 117
#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>