instance_show.php 1.57 KB
Newer Older
1 2 3
<?php
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2006, 2007 University of Utah and the Flux Group.
5 6 7
# All rights reserved.
#
include("defs.php3");
8
include_once("template_defs.php");
9 10
require("Sajax.php");
sajax_init();
11
sajax_export("ModifyAnno");
12 13 14 15

#
# Only known and logged in users ...
#
16 17 18
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
$isadmin   = ISADMIN();
19 20 21 22

#
# Verify page arguments.
#
23 24
$reqargs  = RequiredPageArguments("instance",   PAGEARG_INSTANCE);
$optargs  = OptionalPageArguments("showhidden", PAGEARG_BOOLEAN);
25 26 27 28 29 30 31
$template = $instance->GetTemplate();
# Need these below.
$guid = $template->guid();
$vers = $template->vers();
$pid  = $template->pid();
$eid  = $instance->eid();

32 33 34 35 36
# Default to not showing hidden
if (!isset($showhidden)) {
     $showhidden = 0;
}

37
if (! $template->AccessCheck($this_user, $TB_EXPT_READINFO)) {
38 39 40 41
    USERERROR("You do not have permission to view experiment template ".
	      "$guid/$version!", 1);
}

42 43 44
#
# For the Sajax Interface
#
45
function ModifyAnno($newtext)
46
{
47
    global $this_user, $template, $instance;
48

49 50
    $instance->SetAnnotation($this_user, $newtext);
    return 0;
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
}

#
# See if this request is to the above function. Does not return
# if it is. Otherwise return and continue on.
#
sajax_handle_client_request();

#
# Standard Testbed Header after argument checking.
#
PAGEHEADER("Template Instance");

echo "<script type='text/javascript' language='javascript'>\n";
sajax_show_javascript();
echo "</script>\n";

68 69
echo $instance->PageHeader();
echo "<br><br>\n";
70
$instance->Show(1, 1, $showhidden);
71

72 73 74 75 76
#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>