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