Namespace.register("U.MD.D.PB.A"); //pb帖子区域 ////#region 窗体帖子 /* * 获取用户文章和版块信息 * * @param {object} 帖子信息 * @param {object} 目录信息 * @param {element} 弹框 * @param {element} 帖子内容区域 * @returns {Object} */ U.MD.D.PB.A.WAPMHBK = function (UDE, UBE, URID, UDOD) { try { if (typeof UDE == "string") { UDE = { "ArticleID": UDE, "PublishedDirectoryID": ""} }; //如果不是帖子实体自定义一个 var _UCE, _UDOD = $("#UD_SYPH")[0] || $("#UD_SYP")[0], //文章模板 _UDTD = _UDOD.id == "UD_SYP" ? _UDOD : "", //判断是否使用模板 _UGE = U.MD.D.H.ET["NT"]["PB"]["BK"], //板块信息 _UDID = UDE.PublishedDirectoryID != null ? UDE.PublishedDirectoryID : UBE["UserDirectoryID"] || ""; //论坛id if (_UDID) { UBE = UBE || U.Json.select(_UGE, { "UserDirectoryID": _UDID })[0], (!UBE) && (_UGE.push(UBE = {})) }; //获取数据来源 if (_UDTD) { //新建弹窗 _UDOD = new U.UF.UI.form("文章查看", _UDTD, { "id": "UD_SYPH", "style": { "width": "80%", "height": "80%" } }, { isnarrow: false, isenlarge: false }).form; U.UF.EV.scrollLoad(_UDOD, function () { U.MD.D.PB.Re.FGRPMHBK(_UDOD) }) } else {//窗体弹出 _UDTD = new U.UF.UI.form.allForm["UD_SYPH"].middle; $(_UDOD).Center(); _UDTD.scrollTop = 0; //初始化时候导航到顶部 _UDTD = $(new U.UF.UI.form.et["UD_SYPH"].middle).Child()[0]; //内容元素 } if (UBE && UBE["IF"] || !U.UF.Ut.isEmpty(UBE)) { //数据存在直接打印 if (UDE["ArticleID"]) { //打印帖子 U.MD.D.PB.A.APMHBK(UDE, UBE, _UDTD, UDOD); //帖子内容输出 U.MD.D.PB.Re.RPMHBK(UDE, 1, URID); //评论内容输出 } else { U.MD.D.PB.YMHBK(UBE); } if ((_UCE = US.forum.news) && (U.Json.select((_UCE = _UCE[0]), { "ArticleID": UDE["ArticleID"] }))[0]) { U.MD.D.Blog.N.SNXX(UDE.ArticleID, _UCE); } U.MD.N.UrlWrite["pbt", UDE["ArticleID"]], UDE["ArticleTitle"]; //设置url提示 } else { //帖子打印 U.A.Request(US.AUTH, ["GetPND", _UDID || US.EMPTYGUID, (US.userInfo.userid || US.EMPTYGUID), UDE.ArticleID]), U.MD.D.PB.A.AsynWAPMHBK, [[_UDTD, true], UDE, _UGE, UBE, URID, UDOD]; //获取后腰数据 } } catch (e) { } } //获取用户版块异步 U.MD.D.PB.A.AsynWAPMHBK = function (r) { var _context = r.context, _UDE = _context[1], //帖子信息 _UGE = _context[2], //板块信息 _UBE = _context[3] || {}, //当前板块信息 _URID = _context[4], //回复内容 _UDOD = _context[5]; //板块内文章元素 r = r.value; U.MD.D.PB.CLYMHBK(U.MD.D.H.ET["NT"]["PB"]["BK"], _UBE, r[0], _UBE.PublishedDirectoryID); //文章目录信息处理 U.UF.C.AddObj(_UDE, (_UDE["IF"] = r[1][0])); //给文章添加详细信息 U.MD.D.PB.A.WAPMHBK(_UDE, _UBE, _URID, _UDOD); //打印文章 } /** * 打印用户文章区域 * * @param {object} 帖子信息 * @param {object} 目录信息 * @param {element} 帖子内容区域 * @param {element} 板块页面上的帖子元素 * @returns {Object} */ U.MD.D.PB.A.APMHBK = function (UDE, UBE, UDOD, UDTD) { if (UDE["IF"]) { //选择文章和版块 var _UGE = U.MD.D.H.ET["NT"]["PB"]; UBE = UBE || U.Json.selectOne(_UGE["BK"], { "UserDirectoryID": UDE.PublishedDirectoryID }); U.MD.D.PB.A.PAPMHBK(UDE, UBE, UDOD, UDTD); _UGE["DWZ"] = UDE; } else { U.A.Request(US.CD, [US.DB, "UseStudio_Blog", "UB_P_S_SelectArticleInformation", UDE.ArticleID], U.MD.D.PB.A.AsynAPMHBK, [[UDOD, true], UDE, UBE, UDOD, UDTD]); // U.A.Request(US.AUTH,"pb.ArticleContent", [UDE.ArticleID, "PB"], U.MD.D.PB.A.AsynAPMHBK, [[UDOD, true], UDE, UBE, UDOD, UDTD]); } //获取用户文章 } //用户文章异步 U.MD.D.PB.A.AsynAPMHBK = function (r) { var _context = r.context, _UDE = _context[1], //帖子信息 _UBE = _context[2], //目录信息 _UDOD = _context[3], //弹框 _UDTD = _context[4]; //帖子内容区域 r = r.value; _UDE["IF"] = r[0]; //给帖子添加内容 U.MD.D.PB.A.APMHBK(_UDE, _UBE, _UDOD, _UDTD); //打印文章 } /** * 文章展示 * * @param {object} 帖子信息 * @param {object} 目录信息 * @param {element} 帖子内容区域 * @param {element} 板块页面上的帖子元素 * @returns {Object} */ U.MD.D.PB.A.PAPMHBK = function (UDE, UBE, UDOD, UDTD) { var _UDCD, _UIMG = [], _UIF = UDE["IF"], //各个部分的元素,文章详细信息 _userid = US.userInfo.userid, //用户id _UDAD = $(UDOD).Child(); //内容 //头部 _UDCD = $("div", _UDAD[0]); //头部区域 _UDCD[3].innerHTML = _UIF.ArticleTitle; //标题 $($("img", _UDCD[0])[0] || $$("img", {}, _UDCD[0])).addAttrArray({ //用户头像 "onerror": U.MD.C.imgError, "alt": _UIF.UserNickName, "onclick": function () { U.MD.U.V.ViewOtherUserInfo(_UIF.UserID); }, "src": U.MD.C.getHeadImage(_UIF.UserThumbnailImageHead) }); $(_UDCD[4]).addAttrArray({ "style": { "display": (_userid && UDE.UserID == _userid) ? "block" : "none" }, //是否具有编辑的权限 "title": "编辑修改", "innerHTML": "编辑修改", "onclick": function () { U.MD.D.PB.A.PAPMHPJ(UDE, _UDAD[1], _UDCD[3], UDTD); } }); _UDCD[6].innerText = _UIF.UserNickName; //用户名 _UDCD[7].innerText = U.UF.D.getDateInterval(_UIF.ArticleAddTime); //发帖子时间 //内容 $(_UDAD[1]).addAttrArray({ "innerHTML": _UIF.ArticleContent, "className": "UD_SYPCLCC" }); _UDCD = $("img", _UDAD[1]); for (i = 0; i < _UDCD.length; i++) { //给图片添加弹出图片阅览器 _UIMG.push({ "Time": UDE.ArticleAddTime, "Thm": _UDCD[i].src, "Img": _UDCD[i].alt.indexOf(US.FILESYSTEMURL) > -1 ? _UDCD[i].alt : _UDCD[i].src }); $(_UDCD[i]).addAttrArray({ "style": { "cssText": "" }, "onclick": function () { U.UF.EV.stopBubble(); U.MD.I.Img(_UIF, _UIMG, i); } }); //给图片添加点击事件 } $("a", _UDAD[1]).addAttrArray({ "target": "_blank" }); //当前页面不跳转 //信息 _UDCD = $("div", _UDAD[2]); _UDCD[1].innerHTML = 0; //分享数 _UDCD[4].innerHTML = _UIF.ArticleReplayNumber; //评论数 _UDCD[7].innerHTML = _UIF.AricitleReadNumber; //浏览数 //评论 _UDCD = $("div", _UDAD[3]); _UDCD[2].innerText = "发表评论..."; //发表的内容 _UDCD[14].onclick = function () { U.MD.D.PB.Re.APRPMHBK(null, _UDCD[2], UDE); }; //发帖的按钮 UDOD.style.display = "block"; //显示 } //#endregion //#region 功能区域 //#region 修改的帖子 //窗体修改弹出 U.MD.D.PB.A.PAPMHPJ = function (UDE, UDOD, UDTD, UDSD) { U.MD.D.PB.A.FBTZTC(null, UDE, function () { U.MD.D.PB.A.PAPMHTJ(UDE); U.MD.D.PB.A.ModifyA(UDE, UDOD, UDTD, UDSD); }); } //提交 U.MD.D.PB.A.PAPMHTJ = function (UDE, UDOD, cb) { if (!U.MD.U.L.isLogin()) { var _UAT, _UIT = "", _UST = UDOD.innerHTML || UDOD; U.UF.C.isFunction(cb) ? "" : ((_UIT = arguments[2] || ""), cb = arguments[3]); if (U.UF.C.isString(UDE)) { UDE = { ArticleID: UDE, ArticleTitle: _UIT, ArticleContent: _UST} }; if (_UIT.length == 0 || _UIT.length > 40) { _UAT = "标题太长或者为空"; } else if (_UST.length < 1) { _UAT = "内容太长或者为空"; } else { U.UF.C.AddObj([UDE, UDE["IF"] || {}], { ArticleContentBrief: _UST, ArticleTitle: _UIT, ArticleContent: _UST }); U.A.Request(US.CD, [US.DB, "UseStudio_Blog", "UU_P_U_ModifyArticle", US.userInfo.userid, UDE.ArticleID, _UIT, _UST, U.UF.C.getBriefText(_UST)]), U.MD.D.PB.A.AsynPAPMHTJ, ["", cb]; // U.A.Request(US.AUTH,"pb.modifyarticle", [US.userInfo.userid, UDE.ArticleID, _UIT, _UST], U.MD.D.PB.A.AsynPAPMHTJ, ["", cb]); } U.Alert(_UAT || "同步中"); return !_UAT; } } //提交文章异步 U.MD.D.PB.A.AsynPAPMHTJ = function (r) { U.Alert("修改成功"); var _UCB = r.context[1]; r = r.value; if (_UCB) { _UCB(r) }; } //成功提交后修改帖子内容 U.MD.D.PB.A.ModifyA = function (UDE, UDOD, UDTD, UDSD) { var _UTF, _UDPD, _UIMG, _UDMD, _UDKD, _UDRD; $("div", UDSD)[5].innerHTML = UDTD.innerHTML = UDE.ArticleTitle; UDOD.innerHTML = UDE.IF.ArticleContent; (_UDMD = $("div", UDSD)[13]).innerHTML = UDE.ArticleContentBrief; _UDPD = $(_UDMD).Parent(); _UDKD = $(_UDPD).Child(); _UIMG = $("img", _UDMD)[0]; _UDMD.innerText = _UDMD.innerText.trim(); if (_UIMG) { if (_UDKD.length > 1) { _UDRD = $(_UDKD[1]).Child()[0]; _UDRD.innerText = ""; } else { if ((_UDMD.innerText = _UDMD.innerText.addEllipsis(200)) == "") { _UDMD.style.display = "none"; _UTF = true; }; _UDKD = $$("div",{ "className": "UD_SYSXZBPOCR", "style": { "marginTop": _UTF ? "0px" : "", "height": (222 - Math.ceil(_UDMD.innerText.count() / 52) * 20) + "px" } }, $(_UDMD).Parent()); _UDRD = $$("div", { "onclick": function () { } }, _UDKD); } U.MD.D.H.JZTPJS(_UIMG.src, _UDRD, UDE); } else if (_UDKD[1]) { $(_UDKD[1]).remove(); } } //#endregion //#region 版块搜索帖子 //搜索帖子 U.MD.D.PB.A.TZSS = function (UDOD, UP, UDID) { var _UGE = U.MD.D.H.ET["NT"]["PB"], _userid = US.userInfo.userid, _UBE = _UGE["DBK"], _UDV = UDOD.value.trim().addEllipsis(50).valueOf(); if (UDOD.value != UDOD.defaultValue && _UDV) { _UGE["USID"] = [_UDV, UDID = (UDID || (_UBE && _UBE["UserDirectoryID"]) || US.EMPTYGUID), _UGE["USID"] == _userid ? _userid : US.EMPTYGUID]; U.MD.D.PB.A.FTZSS(_UDV, UP, UDID, _UGE["USID"][2]); } //搜索帖子 else { U.Alert("请正确的输入.."); } } //获取搜索帖子 U.MD.D.PB.A.FTZSS = function (UDV, UP, UDID, userid) { var _UDTD = $("#UD_SYSXZBYPR")[0], _UE = UP * 30, _US = _UE - 29; if (UP == 1) { _UDTD.innerText = "" }; U.A.Request(US.CD, [US.DB, "UseStudio_Blog", "UB_P_S_PostSearch", UDID, UDV, _US, _UE, userid], U.MD.D.PB.A.AsynTZSS, [[UP == 1 ? _UDTD : UD_SYSXZBYPD, true], _UDTD, UP]); //获取搜索的帖子 // U.A.Request(US.AUTH,"pb.SearchArtlce", [UDV, _US, _UE, UDID, userid], U.MD.D.PB.A.AsynTZSS, [[UP == 1 ? _UDTD : UD_SYSXZBYPD, true], _UDTD, UP]); //获取搜索的帖子 } //搜索帖子异步 U.MD.D.PB.A.AsynTZSS = function (r) { var _context = r.context, _UDOD = _context[1], _UP = _context[2]; r = r.value; if (r) {//打印搜索 if (_UP == 1) { _UDOD.innerText = ""; if (!r.length) { U.MD.D.PB.PMHBKK(_UDOD) }; } if (r.length) { U.MD.D.PB.NSYPBL(_UDOD, r) }; } } //#endregion //#region 发表功能 //弹出发表帖子 U.MD.D.PB.A.FBTZTC = function (UDID, UAE, cb) { if (!U.MD.U.L.isLogin()) { var _UDBD, _UDTD = $("#UD_SYSXZBFCA"), _UDOD = document.body, UDID = U.UF.C.isString(UDID) ? UDID : null, _UDE = UDID ? (U.Json.select(U.MD.D.H.ET["NT"]["PB"]["BK"], { UserDirectoryID: UDID })[0] || { UserDirectoryID: UDID }) : (U.MD.D.H.ET["NT"]["PB"]["DBK"] || null); if (_UDE) { return U.UF.UI.EditorLoad({ id: "PB_Editor", head: true, isc: false, name: UAE ? "帖子修改" : _UDE.UserDirectoryName + "帖子发表", title: UAE ? UAE.ArticleTitle : "", context: UAE ? UAE.IF.ArticleContent : "", fcb: function () { U.MD.D.PB.A.FBTZMU(_UDE, cb); } }); } else { U.Alert("请选择版块.."); } } } //我要发布点击 U.MD.D.PB.A.DJWYFB = function () { var i, _UDE = U.MD.D.H.ET["NT"]["PB"]["DBK"]; if (_UDE) { $("#UD_SYSXZBFCAC")[0].onmousedown(); } //直接选择发帖 else {//跳转到最新里查看发帖 _UDE = ["UD_SYSSTO", "UD_SYSXZBTOC"]; for (i = 0; i < _UDE.length; i++) { $("#" + _UDE[i]).Child()[1].onclick(); } U.Alert("请选择目录!"); } } //发表帖子 U.MD.D.PB.A.FBTZMU = function (UDE, cb, UCT, UTI) { return !U.MD.D.PB.A.FBMSSBK(UDE, UTI, UCT, cb || U.MD.D.PB.A.AFBTZMU); } //发表帖子函数 U.MD.D.PB.A.FBMSSBK = function (UDE, UTI, UCT, cb) { var _UAT = "请登录发帖"; if ((_UAT = U.MD.D.PB.A.FBMSSBKG(UDE, UTI, UCT, cb)) === true) { _UAT = "正在提交请稍后"; return true; }; if (_UAT) { U.Alert(_UAT) }; return false; } //发表帖子处理 U.MD.D.PB.A.FBMSSBKG = function (UDE, UIT, UTH, cb) { if (!U.MD.U.L.isLogin()) { if (UIT.trim().length == 0 || UIT.trim().length > 40) { _UAT = "标题太长或者为空"; } else if ($$("div",{"innerHTML": UTH}).innerText.trim().length < 0) { _UAT = "内容太长或者为空"; } //不合格的发帖 else { if (U.UF.C.isString(UDE)) { UDE = { UserDirectoryID: UDE} }; U.A.Request(US.AUTH, ["addArticle", UDE.UserDirectoryID, UIT, UTH, "false"], U.MD.D.PB.A.AsynFBMSSBKG, ["", UDE, UIT, UTH, cb]); return true; } //合格的发帖 return _UAT; //函数回调 } } //发表帖子成功的异步 U.MD.D.PB.A.AsynFBMSSBKG = function (r) { var _UCE, _UBE, _UDOD = $("#UD_SYSXZBYPR")[0], _context = r.context, _UDE = _context[1], _UCB = _context[4], _UTF = "服务器繁忙"; r = r.value; _UCE = new U.MD.D.PB.A.BMSSBTI[0, U.UF.D.toTimeStamp(new Date()), _context[3], _context[3], r, 0, _context[2], US.userInfo.userid, US.userInfo.UserNickName, US.userInfo.UserThumbnailImageHead] if (r) { _UTF = "发表成功"; if (_UDE["IF"] || US.userInfo.PB) { $("#UD_SYSXZBELSD div")[2] = (_UDE.ACF++) + 1; _UBE = _UDE["IF"] ? _UDE["IF"][0][1] : US.userInfo.PB[1][_UDE.UserDirectoryID][1]; if (!_UBE.length) { _UDOD.innerText = "" }; _UBE.unshift(_UCE); //添加发帖内容 } if (_UCB) { _UCB(_UCE, _UDE) }; //回调查看 } U.Alert(_UTF); //添加文章 } //发帖子结束处理 U.MD.D.PB.A.AFBTZMU = function (UCE, UDE) { U.MD.D.PB.NSYPBL($("#UD_SYSXZBYPR")[0], [UCE], UDE, true); } //发表帖子的变化 U.MD.D.PB.A.BMSSBK = function (UDOD, UDE, UCE, UTF) { try { if (UDOD) { var _UH, _UDSD, _UPH, _UDPD = UDOD.parentNode, _UDMD = $("#UD_SYSXZBFC"), _UDAD = $(_UDPD).Child(); if ((UTF == "none" || (UTF == "block" && $("#UD_SYSXZBFCATDO").parentElement().css("display") == "none")) && _UDMD) {// if (UTF == "none" && ((_UDSD = _UDPD.parentNode) != _UDMD[0])) { _UDMD.append($(_UDPD).addAttrArray({ "onmousedown": function () { U.MD.D.H.WZTJQ(null, $(_UDPD).Child()[1]); U.UF.EV.stopBubble(); }, "style": { "position": ""} })) }; _UDAD[_UDAD.length - 1].style.display = _UDAD[_UDAD.length - 2].style.display = _UDAD[0].style.display = UTF; UCE["height"] = ""; $(_UDPD).addAttrArray({ "style": UDE }); $(UDOD).addAttrArray({ "style": UCE }); //头部或者底部是否显示 _UPH = $(_UDPD).height(); if (_UPH) { UDOD.style.height = _UPH - ($(_UDAD[0]).height() + $(_UDAD[2]).height() + 20) + "px" }; return true; } } } catch (e) { } if (UTF != "block") { U.UF.F.CloseWindow($(UDOD).Parent(), "remove") }; } //发帖子窗体变化 U.MD.D.PB.A.BMSSBKSB = function (UDOD) { var _UDPD = $(UDOD).parentElement(2), _UDAD = _UDPD.childs(); _UDAD.css("height", _UDPD.height() - _UDAD.height(0) - _UDAD.height(2) - 22 + "px", 1); } //取消发表帖子函数 U.MD.D.PB.A.QXFBMSSBK = function (UDOD) { var _UDPD = $(UDOD).Parent(2), _UDAD = $(_UDPD).Child(); $("input", _UDPD)[0].value = _UDAD[1].innerText = ""; U.MD.D.PB.A.BMSSBK(_UDAD[1], { "cssText": "" }, { "textIndent": "10px", "color": "#000" }, "none"); } //帖子的实体 U.MD.D.PB.A.BMSSBTI = function (UDE) { this.AricitleReadNumber = UDE[0]; this.ArticleAddTime = UDE[1]; this.ArticleContent = UDE[2]; this.ArticleContentBrief = UDE[3]; this.ArticleID = UDE[4]; this.ArticleReplayNumber = UDE[5]; this.ArticleTitle = UDE[6]; this.UserID = UDE[7]; this.UserNickName = UDE[8]; this.UserThumbnailImageHead = UDE[9]; } //#endregion //#endregion