12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103 |
- Namespace.register("U.MD.DK.VW");
- U.MD.DK.VW.followState = function (diskel, userid) {
- var _followbutton = $(".U_MD_DK_LIRS", diskel);
- _followbutton.attr("user", userid);
- if (userid == US.userInfo.userid) {
- _followbutton[0].innerHTML = "本人";
- }
- else if (US.friend.friends && U.Json.select(US.friend.friends, { UserId: userid })[0]) {
- _followbutton[0].innerHTML = "已追随";
- _followbutton.addClass("U_MD_DK_LIRSED");
- } else {
- _followbutton[0].innerHTML = "追随";
- _followbutton.removeClass("U_MD_DK_LIRSED");
- }
- }
- U.MD.DK.VW.followState.click = function (button) {
- var _userid = $(button).attr("user");
- var _userinfo;
- if (_userid == US.userInfo.userid) {
- return;
- } else if (US.friend.friends && (_userinfo = U.Json.select(US.friend.friends, { UserId: _userid })[0])) {
- U.MD.F.M.deleteFriend(_userinfo, function () {
- button.innerHTML = "追随";
- $(button).removeClass("U_MD_DK_LIRSED");
- });
- } else {
- U.A.Request(US.CD, [US.DB, "UseStudio_Users", "GetUserinfoByUserId", _userid], function (r) {
- if (r.value && r.value[0]) {
- U.MD.F.M.addFriend(r.value[0], function () {
- button.innerHTML = "已追随";
- $(button).addClass("U_MD_DK_LIRSED");
- });
- } else {
- U.Alert("用户信息有误,请稍后尝试...");
- }
- });
- }
- }
- U.MD.DK.VW.viewsSwitch = function (viewtype, diskinfo) {
- var _contentel = $("#U_MD_DK_RZ", diskinfo.formel)[0],
- _viewnav = $(_contentel).prev()[0]
- ;
- diskinfo.viewtype = _contentel.viewtype = viewtype;
- if (diskinfo.currentDirectoryFile.length) {
- _contentel.innerHTML = "";
- U.MD.DK.VW.printContent(diskinfo.currentDirectoryFile, _contentel);
-
- if (viewtype == "Normal") {
- _contentel.style.width = "";
- _viewnav.style.display = "none";
- _contentel.style.height = $(_contentel).Parent(2).offsetHeight - 79 + "px"
- }
-
- else {
- U.MD.DK.VW.size(diskinfo);
- }
- }
- }
- U.MD.DK.VW.SortView = function (diskinfo, type, cb) {
- var _filesinfo = diskinfo.currentDirectoryFile,
- _contentel = $("#U_MD_DK_RZ", diskinfo.formel)[0]
- ;
-
- if (_filesinfo.length) {
-
- if (_filesinfo[0].UserDirectoryAddTime > _filesinfo[1].UserDirectoryAddTime) {
-
- U.UF.Math.sequence(_filesinfo, type, cb, 1);
- } else {
-
- U.UF.Math.sequence(_filesinfo, type, cb, -1);
- }
-
- _contentel.innerHTML = "";
- U.MD.DK.VW.printContent(_filesinfo, _contentel);
- }
- }
- U.MD.DK.VW.printContent = function (filesinfo, el) {
- var _diskinfo = US.disk.UserDisk,
- _viewtype = el.viewtype || "Normal",
- _viewnav = $(el).prev()[0]
- ;
-
- if (filesinfo.length) {
-
- if (_viewtype == "Normal") {
- U.MD.DK.VW.printNormalView(filesinfo, el);
- }
-
- else {
- U.MD.DK.VW.printDetailedView(filesinfo, el);
- }
- }
-
- else if (!$(el).Child().length) {
- U.MD.DK.VW.printNullView(el);
- }
- }
- U.MD.DK.VW.printNullView = function (el) {
- var _viewel,
- _infoel,
- _promptel,
- _viewel = $$("div", { "className": "U_MD_DK_RZF" }, el);
- _infoel = $$("div", { "className": "U_MD_DK_RZFS" }, _viewel);
- $$("div", { "className": "U_MD_DK_RZTSL U_MD_DK_RZFSL", "innerHTML": "!" }, _infoel);
- _promptel = $$("div", { "className": "U_MD_DK_RZFSR" }, _infoel);
-
- _infoel = $$("div", { "className": "U_MD_DK_RZFSRS" }, _promptel);
- $$("div", { "className": "U_MD_DK_RZFSRS", "innerHTML": "这地方暂时" }, _infoel);
- $$("div", { "className": "U_MD_DK_RZFSRS", "innerHTML": " 没有资源哦。" }, _infoel);
- $$("div", { "className": "U_MD_DK_RZTSRX U_MD_DK_RZFSRX", "innerHTML": "Nothing!!" }, _promptel);
- }
- U.MD.DK.VW.printNormalView = function (filesinfo, el) {
-
- var i,
- _isencryp,
- _date,
- _icon,
- _imgicon,
- _iconel,
- _imgeel,
- _infoel,
- _userimg,
- _frag = $$("frag"),
- _diskinfo = US.disk.UserDisk,
- _userid = _diskinfo.userInfo.UserId
- ;
-
- for (i = 0; i < filesinfo.length; i++) {
-
- _isencryp = (filesinfo[i]["UserDirectoryEncrypt"] && filesinfo[i]["UserDirectoryEncrypt"] != _userid);
- _date = U.UF.D.formatDateToArray(filesinfo[i]["UserDirectoryAddTime"], "Array");
- _icon = U.MD.DK.C.getIcon(filesinfo[i].UserDirectoryExtendType);
-
- _viewel = $$("div", {
- "title": filesinfo[i]["UserallDirectoryName"],
- "className": "U_MD_DK_RZO",
- "id": "R" + (filesinfo[i].UserDirectoryID),
- "onmousedown": function () {
- var _isindex = _diskinfo.selectElement.indexOf(this);
- if (_isindex > -1) {
- U.UF.EV.stopBubble();
- }
- },
- "oncontextmenu": U.UF.C.closure(function (fileinfo) {
- U.UF.EV.stopBubble();
- U.UF.EV.stopDefault();
- U.MD.DK.RM.rightMenu(this, fileinfo, US.disk.UserDisk);
- }, [filesinfo[i]])
- }, _frag);
-
- if (filesinfo[i].filetype == "1") {
- _viewel.onclick = U.UF.C.closure(function (fileinfo) {
- U.MD.DK.LE.openFileDirectory(fileinfo, _userid);
- }, [filesinfo[i]]);
- }
- else {
- _viewel.onclick = U.UF.C.closure(function (fileinfo) {
- U.MD.DK.LE.openFileDirectory(fileinfo, _userid);
- }, [filesinfo[i]]);
- }
-
- _imgicon = "";
- _iconel = $$("div", { "className": "U_MD_DK_RZOA" }, _viewel);
-
- if (filesinfo[i].filetype != 1) {
-
- if (_isencryp) {
- _imgicon = "U_MD_DK_Img U_MD_DK_RZOM";
- }
-
- else {
- _imgicon = "U_MD_DK_Img U_MD_DK_RZOW";
- }
- }
-
- else if (_icon.classname[1]) {
- _imgicon = "U_MD_DK_Img " + _icon.classname[1];
- }
- _imgeel = $$("div", { "className": "U_MD_DK_RZOS " + _imgicon }, _iconel);
-
- if (_icon.name == "文件") {
- $$("div", { "className": "U_MD_DK_RZOSZ", "innerHTML": filesinfo[i].UserDirectoryExtendType || "" }, _imgeel);
- }
- else if (!_icon.classname[1]) {
- $$("img", {
- "onerror": U.MD.C.imgError,
- "onerror": function () {
- U.MD.C.imgError(this, 1);
- },
- "title": "点击查看",
- "src": U.MD.C.getHeadImage(filesinfo[i].UserDirectoryUrl)
- }, _imgeel);
- }
-
- _infoel = $$("div", { "className": "U_MD_DK_RZOZO" }, _iconel);
- $$("div", { "className": "U_MD_DK_RZOZ", "innerHTML": filesinfo[i]["UserallDirectoryName"] }, _infoel);
-
- _infoel = $$("div", { "className": "U_MD_DK_RZOFXJ U_MD_D_Text_Abbreviation" }, _infoel);
- $$("span", { "className": "U_MD_DK_RZOFXJO", "innerHTML": _date[0] + "-" + _date[1] + "-" + _date[2] }, _infoel);
- $$("span", { "className": "U_MD_DK_RZOFXJT", "innerHTML": U.UF.UP.minUnitToMaxUnit(filesinfo[i]["UserDirectorySize"]) }, _infoel);
-
- _infoel = $$("div", { "className": "U_MD_DK_RZOF" }, _viewel);
- _infoel = $$("div", { "className": "U_MD_DK_RZOFD" }, _infoel);
- _userimg = $$("div", { "className": "U_MD_DK_RZOFDI" }, _infoel);
-
- $$("img", {
- "onerror": U.MD.C.imgError,
- "onerror": U.MD.C.imgError, "title": "点击查看",
- "src": U.MD.C.getHeadImage(filesinfo[i].UserThumbnailImageHead),
- "onclick": function () {
- U.UF.EV.stopBubble(); U.MD.U.V.ViewOtherUserInfo(filesinfo[i].UserId);
- }
- }, _userimg);
-
- $$("div", { "className": "U_MD_DK_RZOFDN U_MD_D_Text_Abbreviation", "innerHTML": filesinfo[i].UserNickName || filesinfo[i]["UserallDirectoryName"] }, _infoel);
- }
-
- $(el).append(_frag);
- }
- U.MD.DK.VW.printDetailedView = function (filesinfo, el) {
-
- var i,
- _isencryp,
- _date,
- _icon,
- _iconandnameel,
- _ischecked = false,
- _userimg,
- _frag = $$("frag"),
- _userid = US.disk.UserDisk.userInfo.UserId
- ;
-
- for (i = 0; i < filesinfo.length; i++) {
-
- _isencryp = (filesinfo[i]["UserDirectoryEncrypt"] && filesinfo[i]["UserDirectoryEncrypt"] != _userid);
- _date = U.UF.D.formatDateToArray(filesinfo[i]["UserDirectoryAddTime"]);
- _icon = U.MD.DK.C.getIcon(filesinfo[i].UserDirectoryExtendType);
-
- _viewel = $$("div", { "title": filesinfo[i]["UserallDirectoryName"], "className": "U_MD_DK_RZS U_MD_DK_RZXO", "id": "R" + (filesinfo[i].UserDirectoryID) }, _frag);
-
- _viewel.oncontextmenu = function () {
- U.UF.EV.stopBubble();
- U.MD.DK.RM.rightMenu(_viewel, filesinfo[i], US.disk.UserDisk);
- };
- _viewel.onmousedown = function () {
- var _isindex = _diskinfo.selectElement.indexOf(this);
- if (_isindex > -1) {
- U.UF.EV.stopBubble();
- }
- }
-
- _viewel.onclick = U.UF.C.closure(function (fileinfo) {
- U.MD.DK.LE.openFileDirectory(fileinfo, _userid);
- }, [filesinfo[i]]);
- _iconandnameel = $$("div", { "className": "U_MD_DK_RZSO", "style": { "marginLeft": "0px" } }, _viewel);
-
- $$("input", {
- "className": "U_MD_DK_RZSOI",
- "checked": _ischecked,
- "type": "checkbox",
- "onclick": function () {
- U.UF.EV.stopBubble();
- U.MD.DK.VW.checkFile(this);
- }
- }, _iconandnameel);
- _iconandnameel = $$("div", { "className": "U_MD_DK_RZSM U_MD_D_Text_Abbreviation" }, _viewel);
-
- if (_icon.classname[2]) {
- $$("span", { "className": _icon.classname[2] + " U_MD_DK_RZSMI U_MD_DK_Img U_MD_D_Text_Abbreviation", "innerHTML": " " }, _iconandnameel);
- }
- else {
- $$("img", {
- "onerror": U.MD.C.imgError,
- "onerror": function () {
- U.MD.C.imgError(this, 1);
- },
- "title": "点击查看",
- "src": U.MD.C.getHeadImage(filesinfo[i].UserDirectoryUrl || (US.FILESYSTEMURL + filesinfo[i].UseFilesServerThumbnailName))
- }, _iconandnameel);
- }
-
- $$("span", { "className": "U_MD_DK_RZSMN", "innerHTML": filesinfo[i]["UserallDirectoryName"] }, _iconandnameel);
-
- $$("div", { "className": "U_MD_DK_RZSF U_MD_DK_RZSFO U_MD_D_Text_Abbreviation", "innerHTML": 0 }, _viewel);
-
- $$("div", { "className": "U_MD_DK_RZSL U_MD_D_Text_Abbreviation", "innerHTML": filesinfo[i]["UserNickName"] }, _viewel);
-
- $$("div", { "className": "U_MD_DK_RZSX U_MD_D_Text_Abbreviation", "innerHTML": _icon.name }, _viewel);
-
- $$("div", { "className": "U_MD_DK_RZSD U_MD_D_Text_Abbreviation", "innerHTML": U.UF.UP.minUnitToMaxUnit(filesinfo[i]["UserDirectorySize"]) }, _viewel);
-
- $$("div", { "className": "U_MD_DK_RZST U_MD_D_Text_Abbreviation", "innerHTML": _date[0] + "-" + _date[1] + "-" + _date[2] + " " + _date[3] + ":" + _date[4] }, _viewel);
- }
-
- el.appendChild(_frag);
- }
- U.MD.DK.VW.size = function (diskinfo) {
- var i, j, k,
- _childel,
- _size = [0.1, 0.2, 0.1, 0.15, 0.15, 0.15, 0.14],
- _contentel = $("#U_MD_DK_RZ", diskinfo.formel)[0],
- _contentchildel = $(_contentel).Child(),
- _navel = $(_contentel).prev()[0],
- _navchildel = $(_navel).Child(),
- _width = $(_contentel).width(),
- _height = $(_contentel).height()
- ;
- _navel.style.display = "block";
-
- if (_contentel.viewtype === "Detailed" && diskinfo.currentDirectoryFile.length) {
- for (i = 0; i < _size.length; i++) {
-
- for (j = 0; j < _navchildel.length; j += 2) {
- _navchildel[j].style.width = _width * _size[j / 2] + "px";
- }
-
- for (j = 0; j < _contentchildel.length; j++) {
- _childel = $(_contentchildel).Child();
- for (k = 0; k < _childel.length; k++) {
- _childel[k].style.width = _width * _size[k] + "px";
- }
- }
- }
- _navel.style.width = _width + "px";
- _contentel.style.height = _height + "px";
- }
- }
- U.MD.DK.VW.checkAllFile = function (el) {
- var i,
- _ischeck = el.checked,
- _classname = "U_MD_DK_RZS U_MD_DK_RZXO" + (_ischeck ? " U_MD_DK_RZXOO" : ""),
- _contentel = $($(el).Parent(2)).next()[0],
- _childel = $(_contentel).Child()
- ;
- for (i = 0; i < _childel.length; i++) {
- _childel[i].className = _classname;
- $("input", _childel[i])[0].checked = _ischeck;
- }
- }
- U.MD.DK.VW.checkFile = function (el) {
- var _ischeck = el.checked;
-
- $(el).Parent(2).className = "U_MD_DK_RZS U_MD_DK_RZXO" + (_ischeck ? " U_MD_DK_RZXOO" : "");
- }
- U.MD.DK.VW.chosenSaveFile = function (postfix, fileid, filename, callback, formtitle, extendtype) {
- if (!U.MD.U.L.isLogin()) {
- extendtype = extendtype || "folder";
- var _diskinfo = US.disk.Disks[US.userInfo.userid];
- var _formel = $('#U_MD_DK_VW_ChosenSaveFile')[0];
- var _file;
- if (_formel) {
-
- U.UF.F.windowTopCenter(_formel);
-
- _file = $('#U_MD_DK_VW_ChosenSaveFile_File')[0];
- _file.innerHTML = "";
- $('.U_MD_DK_VW_ChosenSaveFile button', _formel)[1].onclick = function () {
- U.MD.DK.VW.chosenSaveFile.ensure(_formel, $('.U_MD_DK_VW_ChosenSaveFile input', _formel)[0], postfix, fileid, callback);
- }
- $('.U_MD_DK_VW_ChosenSaveFile input', _formel)[0].value = "";
- }
- else {
- var _box = $$('div', { style: { position: "relative", overflow: "hidden" }, "className": "U_MD_DK_VW_ChosenSaveFile" });
- var _newfolder = $$('button', { style: { position: "absolute", right: "0", top: "2px" }, innerHTML: "新建文件夹" }, _box);
- $$("div", { style: { "font-size": "16px", padding: "12px 10px 2px" }, innerHTML: "选择文件夹" }, _box);
- $$("hr", {}, _box);
- _file = $$("div", { "className": "U_MD_DK_VW_ChosenSaveFile_File", id: "U_MD_DK_VW_ChosenSaveFile_File" }, _box);
- var _inputarea = $$('div', {}, _box);
- $$('span', { 'innerHTML': '文件名:' }, _inputarea);
- var _input = $$('input', { placeholder: filename || "请输入文件名...", style: { width: "89%", "text-indent": "5px", "line-height": "26px" } }, _inputarea);
- var _ensure = $$('button', { innerHTML: "确定" }, _box);
- var _cancel = $$('button', { innerHTML: "取消" }, _box);
-
- _formel = new U.UF.UI.form(
- "<span id='U_MD_DK_VW_ChosenSaveFile_Title'>" + (formtitle || "新建文件") + "</span>",
- _box, {
- "id": "U_MD_DK_VW_ChosenSaveFile",
- "style": {
- "width": "600px",
- "height": "450px"
- }
- }).form;
-
- _newfolder.onclick = function () {
- U.MD.DK.VW.chosenSaveFile.newFolder();
- }
-
- _ensure.onclick = function () {
- U.MD.DK.VW.chosenSaveFile.ensure(_formel, _input, postfix, fileid, callback);
- }
-
- _cancel.onclick = function () {
- U.UF.F.windowMinimize(_formel);
- }
- }
-
- U.MD.DK.VW.chosenSaveFile.printFolder(_diskinfo.directoryOrFiles.slice(1, 8), _file, 0, ["U_MD_DK_LCD", "U_MD_DK_LCS", "U_MD_DK_LCD", "U_MD_DK_LCB", "U_MD_DK_LCF", "U_MD_DK_LCT", "U_MD_DK_LCP", "U_MD_DK_LCY"], _file, extendtype);
- }
- }
- U.MD.DK.VW.chosenSaveFile.printFolder = function (data, filearea, deviant, iconclass, topfilearea, extendtype) {
- extendtype = extendtype || "folder";
- var i,
- _class;
- for (i = 0; i < data.length; i++) {
- _class = null;
- if (extendtype == "*" || extendtype.indexOf(extendtype) > -1) {
- if ((iconclass || "").length) {
- _class = iconclass[i] || iconclass;
- } else if (data[i].UserDirectoryExtendType == extendtype || extendtype == "*") {
- switch (data[i].UserDirectoryExtendType) {
- case "folder":
- _class = "U_MD_DK_LCW";
- break;
- case "UW": case "txt": case "html": case "uw":
- _class = "U_MD_DK_LCB";
- break;
- case "jpg": case "png":
- _class = "U_MD_DK_LCT";
- break;
- case "mp4":
- _class = "U_MD_DK_LCP";
- break;
- }
- }
- if (_class) {
- U.MD.DK.VW.chosenSaveFile.Print(data[i], filearea, deviant, _class, topfilearea, extendtype);
- }
- }
- }
- }
- U.MD.DK.VW.chosenSaveFile.Print = function (data, filearea, deviant, iconclass, topfilearea, extendtype) {
- var _filediv, _fileel, _folder;
- _folder = false;
- if (data.UserDirectoryExtendType == "folder") {
- _folder = true;
- };
- _filediv = $$('div', { "className": "U_MD_DK_VW_ChosenSaveFile_File_Box" }, filearea);
- _fileel = $$('div', {
- id: data["UserDirectoryID"] ? "CS" + data["UserDirectoryID"] : "",
- "className": "U_MD_DK_LTXOS",
- style: { 'padding-left': deviant + 'px' },
- onclick: U.UF.C.closure(function (directoryinfo, el) {
- var _thisdate = data;
- var _thisfolder = _folder;
- U.UF.EV.stopBubble();
- if (_thisfolder) {
-
- U.MD.DK.VW.chosenSaveFile.forderClick(directoryinfo, el, topfilearea, extendtype);
-
- if ($('.U_MD_DK_VW_ChosenSaveFileName')[0]) {
- $('.U_MD_DK_VW_ChosenSaveFileName')[0].value = data.UserallDirectoryName;
- $('.U_MD_DK_VW_ChosenSaveFileName')[0].data = data;
- }
- } else {
-
- if ($('.U_MD_DK_VW_ChosenSaveFileName')[0]) {
- $('.U_MD_DK_VW_ChosenSaveFileName')[0].value = data.UserallDirectoryName;
- $('.U_MD_DK_VW_ChosenSaveFileName')[0].data = data;
- }
- }
- }, [data, _filediv])
- }, _filediv);
- if (_folder) {
- $$('div', { className: "U_MD_DK_LTXOSI U_MD_DK_Img" }, _fileel);
- } else {
- $$('div', { className: "U_MD_DK_LTXOSI" }, _fileel);
- }
- $$('div', { className: "U_MD_DK_LCOI U_MD_DK_LTXOST U_MD_DK_Img " + iconclass }, _fileel);
- $$('span', { innerHTML: data.UserallDirectoryName }, _fileel);
- return _filediv;
- }
- U.MD.DK.VW.chosenSaveFile.forderClick = function (directoryinfo, el, topfilearea, extendtype) {
- var
- _folder = $(el).Child()[0],
- _deviant = parseInt(_folder.style.paddingLeft || 0) + 5;
- var _icon = $('.U_MD_DK_LTXOSI', _folder);
- $('.U_MD_DK_LTXOSO', topfilearea).removeClass('U_MD_DK_LTXOSO');
- $(_folder).addClass('U_MD_DK_LTXOSO');
- if (_icon.hasClass('U_MD_DK_LTXOSIO')) {
-
- _icon.removeClass('U_MD_DK_LTXOSIO');
- var _nextlevel = $(_folder).next();
- $(_nextlevel).remove();
- } else {
-
- _icon.addClass('U_MD_DK_LTXOSIO');
- if (directoryinfo.Child) {
-
- U.MD.DK.VW.chosenSaveFile.printFolder(directoryinfo.Child, $$('div', {}, el), _deviant, null, null, extendtype);
- } else {
-
- U.MD.DK.LE.getChildsByDirectoryId(US.userInfo.userid, directoryinfo, topfilearea, function () {
-
- U.MD.DK.VW.chosenSaveFile.printFolder(directoryinfo.Child, $$('div', {}, el), _deviant, null, null, extendtype);
- });
- }
- }
- }
- U.MD.DK.VW.chosenSaveFile.ensure = function (formel, input, postfix, fileid, callback) {
- var _name = input.value;
- if (_name.trim() == "") {
- return U.Alert('请填写文件名!');
- }
-
- if (U.UF.S.ZWFileName.test(_name)) {
- var _nowfile = $('.U_MD_DK_LTXOSO', formel)[0];
- if (!_nowfile) {
- U.Alert('请选择文件夹新建的目录!');
- } else {
- var _parentid = _nowfile.id.replace('CS', '');
- var _userid = US.userInfo.userid;
- var _diskinfo = US.disk.Disks[_userid];
- var _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { UserDirectoryID: _parentid })[0];
- if (!U.MD.DK.C.getDirectoryPermissions(_dirinfo.UserDirectoryID, _diskinfo).isnew) {
- return U.Alert(_dirinfo.Child.length ? '分类目录无法操作,请选择群文件或文件夹!' : '分类目录无法操作,请新建群或者选择其他群文件夹');
- }
-
- _ancestors = U.MD.DK.C.getAncestors(_dirinfo, _diskinfo);
-
- if (_ancestors[0].UserDirectoryID == US.FTPFOLDERID) {
- _groupid = _diskinfo.userInfo.UserId;
- }
-
- else {
- _groupid = _ancestors[0].GroupID || "";
- }
- var _newfileid = fileid || Guid.newGuid();
-
- U.A.Request(US.DISK, ["CreateFile", _userid, _newfileid, _parentid, _name, "", "", "", postfix, _groupid], function (r) {
-
- var _fileinfo = new U.MD.DK.M.entity(_newfileid, 0, _parentid, _name, _name, postfix, "", U.UF.D.toTimeStamp(), "", "9999", null, "", 1, "", _groupid, "", _userid, US.userInfo.UserNickName, US.userInfo.username, US.userInfo.UserThumbnailImageHead)
- U.MD.DK.RE.addFileOrFolder([_fileinfo], _diskinfo, _dirinfo);
- U.UF.F.windowMinimize(formel);
-
- if (U.UF.C.isFunction(callback)) {
- callback(_fileinfo);
- }
- }, []);
- }
- } else {
-
- U.Alert('请填写文件名符合规范!');
- }
- }
- U.MD.DK.VW.chosenSaveFile.newFolder = function () {
- var _nowfile = $('.U_MD_DK_VW_ChosenSaveFile_File .U_MD_DK_LTXOSO')[0];
- if (!_nowfile) {
- return U.Alert('请选择文件夹新建的目录!');
- }
- var _userid = US.userInfo.userid;
- var _parentid = _nowfile.id.replace('CS', '');
- var _diskinfo = US.disk.Disks[_userid];
- if (_diskinfo.directoryOrFiles[0].UserDirectoryID == _parentid || _diskinfo.directoryOrFiles[1].UserDirectoryID == _parentid || _diskinfo.directoryOrFiles[2].UserDirectoryID == _parentid) {
- U.Alert('该目录下无法新建文件夹,请重新选择目录!');
- } else {
-
- var _input = $$('input', { placeholder: "请输入文件夹名字...", style: { width: '180px', height: "25px", margin: "30px auto", display: "block", "text-indent": "5px" } });
-
- U.UF.UI.confirm(_input, function () {
-
- var _name = _input.value;
- if (U.UF.S.ZWFileName.test(_name)) {
- var _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { UserDirectoryID: _parentid })[0];
-
- _ancestors = U.MD.DK.C.getAncestors(_dirinfo, _diskinfo);
-
- if (_ancestors[_ancestors.length - 1].UserDirectoryID == US.FTPFOLDERID) {
- _groupid = _diskinfo.userInfo.UserId;
- }
-
- else {
- _groupid = _ancestors[_ancestors.length - 1].GroupID || "";
- }
- var _newfolderid = Guid.newGuid();
-
- U.A.Request(US.DISK, ["CreateDirectory", _userid, _newfolderid, _dirinfo.UserDirectoryDeep + 1, _name, _parentid, "", _groupid, ""],
- function (r) {
-
- var _nextlevel = $(_nowfile).next()[0] || $$('div', {}, $(_nowfile).Parent());
- var _fileinfo = new U.MD.DK.M.entity(_newfolderid, 0, _parentid, _name, _name, "folder", "", U.UF.D.toTimeStamp(), "", _dirinfo.UserDirectoryDeep + 1,
- null, "", 0, "", _groupid, "", _userid, US.userInfo.UserNickName, US.userInfo.username, US.userInfo.UserThumbnailImageHead);
- U.MD.DK.RE.addFileOrFolder([_fileinfo], _diskinfo, _dirinfo);
- _filediv = U.MD.DK.VW.chosenSaveFile.Print(_fileinfo, _nextlevel, parseInt(_nowfile.style.paddingLeft || 0) + 6, "U_MD_DK_LCW");
- _nextlevel.insertBefore(_filediv, $(_nextlevel).Child()[0]);
- });
- } else {
-
- U.Alert('请填写文件名符合规范!');
- return false;
- }
- });
- }
- }
- U.MD.DK.VW.saveSynergy = function (postfix, fileinfo, filename, type, callback) {
- if (!U.MD.U.L.isLogin()) {
- var _grouplistarr = US.disk.Disks[US.userInfo.userid];
- var _formel = $('#U_MD_O_SaveSynergy')[0];
- var _grouplist;
- if (_formel) {
-
- U.UF.F.windowTopCenter(_formel);
-
- _grouplist = $('#U_MD_O_SaveSynergy_GroupList')[0];
- _grouplist.innerHTML = "";
- $('.U_MD_DK_VW_ChosenSaveFile button', _formel)[1].onclick = function () {
- U.MD.DK.VW.saveSynergy.ensure(_formel, $('.U_MD_DK_VW_ChosenSaveFile input', _formel)[0], postfix, fileinfo, type, callback);
- }
- $('.U_MD_DK_VW_ChosenSaveFile input', _formel)[0].value = "";
- }
- else {
- var _box = $$('div', { style: { position: "relative", overflow: "hidden" }, "className": "U_MD_DK_VW_ChosenSaveFile" });
- var _creategroup = $$('button', { style: { position: "absolute", right: "0", top: "-2px" }, innerHTML: "新建群", id: "U_MD_O_SaveSynergy_CreateGroup", onclick: 'U.MD.DK.VW.saveSynergy.swith()' }, _box);
- $$("div", { style: { "font-size": "16px", padding: "6px 10px 7px" }, innerHTML: "群列表" }, _box);
- $$("hr", {}, _box);
- var _newgroup = $$("div", { "className": "U_MD_DK_VW_ChosenSaveFile_File", id: "U_MD_O_SaveSynergy_NewGroup", style: { display: 'none', overflow: 'hidden' } }, _box);
- _grouplist = $$("div", { "className": "U_MD_DK_VW_ChosenSaveFile_File", id: "U_MD_O_SaveSynergy_GroupList" }, _box);
- var _inputarea = $$('div', {}, _box);
- $$('span', { 'innerHTML': '文件名:' }, _inputarea);
- var _input = $$('input', {
- placeholder: "请输入文件名...",
- value: filename == "未命名文档(点击编辑)..." ? "" : filename,
-
-
- style: { width: "89%", "text-indent": "5px", "line-height": "26px" }
- }, _inputarea);
- var _ensure = $$('button', { innerHTML: "确定" }, _box);
- var _cancel = $$('button', { innerHTML: "取消" }, _box);
-
- _formel = new U.UF.UI.form(
- "<span id='U_MD_O_SaveSynergy_Title'>" + (type == 'move' ? "将文档移动到" : "选择保存到") + "指定群</span>",
- _box, {
- "id": "U_MD_O_SaveSynergy",
- "style": {
- "width": "600px",
- "height": "450px"
- }
- }).form;
-
- _ensure.onclick = function () {
- U.MD.DK.VW.saveSynergy.ensure(_formel, _input, postfix, fileinfo, type, callback);
- }
-
- _cancel.onclick = function () {
- U.UF.F.windowMinimize(_formel);
- }
- }
-
- U.MD.DK.VW.chosenSaveFile.printFolder(_grouplistarr.directoryOrFiles.slice(1, 3), _grouplist, 0, ["U_MD_DK_LCD", "U_MD_DK_LCS"]);
-
- U.MD.DK.VW.saveSynergy.swith(true);
- }
- };
- U.MD.DK.VW.saveSynergy.ensure = function (formel, input, postfix, fileinfo, type, callback) {
- var _name = input.value;
- if (_name.trim() == "") {
- return U.Alert('请填写文件名!');
- }
-
- if (U.UF.S.ZWFileName.test(_name)) {
- var _dirinfo;
- var _userid = US.userInfo.userid;
- var _diskinfo = US.disk.Disks[_userid];
- if ($('#U_MD_O_SaveSynergy_GroupList').css('display') == 'none') {
- var _groupName = '协同文档群--' + new Date().getHours() + ":" + new Date().getMinutes(),
- _groupDesc = "由" + US.userInfo.username + "发起的互联办公群组。";
- U.MD.F.J.determineCreateGroupAndAddGroupUser(false, null, null, false, _groupName, _groupDesc, function (groupid) {
- _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { UserDirectoryID: groupid })[0];
- U.MD.DK.VW.saveSynergy.ensure.operate(formel, _dirinfo, fileinfo, groupid, groupid, type, postfix, _name, callback);
- });
- } else {
- var _groupid, _parentid;
- var _nowfile = $('.U_MD_DK_LTXOSO', formel)[0];
- _parentid = _nowfile.id.replace('CS', '');
- _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { UserDirectoryID: _parentid })[0];
- if (!U.MD.DK.C.getDirectoryPermissions(_dirinfo.UserDirectoryID, _diskinfo).isnew) {
- return U.Alert(_dirinfo.Child.length ? '分类目录无法操作,请选择群文件或文件夹!' : '分类目录无法操作,请新建群或者选择其他群文件夹');
- }
-
- _ancestors = U.MD.DK.C.getAncestors(_dirinfo, _diskinfo);
-
- if (_ancestors[0].UserDirectoryID == US.FTPFOLDERID) {
- _groupid = _diskinfo.userInfo.UserId;
- }
-
- else {
- _groupid = _ancestors[0].GroupID || "";
- }
- U.MD.DK.VW.saveSynergy.ensure.operate(formel, _dirinfo, fileinfo, _parentid, _groupid, type, postfix, _name, callback);
- }
- } else {
- U.Alert('请填写文件名符合规范!');
- }
- }
- U.MD.DK.VW.saveSynergy.ensure.operate = function (formel, dirinfo, fileinfo, parentid, groupid, type, postfix, name, callback) {
- var _fileid = fileinfo.UserDirectoryID;
- var _userid = US.userInfo.userid;
- var _diskinfo = US.disk.Disks[_userid];
- if (type == "move") {
- var _pastecontent = US.disk.Disks[_userid].pasteDirOrFile = {
- "type": "shear",
- "UserDirectoryID": groupid,
- "dirorfile": fileinfo,
- "userid": _userid
- }
- U.A.Request(US.DISK, ["CutAndPasteFiles", fileinfo.UserId, groupid, fileinfo.UserDirectoryID, groupid, groupid],
- top.U.MD.DK.RE.asynPaste, ["", dirinfo, groupid, _pastecontent, _diskinfo]);
- U.A.Request(US.DISK, ["UpdateFileInfo", _fileid, name], function () {
- fileinfo.UserallDirectoryName = name;
- fileinfo.UserDirectoryName = name.addEllipsis(20);
- fileinfo.GroupId = fileinfo.UserDirectoryEncrypt = groupid;
-
- if (U.UF.C.isFunction(callback)) {
- callback(fileinfo);
- }
- U.UF.F.windowMinimize(formel);
- });
- } else {
-
- U.A.Request(US.DISK, ["CreateFile", _userid, _fileid, parentid, name, "", "", "", postfix, groupid], function (r) {
-
- var _fileinfo = new U.MD.DK.M.entity(_fileid, 0, parentid, name, name, postfix, "", U.UF.D.toTimeStamp(), "", "9999", null, "", 1, "", groupid, "", _userid, US.userInfo.UserNickName, US.userInfo.username, US.userInfo.UserThumbnailImageHead)
- U.MD.DK.RE.addFileOrFolder([_fileinfo], _diskinfo, dirinfo);
- U.UF.F.windowMinimize(formel);
-
- if (U.UF.C.isFunction(callback)) {
- callback(_fileinfo);
- }
- U.UF.F.windowMinimize(formel);
- }, []);
- }
- }
- U.MD.DK.VW.saveSynergy.swith = function (init) {
- var _newgroup = $('#U_MD_O_SaveSynergy_NewGroup');
- var _grouplist = $('#U_MD_O_SaveSynergy_GroupList');
- var _creategroup = $('#U_MD_O_SaveSynergy_CreateGroup');
- if (_newgroup.css('display') == 'none' && !init) {
- _newgroup.css('display', 'block');
- _grouplist.css('display', 'none');
- _creategroup[0].innerHTML = "返回群列表";
- _creategroup[0].nextElementSibling.innerHTML = "选择联系人";
- if (_newgroup.Child().length == 0) {
- U.MD.DK.VW.saveSynergy.createGroupInit();
- }
- U.MD.DK.VW.saveSynergy.Friends();
- } else {
- _newgroup.css('display', 'none');
- _grouplist.css('display', 'block');
- _creategroup[0].innerHTML = "新建群";
- _creategroup[0].nextElementSibling.innerHTML = "群列表";
- }
- }
- U.MD.DK.VW.saveSynergy.createGroupInit = function () {
- var _newgroup = $('#U_MD_O_SaveSynergy_NewGroup')[0];
- var _left = $$('div', { style: { borderRight: "1px solid #ccc", position: "relative" } }, _newgroup);
- var _right = $$('div', { style: { overflow: "hidden" } }, _newgroup);
- var _count = $$('div', { style: { lineHeight: '30px' }, innerHTML: '已选择联系人:<span>1</span>' }, _right);
- var _select = $$('div', { id: "U_MD_O_SaveSynergy_NewGroup_Select", style: { height: '265px', overflow: 'auto' } }, _right);
- var _box = $$('div', { "className": 'U_MD_O_SaveSynergy_NewGroup_Friend', style: { paddingLeft: '5px' } }, _select);
- $$('img', { "onerror": U.MD.C.imgError, src: U.MD.C.getHeadImage(US.userInfo.UserThumbnailImageHead) }, _box);
- $$('span', { innerHTML: US.userInfo.UserNickName || US.userInfo.username }, _box);
- }
- U.MD.DK.VW.saveSynergy.Friends = function () {
- var i, _box,
- _friends = US.friend.friends;
- var _child = $('#U_MD_O_SaveSynergy_NewGroup').Child();
- var _friendel = _child[0];
- var _countel = $('span', $(_child[1]).Child()[0])[0];
- var _selectel = $("#U_MD_O_SaveSynergy_NewGroup_Select");
- _friendel.innerHTML = "";
- _countel.innerHTML = "1";
- U.MD.F.J.selectUserInfo.NeedUser = [];
- var _oldfriend = _selectel.Child();
-
- for (i = 1; i < _oldfriend.length; i++) {
- $(_oldfriend[i]).remove();
- }
-
- if (_friends.length > 0) {
-
- for (i = 0; i < _friends.length; i++) {
-
- var _box = $$('div', {
- "className": 'U_MD_O_SaveSynergy_NewGroup_Friend', onclick: U.UF.C.closure(function (friendinfo) {
- U.MD.DK.VW.saveSynergy.Friends.Select(friendinfo, _selectel[0], _countel);
- }, [_friends[i]]), friendid: _friends[i].FriendsID
- }, _friendel);
-
- $$('img', { "onerror": U.MD.C.imgError, src: U.MD.C.getHeadImage(_friends[i].UserThumbnailImageHead) }, _box);
-
- $$('span', { innerHTML: _friends[i].UserNickName || _friends[i].UserName }, _box);
- }
- }
-
- else {
-
- $$('p', {
- style: { cssText: "font-weight: bold; font-size: 14px;padding-left:60px;padding-top:60px;" },
- innerHTML: '您暂无添加好友,</br> 快去<span style="cursor:pointer;color:rgb(41, 103, 167);" onclick="U.MD.F.S.popSearchFriendsOrGroupForm(0);">添加你的好友</span>吧。 </br>'
- }, _friendel);
-
- $$('span', {
- innerHTML: "已添加完好友点击刷新好友列表", onclick: function () {
- U.UF.DL.loading(_friendel);
- setTimeout(function () { U.MD.DK.VW.saveSynergy.Friends(); U.UF.DL.uploading(_friendel); }, 300);
- }, style: { color: "red", cursor: "pointer", position: "absolute", bottom: "0px", fontSize: "12px" }
- }, _friendel);
- }
- }
- U.MD.DK.VW.saveSynergy.Friends.Select = function (friendinfo, selectel, countel) {
- var i,
- _isselect = U.Json.select(U.MD.F.J.selectUserInfo.NeedUser, { UserId: friendinfo.UserId })[0];
- if (!_isselect) {
- countel.innerHTML = parseInt(countel.innerHTML) + 1;
- U.MD.F.J.selectUserInfo.NeedUser.push(friendinfo);
-
- var _box = $$('div', {
- "className": 'U_MD_O_SaveSynergy_NewGroup_Friend', style: { paddingLeft: '5px' }, onclick: function () {
- $(this).remove();
- U.Json.del(U.MD.F.J.selectUserInfo.NeedUser, { "UserId": friendinfo.UserId });
- countel.innerHTML = parseInt(countel.innerHTML) - 1;
- }
- }, selectel);
-
- $$('img', { "onerror": U.MD.C.imgError, src: U.MD.C.getHeadImage(friendinfo.UserThumbnailImageHead) }, _box);
-
- $$('span', { innerHTML: friendinfo.UserNickName || friendinfo.UserName }, _box);
- }
- }
- U.MD.DK.VW.choseFile = function (cb, type) {
- var _diskinfo = US.disk.Disks[US.userInfo.userid];
- var _formel = $('#U_MD_DK_VW_ChosenSaveFile')[0];
- var _file;
- type = type ? type : "*";
- if (_formel) {
-
- U.UF.F.windowTopCenter(_formel);
-
- _file = $('#U_MD_DK_VW_ChosenSaveFile_File')[0];
- _file.innerHTML = "";
- }
- else {
- var _box = $$('div', { style: { position: "relative", overflow: "hidden" }, "className": "U_MD_DK_VW_ChosenSaveFile" });
- var _newfolder = $$('button', { style: { position: "absolute", right: "0", top: "2px" }, innerHTML: "新建文件夹" }, _box);
- $$("div", { style: { "font-size": "16px", padding: "12px 10px 2px" }, innerHTML: "文件名称" }, _box);
- $$("hr", {}, _box);
- _file = $$("div", { "className": "U_MD_DK_VW_ChosenSaveFile_File", id: "U_MD_DK_VW_ChosenSaveFile_File" }, _box);
- var _inputarea = $$('div', {}, _box);
- $$('span', { 'innerHTML': '文件名:' }, _inputarea);
- var _input = $$('input', { "className": "U_MD_DK_VW_ChosenSaveFileName", placeholder: "请输入文件名...", style: { width: "89%", "text-indent": "5px", "line-height": "26px" } }, _inputarea);
- var _ensure = $$('button', { innerHTML: "确定" }, _box);
- var _cancel = $$('button', { innerHTML: "取消" }, _box);
-
- _formel = new U.UF.UI.form(
- "<span id='U_MD_DK_VW_ChosenSaveFile_Title'>选择文件</span>",
- _box, {
- "id": "U_MD_DK_VW_ChosenSaveFile",
- "style": {
- "width": "600px",
- "height": "450px"
- }
- }).form;
-
- _newfolder.onclick = function () {
- U.MD.DK.VW.chosenSaveFile.newFolder();
- }
-
- _ensure.onclick = function () {
- cb($('.U_MD_DK_VW_ChosenSaveFileName')[0].data);
- U.UF.F.windowMinimize(_formel);
- _input.value = "";
- _input.data = null;
- }
-
- _cancel.onclick = function () {
- U.UF.F.windowMinimize(_formel);
- }
- }
-
- U.MD.DK.VW.chosenSaveFile.printFolder(_diskinfo.directoryOrFiles.slice(1, 8), _file, 0, ["U_MD_DK_LCD", "U_MD_DK_LCS", "U_MD_DK_LCD", "U_MD_DK_LCB", "U_MD_DK_LCF", "U_MD_DK_LCT", "U_MD_DK_LCP", "U_MD_DK_LCY"], _file, type);
- }
|