Files
test/admin.html
2025-12-09 00:20:32 +00:00

222 lines
5.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Add Camera</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">
<link rel="stylesheet" href="//d2d3qesrx8xj6s.cloudfront.net/dist/bootsnipp.min.css?ver=872ccd9c6dce18ce6ea4d5106540f089">
<style type="text/css">
html, body {
height: 100%;
}
#caminfo {
height: 100%;
}
table {
border-collapse: collapse;
}
table,th,td {
border: 1px solid black;
padding-horizontal: 15px;
}
</style>
</head>
<body>
<div id="caminfo">
<form class="form-horizontal" id="newcam">
<fieldset>
<!-- Form Name -->
<center><legend>Add Camera</legend>
<span class="help-block">This is not a NOAA/NWS system, do not enter any PII gained as a result of your NWS position</span>
<span class="help-block">If you are unsure of what to enter, just email the details to Peck</span></center>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="url">URL</label>
<div class="col-md-4">
<input id="url" name="url" type="text" placeholder="" onchange="isValidUrl(this.value)" class="form-control input-md" required="">
<span class="help-block">Include leading http:// https:// rtsp://</span>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="interval">Interval for download (min)</label>
<div class="col-md-4">
<input id="interval" name="interval" type="text" value="10" class="form-control input-md">
<span class="help-block">No quicker than 2 minutes, 10 suggested if you do not have explicit permission</span>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="lat">Latitude</label>
<div class="col-md-4">
<input id="lat" name="lat" type="text" placeholder="" class="form-control input-md" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="lon">Longitude</label>
<div class="col-md-4">
<input id="lon" name="lon" type="text" placeholder="" class="form-control input-md" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="description">Description</label>
<div class="col-md-4">
<input id="description" name="description" type="text" placeholder="" class="form-control input-md" required="">
<span class="help-block">Short description of the location</span>
<span class="help-block">--------All fields above this line are mandatory--------</span>
<span class="help-block">Default and/or blank values below this are probably fine</span>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="method">Download Method</label>
<div class="col-md-4">
<select id="method" name="method" class="form-control">
<option value="normal">Static image</option>
<option value="rtsp">RTSP/HTTP/HLS (link playlist.m3u8 for HLS) stream</option>
<option value="castr">Castr.io stream (link playlist.m3u8)</option>
<option value="youtube">Youtube (link url in this format: https://www.youtube.com/@wxstoat/live)</option>
<option value="normalproxy">Static image (US based proxy for sites that block my Canadian IP)</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="permission">Permission</label>
<div class="col-md-4">
<div class="radio">
<label for="permission-1">
<input type="radio" name="permission" id="permission-1" value="t">
Yes
</label>
</div>
<div class="radio">
<label for="permission-2">
<input type="radio" name="permission" id="permission-2" value="n" checked="checked">
No
</label>
<span class="help-block">Permission to redistribute image, if you don't know, leave it no</span>
</div>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="credit">Cam Owner</label>
<div class="col-md-4">
<input id="credit" name="credit" type="text" placeholder="" class="form-control input-md">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="email">E-mail for owner</label>
<div class="col-md-4">
<input id="email" name="email" type="text" placeholder="" class="form-control input-md">
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="save"></label>
<div class="col-md-4">
<button id="save" name="save" class="btn btn-primary">Save</button>
</div>
</div>
</fieldset>
</form>
</div>
<script>
function isValidUrl(string) {
$.ajax({
url: 'main.php?service=admin&action=checkurl',
type: 'POST',
dataType: "json",
data: {url:string},
success: function(data) {
console.log(data);
if (data[0].exists == 't') {
document.getElementById('url').style.borderColor = "red";
alert("This camera url already exists in the database, if you don't see it displayed, ask Peck to make sure it's active")
} else {
document.getElementById('url').style.borderColor = "green";
}
}
});
}
$('#newcam').submit(function(e){
e.preventDefault();
$.ajax({
url: 'main.php?service=admin&action=newcam',
type: 'post',
data:$('#newcam').serialize(),
success:function(data){
if (data == '1') {
alert('cam added');
document.getElementById("newcam").reset();
} else {
alert(data);
}
}
});
});
</script>
</body>
</html>