123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- //--------------------------------------------------------------右键菜单----------------------------------------------------------------------
- Namespace.register("U.Dk.RM"); //Disk的右键命名空间
- //#region 右键查看处理
- ////详细视图右键处理
- //U.Dk.RM.WPYJCDX = function (UDOD, UDPD, UDE, UPE, userid) {
- // if (event.button == 2) {//右键选择
- // var i, _UTF, _UDAD = $(UDPD).checked();
- // if (_UDAD.length > 1) {
- // for (i = 0; i < _UDAD.length; i++) {
- // _UDAD[i] = $(_UDAD[i]).Parent(2); (!_UTF && _UDAD[i] == UDOD) && (_UTF = true);
- // }
- // } //获取是否多选
- // U.Dk.RM.WPYJCD(UDOD, UDE, UPE, _UTF ? _UDAD : "", userid); //多选元素处理
- // }
- //}
- //右键菜单弹出
- U.Dk.RM.WPYJCD = function (UDOD, UDE, UAE, UFT, userid) {
- var i, j, _UDID, _UQE, _UKE, _UME, _UAE,
- _UJE = [],
- _USE = [0, 11, 17],
- _UTP = event.type,
- _userid = US.userInfo.userid,
- _UGE = !userid ? US.Disk.UserDisk : U.Dk.DiskOperatingSwitch(userid),
- _UIE = _UGE[1][4] == "Details",
- _UDTD = $("#" + (_UGE[2] ? "UD_SYWMO" : "UD_SYWM"), _UGE.pdiv),
- _UDSD = $("#" + (_UGE[2] ? "UD_SYWOCRC" : "UD_SYWRZ"), _UGE.pdiv)[0],
- _UDPD = $(_UDSD).Parent(2), _UDAD = _UDTD.Child();
- if (UDOD && event.button == 2 && (_UDID = (UDE ? UDE["UserDirectoryParentID"] : (_UGE[1][1] || (_UGE[1][5] ? US.DG : null))))) {//右键选择 这里允许了临时文件夹处理
- if (_UTP == "mouseup") {
- U.M.StopBubble();
- _UQE = U.Dk.HP.WPCZQXHQ(_UDID, _UGE, UDE);
- _UKE = _UQE[2][0];
- _UDID = _UKE[_UKE.length - 1].UserDirectoryID; //递归获取指定导航目录
- if (UFT || (((_UME = U.D.DragE) && _UME.TC.length > 1) && !_UME.Event())) { //文件多选
- _UAE = U.Dk.RM.MFDRC(UFT || _UME.TC, (UAE && UAE.length > 1) ? UAE : _UGE[0]); //获取多选的文件
- _UME = [[2, 3, 4, 6],
- [[[U.Dk.RE.WPSCWJ, [_UAE, userid]]],
- [[U.Dk.RE.WPFZ, [_UAE, "Copy", userid]]],
- [[U.Dk.RE.WPFZ, [_UAE, "Cut", userid]]],
- [[U.Dk.RM.DWJXZ, [_UAE]]]]]; //多选文件目录
- }
- else {
- var _UDOD;
- if (_UIE) {
- _UDOD = $(UDOD).childg()[1];
- _UDOD = $(_UDOD).childg()[1];
- _UDOD = $(_UDOD).Child()[0];
- }
- else {
- _UDOD = $(UDOD).childg()[0];
- _UDOD = $(_UDOD).childg()[1];
- _UDOD = $(_UDOD).Child()[0];
- }
- _UME = UDE ? (UDE["filetype"] ? [[0, 1, 2, 3, 4, 6, 11, 17, 18, 19],
- [UDOD.onclick, [[U.Dk.RE.WPCMM, [_UDOD, UDE, userid]]],
- [[U.Dk.RE.WPSCWJ, [UDE, userid]]],
- [[U.Dk.RE.WPFZ, [UDE, "Copy", userid]]], //复制
- [[U.Dk.RE.WPFZ, [UDE, "Cut", userid]]], //剪切
- [[U.Dk.RE.WPXZWJZJO, [UDE.UserDirectoryID, UDE.filetype ? "file" : "folder"]]],
- [[U.Dk.RE.WPCKPL, [UDE, userid]]],
- [[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]]]] :
- [[0, 1, 2, 3, 4, 5, 6, 17],
- [UDOD.onclick, [[U.Dk.RE.WPCMM, [_UDOD, UDE, userid]]],
- [[U.Dk.RE.WPSCWJ, [UDE, userid]]], [[U.Dk.RE.WPFZ, [UDE, "Copy", userid]]],
- [[U.Dk.RE.WPFZ, [UDE, "Cut", userid]]], [[U.Dk.RE.WPWJJM, [UDE, userid]]],
- [[U.Dk.RE.WPXZWJZJO, [UDE.UserDirectoryID, UDE.filetype ? "file" : "folder"]]],
- [[U.Dk.RE.WPCKSX, ["this", UDE, userid]]]]]) : [[7, 8, 9, 10, 12, 13, 14, 15, 16, 17],
- [[[U.Dk.RE.WPXJWJ, ["folder", _UDPD, _UGE[1][2]]]], [[U.Dk.RE.WPXJWJ, ["txt", _UDPD, _UGE[1][2]]]],
- [[U.Dk.RE.WPXJWJ, ["uw", _UDPD, _UGE[1][2]]]],
- [[U.Dk.RE.WPXJWJ, ["ue", _UDPD, _UGE[1][2]]]],
- [[U.Dk.RE.WPJQ, [_UGE[1][2]]]],
- [[U.Dk.RE.GXWPCKXS, [userid, _UKE[0], true]]],
- [U.Dk.UP.XWPOP, [userid]],
- null,
- null,
- [[U.Dk.RE.WPCKSX, ["this", _$(_UGE[0]).Select({ "UserDirectoryID": _UGE[1][1] })[0], userid]]]]];
- } //单选选项
- if (UDE) {//文件左键
- if (!_UQE[4]) { //非管理员权限
- for (i = 0; i < 2; i++) {
- j = String(2 - i);
- if (_$(_UAE).Select({ UserDirectoryEncrypt: j }).length || (UDE && UDE.UserDirectoryEncrypt == j)) {
- _UQE[i] = false;
- }
- } //去除多余权限
- if (_UQE[1]) {
- _USE = _USE.concat[3, 6];
- }
- if (_UQE[0]) {
- _USE = _USE.concat[12, 14];
- } //只有上传权限 //只有下载权限
- for (i = 0; i < _UME[0].length; i++) {
- if (_USE.indexOf(_UME[0][i]) < 0) {
- _UME[0].splice(i, 1);
- _UME[1].splice(i, 1); i--;
- }
- } //去除功能
- }
- _USE = [];
- if (US.Disk.ApplicationTypes.text.types.indexOf(UDE.UserDirectoryExtendType) == -1) { _USE.push(19); }
- if (!(_UAE && _UAE.length) && _UDID == US.FG && (UDE && !UDE["filetype"])) { _USE.push(5); }
- 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); } //没有加密解密 //没有置顶权限
- for (i = 0; i < _USE.length; i++) {
- if ((j = _UME[0].indexOf(_USE[i])) > -1) {
- _UME[0].splice(j, 1); _UME[1].splice(j, 1);
- }
- }
- if (((_UAE && _UAE.length) && !UDE) || !_UME.length) {
- U.Alert("无权限访问。"); return;
- } //去除权限
- }
- else {//目录中右键
- _UDAD[12].style.color = U.Dk.RE.CE.length ? "#000" : "#b2b2b2";
- if (!_UQE[0]) { for (i = 0; i < _UME.length; i++) { _UME[i].splice(0, 5); _UME[i].splice(1, 1); } } //无添加权限
- else if (!(_UDID == US.DG || _UDID == US.FG || _UKE[0].GroupID)) { _UME[0].splice(1, 2); _UME[1].splice(1, 2); } //无新建office权限
- }
- if ((UDE && ((_UAE && (_UAE = _$(_UAE).Like({ "UserDirectoryID": _UQE[3] })).length)) || _UQE[3].indexOf(_UGE[1][1]) > -1)) {
- if (_UAE && _UAE.length) {
- _UDTD[0].style.display = "none"; U.Alert("初始化的目录无法选择"); return;
- }
- else {
- _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]]]]];
- }
- } //初始化目录的权限
- for (i = 0; i < _UDAD.length; i++) { //设置显示右键
- if (i == 5) {
- _UDAD[i].innerText = (UDE && UDE["UserDsirectoryEncrypt"]) ? "解密" : "加密";
- }
- $(_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 });
- }
- _UDTD[0].style.display = "block";
- U.M.RLocate(_UDTD[0]);
- return; //右键定位
- }
- }
- if (_UTP == "mousedown" && !UDE && UDOD && _UGE[1][5]) {
- U.D.DragSelectE({ "SSO": UDOD, "SO": UDOD, "CS": "UD_SYWRZOI" });
- }
- _UDTD[0].style.display = "none"; //右键以外的消失 //隐藏右键菜单 && _UGE[1][4] == "Normal"
- }
- //批量处理文件
- U.Dk.RM.DWJXZ = function (UDE) {
- var i, _UTP = "ue,uw", _UCE = [];
- for (i = 0; i < UDE.length; i++) {
- if (_UTP.indexOf(UDE[i].UserDirectoryExtendType.toLowerCase()) == -1) { _UCE.push(UDE[i].UserDirectoryID); }
- }
- U.Dk.RE.WPXZWJZJO(_UCE.join(","), "");
- }
- //多文件右键菜单的显示
- U.Dk.RM.MFDRC = function (UDAD, UGE) {
- var i, _UCE = [];
- for (i = 0; i < UDAD.length; i++) {
- _UCE.push(UDAD[i].id);
- };
- return _$(UGE).Like({ "UserDirectoryID": _UCE.join(",") });
- }
- //#endregion
|