diff --git a/tbsetup/template_create.in b/tbsetup/template_create.in index 998bfc725bc5927353f4751588b7ce6abaa6f5dd..7ebe147b77ba9b37f77e58257edea5eacbd6a004 100644 --- a/tbsetup/template_create.in +++ b/tbsetup/template_create.in @@ -34,7 +34,7 @@ sub usage() "-E - A pithy sentence describing the template\n". "-g - The group in which to create the experiment\n". " - The project in which to create the experiment\n". - " - The template name (unique, alphanumeric, no blanks)\n". + " - The template name (alphanumeric, no blanks)\n". " - Input file for experiment.\n"); exit(-1); } @@ -305,6 +305,9 @@ system("$makegraph $guid"); fatal(-1, "Error generating template graph.") if ($?); +# Web interface depends on this line. Bad; need another way to send +# back the newly generated guid/version. +print "Template $guid/$vers has been created\n"; exit(0); # diff --git a/www/experimentrun_show.php b/www/experimentrun_show.php index c7955b6d1785b410d7d309a5d8f747079d4557a3..db86c237d390125ac3f97fac11dcbc4afc2c432e 100644 --- a/www/experimentrun_show.php +++ b/www/experimentrun_show.php @@ -5,7 +5,7 @@ # All rights reserved. # include("defs.php3"); -include("template_defs.php"); +include_once("template_defs.php"); # # Only known and logged in users ... @@ -52,28 +52,26 @@ if (!TBvalid_integer($runidx)) { PAGEHEADER("Experiment Run"); # -# Check to make sure this is a valid template. +# Check to make sure this is a valid template and user has permission. # -if (! TBValidExperimentTemplate($guid, $version)) { +$template = Template::Lookup($guid, $version); +if (!$template) { USERERROR("The experiment template $guid/$version is not a valid ". "experiment template!", 1); } -if (! TBIsTemplateInstanceExperiment($exptidx)) { +if (! $template->AccessCheck($uid, $TB_EXPT_READINFO)) { + USERERROR("You do not have permission to view experiment template ". + "$guid/$version!", 1); +} +$instance = TemplateInstance::LookupByExptidx($exptidx); +if (!$instance) { USERERROR("The instance $exptidx is not a valid instance in ". "template $guid/$version!", 1); } -if (! TBValidExperimentRun($exptidx, $runidx)) { +if (! $instance->ValidRun($runidx)) { USERERROR("The run $runidx is not a valid experiment run!", 1); } -# -# Verify Permission. -# -if (! TBExptTemplateAccessCheck($uid, $guid, $TB_EXPT_READINFO)) { - USERERROR("You do not have permission to view experiment template ". - "$guid/$version!", 1); -} - echo "Experiment Run " . MakeLink("instance", "guid=$guid&version=$version&exptidx=$exptidx", @@ -82,7 +80,7 @@ echo "Experiment Run " . echo "

\n"; -SHOWEXPERIMENTRUN($exptidx, $runidx); +$instance->ShowRun($runidx); # # Standard Testbed Footer diff --git a/www/instance_show.php b/www/instance_show.php index 91da197ea3b1f1fd177cfd9aedd00bc376cd374a..42bd9dd4589d39a9aa5963b76387c656d7cd05ef 100644 --- a/www/instance_show.php +++ b/www/instance_show.php @@ -5,7 +5,7 @@ # All rights reserved. # include("defs.php3"); -include("template_defs.php"); +include_once("template_defs.php"); # # Only known and logged in users ... @@ -45,24 +45,22 @@ if (!TBvalid_integer($exptidx)) { PAGEHEADER("Template Instance"); # -# Check to make sure this is a valid template. +# Check to make sure this is a valid template and user has permission. # -if (! TBValidExperimentTemplate($guid, $version)) { +$template = Template::Lookup($guid, $version); +if (!$template) { USERERROR("The experiment template $guid/$version is not a valid ". "experiment template!", 1); } -if (! TBIsTemplateInstanceExperiment($exptidx)) { - USERERROR("The instance $exptidx is not a valid instance in ". - "template $guid/$version!", 1); -} - -# -# Verify Permission. -# -if (! TBExptTemplateAccessCheck($uid, $guid, $TB_EXPT_READINFO)) { +if (! $template->AccessCheck($uid, $TB_EXPT_READINFO)) { USERERROR("You do not have permission to view experiment template ". "$guid/$version!", 1); } +$instance = TemplateInstance::LookupByExptidx($exptidx); +if (!$instance) { + USERERROR("The instance $exptidx is not a valid instance in ". + "template $guid/$version!", 1); +} echo "Template Instance " . MakeLink("template", @@ -70,7 +68,7 @@ echo "Template Instance " . "\n"; echo "

\n"; -SHOWTEMPLATEINSTANCE($guid, $version, $exptidx, 1); +$instance->Show(1); # # Standard Testbed Footer diff --git a/www/showexp.php3 b/www/showexp.php3 index a64165a192fc311cf6d2716edc0b4f549027c22d..ff4546cacbb05d86e977820cb1a6dc4254dd9f8b 100644 --- a/www/showexp.php3 +++ b/www/showexp.php3 @@ -72,7 +72,7 @@ sajax_handle_client_request(); # Faster to do this after the sajax stuff include("showstuff.php3"); -include("template_defs.php"); +include_once("template_defs.php"); # # Need some DB info. @@ -97,11 +97,15 @@ $panic_date = $row["panic_date"]; $lockdown = $row["lockdown"]; # Template Instance Experiments get special treatment in this page. -$isinstance = ($EXPOSETEMPLATES && - TBIsTemplateInstanceExperiment($expindex) ? 1 : 0); -if ($isinstance) { - $tag = "Template Instance"; - TBPidEid2Template($pid, $eid, $guid, $version, $instance_idx); +$instance = NULL; +if ($EXPOSETEMPLATES) { + $instance = TemplateInstance::LookupByExptidx($expindex); + + if (! is_null($instance)) { + $tag = "Template Instance"; + $guid = $instance->guid(); + $vers = $instance->vers(); + } } # @@ -189,7 +193,7 @@ if ($expstate) { } elseif ($expstate == $TB_EXPTSTATE_ACTIVE || ($expstate == $TB_EXPTSTATE_PANICED && $isadmin)) { - WRITESUBMENUBUTTON(($isinstance ? + WRITESUBMENUBUTTON(($instance ? "Terminate Instance" : "Swap Experiment Out"), "swapexp.php3?inout=out&pid=$exp_pid&eid=$exp_eid"); @@ -201,23 +205,23 @@ if ($expstate) { } } - if (!$isinstance && $expstate != $TB_EXPTSTATE_PANICED) { + if (!$instance && $expstate != $TB_EXPTSTATE_PANICED) { WRITESUBMENUBUTTON("Terminate Experiment", "endexp.php3?pid=$exp_pid&eid=$exp_eid"); } # Batch experiments can be modifed only when paused. - if (!$isinstance && ($expstate == $TB_EXPTSTATE_SWAPPED || + if (!$instance && ($expstate == $TB_EXPTSTATE_SWAPPED || (!$isbatch && $expstate == $TB_EXPTSTATE_ACTIVE))) { WRITESUBMENUBUTTON("Modify Experiment", "modifyexp.php3?pid=$exp_pid&eid=$exp_eid"); } } - if ($isinstance && $expstate == $TB_EXPTSTATE_ACTIVE) { + if ($instance && $expstate == $TB_EXPTSTATE_ACTIVE) { WRITESUBMENUBUTTON("Start New Experiment Run", "template_exprun.php?action=start&guid=$guid". - "&version=$version&eid=$exp_eid"); + "&version=$vers&eid=$exp_eid"); } if ($expstate == $TB_EXPTSTATE_ACTIVE) { @@ -293,7 +297,7 @@ WRITESUBMENUDIVIDER(); WRITESUBMENUBUTTON("Show History", "showstats.php3?showby=expt&which=$expindex"); -if (!$isinstance && STUDLY()) { +if (!$instance && STUDLY()) { WRITESUBMENUBUTTON("Duplicate Experiment", "beginexp_html.php3?copyid=${exp_pid},${exp_eid}"); } @@ -408,11 +412,11 @@ if (TBExptFirewall($exp_pid, $exp_eid) && } SUBPAGEEND(); -if ($isinstance && +if ($instance && ($expstate == $TB_EXPTSTATE_ACTIVE || $expstate == $TB_EXPTSTATE_PANICED || $expstate == $TB_EXPTSTATE_ACTIVATING)) { - SHOWTEMPLATEINSTANCEBINDINGS($guid, $version, $instance_idx); + $instance->ShowBindings(); } # diff --git a/www/showlogfile_sup.php3 b/www/showlogfile_sup.php3 index ce7d3ca96b143e63185c1bc5fb1947ded469ec48..1d26692290420b35df9a564943b0d30f12899082 100644 --- a/www/showlogfile_sup.php3 +++ b/www/showlogfile_sup.php3 @@ -129,7 +129,10 @@ function STARTLOG($pid, $eid) \n"; echo "
\n"; - echo " Loading..."; + echo "
\n"; + echo " + Working ..."; + echo "
\n"; echo "
\n"; echo "