U.DK.RE.js 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. Namespace.register("U.Dk.RE"); //Disk右键功能命名空间
  2. U.Dk.RE.CE = [];
  3. U.Dk.RE.TF = "";
  4. //#region 右键菜单功能
  5. //#region 快速推送目录消息
  6. //发送消息
  7. U.Dk.RE.TSXXML = function () {
  8. var i, _dirid, _fileinfo, _UKE, _UCE,
  9. _UTF = 1,
  10. _userid = US.userInfo.userid,
  11. _diskinfo = US.Disk.UserDisk; //获取文件权限
  12. if (_diskinfo[1][2] == _userid || _diskinfo[2]) {
  13. 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)) { //判断是否群文件推送或者是目录推送
  14. _dirid = _diskinfo[1][1];
  15. _UKE = _$(U.Dk.HP.MLWJSY[_fileinfo[0]], _diskinfo[0][0]).groupBy("UserId");
  16. _UCE = [];
  17. for (i in _UKE) {
  18. (_UKE.hasOwnProperty(i) && i != _userid) && (_UCE.push({ UserId: i, UserThumbnailImageHead: _UKE[i][0].UserThumbnailImageHead }));
  19. };
  20. if (_UCE.length) {
  21. U.F.W.ViewFriend({
  22. GroupManageID: _dirid,
  23. GroupManageName: _fileinfo[0].UserDirectoryName + "(" + _UCE.length + ")人",
  24. GroupManageDescript: "推送消息让所有人都能收到你的通知",
  25. "UserId": _UCE.pluck("UserId").join(",")
  26. });
  27. return ""
  28. } //获取上传列表中的用户
  29. _UTF = 0;
  30. }
  31. else { _UTF = 2; }
  32. }
  33. (_UTF != null) && (U.Alert["无参与消息的用户", "只能在本人共享内推送消息", "本人目录无法推送消息"][_UTF]);
  34. }
  35. //#endregion
  36. //#region 新建文件夹
  37. //新建文件夹权限
  38. U.Dk.RE.QXWJPD = function (userid, UTF, UDID) {
  39. var _UUID = US.userInfo.userid,
  40. _diskinfo = U.Dk.DiskOperatingSwitch(userid),
  41. _UEM = U.Dk.HP.WPCZQXHQ(UDID),
  42. _UCE = _UEM[2][0],
  43. _UPID = _UCE[_UCE.length - 1].UserDirectoryID; //切换
  44. return (_UEM[0] && (UTF == "folder" || (_UPID == US.FG || _UPID == US.DG || _UCE[_UCE.length - 1].GroupID)));
  45. }
  46. //新建文件或者文件夹
  47. U.Dk.RE.WPXJWJ = function (UTF, UDOD, userid) {
  48. if (!U.U.L.isLogin(3)) {
  49. if (U.Dk.RE.QXWJPD(userid, UTF)) {
  50. U.Dk.RE.CMB(UTF, null, UDOD || US.Disk.UserDisk.pdiv, userid);
  51. }
  52. else { U.Alert("无权限访问此文件夹"); };
  53. }
  54. }
  55. //创建添加提示
  56. U.Dk.RE.CMB = function (UTP, UAF, UDOD, userid, UTF) {
  57. var _UDTD, _UDSD, _dirid,
  58. _UFL = false,
  59. _UTF = "txt,uw,ue,folder";
  60. if (_UTF.indexOf(UTP) > -1) {//允许新建的类型
  61. _UDTD = $$("div", { "className": "UDL U_UI_dlnoSR" }); _UFL = true;
  62. _UDSD = $$("div", {}, _UDTD); _dirid = $$("input", { "type": "text", "style": { "cssText": "width: 248px; height: 20px; line-height:20px; border:0; outline:none; background:none;" } }, _UDSD);
  63. U.Dk.RE.Prompt(UTP == "folder" ? "新建文件夹" : "新建" + UTP + "文件", 140, 350, _UDTD, U.M.apply(_UDTD, [[U.Dk.RE.AF, [UTP, _dirid, UAF, userid, UTF]]]), UDOD); //新建提示框
  64. }
  65. return _UFL;
  66. }
  67. //新建的接口
  68. U.Dk.RE.AF = function (UTF, UFN, UAF, userid, UFT) {
  69. var i, _fileinfo, _USID, _UOID, _UGID,
  70. _USC = 9999,
  71. _ULX = 1,
  72. _diskinfo = U.Dk.DiskOperatingSwitch(userid) || US.Disk.UserDisk,
  73. _UPID = _diskinfo[1][1] || US.DG,
  74. _UTM = U.Dk.HP.WPCZQXHQ(_UPID);
  75. (typeof UFN != "string") && (UFN = UFN.value || UFN.innerText || "");
  76. if (_UTM[0] && _UPID && U.Dk.RE.MBC(_UPID, UFN, UTF, "Create") && U.Dk.RE.QXWJPD(userid, UTF)) { //权限判断
  77. _fileinfo = [];
  78. while (_diskinfo[4][_USID || _UPID]) {
  79. _fileinfo.push(_diskinfo[4][_USID || _UPID]);
  80. _USID = _diskinfo[4][_USID || _UPID]["UserDirectoryParentID"]
  81. }
  82. _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;
  83. _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)); //生成文件实体
  84. if (_fileinfo.filetype == "1") {
  85. 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]; //创建文件或者文件夹异步
  86. }
  87. else {
  88. 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]; //创建文件或者文件夹异步
  89. }
  90. return _fileinfo;
  91. }
  92. else { U.Alert("拒绝访问"); } return false;
  93. }
  94. //添加文件异步
  95. U.Dk.RE.AsynAF = function (r) {
  96. var context = r.context,
  97. _fileinfo = context[1],
  98. _cb = context[2],
  99. _diskinfo = context[3],
  100. _UDOD = context[4],
  101. _userid = context[5],
  102. _UTP = context[6],
  103. _UTF = context[7],
  104. _diskinfo = U.Dk.DiskOperatingSwitch(_userid),
  105. _dirid = _diskinfo[1][1];
  106. r = r.value;
  107. if (r != null) {
  108. (_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] }));
  109. var _diskinfo = U.Dk.DiskOperatingSwitch(_userid); //根据userid获取网盘的信息
  110. //调用添加文件到disk全局的方法
  111. U.Dk.M.Entity.Add([_fileinfo], _diskinfo);
  112. if (_dirid == _fileinfo.UserDirectoryParentID) {
  113. U.Dk.RE.AsynWPXJWJ(_UDOD, _userid, _fileinfo);
  114. }
  115. else if (!_dirid) {
  116. var _UDAD = $(_diskinfo[2] ? "#UD_SYWOC" : "#UD_SYWLTXO", _diskinfo.pdiv).childg(0)[_diskinfo[2] ? 1 : 3];
  117. _UDAD = $(_UDAD).Child()[0].onclick();
  118. }
  119. if (_cb) {
  120. _cb(context, r, _diskinfo[1][1] == _fileinfo);
  121. }
  122. else if (!_UTF && "txt,uw,ue".indexOf(_UTP) > -1) {
  123. U.Dk.LE.OpenFileDirectory(_fileinfo);
  124. }
  125. else if (U.Ut.isFunction(_UTF)) { (_UTF)(); } //显示添加和回调
  126. }
  127. }
  128. //新建文件或者文件夹异步
  129. U.Dk.RE.AsynWPXJWJ = function (UDOD, userid, UDE) {
  130. var _UDAD, _UDTD, _UDSD,
  131. _diskinfo = U.Dk.DiskOperatingSwitch(userid);
  132. if (!UDE["filetype"] && UDOD && $(UDOD).Parent().id.indexOf(UDE.UserDirectoryParentID) == 1) {
  133. _UDTD = $($(UDOD).Parent()).Child()[1];
  134. (_UDTD) && (U.Dk.LL.XWPDH([UDE], _UDTD, null, null, userid));
  135. } //文件夹添加左边导航
  136. if (UDE["UserDirectoryParentID"] == _diskinfo[1][1] || !_diskinfo[1][1]) {//添加显示区域
  137. _UDSD = $("#" + (_diskinfo[2] ? (U.Dk.LTWPDH(_diskinfo[2], _diskinfo), "UD_SYWOCRC") : (U.Dk.CSHYHWP(_diskinfo), "UD_SYWRZ")), _diskinfo.pdiv)[0]; //网盘信息输出
  138. (_$(_diskinfo[0]).Select({ "UserDirectoryParentID": _diskinfo[1][1] }).length == 1) && (_UDSD.innerText = ""); //删除空文件提示
  139. U.Dk.VW.XWPDY([UDE], _UDSD, _UDTD ? [(_UDAD = $(_UDTD).Child())[_UDAD.length - 1]] : null); //添加新建
  140. }
  141. }
  142. //#endregion
  143. //#region 删除文件
  144. //删除文件
  145. U.Dk.RE.WPSCWJ = function (UDE, userid) {
  146. var _diskinfo = U.Dk.DiskOperatingSwitch(userid); //切换
  147. U.Dk.RE.DMB(UDE, null, $("#UD_SYW" + (_diskinfo[2] ? "O" : ""), _diskinfo.pdiv)[0], userid);
  148. }
  149. //删除文件
  150. U.Dk.RE.DMB = function (UDE, UAF, UDPD, userid) {
  151. userid = userid || (UDE.UserId || UDE.GroupID) || (UDE[0] && (UDE[0].UserId || UDE[0].GroupID)) || US.userInfo.userid; //选择删除文件的用户ID
  152. var i, _UH, _UDOD,
  153. _userid = US.userInfo.userid;
  154. UDE = UDE.length ? UDE : [UDE];
  155. if (U.Dk.HP.WPCZQXHQ()[4] || (UDE = _$(UDE).Select({ "UserId": _userid })).length) { //权限设置
  156. if (UDE.length > 1) {
  157. _UDOD = $$("div", { "style": { "cssText": "float:left;text-align:center;width:100%;padding:5% 0 5% 0;" } });
  158. $$("span", { "style": { "cssText": "font-weight:bold;" }, "innerHTML": "你确定要删除这" + UDE.length + "项吗?" }, _UDOD);
  159. } //多文件删除
  160. else {
  161. _UDOD = U.Dk.RE.ABYS(null, UDE[0]);
  162. } //单文件处理
  163. U.Dk.RE.Prompt("删除文件", _UH, 350, _UDOD, U.M.apply(this, [[U.Dk.RE.DF, [UDE, UAF, userid]]]), UDPD); //创建删除窗口
  164. }
  165. else { U.Alert("拒绝访问"); }
  166. }
  167. //删除文件接口
  168. U.Dk.RE.DF = function (UDE, UCB, userid) {
  169. UDE = UDE.length == null ? [UDE] : UDE;
  170. var i,
  171. _userid = US.userInfo.userid,
  172. _UAID = _$(UDE).pluck("UserDirectoryID").join(",");
  173. U.A.Request(US.Auth, ["DeleteDirectoryOrFile", _UAID, UDE[0].GroupID || ""]), U.Dk.RE.AsynDF, ["", UDE, UCB, userid]; //文件夹和文件同时删除
  174. }
  175. //删除文件异步
  176. U.Dk.RE.AsynDF = function (r) {
  177. var i, _dirid, _USE,
  178. context = r.context,
  179. _fileinfo = context[1],
  180. _UCB = context[2],
  181. _userid = context[3],
  182. _diskinfo = U.Dk.DiskOperatingSwitch(_userid);
  183. r = r.value;
  184. if (r) {
  185. _USE = U.Dk.RE.DFWJJ(_fileinfo, _userid);
  186. _diskinfo[1][0].FileSize -= _USE[0];
  187. _diskinfo[1][0].FilesCount -= _USE[1];
  188. U.Dk.RE.AsynWPSCWJ(_fileinfo, _userid);
  189. } //允许删除
  190. else {
  191. U.Alert("操作失败!");
  192. }
  193. }
  194. //删除实体文件处理
  195. U.Dk.RE.DFWJJ = function (UDE, userid) {
  196. var i, j, _UKE,
  197. _UCE = [0, 0],
  198. _diskinfo = U.Dk.DiskOperatingSwitch(userid);
  199. for (i = 0; i < UDE.length; i++) {
  200. for (j = 0; j < _diskinfo[0].length; j++) {
  201. if (_diskinfo[0][j].UserDirectoryID == UDE[i].UserDirectoryID || (UDE[i].tf && UDE[i].UserDirectoryParentID == _diskinfo[0][j].UserDirectoryParentID)) {
  202. _UKE = _diskinfo[0][j];
  203. (!_UKE.filetype) && (UDE.push({ "UserDirectoryParentID": _UKE.UserDirectoryID, "tf": true }));
  204. _UCE[0] += _UKE.UserDirectorySize;
  205. _diskinfo[0].splice(j, 1);
  206. (!UDE[i].tf) && (_$(_diskinfo[4][_UKE.UserDirectoryParentID].Child).Delete({ UserDirectoryID: _UKE.UserDirectoryID }));
  207. _UCE[1]++; j--;
  208. }
  209. }
  210. }
  211. return _UCE;
  212. }
  213. //删除文件异步
  214. U.Dk.RE.AsynWPSCWJ = function (UDE, userid) {
  215. var i, j, _UDPD,
  216. _UCE = ["L", "R"],
  217. _diskinfo = U.Dk.DiskOperatingSwitch(userid);
  218. for (i = 0; i < UDE.length; i++) {
  219. if (UDE[i].UserDirectoryID) {
  220. for (j = 0; j < _UCE.length; j++) {
  221. ($("#" + _UCE[j] + UDE[i]["UserDirectoryID"])).remove();
  222. }
  223. }
  224. } //删除文件
  225. _diskinfo[2] ? (_UDPD = "UD_SYWOCRC", U.Dk.LTWPDH(_diskinfo[2], _diskinfo)) : (_UDPD = "UD_SYWRZ", U.Dk.CSHYHWP(_diskinfo));
  226. (!(_UDPD = $("#" + _UDPD, _diskinfo.pdiv)).Child()[0]) && (U.Dk.VW.XWPDYXK(_UDPD[0])); //展示信息
  227. }
  228. //#endregion
  229. //#region 重命名
  230. //重命名
  231. U.Dk.RE.WPCMM = function (UDOD, UDE) {
  232. var _dirid, _userid = US.userInfo.userid;
  233. if (U.Dk.HP.WPCZQXHQ(null, null, UDE)[4]) {//本人才允许重命名
  234. UDOD.innerText = "";
  235. (_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();
  236. _dirid.onkeyup = U.M.apply(_dirid, [[U.M.returnkeylogin, [_dirid, [[_dirid.onblur]]]]]); //回车修改
  237. }
  238. else {
  239. U.Alert("拒绝访问");
  240. }
  241. }
  242. //重命名提示
  243. U.Dk.RE.TWPCMM = function (UDOD, UDE, userid) {
  244. var _UDPD = $(UDOD).Parent(),
  245. _UTF = U.Dk.RE.MFN(UDE, UDOD.value, null, userid);
  246. if (_UTF || _UTF == "none") {
  247. _UDPD.innerText = UDE.UserallDirectoryName;
  248. _UDPD = $("#L" + UDE["UserDirectoryID"], _diskinfo.pdiv)[0];
  249. (_UDPD) && ($("div", _UDPD)[3].innerText = UDE.UserallDirectoryName);
  250. } //
  251. }
  252. //修改文件名
  253. U.Dk.RE.MFN = function (UDE, UST, UCB, userid) {
  254. userid = userid || US.userInfo.userid;
  255. var _UEN = UDE.UserDirectoryExtendType,
  256. _diskinfo = U.Dk.DiskOperatingSwitch(userid),
  257. _USN = UST.replaceHtmlSign();
  258. UST = UST.replaceHtmlSign() + (UDE.filetype ? "." + _UEN : "");
  259. (_UEN == "folderencrypt") && (_UEN = "folder");
  260. if (UST == UDE.UserallDirectoryName) { _UTF = "none"; } //无变化直接修改成功
  261. else if (U.Dk.RE.MBC((_diskinfo && _diskinfo[1] && _diskinfo[1][1] ? _diskinfo[1][1] : UDE.UserDirectoryParentID), UST, _UEN, "Change")) {
  262. _UTF = true;
  263. if (_UEN == "folder") {
  264. U.A.Request(US.Auth, ["UpdateDirectoryInfo", UDE.UserDirectoryID, UST], U.Dk.RE.AsynMRN, ["", UDE, UST, UCB, userid]);
  265. }
  266. else {
  267. U.A.Request(US.Auth, ["UpdateFileInfo", UDE.UserDirectoryID, UST], U.Dk.RE.AsynMRN, ["", UDE, UST, UCB, userid]);
  268. }
  269. }
  270. (_UTF) && (U.Ut.AddObj(UDE, { "UserallDirectoryName": UST, "UserDirectoryName": UST.addEllipsis(20) })); return _UTF;
  271. }
  272. //修改文件名异步
  273. U.Dk.RE.AsynMRN = function (r) {
  274. var context = r.context,
  275. _fileinfo = context[1],
  276. _UST = context[2], _UCB = context[3],
  277. _userid = context[4],
  278. _diskinfo = U.Dk.DiskOperatingSwitch(_userid);
  279. r = r.value;
  280. if (r) {
  281. (_UST) && (U.Ut.AddObj(_fileinfo, { "UserallDirectoryName": _UST, "UserDirectoryName": _UST.addEllipsis(20) }));
  282. U.Dk.RE.AsynWPCMM(_fileinfo);
  283. (_UCB) && (_UCB(context, r));
  284. } //成功修改
  285. }
  286. //重命名异步
  287. U.Dk.RE.AsynWPCMM = function (UDE) {
  288. var i,
  289. _UCE = ["L", "R"],
  290. _diskinfo = US.Disk.UserDisk;
  291. for (i = 0; i < _UCE.length; i++) {
  292. _UDCD = $("#" + _UCE[i] + UDE.UserDirectoryID, _diskinfo.pdiv);
  293. if (_UDCD[0]) {
  294. if (i) {
  295. _UDCD = _UDCD.childg()[0];
  296. _UDCD = $(_UDCD).childg()[1];
  297. _UDCD = $(_UDCD).Child()[0] = UDE.UserallDirectoryName;
  298. }
  299. else {
  300. _UDCD = _UDCD.childg()[0];
  301. _UDCD = $(_UDCD).Child()[2].innerHTML = UDE.UserallDirectoryName;
  302. }
  303. }
  304. // (_UDCD[0]) && ((i ? _UDCD.childg(0, 0).childg(0, 1).Child()[0] : _UDCD.childg(0, 0).Child()[2]).innerHTML = UDE.UserallDirectoryName)
  305. }
  306. }
  307. //#endregion
  308. //#region 复制 剪切 粘贴
  309. //文件复制剪切
  310. U.Dk.RE.WPFZ = function (UDE, TF) {
  311. UDE = UDE.length ? UDE : [UDE]; //这里是可复制多文件 多文件用数组表示,如果只穿了一个文件 转换成 [UDE]
  312. U.Dk.RE.CE = UDE; //复制文件集合定义全局变量
  313. U.Dk.RE.TF = TF; //复制还是粘贴 复制传 Copy 剪切穿 Cut
  314. U.Dk.RE.OR = US.Disk.UserDisk; //当前当前使用者的网盘
  315. U.Dk.RE.UEI = U.Dk.HP.ZDQXWPHQ(US.Disk.UserDisk[1][1], US.Disk.UserDisk); //判断是否具有复制粘贴权限
  316. U.Dk.RE.UDID = UDE[0].UserDirectoryID; //当前复制的目录
  317. }
  318. //粘贴
  319. U.Dk.RE.WPJQ = function (userid) {
  320. if (U.Dk.RE.UDID == US.Disk.UserDisk[1][2] && U.Dk.RE.TF == "Cut") {
  321. U.Alert("文件粘贴成功");
  322. }
  323. else {
  324. U.Dk.DiskOperatingSwitch(userid);
  325. U.Dk.RE.UFStick(userid);
  326. }
  327. }
  328. //粘贴文件
  329. U.Dk.RE.UFStick = function (userid, UCB, UDID) {
  330. var _UGID, _dirid, _UCE, _UFT,
  331. _UME = U.Dk.RE, //复制粘贴的集合
  332. _UTP = _UME.TF, //判断是否为复制还是粘贴 复制为Copy 粘贴为Cat
  333. _fileinfo = _UME.CE, //需要复制的文件
  334. _UBE = _UME.UEI[0][_UME.UEI[0].length - 1], //复制粘贴的权限
  335. _USID = _UBE.UserDirectoryID, //复制到另外一个文件的id
  336. _diskinfo = U.Dk.DiskOperatingSwitch(userid), //切换掉本人的网盘
  337. _UTF = U.Dk.HP.WPCZQXHQ(UDID), //
  338. _UKE = _UTF[2][0][_UTF[2][0].length - 1]; //
  339. UDID = UDID || _diskinfo[1][1]; //
  340. if (_$(_fileinfo).Select({ UserDirectoryID: UDID })[0]) {
  341. U.Alert("不允许添加到选择目录");
  342. } //添加
  343. else if (_UTF[0]) {//目录允许粘贴
  344. if (_fileinfo.length && (((_dirid = _UKE.UserDirectoryID) == US.FG || _UKE.GroupID != null) || ((_dirid == _USID || _dirid == US.SG) && US.userInfo.userid == userid)) || !UDID) { //相同目录类型的 获取添加到共享 我的私密
  345. _UGID = U.Dk.RE.WPHQID(_UTF[2][0], _diskinfo); _UCE = U.Dk.HP.MLWJSY(_fileinfo);
  346. if (_UTP == "Cut" || _diskinfo[1][0].FileSize + _UCE[1] <= U.UP.GetSfileS(_diskinfo[1][0].UserDiskSpace + "M")) {
  347. if (!UDID) {
  348. U.Alert("自动整理分配粘贴文件");
  349. _UTP = _UTP == "Cut";
  350. 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];
  351. } //所有文件需要分配目录
  352. else {
  353. if (_UTP == "Cut") {
  354. 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];
  355. }
  356. else {
  357. 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];
  358. }
  359. // 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];
  360. } //普通目录粘贴
  361. }
  362. else {
  363. U.Alert("网盘已满");
  364. }
  365. }
  366. else {
  367. U.Alert("请保存目录文件类型相同");
  368. }
  369. }
  370. else {
  371. U.Alert("拒绝访问");
  372. } //拒绝访问
  373. }
  374. //异步粘贴
  375. U.Dk.RE.AsynTSStick = function (r) {
  376. var i, _UPID, _dirid, _UCE,
  377. context = r.context,
  378. _fileinfo = context[2],
  379. _diskinfo = r.value;
  380. for (i = 0; i < _diskinfo.length; i++) {
  381. _dirid = _diskinfo[i].UserFilesID;
  382. _UPID = _diskinfo[i].UserDirectoryID;
  383. _UCE = _$(_fileinfo).Select({ UserDirectoryID: _diskinfo[i].PID })[0];
  384. U.Ut.AddObj(_diskinfo[i], _UCE); U.Ut.AddObj(_diskinfo[i], { UserDirectoryParentID: _UPID, UserDirectoryID: _dirid, GroupID: null, UserDirectoryEncrypt: null });
  385. }
  386. context.push(true);
  387. U.Dk.RE.AsynUFStick(r);
  388. }
  389. //粘贴异步
  390. U.Dk.RE.AsynUFStick = function (r) {
  391. var i, j, _UFT, _UAE, _UCE,
  392. _UIF = US.userInfo,
  393. context = r.context,
  394. _dirid = context[1],
  395. _fileinfo = context[2],
  396. _USZ = context[3],
  397. _UCB = context[4],
  398. _userid = context[5],
  399. _UGID = context[6],
  400. _UTF = context[7],
  401. _UMID = context[8],
  402. _UPID = _fileinfo[0].UserDirectoryParentID,
  403. _diskinfo = U.Dk.DiskOperatingSwitch(_userid);
  404. r = r.value;
  405. if (r) {
  406. if (_UTF == "Cut" || _UTF === true) { //剪切处理
  407. (_UTF !== true) && (_$(_fileinfo).Change({ UserDirectoryParentID: _dirid }), U.Dk.M.RecursionUpdateDirectory(_fileinfo, { GroupID: _UGID }));
  408. if (_diskinfo[4][_dirid] && _diskinfo[4][_dirid].Child) {//粘贴文件或节点
  409. _diskinfo[4][_dirid].Child = _diskinfo[4][_dirid].Child.concat(_fileinfo)
  410. }
  411. if (_diskinfo[4][_UPID] && _diskinfo[4][_UPID].Child) {//删除节点文件
  412. for (i = 0; i < _fileinfo.length; i++) {
  413. _$(_diskinfo[4][_UPID].Child).Delete({ "UserDirectoryID": _fileinfo[i].UserDirectoryID });
  414. }
  415. }
  416. U.Dk.RE.WPFZ(_fileinfo, "Copy"); //从新设置剪切
  417. if ((_UAE = U.Dk.RE.OR) !== _diskinfo) {
  418. for (i = 0; i < _fileinfo.length; i++) {
  419. _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]);
  420. } //从其它网盘剪切文件
  421. }
  422. _UFT = true;
  423. U.Ut.AddObj(_fileinfo, { "UserDirectoryEncrypt": _UMID == US.SG ? "true" : "", "GroupID": _UGID }); //修改文件属于的用户
  424. }
  425. else { //复制处理
  426. _UAE = [];
  427. for (i = 0; i < r.length; i++) {
  428. _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))));
  429. _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);
  430. }
  431. _fileinfo = _UAE;
  432. }
  433. if (_UTF == "Copy" || _UTF === false || _UFT) {
  434. _diskinfo[1][0].FileSize += _USZ;
  435. _diskinfo[2] ? U.Dk.LTWPDH(_diskinfo[2], _diskinfo) : U.Dk.CSHYHWP(_diskinfo);
  436. } //修改网盘信息
  437. if (_UGID && (_UAE = _$(US.Friend[2]).Select({ GroupManageID: _UGID })[0])) {
  438. if (!_UAE.DDC) { _UAE.DDC = 0; }
  439. _UAE.DDC += _fileinfo.length;
  440. } //群网盘资料变化
  441. U.Dk.RE.AsynWPJQ(_userid, _fileinfo, _UPID, _UTF); (_UCB) && (_UCB(_fileinfo));
  442. return _fileinfo[_fileinfo.length - 1]; //文件显示变化
  443. }
  444. else {
  445. U.Alert("文件错误!");
  446. }
  447. }
  448. //粘贴异步
  449. U.Dk.RE.AsynWPJQ = function (userid, UDE, UPID, UTF) {
  450. var i, _UIE, _UDOD, _UAE = [],
  451. _UKE = [US.DG, US.PG, US.MG, US.VG],
  452. _diskinfo = U.Dk.DiskOperatingSwitch(userid) || US.Disk.UserDisk,
  453. _UDTD = $("#" + (_diskinfo[2] ? "UD_SYWOCRC" : "UD_SYWRZ"), _diskinfo.pdiv)[0],
  454. _dirid = _diskinfo[1][1],
  455. _UOID = UDE[0].UserDirectoryParentID;
  456. US.Disk.DiskDaren["SE"] = UDE[UDE.length - 1];
  457. if (_UDTD && userid == _diskinfo[1][2]) { //在本域下执行
  458. if ((_dirid == _UOID || (_dirid == "" && _UKE.indexOf(_UOID))) && (UTF == "Copy" || UPID != _UOID)) {
  459. _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);
  460. } //等同于添加文件
  461. else if ((UPID && _dirid == UPID)) {
  462. U.Dk.RE.AsynWPSCWJ(UDE, userid);
  463. } //等同于移除文件
  464. else if (U.Ut.isBoolean(UTF)) {
  465. _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;
  466. } //直接跳转到文件夹
  467. _UDOD = null;
  468. for (i = 0; i < UDE.length; i++) {
  469. if (!UDE[i]["filetype"] && (_UDOD = _UDOD || $("#L" + UDE[i].UserDirectoryParentID)[0])) {
  470. _UAE.push(UDE[i]);
  471. }
  472. } //文件夹添加左边导航
  473. (_UAE.length && (_UDOD = $(_UDOD).Child()[1])) && (U.Dk.LL.XWPDH(_UAE, _UDOD, null, null, userid));
  474. _diskinfo[2] ? U.Dk.LTWPDH(_diskinfo[2], _diskinfo) : U.Dk.CSHYHWP(_diskinfo); //网盘信息输出
  475. }
  476. }
  477. //#endregion
  478. //#region 添加文件置顶
  479. //文件置顶
  480. U.Dk.RE.DWJXZ = function (UFID, UV) {
  481. //#error 文件添加指定审核
  482. 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, ["成功添加置顶"]]]));
  483. // U.A.Request(US.Auth,"UseStudioDisk.WJXG", [US.userInfo.userid, UFID, UV], U.M.apply(null, [[U.Alert, ["成功添加置顶"]]]));
  484. }
  485. //#endregion
  486. //#region 文件下载
  487. //直接下载
  488. U.Dk.RE.WPXZWJZJ = function (UDN, UFSN, UTF) {
  489. if (UFSN != "null" || !UFSN) { U.UP.FileDL(UDN, UFSN, UTF); } else { U.Alert("此文件无法下载"); }
  490. }
  491. //云端跳转下载
  492. U.Dk.RE.WPXZWJZJO = function (UDID, UTP) {
  493. if (UDID && !U.U.L.isLogin()) { window.open("/userpages/UD_XZ.htm?id=" + UDID + "&type=" + (UTP || "")); }
  494. }
  495. //#endregion
  496. //#region 文件属性
  497. //查看文件属性
  498. U.Dk.RE.WPCKSX = function (UDOD, UDE, userid) {
  499. var _diskinfo = U.Dk.DiskOperatingSwitch(userid),
  500. _UDTD = U.Dk.RE.ABYS(UDE.UserDirectoryID, UDE, true); //用户属性框的样式
  501. U.Dk.RE.Prompt(UDOD.innerText, $("select", _UDTD)[0] ? 235 : 215, 350, _UDTD, null, $("#UD_SYW" + (_diskinfo[2] ? "O" : ""), _diskinfo.pdiv)[0]); //添加访问框
  502. }
  503. //用户属性框的样式
  504. U.Dk.RE.ABYS = function (UDID, UDE, UTF) {
  505. var i, _UCE, _UDOD, _UDTD, _UDSD, _UDMD,
  506. _userid = US.userInfo.userid,
  507. _USE = U.UP.FFT(UDE.UserDirectoryExtendType.toLowerCase()),
  508. _UTF = "文件" + (UDE.filetype ? "" : "夹"),
  509. _diskinfo = US.Disk.UserDisk; UDE = UDE || _$(_diskinfo[0]).Select({ "UserDirectoryID": UDID }, null, 1)[0];
  510. _UCE; //= U.UP.IsDF(UDE.UserDirectoryExtendType)[0]
  511. _UDOD = $$("div", { "className": "UDK_SX" }); //$$("div", { "className": "UDK_SXT", "innerHTML": _UTF + "属性:" }, _UDOD);
  512. _UDTD = $$("div", { "className": "UDK_SXC" }, _UDOD); _UDSD = $$("div", { "className": "UDK_SXCO" }, _UDTD);
  513. if (U.UP.IsImg(UDE.UserDirectoryExtendType)) {
  514. $$("img", { "onerror": [[U.M.ImgError, [1]]], "src": U.M.GetImgU(UDE.UserDirectoryUrl), "className": "UDK_RT_UDD_DV" }, _UDSD);
  515. } //图片设置
  516. else {
  517. $$("div", { "className": "UDK_L_DiskGE UDK_SXCOI", "style": { "cssText": _USE[1] } }, _UDSD);
  518. }
  519. _UDSD = $$("div", { "className": "UDK_SXCT" }, _UDTD); $$("div", { "className": "UDK_SXCTO", "style": { "marginTop": "4px" }, "innerHTML": "名称:" + UDE.UserallDirectoryName }, _UDSD);
  520. if (UDE.filetype) {
  521. $$("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);
  522. }
  523. else if (UDID != US.FG && UDE.GroupID == _userid && _userid == _diskinfo[1][2] && UTF) {//ftp上传的设置
  524. _UDMD = $$("div", { "className": "UDK_SXCTO" }, _UDSD); $$("div", { "innerHTML": "权限选择: ", "className": "UDK_SXCTOQ" }, _UDMD); _UDMD = $$("div", { "className": "UDK_SXCTOS" }, _UDMD);
  525. _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]; }
  526. _UCE = UDE.UserDirectoryEncrypt; (_UCE == "1" || _UCE == "2") && (_UDMD.selectedIndex = parseInt(_UCE));
  527. }
  528. $$("div", { "className": "UDK_SXCTO", "innerHTML": "类型:" + _UTF }, _UDSD);
  529. $$("div", { "className": "UDK_SXCTO", "innerHTML": "创建日期:" + U.MT.formatDateToArray(UDE.UserDirectoryAddTime) }, _UDSD);
  530. $$("div", { "className": "UDK_SXCTO", "innerHTML": "文件大小:" + U.UP.FileSize(UDE.UserDirectorySize) }, _UDSD);
  531. return _UDOD;
  532. }
  533. //共享文件夹设置权限
  534. U.Dk.RE.GXSZQX = function (UDOD, UDE) {
  535. var _UDV = UDOD.selectedIndex;
  536. U.Dk.RE.SQX(UDE.UserDirectoryID, _UDV ? _UDV : ""); //设置权限
  537. }
  538. //这是用户权限 全部为0的guid允许上传不允许下载 全部为1的guid允许下载不允许上传
  539. U.Dk.RE.SQX = function (UDID, UV) {
  540. U.A.Request(US.CD, [US.DB, "UseStudio_Disk", "SetFtpPriviledge", UDID, UV], U.Dk.RE.AsynETUE, ["", "SZ", UDID, UV]);
  541. U.Alert("和服务器同步中...");
  542. // U.A.Request(US.Auth,"UseStudioDisk.SetUserQX", [US.userInfo.userid, UDID, UV], U.Dk.RE.AsynETUE, ["", "SZ", UDID, UV]); U.Alert("和服务器同步中...");
  543. }
  544. //#endregion
  545. //#region 设置文件加密
  546. //设置文件加密
  547. U.Dk.RE.WPWJJM = function (UDE) {
  548. var _UKE = U.Dk.HP.WPCZQXHQ(null, null, UDE), _diskinfo = US.Disk.UserDisk;
  549. if (_UKE[2][_UKE[2].length - 1].GroupID == null && _UKE[4]) { //判断是否允许修改
  550. U.Dk.RE.SHEW(UDE.UserDirectoryEncrypt ? false : true, UDE.UserDirectoryID, $("#UD_SYW" + (_diskinfo[2] ? "O" : ""), _diskinfo.pdiv)[0]);
  551. }
  552. }
  553. //加密解密窗体
  554. U.Dk.RE.SHEW = function (UTF, UDID, UDPD) {
  555. var _UDOD, _UDTD, _UW = 280, _UH = 180;
  556. if (UTF) { _UDOD = $$("div", { "className": "UDK_JM" }); _UDTD = $$("div", { "className": "UDK_JMO" }, _UDOD); } else { _UDTD = $$("div", { "className": "UDK_JMA" }); _UH = 125; }
  557. $$("span", { "className": "UDK_JMOS", "innerHTML": "输入密码:" }, _UDTD); $$("input", { "className": "UDK_JMOI", "type": "password" }, _UDTD); //密码框
  558. if (UTF) { _UDSD = $$("div", { "className": "UDK_JMOT" }, _UDOD); $$("span", { "className": "UDK_JMOS", "innerHTML": "确认密码:" }, _UDSD); $$("input", { "type": "password", "className": "UDK_JMOI" }, _UDSD); } //加密的框
  559. 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]); //设置
  560. }
  561. //加密的接口
  562. U.Dk.RE.ETUE = function (UTF, UDID) {
  563. var _dirid = $("input", this), _UM = _dirid[0].value, _UTM = UTF ? _dirid[1].value : _UM;
  564. if (_UM.isStrNull() && _UM == _UTM) {
  565. U.A.Request(US.Auth, [(UTF ? "DirectoryEncrypt" : "DirectoryDecrypt"), UDID, _UM]), U.Dk.RE.AsynETUE, ["", UTF, UDID];
  566. }
  567. else { U.Alert("输入的内容有误"); }
  568. }
  569. //加密解密的异步
  570. U.Dk.RE.AsynETUE = function (r) {
  571. 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;
  572. if (r) { (_fileinfo) && (U.Ut.AddObj(_fileinfo, { "UserDirectoryEncrypt": _UV == null ? r : _UV, "UserDirectoryExtendType": _UTF === true ? "folderencrypt" : "folder" })); U.Dk.RE.AsynWPWJJM(_fileinfo, _UV); } //文件加密异步
  573. else { U.Alert("设置失败"); } //设置权限或者加密解密
  574. }
  575. //设置文件加密异步
  576. U.Dk.RE.AsynWPWJJM = function (UDE, UTF) {
  577. var i, _UCE = ["R", "L"], _dirid = UDE.UserDirectoryID; UTF = UTF ? ["UD_SYWRZOM", "UD_SYWLCJ"] : ["UD_SYWRZOW", "UD_SYWLCW"], _diskinfo = US.Disk.UserDisk;
  578. 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]); }
  579. }
  580. //#endregion
  581. //#region 右键刷新
  582. //加载当前网盘内容
  583. //
  584. //* @param {string} 用户id
  585. //* @param {object} 目录信息
  586. //* @param {element} loading的元素。
  587. //* @param {callback} 回调函数
  588. //* @returns {} 无
  589. //
  590. U.Dk.RE.GXWPCKXS = function (userid, fileinfo, loading, cb) {
  591. //如果没有孩子节点,则去数据库取数据。
  592. if (!fileinfo.Child) {
  593. U.A.Request(US.Auth, ["GetChildsByDirectoryId", userid, fileinfo.UserDirectoryID], U.Dk.RE.AsynGXWPCKXS, [loading, userid, fileinfo, cb]);
  594. }
  595. //如果有孩子节点,则直接打印输出。
  596. else { cb ? cb() : U.Dk.RE.WPCKXS(userid, fileinfo); } //直接查看
  597. }
  598. /**
  599. * 获取网盘数据异步,这里处理了后台数据返回后吧数据写到了全局变量US.Disk.Disks[userid][0]和US.Disk.Disks[userid][4]中
  600. *
  601. * @param {object} ajax异步数据
  602. */
  603. U.Dk.RE.AsynGXWPCKXS = function (r) {
  604. var context = r.context, //获取异步的传参
  605. _userid = context[1], //用户的id
  606. _fileinfo = context[2], //文件的信息
  607. _cb = context[3], //回调函数
  608. _dirid = _fileinfo.UserDirectoryID, //当前获取数据的目录id
  609. _diskinfo = U.Dk.DiskOperatingSwitch(_userid); //获取用户的disk信息
  610. r = r.value;
  611. //把获取的数据设置到网盘全局变量中,为啥有两种数据结构?
  612. _$(_diskinfo[0]).Delete({ "UserDirectoryParentID": _dirid }); //移除原本有的目录文件
  613. _$(_diskinfo[4]).Delete({ "UserDirectoryParentID": _dirid }); //移除原本有的目录文件
  614. _fileinfo.Child = r; //设置目录的子目录或者文件
  615. //添加文件
  616. U.Dk.M.Entity.Add(r, _diskinfo); //把文件写入到全局变量中 在_diskinfo[0]和_diskinfo[4]写入获取文件的信息
  617. U.Dk.RE.GXWPCKXS(_userid, _fileinfo, null, _cb); //异步加载成功,此处为递归?给每一个孩子节点添加孩子节点?
  618. }
  619. //目录更新
  620. U.Dk.RE.WPCKXS = function (userid, fileinfo) {
  621. var _diskinfo = U.Dk.DiskOperatingSwitch(userid), //获取用户的disk信息
  622. _dirid = _diskinfo[1][1], //当前查看网盘的目录id
  623. _contentel = $("#UD_SYWRZ", _diskinfo.pdiv)[0], //内容展示的元素
  624. _leftel = $("#L" + _dirid, _diskinfo.pdiv)[0]; //左边点击的按钮;
  625. //如果用户还在等待当前目录信息出现,那么就展示,如果用户在loading的时候已经切换到其他地方去查看,那么则不展示数据更新
  626. if (fileinfo.UserDirectoryID == _dirid) {
  627. //如果左键存在,则直接点击左键处理
  628. if (_leftel) {
  629. _leftel.onclick();
  630. }
  631. //目录更新查看
  632. else {
  633. U.Dk.LE.OpenFileDirectory(fileinfo, userid); //打开目录操作
  634. }
  635. }
  636. }
  637. //#endregion
  638. //#region 查看评论
  639. //查看文件评论
  640. U.Dk.RE.WPCKPL = function (UDE) {
  641. U.D.Img.Img(UDE, UDE);
  642. // U.D.CM.CKPLXS(UDE.UserDirectoryID, UDE.UserallDirectoryName);
  643. }
  644. //#endregion
  645. //#region 功能使用
  646. //创建文件和修改文件命判断是否符合规范
  647. U.Dk.RE.MBC = function (UDID, UST, UTF, UTP) {
  648. var _UAL,
  649. _UFT = false,
  650. _userid = US.userInfo.userid,
  651. _diskinfo = US.Disk.UserDisk,
  652. _fileinfo = _diskinfo[4][UDID].Child || _$(_diskinfo[0]).Select({ "UserDirectoryParentID": UDID }),
  653. _UAE = _$(_fileinfo).Select({ "UserDirectoryExtendType": "folder" }); //_$(_diskinfo[0]).Select({ "UserDirectoryParentID": UDID });
  654. if (!UST.isStrNull()) { _UAL = "名字不能空"; }
  655. else if (!UST.count() > 40) { _UAL = "文件名过长"; }
  656. else if (UTP == "Create" && (UTF == "folder" && _fileinfo.length >= 500) || (UTF != "folder" && _fileinfo.length - _UAE.length >= 5000)) {
  657. _UAL = "无法创建,超过最大个数";
  658. }
  659. else { _UFT = !_UFT; }; //创建的命名
  660. (_UAL) && (U.Alert(_UAL));
  661. return _UFT; // else if (UTF == "folder" && (_$(_fileinfo).Select({ "UserallDirectoryName": UST, "UserDirectoryExtendType": UTF })[0])) { _UAL = "目录已经包含了名为" + UST + "的文件夹"; } //文件夹不允许重名
  662. }
  663. //获取Group分组的ID
  664. U.Dk.RE.WPHQID = function (UDE, UGE) {
  665. var _UCE = UDE[UDE.length - 1] || "";
  666. return (UGE[2] || _UCE.UserDirectoryID == US.FG) ? UGE[1][2] : (_UCE.GroupID || "");
  667. }
  668. //生成删除添加...提示框
  669. U.Dk.RE.Prompt = function (UTS, UH, UW, UC, UCY, UDOD) {
  670. return U.UI.Confirm(UTS, { "width": UW ? UW + "px" : "", "height": UH ? (UH + "px") : "" }, "", UCY, UC, UDOD);
  671. }
  672. //#endregion
  673. //#endregion