U.DK.RM.js 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. //--------------------------------------------------------------右键菜单----------------------------------------------------------------------
  2. Namespace.register("U.Dk.RM"); //Disk的右键命名空间
  3. //#region 右键查看处理
  4. ////详细视图右键处理
  5. //U.Dk.RM.WPYJCDX = function (UDOD, UDPD, UDE, UPE, userid) {
  6. // if (event.button == 2) {//右键选择
  7. // var i, _UTF, _UDAD = $(UDPD).checked();
  8. // if (_UDAD.length > 1) {
  9. // for (i = 0; i < _UDAD.length; i++) {
  10. // _UDAD[i] = $(_UDAD[i]).Parent(2); (!_UTF && _UDAD[i] == UDOD) && (_UTF = true);
  11. // }
  12. // } //获取是否多选
  13. // U.Dk.RM.WPYJCD(UDOD, UDE, UPE, _UTF ? _UDAD : "", userid); //多选元素处理
  14. // }
  15. //}
  16. //右键菜单弹出
  17. U.Dk.RM.WPYJCD = function (UDOD, UDE, UAE, UFT, userid) {
  18. var i, j, _UDID, _UQE, _UKE, _UME, _UAE,
  19. _UJE = [],
  20. _USE = [0, 11, 17],
  21. _UTP = event.type,
  22. _userid = US.userInfo.userid,
  23. _UGE = !userid ? US.Disk.UserDisk : U.Dk.DiskOperatingSwitch(userid),
  24. _UIE = _UGE[1][4] == "Details",
  25. _UDTD = $("#" + (_UGE[2] ? "UD_SYWMO" : "UD_SYWM"), _UGE.pdiv),
  26. _UDSD = $("#" + (_UGE[2] ? "UD_SYWOCRC" : "UD_SYWRZ"), _UGE.pdiv)[0],
  27. _UDPD = $(_UDSD).Parent(2), _UDAD = _UDTD.Child();
  28. if (UDOD && event.button == 2 && (_UDID = (UDE ? UDE["UserDirectoryParentID"] : (_UGE[1][1] || (_UGE[1][5] ? US.DG : null))))) {//右键选择 这里允许了临时文件夹处理
  29. if (_UTP == "mouseup") {
  30. U.M.StopBubble();
  31. _UQE = U.Dk.HP.WPCZQXHQ(_UDID, _UGE, UDE);
  32. _UKE = _UQE[2][0];
  33. _UDID = _UKE[_UKE.length - 1].UserDirectoryID; //递归获取指定导航目录
  34. if (UFT || (((_UME = U.D.DragE) && _UME.TC.length > 1) && !_UME.Event())) { //文件多选
  35. _UAE = U.Dk.RM.MFDRC(UFT || _UME.TC, (UAE && UAE.length > 1) ? UAE : _UGE[0]); //获取多选的文件
  36. _UME = [[2, 3, 4, 6],
  37. [[[U.Dk.RE.WPSCWJ, [_UAE, userid]]],
  38. [[U.Dk.RE.WPFZ, [_UAE, "Copy", userid]]],
  39. [[U.Dk.RE.WPFZ, [_UAE, "Cut", userid]]],
  40. [[U.Dk.RM.DWJXZ, [_UAE]]]]]; //多选文件目录
  41. }
  42. else {
  43. var _UDOD;
  44. if (_UIE) {
  45. _UDOD = $(UDOD).childg()[1];
  46. _UDOD = $(_UDOD).childg()[1];
  47. _UDOD = $(_UDOD).Child()[0];
  48. }
  49. else {
  50. _UDOD = $(UDOD).childg()[0];
  51. _UDOD = $(_UDOD).childg()[1];
  52. _UDOD = $(_UDOD).Child()[0];
  53. }
  54. _UME = UDE ? (UDE["filetype"] ? [[0, 1, 2, 3, 4, 6, 11, 17, 18, 19],
  55. [UDOD.onclick, [[U.Dk.RE.WPCMM, [_UDOD, UDE, userid]]],
  56. [[U.Dk.RE.WPSCWJ, [UDE, userid]]],
  57. [[U.Dk.RE.WPFZ, [UDE, "Copy", userid]]], //复制
  58. [[U.Dk.RE.WPFZ, [UDE, "Cut", userid]]], //剪切
  59. [[U.Dk.RE.WPXZWJZJO, [UDE.UserDirectoryID, UDE.filetype ? "file" : "folder"]]],
  60. [[U.Dk.RE.WPCKPL, [UDE, userid]]],
  61. [[U.Dk.RE.WPCKSX, ["this", UDE, _UGE[1][2]]]], [[U.Dk.RE.DWJXZ, [_UAE && _UAE.length ? _$(_$(_UAE).Select({ "filetype": 1 })).pluck("UserDirectoryID").join(",") : UDE.UserDirectoryID, "true"]]], [U.D.DT.YYDK, ["Txt", UDE]]]] :
  62. [[0, 1, 2, 3, 4, 5, 6, 17],
  63. [UDOD.onclick, [[U.Dk.RE.WPCMM, [_UDOD, UDE, userid]]],
  64. [[U.Dk.RE.WPSCWJ, [UDE, userid]]], [[U.Dk.RE.WPFZ, [UDE, "Copy", userid]]],
  65. [[U.Dk.RE.WPFZ, [UDE, "Cut", userid]]], [[U.Dk.RE.WPWJJM, [UDE, userid]]],
  66. [[U.Dk.RE.WPXZWJZJO, [UDE.UserDirectoryID, UDE.filetype ? "file" : "folder"]]],
  67. [[U.Dk.RE.WPCKSX, ["this", UDE, userid]]]]]) : [[7, 8, 9, 10, 12, 13, 14, 15, 16, 17],
  68. [[[U.Dk.RE.WPXJWJ, ["folder", _UDPD, _UGE[1][2]]]], [[U.Dk.RE.WPXJWJ, ["txt", _UDPD, _UGE[1][2]]]],
  69. [[U.Dk.RE.WPXJWJ, ["uw", _UDPD, _UGE[1][2]]]],
  70. [[U.Dk.RE.WPXJWJ, ["ue", _UDPD, _UGE[1][2]]]],
  71. [[U.Dk.RE.WPJQ, [_UGE[1][2]]]],
  72. [[U.Dk.RE.GXWPCKXS, [userid, _UKE[0], true]]],
  73. [U.Dk.UP.XWPOP, [userid]],
  74. null,
  75. null,
  76. [[U.Dk.RE.WPCKSX, ["this", _$(_UGE[0]).Select({ "UserDirectoryID": _UGE[1][1] })[0], userid]]]]];
  77. } //单选选项
  78. if (UDE) {//文件左键
  79. if (!_UQE[4]) { //非管理员权限
  80. for (i = 0; i < 2; i++) {
  81. j = String(2 - i);
  82. if (_$(_UAE).Select({ UserDirectoryEncrypt: j }).length || (UDE && UDE.UserDirectoryEncrypt == j)) {
  83. _UQE[i] = false;
  84. }
  85. } //去除多余权限
  86. if (_UQE[1]) {
  87. _USE = _USE.concat[3, 6];
  88. }
  89. if (_UQE[0]) {
  90. _USE = _USE.concat[12, 14];
  91. } //只有上传权限 //只有下载权限
  92. for (i = 0; i < _UME[0].length; i++) {
  93. if (_USE.indexOf(_UME[0][i]) < 0) {
  94. _UME[0].splice(i, 1);
  95. _UME[1].splice(i, 1); i--;
  96. }
  97. } //去除功能
  98. }
  99. _USE = [];
  100. if (US.Disk.ApplicationTypes.text.types.indexOf(UDE.UserDirectoryExtendType) == -1) { _USE.push(19); }
  101. if (!(_UAE && _UAE.length) && _UDID == US.FG && (UDE && !UDE["filetype"])) { _USE.push(5); }
  102. if (!US.userInfo.IsUseStudioMembe && (UDE.filetype == 0 && ((UAE && UAE.length) ? !_$(UAE).Select({ filetype: 1 }).length : true)) && ((i = _UME[0].indexOf(18)) > -1)) { _USE.push(18); } //没有加密解密 //没有置顶权限
  103. for (i = 0; i < _USE.length; i++) {
  104. if ((j = _UME[0].indexOf(_USE[i])) > -1) {
  105. _UME[0].splice(j, 1); _UME[1].splice(j, 1);
  106. }
  107. }
  108. if (((_UAE && _UAE.length) && !UDE) || !_UME.length) {
  109. U.Alert("无权限访问。"); return;
  110. } //去除权限
  111. }
  112. else {//目录中右键
  113. _UDAD[12].style.color = U.Dk.RE.CE.length ? "#000" : "#b2b2b2";
  114. if (!_UQE[0]) { for (i = 0; i < _UME.length; i++) { _UME[i].splice(0, 5); _UME[i].splice(1, 1); } } //无添加权限
  115. else if (!(_UDID == US.DG || _UDID == US.FG || _UKE[0].GroupID)) { _UME[0].splice(1, 2); _UME[1].splice(1, 2); } //无新建office权限
  116. }
  117. if ((UDE && ((_UAE && (_UAE = _$(_UAE).Like({ "UserDirectoryID": _UQE[3] })).length)) || _UQE[3].indexOf(_UGE[1][1]) > -1)) {
  118. if (_UAE && _UAE.length) {
  119. _UDTD[0].style.display = "none"; U.Alert("初始化的目录无法选择"); return;
  120. }
  121. else {
  122. _UME = [[0, 6, 17], [UDOD.onclick, [[U.Dk.RE.WPXZWJZJO, [_UGE[1][1], (UDE && UDE.filetype) ? "file" : "folder"]]], [[U.Dk.RE.WPCKSX, ["this", UDE, userid]]]]];
  123. }
  124. } //初始化目录的权限
  125. for (i = 0; i < _UDAD.length; i++) { //设置显示右键
  126. if (i == 5) {
  127. _UDAD[i].innerText = (UDE && UDE["UserDsirectoryEncrypt"]) ? "解密" : "加密";
  128. }
  129. $(_UDAD[i]).addAttrArray({ "style": { "display": (((j = _UME[0].indexOf(i)) > -1) ? (_UME[0].splice(j, 1), (j = _UME[1].splice(j, 1)[0]), "block") : "none") }, "onmouseup": j != -1 ? (j || _UDAD[i].onmouseup) : _UDAD[i].onmouseup });
  130. }
  131. _UDTD[0].style.display = "block";
  132. U.M.RLocate(_UDTD[0]);
  133. return; //右键定位
  134. }
  135. }
  136. if (_UTP == "mousedown" && !UDE && UDOD && _UGE[1][5]) {
  137. U.D.DragSelectE({ "SSO": UDOD, "SO": UDOD, "CS": "UD_SYWRZOI" });
  138. }
  139. _UDTD[0].style.display = "none"; //右键以外的消失 //隐藏右键菜单 && _UGE[1][4] == "Normal"
  140. }
  141. //批量处理文件
  142. U.Dk.RM.DWJXZ = function (UDE) {
  143. var i, _UTP = "ue,uw", _UCE = [];
  144. for (i = 0; i < UDE.length; i++) {
  145. if (_UTP.indexOf(UDE[i].UserDirectoryExtendType.toLowerCase()) == -1) { _UCE.push(UDE[i].UserDirectoryID); }
  146. }
  147. U.Dk.RE.WPXZWJZJO(_UCE.join(","), "");
  148. }
  149. //多文件右键菜单的显示
  150. U.Dk.RM.MFDRC = function (UDAD, UGE) {
  151. var i, _UCE = [];
  152. for (i = 0; i < UDAD.length; i++) {
  153. _UCE.push(UDAD[i].id);
  154. };
  155. return _$(UGE).Like({ "UserDirectoryID": _UCE.join(",") });
  156. }
  157. //#endregion