Commit 75c8443a authored by Kirk Webb's avatar Kirk Webb
Browse files

Merge branch 'pnet-www'

parents 1a4cf6a7 aa333e81
<?php
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
#
# {{{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/>.
#
# }}}
#
# Alternate domain def structures. The first element of the outermost
# array is the regex pattern to match against $_SERVER['SERVER_NAME'].
# The second element is another array that contains key-value pairs
# for various top-level variable overrides. See SetDomainDefs() in
# defs.php3 for more info.
#
# PhantomNet view declaration
#
$PNET_DOMVIEW = array('hide_sidebar' => 0, 'hide_banner' => 0,
'hide_copyright' => 0, 'show_pnet' => 1,
'css-override' => 1, 'hide_elab' => 1);
$ALTERNATE_DOMAINS[] =
array('/phantom/',
array('THISHOMEBASE' => 'PhantomNet',
'WIKINODE' => 'wiki.phantomnet.org',
'FORUMURL' => 'http://groups.google.com/group/phantomnet-users',
'DOMVIEW' => $PNET_DOMVIEW
));
?>
\ No newline at end of file
......@@ -65,6 +65,7 @@ $MAILMANURL = "http://${USERNODE}/mailman";
$OPSCVSURL = "http://${USERNODE}/cvsweb/cvsweb.cgi";
$OPSJETIURL = "http://${USERNODE}/jabber/jeti.php";
$WIKIDOCURL = "http://${WIKINODE}/wikidocs/wiki";
$FORUMURL = "http://groups.google.com/group/emulab-users";
$MIN_UNIX_UID = @MIN_UNIX_UID@;
$MIN_UNIX_GID = @MIN_UNIX_GID@;
$EXPOSELINKTEST = 1;
......@@ -73,6 +74,7 @@ $EXPOSEARCHIVE = 0;
$EXPOSETEMPLATES= 0;
$USERSELECTUIDS = 1;
$REMOTEWIKIDOCS = @REMOTEWIKIDOCS@;
$FLAVOR = "Emulab";
$GMAP_API_KEY = "@GMAP_API_KEY@";
$NONAMEDSETUP = @DISABLE_NAMED_SETUP@;
$OPS_VM = @OPSVM_ENABLE@;
......@@ -176,6 +178,22 @@ $RSS_HEADER_PGENINEWS =
"<link rel=\"alternate\" type=\"application/rss+xml\" " .
"title=\"ProtoGeni News\" href=\"$TBDOCBASE/news-rss.php3?protogeni=1\"/>";
$RSS_HEADER_PNNEWS =
"<link rel=\"alternate\" type=\"application/rss+xml\" " .
"title=\"PhantomNet News\" href=\"$TBDOCBASE/news-rss.php3?phantomnet=1\"/>";
#
# See if we should override any of the global web variables based on the
# virtual domain. We include a site-dependent definitions file.
#
$ALTERNATE_DOMAINS = array();
$DOMVIEW = NULL;
$altdomfile = strtolower("alternate_domains_${OURDOMAIN}.php");
if (file_exists($altdomfile)) {
include($altdomfile);
}
SetDomainDefs();
#
# Database constants and the like.
#
......@@ -609,6 +627,97 @@ function YesNo($bool) {
return ($bool ? "Yes" : "No");
}
#
# See if someone is logged in, and if they need to be redirected.
#
function CheckRedirect() {
global $stayhome;
if (($this_user = CheckLogin($check_status))) {
$check_status = $check_status & CHECKLOGIN_STATUSMASK;
if ($check_status == CHECKLOGIN_MAYBEVALID) {
# Maybe the reason was because they where not using HTTPS ...
RedirectHTTPS();
}
if (($firstinitstate = TBGetFirstInitState())) {
unset($stayhome);
}
if (!isset($stayhome)) {
if ($check_status == CHECKLOGIN_LOGGEDIN) {
if ($firstinitstate == "createproject") {
# Zap to NewProject Page,
header("Location: $TBBASE/newproject.php3");
}
else {
# Zap to My Emulab page.
header("Location: $TBBASE/".
CreateURL("showuser", $this_user));
}
exit;
}
}
}
}
#
# Loop over the $ALTERNATE_DOMAINS global array and see if the incoming
# request asked for a virtual domain for which we have an alternate set
# of definitions and/or view.
#
# Return 1 if a domain in the array matched, 0 otherwise. Has MAJOR
# side effects: updates/overrides many top-level variables.
#
function SetDomainDefs()
{
global $WWWHOST, $OURDOMAIN, $WWW, $THISHOMEBASE, $TBAUTHDOMAIN, $TBBASE;
global $TBDOCBASE, $TBWWW, $WIKINODE, $WIKIDOCURL, $TBMAINSITE, $FORUMURL;
global $ALTERNATE_DOMAINS, $FLAVOR, $DOMVIEW;
foreach ($ALTERNATE_DOMAINS as $altdom) {
list($dpat, $ovr) = $altdom;
if (preg_match($dpat, $_SERVER['SERVER_NAME']) == 1) {
# Replacement defs derived from the virtual domain itself.
$WWWHOST = $_SERVER['SERVER_NAME'];
$OURDOMAIN = implode(".", array_slice(explode(".",$WWWHOST),1));
$WWW = $WWWHOST;
$TBAUTHDOMAIN = ".$OURDOMAIN";
$TBBASE = "https://$WWWHOST";
$TBDOCBASE = "http://$WWWHOST";
$TBWWW = "<$TBBASE/>";
# Defs that may be overriden in the domain's configuration array
if (isset($ovr['THISHOMEBASE'])) {
$THISHOMEBASE = $ovr['THISHOMEBASE'];
$FLAVOR = $THISHOMEBASE;
}
if (isset($ovr['WIKINODE'])) {
$WIKINODE = $ovr['WIKINODE'];
} else {
$WIKINODE = "wiki.$OURDOMAIN";
}
if (isset($ovr['WIKIDOCURL'])) {
$WIKIDOCURL = $ovr['WIKIDOCURL'];
} else {
$WIKIDOCURL = "http://${WIKINODE}/wikidocs/wiki";
}
if (isset($ovr['FORUMURL'])) {
$FORUMURL = $ovr['FORUMURL'];
}
if (isset($ovr['DOMVIEW'])) {
$DOMVIEW = $ovr['DOMVIEW'];
}
# Given that this is an alternate domain, clear TBMAINSITE
$TBMAINSITE = 0;
# Bail after the first domain match.
return 1;
}
}
return 0;
}
#
# If the page was accessed via http redirect to https and exit
# otherwise do nothing
......
......@@ -29,9 +29,13 @@ include("defs.php3");
PAGEHEADER("Contact Us");
echo "
To ask questions about using Emulab or to report bugs, please
join the <a href='http://groups.google.com/group/emulab-users'>
Help Forum</a>.
To ask questions about using $FLAVOR or to report bugs, please
join the <a href='$FORUMURL'>
Help Forum</a>.";
$view = GETDOMVIEW();
if (!VIEWSET($view, 'hide_elab')) {
echo "
<br>
<br>
If you are interested in creating your own Emulab, please take a look
......@@ -41,6 +45,7 @@ echo "
For additional information on creating your own Emulab, send email
to $TBMAILADDR
\n";
}
#
# Standard Testbed Footer
......
<!--
Copyright (c) 2014 University of Utah and the Flux Group.
{{{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/>.
}}}
-->
<img class="centerimage" src="epc-diagram.png" width="600" height="390" />
<p>
<em>PhantomNet</em> is a mobility testbed, providing researchers with
a set of hardware and software resources that they can use to
develop, debug, and evaluate their mobility designs.
Resources available in <em>PhantomNet</em> include EPC/EPS software
(OpenEPC), hardware access points (ip.access enodeb), PC nodes with
mobile radios (HUAWEI cellular modems), and a large set of commodity
bare metal nodes, virtual nodes and other resouces inherited from
the main Emulab site.
In addition to raw resources, <em>PhantomNet</em> provides configuration
directives and scripts to assist researchers in setting up their
mobility experiments.
Users specify their experiment via Emulab NS file templates augmented with
PhantomNet-specific functionality.
In complement to these template NS files,
PhantomNet does the work of configuring the EPC software components
to operate within the underlying <em>Emulab</em> environment.
</p>
<p>
Some helpful links:<br>
<ul>
<li><a href="http://wiki.phantomnet.org">PhantomNet Wiki</a></li>
<li><a href="http://wiki.phantomnet.org/oepc-tutorial">OpenEPC Tutorial (registration/approval required)</a></li>
</ul>
</p>
<p>
The PhantomNet facility is built on top of
<a href="http://www.emulab.net">Emulab</a> and is run by the
<a href="http://www.flux.utah.edu">Flux Group</a>, part of the
<a href="http://www.cs.utah.edu">School of Computing</a> at the
<a href="http://www.utah.edu">University of Utah</a>.
</p>
......@@ -304,21 +304,9 @@ function WRITEPLABBOTTOMBAR() {
}
#
# WRITESIDEBAR(): Write the menu. The actual menu options the user
# sees depends on the login status and the DB status.
#
function WRITESIDEBAR() {
global $login_status, $login_user, $pid, $gid;
global $TBBASE, $TBDOCBASE, $BASEPATH, $WIKISUPPORT, $MAILMANSUPPORT;
global $BUGDBSUPPORT, $BUGDBURL, $CVSSUPPORT, $CHATSUPPORT, $TRACSUPPORT;
global $PROTOGENI;
global $CHECKLOGIN_WIKINAME, $TBMAINSITE;
global $THISHOMEBASE;
global $EXPOSETEMPLATES;
global $currentusage, $FANCYBANNER, $ELABINELAB, $PLABSUPPORT;
global $WIKIDOCURL;
$firstinitstate = TBGetFirstInitState();
function GETNEWSINFO() {
global $TBBASE, $TBDOCBASE;
global $login_user;
#
# get post time of most recent news;
......@@ -350,6 +338,14 @@ function WRITESIDEBAR() {
}
}
return array($newsBase, $newsDate, $newNews);
}
function WRITEMIDTOPBAR($newsBase, $newNews) {
global $TBBASE, $FLAVOR;
global $login_user, $login_status;
if ($login_user) {
echo "<td>\n";
echo "<div class='midtopcell'>\n";
......@@ -362,7 +358,7 @@ function WRITESIDEBAR() {
if ($login_status & (CHECKLOGIN_LOGGEDIN|CHECKLOGIN_MAYBEVALID)) {
echo "<a class=midtopcell ".
"href='$TBBASE/" . CreateURL("showuser", $login_user) . "'>".
"My Emulab</a>\n";
"My $FLAVOR</a>\n";
echo " <font color=grey>|</font> ";
......@@ -427,72 +423,27 @@ function WRITESIDEBAR() {
echo "<tr id=spacer><td id=spacer></td></tr>";
echo "<tr><td>";
}
NavMenuStart();
NavMenuSection("information", "Information");
NavMenuButton("Home", "$TBDOCBASE/index.php3?stayhome=1");
if (0 == strcasecmp($THISHOMEBASE, "emulab.net")) {
$rootEmulab = 1;
} else {
$rootEmulab = 0;
}
if ($rootEmulab) {
NavMenuButton("Other Emulabs",
"$WIKIDOCURL/OtherEmulabs");
} else {
NavMenuButton("Utah Emulab", "http://www.emulab.net/");
}
if ($newNews) {
NavMenuButtonNew("News $newsDate", "$newsBase/news.php3");
} else {
NavMenuButton("News $newsDate", "$newsBase/news.php3");
}
NavMenuButton("Documentation", "$WIKIDOCURL");
NavMenuButtonNew("Forums", "http://groups.google.com/group/emulab-users");
if ($rootEmulab) {
# Leave New here about 2 weeks
NavMenuButton("Papers and Talks (Jul 18)", "$TBDOCBASE/pubs.php3");
NavMenuButton("Emulab Software (Sep 1)", "$TBDOCBASE/software.php3");
NavMenuButton("List People",
"$TBDOCBASE/people.php3");
NavMenuButton("Photo Gallery",
"$TBDOCBASE/gallery/gallery.php3");
NavMenuButton("Emulab Users",
"$TBDOCBASE/doc/docwrapper.php3?docname=users.html");
NavMenuButton("Emulab Sponsors",
"$TBDOCBASE/docwrapper.php3?docname=sponsors.html");
}
else {
NavMenuButton("Projects on Emulab", "$TBDOCBASE/projectlist.php3");
}
if ($TBMAINSITE) {
NavMenuButton("<font color=red>In Memoriam</font>",
"$TBDOCBASE/jay.php");
}
}
# The search box. Placed in a table so the text input fills available
# space.
if (! $login_user) {
NavMenuSectionEnd();
echo "<div id='searchrow'>
function PUTSEARCHBOX($newsBase) {
echo "<div id='searchrow'>
<form method='get' action='$newsBase/search.php3'>
<table border='0' cellspacing='0' cellpadding='0'><tr>
<td width='100%'><input class='textInputEmpty' name='query'
value='Search Documentation' id='searchbox'
onfocus='focus_text(this, \"Search Documentation\")'
onblur='blur_text(this, \"Search Documentation\")' />
</td>
</td>
<td><input type='submit' id='searchsub' value=Go /></td>
</table>
</form>
</div>\n";
}
}
function WRITELOGINBOX($loginbox_content) {
global $TBBASE, $TBDOCBASE, $BASEPATH;
global $login_status;
#
# Cons up a nice message.
#
......@@ -528,19 +479,9 @@ function WRITESIDEBAR() {
echo "<strong>$login_message</strong>";
}
if (!$firstinitstate) {
echo "<a href=\"$TBBASE/reqaccount.php3\">";
echo "<img alt=\"Request Account\" border=0 ";
echo "src=\"$BASEPATH/requestaccount.gif\" width=\"144\" height=\"32\"></a>";
echo "<strong>or</strong>";
}
echo "<a href=\"$TBBASE/login.php3\">";
echo "<img alt=\"logon\" border=0 ";
echo "src=\"$BASEPATH/logon.gif\" width=\"144\" height=\"32\"></a>\n";
echo $loginbox_content;
echo "</div>";
#
# Login message. Set via 'web/message' site variable
#
......@@ -565,6 +506,12 @@ function WRITESIDEBAR() {
WRITESIDEBARNOTICE($message);
}
}
}
function WRITEEXPERIMENTMENU($firstinitstate) {
global $TBBASE, $TBDOCBASE;
global $WIKISUPPORT, $CHECKLOGIN_WIKINAME, $EXPOSETEMPLATES, $FLAVOR;
global $login_status, $login_user;
# Start Interaction section if going to spit out interaction options.
if ($login_status & (CHECKLOGIN_LOGGEDIN|CHECKLOGIN_MAYBEVALID)) {
......@@ -602,7 +549,7 @@ function WRITESIDEBAR() {
CreateURL("moduserinfo", $login_user));
}
else {
NavMenuButton("My Emulab",
NavMenuButton("My $FLAVOR",
"$TBBASE/" . CreateURL("showuser", $login_user));
#
......@@ -659,6 +606,206 @@ function WRITESIDEBAR() {
"$TBBASE/joinproject.php3");
}
}
}
function WRITEADMINMENU() {
global $TBBASE, $TBDOCBASE;
global $PROTOGENI;
global $login_status;
# Optional ADMIN menu.
if ($login_status & CHECKLOGIN_LOGGEDIN && ISADMIN()) {
NavMenuSection("administration", "Administration");
NavMenuButton("List Projects",
"$TBBASE/showproject_list.php3");
NavMenuButton("List Users",
"$TBBASE/showuser_list.php3");
NavMenuButton("View Testbed Stats",
"$TBBASE/showstats.php3");
NavMenuButton("Resource Usage Visualization",
"$TBBASE/rusage_viz.php");
NavMenuButton("Approve New Projects",
"$TBBASE/approveproject_list.php3");
NavMenuButton("Edit Site Variables",
"$TBBASE/editsitevars.php3");
if ($TBMAINSITE) {
NavMenuButton("Emulab Site List",
"$TBBASE/showsite_list.php");
}
NavMenuButton("Show Shared Node Pool",
"$TBBASE/showpool.php");
$query_result = DBQUeryFatal("select new_node_id from new_nodes");
if (mysql_num_rows($query_result) > 0) {
NavMenuButtonNew("Add Testbed Nodes",
"$TBBASE/newnodes_list.php3");
}
else {
NavMenuButtonNew("Add Testbed Nodes",
"$TBBASE/newnodes_list.php3");
}
if ($PROTOGENI) {
NavMenuButton("ProtoGeni Slices",
"$TBBASE/genislices.php");
NavMenuButton("ProtoGeni History",
"$TBBASE/genihistory.php");
}
}
}
#
# WRITESIDEBARPNET(): Write the "sidebar" menu for PhantomNet.
#
function WRITEPNETSIDEBAR() {
global $login_status, $login_user;
global $TBBASE, $TBDOCBASE, $BASEPATH;
global $TBMAINSITE, $THISHOMEBASE;
global $WIKIDOCURL, $FORUMURL;
list($newsBase, $newsDate, $newNews) = GETNEWSINFO();
WRITEMIDTOPBAR($newsBase, $newNews);
NavMenuStart();
NavMenuSection("information", "Information");
NavMenuButton("Home", "$TBDOCBASE/pnet-index.php?stayhome=1");
if ($newNews) {
NavMenuButtonNew("News $newsDate", "$newsBase/news.php3");
} else {
NavMenuButton("News $newsDate", "$newsBase/news.php3");
}
NavMenuButton("Documentation", "$WIKIDOCURL");
NavMenuButtonNew("Forums", "$FORUMURL");
# The search box. Placed in a table so the text input fills available
# space.
if (! $login_user) {
NavMenuSectionEnd();
PUTSEARCHBOX($newsBase);
}
$lbox_content =
"<a href=\"$TBBASE/reqpnetaccount.php\">".
"<img alt=\"Request Account\" border=0 ".
"src=\"$BASEPATH/pnet-rqaccount.png\" width=\"144\" height=\"32\"></a>".
"<strong>or</strong>".
"<a href=\"$TBBASE/login.php3\">".
"<img alt=\"logon\" border=0 ".
"src=\"$BASEPATH/pnet-login.png\" width=\"144\" height=\"32\"></a>\n";
WRITELOGINBOX($lbox_content);
WRITEEXPERIMENTMENU(0);
WRITEADMINMENU();
# Terminate Interaction menu and render.
NavMenuRender();
if ($login_user) {
echo "</td></tr></table>\n";
# Close up div at start of navmenu
echo "</div>\n";
echo "</td>\n";
}
}
#
# WRITESIDEBAR(): Write the menu. The actual menu options the user
# sees depends on the login status and the DB status.
#
function WRITESIDEBAR() {
global $login_status, $login_user, $pid, $gid;
global $TBBASE, $TBDOCBASE, $BASEPATH, $WIKISUPPORT, $MAILMANSUPPORT;
global $BUGDBSUPPORT, $BUGDBURL, $CVSSUPPORT, $CHATSUPPORT, $TRACSUPPORT;
global $CHECKLOGIN_WIKINAME, $TBMAINSITE;
global $THISHOMEBASE;
global $currentusage, $FANCYBANNER, $ELABINELAB, $PLABSUPPORT;
global $WIKIDOCURL, $FORUMURL;
$firstinitstate = TBGetFirstInitState();
list($newsBase, $newsDate, $newNews) = GETNEWSINFO();
WRITEMIDTOPBAR($newsBase, $newNews);
NavMenuStart();
NavMenuSection("information", "Information");
NavMenuButton("Home", "$TBDOCBASE/index.php3?stayhome=1");
if (0 == strcasecmp($THISHOMEBASE, "emulab.net")) {
$rootEmulab = 1;
} else {
$rootEmulab = 0;
}
if ($rootEmulab) {
NavMenuButton("Other Emulabs",
"$WIKIDOCURL/OtherEmulabs");
} else {
NavMenuButton("Utah Emulab", "http://www.emulab.net/");
}
if ($newNews) {
NavMenuButtonNew("News $newsDate", "$newsBase/news.php3");
} else {
NavMenuButton("News $newsDate", "$newsBase/news.php3");
}
NavMenuButton("Documentation", "$WIKIDOCURL");
NavMenuButtonNew("Forums", "$FORUMURL");
if ($rootEmulab) {
# Leave New here about 2 weeks
NavMenuButton("Papers and Talks (Jul 18)", "$TBDOCBASE/pubs.php3");
NavMenuButton("Emulab Software (Sep 1)", "$TBDOCBASE/software.php3");
NavMenuButton("List People",
"$TBDOCBASE/people.php3");
NavMenuButton("Photo Gallery",
"$TBDOCBASE/gallery/gallery.php3");
NavMenuButton("Emulab Users",
"$TBDOCBASE/doc/docwrapper.php3?docname=users.html");
NavMenuButton("Emulab Sponsors",
"$TBDOCBASE/docwrapper.php3?docname=sponsors.html");
}
else {
NavMenuButton("Projects on Emulab", "$TBDOCBASE/projectlist.php3");
}
if ($TBMAINSITE) {
NavMenuButton("<font color=red>In Memoriam</font>",
"$TBDOCBASE/jay.php");
}
# The search box. Placed in a table so the text input fills available
# space.
if (! $login_user) {
NavMenuSectionEnd();