approveproject_form.php3 6.93 KB
Newer Older
1
<?php
Leigh Stoller's avatar
Leigh Stoller committed
2
#
3
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
Leigh Stoller's avatar
Leigh Stoller committed
23
#
24 25 26 27 28
include("defs.php3");

#
# Only known and logged in users can do this.
#
29 30 31
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
$isadmin   = ISADMIN();
32 33 34 35

#
# Of course verify that this uid has admin privs!
#
36
if (! $isadmin) {
Chad Barb's avatar
Chad Barb committed
37
    USERERROR("You do not have admin privileges to approve projects!", 1);
38 39
}

40
#
41 42 43
# Verify page arguments.
#
$reqargs = RequiredPageArguments("project", PAGEARG_PROJECT);
44 45 46 47 48 49 50
$optargs = OptionalPageArguments("head_uid", PAGEARG_STRING,
				 "user_interface", PAGEARG_STRING,
				 "message", PAGEARG_ANYTHING,
				 "silent", PAGEARG_BOOLEAN,
				 "pcplab_okay", PAGEARG_BOOLEAN,
				 "ron_okay", PAGEARG_BOOLEAN,
				 "back", PAGEARG_STRING);
51

52
#
53
# Check to make sure thats this is a valid PID.
54
#
55 56
if (! ($this_project = $reqargs["project"])) {
    USERERROR("Unknown project", 1);
57
}
58 59
$pid = $this_project->pid();
$projleader = $this_project->GetLeader();
60

61 62 63 64 65
#
# Standard Testbed Header
#
PAGEHEADER("New Project Approval");

66
echo "<center><h3>You have the following choices:</h3></center>
67
      <table class=stealth align=center border=0>
68
        <tr>
69 70 71
            <td class=stealth>Deny</td>
            <td class=stealth>-</td>
            <td class=stealth>Deny project application (kills project records)</td>
72 73 74
        </tr>

        <tr>
75 76 77
            <td class=stealth>Destroy</td>
            <td class=stealth>-</td>
            <td class=stealth>Deny project application, and kill the user account</td>
78 79
        </tr>

80
        <tr>
81 82 83
            <td class=stealth>Approve</td>
            <td class=stealth>-</td>
            <td class=stealth>Approve the project</td>
84 85
        </tr>

86
        <tr>
87 88 89
            <td class=stealth>More Info</td>
            <td class=stealth>-</td>
            <td class=stealth>Ask for more info</td>
90 91
        </tr>

92
        <tr>
93 94 95
            <td class=stealth>Postpone</td>
            <td class=stealth>-</td>
            <td class=stealth>Twiddle your thumbs some more</td>
96 97 98 99
        </tr>
      </table>\n";

#
100
# Show stuff
101
#
102
$this_project->Show();
103

104
$projleader = $this_project->GetLeader();
105 106 107 108 109 110

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

111
$projleader->Show();
112

113 114 115
#
# Check to make sure that the head user is 'unapproved' or 'active'
#
116
$headstatus = $projleader->status();
117 118 119 120 121 122 123
if (!strcmp($headstatus,TBDB_USERSTATUS_UNAPPROVED) ||
	!strcmp($headstatus,TBDB_USERSTATUS_ACTIVE)) {
    $approvable = 1;
} else {
    $approvable = 0;
}

124
#
125
# Now put up the menu choice along with a text box for an email message.
126
#
127 128 129 130
echo "<center>
      <h3>What would you like to do?</h3>
      </center>
      <table align=center border=1>
131 132
      <form action='" . CreateURL("approveproject", $project) .
             "' method='post'>\n";
133 134

echo "<tr>
135 136
          <td align=center>
              <select name=approval>
137 138 139 140 141
                      <option value='postpone'>Postpone</option>";
if ($approvable) {
    echo "                  <option value='approve'>Approve</option>";
}
echo "
142 143 144
                      <option value='moreinfo'>More Info</option>
                      <option value='deny'>Deny</option>
                      <option value='destroy'>Destroy</option>
145 146 147 148 149 150
              </select>";
if (!$approvable) {
	echo "              <br><b>WARNING:</b> Project cannot be approved,";
	echo"               since head user has not been verified";
}
echo "
151 152 153
          </td>
       </tr>\n";

154 155
echo "<tr>
         <td align=center>
156 157 158
	    <input type=checkbox value=Yep ".
               ((isset($silent) && $silent == "Yep") ? "checked " : " ") .
                     "name=silent>Silent (no email sent for deny,destroy)
159 160 161
	 </td>
       </tr>\n";

162
#
163
# Allow the approver to change the projects head UID - gotta find everyone in
164 165 166 167 168 169 170
# the default group, first
#
echo "<tr>
          <td align=center>
	      Head UID:
              <select name=head_uid>
                      <option value=''>(Unchanged)</option>";
171 172 173 174 175 176

$allmembers = $this_project->MemberList();

foreach ($allmembers as $other_user) {
    $this_uid   = $other_user->uid();
    $this_webid = $other_user->webid();
177
    $sel = ((isset($head_uid) && $head_uid == $this_webid) ? "selected" : "");
178
    
179
    echo "             <option $sel value='$this_webid'>$this_uid</option>\n";
180 181 182 183 184
}
echo "        </select>
          </td>
       </tr>\n";

185 186 187 188 189 190 191 192 193
#
# Set the user interface.
#
echo "<tr>
          <td align=center>
              Default User Interface:
              <select name=user_interface>\n";

foreach ($TBDB_USER_INTERFACE_LIST as $interface) {
194 195 196 197
    $sel = ((isset($user_interface) &&
	     $user_interface == $interface) ? "selected" : "");
    
    echo "            <option $sel value='$interface'>$interface</option>\n";
198 199 200 201
}
echo "        </select>
          </td>
       </tr>\n";
202

203 204 205 206 207
#
# XXX
# Temporary Plab hack.
# See if remote nodes requested and put up checkboxes to allow override.
#
208
# These are now booleans, not actual counts.
209 210
$num_pcplab = $this_project->num_pcplab();
$num_ron    = $this_project->num_ron();
211 212

if ($num_ron || $num_pcplab) {
213 214 215 216 217 218
        # Default these on.
        if (!isset($back)) {
	    $pcplab_okay = "Yep";
	    $ron_okay = "Yep";
	}
    
219 220 221
	echo "<tr>
                 <td align=center>\n";
	if ($num_pcplab) {
222 223 224 225
		echo "<input type=checkbox value=Yep ".
		     ((isset($pcplab_okay) && $pcplab_okay == "Yep")
		      ? "checked " : " ") . 
		    " name=pcplab_okay>
226 227 228
                                 Allow Plab &nbsp\n";
	}
	if ($num_ron) {
229 230 231 232
		echo "<input type=checkbox value=Yep ".
		     ((isset($ron_okay) && $ron_okay == "Yep")
		      ? "checked " : " ") . 
                               " name=ron_okay>
233
                                 Allow RON (PCWA) &nbsp\n";
234 235 236 237
	}
	echo "   </td>
              </tr>\n";
}
238 239

echo "<tr>
240 241
          <td>Use the text box (70 columns wide) to add a message to the
              email notification. </td>
242 243
      </tr>\n";

244
echo "<tr>
245
         <td align=center class=left>
246 247
             <textarea name=message rows=15 cols=70>";
if (isset($message)) {
248
    echo str_replace("\r", "", CleanString($message));
249 250
}
echo "</textarea>
251 252 253 254 255
         </td>
      </tr>\n";

echo "<tr>
          <td align=center colspan=2>
256 257 258 259
              <b><input type='submit' value='Submit' name='OK'></td>
      </tr>
      </form>
      </table>\n";
260 261 262 263 264

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