U.DK.LL.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. Namespace.register("U.Dk.LL"); //Disk导航命名空间
  2. //#region 导航
  3. //分类导航和信息的切换
  4. U.Dk.LL.SXWPDH = function (UDOD, TF) {
  5. var i,
  6. _UDAD = $($(UDOD).Parent(3)).Child();
  7. for (i = 0; i < _UDAD.length; i++) {
  8. _UDAD[i].style.display = TF[i];
  9. }
  10. }
  11. //导航点击 默认导航 (其实导航 没有树形分类的)
  12. U.Dk.LL.MRHYHWP = function (UDOD, UIE, userid) {
  13. var _UDE = U.Dk.DiskOperatingSwitch(userid)[1][0]; //转到个人使用网盘
  14. if (!UIE && US.userInfo.userid != _UDE.UserId) {
  15. U.Alert("他人的私密空间无法查看");
  16. return;
  17. } //私密地方必须本人操作
  18. U.Dk.LE.RecordNav[[U.Dk.LL.ZMRHYHWP, [UDOD, UIE, userid]]]; //前进后退执行
  19. }
  20. //执行导航
  21. U.Dk.LL.ZMRHYHWP = function (UDOD, UIE, userid) {
  22. var i = UIE,
  23. _UGE = [],
  24. _UAE = [],
  25. _UDE = U.Dk.DiskOperatingSwitch(userid) || US.Disk.UserDisk,
  26. _UDTD = $(((_UDE[2] ? "#UD_SYWOCRC" : "#UD_SYWRZ")), _UDE.pdiv)[0],
  27. _UDAD = $(UDOD.parentNode).Child();
  28. for (i = 0; i < _UDAD.length; i++) {
  29. _UDAD[i].className = "UD_SYWLCO" + (_UDAD[i] == UDOD ? " UD_SYWLCOA" : "");
  30. $(_UDAD[i]).Child()[1].className = "UD_SYWLCN" + (_UDAD[i] == UDOD ? " UD_SYWLCNA" : "");
  31. };
  32. //#error 这里错误需要修改
  33. U.Dk.LE.OpenFileDirectory(_UDE[0][UIE], _UGE.length > 1 ? { "UserDirectoryID": "", "UserallDirectoryName": "所有分享"} : _UGE[0], userid);
  34. _UDTD.onscroll = null;
  35. }
  36. /**
  37. * 导航打印(树导航)
  38. * @param {object} 左边一级层级树目录的相关信息
  39. * @param {element} 输出到那个区域
  40. * @param {array} 树目录的class样式数组
  41. * @param {element} 树目录区域
  42. * @param {str} 当前用户ID
  43. **/
  44. U.Dk.LL.XWPDH = function (directorys, el, classes, pel, userid) {
  45. _directory = el || $$("div", { "className": "UD_SYWLTXO", "id": pel.id == "UD_SYWLTX" ? "UD_SYWLTXO" : "" }, pel);
  46. var i, _Img, _dtorydiv, _namediv,
  47. _UDFD = $$("frag"),
  48. _UPD = $((pel || $(_directory).Parent())).Child()[0].style.paddingLeft || 0;
  49. _UPD = _UPD == "" ? 3 : parseInt(_UPD) + 5;
  50. for (i = 0; i < directorys.length; i++) {
  51. if ((classes || "").length) {
  52. if (classes[i] == null) {
  53. _Img = classes[0];
  54. }
  55. else {
  56. _Img = classes[i];
  57. }
  58. }
  59. else {
  60. if ((directorys[i]["UserDirectoryEncrypt"] && directorys[i]["UserDirectoryEncrypt"] != userid)) {
  61. _Img = "UD_SYWLCJ";
  62. }
  63. else {
  64. _Img = "UD_SYWLCW";
  65. }
  66. }
  67. _dtorydiv = $$("div", { "id": directorys[i]["UserDirectoryID"] ? "L" + directorys[i]["UserDirectoryID"] : "", "className": "UD_SYWLTXOA" }, _UDFD);
  68. // $(_dtorydiv).addAttrArray({ "clickon": [[U.Dk.LE.RecordNav, ([[[U.Dk.LL.DXWPDH, ([directorys[i], _dtorydiv, [null, null, "none"], userid])]]])]] });
  69. _namediv = $$("div", { "className": "UD_SYWLTXOS", "style": { "paddingLeft": _UPD + "px" },
  70. "onclick": [[U.M.StopBubble], [U.Dk.LE.RecordNav, ([[[U.Dk.LL.DXWPDH, ([directorys[i], _dtorydiv, null, userid])]]])]],
  71. "onmousedown": [[U.Dk.RM.WPYJCD, (["this", directorys[i], null, null, userid])]]
  72. }, _dtorydiv);
  73. $$("div", { "className": "UD_SYWLTXOSI UD_SYID", "onclick": [[U.M.StopBubble], [U.Dk.LE.RecordNav, ([[[U.Dk.LL.DXWPDH, ([directorys[i], _dtorydiv, [null, true], userid])]]])]] }, _namediv);
  74. $$("div", { "className": "UD_SYWLCOI UD_SYWLTXOST UD_SYID " + _Img }, _namediv);
  75. $$("div", { "className": "UD_SYWLTXOSN UTDF", "innerHTML": directorys[i].UserallDirectoryName, "ondblclick": (classes && classes.length) ? U.M.apply() : [[U.M.StopBubble], [U.Dk.RE.WPCMM, (["this", directorys[i]])]] }, _namediv);
  76. }
  77. _directory.appendChild(_UDFD); return _directory;
  78. }
  79. //设置点击前进后退
  80. //
  81. //* @param {callback} 回调函数,用于记录目录或者导航条前进后退的函数。
  82. //* @returns {} 无
  83. //
  84. U.Dk.LE.RecordNav = function (cb) {
  85. //如果是文件,则直接执行函数,否则设置目录的前进后退再回调。
  86. var userid;
  87. userid = US.Disk.UserDisk[1][2]; //
  88. U.AFB.RGoL("Disk" + userid);
  89. U.AFB.AddEvent(cb, "Disk" + userid);
  90. //前进执行
  91. }
  92. //最近访问区域查看
  93. U.Dk.LL.ZJFWDJ = function (UDE, userid, UDOD) {
  94. if (UDE[1].Time) {
  95. //#error 这里错误 需要修改
  96. U.Dk.LE.OpenFileDirectory(UDE[1].Time, { "UserallDirectoryName": "最近访问区域" }, UDE[1][2], true)
  97. }
  98. else {
  99. U.A.Request(US.CD, [US.DB, "UseStudio_Disk", "DirectoryAndFileSortByTime", UDE[1][2], 0, 100], U.Dk.LL.AsynZJFWDJ, [[UDOD, true], UDE, userid, UDOD]);
  100. // U.A.Request(US.Auth,"UseStudioDisk.GetNewByTime", [UDE[1][2], 0, 100], U.Dk.LL.AsynZJFWDJ, [[UDOD, true], UDE, userid, UDOD]);
  101. }
  102. }
  103. //添加最新访问异步
  104. U.Dk.LL.AsynZJFWDJ = function (r) {
  105. var context = r.context,
  106. _UDE = context[1],
  107. _userid = context[2],
  108. _UDOD = context[3],
  109. _UGE = U.Dk.DiskOperatingSwitch(_userid);
  110. _UGE[1].Time = r.value; U.Dk.LL.ZJFWDJ(_UGE, _userid, _UDOD);
  111. }
  112. //导航点击处理
  113. U.Dk.LL.DXWPDH = function (UDE, UDOD, UTF, userid) {
  114. var _UST,
  115. _UDID = UDE.UserDirectoryID;
  116. var i, _UGE, _UDS,
  117. _UDID = UDE.UserDirectoryID,
  118. _UDE = U.Dk.DiskOperatingSwitch((userid = userid || US.userInfo.userid));
  119. if (_UDID == "22222222-2222-2222-2222-222222222222" || _UDID == "11111111-1111-1111-1111-111111111111") {
  120. U.Dk.LL.FCKDXWPDH(_UDID)
  121. }
  122. else {
  123. var _UDJ = U.D.SY.ET["Disk"]["SY"],
  124. _UDPD = $(_UDE[2] ? "#UD_SYWOCRC" : "#UD_SYWRZ", _UDE.pdiv)[0],
  125. _UDAD = $(UDOD).Child(),
  126. _UCE = [[_UDJ["DJ"]], [_UDAD[0], true]],
  127. _UDTD = _UDAD[1],
  128. _UAE = UDE.Child || _$(_UDE[0]).Select({ "UserDirectoryParentID": userid }),
  129. _UDS = " UD_SYWLTXOSIO", _UDSD = $("div", _UDAD[0])[0];
  130. if (userid != US.userInfo.userid) {
  131. if (UDE.UserDirectoryID == US.userInfo) { _UST = "他人群文件无法查看"; }
  132. else if (UDE.UserDirectoryID == US.SG) { _UST = "他人的私密空间无法查看"; }
  133. if (_UST) { U.Alert(_UST); return; }
  134. }
  135. for (i = 0; i < _UCE.length; i++) {
  136. (_UCE[i][0]) && ($(_UCE[i][0])[_UCE[i][1] ? "addClass" : "removeClass"]("UD_SYWLTXOSO"));
  137. };
  138. _UDPD.onscroll = null; _UDJ["DJ"] = _UDAD[0];
  139. if (UDE.Child || _UDID == US.NU || _UDID == userid) { //无需加载
  140. if (!UTF || !UTF[0]) {
  141. _UDS = (_UDSD.className.indexOf("UD_SYWLTXOSIO") > -1 || (UTF && UTF[3] == "none")) ? ["none", ""] : ((_UDTD && !$(_UDTD).Child().length) && ($(_UDTD).remove(), _UDTD = null), (!_UDTD) && (_UGE = _$(_UAE).Select({ "filetype": 0 }), _UDTD = U.Dk.LL.XWPDH(_UGE, _UDTD, null, UDOD, userid)), ["block", _UDS]); _UDTD.style.display = _UDS[0]; _UDSD.className = "UD_SYWLTXOSI UD_SYID" + _UDS[1];
  142. } //导航打印
  143. if (!UTF || !UTF[1]) {
  144. if (_UDID == userid) {
  145. (userid == US.userInfo.userid) && (_UDPD.innerHTML = "", U.Dk.VW.XWPDYH(US.Friend[2]));
  146. }
  147. else if (_UDID == US.NU) {
  148. U.Dk.LL.ZJFWDJ(_UDE, userid, _UDPD);
  149. }
  150. else { U.Dk.LE.OpenFileDirectory(UDE, userid); }
  151. } //文件显示
  152. }
  153. else {
  154. U.Dk.RE.GXWPCKXS(userid, UDE, ((!UTF || !UTF[1]) && (_UDPD.innerHTML = "", true)) ? [_UDPD, true] : null, U.M.apply(null, [[U.Dk.LL.DXWPDH, [UDE, UDOD, UTF, userid]]]));
  155. } //获取目录
  156. }
  157. }
  158. //如果是我的协同或者是他人邀请的
  159. U.Dk.LL.FCKDXWPDH = function (UDID) {
  160. if (UDID == "22222222-2222-2222-2222-222222222222") {
  161. U.A.Request(US.CD, [US.DB, "UseStudio_Office", "GetCollaborativeDocument", US.userInfo.userid, US.NU, US.NU, 0, 0, 100], function (r) {
  162. var _array = [];
  163. for (var i = 0; i < r.value.length; i++) {
  164. _array.push({
  165. "UserDirectoryID": r.value[i].UserFilesID, //文件id
  166. "UserDirectorySize": r.value[i].UserFilesSize, //文件大小
  167. "UserDirectoryParentID": null,
  168. "UserDirectoryName": null,
  169. "UserallDirectoryName": r.value[i].UserFilesName, //文件名
  170. "UserDirectoryExtendType": r.value[i].UserFilesExtendName, //文件属性
  171. "UserFilesServerName": null,
  172. "UserDirectoryAddTime": r.value[i].UserFilesAddTime, //文件创建时间
  173. "UserDirectoryUrl": null,
  174. "UserDirectoryDeep": null,
  175. "UserDirectoryModifyTime": r.value[i].UserFilesModifyTime, //文件最后修改时间
  176. "UserDirectoryEncrypt": r.value[i].UserDirectoryEncrypt, //加密
  177. "filetype": "1", //文件类型 1文件 0文件夹
  178. "Descript": null,
  179. "GroupID": r.value[i].UserDirectoryEncrypt, //群id
  180. "UsOffice": null,
  181. "UserId": r.value[i].UserID,
  182. "UserNickName": "",
  183. "UserName": "",
  184. "UserThumbnailImageHead": ""
  185. });
  186. }
  187. //#error 这里有错误 需要修改
  188. U.Dk.LE.OpenFileDirectory(_array, { UserallDirectoryName: "他人邀请", UserDirectoryID: "22222222-2222-2222-2222-222222222222" });
  189. });
  190. } else if (UDID == "11111111-1111-1111-1111-111111111111") {
  191. U.A.Request(US.CD, [US.DB, "UseStudio_Office", "GetCollaborativeDocument", US.userInfo.userid, "00000000-0000-0000-0000-000000000000", "", 0, 0, 100], function (r) {
  192. var _array = [];
  193. for (var i = 0; i < r.value.length; i++) {
  194. _array.push({
  195. "UserDirectoryID": r.value[i].UserFilesID, //文件id
  196. "UserDirectorySize": r.value[i].UserFilesSize, //文件大小
  197. "UserDirectoryParentID": null,
  198. "UserDirectoryName": null,
  199. "UserallDirectoryName": r.value[i].UserFilesName, //文件名
  200. "UserDirectoryExtendType": r.value[i].UserFilesExtendName, //文件属性
  201. "UserFilesServerName": null,
  202. "UserDirectoryAddTime": r.value[i].UserFilesAddTime, //文件创建时间
  203. "UserDirectoryUrl": null,
  204. "UserDirectoryDeep": null,
  205. "UserDirectoryModifyTime": r.value[i].UserFilesModifyTime, //文件最后修改时间
  206. "UserDirectoryEncrypt": r.value[i].UserDirectoryEncrypt, //加密
  207. "filetype": "1", //文件类型 1文件 0文件夹
  208. "Descript": null,
  209. "GroupID": r.value[i].UserDirectoryEncrypt, //群id
  210. "UsOffice": null,
  211. "UserId": r.value[i].UserID,
  212. "UserNickName": "",
  213. "UserName": "",
  214. "UserThumbnailImageHead": ""
  215. });
  216. }
  217. // U.Dk.VW.XWPDY(_array, $("#" + (_UDE[2] ? "UD_SYWOCRC" : "UD_SYWRZ"), _UDE.pdiv)[0]);
  218. //#error 这里有错误 需要修改
  219. U.Dk.LE.OpenFileDirectory(_array, { UserallDirectoryName: "我的协同", UserDirectoryID: "11111111-1111-1111-1111-111111111111" });
  220. });
  221. }
  222. }
  223. /**
  224. * 生成导航(面包屑导航)
  225. * @param {array} 所有要追加的导航元素
  226. * @param {element} 导航的元素
  227. * @param {string} 用户的id
  228. */
  229. U.Dk.LL.SCDXWPDH = function (navarray, el, userid) {
  230. var i, //用于循环
  231. _frag = $$("frag"), //临时的panel
  232. _click //导航点击事件处理
  233. ;
  234. el.innerText = ""; //清空导航区域
  235. for (i = navarray.length - 1; i > -1; i--) {
  236. //如果导航是目录的导航,则点击的时候可以跳到指定的导航中
  237. if (navarray[i].UserDirectoryID) {
  238. _click = [[U.Dk.LE.RecordNav, [[[U.Dk.LE.OpenFileDirectory, [navarray[i], userid]]]]]]
  239. }
  240. else {
  241. _click = null;
  242. }
  243. //创建一个导航
  244. $$("div", { "className": "UD_SYWRYBO", "innerHTML": navarray[i]["UserallDirectoryName"],
  245. "onclick": _click
  246. }, _frag);
  247. }
  248. el.appendChild(_frag); //添加导航
  249. //每一次导航追加的时候需要如果超过了大小则需要隐藏前面的导航
  250. setTimeout(function () {
  251. var _navchild = $(el).Child(); //导航元素
  252. while (el.scrollHeight > 30) {
  253. _navchild[i].style.display = "none";
  254. }
  255. }, 0);
  256. }
  257. //#endregion