| 1 |
sysadm |
1.1 |
<?
|
| 2 |
|
|
// Prevent load standalone
|
| 3 |
|
|
if (!isset($result_set))
|
| 4 |
|
|
{
|
| 5 |
|
|
exit();
|
| 6 |
|
|
}
|
| 7 |
|
|
?>
|
| 8 |
|
|
<html>
|
| 9 |
|
|
<head>
|
| 10 |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
| 11 |
|
|
<title>设定版块收藏</title>
|
| 12 |
sysadm |
1.3 |
<link rel="stylesheet" href="<? echo get_theme_file('css/default'); ?>" type="text/css">
|
| 13 |
sysadm |
1.1 |
<script src="../js/polyfill.min.js"></script>
|
| 14 |
|
|
<script src="../js/axios.min.js"></script>
|
| 15 |
|
|
<script type="text/javascript">
|
| 16 |
|
|
function select_class(cid, flag)
|
| 17 |
|
|
{
|
| 18 |
|
|
for (var element of document.getElementById("class_" + cid).getElementsByTagName("input"))
|
| 19 |
|
|
{
|
| 20 |
|
|
element.checked = flag;
|
| 21 |
|
|
};
|
| 22 |
|
|
}
|
| 23 |
|
|
|
| 24 |
|
|
function refresh_err_msg(errorFieldMap)
|
| 25 |
|
|
{
|
| 26 |
|
|
document.getElementsByName("err_msg").forEach(element => {
|
| 27 |
|
|
element.innerHTML = (errorFieldMap.has(element.id) ? errorFieldMap.get(element.id) : "");
|
| 28 |
|
|
});
|
| 29 |
|
|
}
|
| 30 |
|
|
|
| 31 |
|
|
function s_favor_sub(f)
|
| 32 |
|
|
{
|
| 33 |
|
|
let sidList = [];
|
| 34 |
|
|
|
| 35 |
|
|
for (const sid of f.sid_list)
|
| 36 |
|
|
{
|
| 37 |
|
|
if (sid.checked)
|
| 38 |
|
|
{
|
| 39 |
|
|
sidList.push(sid.value);
|
| 40 |
|
|
}
|
| 41 |
|
|
}
|
| 42 |
|
|
|
| 43 |
|
|
instance.post('s_favor_sub.php', {
|
| 44 |
|
|
sid_list: sidList,
|
| 45 |
|
|
})
|
| 46 |
|
|
.then(function (response) {
|
| 47 |
|
|
var ret = response.data;
|
| 48 |
|
|
var errorFieldMap = new Map();
|
| 49 |
|
|
switch (ret.return.code)
|
| 50 |
|
|
{
|
| 51 |
|
|
case 0: // OK
|
| 52 |
|
|
errorFieldMap.set("err_msg_prompt", "更新成功");
|
| 53 |
|
|
refresh_err_msg(errorFieldMap);
|
| 54 |
|
|
break;
|
| 55 |
|
|
case -2: // Internal error
|
| 56 |
|
|
console.log(ret.return.message);
|
| 57 |
|
|
errorFieldMap.set("err_msg_prompt", "内部错误");
|
| 58 |
|
|
refresh_err_msg(errorFieldMap);
|
| 59 |
|
|
break;
|
| 60 |
|
|
default:
|
| 61 |
|
|
console.log(ret.return.code);
|
| 62 |
|
|
break;
|
| 63 |
|
|
}
|
| 64 |
|
|
})
|
| 65 |
|
|
.catch(function (error) {
|
| 66 |
|
|
console.log(error);
|
| 67 |
|
|
});
|
| 68 |
|
|
|
| 69 |
|
|
return false;
|
| 70 |
|
|
}
|
| 71 |
|
|
|
| 72 |
|
|
const instance = axios.create({
|
| 73 |
|
|
withCredentials: true,
|
| 74 |
|
|
timeout: 3000,
|
| 75 |
|
|
baseURL: document.location.protocol + '//' + document.location.hostname + (document.location.port=='' ? '' : (':' + document.location.port)) + '/bbs/',
|
| 76 |
|
|
});
|
| 77 |
|
|
|
| 78 |
|
|
window.addEventListener("load", () => {
|
| 79 |
|
|
var f = document.getElementById("s_favor_form");
|
| 80 |
|
|
f.addEventListener("submit", (e) => {
|
| 81 |
|
|
e.preventDefault();
|
| 82 |
|
|
s_favor_sub(f);
|
| 83 |
|
|
});
|
| 84 |
|
|
});
|
| 85 |
|
|
|
| 86 |
|
|
</script>
|
| 87 |
|
|
</head>
|
| 88 |
|
|
<body>
|
| 89 |
|
|
<?
|
| 90 |
sysadm |
1.3 |
include get_theme_file("view/member_service_guide");
|
| 91 |
sysadm |
1.1 |
?>
|
| 92 |
|
|
<center>
|
| 93 |
|
|
<p align="center" style="FONT-WEIGHT: bold; FONT-SIZE: 16px; COLOR: red; FONT-FAMILY: 楷体">
|
| 94 |
|
|
设定版块收藏
|
| 95 |
|
|
</p>
|
| 96 |
|
|
<p>
|
| 97 |
|
|
<span id="err_msg_prompt" name="err_msg" style="color: red"></span>
|
| 98 |
|
|
</p>
|
| 99 |
|
|
<form method="post" action="#" id="s_favor_form" name="s_favor_form">
|
| 100 |
sysadm |
1.7 |
<table border="1" cellpadding="5" cellspacing="0" width="1050" bgcolor="#ffdead">
|
| 101 |
sysadm |
1.1 |
<?
|
| 102 |
sysadm |
1.4 |
foreach ($result_set["data"]["section_hierachy"] as $c_index => $section_class)
|
| 103 |
sysadm |
1.1 |
{
|
| 104 |
|
|
?>
|
| 105 |
|
|
<tr>
|
| 106 |
|
|
<td align="left">
|
| 107 |
sysadm |
1.2 |
<? echo $section_class["title"]; ?>
|
| 108 |
|
|
<a class="s2" href="#" onclick="return select_class(<? echo $section_class['cid']; ?>, true);">全选</a>
|
| 109 |
|
|
<a class="s2" href="#" onclick="return select_class(<? echo $section_class['cid']; ?>, false);">不选</a>
|
| 110 |
sysadm |
1.1 |
</td>
|
| 111 |
|
|
</tr>
|
| 112 |
|
|
<tr>
|
| 113 |
|
|
<td id="class_<? echo $section_class["cid"]; ?>" align="left">
|
| 114 |
|
|
<?
|
| 115 |
|
|
foreach ($section_class["sections"] as $s_index => $section)
|
| 116 |
|
|
{
|
| 117 |
|
|
?>
|
| 118 |
sysadm |
1.6 |
<input type="checkbox" id="sid_list" name="sid_list[]" value="<? echo $section["sid"]; ?>" <? echo ($section["udf_values"] ? "checked" : ""); ?>><a class="s2" href="list.php?sid=<? echo $section["sid"]; ?>" target=_blank><? echo $section["title"]; ?></a>
|
| 119 |
sysadm |
1.1 |
<?
|
| 120 |
|
|
}
|
| 121 |
|
|
?>
|
| 122 |
|
|
</td>
|
| 123 |
|
|
</tr>
|
| 124 |
|
|
<?
|
| 125 |
|
|
}
|
| 126 |
|
|
?>
|
| 127 |
|
|
</table>
|
| 128 |
|
|
<p>
|
| 129 |
|
|
<input type="submit" value="提交" name="Submit">
|
| 130 |
|
|
<input type="reset" value="重填" name="Reset">
|
| 131 |
|
|
</p>
|
| 132 |
|
|
</form>
|
| 133 |
|
|
</center>
|
| 134 |
|
|
</body>
|
| 135 |
|
|
</html>
|