approveproject_form.php3 5.51 KB
Newer Older
1
<?php
Leigh B. Stoller's avatar
Leigh B. Stoller committed
2 3
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2003, 2005, 2006, 2007 University of Utah and the Flux Group.
Leigh B. Stoller's avatar
Leigh B. 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 19 20
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
$isadmin   = ISADMIN();
21 22 23 24

#
# Of course verify that this uid has admin privs!
#
25
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 (! ($this_project = Project::Lookup($pid))) {
    USERERROR("Unknown project $pid", 1);
42 43
}

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

        <tr>
53 54 55
            <td class=stealth>Destroy</td>
            <td class=stealth>-</td>
            <td class=stealth>Deny project application, and kill the user account</td>
56 57
        </tr>

58
        <tr>
59 60 61
            <td class=stealth>Approve</td>
            <td class=stealth>-</td>
            <td class=stealth>Approve the project</td>
62 63
        </tr>

64
        <tr>
65 66 67
            <td class=stealth>More Info</td>
            <td class=stealth>-</td>
            <td class=stealth>Ask for more info</td>
68 69
        </tr>

70
        <tr>
71 72 73
            <td class=stealth>Postpone</td>
            <td class=stealth>-</td>
            <td class=stealth>Twiddle your thumbs some more</td>
74 75 76 77
        </tr>
      </table>\n";

#
78
# Show stuff
79
#
80 81
SHOWPROJECT($pid, $uid);

82
$projleader = $this_project->GetLeader();
83 84 85 86 87 88

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

89
SHOWUSER($projleader->uid());
90

91 92 93
#
# Check to make sure that the head user is 'unapproved' or 'active'
#
94
$headstatus = $projleader->status();
95 96 97 98 99 100 101
if (!strcmp($headstatus,TBDB_USERSTATUS_UNAPPROVED) ||
	!strcmp($headstatus,TBDB_USERSTATUS_ACTIVE)) {
    $approvable = 1;
} else {
    $approvable = 0;
}

102
#
103
# Now put up the menu choice along with a text box for an email message.
104
#
105 106 107 108
echo "<center>
      <h3>What would you like to do?</h3>
      </center>
      <table align=center border=1>
109
      <form action='approveproject.php3?pid=$pid' method='post'>\n";
110 111

echo "<tr>
112 113
          <td align=center>
              <select name=approval>
114 115 116 117 118
                      <option value='postpone'>Postpone</option>";
if ($approvable) {
    echo "                  <option value='approve'>Approve</option>";
}
echo "
119 120 121
                      <option value='moreinfo'>More Info</option>
                      <option value='deny'>Deny</option>
                      <option value='destroy'>Destroy</option>
122 123 124 125 126 127
              </select>";
if (!$approvable) {
	echo "              <br><b>WARNING:</b> Project cannot be approved,";
	echo"               since head user has not been verified";
}
echo "
128 129 130
          </td>
       </tr>\n";

131 132 133 134 135 136 137
echo "<tr>
         <td align=center>
	    <input type=checkbox value=Yep
                     name=silent>Silent (no email sent for deny,destroy)
	 </td>
       </tr>\n";

138
#
139
# Allow the approver to change the projects head UID - gotta find everyone in
140 141 142 143 144 145 146
# the default group, first
#
echo "<tr>
          <td align=center>
	      Head UID:
              <select name=head_uid>
                      <option value=''>(Unchanged)</option>";
147 148 149 150 151 152 153 154

$allmembers = $this_project->MemberList();

foreach ($allmembers as $other_user) {
    $this_uid   = $other_user->uid();
    $this_webid = $other_user->webid();
    
    echo "                   <option value='$this_webid'>$this_uid</option>\n";
155 156 157 158 159
}
echo "        </select>
          </td>
       </tr>\n";

160 161 162 163 164 165 166 167 168 169 170 171 172 173
#
# Set the user interface.
#
echo "<tr>
          <td align=center>
              Default User Interface:
              <select name=user_interface>\n";

foreach ($TBDB_USER_INTERFACE_LIST as $interface) {
    echo "            <option value='$interface'>$interface</option>\n";
}
echo "        </select>
          </td>
       </tr>\n";
174

175 176 177 178 179 180 181 182 183
#
# 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);
184
# These are now booleans, not actual counts.
185 186 187 188 189 190 191 192 193 194 195 196 197 198
$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>
199
                                 Allow RON (PCWA) &nbsp\n";
200 201 202 203
	}
	echo "   </td>
              </tr>\n";
}
204 205

echo "<tr>
206 207
          <td>Use the text box (70 columns wide) to add a message to the
              email notification. </td>
208 209
      </tr>\n";

210
echo "<tr>
211
         <td align=center class=left>
212
             <textarea name=message rows=15 cols=70></textarea>
213 214 215 216 217
         </td>
      </tr>\n";

echo "<tr>
          <td align=center colspan=2>
218 219 220 221
              <b><input type='submit' value='Submit' name='OK'></td>
      </tr>
      </form>
      </table>\n";
222 223 224 225 226

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