showproject.php3 6.42 KB
Newer Older
1
<?php
Leigh B. Stoller's avatar
Leigh B. Stoller committed
2 3
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2008 University of Utah and the Flux Group.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
5 6
# All rights reserved.
#
7
include("defs.php3");
8
include_once("template_defs.php");
Kevin Atkinson's avatar
 
Kevin Atkinson committed
9
include_once("pub_defs.php");
10 11 12 13 14 15 16 17 18

#
# Note the difference with which this page gets it arguments!
# I invoke it using GET arguments, so uid and pid are are defined
# without having to find them in URI (like most of the other pages
# find the uid).
#

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

#
26
# Verify page arguments.
27
#
28 29 30 31
$reqargs  = RequiredPageArguments("project", PAGEARG_PROJECT);
$project  = $reqargs["project"];
$group    = $project->Group();
$pid      = $project->pid();
32

33 34 35 36 37
#
# Standard Testbed Header
#
PAGEHEADER("Project $pid");

38
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
39
# Verify that this uid is a member of the project being displayed.
40
#
41
if (! $project->AccessCheck($this_user, $TB_PROJECT_READINFO)) {
42
    USERERROR("You are not a member of Project $pid.", 1);
43 44
}

45 46 47
SUBPAGESTART();
SUBMENUSTART("Project Options");
WRITESUBMENUBUTTON("Create Subgroup",
48
		   "newgroup.php3?pid=$pid");
49
WRITESUBMENUBUTTON("Edit User Privs",
50
		   "editgroup.php3?pid=$pid&gid=$pid");
51 52
WRITESUBMENUBUTTON("Remove Users",
		   "showgroup.php3?pid=$pid&gid=$pid");
53
WRITESUBMENUBUTTON("Show Project History",
54
		   "showstats.php3?showby=project&pid=$pid");
55 56
WRITESUBMENUBUTTON("Free Node Summary",
		   "nodecontrol_list.php3?showtype=summary&bypid=$pid");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
57 58 59 60
if ($isadmin) {
    WRITESUBMENUDIVIDER();
    WRITESUBMENUBUTTON("Delete this project",
		       "deleteproject.php3?pid=$pid");
61 62
    WRITESUBMENUBUTTON("Resend Approval Message",
		       "resendapproval.php?pid=$pid");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
63
}
64
SUBMENUEND();
65

66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
# Gather up the html sections.
ob_start();
$project->Show();
$profile_html = ob_get_contents();
ob_end_clean();

ob_start();
$group->ShowMembers();
$members_html = ob_get_contents();
ob_end_clean();

ob_start();
$project->ShowGroupList();
$groups_html = ob_get_contents();
ob_end_clean();

# Project wide Templates.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
83
$templates_html = null;
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
if ($EXPOSETEMPLATES) {
    $templates_html = SHOWTEMPLATELIST("PROJ", 0, $uid, $pid, "", TRUE);
}

ob_start();
ShowExperimentList("PROJ", $this_user, $project);
$experiments_html = ob_get_contents();
ob_end_clean();

$stats_html = null;
if ($isadmin) {
    ob_start();
    $project->ShowStats();
    $stats_html = ob_get_contents();
    ob_end_clean();
}

Kevin Atkinson's avatar
 
Kevin Atkinson committed
101
$papers_html = null;
Kevin Atkinson's avatar
 
Kevin Atkinson committed
102
if ($PUBSUPPORT) {
Kevin Atkinson's avatar
 
Kevin Atkinson committed
103 104 105
    #
    # List papers for this project if any
    #
Kevin Atkinson's avatar
 
Kevin Atkinson committed
106
    $query_result = GetPubs("`project` = \"$pid\"");
Kevin Atkinson's avatar
 
Kevin Atkinson committed
107 108 109 110 111
    if (mysql_num_rows($query_result)) {
	$papers_html = MakeBibList($this_user, $isadmin, $query_result);
    }
}

112 113 114
#
# Show number of PCS
#
115
$numpcs = $project->PCsInUse();
116 117 118 119

if ($numpcs) {
    echo "<center><font color=Red size=+2>\n";
    echo "Project $pid is using $numpcs PCs!\n";
120
    echo "</font></center><br>\n";
121 122
}

123
#
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
# Function to change what is being shown.
#
echo "<script type='text/javascript' language='javascript'>
        var li_current = 'li_profile';
        var div_current = 'div_profile';
        function Show(which) {
	    li = getObjbyName(li_current);
            li.style.backgroundColor = '#DDE';
            li.style.borderBottom = '1px solid #778';
            div = getObjbyName(div_current);
            div.style.display = 'none';

            li_current = 'li_' + which;
	    li = getObjbyName(li_current);
            li.style.backgroundColor = 'white';
            li.style.borderBottom = '1px solid white';
            div_current = 'div_' + which;
            div = getObjbyName(div_current);
            div.style.display = 'block';

            return false;
        }
        function Setup(which) {
            li_current = 'li_' + which;
            div_current = 'div_' + which;
	    li = getObjbyName(li_current);
            li.style.backgroundColor = 'white';
            li.style.borderBottom = '1px solid white';
            div = getObjbyName(div_current);
            div.style.display = 'block';
        }
      </script>\n";

#
# This is the topbar
#
echo "<div width=\"100%\" align=center>\n";
echo "<ul id=\"topnavbar\">\n";
if ($templates_html) {
    echo "<li>
           <a href=\"#A\" class=topnavbar onfocus=\"this.hideFocus=true;\" ".
               "id=\"li_templates\" onclick=\"Show('templates');\">".
               "Templates</a></li>\n";
}
if ($experiments_html) {
     echo "<li>
            <a href=\"#B\" class=topnavbar onfocus=\"this.hideFocus=true;\" ".
               "id=\"li_experiments\" onclick=\"Show('experiments');\">".
               "Experiments</a></li>\n";
}
if ($groups_html) {
    echo "<li>
          <a href=\"#C\" class=topnavbar onfocus=\"this.hideFocus=true;\" ".
	      "id=\"li_groups\" onclick=\"Show('groups');\">".
              "Groups</a></li>\n";
}
if ($members_html) {
    echo "<li>
          <a href=\"#D\" class=topnavbar onfocus=\"this.hideFocus=true;\" ".
	      "id=\"li_members\" onclick=\"Show('members');\">".
              "Members</a></li>\n";
}
echo "<li>
      <a href=\"#E\" class=topnavbar onfocus=\"this.hideFocus=true;\" ".
           "id=\"li_profile\" onclick=\"Show('profile');\">".
           "Profile</a></li>\n";

if ($isadmin && $stats_html) {
    echo "<li>
          <a href=\"#F\" class=topnavbar onfocus=\"this.hideFocus=true;\" ".
	      "id=\"li_stats\" onclick=\"Show('stats');\">".
              "Project Stats</a></li>\n";
}
Kevin Atkinson's avatar
 
Kevin Atkinson committed
197 198 199 200 201 202
if ($papers_html) {
    echo "<li>
          <a href=\"#G\" class=topnavbar onfocus=\"this.hideFocus=true;\" ".
	      "id=\"li_papers\" onclick=\"Show('papers');\">".
              "Publications</a></li>\n";
}
203 204 205
echo "</ul>\n";
echo "</div>\n";
echo "<div align=center id=topnavbarbottom>&nbsp</div>\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
206

207 208
if ($templates_html) {
     echo "<div class=invisible id=\"div_templates\">$templates_html</div>";
209
}
210 211 212 213 214 215 216 217 218 219 220 221 222
if ($experiments_html) {
     echo "<div class=invisible id=\"div_experiments\">$experiments_html</div>";
}
if ($groups_html) {
     echo "<div class=invisible id=\"div_groups\">$groups_html</div>";
}
if ($members_html) {
     echo "<div class=invisible id=\"div_members\">$members_html</div>";
}
echo "<div class=invisible id=\"div_profile\">$profile_html</div>";
if ($isadmin && $stats_html) {
    echo "<div class=invisible id=\"div_stats\">$stats_html</div>";
}
Kevin Atkinson's avatar
 
Kevin Atkinson committed
223 224 225
if ($papers_html) {
     echo "<div class=invisible id=\"div_papers\">$papers_html</div>";
}
226
SUBPAGEEND();
227

228
#
229
# Get the active tab to look right.
230
#
231 232 233
echo "<script type='text/javascript' language='javascript'>
      Setup(\"profile\");
      </script>\n";
234

235 236 237 238
#
# Standard Testbed Footer
# 
PAGEFOOTER();
239
?>