Fix frontend and input handling

This commit is contained in:
Kumi 2018-10-21 09:16:27 +02:00
parent 8a66588541
commit 8af0a78c74
2 changed files with 9 additions and 8 deletions

View file

@ -40,33 +40,34 @@ def static(req):
def addjob(req): def addjob(req):
jobid = str(uuid.uuid4()) jobid = str(uuid.uuid4())
config = configparser.ConfigParser() config = configparser.ConfigParser()
try: try:
title = req.args["title"][0].replace(" ", "_") or "output" title = re.sub(r"[^a-zA-Z0-9_\-]", "_", req.args["title"][0]) or output
except: except:
title = "output" title = "output"
try: try:
rx = req.args["rx"][0] rx = int(req.args["rx"][0]) or 0
except: except:
rx = 0 rx = 0
try: try:
ry = req.args["ry"][0] ry = int(req.args["ry"][0]) or 0
except: except:
ry = 0 ry = 0
try: try:
rz = req.args["rz"][0] rz = int(req.args["rz"][0]) or 0
except: except:
rz = 0 rz = 0
try: try:
width = req.args["width"][0] width = int(req.args["width"][0]) or 3840
except: except:
width = 3840 width = 3840
try: try:
height = req.args["height"][0] height = int(req.args["height"][0]) or 1920
except: except:
height = 1920 height = 1920

View file

@ -25,7 +25,7 @@
<form class="" id="theform"> <form class="" id="theform">
<div class="form-group"> <label>URL</label> <input type="text" class="form-control" placeholder="https://example.com/0/0/0_0.jpg" name="url" required="required"> <small class="form-text text-muted">URL of an image contained in a krpano panorama or of a website containing a krpano panorama</small> </div> <div class="form-group"> <label>URL</label> <input type="text" class="form-control" placeholder="https://example.com/0/0/0_0.jpg" name="url" required="required"> <small class="form-text text-muted">URL of an image contained in a krpano panorama or of a website containing a krpano panorama</small> </div>
<div class="form-group"> <label>Title</label> <input type="" class="form-control" placeholder="1234 - Shiny Place" name="title"> </div> <div class="form-group"> <label>Title</label> <input type="" class="form-control" placeholder="1234 - Shiny Place" name="title"> </div>
<div class="form-group"> <label style="display: block;">Resolution</label> <input type="" class="form-control" placeholder="3840" name="width" style="width: 100px; display: inline;"> x <input type="" class="form-control" placeholder="1920" name="width" style="width: 100px; display: inline;"> </div> <div class="form-group"> <label style="display: block;">Resolution</label> <input type="" class="form-control" placeholder="3840" name="width" style="width: 100px; display: inline;"> x <input type="" class="form-control" placeholder="1920" name="height" style="width: 100px; display: inline;"> </div>
<div id="options"> <div id="options">
<div class="form-group"> <label style="display: block;">Rotation on X/Y/Z axes</label> <input type="" class="form-control" placeholder="0" name="rx" style="width: 100px; display: inline;"> / <input type="" class="form-control" placeholder="0" name="ry" style="width: 100px; display: inline;"> / <input type="" class="form-control" placeholder="0" name="rz" style="width: 100px; display: inline;"> </div> <div class="form-group"> <label style="display: block;">Rotation on X/Y/Z axes</label> <input type="" class="form-control" placeholder="0" name="rx" style="width: 100px; display: inline;"> / <input type="" class="form-control" placeholder="0" name="ry" style="width: 100px; display: inline;"> / <input type="" class="form-control" placeholder="0" name="rz" style="width: 100px; display: inline;"> </div>
<div class="form-group"> <label>Transposition<br></label><select class="custom-control custom-select" name="transpose"> <div class="form-group"> <label>Transposition<br></label><select class="custom-control custom-select" name="transpose">
@ -33,7 +33,7 @@
<option value="0">No transposition</option> <option value="0">No transposition</option>
</select> </div> </select> </div>
</div> </div>
<button type="submit" class="btn btn-success">Submit</button> <button type="reset" class="btn btn-danger">Reset</button> <button class="btn btn-info" onclick="toggleOptions()">More options</button> <button type="submit" class="btn btn-success">Submit</button> <button type="reset" class="btn btn-danger">Reset</button> <button type="button" class="btn btn-info" onclick="toggleOptions()">More options</button>
</form> </form>
</div> </div>
</div> </div>