WEB/Praktikum2/ppm1/static/functions.js
darthsandmann 8060d7af68 Revert "PPM2: select"
This reverts commit 552b7cc9423a58442d1d1bcb51e1fe8d70594ac4
2016-12-12 23:04:04 +01:00

46 lines
1.2 KiB
JavaScript

var table = document.getElementById('idList');
var selected = table.getElementsByClassName('selected');
var selectedId = 'None';
table.onclick = highlight;
function select(category, mode) {
var id = selectedId;
if (id == 'None')
{
alert("Kein Eintrag ausgewaehlt!");
}
else
{
if(mode == 0) {
window.location.href = '/detail/?cat=' + category + '&id=' + id;
}
if(mode == 1) {
var result = confirm("Sind Sie sicher, dass der Eintrag gelöscht werden soll?");
if(result) {
window.location.href = '/delete/?cat=' + category + '&id=' + id;
return true;
}
else {
return false;
}
}
if(mode == 2) {
var result = confirm("Sind Sie sicher, dass das Angebot angenommen werden soll?");
if(result) {
window.location.href = '/detailchoice/?id=' + id;
return true;
}
else {
return false;
}
}
}
}
function highlight(e) {
if (selected[0]) selected[0].className = '';
e.target.parentNode.className = 'selected';
var tr = e.target.parentNode;
selectedId = tr.getAttribute('id');
}