All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 181608c7 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Flyspray #117: Just for Mike, clean up the header links so they are

consistent and easy to use.
parent d6dfc642
......@@ -94,14 +94,8 @@ sajax_handle_client_request();
# Standard Testbed Header after argument checking.
#
PAGEHEADER("Experiment Run");
echo "<font size=+2>Experiment Run<b> " .
MakeLink("instance",
"guid=$guid&version=$version&exptidx=$exptidx",
"$guid/$version/$exptidx") .
"</b></font>\n";
echo $instance->RunPageHeader($runidx);
echo "<br><br>\n";
$instance->ShowRun($runidx);
echo "<script type='text/javascript' language='javascript'>\n";
......
......@@ -85,12 +85,8 @@ sajax_handle_client_request();
#
PAGEHEADER("Template Instance");
echo "<font size=+2>Template Instance <b>" .
MakeLink("template",
"guid=$guid&version=$version", "$guid/$version") .
"</b></font>\n";
echo $instance->PageHeader();
echo "<br><br>\n";
$instance->Show(1);
echo "<script type='text/javascript' language='javascript'>\n";
......
......@@ -76,6 +76,7 @@ $eid = $instance->eid();
#
if (!$confirmed) {
PAGEHEADER("Create Template from Instance");
echo $instance->ExpPageHeader();
echo "<center><br><font size=+1>
Create new Template from instance $eid
......@@ -112,13 +113,7 @@ set_time_limit(0);
PAGEHEADER("Create Template from Instance");
echo "<font size=+2>Template <b>" .
MakeLink("template",
"guid=$guid&version=$version", "$guid/$version") .
"</b>, Instance <b>" .
MakeLink("project", "pid=$pid", $pid) . "/" .
MakeLink("experiment", "pid=$pid&eid=$eid", $eid);
echo "</b></font>\n";
echo $instance->ExpPageHeader();
echo "<br><br>\n";
echo "<script type='text/javascript' language='javascript' ".
......
......@@ -288,6 +288,20 @@ class Template
echo "</table>\n";
}
#
# Page header; spit back some html for the typical page header.
#
function PageHeader() {
$guid = $this->guid();
$vers = $this->vers();
$html = "<font size=+2>Template <b>" .
MakeLink("template",
"guid=$guid&version=$vers", "$guid/$vers") .
"</b></font>";
return $html;
}
#
# Display template parameters and default values in a table
#
......@@ -1112,6 +1126,63 @@ class TemplateInstance
$this->ShowRunList(1);
}
}
#
# Page header; spit back some html for the typical page header.
#
function PageHeader() {
$template = $this->template();
$exptidx = $this->exptidx();
$html = $template->PageHeader();
$guid = $this->guid();
$vers = $this->vers();
$eid = $this->eid();
$html .= "<font size=+2>, Instance <b>" .
MakeLink("instance",
"guid=$guid&version=$vers&exptidx=$exptidx", $eid) .
"</b></font>";
return $html;
}
#
# A variant that points to the active experiment.
#
function ExpPageHeader() {
$template = $this->template();
$html = $template->PageHeader();
$guid = $this->guid();
$vers = $this->vers();
$pid = $this->pid();
$eid = $this->eid();
$html .= "<font size=+2>, Instance <b>" .
MakeLink("project", "pid=$pid", $pid) . "/" .
MakeLink("experiment", "pid=$pid&eid=$eid", $eid) .
"</b></font>";
return $html;
}
#
# Ditto for a run, although run should its own class.
#
function RunPageHeader($runidx) {
$template = $this->template();
$exptidx = $this->exptidx();
$html = $this->PageHeader();
$guid = $this->guid();
$vers = $this->vers();
$eid = $this->eid();
$runid = $this->GetRunID($runidx);
$html .= "<font size=+2>, Run <b>" .
MakeLink("run",
"guid=$guid&version=$vers&exptidx=$exptidx".
"&runidx=$runidx", $runid) .
"</b></font>";
return $html;
}
#
# Display instance bindings in a table
......@@ -1377,6 +1448,23 @@ class TemplateInstance
return "${eid}-R${foo}";
}
#
# Get runid from a runidx; run needs to be its own class!
#
function GetRunID($runidx) {
$exptidx = $this->exptidx();
$query_result =
DBQueryFatal("select r.runid from experiment_runs as r ".
"where r.exptidx='$exptidx' and r.idx='$runidx'");
if (!mysql_num_rows($query_result))
return "";
$row = mysql_fetch_array($query_result);
return $row[0];
}
#
# Return an array of the bindings for a template instance.
#
......
......@@ -27,11 +27,8 @@ function SPITFORM($template, $formfields, $errors)
$guid = $template->guid();
$version = $template->vers();
echo "<font size=+2>Template <b>";
echo MakeLink("template", "guid=$guid&version=$version", "$guid/$version");
echo "</b>";
echo "</b></font>\n";
echo $template->PageHeader();
echo "<br>\n";
echo "<center>\n";
......
......@@ -58,12 +58,8 @@ if (! $template->AccessCheck($uid, $TB_EXPT_READINFO)) {
"$guid/$version!", 1);
}
echo "<font size=+2>Experiment Template <b>" .
MakeLink("template",
"guid=$guid&version=$version", "$guid/$version") .
"</b></font>\n";
echo $template->PageHeader();
echo "<br><br>\n";
$template->ShowHistory($expand);
#
......
......@@ -18,7 +18,7 @@ $isadmin = ISADMIN($uid);
#
# Spit the form out using the array of data.
#
function SPITFORM($formfields, $errors)
function SPITFORM($template, $formfields, $errors)
{
global $TBDB_PIDLEN, $TBDB_GIDLEN, $TBDB_EIDLEN, $TBDOCBASE;
global $guid, $version;
......@@ -45,10 +45,7 @@ function SPITFORM($formfields, $errors)
echo "</table><br>\n";
}
echo "<font size=+2>Experiment Template <b>" .
MakeLink("template",
"guid=$guid&version=$version", "$guid/$version") .
"</b></font>\n";
echo $template->PageHeader();
echo "<br><br>\n";
echo "<form action='template_modify.php?guid=$guid&version=$version'
......@@ -151,7 +148,7 @@ if (! isset($modify)) {
$defaults["tid"] = $template->NextTID();
$defaults["nsdata"] = $input_list[0];
$defaults["description"] = $template->description();
SPITFORM($defaults, 0);
SPITFORM($template, $defaults, 0);
PAGEFOOTER();
exit();
}
......@@ -215,7 +212,7 @@ if (!isset($formfields[nsdata]) || $formfields[nsdata] == "") {
}
if (count($errors)) {
SPITFORM($formfields, $errors);
SPITFORM($template, $formfields, $errors);
PAGEFOOTER();
exit(1);
}
......
......@@ -707,13 +707,11 @@ set_time_limit(0);
# Okay, we can spit back a header now that there is no worry of redirect.
PAGEHEADER("Instantiate Experiment Template");
echo "<font size=+2>Template <b>" .
MakeLink("template",
"guid=$guid&version=$version", "$guid/$version") .
"</b>, Instance <b>" .
MakeLink("project", "pid=$pid", $pid) . "/" .
MakeLink("experiment", "pid=$pid&eid=$eid", $eid);
echo "</b></font>\n";
echo $template->PageHeader();
echo "<font size=+2>, Instance <b>" .
MakeLink("project", "pid=$pid", $pid) . "/" .
MakeLink("experiment", "pid=$pid&eid=$eid", $eid) .
"</b></font>";
echo "<br><br>\n";
echo "<script type='text/javascript' language='javascript' ".
......
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