beginexp_form.php3 22.7 KB
Newer Older
1 2 3
<?php
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
5 6 7 8 9 10 11 12
# All rights reserved.
#

#
# Display a virgin form and exit.
# 
function INITFORM($formfields, $projlist)
{
13
    global $nsref, $guid, $copyid;
14 15 16
    
    $defaults = array();

17 18 19 20 21 22
    # These defaults possibly set below.
    $defaults["exp_pid"]          = "";
    $defaults["exp_gid"]          = "";
    $defaults["exp_id"]           = "";
    $defaults["exp_description"]  = "";

23
    #
24
    # This is for experiment copying ...
25
    #
26 27 28 29 30 31 32
    if (isset($copyid) && $copyid != "") {
	unset($copypid);
	unset($copyeid);
	
	#
	# See what kind of copy.
	#
33
	if (preg_match("/^(\d+)(?::([-\w]*))?$/", $copyid, $matches)) {
34 35
	    $exptidx = $matches[1];
	    
36 37 38 39 40 41
            #
	    # See if its a current experiment.
	    #
	    if (($experiment = Experiment::Lookup($exptidx))) {
		$copypid = $experiment->pid();
		$copyeid = $experiment->eid();
42 43
	    }
	}
44
	elseif (preg_match("/^([-\w]+),([-\w]+)(?::([-\w]*))?$/",
45 46 47 48 49 50 51 52 53
		       $copyid, $matches)) {
	    $copypid = $matches[1];
	    $copyeid = $matches[2];
	}

	#
	# Current experiment; we can get some additional stuff.
	#
	if (isset($copypid) && isset($copyeid)) {
54 55 56 57 58 59
            #
	    # See if its a current experiment.
	    #
	    if (($experiment =
		 Experiment::LookupByPidEid($copypid, $copyeid))) {
		$defaults["exp_description"] = $experiment->description();
60 61 62 63 64 65 66 67 68 69 70 71 72 73
	    }
	    
	    # See if already a copy.
	    if (preg_match("/^([-\w]*)-Copy(\d*)$/", $copyeid, $matches2)) {
		$copyeid   = $matches2[1];
		$copycount = "Copy" . (((int) $matches2[2]) + 1);
	    }
	    else
		$copycount = "Copy0";

	    $defaults["exp_pid"] = $copypid;
	    $defaults["exp_id"]  = "${copyeid}-${copycount}";
	}
	$defaults["copyid"] = $copyid;
Leigh Stoller's avatar
Leigh Stoller committed
74
	$defaults["exp_branch"] = 0;
75
    }
76 77 78 79 80 81 82 83 84 85
    else {
	unset($copyid);

        #
        # This stuff is here for netbuild. The initial post from netbuild will
        # include these; they point to the nsfile. The right approach for doing
        # this is to have another page for netbuild that does some magic and
        # redirects the browser to this page. 
        #
	if (isset($nsref) && $nsref != "" && ereg("^[0-9]+$", $nsref))
86
	    $defaults["nsref"] = $nsref;
87
	else
88 89 90
	    unset($nsref);
	
	if (isset($guid) && $guid != "" &&  ereg("^[0-9]+$", $guid))
91
	    $defaults["guid"] = $guid;
92 93
	else
	    unset($guid);
94
    }
95
    
96 97 98 99 100 101 102 103 104
    #
    # For users that are in one project and one subgroup, it is usually
    # the case that they should use the subgroup, and since they also tend
    # to be in the clueless portion of our users, give them some help.
    #
    if (count($projlist) == 1) {
	list($project, $grouplist) = each($projlist);

	if (count($grouplist) <= 2) {
105
	    $defaults["exp_pid"] = $project;
106
	    if (count($grouplist) == 1 || strcmp($project, $grouplist[0]))
107
		$defaults["exp_gid"] = $grouplist[0];
108
	    else
109
		$defaults["exp_gid"] = $grouplist[1];
110 111 112 113
	}
	reset($projlist);
    }

114 115 116 117 118 119 120 121 122 123 124 125 126
    $defaults["exp_swappable"]         = "1";
    $defaults["exp_noswap_reason"]     = "";
    $defaults["exp_idleswap"]          = "1";
    $defaults["exp_noidleswap_reason"] = "";
    $defaults["exp_idleswap_timeout"]  = TBGetSiteVar("idle/threshold");
    $defaults["exp_autoswap"]          = TBGetSiteVar("general/autoswap_mode");
    $defaults["exp_autoswap_timeout"]  = TBGetSiteVar("general/autoswap_threshold");
    $defaults["exp_localnsfile"]       = "";
    $defaults["exp_nsfile"]            = ""; # Multipart data.
    $defaults["exp_preload"]           = "no";
    $defaults["exp_batched"]           = "no";
    $defaults["exp_linktest"]          = 3;
    $defaults["exp_savedisk"]          = "no";
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151

    #
    # Allow formfields that are already set to override defaults
    #
    if (isset($formfields)) {
	while (list ($field, $value) = each ($formfields)) {
	    $defaults[$field] = $formfields[$field];
	}
    }

    SPITFORM($defaults, 0);
    return;
}

#
# Check form and return XML to the main page. 
# 
function CHECKFORM(&$formfields, $projlist)
{
    $errors = array();
    
    #
    # Must convert uploaded file for the XML page. We pass it along inline.
    # Check size though. 
    #
152
    $formfields['exp_nsfile'] = "";
153 154
    
    if (isset($_FILES['exp_nsfile']) && $_FILES['exp_nsfile']['size'] != 0) {
155
	if ($_FILES['exp_nsfile']['size'] > (1024 * 500)) {
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
	    $errors["Local NS File"] = "Too big!";
	}
	elseif ($_FILES['exp_nsfile']['name'] == "") {
	    $errors["Local NS File"] =
		"Local filename does not appear to be valid";
	}
	elseif ($_FILES['exp_nsfile']['tmp_name'] == "") {
	    $errors["Local NS File"] =
		"Temp filename does not appear to be valid";
	}
	elseif (!preg_match("/^([-\@\w\.\/]+)$/",
			    $_FILES['exp_nsfile']['tmp_name'])) {
	    $errors["Local NS File"] = "Temp path includes illegal characters";
	}
        #
        # For the benefit of the form. Remember to pass back actual filename, not
        # the php temporary file name. Note that there appears to be some kind
        # of breakage, at least in opera; filename has no path.
        #
175
        $formfields['exp_nsfile'] = $_FILES['exp_nsfile']['name'];
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190

	if (count($errors)) {
	    SPITFORM($formfields, $errors);
	    PAGEFOOTER();
	    exit(1);
	}

	# Read the entire file into a string.
	$file_contents = file_get_contents($_FILES['exp_nsfile']['tmp_name']);
	if (!$file_contents || $file_contents == "") {
	    $errors["Local NS File"] = "Error reading file on server";
	    SPITFORM($formfields, $errors);
	    PAGEFOOTER();
	    exit(1);
	}
Leigh Stoller's avatar
Leigh Stoller committed
191
	$formfields["exp_nsfile_contents"] = urlencode($file_contents);
192 193 194 195 196 197 198 199 200 201 202 203 204
    }
    $args    = array();
    $args[0] = $formfields;
    $xmlcode = xmlrpc_encode_request("dummy", $args);
    return $xmlcode;
}

#
# Spit the form out using the array of data.
#
function SPITFORM($formfields, $errors)
{
    global $TBDB_PIDLEN, $TBDB_GIDLEN, $TBDB_EIDLEN, $TBDOCBASE;
205
    global $view, $view_style, $projlist, $linktest_levels;
206
    global $EXPOSELINKTEST, $EXPOSEARCHIVE;
207
    global $EXPOSESTATESAVE;
208
    global $TBVALIDDIRS_HTML;
209

210
    PAGEHEADER("Begin a Testbed Experiment");
211 212 213 214 215 216 217 218

    echo "<script language=JavaScript>
          <!--
          function NormalSubmit() {
              document.form1.target='_self';
              document.form1.submit();
          }
          function SyntaxCheck() {
219
              window.open('','nscheck','width=650,height=400,toolbar=no,".
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
	                      "resizeable=yes,scrollbars=yes,status=yes,".
	                      "menubar=yes');
              var action = document.form1.action;
              var target = document.form1.target;

              document.form1.action='nscheck.php3';
              document.form1.target='nscheck';
              document.form1.submit();

              document.form1.action=action;
              document.form1.target=target;
          }
          //-->
          </script>\n";

    if ($errors) {
	echo "<table class=nogrid
                     align=center border=0 cellpadding=6 cellspacing=0>
              <tr>
                 <th align=center colspan=2>
                   <font size=+1 color=red>
                      &nbsp;Oops, please fix the following errors!&nbsp;
                   </font>
                 </td>
              </tr>\n";

	while (list ($name, $message) = each ($errors)) {
	    echo "<tr>
                     <td align=right>
                       <font color=red>$name:&nbsp;</font></td>
                     <td align=left>
                       <font color=red>$message</font></td>
                  </tr>\n";
	}
	echo "</table><br>\n";
    }
    else {
257
       if (! isset($formfields['copyid'])) {
258
	if (!isset($formfields['nsref']) && !isset($view['quiet'])) {
259 260 261 262 263 264 265 266 267 268 269 270 271
	  if (STUDLY()) {
            echo "<p><ul>
	    <li><b>If you have an NS file:</b><br> You may want to
                <b><a href='nscheck_form.php3'>syntax check it first</a></b>
            <li><b>If you do not have an NS file:</b><br>
                <b><a href='clientui.php3'>New GUI editor</a></b> - An enhanced Java applet for editing topologies.<br>
                <b><a href='buildui/bui.php3'>The NetBuild GUI</a></b>
		can be used to graphically create topologies.<font size=-2>
		(<a href='$TBDOCBASE/faq.php3#netbuild'>Additional 
		information</a>)</font>.
            </ul></p><br>";
	  } else {
	    echo "<p><ul>
272 273 274 275
	    <li><b>If you have an NS file:</b><br> You may want to
                <b><a href='nscheck_form.php3'>syntax check it first</a></b>
	    <li><b>If you do not have an NS file:</b><br> You may want to
		<b><a href='buildui/bui.php3'>go to the NetBuild GUI</a></b>
276
		to graphically create one online<font size=-2>
277
		(<a href='$TBDOCBASE/faq.php3#netbuild'>Additional 
278 279 280 281
		information</a>)</font>.<br>
                Or, you can download the Emulab
                <a href='netlab/client.php3'><b>client</b></a> and graphically
                create one from your desktop.
282
	     </ul></p><br>";
283
	  }
284 285
	} else {
	    if (isset($view['plab_ns_message'])) {
286 287 288 289
		echo "<center>
                        <p><b>To finish creating your slice, edit the 
                              following information as needed, and click 
                              Submit.  PlanetLab <font size=+1 color=red>  
290
                              requires</font>  users
291
                              to provide detail on what their slice will
Jay Lepreau's avatar
Jay Lepreau committed
292
                              be doing via its description (i.e., what kind 
293
                              of network traffic it will be producing).
294
                              Be sure to read over the
Jay Lepreau's avatar
Jay Lepreau committed
295
                              <a href='http://www.planet-lab.org/php/aup/'>
296
                              PlanetLab AUP</a> if you haven't already.
297 298
                       </b></p>
                      </center>\n";
299 300 301 302 303 304
	    } else {
		echo "<p><b>Your automatically generated NS file has been " .
		     "uploaded.</b> To finish creating your experiment, " .
		     "please fill out the following information:</p>";
	    }
        }
305
       }
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345
    }

    echo "<form name=form1 enctype=multipart/form-data
                onsubmit=\"return false;\"
                action=beginexp_html.php3 method=post>\n";
    # Something funky going on ...
    echo "<input type=hidden name=beginexp value=Submit>\n";
    echo "<table align=center border=1>\n";

    #
    # Include view_style in a hidden field so that it gets preserved if there
    # are errors
    #
    if ($view_style) {
	echo "<input type='hidden' name='view_style' value='$view_style'>\n";
    }

    #
    # Select Project
    #
    if (isset($view['hide_proj']) && (count($projlist) == 1)) {
	# Just include the project as a hidden field - since the user has
	# only a single project, grab that project, which is the first thing
	# in $projlist
	list($project) = each($projlist);
	echo "<input type='hidden' name=\"formfields[exp_pid]\"
                     value='$project'>\n";
    } else {
	echo "<tr>
		  <td class='pad4'>Select Project:</td>
		  <td class='pad4'><select name=\"formfields[exp_pid]\">\n";

	# If just one project, make sure just the one option.
	if (count($projlist) != 1) {
	    echo "<option value=''>Please Select &nbsp</option>\n";
	}

	while (list($project) = each($projlist)) {
	    $selected = "";

346
	    if (strcmp($formfields["exp_pid"], $project) == 0)
347 348 349 350 351 352 353 354 355 356 357 358 359 360
		$selected = "selected";

	    echo "        <option $selected value=\"$project\">
				 $project </option>\n";
	}
	echo "       </select>";
	echo "    </td>
	      </tr>\n";
    }

    #
    # Select a group
    #
    if (isset($view['hide_group'])) {
361
	if (isset($formfields['group'])) {
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381
	    $group = $formfields['group'];
	} else {
	    $group = "";
	}
	echo "<input type='hidden' name=\"formfields[exp_gid]\"
                     value='$group'>\n";
    } else {
	echo "<tr>
		  <td class='pad4'>Group:</td>
		  <td class='pad4'><select name=\"formfields[exp_gid]\">
			<option 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)) {
		    $selected = "";

382 383 384 385
		    if (isset($formfields["exp_gid"]) &&
			isset($formfields["exp_pid"]) &&
			strcmp($formfields["exp_pid"], $project) == 0 &&
			strcmp($formfields["exp_gid"], $group) == 0)
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
			$selected = "selected";

		    echo "<option $selected value=\"$group\">
			       $project/$group</option>\n";
		}
	    }
	}
	echo "     </select>
	      <font size=-1>(Must be default or correspond to selected project)
	      </font>
		 </td>
	      </tr>\n";
    }

    #
    # Name:
    #
    echo "<tr>
              <td class='pad4'>Name:
              <br><font size='-1'>(No blanks)</font></td>
              <td class='pad4' class=left>
                  <input type=text
                         name=\"formfields[exp_id]\"
409
                         value=\"" . $formfields['exp_id'] . "\"
410 411 412 413 414 415 416 417
	                 size=$TBDB_EIDLEN
                         maxlength=$TBDB_EIDLEN>
              </td>
          </tr>\n";

    #
    # Description
    #
418
    if (isset($view["plab_descr"])) {
419 420 421 422 423 424
          echo "<tr>
                    <td class='pad4'>Slice Description:<br>
                        <font size='-1'>(Please be detailed)</font></td>
                    <td class='pad4' class=left>
                        <textarea
                               name=\"formfields[exp_description]\"
425 426
	                       rows=5 cols=50>".
	                       $formfields['exp_description'] ."
427
                        </textarea>
428 429 430 431 432 433 434 435 436
                    </td>
                </tr>\n";
    } else {
          echo "<tr>
                    <td class='pad4'>Description:<br>
                        <font size='-1'>(A concise sentence)</font></td>
                    <td class='pad4' class=left>
                        <input type=text
                               name=\"formfields[exp_description]\"
437
                               value=\"" . $formfields['exp_description'] . "\"
438 439 440 441
	                       size=60>
                    </td>
                </tr>\n";
    }
442 443 444 445

    #
    # NS file
    #
446 447 448 449 450
    if (isset($formfields['copyid'])) {
	$copyid = $formfields['copyid'];

	echo "<tr>
               <td class='pad4'>Copy of experiment: &nbsp</td>
451 452 453 454 455 456 457
               <td class='pad4'>
                   <a target=nsfile href=spitnsdata.php3?copyid=$copyid>
                      $copyid</a>\n";

	if ($EXPOSEARCHIVE) {
	    $checked = "";

458
	    if ($formfields['exp_branch'] == "1") {
459 460
		$checked = "checked=1";
	    }
461
	    echo "&nbsp; <input type='checkbox' $checked
462
			 name='formfields[exp_branch]' value='1'> ";
463
	    echo "&nbsp; Branch?";
464 465
	}
        echo "  </td>
466 467 468
                <input type=hidden name=\"formfields[copyid]\" value='$copyid'>
              </tr>\n";
    }
469 470
    elseif (isset($formfields['nsref'])) {
	$nsref = $formfields['nsref'];
471
	
472 473
	if (isset($formfields['guid'])) {
	    $guid = $formfields['guid'];
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504
	    
	    echo "<tr>
                  <td class='pad4'>Your auto-generated NS file: &nbsp</td>
                      <input type=hidden name=\"formfields[nsref]\" value=$nsref>
                      <input type=hidden name=\"formfields[guid]\" value=$guid>
                  <td class='pad4'>
                      <a target=_blank
                                href=\"spitnsdata.php3?nsref=$nsref&guid=$guid\">
                      View NS File</a></td>
                  </tr>\n";
        }
	else {
	    echo "<tr>
                   <td class='pad4'>Your auto-generated NS file: &nbsp</td>
                       <input type=hidden name=\"formfields[nsref]\"
                              value=$nsref>
                   <td class='pad4'>
                       <a target=_blank href=spitnsdata.php3?nsref=$nsref>
                       View NS File</a></td>
                 </tr>\n";
        }
    }
    else {
	echo "<tr>
                  <td class='pad4'>Your NS file:<br>
		      <input type=submit disabled id=syntax name=syntax value='Syntax Check' onclick=\"SyntaxCheck();\">
  		  </td>

                  <td><table cellspacing=0 cellpadding=0 border=0>
                    <tr>
                      <td class='pad4'>Upload<br>
505
			<font size='-1'>(500k&nbsp;max)</font></td>
506
                      <td class='pad4'>
507
                        <input type=hidden name=MAX_FILE_SIZE value=512000>
508 509
	                <input type=file
                               name=exp_nsfile
510
                               value=\"" . $formfields['exp_nsfile'] . "\"
511 512 513 514 515 516 517
	                       size=30
			       onchange=\"this.form.syntax.disabled=(this.value=='')\">
                      </td>
                    </tr><tr>
                    <td>&nbsp;&nbsp;<b>or</b></td><td></td>
                    </tr><tr>
                      <td class='pad4'>On Server<br>
518 519
                              <font size='-1'>(" . $TBVALIDDIRS_HTML .
	    		      ")</font></td>
520 521 522
                      <td class='pad4'>
	                <input type=text
                               name=\"formfields[exp_localnsfile]\"
523
                               value=\"" . $formfields['exp_localnsfile'] . "\"
524 525 526 527 528 529 530 531 532 533 534 535
	                       size=40
			       onchange=\"this.form.syntax.disabled=(this.value=='')\">
                      </td>
                    </tr></table></td></tr>\n";
    }

    #
    # Swapping
    #
    # Add in hidden fields to send swappable and noswap_reason, since
    # they do not show on the form
    echo "<input type=hidden name=\"formfields[exp_swappable]\"
536
                 value='" . $formfields['exp_swappable'] . "'>\n";
537
    echo "<input type=hidden name=\"formfields[exp_noswap_reason]\" value='";
538
    echo htmlspecialchars($formfields['exp_noswap_reason'], ENT_QUOTES);
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562
    echo "'>\n";
    
    if (isset($view['hide_swap'])) {
	$idlevars = array('exp_idleswap','exp_noidleswap_reason',
			  'exp_idleswap_timeout',
	                  'exp_autoswap','exp_autoswap_timeout');
	while (list($index,$value) = each($idlevars)) {
	    if (isset($formfields[$value])) {
		echo "<input type='hidden' name='formfields[$value]'
                             value='$formfields[$value]'>\n";
	    }
	}
    }
    else {
	echo "<tr>
		  <td class='pad4'>
		    <a href='$TBDOCBASE/docwrapper.php3?".
	                 "docname=swapping.html#swapping'>
		    Swapping:</td>
		  <td>
		  <table cellpadding=0 cellspacing=0 border=0><tr>
		  <td><input type='checkbox'
			 name='formfields[exp_idleswap]'
			 value='1'";
563
	if ($formfields['exp_idleswap'] == "1") {
564 565 566 567 568 569 570 571 572
	    echo " checked='1'";
	}
	echo "></td>
		  <td><a href='$TBDOCBASE/docwrapper.php3?".
	                    "docname=swapping.html#idleswap'>
		  <b>Idle-Swap:</b></a> Swap out this experiment
		  after 
		  <input type='text' name='formfields[exp_idleswap_timeout]'
			 value='";
573
	echo htmlspecialchars($formfields['exp_idleswap_timeout'], ENT_QUOTES);
574 575 576 577 578 579
	echo "' size='3'> hours idle.</td>
		  </tr><tr>
		  <td> </td>
		  <td>If not, why not?<br><textarea rows=2 cols=50
			      name='formfields[exp_noidleswap_reason]'>";
			      
580
	echo htmlspecialchars($formfields['exp_noidleswap_reason'],ENT_QUOTES);
581 582 583 584 585
	echo "</textarea></td>
		  </tr><tr>
		  <td><input type='checkbox'
			 name='formfields[exp_autoswap]'
			 value='1' ";
Leigh Stoller's avatar
Leigh Stoller committed
586 587
	if (isset($formfields['exp_autoswap']) &&
	    $formfields['exp_autoswap'] == "1") {
588 589 590 591 592 593 594 595
	    echo " checked='1'";
	}
	echo "></td>
		  <td><a href='$TBDOCBASE/docwrapper.php3?".
	                    "docname=swapping.html#autoswap'>
		  <b>Max. Duration:</b></a> Swap out after
		  <input type='text' name='formfields[exp_autoswap_timeout]'
			 value='";
596
	echo htmlspecialchars($formfields['exp_autoswap_timeout'], ENT_QUOTES);
597
	echo "' size='3'> hours, even if not idle.</td>
598 599 600 601 602 603 604
		  </tr>";

	if (STUDLY() || $EXPOSESTATESAVE) {
	    echo "<tr><td>
	         <input type=checkbox name='formfields[exp_savedisk]'
	         value='Yep'";

605 606
	    if (isset($formfields['exp_savedisk']) &&
		strcmp($formfields['exp_savedisk'], "Yep") == 0) {
607 608 609 610 611 612 613 614 615 616
		    echo " checked='1'";
	    }

	    echo "></td>\n";
	    echo "<td><a href='$TBDOCBASE/docwrapper.php3?".
		              "docname=swapping.html#swapstatesave'>
		  <b>State Saving:</b></a> Save disk state on swapout</td>
		  </tr>";
	}
	echo "</table></td></tr>";
617 618
    }

619 620 621
    #
    # Run linktest, and level. 
    #
622
    if (STUDLY() || $EXPOSELINKTEST) {
623
      if (isset($view['hide_linktest'])) {
624
        if ($formfields['exp_linktest']) {
625
          echo "<input type='hidden' name='formfields[exp_linktest]'
626
                       value='" . $formfields['exp_linktest'] . "'\n";
627 628
        }
      } else {
629 630 631 632 633 634 635 636 637
    echo "<tr>
              <td><a href='$TBDOCBASE/doc/docwrapper.php3?".
	                  "docname=linktest.html'>Linktest</a> Option:</td>
              <td><select name=\"formfields[exp_linktest]\">
                          <option value=0>Skip Linktest </option>\n";

    for ($i = 1; $i <= TBDB_LINKTEST_MAX; $i++) {
	$selected = "";

638
	if (strcmp($formfields['exp_linktest'], "$i") == 0)
639 640 641 642 643 644
	    $selected = "selected";
	
	echo "        <option $selected value=$i>Level $i - " .
	    $linktest_levels[$i] . "</option>\n";
    }
    echo "       </select>";
645
    echo "    (<a href='$TBDOCBASE/doc/docwrapper.php3?".
646
	"docname=linktest.html'><b>What is this?</b></a>)";
647 648
    echo "    </td>
          </tr>\n";
649
      }
650
    }
651

652 653 654 655 656 657
    #
    # Batch Experiment?
    #
    if (isset($view['hide_batch'])) {
	if ($formfields['exp_batched']) {
	    echo "<input type='hidden' name='formfields[exp_batched]'
658
                         value='" . $formfields['exp_batched'] . "'\n";
659 660 661 662 663 664 665
	}
    } else {
	echo "<tr>
		  <td class='pad4' colspan=2>
		  <input type=checkbox name='formfields[exp_batched]'
                         value='Yep'";

666 667
	if (isset($formfields['exp_batched']) &&
	    strcmp($formfields['exp_batched'], "Yep") == 0) {
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685
		echo " checked='1'";
	    }

	echo ">\n";
	echo "Batch Mode Experiment &nbsp;
	      <font size='-1'>(See
	      <a href='$TBDOCBASE/tutorial/tutorial.php3#BatchMode'>Tutorial</a>
	      for more information)</font>
	      </td>
	      </tr>\n";
    }

    #
    # Preload?
    #
    if (isset($view['hide_preload'])) { 
	if ($formfields['exp_preload']) {
	    echo "<input type='hidden' name='formfields[exp_preload]'
686
                         value='" . $formfields['exp_preload'] . "'>\n";
687 688 689 690 691 692 693
	}
    } else {
	echo "<tr>
		  <td class='pad4' colspan=2>
		      <input type=checkbox name='formfields[exp_preload]'
                             value='Yep'";

694 695
	if (isset($formfields['exp_preload']) &&
	    strcmp($formfields['exp_preload'], "Yep") == 0) {
696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724
		echo " checked='1'";
	    }

	echo ">\n";
	echo "Do Not Swap In</td>
	      </tr>\n";
    }

    echo "<tr>
              <td class='pad4' align=center colspan=2>
                 <b><input type=button value=Submit name=beginexp
                           onclick=\"NormalSubmit();\"></b>
              </td>
         </tr>
        </form>
        </table>\n";

    if (!isset($view['quiet'])) {
	echo "<p>
	      <h3>Handy Links:</h3>
	      <ul>
		 <li> View a <a href='showosid_list.php3'>list of OSIDs</a>
		      that are available for you to use in your NS file.</li>
		 <li> Create your own <a href='newimageid_ez.php3'>
		      custom disk images</a>.</li>
	      </ul>\n";
    }
}
?>