Commit d1c6b50e authored by Keith Downie's avatar Keith Downie

Made max duration of 16 hours less hardcoded

parent ae626b77
......@@ -27,6 +27,9 @@ chdir("apt");
include_once("profile_defs.php");
include_once("instance_defs.php");
# Need to make non-hardcoded
$maxduration = 16;
#
# Return info about specific profile.
#
......@@ -570,7 +573,7 @@ function CheckStep2()
global $ajax_args;
global $ISAPT, $ISPNET, $ISCLOUD, $ISEMULAB;
global $TB_PROJECT_CREATEEXPT;
$durationlimit = 16;
global $maxduration;
if (!isset($ajax_args["formfields"])) {
SPITAJAX_ERROR(-1, "Missing formfields");
......@@ -688,11 +691,8 @@ function CheckStep2()
if (!isset($formfields["duration"]) || $formfields["duration"] == "") {
$errors["duration"] = "Must set an experiment duration";
}
elseif (!ctype_digit($formfields["duration"]) ) {
$errors["duration"] = "Must be an integer between 1 and ".$durationlimit;
}
elseif (((int)$formfields["duration"]) <= 0 || ((int)$formfields["duration"]) > $durationlimit) {
$errors["duration"] = "Must be an integer between 1 and ".$durationlimit;
elseif (!ctype_digit($formfields["duration"]) || (((int)$formfields["duration"]) <= 0 || ((int)$formfields["duration"]) > $maxduration)) {
$errors["duration"] = "Must be an integer between 1 and ".$maxduration;
}
}
if (count($errors)) {
......
......@@ -81,6 +81,9 @@ if ($ISAPT && !$this_user) {
}
}
# Need to make non-hardcoded
$maxduration = 16;
$skipfirststep = 0;
if (isset($from) && ($from == "manage-profile" || $from == "show-profile")) {
$skipfirststep = 1;
......@@ -317,7 +320,7 @@ function SPITFORM($formfields, $newuser, $errors)
{
global $TBBASE, $APTMAIL, $ISAPT, $ISCLOUD, $ISPNET, $PORTAL_NAME;
global $profile_array, $this_user, $profilename, $profile;
global $projlist, $skipfirststep, $TBMAINSITE;
global $projlist, $skipfirststep, $maxduration, $TBMAINSITE;
global $refspec;
$showabout = ($ISAPT && !$this_user ? 1 : 0);
......@@ -391,6 +394,7 @@ function SPITFORM($formfields, $newuser, $errors)
echo " window.WEBONLY = $webonly;\n";
echo " window.PORTAL = '$portal';\n";
echo " window.SHOWPICKER = $showpicker;\n";
echo " window.MAXDURATION = $maxduration;\n";
echo " window.CANCOPY = $cancopy;\n";
$isadmin = (isset($this_user) && ISADMIN() ? 1 : 0);
echo " window.ISADMIN = $isadmin;\n";
......
......@@ -129,6 +129,7 @@ $(function ()
cancopy: window.CANCOPY,
clustername: window.PORTAL_NAME,
admin: isadmin,
maxduration: window.MAXDURATION,
});
$('#main-body').html(html);
if (projlist)
......
......@@ -374,13 +374,13 @@
data-delay='{hide:1500, show:500}'
data-html='true'
data-content="Sets the intial amount of time that the
experiment will run. Limit: 16 hours. If more time is needed, the duration can be extended after the
experiment will run. Limit: <%- maxduration %> hours. If more time is needed, the duration can be extended after the
experiment has been created.">
<input id='experiment_duration'
class='form-control'
data-key='duration'
name='duration'
value='16'>
value='<%- maxduration %>'>
<label style='position: absolute;
top: 6px;
right: 22px;
......
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