Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
76ff6e3e
Commit
76ff6e3e
authored
Sep 11, 2001
by
Leigh B. Stoller
Browse files
Changes to project listings as per Jay request in email.
parent
5ec3257a
Changes
2
Hide whitespace changes
Inline
Side-by-side
www/projectlist.php3
View file @
76ff6e3e
...
...
@@ -5,64 +5,92 @@ include("defs.php3");
# Standard Testbed Header
#
# Change when do check for number of experiments.
# PAGEHEADER("Projects that have actively used emulab.net");
PAGEHEADER
(
"Projects that have used emulab.net"
);
PAGEHEADER
(
"Projects that have actively used emulab.net"
);
#
# We let anyone access this page. It
'
s basically a pretty-printed version
of the
# current testbed clients, who have not opted out from this display.
# 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.
#
# Complete information is better viewed with the "Project Information" link.
# That requires a logged in user though.
#
#
# Get the project list.
# Helper
#
function
GENPLIST
(
$query_result
)
{
echo
"<tr>
<td><h4>Name</td>
<td><h4>Institution</td>
</tr>
\n
"
;
echo
"<tr></tr>
\n
"
;
echo
"<tr></tr>
\n
"
;
while
(
$projectrow
=
mysql_fetch_array
(
$query_result
))
{
$pname
=
$projectrow
[
name
];
$url
=
$projectrow
[
URL
];
$affil
=
$projectrow
[
usr_affil
];
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.
#
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT pid,name,URL,usr_affil FROM projects "
.
"left join users on projects.head_uid=users.uid "
.
"where public=1 and approved=1 order by
pid
"
);
"where public=1 and approved=1
and expt_count>0
order by
name
"
);
if
(
!
$query_result
)
{
$err
=
mysql_error
();
TBERROR
(
"Database Error getting project list:
$err
\n
"
,
1
);
}
# Not likely to happen!
if
(
mysql_num_rows
(
$query_result
)
==
0
)
{
USERERROR
(
"There are no projects!"
,
1
);
TBERROR
(
"Database Error getting active project list:
$err
\n
"
,
1
);
}
echo
"<table width=
\"
100%
\"
border=0 cellpadding=2 cellspacing=2
align='center'>
\n
"
;
echo
"<tr>
<td><h4>Name</td>
<td><h4>Institution</td>
</tr>
\n
"
;
echo
"<tr></tr>
\n
"
;
echo
"<tr></tr>
\n
"
;
align='center'>
\n
"
;
while
(
$projectrow
=
mysql_fetch_array
(
$query_result
))
{
$pname
=
$projectrow
[
name
];
$url
=
$projectrow
[
URL
];
$affil
=
$projectrow
[
usr_affil
];
echo
"<tr>
\n
"
;
if
(
!
$url
||
strcmp
(
$url
,
""
)
==
0
)
{
echo
"<td>
$pname
</td>
\n
"
;
}
else
{
echo
"<td><A href=
\"
$url
\"
>
$pname
</A></td>
\n
"
;
}
if
(
mysql_num_rows
(
$query_result
))
{
GENPLIST
(
$query_result
);
}
echo
"<td>
$affil
</td>
\n
"
;
#
# Get the "inactive" project list.
#
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT pid,name,URL,usr_affil FROM projects "
.
"left join users on projects.head_uid=users.uid "
.
"where public=1 and approved=1 and expt_count=0 order by name"
);
echo
"</tr>
\n
"
;
if
(
!
$query_result
)
{
$err
=
mysql_error
();
TBERROR
(
"Database Error getting inactive project list:
$err
\n
"
,
1
);
}
if
(
mysql_num_rows
(
$query_result
))
{
echo
"<tr></tr>
\n
"
;
echo
"<tr></tr>
\n
"
;
echo
"<tr><td colspan=2 align=center>
<h4>Other projects registered on Emulab.Net</h4>
</td>
</tr>
\n
"
;
GENPLIST
(
$query_result
);
}
echo
"</table>
\n
"
;
#
...
...
www/showproject_list.php3
View file @
76ff6e3e
...
...
@@ -25,11 +25,11 @@ $isadmin = ISADMIN($uid);
#
if
(
$isadmin
)
{
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT
pid,head_uid,name,approved
FROM projects order by pid"
);
"SELECT
*
FROM projects order by pid"
);
}
else
{
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT * FROM projects where head_uid='
$uid
' order by
pid
"
);
"SELECT * FROM projects where head_uid='
$uid
' order by
name
"
);
}
if
(
!
$query_result
)
{
$err
=
mysql_error
();
...
...
@@ -45,15 +45,52 @@ if (mysql_num_rows($query_result) == 0) {
}
}
echo
"<table width=
\"
100%
\"
border=2 cellpadding=0 cellspacing=2
align='center'>
\n
"
;
if
(
$isadmin
)
{
#
# Process the query results for active projects so I can generate a
# summary block (as per Jays request).
#
$total_projects
=
mysql_num_rows
(
$query_result
);
$active_projects
=
0
;
while
(
$projectrow
=
mysql_fetch_array
(
$query_result
))
{
$expt_count
=
$projectrow
[
expt_count
];
if
(
$expt_count
>
0
)
{
$active_projects
++
;
}
}
mysql_data_seek
(
$query_result
,
0
);
$never_active
=
$total_projects
-
$active_projects
;
echo
"<table border=0 align=center cellpadding=0 cellspacing=3>
<tr>
<td align=right><b>Been Active:</b></td>
<td align=left>
$active_projects
</td>
</tr>
<tr>
<td align=right><b>Never Active:</b></td>
<td align=left>
$never_active
</td>
</tr>
<tr>
<td align=right><b>Total:</b></td>
<td align=left>
$total_projects
</td>
</tr>
</table>
\n
"
;
}
echo
"<tr>
<td>Project Info</td>
#
# Now the project list.
#
echo
"<table width=
\"
100%
\"
border=2 cellpadding=2 cellspacing=0 align=center>
<tr>
<td>PID</td>
<td>Name</td>
<td>Leader</td>
<td>Expts</td>
<td>Nodes</td>
<td align=center>Days<br>Idle</td>
<td align=center>Expts<br>Created</td>
<td align=center>Expts<br>Running</td>
<td align=center>Nodes</td>
<td align=center>Approved?</td>
\n
"
;
#
...
...
@@ -65,28 +102,43 @@ if ($isadmin) {
echo
"</tr>
\n
"
;
while
(
$projectrow
=
mysql_fetch_array
(
$query_result
))
{
$pid
=
$projectrow
[
pid
];
$headuid
=
$projectrow
[
head_uid
];
$Pname
=
$projectrow
[
name
];
$approved
=
$projectrow
[
approved
];
$pid
=
$projectrow
[
pid
];
$headuid
=
$projectrow
[
head_uid
];
$Pname
=
$projectrow
[
name
];
$approved
=
$projectrow
[
approved
];
$expt_count
=
$projectrow
[
expt_count
];
$expt_last
=
$projectrow
[
expt_last
];
echo
"<tr>
<td><A href='showproject.php3?pid=
$pid
'>
$pid
</A></td>
<td>
$Pname
</td>
<td><A href='showuser.php3?target_uid=
$headuid
'>
$headuid
</A></td>
\n
"
;
if
(
$isadmin
)
{
$count1
=
mysql_db_query
(
$TBDBNAME
,
"SELECT count(*) FROM experiments where pid='
$pid
'"
);
$row1
=
mysql_fetch_array
(
$count1
);
$count2
=
mysql_db_query
(
$TBDBNAME
,
"SELECT count(*) FROM reserved where pid='
$pid
'"
);
$row2
=
mysql_fetch_array
(
$count2
);
if
(
$row1
[
0
]
>
0
)
{
echo
"<td>
$row1[0]</td><td>$row2[0]
</td>
\n
"
;
}
else
{
echo
"<td> </td><td> </td>
\n
"
;
}
#
# Sleazy! Use mysql query to convert dates to days and subtract!
#
if
(
isset
(
$expt_last
))
{
$idle_query
=
mysql_db_query
(
$TBDBNAME
,
"SELECT TO_DAYS(CURDATE()) - TO_DAYS(
\"
$expt_last
\"
)"
);
$idle_row
=
mysql_fetch_row
(
$idle_query
);
echo
"<td>
$idle_row[0]
</td>
\n
"
;
}
else
{
echo
"<td>--</td>
\n
"
;
}
echo
"<td>
$expt_count
</td>
\n
"
;
$count1
=
mysql_db_query
(
$TBDBNAME
,
"SELECT count(*) FROM experiments where pid='
$pid
'"
);
$row1
=
mysql_fetch_array
(
$count1
);
$count2
=
mysql_db_query
(
$TBDBNAME
,
"SELECT count(*) FROM reserved where pid='
$pid
'"
);
$row2
=
mysql_fetch_array
(
$count2
);
echo
"<td>
$row1[0]</td><td>$row2[0]
</td>
\n
"
;
if
(
$approved
)
{
echo
"<td align=center><img alt=
\"
Y
\"
src=
\"
greenball.gif
\"
></td>
\n
"
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment