showimageid.php3 2.23 KB
Newer Older
1
<?php
Leigh Stoller's avatar
Leigh Stoller committed
2 3
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
Leigh Stoller's avatar
Leigh Stoller committed
5 6
# All rights reserved.
#
7
include("defs.php3");
8
include("imageid_defs.php");
9 10

#
11
# Only known and logged in users.
12
#
13 14 15
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
$isadmin   = ISADMIN();
16 17

#
18 19 20
# Verify page arguments.
#
$reqargs = RequiredPageArguments("image", PAGEARG_IMAGE);
21

22 23 24 25 26
#
# Standard Testbed Header
#
PAGEHEADER("Image Descriptor");

27 28
# Need these below.
$imageid = $image->imageid();
29 30

#
Leigh Stoller's avatar
Leigh Stoller committed
31
# Verify permission.
32
#
33
if (!$image->AccessCheck($this_user, $TB_IMAGEID_READINFO)) {
Leigh Stoller's avatar
Leigh Stoller committed
34
    USERERROR("You do not have permission to access ImageID $imageid.", 1);
35 36
}

37 38 39 40
SUBPAGESTART();
SUBMENUSTART("More Options");
$fooid = rawurlencode($imageid);
WRITESUBMENUBUTTON("Edit this Image Descriptor",
41
		   "editimageid.php3?imageid=$fooid");
Chad Barb's avatar
Chad Barb committed
42
WRITESUBMENUBUTTON("Snapshot Node Disk into Image",
43
		   "loadimage.php3?imageid=$fooid");
44 45
WRITESUBMENUBUTTON("Delete this Image Descriptor",
		   "deleteimageid.php3?imageid=$fooid");
46
WRITESUBMENUBUTTON("Create a New Image Descriptor",
47
		   "newimageid_ez.php3");
48 49
if ($isadmin) {
    WRITESUBMENUBUTTON("Create a new OS Descriptor",
50
		       "newosid.php3");
51
}
Leigh Stoller's avatar
Leigh Stoller committed
52
WRITESUBMENUBUTTON("Image Descriptor list",
53
		   "showimageid_list.php3");
Leigh Stoller's avatar
Leigh Stoller committed
54
WRITESUBMENUBUTTON("OS Descriptor list",
55 56 57
		   "showosid_list.php3");
SUBMENUEND();

58 59 60
#
# Dump record.
# 
61
$image->Show();
62

63 64 65 66
echo "<br>\n";

#
# Show experiments using this image - we have to handle all four partitions.
67 68 69
# Also we do not put OSIDs directly into the virt_nodes table, so we have to
# get the pid and osname for the image, and use that to look into the 
# virt_nodes table.
70
#
71 72 73 74 75
function SHOWIT($osid) {
    global $this_user;
    
    if (! ($osinfo = OSinfo::Lookup($osid))) {
	TBERROR("Could not map osid to its object: $osid", 1);
76
    }
77 78 79
    echo "<h3 align='center'>Experiments using OS ";
    $osinfo->SpitLink();
    echo "</h3>\n";
80

81 82
    $osinfo->ShowExperiments($this_user);
}
83

84 85 86 87 88 89 90 91 92 93 94 95
if ($image->part1_osid()) {
    SHOWIT($image->part1_osid());
}
if ($image->part2_osid()) {
    SHOWIT($image->part2_osid());
}
if ($image->part3_osid()) {
    SHOWIT($image->part3_osid());
}
if ($image->part4_osid()) {
    SHOWIT($image->part4_osid());
}
96
SUBPAGEEND();
97 98 99 100 101 102

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