123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
-
- Namespace.register("U.MD.O");
- U.MD.O.word = function (userinfo, fileinfo, cb) {
- var _contentel,
- _fileid,
- _formel,
- _child
- ;
-
- if (fileinfo && fileinfo.UserDirectoryID) {
- _fileid = fileinfo.UserDirectoryID;
- }
- if (!_fileid) {
- _fileid = Guid.newGuid();
- var _type = fileinfo.UserDirectoryExtendType;
- fileinfo = { "UserDirectoryID": _fileid, UserDirectoryExtendType: _type };
- if (_type == "un") {
- fileinfo.UsOffice = U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "GetFileContent", "6a8a235a-41c4-c3d2-8dd5-b6ee851e1967"])).value[0].UsOffice.unEscapeQuotes();
- } else {
- fileinfo.UsOffice = U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "GetFileContent", "d17a2910-11ba-df39-cd8a-5cac851c2148"])).value[0].UsOffice.unEscapeQuotes();
- }
- fileinfo.newfile = true;
- }
-
- _formel = $("#UD_Word" + _fileid)[0];
-
- if (!_formel) {
-
- _contentel = $("#UD_Word").clone(true);
- _child = $(_contentel[0]).Child();
- _formel = new U.UF.UI.form(
- _child[0],
- _child[1],
- {
- "id": "UD_Word" + _fileid, "style": { "width": "90%", "height": "90%", "overflow": 'hidden' },
- "onresize": function () { }
- },
- {
- closecallback: function () {
- U.A.Request(US.SCOKET, ["quitOffice", JSON.stringify({ docId: fileinfo.UserDirectoryID, pageId: US.pageId, userId: top.US.userInfo.userid, type: fileinfo.UserDirectoryExtendType == 'un' ? 'nav' : 'word' })], function (r) {
-
- });
- }
- },
- { "style": { "height": "36px" } }).form;
- U.MD.O.header(userinfo, _child[0], fileinfo);
- U.UF.DL.loading(_child[1]);
-
- U.MD.O.officeLoad(_child[1], "Word", function (iframe) {
- iframe.contentWindow.U.MD.O.W.load(fileinfo, userinfo);
- $('#UD_Word' + _fileid + ' .U_MD_O_H_head_navigation_Title')[0].onchange = iframe.contentWindow.U.MD.O.W.updateName;
-
- if (U.UF.C.isFunction(cb)) {
- cb(iframe.contentWindow);
- }
- U.UF.DL.uploading(_child[1]);
- });
- }
-
- else {
- $('iframe', _formel)[0].contentWindow.U.MD.O.W.load(fileinfo, userinfo);
- U.UF.F.windowTopCenter(_formel);
- }
- return [_formel, fileinfo];
- }
- U.MD.O.wordNav = function (el) {
- }
- U.MD.O.excel = function (userinfo, fileinfo) {
- var _contentel,
- _fileid,
- _formel,
- _child
- ;
-
- if (fileinfo && fileinfo.UserDirectoryID) {
- _fileid = fileinfo.UserDirectoryID;
- }
- if (!_fileid) {
- _fileid = Guid.newGuid();
- fileinfo = { "UserDirectoryID": _fileid };
- }
-
- _formel = $("#UD_Excel" + _fileid)[0];
-
- if (!_formel) {
-
- _contentel = $("#UD_Excel").clone(true);
- _contentel[0].id = "";
- _child = $(_contentel[0]).Child();
- _formel = new U.UF.UI.form(_child[0], _child[1], { "id": "UD_Excel" + _fileid, "style": { "width": "90%", "height": "90%", "overflow": 'hidden' } }, {}, { "style": { "height": "36px" } }).form;
- U.UF.DL.loading(_child[1]);
- U.MD.O.header(userinfo, _child[0], fileinfo);
-
- U.MD.O.officeLoad(_child[1], "Excel", function (iframe) {
- U.UF.DL.uploading(_child[1]);
- iframe.contentWindow.U.MD.O.E.load(fileinfo, userinfo, iframe);
- });
- }
-
- else {
- U.UF.F.windowTopCenter(_formel);
- }
- return _formel;
- }
- U.MD.O.officeLoad = function (el, type, cb) {
- var _file,
- _iframe
- ;
-
- switch (type) {
- case "Word":
- _file = "WordEditArea.htm";
- break;
- case "Excel":
- _file = "ExcelEditArea.htm";
-
- break;
- case "PPT":
- _file = "PPT.htm";
- break;
- default: break;
- }
-
- _iframe = $$("iframe", {
- "frameBorder": "0",
- "style": {
- "border": "0"
- },
- "src": US.MAINDOMAIN + "/Controls/Office/" + type + "/" + _file,
- "width": "100%",
- "height": "100%"
- }, el);
-
- U.UF.DL.iframeLoad(_iframe, function () {
- $("body", _iframe.contentWindow.document)[0].onmousedown = function () {
- U.UF.F.topWindow(el, true);
- }
- cb(_iframe);
- });
- }
- U.MD.O.header = function (userinfo, el, fileinfo) {
- var _filename,
- _hreadel;
-
- if (fileinfo && (fileinfo["UserallDirectoryName"] || fileinfo["UserFilesName"])) {
- _filename = fileinfo["UserallDirectoryName"] || fileinfo["UserFilesName"];
- }
-
- else {
- _filename = "未命名文档(点击编辑)...";
- }
- $("input", el)[0].value = _filename;
-
- _hreadel = $$("div", { "className": "U_MD_O_H_Editor" }, el.children[2].children[4]);
- $$("img", {
- "onerror": U.MD.C.imgError,
- "onerror": U.MD.C.imgError,
- "src": U.MD.C.getHeadImage(userinfo.UserThumbnailImageHead)
- }, _hreadel);
- $$("div", { "className": "U_MD_O_H_head_navigation_username", "innerHTML": userinfo.UserNickName || "" }, el.children[2].children[4]);
- }
- U.MD.O.getOfficeWindow = function (el) {
-
- el = el || event.srcElement;
- return $("iframe", $(el).Parent({ usform: "true" }) || el)[0].contentWindow;
- }
|