master
assar 8 years ago
parent 6214390df4
commit fcab1c5cfd

@ -66,7 +66,8 @@ def alter(partID):
file = request.files['file'] file = request.files['file']
filename = secure_filename(file.filename) filename = secure_filename(file.filename)
file.save(os.path.join('/srv/datasheets', filename))''' file.save(os.path.join('/srv/datasheets', filename))'''
print dict(request) print dict(request.data)
print dict(request.files)
def connect(user, password, db, host='localhost', port=5432): def connect(user, password, db, host='localhost', port=5432):
'''Returns a connection and a metadata object''' '''Returns a connection and a metadata object'''

@ -83,11 +83,11 @@ function save(partID) {
var quantity_v = $('#quantity-input').val(); var quantity_v = $('#quantity-input').val();
var notes_v = $('#notes-input').val(); var notes_v = $('#notes-input').val();
var datasheet = $('#datasheet-input')[0].files; var datasheet = $('#datasheet-input')[0].files;
if(! partno.match(/^([a-zA-Z0-9]+\s*){1,3}$/g)) { if(! partno_v.match(/^([a-zA-Z0-9]+\s*){1,3}$/g)) {
alert('Invalid part number format. Accepted: <Part-number-line-1> <Part-number-line-2> <Part-number-line-3>'); alert('Invalid part number format. Accepted: <Part-number-line-1> <Part-number-line-2> <Part-number-line-3>');
return; return;
} }
if(! block.match(/^[0-9]+$/g)) { if(! block_v.match(/^[0-9]+$/g)) {
alert('Invalid location field. Only numbers accepted.'); alert('Invalid location field. Only numbers accepted.');
return; return;
} }
@ -153,7 +153,7 @@ function show_part_info(partID) {
$('#datasheet-info').text('<a href="https://www.elab.kth.se/parts/getfile/' + data.datasheet + '"><i class="fa fa-file-text" aria-hidden="true"></i></a>'); $('#datasheet-info').text('<a href="https://www.elab.kth.se/parts/getfile/' + data.datasheet + '"><i class="fa fa-file-text" aria-hidden="true"></i></a>');
else else
$('#datasheet-info').text(' '); $('#datasheet-info').text(' ');
$('#edit-button').on('click', function() { $('#edit-button').click(function() {
init_edit(partID); init_edit(partID);
}); });
overlay_in(); overlay_in();

@ -68,7 +68,7 @@
<div class="details-content"><p id="datasheet-info"></p></div> <div class="details-content"><p id="datasheet-info"></p></div>
</div> </div>
<div class="round-button"><a href="#" id="edit_button"><i class="fa fa-pencil" aria-hidden="true"></i></a></div> <div class="round-button"><a href="#" id="edit-button"><i class="fa fa-pencil" aria-hidden="true"></i></a></div>
<div class="small-square-button"><a href="#" onclick="overlay_out()"><i class="fa fa-times" aria-hidden="true"></i></a></div> <div class="small-square-button"><a href="#" onclick="overlay_out()"><i class="fa fa-times" aria-hidden="true"></i></a></div>
<!--<h2 class="card-id"></h2> <!--<h2 class="card-id"></h2>
<input type="text" name="name" placeholder="Name" id="name"><br><br> <input type="text" name="name" placeholder="Name" id="name"><br><br>

Loading…
Cancel
Save