Commit 2fad09a4 authored by Chad Barb's avatar Chad Barb

NetBuild modify. Woot.

Available only to admins for now.

Link is available off "modify experiment page" in admin mode.
parent 5991e780
This diff is collapsed.
......@@ -258,8 +258,14 @@ abstract synchronized class PropertiesArea extends Panel implements TextListener
}
} else {
if (nameEdit != null) {
nameEdit.tf.setEditable( true );
nameEdit.tf.setBackground( Color.white );
if (thingsICareAbout == 1 &&
((Thingee)cThingees.elementAt(0)).nameFixed()) {
nameEdit.tf.setEditable( false );
nameEdit.tf.setBackground( disabledBox );
} else {
nameEdit.tf.setEditable( true );
nameEdit.tf.setBackground( Color.white );
}
}
if (ipEdit != null) {
......
......@@ -4,6 +4,7 @@ import java.util.*;
import java.text.*;
class Thingee {
private boolean nameFixed;
private String name;
private int x, y;
......@@ -114,6 +115,14 @@ class Thingee {
currentlySelected = t;
}*/
public void fixName( boolean fix ) {
nameFixed = fix;
}
public boolean nameFixed() {
return nameFixed;
}
public String getName() {
return name;
}
......@@ -121,10 +130,12 @@ class Thingee {
public void setName( String newName ) {
// System.out.println("Thingee.setName(): Renamed from \"" + name +
// "\" to \"" + newName + "\"" );
names.remove( name );
name = new String( newName );
names.put( name, new Integer(1) );
stringWidthValid = false;
if (!nameFixed) {
names.remove( name );
name = new String( newName );
names.put( name, new Integer(1) );
stringWidthValid = false;
}
}
public Thingee(String newName) {
......@@ -137,6 +148,7 @@ class Thingee {
moveable = true;
propertyEditable = true;
trashable = true;
nameFixed = false;
}
public void move( int nx, int ny ) {
......
This diff is collapsed.
......@@ -22,13 +22,32 @@ $isadmin = ISADMIN($uid);
chdir("buildui");
if (isset($action) && $action == "modify") {
echo "<h3>Modifying $pid/$eid:</h3>";
}
?>
<applet code="Netbuild.class" width=800 height=600 MAYSCRIPT>
<param name=exporturl
<param name='exporturl'
value="<?php echo $TBBASE?>/buildui/nssave.php3">
<param name=expcreateurl
<param name='importurl'
value="<?php echo $TBBASE?>/shownsfile.php3">
<param name='modifyurl'
value="<?php echo $TBBASE?>/modifyexp.php3">
<param name='uid'
value="<?php echo $uid?>">
<param name='auth'
value="<?php echo $HTTP_COOKIE_VARS[$TBAUTHCOOKIE]?>">
<param name='expcreateurl'
value="<?php echo $TBBASE?>/beginexp.php3">
<?php
if (isset($action) && $action == "modify") {
echo "<param name='action' value='modify'>";
echo "<param name='pid' value='$pid'>";
echo "<param name='eid' value='$eid'>";
}
?>
<pre>
NetBuild requires Java.
......@@ -47,7 +66,7 @@ We'll still be here waiting for you.
<hr>
<h2>Basic usage:</h2>
<list>
<ul>
<li>
Drag Nodes and LANs from the <i>Palette</i> on the left into the <i>Workarea</i> in the middle.
</li>
......@@ -57,7 +76,7 @@ We'll still be here waiting for you.
<li>
Clicking the "create experiment" button will send you to the Emulab "create experiment" web page, automatically generating and sending an NS file for your designed topology along. From that page, you may create the experiment and/or view the generated NS file.
</li>
</list>
</ul>
<p>
<a href="../doc/docwrapper.php3?docname=netbuilddoc.html">Netbuild Full Reference</a>
</p>
......
......@@ -14,6 +14,27 @@ $parser = "$TB/libexec/ns2ir/parse-ns";
#
PAGEHEADER("Modify Experiment");
# the following hack is a page for Netbuild to
# point the user's browser at after a successful modify.
# this does no error checking.
if ($justsuccess) {
echo "<br /><br />";
echo "<font size=+1>
<p>Experiment
<a href='showexp.php3?pid=$pid&eid=$eid'>$eid</a>
in project <A href='showproject.php3?pid=$pid'>$pid</A>
is being modified!</p><br />
<p>You will be notified via email when the operation is complete.
This could take one to ten minutes, depending on
whether nodes were added to the experiments, and whether
disk images had to be loaded.</p>
<p>While you are waiting, you can watch the log
in <a target=_blank href=spewlogfile.php3?pid=$pid&eid=$eid>
realtime</a>.</p></font>\n";
PAGEFOOTER();
return;
}
#
# Only known and logged in users can modify experiments.
#
......@@ -47,6 +68,8 @@ $query_result =
DBQueryFatal("SELECT * FROM experiments WHERE ".
"eid='$eid' and pid='$pid'");
if (mysql_num_rows($query_result) == 0) {
# Netbuild requires the following line.
echo "\n\n<!-- NetBuild! Experiment does not exist -->\n\n";
USERERROR("The experiment $eid is not a valid experiment ".
"in project $pid.", 1);
}
......@@ -54,19 +77,31 @@ if (mysql_num_rows($query_result) == 0) {
$expstate = TBExptState($pid, $eid);
if (! TBExptAccessCheck($uid, $pid, $eid, $TB_EXPT_MODIFY ) ) {
# Netbuild requires the following line.
echo "\n\n<!-- NetBuild! No permission to modify -->\n\n";
USERERROR("You do not have permission to modify this experiment.", 1);
}
if (strcmp($expstate, $TB_EXPTSTATE_ACTIVE) &&
strcmp($expstate, $TB_EXPTSTATE_SWAPPED)) {
# Netbuild requires the following line.
echo "\n\n<!-- NetBuild! Experiment cannot be modified while in transition. -->\n\n";
USERERROR("You cannot modify an experiment in transition.", 1);
}
if (! isset($go)) {
echo "<h3>Experiment Modify ";
echo "<a href='faq.php3#UTT-Modify'>Documentation (FAQ)</a></h3>";
echo "<h3>Modifying Experiment $pid/$eid:<br>";
echo "<a href='faq.php3#UTT-Modify'>Modify Experiment Documentation (FAQ)</a></h3>";
echo "<br>";
if ($isadmin) {
echo "<font size='+1'>".
"You can <a href='buildui/bui.php3?action=modify&pid=$pid&eid=$eid'>".
"modify this experiment with NetBuild</a>, or edit the NS directly:</font>";
echo "<br>";
}
echo "<form action='modifyexp.php3' method='post'>";
echo "<textarea cols='100' rows='40' name='nsdata'>";
......@@ -161,6 +196,8 @@ if (! isset($go)) {
echo "$output[$i]\n";
}
echo "</xmp>\n";
# the following line is required for Netbuild interaction.
echo "\n\n<!-- Netbuild! Modify failed -->\n\n";
PAGEFOOTER();
die("");
......@@ -182,6 +219,8 @@ if (! isset($go)) {
<p>While you are waiting, you can watch the log
in <a target=_blank href=spewlogfile.php3?pid=$pid&eid=$eid>
realtime</a>.</p></font>\n";
# the following line is required for Netbuild.
echo "\n\n<!-- Netbuild! success -->\n\n";
}
# if ($delnsfile) {
......
......@@ -10,7 +10,15 @@ include("showstuff.php3");
#
# Standard Testbed Header
#
PAGEHEADER("Visualization, NS File, and Details");
if (!isset($justns)) {
$justns = 0;
}
if (!$justns) {
PAGEHEADER("Visualization, NS File, and Details");
}
#
# Only known and logged in users can end experiments.
......@@ -63,6 +71,38 @@ if (!$isadmin) {
}
}
#
# if it is netbuild wanting an NS to modify, send that along
# (For now, as a disgusting hack, send node positioning along, too.)
#
if ($justns) {
$query_result =
DBQueryFatal("SELECT nsfile from nsfiles where pid='$pid' and eid='$eid'");
if (mysql_num_rows($query_result)) {
$row = mysql_fetch_array($query_result);
$nsfile = stripslashes($row[nsfile]);
echo "$nsfile\n";
# flush();
$query_result =
DBQueryFatal("SELECT vname, x, y FROM vis_nodes where pid='$pid' and eid='$eid'");
while ($row = mysql_fetch_array($query_result)) {
$name = $row[vname];
$x = $row[x];
$y = $row[y];
echo "tb-set-vis-position \$$name $x $y\n";
}
flush();
}
else {
echo "No stored NS file for $pid/$eid\n";
}
return;
}
echo "<font size=+2><b>".
"<a href='showproject.php3?pid=$pid'>$pid</a>/".
"<a href='showexp.php3?pid=$pid&eid=$eid'>$eid</a>".
......
......@@ -83,10 +83,17 @@ function GETLOGIN() {
#
function GETUID() {
global $TBNAMECOOKIE, $HTTP_COOKIE_VARS;
global $nocookieuid;
$curname = $HTTP_COOKIE_VARS[$TBNAMECOOKIE];
if ($curname == NULL)
return FALSE;
$curname = $nocookieuid;
if ($curname == NULL) {
$curname = $HTTP_COOKIE_VARS[$TBNAMECOOKIE];
}
if ($curname == NULL) {
return FALSE;
}
return $curname;
}
......@@ -101,7 +108,7 @@ function GETUID() {
function CHECKLOGIN($uid) {
global $TBAUTHCOOKIE, $HTTP_COOKIE_VARS, $TBAUTHTIMEOUT;
global $CHECKLOGIN_STATUS, $CHECKLOGIN_UID;
global $nocookieauth;
#
# If we already figured this out, do not duplicate work!
#
......@@ -110,8 +117,14 @@ function CHECKLOGIN($uid) {
}
$CHECKLOGIN_UID = $uid;
$curhash = $HTTP_COOKIE_VARS[$TBAUTHCOOKIE];
# for java applet, we can send the key in the $auth variable,
# rather than passing it is a cookie.
if (isset($nocookieauth)) {
$curhash = $nocookieauth;
} else {
$curhash = $HTTP_COOKIE_VARS[$TBAUTHCOOKIE];
}
#
# Note that we get multiple rows back because of the group_membership
# join. No big deal.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment