Mercurial > hg > fapweb
changeset 286:daa9e22045ad
Simplify and remove remnants of the frontend-based input checking.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 25 Nov 2013 00:15:19 +0200 |
parents | 4c00e9cbb84e |
children | 71442d864367 |
files | admin.php majax.php |
diffstat | 2 files changed, 11 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/admin.php Sun Nov 24 23:20:38 2013 +0200 +++ b/admin.php Mon Nov 25 00:15:19 2013 +0200 @@ -236,7 +236,7 @@ function addAttendee() { - var args = makePostArgs({"name":1,"groups":0,"oneliner":0,"email":0}, "ne", "x"); + var args = makePostArgs({"name":1,"groups":1,"oneliner":1,"email":1}, "ne", "x"); var msuccess = function(txt) { @@ -258,7 +258,7 @@ function updateAttendee(id) { - var args = makePostArgs({"name":1,"groups":0,"oneliner":0,"email":0}, "at", id); + var args = makePostArgs({"name":1,"groups":1,"oneliner":1,"email":1}, "at", id); var msuccess = function(txt) { @@ -338,7 +338,7 @@ function addEntry(id) { - var args = makePostArgs({"name":1, "author":1, "filename":0, "info":0}, "ne", id); + var args = makePostArgs({"name":1, "author":1, "filename":1, "info":1}, "ne", id); var msuccess = function(txt) { @@ -353,7 +353,7 @@ function updateEntry(id) { - var args = makePostArgs({"name":1, "author":1, "filename":0, "info":0, "compo_id":2}, "en", id); + var args = makePostArgs({"name":1, "author":1, "filename":1, "info":1, "compo_id":2}, "en", id); var msuccess = function(txt) {
--- a/majax.php Sun Nov 24 23:20:38 2013 +0200 +++ b/majax.php Mon Nov 25 00:15:19 2013 +0200 @@ -116,33 +116,23 @@ switch (fields[id]) { - case 0: case 1: - case 4: - { - var str = strtrim(elem.value); - /* Disabled for now, as the backend should do these checks. - if ((fields[id] == 1 || fields[id] == 4) && str == "") - { - alert("One or more of the required fields are empty."); - return ""; - } - */ - if (fields[id] == 4) - res.push(id+"="+parseInt(elem.value)); - else - res.push(id+"="+strencode(str)); - } + var vstr = strtrim(elem.value); + res.push(id+"="+strencode(vstr)); break; case 2: - res.push(id+"="+parseInt(elem.value)); + var vint = parseInt(strtrim(elem.value)); + res.push(id+"="+vint); break; case 3: res.push(id+"="+(elem.checked ? "1" : "0")); break; + default: + alert("Unsupported field type in "+ fprefix +" : "+ fsuffix); + break; } } return res.join("&");