U.D.PB.Pa.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. Namespace.register("U.MD.D.PB.Pa"); //板块处理
  2. //#region 获取板块信息
  3. //#endregion
  4. //#region 搜索板块
  5. //出现搜索
  6. U.MD.D.PB.Pa.BKSSBK = function (UDOD, UTF) {
  7. var _UDAD = $(UDOD).Child(), _UDID = $("input", UDOD)[1];
  8. if (UTF[1] == "block" || _UDID.value == "") {
  9. _UDAD[0].style.display = UTF[0]; _UDAD[1].style.display = UTF[1];
  10. (UTF[1] == "block") && ($("input", _UDAD[1])[0].focus());
  11. }
  12. }
  13. //版块内的搜索
  14. U.MD.D.PB.Pa.BSBKSSBKO = function (UDOD) {
  15. var _UDTD = $("#UD_SYSXZBALSTI"), _UDSD = $("input", _UDTD.Parent())[0], _UDID = $("input", UDOD.parentNode)[0];
  16. if (_UDID.value != _UDID.defaultValue) { _UDSD.value = _UDID.value; U.MD.D.PB.Pa.SBKSSBKO(_UDTD[0]); }
  17. }
  18. //搜索单个版块
  19. U.MD.D.PB.Pa.SBKSSBKO = function (UDOD, UFN) {
  20. var i, _UDE, _UCE = ["none", "block"], _UDAD, _UGE = U.MD.D.H.ET["NT"]["PB"]["BK"], _UDPD = $(UDOD).Parent(4), _UDTD = $($(_UDPD).Child()[1]).Child()[1], _UDID = $("input", _UDPD)[1], _UDV = _UDID.value.trim();
  21. if (_UDV && _UDID.value != _UDID.defaultValue) {
  22. _UDE = _$(_UGE).Select({ "UserDirectoryName": _UDV })[0]
  23. if (_UDE) { U.MD.D.PB.DJPBCKMU(_UDE); } //搜索有结果直接打印结果
  24. else {//后台搜索结果
  25. U.UF.A.Request(US.AUTH, ["GetZDKM", _UDV], U.MD.D.PB.Pa.AsynSBKSSBKO, [[$("#UD_SYSXZBALZ")[0], true], _UDTD, _UDV, _UGE, UFN]);
  26. return;
  27. }
  28. }
  29. U.MD.D.PB.Pa.XSYCBK(_UDTD, _UCE);
  30. }
  31. //搜索版块异步
  32. U.MD.D.PB.Pa.AsynSBKSSBKO = function (r) {
  33. var i, _UCE, context = r.context, _UDOD = context[1], _UDV = context[2], _UGE = context[3], _UFN = context[4], _UDAD = $(_UDOD).Child(), _UDE = ["block", "none"]; r = r.value;
  34. if ((_UCE = r[0]) && _UCE[0]) { _UDE = ["none", "block"]; _UGE.push(_UCE[0]); U.MD.D.PB.DJPBCKMU(_UCE[0]); } //打印信息
  35. else { U.MD.D.PB.Pa.PKSBKSSBK(_UDAD[0], r[1], _UDV, _UFN); } //无搜索结果 显示相关的信息
  36. U.MD.D.PB.Pa.XSYCBK(_UDOD, _UDE); //显示
  37. }
  38. //搜索版块无结果
  39. U.MD.D.PB.Pa.PKSBKSSBK = function (UDOD, UDE, UDV, UFN) {
  40. var i, _UDTD, _UDSD; UDOD.innerText = "";
  41. $$("div", { "className": "UD_SYSXZBATO", "innerHTML": "暂时找不到<span> \"" + UDV + "\" </span>版块" }, UDOD);
  42. if (UDE.length) {//有类似的结果
  43. _UDTD = $$("div", { "className": "UD_SYSXZBATC" }, UDOD);
  44. $$("div", { "className": "UD_SYSXZBATCL", "innerHTML": "是不是在找?" }, _UDTD);
  45. _UDSD = $$("div", { "className": "UD_SYSXZBATCR" }, _UDTD);
  46. for (i = 0; i < UDE.length; i++) { $$("div", { "className": "UD_SYSXZBATCRO", "title": UDE[i].UserDirectoryName, "innerHTML": UDE[i].UserDirectoryName, "onclick": [[U.MD.D.PB.DJPBCKMU, [UDE[i]]]] }, _UDSD); }
  47. }
  48. $$("div", { "className": "UD_SYSXZBATD", "innerHTML": "返回上一步 >", "onclick": UFN || [[U.MD.D.PB.Pa.XSYCBK, [UDOD.parentNode, ["none", "block"]]]] }, UDOD);
  49. }
  50. //显示隐藏版块
  51. U.MD.D.PB.Pa.XSYCBK = function (UDPD, UDE) {
  52. var i, _UDAD = $(UDPD).Child(); UDE = UDE || ["none", "block"];
  53. for (i = 0; i < UDE.length; i++) { _UDAD[i].style.display = UDE[i]; }
  54. }
  55. //#endregion
  56. //#region 申请版块
  57. //申请版块
  58. U.MD.D.PB.Pa.SQPGHBK = function (UCE, UCB) {
  59. if (!U.MD.U.L.isLogin(3)) {
  60. var i, _UBE, _UDSD, _UGE = U.MD.D.H.ET["NT"]["PB"], _UDOD = $("#UD_SYTB").addAttrArray({ "style": { "display": "block"} }), _UDTD = $("div#UD_SYTBODLR", _UDOD[0])[0], _UDKD = $("input", _UDOD[0])[0];
  61. if (U.UF.Ut.isString(UCE)) { _UBE = { PublishedParentID: UCE }; UCE = []; } else if (U.UF.Ut.isArray(UCE)) { _UBE = UCE ? UCE[0] : _UGE["DBK"]; } else { _UBE = []; _UBE = _UGE["DBK"] || { "UserDirectoryID": US.FORUMROOTID, "PublishedParentID": US.FORUMROOTID, "UserDirectoryName": "学习系统" }; }
  62. UCE = (_UBE ? _$(_UGE["BK"]).Select({ "PublishedParentID": _UBE["PublishedParentID"] }) : []).concat(UCE || []); (!UCE.length) && (UCE.push(_UBE)); _UDTD.innerText = ""; _UDSD = $$("select", { "onchange": [[U.MD.D.PB.Pa.SZSQPGHBKTS, [UCE, _UDKD, "this", UCB]]] }); _UDSD.options.length = UCE.length;
  63. for (i = 0; i < UCE.length; i++) { $(_UDSD.options[i]).addAttrArray({ "text": UCE[i].UserDirectoryName, "value": UCE[i].UserDirectoryName }); (!_UBE || (_UBE["UserDirectoryID"] == UCE[i]["UserDirectoryID"])) && (_UDSD.selectedIndex = i) };
  64. _UDSD.onchange(); _UDTD.appendChild(_UDSD); U.UF.UI.Form({ min: false, max: false, id: "UD_SYTBA", content: _UDOD, title: "申请板块", style: { height: "525px", width: "685px"} }); _UDKD.focus();
  65. }
  66. //else { U.MD.D.H.ET.DLHD = [U.UF.M.apply(this, [[U.MD.D.H.SYQHL, []]])]; } //切换会动静页面
  67. }
  68. //设置申请版块确定
  69. U.MD.D.PB.Pa.SZSQPGHBKTS = function (UDE, UDOD, UDTD, UCB) {
  70. $("#UD_SYTBOXR")[0].onclick = U.UF.M.apply(this, [[U.MD.D.PB.Pa.QDSQPGHBK, [UDOD, UDE[UDTD.selectedIndex], UCB]]]);
  71. }
  72. //申请版块提示
  73. U.MD.D.PB.Pa.SQPGHBKTS = function (UDID, UNS) {
  74. $(UDID).addAttrArray({ "innerHTML": UNS, "style": { "display": "block"} });
  75. }
  76. //点击申请版块
  77. U.MD.D.PB.Pa.QDSQPGHBK = function (UDOD, UDE, UCB) {
  78. if (!U.MD.D.H.ET.PB.SQ) { //暂无申请
  79. var _UDN, _UTS, _UTF,
  80. _UFT = (event.type != "blur"), //判断时间
  81. _UDE = UDE || U.MD.D.H.ET["NT"]["PB"]["DBK"], //当前所在的板块
  82. _UDPD = $(UDOD).Parent(5),
  83. _UDED = $("i", _UDPD)[0],
  84. _UDTD = $("div", _UDPD);
  85. _UDTD = _UDTD[_UDTD.length - 2];
  86. if ((_UDN = UDOD.value) && _UDN != UDOD.defaultValue) {//如果没有任何输入就不提示
  87. if ((_UTF = U.UF.S.FFZF.test(_UDN)) && _UDN.length) { //输入限制
  88. U.MD.D.H.ET.PB.SQ = true;
  89. U.UF.A.Request(US.AUTH, ["IsDName", _UDN, US.userInfo.userid, _UDE ? (_UDE["UserDirectoryID"] || _UDE["PublishedDirectoryID"]) : US.FORUMROOTID, "1", _UFT],
  90. U.MD.D.PB.Pa.AsynQDSQPGHBK, ["", UDOD, UDE, _UDPD, _UDED, _UFT, UCB]); _UTS = "检测中...";
  91. }
  92. U.MD.D.PB.Pa.SQPGHBKTS(_UDED, _UTS || (_UTF ? "输入内容长度不允许大于50" : "不允许输入特殊字符")); //提示
  93. }
  94. }
  95. }
  96. //点击确定或者回车等待建立
  97. U.MD.D.PB.Pa.DDJL = function (UDOD) {
  98. UDOD.onclick(true);
  99. }
  100. //申请版块提示 判断申请的版块是否存在
  101. U.MD.D.PB.Pa.AsynQDSQPGHBK = function (r) {
  102. var _UDAD, _UTS = "版块名已存在无法建立", context = r.context, _UDID = context[1], _UDE = context[2], _UDPD = context[3], _UDED = context[4], _UTD = context[5], _UCB = context[6]; U.MD.D.H.ET.PB.SQ = false;
  103. if (_UTD && r.value.UserDirectoryID) { U.MD.D.PB.Pa.AsynSSQPGHBK(r); } //直接请求数据返回
  104. else {//查看是否为特殊字符
  105. if (!U.UF.Ut.isNumber((r = r.value))) { _UTS = "板块有效,请发送申请"; _UDAD = $("div", _UDPD); _UDAD.addAttrArray({ "onclick": [[U.MD.D.PB.Pa.SSQPGHBK, ["this", _UDID, _UDPD, _UDE, _UCB]]] }, _UDAD.length - 3); } //版块名允许建立
  106. (r === 0) && (_UTS = "此板块已有申请信息, 等待审核!"); (r === 1) && (_UTS = "此板块信息含有不法信息无法建立!"); U.MD.D.PB.Pa.SQPGHBKTS(_UDED, _UTS);
  107. }
  108. }
  109. //确定申请版块
  110. U.MD.D.PB.Pa.SSQPGHBK = function (UDOD, UDID, UDPD, UDE, UCB) {
  111. var _UDED = $("i", UDPD)[0],
  112. _UDN = UDID.value;
  113. U.MD.D.H.ET.PB.SQ = true;
  114. U.MD.D.PB.Pa.SQPGHBKTS(_UDED, "等待服务器响应");
  115. U.UF.A.Request(US.AUTH, ["addRoot", _UDN, US.userInfo.userid, UDE ? (UDE["UserDirectoryID"] || UDE["PublishedDirectoryID"]) : US.FORUMROOTID, "1"], U.MD.D.PB.Pa.AsynSSQPGHBK, ["", UDID, UDE, UDPD, _UDED, false, UCB]);
  116. }
  117. //确定申请版块
  118. U.MD.D.PB.Pa.AsynSSQPGHBK = function (r) {
  119. var context = r.context, _UDID = context[1], UDE = context[2], _UDPD = context[3], _UDED = context[4], _UCB = context[6]; r = r.value; U.MD.D.H.ET.PB.SQ = false;
  120. _UDID.value = _UDID.defaultValue; U.Alert(r.UserDirectoryID ? (r.IsPublishToStudy == 2 ? ($("#UD_SYTBOXL")[0].onclick(), U.MD.D.PB.Pa.SQZJTT(UDE, r), "板块申请成功") : "申请版块成功,请等待审核...") : ((_UDID.focus() || true), "服务器繁忙,请重新填写...")); //提示
  121. (_UCB) && (_UCB(r)); //回调
  122. }
  123. //直接通过建立后使用
  124. U.MD.D.PB.Pa.SQZJTT = function (UDE, UCE) {
  125. var _UGE = U.MD.D.H.ET["NT"]["PB"], _UTF = UDE && UDE["Child"], _UIF = US.userInfo; (_UTF) && (UDE["Child"].push(UCE));
  126. if (_UTF || UDE["PublishedParentID"] == US.FORUMROOTID) {
  127. _UGE["BK"].push(U.UF.Ut.AddObj(UCE, { UserName: _UIF.UserName, UserThumbnailImageHead: _UIF.UserThumbnailImageHead }));
  128. if (!_UTF) { U.MD.D.PB.PBCKMU($("#UD_SYSXZBYPL")[0], [UCE], null, true).onclick(); } else { U.MD.D.PB.XJBKMU($("#UD_SYSXZBYT")[0], UDE["Child"], UDE) }
  129. }
  130. }
  131. //通过板块名字获取板块
  132. U.MD.D.PB.Pa.GetBKID = function (UDN, UPID, UCB) {
  133. U.UF.A.Request(US.CROSSDOMAIN, [US.DB, "UseStudio_Blog", "UB_P_S_GetPND", UPID || US.EMPTYGUID, UDN], U.MD.D.PB.Pa.AsynGetBKID, ["", UCB]);
  134. // U.UF.A.Request(US.AUTH,"pb.GetBKID", [UDN, UPID || US.EMPTYGUID]), U.MD.D.PB.Pa.AsynGetBKID, ["", UCB];
  135. }
  136. //获取板块异步
  137. U.MD.D.PB.Pa.AsynGetBKID = function (r) {
  138. var context = r.context, _UCB = context[1]; r = r.value; (_UCB) && (_UCB(r));
  139. }
  140. //删除板块
  141. U.MD.D.PB.Pa.SCBK = function (UDID, UTF, UCB) {
  142. if (!U.MD.U.L.isLogin(3)) {
  143. U.UF.A.Request(US.CROSSDOMAIN, [US.DB, "UseStudio_Blog", "UB_P_D_DeleteSubject", US.userInfo.userid, UDID, UTF ? 1 : 0]), U.MD.D.PB.Pa.AsynSCBK, ["", UDID, UCB];
  144. // U.UF.A.Request(US.AUTH,"pb.DeleteSubject", [US.userInfo.userid, UDID, UTF ? 1 : 0]), U.MD.D.PB.Pa.AsynSCBK, ["", UDID, UCB];
  145. }
  146. }
  147. //删除板块异步
  148. U.MD.D.PB.Pa.AsynSCBK = function (r) {
  149. var i, _UGE = U.MD.D.H.ET["NT"]["PB"]["BK"], context = r.context, _UDID = context[1], _UCB = context[2]; r = r.value;
  150. if (r == 1) {
  151. _UKE = _$(_UGE).Delete({ UserDirectoryID: _UDID });
  152. for (i = 0; i < _UKE.length; i++) { _UKE = _UKE.concat(_$(_UGE).Delete({ UserDirectoryParentID: _UKE[i].UserDirectoryID })); } //删除子目录
  153. }
  154. (_UCB) && (_UCB(r));
  155. }
  156. //修改板块信息
  157. U.MD.D.PB.Pa.XGBKX = function (UDID, USN, UPID, UCB) {
  158. if (!U.MD.U.L.isLogin(3)) { U.UF.A.Request(US.CROSSDOMAIN, [US.DB, "UseStudio_Blog", "UU_P_U_ModifyDirectory", US.userInfo.userid, UDID, USN, UPID || US.EMPTYGUID]), U.MD.D.PB.Pa.AsynXGBKX, ["", UCB]; }
  159. // if (!U.MD.U.L.isLogin(3)) { U.UF.A.Request(US.AUTH,"pb.ModifySubjectBG", [US.userInfo.userid, UDID, USN, UPID || US.EMPTYGUID]), U.MD.D.PB.Pa.AsynXGBKX, ["", UCB]; }
  160. }
  161. //修改板块
  162. U.MD.D.PB.Pa.AsynXGBKX = function (r) {
  163. var context = r.context, _UCB = context[1]; r = r.value; (_UCB) && (_UCB(r));
  164. }
  165. //#endregion
  166. //#region 版块收藏区域
  167. //添加收藏版块
  168. U.MD.D.PB.Pa.SCYMHBK = function (UBE, UDOD, UFN) {
  169. if (!U.MD.U.L.isLogin(3) && (!UBE["IF"] || UBE["IF"][2] != 2)) {//添加版块收藏
  170. var _UDE = ["您确认要收藏该版块吗", "AddCollect", [US.userInfo.userid, UBE.UserDirectoryID || UBE.PublishedDirectoryID]]; (UBE["IF"] && UBE["IF"][2]) && (_UDE[0] = "您取消版块收藏吗", _UDE[1] = "DCollect", _UDE[2].splice(1, 0, ""));
  171. U.Alert("服务器同步中..."); U.UF.A.Request(US.AUTH, "pb." + _UDE[1], _UDE[2], U.MD.D.PB.Pa.AsynSCYMHBK, ["", UBE, UDOD, UFN]); //添加或者删除收藏
  172. }
  173. }
  174. //推荐类添加回调
  175. U.MD.D.PB.Pa.TJSCYMHBK = function (UBE, UDOD, UDE) {
  176. if (!UBE["IF"]) { UBE["IF"] = [null, null, UDE ? 0 : 1]; } else { UBE["IF"][2] = (UDE = (UDE && UBE["IF"][2])) ? 0 : 1; }
  177. $(UDOD).addAttrArray({ "innerHTML": UDE ? "添加爱好" : "取消爱好", "className": UDOD.className.replace(" UD_SYSXRAHRCOTCOO", "") + (UDE ? "" : " UD_SYSXRAHRCOTCOO") });
  178. }
  179. //异步添加收藏
  180. U.MD.D.PB.Pa.AsynSCYMHBK = function (r) {
  181. var _UCE, _UTF = ["取消爱好", 1, 1, " UD_SYSXZBELSLXO"], _UDE = US.userInfo["SC"], _UBK = U.MD.D.H.ET["NT"]["PB"]["BK"], context = r.context, _UBE = context[1], _UDOD = context[2], _UFN = context[3], _DID = _UBE.UserDirectoryID; r = r.value;
  182. if (r && !_UFN) {
  183. _UCE = _$(_UBK).Select({ "UserDirectoryID": _DID })[0];
  184. if (_UBE["IF"] && _UBE["IF"][2]) { (_UDE) && (_$(_UDE).Delete({ "UserDirectoryID": _DID })); _UTF[0] = "添加爱好"; _UTF[1] = 0; _UTF[2] = -1; _UTF[3] = ""; U.Alert("取消对该版块的关注"); } //取消收藏后
  185. else { (_UDE) && (_UDE.unshift(_UBK || _UBE)); U.Alert("收藏成功") } //添加收藏后
  186. _UBE["DCF"] += _UTF[2]; _UBE["IF"][2] = _UTF[1]; //版块变化
  187. (_UDOD) && ($[$("#UD_SYSXZBELSLX")[0], context[2]].addAttrArray({ "innerText": _UTF[0], "className": "UD_SYSXZBELSLX" + (_UTF[3] || "") })); //修改添加或者取消
  188. }
  189. else { U.Alert("版块已收藏"); }
  190. (_UFN) && (_UFN(_UBE, _UDOD, r));
  191. }
  192. //获取用户所有的收藏
  193. U.MD.D.PB.Pa.ZSYMHBK = function (UP) {
  194. if (US.userInfo.userid) { //用户收藏版块
  195. var _UPE = 1, _UDE = US.userInfo["SC"]; (_UDE) && (_UPE = U.MD.D.D.FYGBL(_UDE, UP, [30, 300]), U.MD.D.H.PZSYMHBK((_UDE = _UPE[0])), _UPE = _UPE[1]); //打印搜藏
  196. (_UDE) && (U.UF.A.Request(US.CROSSDOMAIN, [US.DB, "UseStudio_Blog", "UB_P_S_GetUserPBCollect", US.userInfo.userid, US.userInfo.userid, _UPE * 50 - 50, _UPE * 50]), U.MD.D.PB.Pa.AsynZSYMHBK, ["", UP]); //获取用户收藏的版块
  197. // (_UDE) && (U.UF.A.Request(US.AUTH,"pb.GetCollect", [US.userInfo.userid, _UPE * 50 - 50, _UPE * 50]), U.MD.D.PB.Pa.AsynZSYMHBK, ["", UP]); //获取用户收藏的版块
  198. }
  199. else { parent.U.Alert("请登录"); } //未登录展示
  200. }
  201. //获取用户收藏异步
  202. U.MD.D.PB.Pa.AsynZSYMHBK = function (r) {
  203. var context = r.context;
  204. US.userInfo["SC"] = r = r.value; //用户收藏
  205. U.MD.D.H.PZSYMHBK();
  206. }
  207. //#endregion