diff options
Diffstat (limited to 'www/scripts')
-rw-r--r-- | www/scripts/main.js | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/www/scripts/main.js b/www/scripts/main.js index 900357b..9c77f56 100644 --- a/www/scripts/main.js +++ b/www/scripts/main.js @@ -118,11 +118,10 @@ function LoadGroups(keep_selection) elem.add(option); } - alert(globalCurrentGroup); elem.value = globalCurrentGroup; } -function AddTableInputCell(id, text, name, tr) +function AddTableInputCell(id, text, name, node) { var td = document.createElement("td"); var input = document.createElement("input"); @@ -132,7 +131,26 @@ function AddTableInputCell(id, text, name, tr) input.type = "text"; td.appendChild(input); - tr.appendChild(td); + node.appendChild(td); +} + +function AddSmallLink(node, text, func, id) +{ + var anchor = document.createElement("a"); + + anchor.href = "#"; + anchor.onclick = func; + anchor.text = text; + anchor.className = "smalltext"; + anchor.dataset.pmId = id; + + node.appendChild(anchor); +} + +function AddNBSP(node) +{ + var nbsp = document.createTextNode("\u00a0"); + node.appendChild(nbsp); } function AddRow(table, id, desc, username, password, rowcount) @@ -141,11 +159,11 @@ function AddRow(table, id, desc, username, password, rowcount) if ((rowcount % 2) == 1) { - tr.style = "style1"; + tr.className = "style1"; } else { - tr.style = "style2"; + tr.className = "style2"; } AddTableInputCell(id, desc, "Description", tr); @@ -156,11 +174,13 @@ function AddRow(table, id, desc, username, password, rowcount) if (id == -1) { - td.innerText = "Stuff for new entry"; + AddSmallLink(td, "Add", DoAdd, id); } else { - td.innerText = "Stuff for existing entry"; + AddSmallLink(td, "Edit", DoEdit, id); + AddNBSP(td); + AddSmallLink(td, "Delete", DoDelete, id); } tr.appendChild(td); @@ -218,4 +238,16 @@ function DoSelectGroup() LoadTable(); } +function DoAdd() +{ +} + +function DoEdit() +{ +} + +function DoDelete() +{ +} + // vim: sw=4 ts=4 |