projectlist.php3 2.67 KB
Newer Older
1
<?php
Leigh B. Stoller's avatar
Leigh B. Stoller committed
2
#
3
# Copyright (c) 2000-2002, 2007 University of Utah and the Flux Group.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
Leigh B. Stoller's avatar
Leigh B. Stoller committed
23
#
24 25 26 27 28
include("defs.php3");

#
# Standard Testbed Header
#
Jay Lepreau's avatar
Jay Lepreau committed
29
# Change when do check for number of experiments.
30
PAGEHEADER("Projects that have actively used ".strtolower($THISHOMEBASE));
31 32

#
33 34
# We let anyone access this page.  Its basically a pretty-printed version
# of the current testbed clients, who have not opted out from this display.
35 36 37 38 39 40
#
# Complete information is better viewed with the "Project Information" link.
# That requires a logged in user though. 
#

#
41 42 43 44 45
# Helper
#
function GENPLIST ($query_result)
{
    echo "<tr>
Chad Barb's avatar
Chad Barb committed
46 47
             <th>Name</th>
             <th>Institution</th>
48 49 50
          </tr>\n";

    while ($projectrow = mysql_fetch_array($query_result)) {
51 52 53
	$pname  = $projectrow["name"];
	$url    = $projectrow["URL"];
	$affil  = $projectrow["usr_affil"];
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

	echo "<tr>\n";

	if (!$url || strcmp($url, "") == 0) {
	    echo "<td>$pname</td>\n";
	}
	else {
	    echo "<td><A href=\"$url\">$pname</A></td>\n";
	}

	echo "<td>$affil</td>\n";

	echo "</tr>\n";

    }
}

#
# Get the "active" project list.
73
#
74 75
$query_result =
    DBQueryFatal("SELECT pid,name,URL,usr_affil FROM projects ".
76
		 "left join users on projects.head_idx=users.uid_idx ".
77 78
		 "where public=1 and approved=1 and expt_count>0 ".
		 "order by name");
79

80
echo "<table width=\"100%\" border=0 cellpadding=2 cellspacing=2
81
             align='center'>\n";
82

83 84 85
if (mysql_num_rows($query_result)) {
    GENPLIST($query_result);
}
86

87 88 89
#
# Get the "inactive" project list.
#
90 91
$query_result =
    DBQueryFatal("SELECT pid,name,URL,usr_affil FROM projects ".
92
		 "left join users on projects.head_idx=users.uid_idx ".
93 94
		 "where public=1 and approved=1 and expt_count=0 ".
		 "order by name");
95

96
if (mysql_num_rows($query_result)) {
Chad Barb's avatar
Chad Barb committed
97 98 99
    echo "<tr><th colspan=2>
              Other projects registered on Emulab.Net:</h4>
              </th>
100 101
          </tr>\n";
    GENPLIST($query_result);
102
}
103

104 105 106 107 108 109 110
echo "</table>\n";

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