123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- Namespace.register("U.MD.D.PB.Pa"); //板块处理
- //#region 获取板块信息
- //#endregion
- //#region 搜索板块
- //出现搜索
- U.MD.D.PB.Pa.BKSSBK = function (UDOD, UTF) {
- var _UDAD = $(UDOD).Child(), _UDID = $("input", UDOD)[1];
- if (UTF[1] == "block" || _UDID.value == "") {
- _UDAD[0].style.display = UTF[0]; _UDAD[1].style.display = UTF[1];
- (UTF[1] == "block") && ($("input", _UDAD[1])[0].focus());
- }
- }
- //版块内的搜索
- U.MD.D.PB.Pa.BSBKSSBKO = function (UDOD) {
- var _UDTD = $("#UD_SYSXZBALSTI"), _UDSD = $("input", _UDTD.Parent())[0], _UDID = $("input", UDOD.parentNode)[0];
- if (_UDID.value != _UDID.defaultValue) { _UDSD.value = _UDID.value; U.MD.D.PB.Pa.SBKSSBKO(_UDTD[0]); }
- }
- //搜索单个版块
- U.MD.D.PB.Pa.SBKSSBKO = function (UDOD, UFN) {
- 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();
- if (_UDV && _UDID.value != _UDID.defaultValue) {
- _UDE = _$(_UGE).Select({ "UserDirectoryName": _UDV })[0]
- if (_UDE) { U.MD.D.PB.DJPBCKMU(_UDE); } //搜索有结果直接打印结果
- else {//后台搜索结果
- U.UF.A.Request(US.AUTH, ["GetZDKM", _UDV], U.MD.D.PB.Pa.AsynSBKSSBKO, [[$("#UD_SYSXZBALZ")[0], true], _UDTD, _UDV, _UGE, UFN]);
- return;
- }
- }
- U.MD.D.PB.Pa.XSYCBK(_UDTD, _UCE);
- }
- //搜索版块异步
- U.MD.D.PB.Pa.AsynSBKSSBKO = function (r) {
- 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;
- if ((_UCE = r[0]) && _UCE[0]) { _UDE = ["none", "block"]; _UGE.push(_UCE[0]); U.MD.D.PB.DJPBCKMU(_UCE[0]); } //打印信息
- else { U.MD.D.PB.Pa.PKSBKSSBK(_UDAD[0], r[1], _UDV, _UFN); } //无搜索结果 显示相关的信息
- U.MD.D.PB.Pa.XSYCBK(_UDOD, _UDE); //显示
- }
- //搜索版块无结果
- U.MD.D.PB.Pa.PKSBKSSBK = function (UDOD, UDE, UDV, UFN) {
- var i, _UDTD, _UDSD; UDOD.innerText = "";
- $$("div", { "className": "UD_SYSXZBATO", "innerHTML": "暂时找不到<span> \"" + UDV + "\" </span>版块" }, UDOD);
- if (UDE.length) {//有类似的结果
- _UDTD = $$("div", { "className": "UD_SYSXZBATC" }, UDOD);
- $$("div", { "className": "UD_SYSXZBATCL", "innerHTML": "是不是在找?" }, _UDTD);
- _UDSD = $$("div", { "className": "UD_SYSXZBATCR" }, _UDTD);
- 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); }
- }
- $$("div", { "className": "UD_SYSXZBATD", "innerHTML": "返回上一步 >", "onclick": UFN || [[U.MD.D.PB.Pa.XSYCBK, [UDOD.parentNode, ["none", "block"]]]] }, UDOD);
- }
- //显示隐藏版块
- U.MD.D.PB.Pa.XSYCBK = function (UDPD, UDE) {
- var i, _UDAD = $(UDPD).Child(); UDE = UDE || ["none", "block"];
- for (i = 0; i < UDE.length; i++) { _UDAD[i].style.display = UDE[i]; }
- }
- //#endregion
- //#region 申请版块
- //申请版块
- U.MD.D.PB.Pa.SQPGHBK = function (UCE, UCB) {
- if (!U.MD.U.L.isLogin(3)) {
- 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];
- 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": "学习系统" }; }
- 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;
- 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) };
- _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();
- }
- //else { U.MD.D.H.ET.DLHD = [U.UF.M.apply(this, [[U.MD.D.H.SYQHL, []]])]; } //切换会动静页面
- }
- //设置申请版块确定
- U.MD.D.PB.Pa.SZSQPGHBKTS = function (UDE, UDOD, UDTD, UCB) {
- $("#UD_SYTBOXR")[0].onclick = U.UF.M.apply(this, [[U.MD.D.PB.Pa.QDSQPGHBK, [UDOD, UDE[UDTD.selectedIndex], UCB]]]);
- }
- //申请版块提示
- U.MD.D.PB.Pa.SQPGHBKTS = function (UDID, UNS) {
- $(UDID).addAttrArray({ "innerHTML": UNS, "style": { "display": "block"} });
- }
- //点击申请版块
- U.MD.D.PB.Pa.QDSQPGHBK = function (UDOD, UDE, UCB) {
- if (!U.MD.D.H.ET.PB.SQ) { //暂无申请
- var _UDN, _UTS, _UTF,
- _UFT = (event.type != "blur"), //判断时间
- _UDE = UDE || U.MD.D.H.ET["NT"]["PB"]["DBK"], //当前所在的板块
- _UDPD = $(UDOD).Parent(5),
- _UDED = $("i", _UDPD)[0],
- _UDTD = $("div", _UDPD);
- _UDTD = _UDTD[_UDTD.length - 2];
- if ((_UDN = UDOD.value) && _UDN != UDOD.defaultValue) {//如果没有任何输入就不提示
- if ((_UTF = U.UF.S.FFZF.test(_UDN)) && _UDN.length) { //输入限制
- U.MD.D.H.ET.PB.SQ = true;
- U.UF.A.Request(US.AUTH, ["IsDName", _UDN, US.userInfo.userid, _UDE ? (_UDE["UserDirectoryID"] || _UDE["PublishedDirectoryID"]) : US.FORUMROOTID, "1", _UFT],
- U.MD.D.PB.Pa.AsynQDSQPGHBK, ["", UDOD, UDE, _UDPD, _UDED, _UFT, UCB]); _UTS = "检测中...";
- }
- U.MD.D.PB.Pa.SQPGHBKTS(_UDED, _UTS || (_UTF ? "输入内容长度不允许大于50" : "不允许输入特殊字符")); //提示
- }
- }
- }
- //点击确定或者回车等待建立
- U.MD.D.PB.Pa.DDJL = function (UDOD) {
- UDOD.onclick(true);
- }
- //申请版块提示 判断申请的版块是否存在
- U.MD.D.PB.Pa.AsynQDSQPGHBK = function (r) {
- 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;
- if (_UTD && r.value.UserDirectoryID) { U.MD.D.PB.Pa.AsynSSQPGHBK(r); } //直接请求数据返回
- else {//查看是否为特殊字符
- 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); } //版块名允许建立
- (r === 0) && (_UTS = "此板块已有申请信息, 等待审核!"); (r === 1) && (_UTS = "此板块信息含有不法信息无法建立!"); U.MD.D.PB.Pa.SQPGHBKTS(_UDED, _UTS);
- }
- }
- //确定申请版块
- U.MD.D.PB.Pa.SSQPGHBK = function (UDOD, UDID, UDPD, UDE, UCB) {
- var _UDED = $("i", UDPD)[0],
- _UDN = UDID.value;
- U.MD.D.H.ET.PB.SQ = true;
- U.MD.D.PB.Pa.SQPGHBKTS(_UDED, "等待服务器响应");
- 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]);
- }
- //确定申请版块
- U.MD.D.PB.Pa.AsynSSQPGHBK = function (r) {
- 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;
- _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), "服务器繁忙,请重新填写...")); //提示
- (_UCB) && (_UCB(r)); //回调
- }
- //直接通过建立后使用
- U.MD.D.PB.Pa.SQZJTT = function (UDE, UCE) {
- var _UGE = U.MD.D.H.ET["NT"]["PB"], _UTF = UDE && UDE["Child"], _UIF = US.userInfo; (_UTF) && (UDE["Child"].push(UCE));
- if (_UTF || UDE["PublishedParentID"] == US.FORUMROOTID) {
- _UGE["BK"].push(U.UF.Ut.AddObj(UCE, { UserName: _UIF.UserName, UserThumbnailImageHead: _UIF.UserThumbnailImageHead }));
- 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) }
- }
- }
- //通过板块名字获取板块
- U.MD.D.PB.Pa.GetBKID = function (UDN, UPID, UCB) {
- 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]);
- // U.UF.A.Request(US.AUTH,"pb.GetBKID", [UDN, UPID || US.EMPTYGUID]), U.MD.D.PB.Pa.AsynGetBKID, ["", UCB];
- }
- //获取板块异步
- U.MD.D.PB.Pa.AsynGetBKID = function (r) {
- var context = r.context, _UCB = context[1]; r = r.value; (_UCB) && (_UCB(r));
- }
- //删除板块
- U.MD.D.PB.Pa.SCBK = function (UDID, UTF, UCB) {
- if (!U.MD.U.L.isLogin(3)) {
- 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];
- // U.UF.A.Request(US.AUTH,"pb.DeleteSubject", [US.userInfo.userid, UDID, UTF ? 1 : 0]), U.MD.D.PB.Pa.AsynSCBK, ["", UDID, UCB];
- }
- }
- //删除板块异步
- U.MD.D.PB.Pa.AsynSCBK = function (r) {
- var i, _UGE = U.MD.D.H.ET["NT"]["PB"]["BK"], context = r.context, _UDID = context[1], _UCB = context[2]; r = r.value;
- if (r == 1) {
- _UKE = _$(_UGE).Delete({ UserDirectoryID: _UDID });
- for (i = 0; i < _UKE.length; i++) { _UKE = _UKE.concat(_$(_UGE).Delete({ UserDirectoryParentID: _UKE[i].UserDirectoryID })); } //删除子目录
- }
- (_UCB) && (_UCB(r));
- }
- //修改板块信息
- U.MD.D.PB.Pa.XGBKX = function (UDID, USN, UPID, UCB) {
- 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]; }
- // 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]; }
- }
- //修改板块
- U.MD.D.PB.Pa.AsynXGBKX = function (r) {
- var context = r.context, _UCB = context[1]; r = r.value; (_UCB) && (_UCB(r));
- }
- //#endregion
- //#region 版块收藏区域
- //添加收藏版块
- U.MD.D.PB.Pa.SCYMHBK = function (UBE, UDOD, UFN) {
- if (!U.MD.U.L.isLogin(3) && (!UBE["IF"] || UBE["IF"][2] != 2)) {//添加版块收藏
- 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, ""));
- U.Alert("服务器同步中..."); U.UF.A.Request(US.AUTH, "pb." + _UDE[1], _UDE[2], U.MD.D.PB.Pa.AsynSCYMHBK, ["", UBE, UDOD, UFN]); //添加或者删除收藏
- }
- }
- //推荐类添加回调
- U.MD.D.PB.Pa.TJSCYMHBK = function (UBE, UDOD, UDE) {
- if (!UBE["IF"]) { UBE["IF"] = [null, null, UDE ? 0 : 1]; } else { UBE["IF"][2] = (UDE = (UDE && UBE["IF"][2])) ? 0 : 1; }
- $(UDOD).addAttrArray({ "innerHTML": UDE ? "添加爱好" : "取消爱好", "className": UDOD.className.replace(" UD_SYSXRAHRCOTCOO", "") + (UDE ? "" : " UD_SYSXRAHRCOTCOO") });
- }
- //异步添加收藏
- U.MD.D.PB.Pa.AsynSCYMHBK = function (r) {
- 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;
- if (r && !_UFN) {
- _UCE = _$(_UBK).Select({ "UserDirectoryID": _DID })[0];
- if (_UBE["IF"] && _UBE["IF"][2]) { (_UDE) && (_$(_UDE).Delete({ "UserDirectoryID": _DID })); _UTF[0] = "添加爱好"; _UTF[1] = 0; _UTF[2] = -1; _UTF[3] = ""; U.Alert("取消对该版块的关注"); } //取消收藏后
- else { (_UDE) && (_UDE.unshift(_UBK || _UBE)); U.Alert("收藏成功") } //添加收藏后
- _UBE["DCF"] += _UTF[2]; _UBE["IF"][2] = _UTF[1]; //版块变化
- (_UDOD) && ($[$("#UD_SYSXZBELSLX")[0], context[2]].addAttrArray({ "innerText": _UTF[0], "className": "UD_SYSXZBELSLX" + (_UTF[3] || "") })); //修改添加或者取消
- }
- else { U.Alert("版块已收藏"); }
- (_UFN) && (_UFN(_UBE, _UDOD, r));
- }
- //获取用户所有的收藏
- U.MD.D.PB.Pa.ZSYMHBK = function (UP) {
- if (US.userInfo.userid) { //用户收藏版块
- 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]); //打印搜藏
- (_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]); //获取用户收藏的版块
- // (_UDE) && (U.UF.A.Request(US.AUTH,"pb.GetCollect", [US.userInfo.userid, _UPE * 50 - 50, _UPE * 50]), U.MD.D.PB.Pa.AsynZSYMHBK, ["", UP]); //获取用户收藏的版块
- }
- else { parent.U.Alert("请登录"); } //未登录展示
- }
- //获取用户收藏异步
- U.MD.D.PB.Pa.AsynZSYMHBK = function (r) {
- var context = r.context;
- US.userInfo["SC"] = r = r.value; //用户收藏
- U.MD.D.H.PZSYMHBK();
- }
- //#endregion
|