Commit 19ec308e authored by Leigh Stoller's avatar Leigh Stoller

Add handy pid/eid mode to spitnsdata.php3, so that you can get the

plain text of just the NS file. The "NS File:" subheader in the
showexp page is now a hyperlink to it.
parent 39b1f04c
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -192,7 +192,7 @@ if (strcmp($expstate, $TB_EXPTSTATE_NEW) &&
}
echo "<br>
<h3>NS File:</h3>\n";
<a href=spitnsdata.php3?pid=$pid&eid=$eid><h3>NS File:</h3><a>\n";
$query_result =
DBQueryFatal("SELECT nsfile from nsfiles where pid='$pid' and eid='$eid'");
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -13,16 +13,55 @@ $uid = GETLOGIN();
LOGGEDINORDIE($uid);
#
# Spit back an NS file to the user. It comes in as an urlencoded argument
# and we send it back as plain text so that user can write it out. This
# is in support of the graphical NS topology editor that fires off an
# experiment directly.
# Spit back an NS file to the user.
#
# if requesting a specific pid,eid must have permission.
#
if (isset($pid) && isset($eid)) {
#
# Check to make sure this is a valid PID/EID tuple.
#
if (! TBValidExperiment($pid, $eid)) {
USERERROR("Experiment $eid is not a valid experiment ".
"in project $pid.", 1);
}
#
# Verify Permission.
#
if (! TBExptAccessCheck($uid, $pid, $eid, $TB_EXPT_READINFO)) {
USERERROR("You do not have permission to view the NS file for ".
"experiment $eid in project $pid!", 1);
}
#
# Grab the NS file from the DB.
#
$query_result =
DBQueryFatal("select nsfile from nsfiles ".
"where pid='$pid' and eid='$eid'");
if (mysql_num_rows($query_result) == 0) {
USERERROR("There is no NS file recorded for ".
"experiment $eid in project $pid!", 1);
}
$row = mysql_fetch_array($query_result);
$nsfile = stripslashes($row["nsfile"]);
header("Content-Type: text/plain");
echo "$nsfile\n";
return;
}
#
# See if nsdata was provided.
# Otherwise:
#
# See if nsdata was provided. I think nsdata is deprecated now, and
# netbuild uses the nsref variant (LBS).
#
# See if nsref was provided. This is how the current netbuild works, by
# uploading the nsfile with nssave.php3, to a randomly generated name in
# /tmp. Spit that file back.
#
if (isset($nsdata) && strcmp($nsdata, "") != 0) {
header("Content-Type: text/plain");
echo "$nsdata";
......
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