Added nextrun control
This commit is contained in:
parent
a14da30879
commit
54ddda70cd
|
@ -62,6 +62,8 @@ elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||
$url = $_POST['url'];
|
||||
$name = $_POST['name'];
|
||||
$delay = $_POST['delay'];
|
||||
$nextrunObj = new DateTime($_POST['nextrun']);
|
||||
$nextrun = $nextrunObj->getTimestamp();
|
||||
|
||||
if(filter_var($url, FILTER_VALIDATE_URL) === FALSE) {
|
||||
header("location:addjob.php?error=invalidurl");
|
||||
|
@ -72,10 +74,14 @@ elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||
header("location:addjob.php?error=invaliddelay");
|
||||
exit;
|
||||
}
|
||||
if(!is_numeric($nextrun)) {
|
||||
header("location:addjob.php?error=invalidnextrun");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$stmt = $db->prepare("INSERT INTO jobs(user, name, url, delay, nextrun) VALUES(?, ?, ?, ?, ?)");
|
||||
$stmt->execute(array($_SESSION["userID"], $name, $url, $delay, time()+$delay));
|
||||
$stmt->execute(array($_SESSION["userID"], $name, $url, $delay, $nextrun));
|
||||
|
||||
header("location:addjob.php?message=added");
|
||||
exit;
|
||||
|
|
|
@ -26,5 +26,6 @@
|
|||
$(document).ready(function() {
|
||||
$("body").on("click", "#patternDropdown li", function() {
|
||||
if(this.value != "custom") { $("input#delay").val($(this).data("val")); }
|
||||
});
|
||||
});
|
||||
$('#nextrunselector').datetimepicker();
|
||||
});
|
||||
|
|
|
@ -42,6 +42,15 @@
|
|||
<input type="number" class="form-control" id="delay" name="delay">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nextrun">Next run</label>
|
||||
<div class="input-group date" id="nextrunselector">
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-calendar"></span>
|
||||
</span>
|
||||
<input type="text" class="form-control" name="nextrun">
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default">Submit</button>
|
||||
</form>
|
||||
|
||||
|
|
|
@ -5,10 +5,13 @@
|
|||
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.css">
|
||||
<link rel="stylesheet" href="/css/site.css">
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.js" type="text/javascript"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
|
||||
<script src="/js/site.js" type="text/javascript"></script>
|
||||
</head>
|
||||
|
||||
|
|
Loading…
Reference in New Issue