| Index: sitescripts/reports/static/reports.js |
| =================================================================== |
| --- a/sitescripts/reports/static/reports.js |
| +++ b/sitescripts/reports/static/reports.js |
| @@ -29,6 +29,17 @@ |
| return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """); |
| } |
| +function setRadio(radio, value) |
| +{ |
| + for (i = 0; i < radio.length; i++) |
| + { |
| + if (radio[i].value == value) |
| + radio[i].checked = true; |
| + else |
| + radio[i].checked = false; |
| + } |
| +} |
| + |
| function saveSecret(guid, secret) |
| { |
| var secrets = localStorage.secrets; |
| @@ -48,6 +59,9 @@ |
| var statusCell = document.getElementById("statusCell"); |
| if (statusCell) |
| status = statusCell.textContent; |
| + |
| + var utility = "0"; |
| + var utilityCell = document.getElementById("utilityCell"); |
| var div = document.createElement("div"); |
| div.className = "updateLink" |
| @@ -64,10 +78,14 @@ |
| link.onclick = function() |
| { |
| var notifyBox = ""; |
| + var utilityRadios = ""; |
| if (document.getElementById("emailCell")) |
| + { |
| notifyBox = '<span id="notifyField"><input type="checkbox" id="notify" name="notify" value="1" /> <label for="notify">Notify user</label></span>'; |
| - |
| - div.innerHTML = '<form action="/updateReport" method="POST">' + |
| + utilityRadios = '<br />Utility: <input type="radio" name="utility" value="0" checked="checked" /> not established <input type="radio" name="utility" value="1" /> usefull <input type="radio" name="utility" value="-1" /> harmful'; |
|
Wladimir Palant
2012/10/18 15:41:24
Not "harmful" but "useless". And it is "useful", n
Andrey Novikov
2012/10/18 15:51:29
Done.
|
| + } |
| + |
| + div.innerHTML = '<form id="updateForm" action="/updateReport" method="POST">' + |
| '<input type="hidden" name="secret" value="' + escapeHTML(secret) + '" />' + |
| '<input type="hidden" name="guid" value="' + escapeHTML(guid) + '" />' + |
| '<p>' + |
| @@ -76,7 +94,8 @@ |
| '</p>' + |
| '<p>' + |
| 'Enter new status:' + notifyBox + '<br />' + |
| - '<textarea id="statusField" name="status" oninput="updateTemplateButtons();"></textarea>' + |
| + '<textarea id="statusField" name="status" oninput="updateTemplateButtons();"></textarea>' + |
| + utilityRadios + |
| '</p>' + |
| '<div>' + |
| '<button id="addTemplateButton" type="button" onclick="addTemplate();">Add as template</button>' + |
| @@ -97,6 +116,12 @@ |
| }, false); |
| var statusField = document.getElementById("statusField"); |
| statusField.value = status; |
| + if (utilityCell) |
| + { |
| + utility = utilityCell.getAttribute("value"); |
| + setRadio(document.getElementById("updateForm").elements.utility, utility); |
| + } |
| + |
| updateTemplates(); |
| statusField.focus(); |
| } |