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

10 11 12 13 14
#
# Standard Testbed Header
#
PAGEHEADER("New Project Approval");

15 16 17
#
# Only known and logged in users can do this.
#
18
$uid = GETLOGIN();
19 20 21 22 23
LOGGEDINORDIE($uid);

#
# Of course verify that this uid has admin privs!
#
24 25
$isadmin = ISADMIN($uid);
if (! $isadmin) {
Chad Barb's avatar
Chad Barb committed
26
    USERERROR("You do not have admin privileges to approve projects!", 1);
27 28
}

29 30 31 32 33 34 35 36
#
# Verify arguments.
# 
if (!isset($pid) ||
    strcmp($pid, "") == 0) {
    USERERROR("You must provide a project ID.", 1);
}

37
#
38
# Check to make sure thats this is a valid PID.
39
#
40 41
if (! TBValidProject($pid)) {
    USERERROR("The project $pid is not a valid project.", 1);
42 43
}

44
echo "<center><h3>You have the following choices:</h3></center>
45 46 47 48 49 50 51 52 53 54 55 56 57
      <table align=center border=0>
        <tr>
            <td>Deny</td>
            <td>-</td>
            <td>Deny project application (kills project records)</td>
        </tr>

        <tr>
            <td>Destroy</td>
            <td>-</td>
            <td>Deny project application, and kill the user account</td>
        </tr>

58 59 60 61 62 63 64
        <tr>
            <td>Annihilate</td>
            <td>-</td>
            <td>Deny project application silently,
                    and kill the user account silently</td>
        </tr>

65 66 67 68 69 70
        <tr>
            <td>Approve</td>
            <td>-</td>
            <td>Approve the project</td>
        </tr>

71 72 73 74 75 76
        <tr>
            <td>More Info</td>
            <td>-</td>
            <td>Ask for more info</td>
        </tr>

77 78 79 80 81 82 83 84
        <tr>
            <td>Postpone</td>
            <td>-</td>
            <td>Twiddle your thumbs some more</td>
        </tr>
      </table>\n";

#
85
# Show stuff
86
#
87 88 89 90 91 92 93 94 95 96
SHOWPROJECT($pid, $uid);

TBProjLeader($pid, $projleader);

echo "<center>
      <h3>Project Leader Information</h3>
      </center>
      <table align=center border=0>\n";

SHOWUSER($projleader);
97

98 99 100 101 102 103 104 105 106 107 108
#
# Check to make sure that the head user is 'unapproved' or 'active'
#
$headstatus = TBUserStatus($projleader);
if (!strcmp($headstatus,TBDB_USERSTATUS_UNAPPROVED) ||
	!strcmp($headstatus,TBDB_USERSTATUS_ACTIVE)) {
    $approvable = 1;
} else {
    $approvable = 0;
}

109
#
110
# Now put up the menu choice along with a text box for an email message.
111
#
112 113 114 115
echo "<center>
      <h3>What would you like to do?</h3>
      </center>
      <table align=center border=1>
116
      <form action='approveproject.php3?pid=$pid' method='post'>\n";
117 118

echo "<tr>
119 120
          <td align=center>
              <select name=approval>
121 122 123 124 125
                      <option value='postpone'>Postpone</option>";
if ($approvable) {
    echo "                  <option value='approve'>Approve</option>";
}
echo "
126 127 128
                      <option value='moreinfo'>More Info</option>
                      <option value='deny'>Deny</option>
                      <option value='destroy'>Destroy</option>
129
                      <option value='annihilate'>Annihilate</option>
130 131 132 133 134 135
              </select>";
if (!$approvable) {
	echo "              <br><b>WARNING:</b> Project cannot be approved,";
	echo"               since head user has not been verified";
}
echo "
136 137 138
          </td>
       </tr>\n";

139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
#
# Allow the approver to change the project's head UID - gotta find everyone in
# the default group, first
#
echo "<tr>
          <td align=center>
	      Head UID:
              <select name=head_uid>
                      <option value=''>(Unchanged)</option>";
$query_result =
    DBQueryFatal("select uid from group_membership where pid='$pid' and " .
	    "gid='$pid'");
while ($row = mysql_fetch_array($query_result)) {
    $thisuid = $row[uid];
    echo "                      <option value='$thisuid'>$thisuid</option>\n";
}
echo "        </select>
          </td>
       </tr>\n";


160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
#
# XXX
# Temporary Plab hack.
# See if remote nodes requested and put up checkboxes to allow override.
#
$query_result =
    DBQueryFatal("select num_pcplab,num_ron from projects where pid='$pid'");

$row = mysql_fetch_array($query_result);
$num_pcplab = $row[num_pcplab];
$num_ron    = $row[num_ron];

if ($num_ron || $num_pcplab) {
	echo "<tr>
                 <td align=center>\n";
	if ($num_pcplab) {
		echo "<input type=checkbox value=Yep checked
                                 name=pcplab_okay>
                                 Allow Plab &nbsp\n";
	}
	if ($num_ron) {
		echo "<input type=checkbox value=Yep checked
                                 name=ron_okay>
183
                                 Allow RON (PCWA) &nbsp\n";
184 185 186 187
	}
	echo "   </td>
              </tr>\n";
}
188 189

echo "<tr>
190 191
          <td>Use the text box (70 columns wide) to add a message to the
              email notification. </td>
192 193
      </tr>\n";

194
echo "<tr>
195
         <td align=center class=left>
196
             <textarea name=message rows=15 cols=70></textarea>
197 198 199 200 201
         </td>
      </tr>\n";

echo "<tr>
          <td align=center colspan=2>
202 203 204 205
              <b><input type='submit' value='Submit' name='OK'></td>
      </tr>
      </form>
      </table>\n";
206 207 208 209 210

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