showproject.php3 6.45 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_once("template_defs.php");
9 10
if ($PAPERSUPPORT)
  include_once("paper_defs.php");
11 12 13 14 15 16 17 18 19

#
# 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).
#

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

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

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

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

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

67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
# 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 Stoller's avatar
Leigh Stoller committed
84
$templates_html = null;
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
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();
}

102 103 104 105 106 107 108 109 110 111 112
$papers_html = null;
if ($PAPERSUPPORT) {
    #
    # List papers for this project if any
    #
    $query_result = GetPapers("`project` = \"$pid\"");
    if (mysql_num_rows($query_result)) {
	$papers_html = MakeBibList($this_user, $isadmin, $query_result);
    }
}

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

if ($numpcs) {
    echo "<center><font color=Red size=+2>\n";
    echo "Project $pid is using $numpcs PCs!\n";
121
    echo "</font></center><br>\n";
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 197
# 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";
}
198 199 200 201 202 203
if ($papers_html) {
    echo "<li>
          <a href=\"#G\" class=topnavbar onfocus=\"this.hideFocus=true;\" ".
	      "id=\"li_papers\" onclick=\"Show('papers');\">".
              "Publications</a></li>\n";
}
204 205 206
echo "</ul>\n";
echo "</div>\n";
echo "<div align=center id=topnavbarbottom>&nbsp</div>\n";
Leigh Stoller's avatar
Leigh Stoller committed
207

208 209
if ($templates_html) {
     echo "<div class=invisible id=\"div_templates\">$templates_html</div>";
210
}
211 212 213 214 215 216 217 218 219 220 221 222 223
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>";
}
224 225 226
if ($papers_html) {
     echo "<div class=invisible id=\"div_papers\">$papers_html</div>";
}
227
SUBPAGEEND();
228

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

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