Commit 0f386380 authored by Leigh Stoller's avatar Leigh Stoller

First cut at the Emulab Portal. Recalling a historical commit message, many

things were changed.
parent bff243ed
.navbar img {
margin: 5 auto;
height: 65px;
}
.navbar-static-top, .navbar-inner {
background-color: #66b2ff;
}
#footer, #footer a, #footer a:hover {
background-color: #66b2ff;
color: black;
}
#footer a, #footer a:hover {
color: black;
}
.btn-quickvm-home, .btn-quickvm-home:hover {
background-color: #e8eeef
}
.btn-success {
background-color: #289328;
border-color: #237f23;
}
.btn-primary {
background-color: #2f8ead;
border-color: #2a7e99;
}
.btn-info {
background-color: #2f64ad;
border-color: #2a5899;
}
.btn-warning {
background-color: #8a7626;
border-color: #766520;
}
.btn-danger {
background-color: #9c2a2a;
border-color: #882525;
}
This diff is collapsed.
......@@ -23,16 +23,6 @@
#
#
if ($ISAPT) {
$DEFAULT_AGGREGATE = "Utah APT";
}
elseif ($ISCLOUD) {
$DEFAULT_AGGREGATE = "Utah Cloudlab";
}
elseif ($ISPNET) {
$DEFAULT_AGGREGATE = "Emulab";
}
$urn_mapping =
array("urn:publicid:IDN+utah.cloudlab.us+authority+cm" => "Utah",
"urn:publicid:IDN+wisc.cloudlab.us+authority+cm" => "Wisc",
......@@ -359,7 +349,7 @@ class Instance
# Return aggregate based on the current user.
#
function DefaultAggregateList() {
global $ISAPT, $ISCLOUD, $ISPNET;
global $ISAPT, $ISCLOUD, $ISPNET, $ISEMULAB;
if ($ISAPT) {
$am_array = array(
'Cloudlab Utah' =>
......@@ -394,7 +384,7 @@ class Instance
"urn:publicid:IDN+uky.emulab.net+authority+cm";
}
}
elseif ($ISPNET) {
elseif ($ISPNET || $ISEMULAB) {
$am_array = array(
'Emulab' =>
"urn:publicid:IDN+emulab.net+authority+cm"
......
......@@ -115,75 +115,8 @@ function Do_GetParameters()
#
function Do_Instantiate()
{
global $this_user, $DEFAULT_AGGREGATE, $ISCLOUD;
global $ajax_args;
$am_array = Instance::DefaultAggregateList();
if (!isset($ajax_args["uuid"])) {
SPITAJAX_ERROR(1, "Missing profile uuid");
return;
}
$profile = Profile::Lookup($ajax_args["uuid"]);
if (!$profile) {
SPITAJAX_ERROR(1, "Unknown profile uuid");
return;
}
if (!isset($this_user)) {
if (!$profile->ispublic()) {
SPITAJAX_ERROR(1, "Not enough permission to instantiate profile");
return;
}
}
elseif (! ($profile->CanInstantiate($this_user) || ISADMIN())) {
SPITAJAX_ERROR(1, "Not enough permission to instantiate profile");
return;
}
$args = array();
$args["username"] = $this_user->uid();
$args["email"] = $this_user->email();
$args["profile"] = $profile->uuid();
# Guest users not allowed to provide rspec
if (isset($this_user) &&
array_key_exists("rspec", $ajax_args)) {
$args["rspec"] = $ajax_args["rspec"];
}
$opts = "";
# Guest users not allowed to choose aggregate.
if (isset($this_user) && ($ISCLOUD || ISADMIN() || STUDLY()) &&
isset($ajax_args["where"])) {
if (array_key_exists($ajax_args["where"], $am_array)) {
$opts = "-a " . $am_array[$ajax_args["where"]];
}
else {
SPITAJAX_ERROR(1, "Invalid Aggregate");
return;
}
}
else {
# Temporary until constraint system in place.
$best = $profile->BestAggregate();
if (!$best) {
$best = $DEFAULT_AGGREGATE;
}
$opts = "-a " . $am_array[$best];
}
#
# Invoke the backend.
#
$errors = array();
list ($instance, $creator) =
Instance::Instantiate($this_user, $opts, $args, $errors);
if (!isset($instance) || is_null($instance)) {
SPITAJAX_ERROR(1, $errors["error"]);
return;
}
#
# Redirect user to status page.
#
$uuid = $instance->uuid();
SPITAJAX_RESPONSE("status.php?uuid=$uuid");
SPITAJAX_ERROR(1, "This interface is deprecated");
return;
}
#
......@@ -611,7 +544,7 @@ function CheckStep2()
{
global $this_user;
global $ajax_args;
global $ISAPT, $ISPNET, $ISCLOUD;
global $ISAPT, $ISPNET, $ISCLOUD, $ISEMULAB;
if (!isset($ajax_args["formfields"])) {
SPITAJAX_ERROR(-1, "Missing formfields");
......@@ -659,7 +592,7 @@ function CheckStep2()
}
}
}
elseif ($ISAPT || $ISPNET) {
elseif ($ISAPT || $ISPNET || $ISEMULAB) {
# No choice
;
}
......@@ -714,7 +647,7 @@ function Do_Submit()
{
global $this_user;
global $ajax_args;
global $TBAUTHDOMAIN, $ISAPT, $ISPNET;
global $TBAUTHDOMAIN, $ISAPT, $ISPNET, $DEFAULT_AGGREGATE_URN;
if (!isset($ajax_args["formfields"])) {
SPITAJAX_ERROR(1, "Missing formfields");
......@@ -758,12 +691,9 @@ function Do_Submit()
$sitemap = array();
if ($this_user) {
if ($ISAPT) {
$aggregate_urn = "urn:publicid:IDN+apt.emulab.net+authority+cm";
if ($ISAPT || $ISPNET) {
$aggregate_urn = $DEFAULT_AGGREGATE_URN;
}
elseif ($ISPNET) {
$aggregate_urn = "urn:publicid:IDN+emulab.net+authority+cm";
}
elseif (isset($formfields["sites"]) && is_array($formfields["sites"])) {
while (list($siteid, $am) = each($formfields["sites"])) {
if (array_key_exists($am, $am_array)) {
......
......@@ -44,7 +44,7 @@ $this_user = CheckLogin($check_status);
if (isset($this_user)) {
CheckLoginOrDie(CHECKLOGIN_NONLOCAL|CHECKLOGIN_WEBONLY);
}
elseif ($ISCLOUD || $ISPNET) {
elseif (!$ISAPT) {
RedirectLoginPage();
}
......@@ -300,7 +300,7 @@ $profile_array = $tmp_array;
function SPITFORM($formfields, $newuser, $errors)
{
global $TBBASE, $APTMAIL, $ISAPT, $ISCLOUD, $ISPNET;
global $TBBASE, $APTMAIL, $ISAPT, $ISCLOUD, $ISPNET, $PORTAL_NAME;
global $profile_array, $this_user, $profilename, $profile, $am_array;
global $projlist;
$amlist = array();
......@@ -312,7 +312,6 @@ function SPITFORM($formfields, $newuser, $errors)
$this_user->webonly() ? "true" : "false");
$cancopy = (isset($this_user) && !$this_user->webonly() ? 1 : 0);
$nopprspec = (!isset($this_user) ? "true" : "false");
$cluster = ($ISCLOUD ? "Cloudlab" : ($ISPNET ? "PhantomNet" : "APT"));
$portal = "";
$showpicker = (isset($profile) ? 0 : 1);
if (isset($profilename)) {
......@@ -399,6 +398,7 @@ function SPITFORM($formfields, $newuser, $errors)
$doconstraints = (isset($this_user) &&
(ISADMINISTRATOR() || STUDLY()) ? 1 : 0);
echo " window.DOCONSTRAINTS = 1;\n";
echo " window.PORTAL_NAME = '$PORTAL_NAME';\n";
echo "</script>\n";
echo "<script src='js/lib/jquery-2.0.3.min.js?nocache=asdfasdf'></script>\n";
echo "<script src='js/lib/bootstrap.js?nocache=asdfasdf'></script>\n";
......
......@@ -41,7 +41,7 @@ function (_, editModalString, editInlineString)
var contextFetched = false;
var contextUrl = "";
if (window.ISCLOUD)
if (window.ISCLOUD || window.ISEMULAB)
{
contextUrl = 'https://www.emulab.net/protogeni/jacks-context/cloudlab-utah.json';
}
......
......@@ -56,8 +56,6 @@ function (_, sup, moment, mainString, helpString)
embedded: window.EMBEDDED,
editing: editing,
isadmin: isadmin,
sitename: (window.ISCLOUD ? "CloudLab" :
(window.ISPNET ? "PhantomNet" : "APT")),
});
html = formatter(html, errors).html();
$('#main-body').html(html);
......
......@@ -83,8 +83,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt,
profilevers: window.PROFILEVERS,
showpicker: showpicker,
cancopy: window.CANCOPY,
clustername: (window.ISCLOUD ? "CloudLab" :
(window.ISPNET ? "PhantomNet" : "APT")),
clustername: window.PORTAL_NAME,
});
$('#main-body').html(html);
......
......@@ -111,8 +111,7 @@ function (_, sup, filesize, JacksEditor, ShowImagingModal, moment, ppstart,
copyuuid: (window.COPYUUID || null),
snapuuid: (window.SNAPUUID || null),
general_error: (errors.error || ''),
iscloud: window.ISCLOUD,
ispnet: window.ISPNET,
isapt: window.ISAPT,
disabled: window.DISABLED,
versions: versions,
withpublishing: window.WITHPUBLISHING,
......
......@@ -19,14 +19,10 @@ function (_, sup,
var personalTemplate = _.template(personalString);
var projectTemplate = _.template(projectString);
var signupTemplate = _.template(signupString);
var ISCLOUD = 0;
var ISPNET = 0;
function initialize()
{
window.APT_OPTIONS.initialize(sup);
ISCLOUD = window.ISCLOUD;
ISPNET = window.ISPNET;
$('#toomany_div').html(toomanyString);
var fields = JSON.parse(_.unescape($('#form-json')[0].textContent));
......@@ -79,7 +75,7 @@ function (_, sup,
var signup = signupTemplate({
button_label: buttonLabel,
general_error: (errors.error || ''),
about_account: (ISCLOUD || ISPNET || thisUser ? null : about),
about_account: (window.ISAPT || !thisUser ? about : null),
this_user: thisUser,
promoting: promoting,
joinproject: joinproject,
......
......@@ -60,11 +60,7 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
lockdown = window.APT_OPTIONS.lockdown;
lockdown_code= uuid.substr(2, 5);
var instanceStatus = window.APT_OPTIONS.instanceStatus;
var errorURL = (window.ISCLOUD ?
"https://groups.google.com/d/forum/cloudlab-users" :
(window.ISPNET ?
"https://groups.google.com/d/forum/phantomnet-users" :
"https://groups.google.com/d/forum/apt-users"));
var errorURL = window.HELPFORUM;
// Generate the templates.
var template_args = {
......
......@@ -33,7 +33,7 @@ include_once("instance_defs.php");
#
RedirectSecure();
$this_user = CheckLogin($check_status);
if ($ISCLOUD || $ISPNET) {
if (!$ISAPT) {
if (! ($CHECKLOGIN_STATUS & CHECKLOGIN_LOGGEDIN)) {
header("Location: login.php");
return;
......
......@@ -87,13 +87,10 @@ if (NOLOGINS()) {
#
function SPITFORM($uid, $referrer, $error)
{
global $PORTAL_PASSWORD_HELP;
global $TBDB_UIDLEN, $TBBASE, $refer;
global $ISAPT, $ISCLOUD, $ISPNET, $showguestlogin;
$pwlab = ($ISAPT ? "Aptlab.net" :
($ISCLOUD ? "CloudLab.us" :
($ISPNET ? "PhantomNet.org" : ""))) .
" or Emulab.net Username";
global $ISAPT, $ISCLOUD, $showguestlogin;
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, max-age=0, must-revalidate, no-store");
......@@ -146,7 +143,7 @@ function SPITFORM($uid, $referrer, $error)
<label for='uid' class='col-sm-2 control-label'>Username</label>
<div class='col-sm-10'>
<input name='uid' class='form-control'
placeholder='<?php echo $pwlab ?>'
placeholder='<?php echo $PORTAL_PASSWORD_HELP ?>'
autofocus type='text'>
</div>
</div>
......
......@@ -59,7 +59,7 @@ function SPITFORM($formfields, $errors)
{
global $this_user, $projlist, $action, $profile, $DEFAULT_AGGREGATE;
global $notifyupdate, $notifyclone, $copyuuid, $snapuuid, $am_array;
global $ISCLOUD, $ISPNET;
global $ISCLOUD;
global $version_array, $WITHPUBLISHING;
$viewing = 0;
$candelete = 0;
......@@ -195,16 +195,6 @@ function SPITFORM($formfields, $errors)
echo " window.BUTTONLABEL = '$button_label';\n";
echo " window.ISPPPROFILE = $ispp;\n";
echo " window.WITHPUBLISHING = $WITHPUBLISHING;\n";
if ($ISCLOUD) {
echo " window.ISCLOUD = true;\n";
} else {
echo " window.ISCLOUD = false;\n";
}
if ($ISPNET) {
echo " window.ISPNET = true;";
} else {
echo " window.ISPNET = false;";
}
if (isset($copyuuid)) {
echo " window.COPYUUID = '$copyuuid';\n";
}
......
<?php
#
# Copyright (c) 2006-2015 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/>.
#
# }}}
#
#
$APTHOST = "$WWWHOST";
# Not sure why tbauth uses WWWHOST for the login cookies, but it
# causes confusion in geni-login.ajax.
$COOKDIEDOMAIN = "$WWWHOST";
$APTBASE = "$TBBASE/apt";
$APTMAIL = $TBMAIL_OPS;
$EXTENSIONS = $TBMAIL_OPS;
$APTTITLE = "Emulab";
$FAVICON = "../favicon.ico";
$APTLOGO = "emulab-logo.svg";
$APTSTYLE = "emulab.css";
$ISEMULAB = 1;
$ISAPT = 0;
$ISCLOUD = 0;
$ISPNET = 0;
$ISVSERVER = 0;
$GOOGLEUA = 'UA-45161989-1';
# See tbauth.php3
$CHANGEPSWD_PAGE= "changepswd.php";
$MAXGUESTINSTANCES = 10;
$WITHPUBLISHING = 0;
#
# Other Portal globals.
#
$PORTAL_MANUAL = "https://wiki.emulab.net/wikidocs/wiki";
$PORTAL_MOTD_SITEVAR = "web/banner";
$PORTAL_HELPFORUM = "emulab-users";
$PORTAL_PASSWORD_HELP = "Emulab Username or Email";
$PORTAL_NSFNUMBER = "CNS-58502134";
$PORTAL_GENESIS = "emulab";
$DEFAULT_AGGREGATE = "Emulab";
$DEFAULT_AGGREGATE_URN = "urn:publicid:IDN+emulab.net+authority+cm";
$PORTAL_NAME = "Emulab";
#
# The Utah MotherShip defines alternate portals.
#
if ($TBMAINSITE) {
include_once("portal_mainsite.php");
}
?>
<?php
#
# Copyright (c) 2006-2015 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/>.
#
# }}}
#
#
#
# So, we could be coming in on the alternate APT address (virtual server)
# which causes cookie problems. I need to look into avoiding this problem
# but for now, just change the global value of the TBAUTHDOMAIN when we do.
# The downside is that users will have to log in twice if they switch back
# and forth.
#
if ($_SERVER["SERVER_NAME"] == "www.aptlab.net") {
$ISVSERVER = 1;
$ISAPT = 1;
$TBAUTHDOMAIN = ".aptlab.net";
$COOKDIEDOMAIN= ".aptlab.net";
$APTHOST = "www.aptlab.net";
$WWWHOST = "www.aptlab.net";
$APTBASE = "https://www.aptlab.net";
$APTMAIL = "APT Operations <portal-ops@aptlab.net>";
$GOOGLEUA = 'UA-42844769-3';
$TBMAILTAG = "aptlab.net";
$EXTENSIONS = "portal-extensions@aptlab.net";
$TBAUTHTIMEOUT= (24 * 3600 * 7);
# For devel trees
if (preg_match("/\/([\w\/]+)$/", $WWW, $matches)) {
$APTBASE .= "/" . $matches[1];
}
$PORTAL_MANUAL = "http://docs.aptlab.net";
$PORTAL_MOTD_SITEVAR = "aptlab/message";
$PORTAL_HELPFORUM = "apt-users";
$PORTAL_PASSWORD_HELP= "Aptlab.net or Emulab.net Username";
$PORTAL_NSFNUMBER = "CNS-1338155";
$DEFAULT_AGGREGATE = "Utah APT";
$PORTAL_GENESIS = "aptlab";
$PORTAL_NAME = "APT";
}
elseif ($_SERVER["SERVER_NAME"] == "www.cloudlab.us") {
$ISVSERVER = 1;
$TBAUTHDOMAIN = ".cloudlab.us";
$COOKDIEDOMAIN= "www.cloudlab.us";
$APTHOST = "www.cloudlab.us";
$WWWHOST = "www.cloudlab.us";
$APTBASE = "https://www.cloudlab.us";
$APTMAIL = "CloudLab Operations <portal-ops@cloudlab.us>";
$APTTITLE = "CloudLab";
$FAVICON = "cloudlab.ico";
$APTLOGO = "cloudlogo.png";
$APTSTYLE = "cloudlab.css";
$ISCLOUD = 1;
$GOOGLEUA = 'UA-42844769-2';
$TBMAILTAG = "cloudlab.us";
$EXTENSIONS = "portal-extensions@cloudlab.us";
$TBAUTHTIMEOUT= (24 * 3600 * 14);
# For devel trees
if (preg_match("/\/([\w\/]+)$/", $WWW, $matches)) {
$APTBASE .= "/" . $matches[1];
}
$PORTAL_MANUAL = "http://docs.cloudlab.us";
$PORTAL_MOTD_SITEVAR = "aptlab/message";
$PORTAL_HELPFORUM = "cloudlab-users";
$PORTAL_PASSWORD_HELP= "CloudLab.us or Emulab.net Username";
$PORTAL_NSFNUMBER = "CNS-1302688";
$DEFAULT_AGGREGATE = "Utah Cloudlab";
$PORTAL_GENESIS = "cloudlab";
$PORTAL_NAME = "CloudLab";
}
elseif ($ISALTDOMAIN && $_SERVER["SERVER_NAME"] == "www.phantomnet.org") {
$ISVSERVER = 1;
$TBAUTHDOMAIN = ".phantomnet.org";
$COOKDIEDOMAIN= "www.phantomnet.org";
$APTHOST = "www.phantomnet.org";
$WWWHOST = "www.phantomnet.org";
$APTBASE = "https://www.phantomnet.org";
$APTMAIL = "PhantomNet Operations <portal-ops@phantomnet.org>";
$APTTITLE = "PhantomNet";
$FAVICON = "phantomnet.ico";
$APTLOGO = "phantomlogo.png";
$APTSTYLE = "phantomnet.css";
$ISPNET = 1;
#$GOOGLEUA = 'UA-42844769-2';
$TBMAILTAG = "phantomnet.org";
$EXTENSIONS = "portal-extensions@phantomnet.org";
$TBAUTHTIMEOUT= (24 * 3600 * 14);
# For devel trees
if (preg_match("/\/([\w\/]+)$/", $WWW, $matches)) {
$APTBASE .= "/" . $matches[1];
}
$PORTAL_MANUAL = "http://wiki.phantomnet.org";
$PORTAL_MOTD_SITEVAR = "phantomnet/message";
$PORTAL_HELPFORUM = "phantomnet-users";
$PORTAL_PASSWORD_HELP = "PhantomNet.org or Emulab.net Username";
$PORTAL_NSFNUMBER = "CNS-1305384";
$DEFAULT_AGGREGATE = "Emulab";
$DEFAULT_AGGREGATE_URN = "urn:publicid:IDN+apt.emulab.net+authority+cm";
$PORTAL_GENESIS = "phantomnet";
$PORTAL_NAME = "PhantomNet";
}
?>
......@@ -238,11 +238,11 @@ class Profile
# URL. To the specific version of the profile.
#
function URL() {
global $APTBASE, $ISVSERVER, $ISCLOUD, $ISPNET;
global $APTBASE, $ISVSERVER, $ISAPT;
$uuid = $this->uuid();
if ($this->ispublic() || (($ISCLOUD || $ISPNET) && $this->shared())) {
if ($this->ispublic() || (!$ISAPT && $this->shared())) {
$pid = $this->pid();
$name = $this->name();
$vers = $this->version();
......@@ -259,11 +259,11 @@ class Profile
}
# And the URL of the profile itself.
function ProfileURL() {
global $APTBASE, $ISVSERVER, $ISCLOUD, $ISPNET;
global $APTBASE, $ISVSERVER, $ISAPT;
$uuid = $this->profile_uuid();
if ($this->ispublic() || (($ISCLOUD || $ISPNET) && $this->shared())) {
if ($this->ispublic() || (!$ISAPT && $this->shared())) {
$pid = $this->pid();
$name = $this->name();
if ($ISVSERVER)
......
This diff is collapsed.
......@@ -419,9 +419,7 @@ if (!$this_user) {
# Force initial SSL cert generation.
$args["passphrase"] = $formfields["password1"];
# Flag to the backend.
$args["genesis"] = ($ISAPT ? "aptlab" :
($ISPNET ? "phantomnet" :
"cloudlab"));
$args["genesis"] = $PORTAL_GENESIS;
#
# Backend verifies pubkey and returns error. We first look for a
......@@ -517,9 +515,9 @@ $args["linkedtous"] = 1;
$args["plab"] = 0;
$args["ron"] = 0;
$args["funders"] = "None";
$args["whynotpublic"] = ($ISAPT ? "aptlab" : ($ISPNET ? "phantomnet" : "cloudlab"));
$args["whynotpublic"] = $PORTAL_GENESIS;
# Flag to the backend.
$args["genesis"] = ($ISAPT ? "aptlab" : ($ISPNET ? "phantomnet" : "cloudlab"));
$args["genesis"] = $PORTAL_GENESIS;
if (! ($project = Project::NewNewProject($args, $error))) {
$errors["error"] = $error;
......
......@@ -324,10 +324,10 @@
<% if (formfields.profile_who == "public") {
%>checked<% } %>
value='public'>
<% if (iscloud || ispnet) { %>
<em>Anyone</em>
<% } else { %>
<% if (isapt) { %>
<em>Anyone</em> on the internet
<% } else { %>
<em>Anyone</em>
<% } %>
</label>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment