123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- 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 {
- (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
- (_UDID) && (UBE = UBE || _$(_UGE).Select({ "UserDirectoryID": _UDID })[0], (!UBE) && (_UGE.push(UBE = {}))); //获取数据来源
- if (_UDTD) { //新建弹窗
- _UDOD = U.UF.UI.Form({ min: false, max: false, id: "UD_SYPH", style: { width: "80%", height: "80%" }, content: _UDTD, //调用弹窗
- title: "<div class='UD_SYF_STI'>文章查看</div>", bst: { style: { "overflow": "auto" }, onscroll: U.UF.M.SSCH({ "AF": U.MD.D.PB.Re.FGRPMHBK }).SCH() }, hst: { style: { "padding": "0"}} //页面滚动加载评论
- }).be;
- }
- else {//窗体弹出
- _UDTD = U.UF.UI.Form.et["UD_SYPH"].body;
- $(_UDOD).Center(); _UDTD.scrollTop = 0; //初始化时候导航到顶部
- _UDTD = $(U.UF.UI.Form.et["UD_SYPH"].body).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) && (_$((_UCE = _UCE[0])).Select({ "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.UF.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.Ut.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 || _$(_UGE["BK"]).FindOne({ "UserDirectoryID": UDE.PublishedDirectoryID });
- U.MD.D.PB.A.PAPMHBK(UDE, UBE, UDOD, UDTD); _UGE["DWZ"] = UDE;
- }
- else {
- U.UF.A.Request(US.CROSSDOMAIN, [US.DB, "UseStudio_Blog", "UB_P_S_SelectArticleInformation", UDE.ArticleID], U.MD.D.PB.A.AsynAPMHBK, [[UDOD, true], UDE, UBE, UDOD, UDTD]);
- // U.UF.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.UF.M.ImgError, "alt": _UIF.UserNickName,
- "onclick": [[U.MD.U.I.ViewOtherUserInfo, [_UIF.UserID]]],
- "src": U.UF.M.GetImgU(_UIF.UserThumbnailImageHead)
- });
- $(_UDCD[4]).addAttrArray({ "style": { "display": (_userid && UDE.UserID == _userid) ? "block" : "none" }, //是否具有编辑的权限
- "title": "编辑修改", "innerHTML": "编辑修改",
- "onclick": [[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": [[U.UF.M.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 = U.UF.M.apply(this, [[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, U.UF.M.apply(null, [[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, UCB) {
- if (!U.MD.U.L.isLogin(3)) {
- var _UAT, _UIT = "", _UST = UDOD.innerHTML || UDOD; U.UF.Ut.isFunction(UCB) ? "" : ((_UIT = arguments[2] || ""), UCB = arguments[3]); (U.UF.Ut.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.Ut.AddObj([UDE, UDE["IF"] || {}], { ArticleContentBrief: _UST, ArticleTitle: _UIT, ArticleContent: _UST });
- U.UF.A.Request(US.CROSSDOMAIN, [US.DB, "UseStudio_Blog", "UU_P_U_ModifyArticle", US.userInfo.userid, UDE.ArticleID, _UIT, _UST, U.UF.M.Shorttext(_UST)]), U.MD.D.PB.A.AsynPAPMHTJ, ["", UCB];
- // U.UF.A.Request(US.AUTH,"pb.modifyarticle", [US.userInfo.userid, UDE.ArticleID, _UIT, _UST], U.MD.D.PB.A.AsynPAPMHTJ, ["", UCB]);
- }
- U.Alert(_UAT || "同步中"); return !_UAT;
- }
- }
- //提交文章异步
- U.MD.D.PB.A.AsynPAPMHTJ = function (r) {
- U.Alert("修改成功"); var _UCB = r.context[1]; r = r.value; (_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": U.UF.M.apply() }, _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; (UP == 1) && (_UDTD.innerText = "");
- U.UF.A.Request(US.CROSSDOMAIN, [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.UF.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 = "";
- (!r.length) && (U.MD.D.PB.PMHBKK(_UDOD));
- }
- (r.length) && (U.MD.D.PB.NSYPBL(_UDOD, r));
- }
- }
- //#endregion
- //#region 发表功能
- //弹出发表帖子
- U.MD.D.PB.A.FBTZTC = function (UDID, UAE, UCB) {
- if (!U.MD.U.L.isLogin(3)) {
- var _UDBD, _UDTD = $("#UD_SYSXZBFCA"),
- _UDOD = document.body,
- UDID = U.UF.Ut.isString(UDID) ? UDID : null,
- _UDE = UDID ? (_$(U.MD.D.H.ET["NT"]["PB"]["BK"]).Select({ 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: U.UF.M.apply(_UDBD, [[U.MD.D.PB.A.FBTZMU, [_UDE, UCB]]])
- });
- }
- 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, UCB, UCT, UTI) {
- return !U.MD.D.PB.A.FBMSSBK(UDE, UTI, UCT, UCB || U.MD.D.PB.A.AFBTZMU);
- }
- //发表帖子函数
- U.MD.D.PB.A.FBMSSBK = function (UDE, UTI, UCT, UCB) {
- var _UAT = "请登录发帖"; if ((_UAT = U.MD.D.PB.A.FBMSSBKG(UDE, UTI, UCT, UCB)) === true) { _UAT = "正在提交请稍后"; return true; }; (_UAT) && (U.Alert(_UAT)); return false;
- }
- //发表帖子处理
- U.MD.D.PB.A.FBMSSBKG = function (UDE, UIT, UTH, UCB) {
- if (!U.MD.U.L.isLogin(3)) {
- if (UIT.trim().length == 0 || UIT.trim().length > 40) { _UAT = "标题太长或者为空"; }
- else if ($$("div", { "innerHTML": UTH }).innerText.trim().length < 0) { _UAT = "内容太长或者为空"; } //不合格的发帖
- else {
- (U.UF.Ut.isString(UDE)) && (UDE = { UserDirectoryID: UDE });
- U.UF.A.Request(US.AUTH, ["addArticle", UDE.UserDirectoryID, UIT, UTH, "false"], U.MD.D.PB.A.AsynFBMSSBKG, ["", UDE, UIT, UTH, UCB]); 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];
- (!_UBE.length) && (_UDOD.innerText = ""); _UBE.unshift(_UCE); //添加发帖内容
- }
- (_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").parentg().css("display") == "none")) && _UDMD) {//
- (UTF == "none" && ((_UDSD = _UDPD.parentNode) != _UDMD[0])) && (_UDMD.append($(_UDPD).addAttrArray({ "onmousedown": [[U.MD.D.H.WZTJQ, [null, $(_UDPD).Child()[1]]], [U.UF.M.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(); (_UPH) && (UDOD.style.height = _UPH - ($(_UDAD[0]).height() + $(_UDAD[2]).height() + 20) + "px");
- return true;
- }
- }
- } catch (e) { }
- (UTF != "block") && (U.UF.SI.CloseWindow($(UDOD).Parent()));
- }
- //发帖子窗体变化
- U.MD.D.PB.A.BMSSBKSB = function (UDOD) {
- var _UDPD = $(UDOD).parentg(2), _UDAD = _UDPD.childg();
- _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
|