Marek Baczynski 6 years ago
commit 2a8b1f50f4

@ -254,9 +254,9 @@ def alter(partID):
datasheet_file.save('/srv/datasheets/' + datasheet_filename) datasheet_file.save('/srv/datasheets/' + datasheet_filename)
datasheet_filename = 'http://elab.kth.se/parts/getfile/' + datasheet_filename datasheet_filename = 'http://elab.kth.se/parts/getfile/' + datasheet_filename
if l[0]['datasheet'] != None: if l[0]['datasheet'] != None:
os.remove('/srv/datasheets/' + l[0]['datasheet']) whole_url = l[0]['datasheet']
# elif request.form.has_key('datasheet-url'): actual_filename = whole_url[whole_url.rfind('/') + 1:]
# datasheet_filename = request.form['datasheet-url'] os.remove('/srv/datasheets/' + actual_filename)
else: else:
try: try:
datasheet_filename = request.form['datasheet-url'] datasheet_filename = request.form['datasheet-url']

@ -182,8 +182,10 @@ function show_part_info(partID) {
$('tr#datasheet-head').html($('<td>DATASHEET: <a href="' + data.datasheet + '" target="_blank"><i class="fa fa-file-text" aria-hidden="true"></i></a></td>')); $('tr#datasheet-head').html($('<td>DATASHEET: <a href="' + data.datasheet + '" target="_blank"><i class="fa fa-file-text" aria-hidden="true"></i></a></td>'));
$('input[name=datasheet-url-input]').val(data.datasheet); $('input[name=datasheet-url-input]').val(data.datasheet);
} }
else else {
$('tr#datasheet-head td').text('DATASHEET: '); $('tr#datasheet-head td').text('DATASHEET: ');
$('input[name=datasheet-url-input]').val('');
}
$('#edit-button').click(function() { $('#edit-button').click(function() {
init_edit(partID); init_edit(partID);
}); });

Loading…
Cancel
Save