📄 actionsgroup.js
字号:
/* * Request PHP to get forms list */function getGroupMgtForm() { var req = newXMLHttpRequest(); var handlerFunction = getReadyStateHandler(req, showGroupMgtForm); req.onreadystatechange = handlerFunction; req.open("POST", "actions/getGroups.php", true); document.getElementById("content").innerHTML = msgWaiting; req.send(''); if (debug) trace("POST getGroups.php"); return true;}/* * Verify mandatories fields and call modifyGroupName() for each group. At the end, refresh the group list zone. */function modifyGroupNames() { var formGroup = document.getElementById("formGroup"); var inputs = formGroup.getElementsByTagName("input"); // Verification for(var i = 0; i < inputs.length; i++) { if (inputs[i].type == 'text' && inputs[i].name != 'nameNew') { if(inputs[i].value == '') { alert(lbl_fill_group_name); inputs[i].focus(); return false; } } } for(var i = 0; i < inputs.length; i++) { if (inputs[i].type == 'text' && inputs[i].name != 'nameNew') { modifyGroupName(inputs[i]); } } document.getElementById("content").innerHTML = msgWaiting; setTimeout("getGroupMgtForm()", 500); return true;}/* * Request PHP to change one group name * @param Input text field wich contains the group name */function modifyGroupName(element) { var idWithName = element.id; var id = idWithName.replace("name", ""); var req = newXMLHttpRequest(), param = ''; req.open("POST", "actions/modifyGroup.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); param = "idgroup=" + id + "&name=" + element.value; req.send(param); if (debug) trace("POST modifyGroup.php param=" + param); return true;}/* * Verify the group name and request (or not) PHP to add a new group * @param Input text field wich contains the group name */function createGroupName(elName) { if (!elName || !elName.value) { alert(lbl_fill_group_name); return false; } var req = newXMLHttpRequest(), param = ''; var handlerFunction = getReadyStateHandler(req, getGroupMgtForm); req.onreadystatechange = handlerFunction; req.open("POST", "actions/createNewGroup.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); param = "name=" + elName.value; document.getElementById("content").innerHTML = msgWaiting; req.send(param); if (debug) trace("POST createNewGroup.php param=" + param); return true;}/* * Request PHP to get groups */function getGroupList() { var req = newXMLHttpRequest(); var handlerFunction = getReadyStateHandler(req, updateGroupList); req.onreadystatechange = handlerFunction; req.open("POST", "actions/getGroups.php", true); document.getElementById("listeGroupes").innerHTML = msgWaiting; req.send(''); if (debug) trace("POST getGroups.php"); return true;}/* * Delete a group * (the group must be empty, if not, persons on the deleted group will still be in the database but will be unreachable by the application) * @param group id to delete */function deleteGroup(id) { var req = newXMLHttpRequest(), param = ''; var handlerFunction = getReadyStateHandler(req, showGroupMgtForm); req.onreadystatechange = handlerFunction; req.open("POST", "actions/deleteGroup.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); param = "idgroup=" + id; document.getElementById("content").innerHTML = msgWaiting; req.send(param); if (debug) trace("POST deleteGroup.php param="+param); return true;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -