template_show.php 2.42 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2006 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
include("template_defs.php");

#
11
# Only known and logged in users ...
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
#
$uid = GETLOGIN();
LOGGEDINORDIE($uid);
$isadmin = ISADMIN($uid);

#
# Verify page arguments.
# 
if (!isset($guid) ||
    strcmp($guid, "") == 0) {
    USERERROR("You must provide a template GUID.", 1);
}

if (!isset($version) ||
    strcmp($version, "") == 0) {
    USERERROR("You must provide a template version number", 1);
}
if (!TBvalid_guid($guid)) {
    PAGEARGERROR("Invalid characters in GUID!");
}
if (!TBvalid_integer($version)) {
    PAGEARGERROR("Invalid characters in version!");
}

#
# Standard Testbed Header after argument checking.
#
PAGEHEADER("Experiment Template: $guid/$version");

#
# Check to make sure this is a valid template.
#
if (! TBValidExperimentTemplate($guid, $version)) {
    USERERROR("The experiment template $guid/$version is not a valid ".
              "experiment template!", 1);
}

#
# Verify Permission.
#
if (! TBExptTemplateAccessCheck($uid, $guid, $TB_EXPT_READINFO)) {
    USERERROR("You do not have permission to view experiment template ".
	      "$guid/$version!", 1);
}

57 58 59 60
echo "<font size=+2>Experiment Template <b>" .
         MakeLink("template",
		  "guid=$guid&version=$version", "$guid/$version") . 
      "</b></font>\n";
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
echo "<br><br>\n";

SUBPAGESTART();
SUBMENUSTART("Template Options");

WRITESUBMENUBUTTON("Show NS File &nbsp &nbsp",
		   "spitnsdata.php3?guid=$guid&version=$version");

WRITESUBMENUBUTTON("Modify Template",
		   "template_modify.php?guid=$guid&version=$version");

WRITESUBMENUBUTTON("Instantiate Template",
		   "template_swapin.php?guid=$guid&version=$version");

WRITESUBMENUBUTTON("Add Metadata",
		   "template_metadata.php?action=add&".
		   "guid=$guid&version=$version");

WRITESUBMENUBUTTON("Template History",
		   "template_history.php?guid=$guid&version=$version");

SUBMENUEND_2A();

#
# Ick.
#
TBTemplatePidEid($guid, $version, $pid, $eid);
$rsrcidx = TBrsrcIndex($pid, $eid);

echo "<br>
      <img border=1 alt='template visualization'
           src='showthumb.php3?idx=$rsrcidx'>";

SUBMENUEND_2B();

SHOWTEMPLATE($guid, $version);
SHOWTEMPLATEMETADATA($guid, $version);
SUBPAGEEND();

if (SHOWTEMPLATEPARAMETERS($guid, $version)) {
    echo "<br>\n";
}
SHOWTEMPLATEINSTANCES($guid, $version);

SHOWTEMPLATEGRAPH($guid);

#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>