Commit 5e2966f7 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Add a modal to warn they user they have created too many experiments

as a guest and that they have to apply for a real account.
parent c3f52c91
...@@ -5,11 +5,12 @@ require(window.APT_OPTIONS.configObject, ...@@ -5,11 +5,12 @@ require(window.APT_OPTIONS.configObject,
'js/lib/text!template/signup-personal.html', 'js/lib/text!template/signup-personal.html',
'js/lib/text!template/signup-project.html', 'js/lib/text!template/signup-project.html',
'js/lib/text!template/signup.html', 'js/lib/text!template/signup.html',
'js/lib/text!template/toomany-modal.html',
// jQuery modules // jQuery modules
'formhelpers'], 'formhelpers'],
function (_, sup, function (_, sup,
aboutString, verifyString, personalString, aboutString, verifyString, personalString,
projectString, signupString) projectString, signupString, toomanyString)
{ {
'use strict'; 'use strict';
...@@ -24,6 +25,7 @@ function (_, sup, ...@@ -24,6 +25,7 @@ function (_, sup,
{ {
window.APT_OPTIONS.initialize(sup); window.APT_OPTIONS.initialize(sup);
ISCLOUD = window.ISCLOUD; ISCLOUD = window.ISCLOUD;
$('#toomany_div').html(toomanyString);
var fields = JSON.parse(_.unescape($('#form-json')[0].textContent)); var fields = JSON.parse(_.unescape($('#form-json')[0].textContent));
var errors = JSON.parse(_.unescape($('#error-json')[0].textContent)); var errors = JSON.parse(_.unescape($('#error-json')[0].textContent));
...@@ -48,6 +50,9 @@ function (_, sup, ...@@ -48,6 +50,9 @@ function (_, sup,
$('#signup_panel_title').text("Start Project"); $('#signup_panel_title').text("Start Project");
} }
}); });
if (window.APT_OPTIONS.toomany) {
sup.ShowModal('#toomany_modal');
}
} }
function renderForm(formfields, errors, joinproject, showVerify, thisUser) function renderForm(formfields, errors, joinproject, showVerify, thisUser)
......
<?php <?php
# #
# Copyright (c) 2000-2014 University of Utah and the Flux Group. # Copyright (c) 2000-2015 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -47,6 +47,7 @@ $optargs = OptionalPageArguments("create", PAGEARG_STRING, ...@@ -47,6 +47,7 @@ $optargs = OptionalPageArguments("create", PAGEARG_STRING,
"verify", PAGEARG_STRING, "verify", PAGEARG_STRING,
"finished", PAGEARG_BOOLEAN, "finished", PAGEARG_BOOLEAN,
"joinproject", PAGEARG_BOOLEAN, "joinproject", PAGEARG_BOOLEAN,
"toomany", PAGEARG_BOOLEAN,
"formfields", PAGEARG_ARRAY); "formfields", PAGEARG_ARRAY);
# #
...@@ -55,7 +56,7 @@ $optargs = OptionalPageArguments("create", PAGEARG_STRING, ...@@ -55,7 +56,7 @@ $optargs = OptionalPageArguments("create", PAGEARG_STRING,
function SPITFORM($formfields, $showverify, $errors) function SPITFORM($formfields, $showverify, $errors)
{ {
global $TBDB_UIDLEN, $TBDB_PIDLEN, $TBDOCBASE, $WWWHOST; global $TBDB_UIDLEN, $TBDB_PIDLEN, $TBDOCBASE, $WWWHOST;
global $ACCOUNTWARNING, $EMAILWARNING, $this_user, $joinproject; global $ACCOUNTWARNING, $EMAILWARNING, $this_user, $joinproject, $toomany;
$button_label = "Create Account"; $button_label = "Create Account";
echo "<link rel='stylesheet' echo "<link rel='stylesheet'
...@@ -64,6 +65,7 @@ function SPITFORM($formfields, $showverify, $errors) ...@@ -64,6 +65,7 @@ function SPITFORM($formfields, $showverify, $errors)
SPITHEADER(1); SPITHEADER(1);
echo "<div id='signup-body'></div>\n"; echo "<div id='signup-body'></div>\n";
echo "<div id='toomany_div'></div>\n";
echo "<script type='text/plain' id='form-json'>\n"; echo "<script type='text/plain' id='form-json'>\n";
echo htmlentities(json_encode($formfields)) . "\n"; echo htmlentities(json_encode($formfields)) . "\n";
echo "</script>\n"; echo "</script>\n";
...@@ -87,6 +89,12 @@ function SPITFORM($formfields, $showverify, $errors) ...@@ -87,6 +89,12 @@ function SPITFORM($formfields, $showverify, $errors)
else { else {
echo "window.APT_OPTIONS.this_user = false;\n"; echo "window.APT_OPTIONS.this_user = false;\n";
} }
if ($toomany) {
echo "window.APT_OPTIONS.toomany = true;\n";
}
else {
echo "window.APT_OPTIONS.toomany = false;\n";
}
echo "</script>\n"; echo "</script>\n";
......
<div id='toomany_modal' class='modal fade'>
<div class='modal-dialog'>
<div class='modal-content'>
<div class='modal-header'>
You have exceeded the number of experiments you can create as a
guest user!
</div>
<div class='modal-body'>
<p>Benefits of registering for an account include being able
to design your own experiments, have more then one active
experiment at a time, or extend the life of an experiment longer.
</p><br>
<button class='btn btn-primary align-center'
data-dismiss='modal'
type='button name='register'>Close</button>
</div>
</div>
</div>
</div>
Supports Markdown
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