📄 actionsmailinglist.js
字号:
/* * Verify mandatory field and request (or not) PHP to create a mailing-list */function createMailingList() { if (!verifyNotEmpty(new Array('mailingListName'))) return false; var req = newXMLHttpRequest(), param = ''; var handlerFunction = getReadyStateHandler(req, getModifyMailingListForm); req.onreadystatechange = handlerFunction; req.open("POST", "actions/createNewMailingList.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); param = "name=" + document.getElementById('mailingListName').value; document.getElementById("content").innerHTML = msgWaiting; req.send(param); if (debug) trace("POST createNewMailingList.php param=" + param); return true;}/* * Request PHP to have the mailing-list and go to the modification form * @param mailing-list id */function getMailingListToModify(id) { var req = newXMLHttpRequest(), param = ''; var handlerFunction = getReadyStateHandler(req, getModifyMailingListForm); req.onreadystatechange = handlerFunction; req.open("POST", "actions/getMailingList.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); param = "id=" + id; document.getElementById("content").innerHTML = msgWaiting; req.send(param); if (debug) trace("POST getMailingList.php param=" + param); return true;}/* * Request PHP to have the mailing-list and go to the mailing-list details * @param mailing-list id */function getMailingListToShow(id) { var req = newXMLHttpRequest(), param = ''; var handlerFunction = getReadyStateHandler(req, showMailingList); req.onreadystatechange = handlerFunction; req.open("POST", "actions/getMailingList.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); param = "id=" + id; document.getElementById("content").innerHTML = msgWaiting; req.send(param); if (debug) trace("POST getMailingList.php param=" + param); return true;}/* * Verify mandatory field and request (or not) PHP to modify the mailing-list */function modifyMailingList() { if (!verifyNotEmpty(new Array('mailingListName'))) return false; var form = document.getElementById("formML"), inputs = form.getElementsByTagName('input'), lstContact = '&emails=', first = true, valueDest = 'to'; // Parse emails checkbox and construct a list of id for(var i = 0; i < inputs.length; i++) { if (inputs[i].type == 'checkbox' && inputs[i].checked == true) { if (!first) lstContact += ','; else first = false; lstContact += inputs[i].value.replace("email", ""); } } if (document.getElementById('mailingListTo').checked) valueDest = 'to'; else if (document.getElementById('mailingListCC').checked) valueDest = 'cc'; else if (document.getElementById('mailingListBCC').checked) valueDest = 'bcc'; var req = newXMLHttpRequest(), param = ''; var handlerFunction = getReadyStateHandler(req, showMailingList); req.onreadystatechange = handlerFunction; req.open("POST", "actions/modifyMailingList.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); param = "id="+ document.getElementById('mailingListId').value +"&name=" + document.getElementById('mailingListName').value + "&dest="+ valueDest + lstContact; document.getElementById("content").innerHTML = msgWaiting; req.send(param); if (debug) trace("POST createNewMailingList.php param=" + param); return true;}/* * Request PHP to get mailing-lists */function getMailingLists() { var req = newXMLHttpRequest(); var handlerFunction = getReadyStateHandler(req, updateMailingLists); req.onreadystatechange = handlerFunction; req.open("POST", "actions/getMailingLists.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); document.getElementById("listeMailingList").innerHTML = msgWaiting; req.send(''); if (debug) trace("POST getMailingLists.php"); return true;}/* * Delete a mailing-list * @param mailing id to delete */function deleteMailingList(id) { var req = newXMLHttpRequest(), param = ''; var handlerFunction = getReadyStateHandler(req, updateMailingListDeleted); req.onreadystatechange = handlerFunction; req.open("POST", "actions/deleteMailingList.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); param = "id=" + id; document.getElementById("content").innerHTML = msgWaiting; req.send(param); if (debug) trace("POST deleteMailingList.php param="+param); return true;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -