📄 actionsperson.js
字号:
/* * Verify the id, display an confirmation message and delete (or not) the user * @param event coming from the link on persons list */function delUser(e) { if (!e) var e = window.event if (!this.name) { alert("problem : id in attribute name not found"); return false; } if (!confirm(lbl_delete_confirm_message)) return false; var req = newXMLHttpRequest(), param = ''; var handlerFunction = getReadyStateHandler(req, updateUserDeleted); req.onreadystatechange = handlerFunction; req.open("POST", "actions/deletePerson.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); param = "id="+this.name; req.send(param); if (debug) trace("POST deleteContact.php param=" + param); return true;}/* * Verify mandatory field, birthday date and create a new person */function createPerson() { if (!verifyNotEmpty(new Array('lastname')) || !verifyDate(document.getElementById('birthdate'))) return false; var req = newXMLHttpRequest(), param = ''; var handlerFunction = getReadyStateHandler(req, getModifyPersonForm); req.onreadystatechange = handlerFunction; req.open("POST", "actions/createNewPerson.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); param = "idgroup="+ document.getElementById('idgroup').value + "&title=" + document.getElementById('title').value + "&firstname=" + document.getElementById('firstname').value + "&lastname=" + document.getElementById('lastname').value + "&birthdate=" + document.getElementById('birthdate').value + "¬e=" + document.getElementById('note').value; document.getElementById("content").innerHTML = msgWaiting; req.send(param); if (debug) trace("POST createNewContact.php param="+param); return true;}/* * Request PHP to get group list */function getNewPersonForm() { var req = newXMLHttpRequest(); var handlerFunction = getReadyStateHandler(req, updateFormNewPerson); req.onreadystatechange = handlerFunction; req.open("POST", "actions/getGroups.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); document.getElementById("content").innerHTML = msgWaiting; req.send(''); if (debug) trace("POST getGroups.php"); return true;} /* * Verify the Id, and call getPersonToModifyWithId() * @param event coming from the link on persons list */function getPersonToModify(e) { if (!e) var e = window.event if (!this.name) { alert("problem : id in attribute name not found"); return false; } return getPersonToModifyWithId(this.name);}/* * Request PHP to get person informations * @param id of the person to modify */function getPersonToModifyWithId(id) { var req = newXMLHttpRequest(), param = ''; var handlerFunction = getReadyStateHandler(req, getModifyPersonForm); req.onreadystatechange = handlerFunction; req.open("POST", "actions/getPerson.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); param = "idperson="+id; document.getElementById("content").innerHTML = msgWaiting; req.send(param); if (debug) trace("POST getPerson.php id="+this.id); return true;}/* * Request PHP to get a person * @param person id */function showPerson(id) { var req = newXMLHttpRequest(), param = ''; var handlerFunction = getReadyStateHandler(req, showResult); req.onreadystatechange = handlerFunction; req.open("POST", "actions/getPerson.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); param = "idperson="+id; document.getElementById("content").innerHTML = msgWaiting; req.send(param); if (debug) trace("POST getPerson.php id="+this.id); return true;}/* * Verify mandatory field, birthday date and send forms fields to PHP */function modifyPerson() { if (!verifyNotEmpty(new Array('lastname')) || !verifyDate(document.getElementById('birthdate'))) return false; var req = newXMLHttpRequest(), param = ''; var handlerFunction = getReadyStateHandler(req, getModifyPersonForm); req.onreadystatechange = handlerFunction; req.open("POST", "actions/modifyPerson.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); param = "idperson=" + document.getElementById('idperson').value + "&idgroup="+ document.getElementById('idgroup').value + "&title=" + document.getElementById('title').value + "&firstname=" + document.getElementById('firstname').value + "&lastname=" + document.getElementById('lastname').value + "&birthdate=" + document.getElementById('birthdate').value + "¬e=" + document.getElementById('note').value; document.getElementById("content").innerHTML = msgWaiting; req.send(param); if (debug) trace("POST modifyPerson.php param="+param); return true;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -