123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846 |
- //此处放置iframe中的word中的功能面板,包括包括创建邀请协作人员,创建编辑历史,创建生成链接.创建热门模板。
- Namespace.register("U.MD.O.W.Panel");
- //协作统一命名为Collaborative,但牵涉的地方太多,暂时还是用Synergy
- //#region 本地转协同文档及新建保存为协同文档操作
- /**
- * 本地转协同文档及新建保存为协同文档操作,此函数逻辑不清,需要改写!
- *
- * @param fun {element} 回调函数
- */
- U.MD.O.W.Panel.isSynergy = function (fun) {
- //判断是登录
- if (!top.U.MD.U.L.isLogin()) {
- var _fileinfo = U.MD.O.W.fileinfo, //文件信息
- ////或者是什么意思?不严谨
- _filegroupid = _fileinfo.GroupID; //获取_filegroupid群id,判断是否是在自己的ftp下的文档
- //判断是否为互联办公文档,此处有问题。互联办公的权限有问题。
- if (U.MD.O.W.permission.web) {
- if (U.UF.C.isFunction(fun)) {//判断是否有点击事件的方法,如果有,运行它
- fun(_fileinfo);
- }
- return true;
- }
- else {
- var _filename = top.$('#UD_Word' + _fileinfo.UserDirectoryID + ' .U_MD_O_H_head_navigation_Title')[0]; //获取文件名
- //判断文档是否是保持文档,是否是可编辑文档
- if (U.MD.O.W.isSave() && U.MD.O.W.permission.edit) {
- //如果是保持的文档,那么直接提示是否转成系统文档
- new U.UF.UI.confirm("是否将此文档转成互联办公文档", function () {
- //保存到群里
- top.U.MD.DK.VW.saveSynergy(_fileinfo.UserDirectoryExtendType || "uw", _fileinfo, _filename.value, 'move', function (fileinfo) {
- U.MD.O.W.Panel.isSynergy.async(fileinfo, fun);
- });
- });
- }
- //新建保存为协同
- else {
- //否则是新建文档
- top.U.MD.DK.VW.saveSynergy(_fileinfo.UserDirectoryExtendType || "uw", _fileinfo, _filename.value, 'new', function (fileinfo) {
- U.MD.O.W.Panel.isSynergy.async(fileinfo, fun);
- });
- }
- }
- }
- return false;
- }
- /**
- * 本地转协同文档及新建保存为协同文档操作
- *
- * @param fileinfo {object} 文件信息
- * @param fun {element} 回调函数
- */
- U.MD.O.W.Panel.isSynergy.async = function (fileinfo, fun) {
- U.MD.O.W.fileinfo = fileinfo; //设置文件信息
- U.MD.O.W.Panel.disPlayUser(fileinfo); //获取协作人员
- var _eidtorel = $('#U_MD_O_H_wordEditor')[0]; //获取编辑器
- //导航文件转成互联
- if (fileinfo.UserDirectoryExtendType == 'un') {
- //保存文件到后台
- U.MD.O.W.T.N.saveAllPage(function () {
- U.MD.O.W.T.N.saveNav.asyn(true, fileinfo, _eidtorel);
- }, 0, true, _eidtorel.innerHTML);
- }
- else {
- //保存文件到后台
- U.A.Request(US.SCOKET, ["newWordSave", fileinfo.UserDirectoryID, _eidtorel.innerHTML.escapeQuotes(), fileinfo.UserDirectoryName, US.userInfo.userid, top.US.pageId], U.MD.O.W.Panel.isSynergy.saveAsync, [null, fileinfo, _eidtorel]);
- }
- if (U.UF.C.isFunction(fun)) {//判断是否有点击事件的方法,如果有,运行它
- fun(fileinfo);
- }
- }
- U.MD.O.W.Panel.isSynergy.saveAsync = function (r) {
- var _fileinfo = r.context[1];
- var _eidtorel = r.context[2];
- U.MD.O.W.permission.edit = true;
- U.MD.O.W.permission.web = true;
- top.$('#UD_Word' + _fileinfo.UserDirectoryID + ' .U_MD_O_H_head_navigation_Title')[0].value = _fileinfo.UserDirectoryName; //设置文件名
- U.Alert("保存成功"); //提示保存成功
- U.MD.O.W.fileinfo.UsOffice = _eidtorel.innerHTML; //设置内容
- _eidtorel.editor.operaNotice = U.MD.O.W.E.operationNotice; //设置协同监听回调
- }
- //#endregion
- //#region 团队成员
- /**
- * 创建团队成员的窗体
- *
- * @param fileinfo {object} 文件信息
- */
- U.MD.O.W.Panel.loadPlayUser = function (fileinfo) {
- var _coopwindow, _frienddiv, _example, _shareLink, _cBox, _person;
- console.log(fileinfo);
- //如果不存在团队成员窗口,则创建一个团队成员窗口。
- if (!$("#U_MD_O_H_body_left_invite_user")[0]) {
- //创建邀请协助人员窗口
- _coopwindow = $("#U_MD_O_H_body_left")[0];
- _cBox = $$("div", {});
- _shareLink = $$("div", {
- className: 'U_MD_O_H_body_left_invite_linkTxt', "onclick": function () {
- // U.MD.O.W.Panel.isSynergy(U.MD.O.W.Panel.shareLink);
- U.MD.D.I.isOpenRoomConfirm();
- }, "innerText": "第三方链接邀请"
- }, _cBox);
- _frienddiv = $$("div", { "className": "U_MD_O_H_body_left_invite_user", "id": "U_MD_O_H_body_left_invite_user" }, _cBox); //好友内容区域
- // _example = $$("div", {
- // "className": "U_MD_O_H_body_left_invite_user_a", "onclick": function () {
- // U.MD.O.W.Panel.displayInsertUser();
- // }
- // }, _frienddiv); //默认邀请按钮
- _example = $$("div", {
- "className": "U_MD_O_H_body_left_invite_user_a",
- }, _frienddiv);
- for (i = 0; i <= 2; i++) {
- _person = $$("div", { "className": "U_MD_O_H_body_left_person", }, _example);
- $$("div", { "className": "U_MD_O_H_body_left_invite_user_a_img" }, _person);
- $$("div", { "className": "U_MD_O_H_body_left_invite_user_a_div", "innerHTML": "陈慧" }, _person);
- }
- _person = $$("div", { "className": "U_MD_O_H_body_left_person", }, _example);
- $$("div", {
- "className": "U_MD_O_H_body_left_invite_user_a_img_add", "onclick": function () {
- U.MD.D.I.addPerson();
- }
- }, _person);
- new U.UF.UI.form("邀请协作人员", _cBox, { id: "LoadPlayUser", style: { border: "none", position: "absolute", width: "300px", "min-width": "200px", height: "250px", top: "310px", left: "auto", "box-shadow": "none" } },
- { isenlarge: false, isnarrow: false }, { style: { margin: "0px 5px", "border-bottom": "1px solid #d6def0", color: "#000", background: "#fff" } }, null, null, _coopwindow);
- }
- U.MD.O.W.Panel.disPlayUser(fileinfo); //获取协作人员
- }
- /**
- * 初始化查看团队成员
- *
- * @param fileinfo {object} 文件信息
- */
- U.MD.O.W.Panel.disPlayUser = function (fileinfo, el) {
- el = $("#U_MD_O_H_body_left_invite_user")[0]; //获取团队成员初始化的位置
- var _elchild = el.children[0] //获取元素的子元素;
- el.innerHTML = ""//清空内容
- $(el).append(_elchild);
- if (fileinfo) {//判断是否有文件信息
- var _userinfo = [];// U.Json.select(US.friend.groupusers, { "GroupManageID": fileinfo.GroupID }); //获取所有在群里的成员
- if (_userinfo) {//判断是否拥有群成员
- for (i = 0; i < _userinfo.length; i++) {//循环打印所有的群成员
- U.MD.O.W.Panel.createUser(_userinfo[i], el);
- }
- }
- }
- }
- /**
- * 打印团队编辑成员
- *
- * @param fileinfo {object} 文件信息
- */
- U.MD.O.W.Panel.createUser = function (userinfo, el) {
- var _elparent = $$("div", {
- "className": "U_MD_O_H_body_left_invite_user_a", "onclick": U.UF.C.closure(function (userid) {
- top.U.MD.U.V.ViewOtherUserInfo(userid);
- }, [userInfo.userid])
- }, el); //好友头像父级元素
- var _elcontant = $$("div", { "className": "U_MD_O_H_body_left_invite_user_a_user", "style": { "background": "" } }, _elparent); //好友头像元素
- $$("img", { "onerror": U.MD.C.imgError, "src": top.U.MD.C.getHeadImage(userinfo.UserThumbnailImageHead) }, _elcontant); //好友头像图片
- $$("div", { "className": "U_MD_O_H_body_left_invite_user_a_div", "innerHTML": userinfo.UserNickName }, _elparent); //好友名称
- }
- /**
- * 单击邀请时,从普通文档转换为协同文档的过程!
- * 判断是否是已经新建过 弹出添加成员 异步回调
- *
- * @param {element} Wrod信息数组
- */
- U.MD.O.W.Panel.displayInsertUser = function () {
- //判断是否是协同文档
- if (U.MD.O.W.Panel.isSynergy()) {
- var _fileinfo = U.MD.O.W["fileinfo"];
- top.U.MD.F.J.selectFriendForm(function (groupid) {
- //或者是什么意思?不严谨
- var _filegroupid = _fileinfo.GroupID; //获取_filegroupid群id,判断是否是在自己的ftp下的文档
- var _groupinfo = U.Json.select(US.friend.group, { "GroupManageID": _filegroupid })[0]; //群信息
- var _needuser = top.U.MD.F.J.selectUserInfo.NeedUser; //选中好友集合
- var _groupname = _groupinfo.GroupManageName; // 群名
- var _groupdesc = _groupinfo.GroupManageDescript; //群描述
- var _selectfriend = U.Json.select(US.friend.groupusers, { "GroupManageID": _filegroupid }); //选择的好友信息
- //已经在群里的就不添加了
- var i;
- for (i = 0; i < _selectfriend.length; i++) {
- U.Json.del(_needuser, { "UserId": _selectfriend[i].UserId }); //删除所有在群里的用户id
- }
- //创建及添加群处理
- top.U.MD.F.J.determineCreateGroupAndAddGroupUser(_filegroupid, null, null, false, _groupname, _groupdesc, function (groupid, groupinfo) {
- var i, _userids = "";
- //U.MD.O.W.Panel.disPlayUser(_fileinfo);
- for (i = 0; i < _needuser.length; i++) {//循环打印所有的群成员
- _userids += _needuser[i].UserId + (i < _needuser.length - 1 ? "," : "");
- U.MD.O.W.Panel.createUser(_needuser[i]);
- }
- U.MD.O.W.Panel.addUser(_userids);
- });
- }, null, _fileinfo); //调用打印函数
- }
- }
- U.MD.O.W.Panel.addUser = function (userids) {
- var _type = U.MD.O.W["fileinfo"].UserDirectoryExtendType == "un" ? "nav" : "word";
- top.U.A.Request(US.SCOKET, ["addUser", _type, U.MD.O.W["fileinfo"].UserDirectoryID, userids, US.userInfo.userid, top.US.pageId], function () { });
- }
- U.MD.O.W.Panel.syncAddUser = function (userids, senduserid) {
- userids = userids.split(",");
- var i, _userinfo;
- for (i = 0; i < userids.length; i++) {
- _userinfo = U.Json.selectOne(US.friend.groupusers, { UserId: userids[i] });
- if (!_userinfo) {
- top.U.A.Request(US.CD, [US.DB, "UseStudio_Users", "GetUserinfoByUserId", userids[i]], function (r) {
- _userinfo = r.value[0];
- U.MD.O.W.Panel.createUser(_userinfo);
- })
- }
- }
- }
- //#endregion
- //#region 分享文档链接
- /**
- * ----------------------------添加团队成员
- *
- * @param {object} 文件信息
- * @param {string} 文件提交到哪个群的id
- * @param {array} 用户id的数组
- */
- //U.MD.O.W.Panel.insertUser = function (fileinfo, groupid) {
- // // if (!fileinfo.UserId && !fileinfo.UserallDirectoryName) {
- // // fileinfo.GroupId = fileinfo.UserDirectoryEncrypt = groupid;
- // // var _groupuserid = U.Json.select(US.friend.group, { 'GroupManageID': groupid })[0].GroupManageUserID;
- // // var _dirinfo, _dirid, _diskinfo = US.disk.Disks[US.userInfo.userid];
- // // if (_groupuserid == US.userInfo.userid) {
- // // _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { 'UserDirectoryName': "我的协同" })[0];
- // // } else {
- // // _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { 'UserDirectoryName': "他人邀请" })[0];
- // // }
- // // var _dirchild = top.$('#L' + _dirinfo.UserDirectoryID).Child();
- // // !_dirchild[1] && _dirchild[0].onclick()
- // // top.$('#L' + groupid).Child()[0].onclick();
- // // } else if ((fileinfo.UserDirectoryEncrypt || fileinfo.GroupID) == US.userInfo.userid) { //如果是新创建的文件,同时文件不在群里 就把文件拷贝到群里进行处理
- // // var _userid = fileinfo.UserId,
- // // _diskinfo = US.disk.Disks[US.userInfo.userid],
- // // _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { "UserDirectoryID": groupid }, 1)[0]; //当前目录的信息
- // // var _pastecontent = US.disk.Disks[_userid].pasteDirOrFile = {
- // // "type": "shear", //复制或者剪切 "copy" || "shear"
- // // "UserDirectoryID": groupid, //在哪个目录复制或者剪切
- // // "dirorfile": fileinfo, //复制的内容
- // // "userid": _userid //用户id
- // // }
- // // top.U.A.Request(US.AUTH, ["CutAndPasteFiles", fileinfo.UserId, groupid, fileinfo.UserDirectoryID, groupid, groupid],
- // // top.U.MD.DK.RE.asynPaste, ["", _dirinfo, groupid, _pastecontent, _diskinfo]
- // // );
- // // fileinfo.GroupId = fileinfo.UserDirectoryEncrypt = groupid;
- // // }
- // // U.MD.O.W.Panel.disPlayUser(fileinfo);
- //}
- /**
- * 分享文档链接
- *
- * @param fileinfo {object} 文件信息
- */
- U.MD.O.W.Panel.shareLink = function (fileinfo) {
- var _template = U.MD.O.W.Panel.shareLinkTemplate(fileinfo); //生成窗体内容
- new U.UF.UI.form("邀请协助链接", _template, { id: "U_MD_O_W_Panel_InviteForm", style: { cssText: "width:600px; height:450px;" } }); //创建窗体
- }
- /**
- * 创建分享链接窗体内容模板
- *
- * @param {fileinfo} 文件信息
- */
- U.MD.O.W.Panel.shareLinkTemplate = function (fileinfo) {
- var _cBox = $$('div', { className: "U_MD_O_H_body_left_invite_form" }), //创建最外层元素
- _shareLinkEl = $$('div', { className: "U_MD_O_H_body_left_invite_formShare" }, _cBox), //分享链接盒子元素
- _QRCodeEl = $$('div', { className: "U_MD_O_H_body_left_invite_formQRCode" }, _cBox); //二维码元素
- $$('p', { innerText: "通过链接邀请:", style: { cssText: "font-size:18px; font-weight: bold;" } }, _shareLinkEl) //文字提示
- var _shareLinkInpBlock = $$('div', { className: "U_MD_O_H_body_left_invite_shareInpMargin" }, _shareLinkEl); //分享链接文本框
- $$('p', { style: { cssText: "margin-top: 8px;" }, innerText: "将下面的邀请链接通过QQ或微信发送给需要邀请的人" }, _shareLinkInpBlock); //文字提示
- var _fileType; //文档类型
- switch (fileinfo.UserDirectoryExtendType.toLowerCase()) { //字符串转换
- case 'uw':
- _fileType = 'word'; break;
- case 'ue':
- _fileType = 'execl'; break;
- case 'un':
- _fileType = 'word'; break;
- default:
- _fileType = false; break;
- }
- var _shareLinkInpBlockShow = $$('input', { style: { cssText: "margin-top: 5px;" }, className: "U_MD_O_H_body_left_invite_shareInp", value: "http://www.1473.cn/#" + _fileType + '/join/' + fileinfo.UserDirectoryID, disabled: "disabled" }, _shareLinkInpBlock), //输出
- _shareLinkInpBlockBtn = $$('div', {
- style: { cssText: "margin-top: 5px;" }, className: "U_MD_O_H_body_left_invite_shareBtn", innerText: "复制", onclick: function () { //复制按钮
- var _inp = $$('input', { value: _shareLinkInpBlockShow.value }, $('body')[0]); //创建复制文本框
- _inp.select(); //选中
- document.execCommand("Copy"); //复制
- $(_inp).remove();
- U.Alert('复制成功,赶紧分享给小伙伴吧!'); //提示
- }
- }, _shareLinkInpBlock)
- $$('p', { innerText: "通过二维码邀请:", style: { cssText: "font-size:18px; font-weight: bold;" } }, _QRCodeEl); //文字
- var _QRCodeImg = $$('div', { style: { cssText: "margin-left:40px;margin-top: 20px;position:absolute;" } }, _QRCodeEl);
- $$('div', { innerHTML: "<span style='font-size:16px'>通过扫码,邀请好友</span><br>扫描二维码获取邀请函,转发给微信好友/群,<br/>即可邀请他们加入你的文档", style: { cssText: "margin-left: 270px;margin-top:40px;line-height:30px;" } }, _QRCodeEl);
- top.U.UF.QR.generate("150", "150", "black", "white", _shareLinkInpBlockShow.value, _QRCodeImg); //调用生成二维码函数
- return _cBox; //返回最外层元素
- }
- //#endregion
- //#region 热门模板
- /**
- * 创建热门模板窗体
- *
- * @param {element} 换页元素
- */
- U.MD.O.W.Panel.loadHotTemplates = function (fileinfo) {
- var _leftel, _el;
- //判断是否加载热门模板
- if (!$("#U_MD_O_H_body_left_template_hot")[0]) {
- _leftel = $("#U_MD_O_H_body_left")[0];
- //创建热门模板窗体
- _el = $$("div", { "className": "U_MD_O_H_body_left_template_user", id: "U_MD_O_H_body_left_template_hot" });
- new U.UF.UI.form("热门模板提供", _el, { id: "LoadHotTemplates", style: { border: "none", width: "300px", height: "477px", position: "absolute", top: "695px", left: "auto", "box-shadow": "none" } }, { isenlarge: false, isnarrow: false }, { style: { margin: "0px 5px", "border-bottom": "1px solid #d6def0", color: "#000", background: "#fff" } }, null, null, _leftel);
- }
- U.MD.O.W.Panel.getHotTemplates("00000000-0000-0000-0000-000000000000", 1, 10); //热门模板
- }
- /**
- * 初始化加载模板
- *
- * @param {element} 换页元素
- */
- U.MD.O.W.Panel.getHotTemplates = function (hid, start, end) {
- var _el = $("#U_MD_O_H_body_left_template_hot")[0];
- U.A.Request(US.CD, [US.DB, "UseStudio_Office", "SelectHotTemplate", hid, start, end], U.MD.O.W.Panel.asynGetHotTemplates, [null, _el]);
- }
- /**
- * 获取热门模板
- *
- * @param {element} 换页元素
- */
- U.MD.O.W.Panel.asynGetHotTemplates = function (r) {
- var i, _el,
- _frag = $$("frag"),
- _hel = r.context[1];
- r = r.value;
- //循环答应热门模板
- for (i = 0; i < r.length; i++) {
- _el = $$("div", {
- "className": "U_MD_O_H_body_left_template_user_m",
- "onclick": U.UF.C.closure(function (info) {
- parent.U.A.Request(US.DISK, ["GetFileContent", info.FileId], function (r) {
- //获取到内容
- if (r.value && r.value.UsOffice !== undefined) {
- r = r.value.UsOffice;
- }
- //打开新的word处理
- top.U.MD.O.word(US.userInfo, { UserDirectoryID: Guid.newGuid(), UsOffice: r || "" });
- });
- }, [r[i]])
- }, _frag);
- $$("div", { "className": "U_MD_O_H_body_left_template_user_m_s", "style": { "background-image": "url(" + (r[i].UseFilesServerThumbnailName || "http://www.1473.cn/Boomyun/img/pc/NImg.png") + ")" } }, _el);
- $$("div", { "className": "U_MD_O_H_body_left_template_user_m_x", "innerHTML": r[i]["UserFilesName"] }, _el);
- }
- $(_hel).append(_frag);
- }
- //#endregion
- //#region 链接查看
- /**
- *
- * 加载,生成连接区域
- *
- * @param wordinfo {object} 当前文档信息
- */
- U.MD.O.W.Panel.loadlink = function (wordinfo) {
- var _linkareael = $("#U_MD_O_H_body_left_href_pay_a")[0];
- //如果不存在添加链接区域,则创建。
- if (!_linkareael || (_linkareael && _linkareael.innerHTML == "")) {
- U.MD.O.W.Panel.formloadlink([]); //加载链接,这里有可能没有设置过短连接
- //加载word文件的短链接
- // U.A.Request('http://cd.1473.cn/php', ["db.1473.cn", "UseStudio_DNS", 'GetDnsInfoByFileId', wordinfo.UserDirectoryID], function (r) {
- // var _date = r.value; //获取短连接信息
- // U.MD.O.W.Panel.formloadlink(_date); //加载链接,这里有可能没有设置过短连接
- // });
- }
- }
- /**
- *
- * 加载,生成连接区域
- *
- * @param wordinfo {object} 当前文档信息
- */
- U.MD.O.W.Panel.formloadlink = function (date) {
- var _url,
- _linkdiv,
- _wordinfo = U.MD.O.W.fileinfo,
- _rightwindow = $("#U_MD_O_H_body_left")[0], //右边功能区
- _linkareael = $("#U_MD_O_H_body_left_href_pay_a")[0]
- ;
- //设置过域名的加载
- if (date.length) {
- _url = date[0].AppId + ".1473.cn/" + date[0].Domain
- _linkdiv = $$("div", { "className": "U_MD_O_H_body_left_href_pay_a", id: "U_MD_O_H_body_left_href_pay_a" });
- $$("a", { className: "U_MD_O_H_body_left_href_pay_aText", href: "//" + _url, innerText: _url, target: "_Blank" }, _linkdiv);
- //只有编辑权限才显示修改和分享按钮
- if (U.MD.O.W.permission.edit) {
- $$('div', {
- innerText: '分享', className: "U_MD_O_H_body_left_href_pay_Btn", onclick: function () {
- //判断是否保持文档
- if (U.MD.O.W.isSave()) {
- var _iframe = $$('iframe', { src: '//domain.1473.cn/DomainSystem.aspx/?fileId=' + _wordinfo.UserDirectoryID + '&type=word&mode=share', frameborder: "0", style: { cssText: "width:100%;height:100%;border:0px" } });
- new U.UF.UI.form("域名管理", _iframe, { id: "U_MD_DS_DomainShare", style: { "width": "370px", "height": "390px" } });
- }
- //点击保存处理
- else {
- $('#U_MD_O_H_save')[0].onclick();
- }
- }
- }, _linkdiv);
- $$("div", {
- innerText: '修改', className: "U_MD_O_H_body_left_href_pay_Btn", onclick: function () {
- //判断是否保持文档
- if (U.MD.O.W.isSave()) {
- var _iframe = $$('iframe', { src: '//domain.1473.cn/DomainSystem.aspx/?fileId=' + _wordinfo.UserDirectoryID + '&type=word&mode=base', frameborder: "0", style: { cssText: "width:100%;height:100%;border:0px" } });
- new U.UF.UI.form("域名管理", _iframe, { id: "U_MD_DS_DomainManage", style: { cssText: 'width: 1040px; height: 555px' } });
- }
- //点击保存处理
- else {
- $('#U_MD_O_H_save')[0].onclick();
- }
- }
- }, _linkdiv);
- }
- }
- //未设置过的
- else {
- // _linkdiv = $$("div", {
- // "className": "U_MD_O_H_body_left_href_pay_a", id: "U_MD_O_H_body_left_href_pay_a", "innerHTML": "将此站点生成链接", "onclick": function () { //生成链接
- // //判断文件是否保存,此判断未成功
- // if (U.MD.O.W.isSave()) { //如果保存的文档,点击直接弹出网页
- // //得到编辑器
- // var _wordContent = document.getElementById("U_MD_O_H_wordEditor");
- // //如果文件变量中的word内容存在,编辑器内容不同于文件变量中的内容,则保存内容,否则,返回true
- // if (_wordinfo.UsOffice && _wordinfo.UsOffice != _wordContent.innerHTML) {
- // //保存到数据库
- // top.U.A.Request(US.DISK, ["SaveFileContent", US.userInfo.UserId, _wordinfo.UserDirectoryID, _wordContent.innerHTML.escapeQuotes(), _wordinfo.UserallDirectoryName, "uw"], function (r) {
- // //跳转新页面显示word内容
- // window.open("http://" + U.MD.O.W.fileinfo.UserDirectoryID + ".1473.cn");
- // }, ([''])); //保存到数据库
- // }
- // else {
- // //先判断数据库是否存在该文件
- // parent.U.A.Request(US.DISK, ["GetFileContent", _wordinfo.UserDirectoryID], function (r) {
- // //能够获取到内容
- // if (r.value && r.value.UsOffice !== null) {
- // //跳转新页面显示word内容
- // window.open("http://" + U.MD.O.W.fileinfo.UserDirectoryID + ".1473.cn");
- // }
- // else {
- // //保存到数据库
- // top.U.A.Request(US.DISK, ["SaveFileContent", US.userInfo.UserId, _wordinfo.UserDirectoryID, _wordContent.innerHTML.escapeQuotes(), _wordinfo.UserallDirectoryName, "uw"], function (r) {
- // //跳转新页面显示word内容
- // window.open("http://" + U.MD.O.W.fileinfo.UserDirectoryID + ".1473.cn");
- // }, ([''])); //保存到数据库
- // }
- // });
- // }
- // }
- // else { //未保存的文档查看站点,触发保存事件
- // $('#U_MD_O_H_save')[0].onclick();
- // }
- // }
- // });
- }
- //如果已经创建
- if (_linkareael && _linkareael.innerHTML == "") {
- _linkareael.appendChild(_linkdiv);
- }
- //如果生成链接的处理
- else {
- // new U.UF.UI.form("生成链接", _linkdiv, { style: { border: "none", position: "absolute", width: "300px", height: "70px", top: "60px", left: "auto", "box-shadow": "none" } }, { isenlarge: false, isnarrow: false }, { style: { margin: "0px 5px", "border-bottom": "1px solid #d6def0", color: "#000", background: "#fff" } }, null, null, _rightwindow);
- }
- }
- //#endregion
- //#region 历史记录
- /**
- * 初始化历史记录
- *
- * @param
- */
- U.MD.O.W.Panel.loadOfficeHistory = function (fileinfo) {
- var _el, _leftel;
- //判断是否有历史记录
- if (!$("#U_MD_O_H_body_left_invite_history")[0]) {
- _leftel = $("#U_MD_O_H_body_left")[0];
- //编辑历史
- _el = $$("div", { "className": "U_MD_O_H_body_left_invite_user", "id": "U_MD_O_H_body_left_invite_history" });
- new U.UF.UI.form("编辑历史", _el, { id: "LoadOfficeHistory", style: { width: "300px", height: "284px", position: "absolute", top: "400px", left: "auto", "border-radius": "0px", border: "none", "box-shadow": "none", "border-radius": "5px" } }, { isenlarge: false, isnarrow: false }, { style: { margin: "0px 5px", "border-bottom": "1px solid #d6def0", color: "#000", background: "#fff" } }, null, null, _leftel);
- }
- //判断文件是否保持的文件,如果保持的文件则有历史记录,未保存的没有
- if (U.MD.O.W.isSave()) {
- U.MD.O.W.Panel.viewEditHistory(fileinfo.UserDirectoryID, U.MD.O.W.historyid, 1, 100); //历史记录
- }
- //没有历史记录
- else {
- $$("div", { "innerHTML": "暂无历史", "style": { "text-align": "center", "margin-top": "50px" } }, _el);
- }
- }
- /**
- * 查看编辑历史
- *
- * @param {element} 换页元素
- * 创始人id 文件id 空的id 选取开始 选取长度 获取编辑历史的框
- */
- U.MD.O.W.Panel.viewEditHistory = function (id, hid, start, end) {
- var _el = $("#U_MD_O_H_body_left_invite_history")[0];
- U.A.Request(US.CD, [US.DB, "UseStudio_Office", "SelectOfficeHistory", id, hid, start, end], U.MD.O.W.Panel.asynViewEditHistory, [null, _el]);
- }
- /**
- * 查看编辑历史异步
- *
- * @param {element} 换页元素
- */
- U.MD.O.W.Panel.asynViewEditHistory = function (r) {
- $('#U_MD_O_H_body_left_invite_history')[0].innerHTML = '';
- var _value = r.value,
- _el = $('#U_MD_O_H_body_left_invite_history')[0]
- for (var i = 0; i < _value.length; i++) {
- _el.appendChild(U.MD.O.W.Panel.createHis(_value[i]))
- }
- }
- /**
- * 添加详细历史记录布局
- *
- * @param {object} data 数据
- */
- U.MD.O.W.Panel.createHis = function (data) {
- var _hisel, _imgel, _infoel, _textel, _btnel;
- _hisel = $$('div', { style: { cssText: 'min-height: 85px; border-bottom: 1px solid silver; margin: 0 3px' } });
- _imgel = $$('div', { style: { margin: '22px 12px 0', float: 'left' } }, _hisel);
- $$('img', { "onerror": U.MD.C.imgError, style: { cssText: 'width:40px; height: 40px;' }, src: top.U.MD.C.getHeadImage(data.UserThumbnailImageHead) }, _imgel);
- _infoel = $$('div', { style: { cssText: 'margin-left: 62px;' } }, _hisel);
- _textel = $$('div', { style: { 'padding-top': '25px', 'white-space': 'nowrap' } }, _infoel);
- $$('span', { innerText: data.UserName }, _textel);
- $$('span', { innerText: U.UF.D.getDateInterval(data.CreateTime) + '保存一次', style: { 'padding-left': '10px' } }, _textel);
- _btnel = $$('div', { style: { 'margin-top': '10px', 'white-space': 'nowrap' } }, _infoel);
- //判断是否是自己编辑历史记录,是则不打印对话
- if (data.UserId != U.MD.O.W.userInfo.userid) {
- $$('button', {
- innerText: '对话', style: { cssText: 'color: #fff; background-color:#6d81a4; border-radius: 4px; border:none; outline:none; padding: 4px 8px; cursor: pointer;' }, onclick: function () {
- //这里有问题,这样获取不一定能获取用户数据,同时数据没有分离
- var _friendel = U.Json.select(US.friend.friends, { UserId: data.UserId });
- //如果未添加好友,则弹出添加好友框,否则直接弹出聊天窗口
- if (_friendel.length == 0) {
- top.U.MD.U.V.ViewOtherUserInfo(data.UserId);
- } else {
- _data = !_friendel.length ? U.Json.select(US.friend.recentcontacts, { UserId: data.UserId }) : _friendel;
- top.U.MD.F.W.popupFriendsForm(_data[0], this);
- }
- }
- }, _btnel);
- }
- $$('button', {
- innerText: '详细', style: { cssText: 'color: #fff; background-color:#6d81a4; border-radius: 4px; border:none; outline:none; padding: 4px 8px; margin-left: 4px;cursor: pointer;' },
- onclick: function () {
- U.MD.O.W.Panel.EditHistory(data)
- }
- }, _btnel);
- //返回最外的元素
- return _hisel
- }
- /**
- * 插入历史
- *
- * @param _fileinfo {string} 文件信息
- * @param {string} 历史记录内容
- *
- */
- U.MD.O.W.Panel.InsertOfficeHistory = function (fileinfo, html, name, contentel) {
- var _fileid = fileinfo.UserDirectoryID; //文件ID
- if (U.MD.O.W.permission.web) {
- //html,
- top.U.A.Request(US.SCOKET, ["insertModifyRecord", "word", _fileid, name, html, US.userInfo.userid, US.pageId], function (r) {
- if (r.value) {
- var _historyid = r.value;
- U.MD.O.W.Panel.syncHistory(US.userInfo.userid, _historyid);
- U.MD.O.W.fileinfo.UsOffice = contentel.innerHTML;
- U.Alert("保存成功");
- } else {
- U.Alert("系统有误,请稍后重试..");
- }
- });
- } else {
- //插入历史
- U.A.Request(US.CD, [US.DB, "UseStudio_Office", "InsertDocumentModifyRecord", US.userInfo.userid, _fileid, html, name], function (r) {
- if (r.value[0]) {
- U.MD.O.W.Panel.syncHistory(US.userInfo.userid, r.value[0].historyid);
- U.MD.O.W.fileinfo.UsOffice = contentel.innerHTML;
- U.Alert("保存成功");
- } else {
- U.Alert("系统有误,请稍后重试..");
- }
- });
- }
- }
- U.MD.O.W.Panel.syncHistory = function (userid, historyid, isbool) {
- if (!isbool) {
- var _data, _fileinfo = U.MD.O.W.fileinfo;
- _fileinfo.HistoryId = historyid; //记录历史ID
- if (userid == US.userInfo.userid) {
- _data = U.MD.O.W.dataStructure(_fileinfo.UserDirectoryModifyTime, US.userInfo.username, US.userInfo.UserThumbnailImageHead, historyid, US.userInfo.userid);
- } else {
- var _userinfo = U.Json.select(US.friend.groupusers, { UserId: userid })[0];
- _data = U.MD.O.W.dataStructure(_fileinfo.UserDirectoryModifyTime, _userinfo.UserName, _userinfo.UserThumbnailImageHead, historyid, _userinfo);
- }
- var _el = U.MD.O.W.Panel.createHis(_data), //创建历史记录
- _addel = $('#U_MD_O_H_body_left_invite_history')[0]; //历史记录区域
- $(_el).appendTo(_addel, 0, _addel.firstElementChild); //置顶插入
- }
- }
- /**
- * 历史数据结构
- *
- * @param creattime {string} 创建时间
- * @param username {string} 用户名
- * @param userbgimg {string} 用户头像
- * @param historyid {string} 历史ID
- * @param userid {string} 用户ID
- *
- */
- U.MD.O.W.dataStructure = function (creattime, username, userbgimg, historyid, userid) {
- return {
- CreateTime: creattime || U.UF.D.toTimeStamp(new Date()), //创建时间
- UserName: username, //用户名
- UserThumbnailImageHead: userbgimg, //用户头像
- HistoryId: historyid, //历史ID
- UserId: userid //用户ID
- }
- }
- /**
- * 添加详细历史记录
- *
- * @param {element} e 子元素
- * @param {element} el 父亲元素
- * @param {object} data 数据
- */
- U.MD.O.W.Panel.AddDetailedHis = function (e, el, data) {
- var _conEl = e.lastElementChild,
- _hisInfoDate = $$('span', {
- innerText: U.UF.D.getDateInterval(new Date(parseInt(data.CreateTime.replace(/[^0-9]/ig, "")))) + '修改了一次',
- style: { 'padding-left': '10px' }
- }, _conEl.firstElementChild),
- _conText = $$('div', { innerHTML: data.OfficeContent }, _conEl)
- el.appendChild(e);
- }
- /**
- * 编辑历史弹出全部
- *
- */
- U.MD.O.W.Panel.EditHistoryc = function (UDE) {//此参数为历史记录的信息
- var _el = $$("div"),
- // _UCT = new U.UF.UI.form("<div _el='U_MD_F_S_TI'>历史记录</div>",_el,{"className": "Bjlsall", "style": {"width": "950px", "height": "550px","overflow": "hidden"} },{isdrag: false,isenlarge: false, isnarrow: false }, null, null, null, _UDTD);
- _UCT = new U.UF.UI.form("历史记录", _el, { className: 'Bjlsall', style: { width: "950px", height: "550px", overflow: "hidden" } }, { isdrag: false, isenlarge: false, isnarrow: false }, null, null, null);
- var i, _UDBD, _UDTD, _UDSD;
- for (var a = 0; a < UDE.length; a++) {//循环历史记录的长度 用来显示多个历史记录在"显示按钮"的打开的窗体上
- _UDBD = $$("div", { "className": "U_MD_O_W_History_all", "id": UDE[a].HistoryId + "-" + a }, _el);
- _UDTD = $$("div", { "className": "U_MD_O_W_History_Head" }, _UDBD);
- _UDBB = $$("div", {
- "className": "U_MD_O_H_body_btn",
- "innerHTML": "展开",
- "onclick": U.MD.O.W.Panel.btn
- },
- _UDBD);
- $$("div", { "className": "U_MD_O_H_body_btn_img1" }, _UDBB);
- $$("img",
- {
- "src": U.MD.C.getHeadImage(UDE[a].UserThumbnailImageHead),
- "onerror": U.MD.C.imgError,
- "alt": UDE[a].UserName,
- "title": UDE[a].UserName
- },
- _UDTD);
- $$("div", { "innerHTML": (UDE[a].UserNickName) + " " + U.UF.D.getDateInterval(UDE[a].CreateTime) + " 更改了以下内容" }, _UDTD);
- $$("div", { "className": "U_MD_O_H_body_right_user_o_r_all_nr", "innerHTML": UDE[a].OfficeContent }, _UDTD);
- }
- }
- /**
- * 点击显示全部
- *
- */
- U.MD.O.W.Panel.EditHistoryonc = function () {
- var _wordinfo = U.MD.O.W; //word全局变量 包含了uw文件的文件信息 等
- var _fileinfo = _wordinfo["fileinfo"]; //uw文件的文件信息
- var _fileid = _fileinfo.UserDirectoryID;
- var UDOD = $("#U_MD_O_H_body_left_invite_history")[0]; //历史记录框
- U.A.Request(US.CD, [US.DB, "UseStudio_Office", "SelectOfficeHistory", _fileid, "00000000-0000-0000-0000-000000000000", 1, 10], U.MD.O.W.Panel.OnDisplayD, [null, UDOD]); //
- }
- /**
- * 更新历史弹出全部
- *
- */
- U.MD.O.W.Panel.OnDisplayD = function (r) {
- if ($(".U_MD_O_H_body_right_user_o_r_all")) {//如果存在则删除
- $(".U_MD_O_H_body_right_user_o_r_all").remove();
- }
- divall = $$("div", { "className": "U_MD_O_H_body_right_user_o_r_all" }, r.context[1].parentNode.parentNode);
- $$("div",
- {
- "className": "U_MD_O_H_body_right_user_o_r_all_a",
- "innerHTML": "显示全部",
- "onclick": [U.MD.O.W.Panel.EditHistoryonc]
- },
- divall);
- U.MD.O.W.Panel.EditHistoryc(r.value);
- }
- /**
- * 编辑历史的展开与关闭
- *
- */
- U.MD.O.W.Panel.btn = function () {//编辑历史记录底端的显示全部的展开与关闭
- if (this.parentNode.children[0].lastChild.children[0].scrollHeight > 100) {//根据内容的高度来判断
- if (this.innerText == "展开") {
- this.innerHTML = "收起<div class='U_MD_O_H_body_btn_img2'></div>";
- this.parentNode.style.cssText = "height:100%;min-height:100px;overflow:visible;float:left;width:95%;"
- this.style.cssText = "margin-right:-7px;"
- }
- else if (this.innerText == "收起") {
- this.innerHTML = "展开<div class='U_MD_O_H_body_btn_img1'></div>";
- this.parentNode.style.cssText = "height:100px;overflow:hidden;float:none;width:none";
- this.style.cssText = "margin-right: 0px; "
- }
- } else {
- if (this.innerText == "展开") {
- this.innerHTML = "收起<div class='U_MD_O_H_body_btn_img2'></div>";
- this.parentNode.style.cssText = "height:100%;min-height:100px;overflow:visible;float:left;width:95%;"
- this.style.cssText = "margin-right:-7px;"
- }
- else if (this.innerText == "收起") {
- this.innerHTML = "展开<div class='U_MD_O_H_body_btn_img1'></div>";
- this.parentNode.style.cssText = "height:100px;overflow:hidden;";
- this.style.cssText = "margin-right: 0px;"
- }
- }
- }
- /**
- * 编辑历史弹出
- *
- */
- U.MD.O.W.Panel.EditHistory = function (UDE) {//此参数为历史记录的信息
- var _el = $$("div", { style: { cssText: "padding: 0 10px;" } }),
- _UCT = new U.UF.UI.form("历史记录", _el, { id: "Bjls", style: { width: "680px", height: "550px", overflow: "hidden", 'box-shadow': 'rgb(180, 180, 180) 1px 1px 5px 2px', 'border-radius': '0', 'border': 'none' } }, { isdrag: false, isenlarge: false, isnarrow: false }, { style: { 'background-color': '#3c475b', 'padding': '4px' } });
- if (UDE.OfficeContent == undefined) {
- U.A.Request(US.CD, [US.DB, "Usestudio_Office", "SelectHistoryDetails", UDE.HistoryId], function (r) {
- UDE.OfficeContent = r.value[0].OfficeContent.unEscapeQuotes().unEscapeQuotes();
- U.MD.O.W.Panel.AsynEditHistory(UDE, _el);
- }, [_el]);
- } else {
- U.MD.O.W.Panel.AsynEditHistory(UDE, _el);
- }
- }
- /**
- * 编辑历史弹出异步
- *
- */
- U.MD.O.W.Panel.AsynEditHistory = function (docinfo, element) {
- var _UDBD = $$("div", { "class": "U_MD_O_W_History" }, element);
- var _UDTD = $$("div", { "class": "U_MD_O_W_History_Head" }, element);
- $$("img",
- {
- "onerror": U.MD.C.imgError,
- "src": (top.U.MD.C.getHeadImage(docinfo.UserThumbnailImageHead) || 'http://www.1473.cn/img/UserHead/UseHead.jpg'),
- "alt": docinfo.UserNickName || docinfo.UserName,
- "title": docinfo.UserNickName || docinfo.UserName
- },
- _UDTD);
- $$("div", { "innerHTML": (docinfo.UserNickName || docinfo.UserName) + " " + U.UF.D.getDateInterval(docinfo.CreateTime || new Date()) + " 更改了以下内容", style: { cssText: "display: inline-block; margin-left:10px" } }, _UDTD);
- $$("div", { "className": "U_MD_O_H_body_right_user_o_r_nr", "innerHTML": docinfo.OfficeContent }, _UDTD);
- }
- //#endregion
|