Namespace.register("U.Dk.RE"); //Disk右键功能命名空间 U.Dk.RE.CE = []; U.Dk.RE.TF = ""; //#region 右键菜单功能 //#region 快速推送目录消息 //发送消息 U.Dk.RE.TSXXML = function () { var i, _dirid, _fileinfo, _UKE, _UCE, _UTF = 1, _userid = US.userInfo.userid, _diskinfo = US.Disk.UserDisk; //获取文件权限 if (_diskinfo[1][2] == _userid || _diskinfo[2]) { if (_diskinfo[2] || ((_fileinfo = _$(_diskinfo[0]).RecurD(null, { "UserDirectoryID": _diskinfo[1][1] }, "UserDirectoryParentID"), _UCE = _fileinfo[_fileinfo.length - 1], _dirid = _UCE.UserDirectoryID) && _UCE.GroupID || _dirid == US.FG)) { //判断是否群文件推送或者是目录推送 _dirid = _diskinfo[1][1]; _UKE = _$(U.Dk.HP.MLWJSY[_fileinfo[0]], _diskinfo[0][0]).groupBy("UserId"); _UCE = []; for (i in _UKE) { (_UKE.hasOwnProperty(i) && i != _userid) && (_UCE.push({ UserId: i, UserThumbnailImageHead: _UKE[i][0].UserThumbnailImageHead })); }; if (_UCE.length) { U.F.W.ViewFriend({ GroupManageID: _dirid, GroupManageName: _fileinfo[0].UserDirectoryName + "(" + _UCE.length + ")人", GroupManageDescript: "推送消息让所有人都能收到你的通知", "UserId": _UCE.pluck("UserId").join(",") }); return "" } //获取上传列表中的用户 _UTF = 0; } else { _UTF = 2; } } (_UTF != null) && (U.Alert["无参与消息的用户", "只能在本人共享内推送消息", "本人目录无法推送消息"][_UTF]); } //#endregion //#region 新建文件夹 //新建文件夹权限 U.Dk.RE.QXWJPD = function (userid, UTF, UDID) { var _UUID = US.userInfo.userid, _diskinfo = U.Dk.DiskOperatingSwitch(userid), _UEM = U.Dk.HP.WPCZQXHQ(UDID), _UCE = _UEM[2][0], _UPID = _UCE[_UCE.length - 1].UserDirectoryID; //切换 return (_UEM[0] && (UTF == "folder" || (_UPID == US.FG || _UPID == US.DG || _UCE[_UCE.length - 1].GroupID))); } //新建文件或者文件夹 U.Dk.RE.WPXJWJ = function (UTF, UDOD, userid) { if (!U.U.L.isLogin(3)) { if (U.Dk.RE.QXWJPD(userid, UTF)) { U.Dk.RE.CMB(UTF, null, UDOD || US.Disk.UserDisk.pdiv, userid); } else { U.Alert("无权限访问此文件夹"); }; } } //创建添加提示 U.Dk.RE.CMB = function (UTP, UAF, UDOD, userid, UTF) { var _UDTD, _UDSD, _dirid, _UFL = false, _UTF = "txt,uw,ue,folder"; if (_UTF.indexOf(UTP) > -1) {//允许新建的类型 _UDTD = $$("div", { "className": "UDL U_UI_dlnoSR" }); _UFL = true; _UDSD = $$("div", {}, _UDTD); _dirid = $$("input", { "type": "text", "style": { "cssText": "width: 248px; height: 20px; line-height:20px; border:0; outline:none; background:none;" } }, _UDSD); U.Dk.RE.Prompt(UTP == "folder" ? "新建文件夹" : "新建" + UTP + "文件", 140, 350, _UDTD, U.M.apply(_UDTD, [[U.Dk.RE.AF, [UTP, _dirid, UAF, userid, UTF]]]), UDOD); //新建提示框 } return _UFL; } //新建的接口 U.Dk.RE.AF = function (UTF, UFN, UAF, userid, UFT) { var i, _fileinfo, _USID, _UOID, _UGID, _USC = 9999, _ULX = 1, _diskinfo = U.Dk.DiskOperatingSwitch(userid) || US.Disk.UserDisk, _UPID = _diskinfo[1][1] || US.DG, _UTM = U.Dk.HP.WPCZQXHQ(_UPID); (typeof UFN != "string") && (UFN = UFN.value || UFN.innerText || ""); if (_UTM[0] && _UPID && U.Dk.RE.MBC(_UPID, UFN, UTF, "Create") && U.Dk.RE.QXWJPD(userid, UTF)) { //权限判断 _fileinfo = []; while (_diskinfo[4][_USID || _UPID]) { _fileinfo.push(_diskinfo[4][_USID || _UPID]); _USID = _diskinfo[4][_USID || _UPID]["UserDirectoryParentID"] } _UGID = U.Dk.RE.WPHQID(_fileinfo, _diskinfo); ("folderencrypt".indexOf(UTF) > -1) && (_USC = _fileinfo[0].UserDirectoryDeep, _ULX = 0, _diskinfo[1][0].FilesCount += 1); _UOID = _fileinfo[_fileinfo.length - 1].UserDirectoryID; _fileinfo = U.Dk.M.RUS(new U.Dk.M.Entity(Guid.newGuid(), 0, _UPID, UFN.addEllipsis(20), UFN, UTF, null, U.MT.toTimeStamp(new Date()), "", _USC, null, _UOID == US.SG ? "true" : "", _ULX, "", (_UOID == US.FG ? userid : (_UGID || "")), null, userid)); //生成文件实体 if (_fileinfo.filetype == "1") { U.A.Request(US.Auth, ["CreateFile", US.userInfo.userid, _fileinfo["UserDirectoryID"], _fileinfo["UserDirectoryParentID"], UFN.escapeQuotes() + (UTF == "txt" ? ".txt" : ""), UTF, _fileinfo["UserFilesServerName"] || "", _UGID, _fileinfo.filetype == "1" ? (_fileinfo["UserDirectoryEncrypt"] || _UGID) : _fileinfo["UserDirectoryEncrypt"]]), U.Dk.RE.AsynAF, ["", _fileinfo, UAF, _diskinfo, U.D.SY.ET["Disk"]["SY"]["DJ"], userid, UTF, UFT]; //创建文件或者文件夹异步 } else { U.A.Request(US.Auth, ["CreateDirectory", US.userInfo.userid, _fileinfo["UserDirectoryID"], _fileinfo["UserDirectoryParentID"], _USC, UFN.escapeQuotes(), _UGID, _fileinfo.filetype == "1" ? (_fileinfo["UserDirectoryEncrypt"] || _UGID) : _fileinfo["UserDirectoryEncrypt"]]), U.Dk.RE.AsynAF, ["", _fileinfo, UAF, _diskinfo, U.D.SY.ET["Disk"]["SY"]["DJ"], userid, UTF, UFT]; //创建文件或者文件夹异步 } return _fileinfo; } else { U.Alert("拒绝访问"); } return false; } //添加文件异步 U.Dk.RE.AsynAF = function (r) { var context = r.context, _fileinfo = context[1], _cb = context[2], _diskinfo = context[3], _UDOD = context[4], _userid = context[5], _UTP = context[6], _UTF = context[7], _diskinfo = U.Dk.DiskOperatingSwitch(_userid), _dirid = _diskinfo[1][1]; r = r.value; if (r != null) { (_diskinfo[2] || _diskinfo[1][2] != US.userInfo.userid) && (U.Ut.AddObj(_fileinfo, { "UserId": US.userInfo.userid, "UserNickName": US.userInfo.UserNickName, "UserName": US.userInfo.username, "UserThumbnailImageHead": US.userInfo.UserThumbnailImageHead, "Parent": _diskinfo[4][_fileinfo.UserDirectoryParentID] })); var _diskinfo = U.Dk.DiskOperatingSwitch(_userid); //根据userid获取网盘的信息 //调用添加文件到disk全局的方法 U.Dk.M.Entity.Add([_fileinfo], _diskinfo); if (_dirid == _fileinfo.UserDirectoryParentID) { U.Dk.RE.AsynWPXJWJ(_UDOD, _userid, _fileinfo); } else if (!_dirid) { var _UDAD = $(_diskinfo[2] ? "#UD_SYWOC" : "#UD_SYWLTXO", _diskinfo.pdiv).childg(0)[_diskinfo[2] ? 1 : 3]; _UDAD = $(_UDAD).Child()[0].onclick(); } if (_cb) { _cb(context, r, _diskinfo[1][1] == _fileinfo); } else if (!_UTF && "txt,uw,ue".indexOf(_UTP) > -1) { U.Dk.LE.OpenFileDirectory(_fileinfo); } else if (U.Ut.isFunction(_UTF)) { (_UTF)(); } //显示添加和回调 } } //新建文件或者文件夹异步 U.Dk.RE.AsynWPXJWJ = function (UDOD, userid, UDE) { var _UDAD, _UDTD, _UDSD, _diskinfo = U.Dk.DiskOperatingSwitch(userid); if (!UDE["filetype"] && UDOD && $(UDOD).Parent().id.indexOf(UDE.UserDirectoryParentID) == 1) { _UDTD = $($(UDOD).Parent()).Child()[1]; (_UDTD) && (U.Dk.LL.XWPDH([UDE], _UDTD, null, null, userid)); } //文件夹添加左边导航 if (UDE["UserDirectoryParentID"] == _diskinfo[1][1] || !_diskinfo[1][1]) {//添加显示区域 _UDSD = $("#" + (_diskinfo[2] ? (U.Dk.LTWPDH(_diskinfo[2], _diskinfo), "UD_SYWOCRC") : (U.Dk.CSHYHWP(_diskinfo), "UD_SYWRZ")), _diskinfo.pdiv)[0]; //网盘信息输出 (_$(_diskinfo[0]).Select({ "UserDirectoryParentID": _diskinfo[1][1] }).length == 1) && (_UDSD.innerText = ""); //删除空文件提示 U.Dk.VW.XWPDY([UDE], _UDSD, _UDTD ? [(_UDAD = $(_UDTD).Child())[_UDAD.length - 1]] : null); //添加新建 } } //#endregion //#region 删除文件 //删除文件 U.Dk.RE.WPSCWJ = function (UDE, userid) { var _diskinfo = U.Dk.DiskOperatingSwitch(userid); //切换 U.Dk.RE.DMB(UDE, null, $("#UD_SYW" + (_diskinfo[2] ? "O" : ""), _diskinfo.pdiv)[0], userid); } //删除文件 U.Dk.RE.DMB = function (UDE, UAF, UDPD, userid) { userid = userid || (UDE.UserId || UDE.GroupID) || (UDE[0] && (UDE[0].UserId || UDE[0].GroupID)) || US.userInfo.userid; //选择删除文件的用户ID var i, _UH, _UDOD, _userid = US.userInfo.userid; UDE = UDE.length ? UDE : [UDE]; if (U.Dk.HP.WPCZQXHQ()[4] || (UDE = _$(UDE).Select({ "UserId": _userid })).length) { //权限设置 if (UDE.length > 1) { _UDOD = $$("div", { "style": { "cssText": "float:left;text-align:center;width:100%;padding:5% 0 5% 0;" } }); $$("span", { "style": { "cssText": "font-weight:bold;" }, "innerHTML": "你确定要删除这" + UDE.length + "项吗?" }, _UDOD); } //多文件删除 else { _UDOD = U.Dk.RE.ABYS(null, UDE[0]); } //单文件处理 U.Dk.RE.Prompt("删除文件", _UH, 350, _UDOD, U.M.apply(this, [[U.Dk.RE.DF, [UDE, UAF, userid]]]), UDPD); //创建删除窗口 } else { U.Alert("拒绝访问"); } } //删除文件接口 U.Dk.RE.DF = function (UDE, UCB, userid) { UDE = UDE.length == null ? [UDE] : UDE; var i, _userid = US.userInfo.userid, _UAID = _$(UDE).pluck("UserDirectoryID").join(","); U.A.Request(US.Auth, ["DeleteDirectoryOrFile", _UAID, UDE[0].GroupID || ""]), U.Dk.RE.AsynDF, ["", UDE, UCB, userid]; //文件夹和文件同时删除 } //删除文件异步 U.Dk.RE.AsynDF = function (r) { var i, _dirid, _USE, context = r.context, _fileinfo = context[1], _UCB = context[2], _userid = context[3], _diskinfo = U.Dk.DiskOperatingSwitch(_userid); r = r.value; if (r) { _USE = U.Dk.RE.DFWJJ(_fileinfo, _userid); _diskinfo[1][0].FileSize -= _USE[0]; _diskinfo[1][0].FilesCount -= _USE[1]; U.Dk.RE.AsynWPSCWJ(_fileinfo, _userid); } //允许删除 else { U.Alert("操作失败!"); } } //删除实体文件处理 U.Dk.RE.DFWJJ = function (UDE, userid) { var i, j, _UKE, _UCE = [0, 0], _diskinfo = U.Dk.DiskOperatingSwitch(userid); for (i = 0; i < UDE.length; i++) { for (j = 0; j < _diskinfo[0].length; j++) { if (_diskinfo[0][j].UserDirectoryID == UDE[i].UserDirectoryID || (UDE[i].tf && UDE[i].UserDirectoryParentID == _diskinfo[0][j].UserDirectoryParentID)) { _UKE = _diskinfo[0][j]; (!_UKE.filetype) && (UDE.push({ "UserDirectoryParentID": _UKE.UserDirectoryID, "tf": true })); _UCE[0] += _UKE.UserDirectorySize; _diskinfo[0].splice(j, 1); (!UDE[i].tf) && (_$(_diskinfo[4][_UKE.UserDirectoryParentID].Child).Delete({ UserDirectoryID: _UKE.UserDirectoryID })); _UCE[1]++; j--; } } } return _UCE; } //删除文件异步 U.Dk.RE.AsynWPSCWJ = function (UDE, userid) { var i, j, _UDPD, _UCE = ["L", "R"], _diskinfo = U.Dk.DiskOperatingSwitch(userid); for (i = 0; i < UDE.length; i++) { if (UDE[i].UserDirectoryID) { for (j = 0; j < _UCE.length; j++) { ($("#" + _UCE[j] + UDE[i]["UserDirectoryID"])).remove(); } } } //删除文件 _diskinfo[2] ? (_UDPD = "UD_SYWOCRC", U.Dk.LTWPDH(_diskinfo[2], _diskinfo)) : (_UDPD = "UD_SYWRZ", U.Dk.CSHYHWP(_diskinfo)); (!(_UDPD = $("#" + _UDPD, _diskinfo.pdiv)).Child()[0]) && (U.Dk.VW.XWPDYXK(_UDPD[0])); //展示信息 } //#endregion //#region 重命名 //重命名 U.Dk.RE.WPCMM = function (UDOD, UDE) { var _dirid, _userid = US.userInfo.userid; if (U.Dk.HP.WPCZQXHQ(null, null, UDE)[4]) {//本人才允许重命名 UDOD.innerText = ""; (_dirid = $$("input", { "ondblclick": U.M.StopBubble, "onblur": [[U.Dk.RE.TWPCMM, ["this", UDE, UDE.UserId || _userid]]], "onclick": U.M.StopBubble, "className": "UD_SYSXZTST", "value": UDE["UserallDirectoryName"].replace("." + UDE["UserDirectoryExtendType"], "") }, UDOD)).select(); _dirid.onkeyup = U.M.apply(_dirid, [[U.M.returnkeylogin, [_dirid, [[_dirid.onblur]]]]]); //回车修改 } else { U.Alert("拒绝访问"); } } //重命名提示 U.Dk.RE.TWPCMM = function (UDOD, UDE, userid) { var _UDPD = $(UDOD).Parent(), _UTF = U.Dk.RE.MFN(UDE, UDOD.value, null, userid); if (_UTF || _UTF == "none") { _UDPD.innerText = UDE.UserallDirectoryName; _UDPD = $("#L" + UDE["UserDirectoryID"], _diskinfo.pdiv)[0]; (_UDPD) && ($("div", _UDPD)[3].innerText = UDE.UserallDirectoryName); } // } //修改文件名 U.Dk.RE.MFN = function (UDE, UST, UCB, userid) { userid = userid || US.userInfo.userid; var _UEN = UDE.UserDirectoryExtendType, _diskinfo = U.Dk.DiskOperatingSwitch(userid), _USN = UST.replaceHtmlSign(); UST = UST.replaceHtmlSign() + (UDE.filetype ? "." + _UEN : ""); (_UEN == "folderencrypt") && (_UEN = "folder"); if (UST == UDE.UserallDirectoryName) { _UTF = "none"; } //无变化直接修改成功 else if (U.Dk.RE.MBC((_diskinfo && _diskinfo[1] && _diskinfo[1][1] ? _diskinfo[1][1] : UDE.UserDirectoryParentID), UST, _UEN, "Change")) { _UTF = true; if (_UEN == "folder") { U.A.Request(US.Auth, ["UpdateDirectoryInfo", UDE.UserDirectoryID, UST], U.Dk.RE.AsynMRN, ["", UDE, UST, UCB, userid]); } else { U.A.Request(US.Auth, ["UpdateFileInfo", UDE.UserDirectoryID, UST], U.Dk.RE.AsynMRN, ["", UDE, UST, UCB, userid]); } } (_UTF) && (U.Ut.AddObj(UDE, { "UserallDirectoryName": UST, "UserDirectoryName": UST.addEllipsis(20) })); return _UTF; } //修改文件名异步 U.Dk.RE.AsynMRN = function (r) { var context = r.context, _fileinfo = context[1], _UST = context[2], _UCB = context[3], _userid = context[4], _diskinfo = U.Dk.DiskOperatingSwitch(_userid); r = r.value; if (r) { (_UST) && (U.Ut.AddObj(_fileinfo, { "UserallDirectoryName": _UST, "UserDirectoryName": _UST.addEllipsis(20) })); U.Dk.RE.AsynWPCMM(_fileinfo); (_UCB) && (_UCB(context, r)); } //成功修改 } //重命名异步 U.Dk.RE.AsynWPCMM = function (UDE) { var i, _UCE = ["L", "R"], _diskinfo = US.Disk.UserDisk; for (i = 0; i < _UCE.length; i++) { _UDCD = $("#" + _UCE[i] + UDE.UserDirectoryID, _diskinfo.pdiv); if (_UDCD[0]) { if (i) { _UDCD = _UDCD.childg()[0]; _UDCD = $(_UDCD).childg()[1]; _UDCD = $(_UDCD).Child()[0] = UDE.UserallDirectoryName; } else { _UDCD = _UDCD.childg()[0]; _UDCD = $(_UDCD).Child()[2].innerHTML = UDE.UserallDirectoryName; } } // (_UDCD[0]) && ((i ? _UDCD.childg(0, 0).childg(0, 1).Child()[0] : _UDCD.childg(0, 0).Child()[2]).innerHTML = UDE.UserallDirectoryName) } } //#endregion //#region 复制 剪切 粘贴 //文件复制剪切 U.Dk.RE.WPFZ = function (UDE, TF) { UDE = UDE.length ? UDE : [UDE]; //这里是可复制多文件 多文件用数组表示,如果只穿了一个文件 转换成 [UDE] U.Dk.RE.CE = UDE; //复制文件集合定义全局变量 U.Dk.RE.TF = TF; //复制还是粘贴 复制传 Copy 剪切穿 Cut U.Dk.RE.OR = US.Disk.UserDisk; //当前当前使用者的网盘 U.Dk.RE.UEI = U.Dk.HP.ZDQXWPHQ(US.Disk.UserDisk[1][1], US.Disk.UserDisk); //判断是否具有复制粘贴权限 U.Dk.RE.UDID = UDE[0].UserDirectoryID; //当前复制的目录 } //粘贴 U.Dk.RE.WPJQ = function (userid) { if (U.Dk.RE.UDID == US.Disk.UserDisk[1][2] && U.Dk.RE.TF == "Cut") { U.Alert("文件粘贴成功"); } else { U.Dk.DiskOperatingSwitch(userid); U.Dk.RE.UFStick(userid); } } //粘贴文件 U.Dk.RE.UFStick = function (userid, UCB, UDID) { var _UGID, _dirid, _UCE, _UFT, _UME = U.Dk.RE, //复制粘贴的集合 _UTP = _UME.TF, //判断是否为复制还是粘贴 复制为Copy 粘贴为Cat _fileinfo = _UME.CE, //需要复制的文件 _UBE = _UME.UEI[0][_UME.UEI[0].length - 1], //复制粘贴的权限 _USID = _UBE.UserDirectoryID, //复制到另外一个文件的id _diskinfo = U.Dk.DiskOperatingSwitch(userid), //切换掉本人的网盘 _UTF = U.Dk.HP.WPCZQXHQ(UDID), // _UKE = _UTF[2][0][_UTF[2][0].length - 1]; // UDID = UDID || _diskinfo[1][1]; // if (_$(_fileinfo).Select({ UserDirectoryID: UDID })[0]) { U.Alert("不允许添加到选择目录"); } //添加 else if (_UTF[0]) {//目录允许粘贴 if (_fileinfo.length && (((_dirid = _UKE.UserDirectoryID) == US.FG || _UKE.GroupID != null) || ((_dirid == _USID || _dirid == US.SG) && US.userInfo.userid == userid)) || !UDID) { //相同目录类型的 获取添加到共享 我的私密 _UGID = U.Dk.RE.WPHQID(_UTF[2][0], _diskinfo); _UCE = U.Dk.HP.MLWJSY(_fileinfo); if (_UTP == "Cut" || _diskinfo[1][0].FileSize + _UCE[1] <= U.UP.GetSfileS(_diskinfo[1][0].UserDiskSpace + "M")) { if (!UDID) { U.Alert("自动整理分配粘贴文件"); _UTP = _UTP == "Cut"; U.A.Request(US.Auth, ["CopyOrCutAndPasteFiles", US.userInfo.userid, _$(_fileinfo).pluck("UserDirectoryID").join(","), _UTP, UDID]), U.Dk.RE.AsynTSStick, ["", UDID, _fileinfo, _UCE[1], UCB, _diskinfo[1][2], _UGID, _UTP, _dirid]; } //所有文件需要分配目录 else { if (_UTP == "Cut") { U.A.Request(US.Auth, ["CutAndPasteFiles", US.userInfo.userid, UDID, _$(_fileinfo).pluck("UserDirectoryID").join(","), _UGID, (_fileinfo[0].GroupID || "")]), U.Dk.RE.AsynUFStick, ["", UDID, _fileinfo, _UCE[1], UCB, _diskinfo[1][2], _UGID, _UTP, _dirid]; } else { U.A.Request(US.Auth, ["CopyAndPasteFiles", US.userInfo.userid, UDID, _$(_fileinfo).pluck("UserDirectoryID").join(","), _UGID, (_UCE[2].length ? _UME.UEI[0][0].UserDirectoryDeep : "")]), U.Dk.RE.AsynUFStick, ["", UDID, _fileinfo, _UCE[1], UCB, _diskinfo[1][2], _UGID, _UTP, _dirid]; } // U.A.Request(US.Auth,"UseStudioDisk." + _UTP + (_UTP == "Cut" ? "File" : (_UCE[2].length ? "Folder" : "File")), [US.userInfo.userid, UDID, _$(_fileinfo).pluck("UserDirectoryID").join(","), _UGID, _UTP == "Cut" ? (_fileinfo[0].GroupID || "") : (_UCE[2].length ? _UME.UEI[0][0].UserDirectoryDeep : "")]), U.Dk.RE.AsynUFStick, ["", UDID, _fileinfo, _UCE[1], UCB, _diskinfo[1][2], _UGID, _UTP, _dirid]; } //普通目录粘贴 } else { U.Alert("网盘已满"); } } else { U.Alert("请保存目录文件类型相同"); } } else { U.Alert("拒绝访问"); } //拒绝访问 } //异步粘贴 U.Dk.RE.AsynTSStick = function (r) { var i, _UPID, _dirid, _UCE, context = r.context, _fileinfo = context[2], _diskinfo = r.value; for (i = 0; i < _diskinfo.length; i++) { _dirid = _diskinfo[i].UserFilesID; _UPID = _diskinfo[i].UserDirectoryID; _UCE = _$(_fileinfo).Select({ UserDirectoryID: _diskinfo[i].PID })[0]; U.Ut.AddObj(_diskinfo[i], _UCE); U.Ut.AddObj(_diskinfo[i], { UserDirectoryParentID: _UPID, UserDirectoryID: _dirid, GroupID: null, UserDirectoryEncrypt: null }); } context.push(true); U.Dk.RE.AsynUFStick(r); } //粘贴异步 U.Dk.RE.AsynUFStick = function (r) { var i, j, _UFT, _UAE, _UCE, _UIF = US.userInfo, context = r.context, _dirid = context[1], _fileinfo = context[2], _USZ = context[3], _UCB = context[4], _userid = context[5], _UGID = context[6], _UTF = context[7], _UMID = context[8], _UPID = _fileinfo[0].UserDirectoryParentID, _diskinfo = U.Dk.DiskOperatingSwitch(_userid); r = r.value; if (r) { if (_UTF == "Cut" || _UTF === true) { //剪切处理 (_UTF !== true) && (_$(_fileinfo).Change({ UserDirectoryParentID: _dirid }), U.Dk.M.RecursionUpdateDirectory(_fileinfo, { GroupID: _UGID })); if (_diskinfo[4][_dirid] && _diskinfo[4][_dirid].Child) {//粘贴文件或节点 _diskinfo[4][_dirid].Child = _diskinfo[4][_dirid].Child.concat(_fileinfo) } if (_diskinfo[4][_UPID] && _diskinfo[4][_UPID].Child) {//删除节点文件 for (i = 0; i < _fileinfo.length; i++) { _$(_diskinfo[4][_UPID].Child).Delete({ "UserDirectoryID": _fileinfo[i].UserDirectoryID }); } } U.Dk.RE.WPFZ(_fileinfo, "Copy"); //从新设置剪切 if ((_UAE = U.Dk.RE.OR) !== _diskinfo) { for (i = 0; i < _fileinfo.length; i++) { _diskinfo[0].push((_fileinfo[i] = _diskinfo[4][_fileinfo[i].UserDirectoryID] = (_$(_UAE[0]).Delete({ "UserDirectoryID": _fileinfo[i].UserDirectoryID })))); _diskinfo[4][_fileinfo[i].UserDirectoryParentID].Child.push(_fileinfo[i]); } //从其它网盘剪切文件 } _UFT = true; U.Ut.AddObj(_fileinfo, { "UserDirectoryEncrypt": _UMID == US.SG ? "true" : "", "GroupID": _UGID }); //修改文件属于的用户 } else { //复制处理 _UAE = []; for (i = 0; i < r.length; i++) { _UCE = r[i]; _diskinfo[0].push((_UCE = !_UTF ? _UCE : U.Dk.M.RUS(new U.Dk.M.Entity(_UCE.UserFilesID, _UCE.UserFilesSize, _UCE.UserDirectoryID, _UCE.UserFilesName.addEllipsis(20), _UCE.UserFilesName, _UCE.UserFilesExtendName, _UCE.UserFilesServerName, _UCE.UserFilesAddTime, _UCE.UseFilesServerThumbnailName || "", _UCE.UserDirectoryDeep, U.MT.toTimeStamp(), _UCE.UserDirectoryEncrypt, _UCE.UserFilesExtendName == "folder" ? 0 : 1, "", _UGID)))); _diskinfo[4][_UCE.UserDirectoryID] = _UCE; for (j = 0; j < _fileinfo.length; j++) { if (_fileinfo[j].UserDirectoryID == r[i].PID || _fileinfo[j].UserFilesID == r[i].PID) { (_diskinfo[4][_UCE.UserDirectoryParentID] && _diskinfo[4][_UCE.UserDirectoryParentID].Child) && (_diskinfo[4][_UCE.UserDirectoryParentID].Child.push(_UCE)); _UAE.push(_UCE); break; } } //_fileinfo.splice(j, 1); } _fileinfo = _UAE; } if (_UTF == "Copy" || _UTF === false || _UFT) { _diskinfo[1][0].FileSize += _USZ; _diskinfo[2] ? U.Dk.LTWPDH(_diskinfo[2], _diskinfo) : U.Dk.CSHYHWP(_diskinfo); } //修改网盘信息 if (_UGID && (_UAE = _$(US.Friend[2]).Select({ GroupManageID: _UGID })[0])) { if (!_UAE.DDC) { _UAE.DDC = 0; } _UAE.DDC += _fileinfo.length; } //群网盘资料变化 U.Dk.RE.AsynWPJQ(_userid, _fileinfo, _UPID, _UTF); (_UCB) && (_UCB(_fileinfo)); return _fileinfo[_fileinfo.length - 1]; //文件显示变化 } else { U.Alert("文件错误!"); } } //粘贴异步 U.Dk.RE.AsynWPJQ = function (userid, UDE, UPID, UTF) { var i, _UIE, _UDOD, _UAE = [], _UKE = [US.DG, US.PG, US.MG, US.VG], _diskinfo = U.Dk.DiskOperatingSwitch(userid) || US.Disk.UserDisk, _UDTD = $("#" + (_diskinfo[2] ? "UD_SYWOCRC" : "UD_SYWRZ"), _diskinfo.pdiv)[0], _dirid = _diskinfo[1][1], _UOID = UDE[0].UserDirectoryParentID; US.Disk.DiskDaren["SE"] = UDE[UDE.length - 1]; if (_UDTD && userid == _diskinfo[1][2]) { //在本域下执行 if ((_dirid == _UOID || (_dirid == "" && _UKE.indexOf(_UOID))) && (UTF == "Copy" || UPID != _UOID)) { _UDOD = $("#" + (_diskinfo[2] ? "UD_SYWOCRC" : "UD_SYWRZ"), _diskinfo.pdiv)[0]; (_$(_diskinfo[0]).Select({ "UserDirectoryParentID": _diskinfo[1][1] }).length == UDE.length) && (_UDOD.innerText = ""); U.Dk.VW.XWPDY(UDE, _UDOD); } //等同于添加文件 else if ((UPID && _dirid == UPID)) { U.Dk.RE.AsynWPSCWJ(UDE, userid); } //等同于移除文件 else if (U.Ut.isBoolean(UTF)) { _diskinfo[1][1] = _UOID; if (!_diskinfo[2]) { _UDOD = $("#UD_SYWLC", _diskinfo.pdiv)[0].style.display == "none" ? $("#L" + _UOID, _diskinfo.pdiv)[0] : $("#UD_SYWLC", _diskinfo.pdiv).Child()[((_UIE = _UKE.indexOf(_UOID)) > 0 ? _UIE : -4) + 3]; if (_UDOD) { $(_UDOD).Child()[0].onclick(); } }; (!_UDOD) && (U.Dk.LE.OpenFileDirectory(_$(_diskinfo[0]).Select({ "UserDirectoryID": _UOID })[0], userid)); _UDTD.scrollTop = _UDTD.scrollHeight; } //直接跳转到文件夹 _UDOD = null; for (i = 0; i < UDE.length; i++) { if (!UDE[i]["filetype"] && (_UDOD = _UDOD || $("#L" + UDE[i].UserDirectoryParentID)[0])) { _UAE.push(UDE[i]); } } //文件夹添加左边导航 (_UAE.length && (_UDOD = $(_UDOD).Child()[1])) && (U.Dk.LL.XWPDH(_UAE, _UDOD, null, null, userid)); _diskinfo[2] ? U.Dk.LTWPDH(_diskinfo[2], _diskinfo) : U.Dk.CSHYHWP(_diskinfo); //网盘信息输出 } } //#endregion //#region 添加文件置顶 //文件置顶 U.Dk.RE.DWJXZ = function (UFID, UV) { //#error 文件添加指定审核 U.A.Request(US.CD, [US.DB, "UseStudio_Disk", "UD_I_AddFileEX", US.userInfo.userid, UFID, UV == "true" ? 1 : 0], U.M.apply(null, [[U.Alert, ["成功添加置顶"]]])); // U.A.Request(US.Auth,"UseStudioDisk.WJXG", [US.userInfo.userid, UFID, UV], U.M.apply(null, [[U.Alert, ["成功添加置顶"]]])); } //#endregion //#region 文件下载 //直接下载 U.Dk.RE.WPXZWJZJ = function (UDN, UFSN, UTF) { if (UFSN != "null" || !UFSN) { U.UP.FileDL(UDN, UFSN, UTF); } else { U.Alert("此文件无法下载"); } } //云端跳转下载 U.Dk.RE.WPXZWJZJO = function (UDID, UTP) { if (UDID && !U.U.L.isLogin()) { window.open("/userpages/UD_XZ.htm?id=" + UDID + "&type=" + (UTP || "")); } } //#endregion //#region 文件属性 //查看文件属性 U.Dk.RE.WPCKSX = function (UDOD, UDE, userid) { var _diskinfo = U.Dk.DiskOperatingSwitch(userid), _UDTD = U.Dk.RE.ABYS(UDE.UserDirectoryID, UDE, true); //用户属性框的样式 U.Dk.RE.Prompt(UDOD.innerText, $("select", _UDTD)[0] ? 235 : 215, 350, _UDTD, null, $("#UD_SYW" + (_diskinfo[2] ? "O" : ""), _diskinfo.pdiv)[0]); //添加访问框 } //用户属性框的样式 U.Dk.RE.ABYS = function (UDID, UDE, UTF) { var i, _UCE, _UDOD, _UDTD, _UDSD, _UDMD, _userid = US.userInfo.userid, _USE = U.UP.FFT(UDE.UserDirectoryExtendType.toLowerCase()), _UTF = "文件" + (UDE.filetype ? "" : "夹"), _diskinfo = US.Disk.UserDisk; UDE = UDE || _$(_diskinfo[0]).Select({ "UserDirectoryID": UDID }, null, 1)[0]; _UCE; //= U.UP.IsDF(UDE.UserDirectoryExtendType)[0] _UDOD = $$("div", { "className": "UDK_SX" }); //$$("div", { "className": "UDK_SXT", "innerHTML": _UTF + "属性:" }, _UDOD); _UDTD = $$("div", { "className": "UDK_SXC" }, _UDOD); _UDSD = $$("div", { "className": "UDK_SXCO" }, _UDTD); if (U.UP.IsImg(UDE.UserDirectoryExtendType)) { $$("img", { "onerror": [[U.M.ImgError, [1]]], "src": U.M.GetImgU(UDE.UserDirectoryUrl), "className": "UDK_RT_UDD_DV" }, _UDSD); } //图片设置 else { $$("div", { "className": "UDK_L_DiskGE UDK_SXCOI", "style": { "cssText": _USE[1] } }, _UDSD); } _UDSD = $$("div", { "className": "UDK_SXCT" }, _UDTD); $$("div", { "className": "UDK_SXCTO", "style": { "marginTop": "4px" }, "innerHTML": "名称:" + UDE.UserallDirectoryName }, _UDSD); if (UDE.filetype) { $$("div", { "className": "UDK_SXCTT UC_TF", "onselectstart": U.M.StopBubble, "spellcheck": "false", "innerHTML": "链接:" + (_USE[0] == "图片文件" ? U.M.GetImgU(UDE["UserFilesServerName"]) : "http://disk.1473.cn/" + UDE["UserDirectoryID"]) }, _UDSD); } else if (UDID != US.FG && UDE.GroupID == _userid && _userid == _diskinfo[1][2] && UTF) {//ftp上传的设置 _UDMD = $$("div", { "className": "UDK_SXCTO" }, _UDSD); $$("div", { "innerHTML": "权限选择: ", "className": "UDK_SXCTOQ" }, _UDMD); _UDMD = $$("div", { "className": "UDK_SXCTOS" }, _UDMD); _UDMD = $$("select", { "onchange": [[U.Dk.RE.GXSZQX, ["this", UDE]]] }, _UDMD); _UDMD.options.length = 3; _UCE = ["无限制", "只允许上传", "只允许下载"]; for (i = 0; i < 3; i++) { _UDMD.options[i].text = _UCE[i]; } _UCE = UDE.UserDirectoryEncrypt; (_UCE == "1" || _UCE == "2") && (_UDMD.selectedIndex = parseInt(_UCE)); } $$("div", { "className": "UDK_SXCTO", "innerHTML": "类型:" + _UTF }, _UDSD); $$("div", { "className": "UDK_SXCTO", "innerHTML": "创建日期:" + U.MT.formatDateToArray(UDE.UserDirectoryAddTime) }, _UDSD); $$("div", { "className": "UDK_SXCTO", "innerHTML": "文件大小:" + U.UP.FileSize(UDE.UserDirectorySize) }, _UDSD); return _UDOD; } //共享文件夹设置权限 U.Dk.RE.GXSZQX = function (UDOD, UDE) { var _UDV = UDOD.selectedIndex; U.Dk.RE.SQX(UDE.UserDirectoryID, _UDV ? _UDV : ""); //设置权限 } //这是用户权限 全部为0的guid允许上传不允许下载 全部为1的guid允许下载不允许上传 U.Dk.RE.SQX = function (UDID, UV) { U.A.Request(US.CD, [US.DB, "UseStudio_Disk", "SetFtpPriviledge", UDID, UV], U.Dk.RE.AsynETUE, ["", "SZ", UDID, UV]); U.Alert("和服务器同步中..."); // U.A.Request(US.Auth,"UseStudioDisk.SetUserQX", [US.userInfo.userid, UDID, UV], U.Dk.RE.AsynETUE, ["", "SZ", UDID, UV]); U.Alert("和服务器同步中..."); } //#endregion //#region 设置文件加密 //设置文件加密 U.Dk.RE.WPWJJM = function (UDE) { var _UKE = U.Dk.HP.WPCZQXHQ(null, null, UDE), _diskinfo = US.Disk.UserDisk; if (_UKE[2][_UKE[2].length - 1].GroupID == null && _UKE[4]) { //判断是否允许修改 U.Dk.RE.SHEW(UDE.UserDirectoryEncrypt ? false : true, UDE.UserDirectoryID, $("#UD_SYW" + (_diskinfo[2] ? "O" : ""), _diskinfo.pdiv)[0]); } } //加密解密窗体 U.Dk.RE.SHEW = function (UTF, UDID, UDPD) { var _UDOD, _UDTD, _UW = 280, _UH = 180; if (UTF) { _UDOD = $$("div", { "className": "UDK_JM" }); _UDTD = $$("div", { "className": "UDK_JMO" }, _UDOD); } else { _UDTD = $$("div", { "className": "UDK_JMA" }); _UH = 125; } $$("span", { "className": "UDK_JMOS", "innerHTML": "输入密码:" }, _UDTD); $$("input", { "className": "UDK_JMOI", "type": "password" }, _UDTD); //密码框 if (UTF) { _UDSD = $$("div", { "className": "UDK_JMOT" }, _UDOD); $$("span", { "className": "UDK_JMOS", "innerHTML": "确认密码:" }, _UDSD); $$("input", { "type": "password", "className": "UDK_JMOI" }, _UDSD); } //加密的框 U.Dk.RE.Prompt("文件夹" + (UTF ? "加密" : "解密"), _UH, _UW, _UDOD || _UDTD, U.M.apply(_UDOD || _UDTD, [[U.Dk.RE.ETUE, [UTF, UDID]]]), UDPD || US.Disk.UserDisk[1][3]); //设置 } //加密的接口 U.Dk.RE.ETUE = function (UTF, UDID) { var _dirid = $("input", this), _UM = _dirid[0].value, _UTM = UTF ? _dirid[1].value : _UM; if (_UM.isStrNull() && _UM == _UTM) { U.A.Request(US.Auth, [(UTF ? "DirectoryEncrypt" : "DirectoryDecrypt"), UDID, _UM]), U.Dk.RE.AsynETUE, ["", UTF, UDID]; } else { U.Alert("输入的内容有误"); } } //加密解密的异步 U.Dk.RE.AsynETUE = function (r) { var context = r.context, _UTF = context[1], _dirid = context[2], _UV = context[3], _diskinfo = US.Disk.UserDisk, _fileinfo = _$(_diskinfo[0]).Select({ "UserDirectoryID": _dirid })[0]; r = r.value; // _UV = _UV == true ? "" : _UV; if (r) { (_fileinfo) && (U.Ut.AddObj(_fileinfo, { "UserDirectoryEncrypt": _UV == null ? r : _UV, "UserDirectoryExtendType": _UTF === true ? "folderencrypt" : "folder" })); U.Dk.RE.AsynWPWJJM(_fileinfo, _UV); } //文件加密异步 else { U.Alert("设置失败"); } //设置权限或者加密解密 } //设置文件加密异步 U.Dk.RE.AsynWPWJJM = function (UDE, UTF) { var i, _UCE = ["R", "L"], _dirid = UDE.UserDirectoryID; UTF = UTF ? ["UD_SYWRZOM", "UD_SYWLCJ"] : ["UD_SYWRZOW", "UD_SYWLCW"], _diskinfo = US.Disk.UserDisk; for (i = 0; i < _UCE.length; i++) { (_UDCD = $("#" + _UCE[i] + _dirid, _diskinfo.pdiv)[0]); (_UDCD) && ($("div", _UDCD)[i + 1].className = (i ? "UD_SYWLCOI UD_SYWLTXOST UD_SYID " : "UD_SYWRZOS UD_SYID ") + UTF[i]); } } //#endregion //#region 右键刷新 //加载当前网盘内容 // //* @param {string} 用户id //* @param {object} 目录信息 //* @param {element} loading的元素。 //* @param {callback} 回调函数 //* @returns {} 无 // U.Dk.RE.GXWPCKXS = function (userid, fileinfo, loading, cb) { //如果没有孩子节点,则去数据库取数据。 if (!fileinfo.Child) { U.A.Request(US.Auth, ["GetChildsByDirectoryId", userid, fileinfo.UserDirectoryID], U.Dk.RE.AsynGXWPCKXS, [loading, userid, fileinfo, cb]); } //如果有孩子节点,则直接打印输出。 else { cb ? cb() : U.Dk.RE.WPCKXS(userid, fileinfo); } //直接查看 } /** * 获取网盘数据异步,这里处理了后台数据返回后吧数据写到了全局变量US.Disk.Disks[userid][0]和US.Disk.Disks[userid][4]中 * * @param {object} ajax异步数据 */ U.Dk.RE.AsynGXWPCKXS = function (r) { var context = r.context, //获取异步的传参 _userid = context[1], //用户的id _fileinfo = context[2], //文件的信息 _cb = context[3], //回调函数 _dirid = _fileinfo.UserDirectoryID, //当前获取数据的目录id _diskinfo = U.Dk.DiskOperatingSwitch(_userid); //获取用户的disk信息 r = r.value; //把获取的数据设置到网盘全局变量中,为啥有两种数据结构? _$(_diskinfo[0]).Delete({ "UserDirectoryParentID": _dirid }); //移除原本有的目录文件 _$(_diskinfo[4]).Delete({ "UserDirectoryParentID": _dirid }); //移除原本有的目录文件 _fileinfo.Child = r; //设置目录的子目录或者文件 //添加文件 U.Dk.M.Entity.Add(r, _diskinfo); //把文件写入到全局变量中 在_diskinfo[0]和_diskinfo[4]写入获取文件的信息 U.Dk.RE.GXWPCKXS(_userid, _fileinfo, null, _cb); //异步加载成功,此处为递归?给每一个孩子节点添加孩子节点? } //目录更新 U.Dk.RE.WPCKXS = function (userid, fileinfo) { var _diskinfo = U.Dk.DiskOperatingSwitch(userid), //获取用户的disk信息 _dirid = _diskinfo[1][1], //当前查看网盘的目录id _contentel = $("#UD_SYWRZ", _diskinfo.pdiv)[0], //内容展示的元素 _leftel = $("#L" + _dirid, _diskinfo.pdiv)[0]; //左边点击的按钮; //如果用户还在等待当前目录信息出现,那么就展示,如果用户在loading的时候已经切换到其他地方去查看,那么则不展示数据更新 if (fileinfo.UserDirectoryID == _dirid) { //如果左键存在,则直接点击左键处理 if (_leftel) { _leftel.onclick(); } //目录更新查看 else { U.Dk.LE.OpenFileDirectory(fileinfo, userid); //打开目录操作 } } } //#endregion //#region 查看评论 //查看文件评论 U.Dk.RE.WPCKPL = function (UDE) { U.D.Img.Img(UDE, UDE); // U.D.CM.CKPLXS(UDE.UserDirectoryID, UDE.UserallDirectoryName); } //#endregion //#region 功能使用 //创建文件和修改文件命判断是否符合规范 U.Dk.RE.MBC = function (UDID, UST, UTF, UTP) { var _UAL, _UFT = false, _userid = US.userInfo.userid, _diskinfo = US.Disk.UserDisk, _fileinfo = _diskinfo[4][UDID].Child || _$(_diskinfo[0]).Select({ "UserDirectoryParentID": UDID }), _UAE = _$(_fileinfo).Select({ "UserDirectoryExtendType": "folder" }); //_$(_diskinfo[0]).Select({ "UserDirectoryParentID": UDID }); if (!UST.isStrNull()) { _UAL = "名字不能空"; } else if (!UST.count() > 40) { _UAL = "文件名过长"; } else if (UTP == "Create" && (UTF == "folder" && _fileinfo.length >= 500) || (UTF != "folder" && _fileinfo.length - _UAE.length >= 5000)) { _UAL = "无法创建,超过最大个数"; } else { _UFT = !_UFT; }; //创建的命名 (_UAL) && (U.Alert(_UAL)); return _UFT; // else if (UTF == "folder" && (_$(_fileinfo).Select({ "UserallDirectoryName": UST, "UserDirectoryExtendType": UTF })[0])) { _UAL = "目录已经包含了名为" + UST + "的文件夹"; } //文件夹不允许重名 } //获取Group分组的ID U.Dk.RE.WPHQID = function (UDE, UGE) { var _UCE = UDE[UDE.length - 1] || ""; return (UGE[2] || _UCE.UserDirectoryID == US.FG) ? UGE[1][2] : (_UCE.GroupID || ""); } //生成删除添加...提示框 U.Dk.RE.Prompt = function (UTS, UH, UW, UC, UCY, UDOD) { return U.UI.Confirm(UTS, { "width": UW ? UW + "px" : "", "height": UH ? (UH + "px") : "" }, "", UCY, UC, UDOD); } //#endregion //#endregion