Преглед изворни кода

Merge branch 'feature/ntko_office_linux' into 'wrdp'

移动端appFormLoaded回调

See merge request o2oa/o2oa!3115
胡起 пре 4 година
родитељ
комит
2d9da7394b

+ 0 - 9
o2web/source/x_component_process_Work/Main.js

@@ -731,8 +731,6 @@ MWF.xApplication.process.Work.Main = new Class({
                     }.bind(this));
                 }
 
-                if  (layout.desktop.type !== "layout") layout.appForm = this.appForm;
-
                 this.appForm.load(function(){
                     if (this.mask) this.mask.hide();
                     if (window.o2android && window.o2android.appFormLoaded){
@@ -748,13 +746,6 @@ MWF.xApplication.process.Work.Main = new Class({
                         this.options.action = "";
                     }
 
-                    if (window.o2 && window.o2.appFormLoaded){
-                        window.o2.appFormLoaded('true');
-                    }
-                    if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.appFormLoaded){
-                        window.webkit.messageHandlers.appFormLoaded.postMessage('true')
-                    }
-
                     this.fireEvent("postLoadForm");
                 }.bind(this));
             }.bind(this));

+ 2 - 1
o2web/source/x_component_process_Xform/Form.js

@@ -592,7 +592,8 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class(
                 node.empty();
                 this._loadMobileActions(node, callback);
             } else {
-                console.log("没有找到移动端底部操作栏!")
+                if (callback) callback();
+                //console.log("没有找到移动端底部操作栏!")
             }
         } else {
             if (callback) callback();

+ 68 - 20
o2web/source/x_component_process_Xform/Office.js

@@ -115,8 +115,9 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice =  new Class(
 			"min-height": "100px"
 		});
         // this.isActive = true;
-        //if (Browser.name==="ie" || Browser.name==="chrome" || Browser.name==="firefox"){
-		if (Browser.name==="ie"){
+        debugger;
+        if (Browser.name==="ie" || Browser.name==="chrome" || Browser.name==="firefox"){
+		//if (Browser.name==="ie"){
             this.isActive = true;
             this.file = null;
             if (!this.form.officeList) this.form.officeList=[];
@@ -827,12 +828,29 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice =  new Class(
             var version = this.json.version || this.options.version;
             var classid = this.json.clsid || this.options.clsid;
 
-            var objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id='"+this.getOfficeObjectId()+"' " +
-                "type='application/ntko-plug' " +
-                "style='HEIGHT: 99%; WIDTH: 100%' " +
-                "height='99%' width='100%' " +
-                "codeBase='"+codeBase+"#version="+version+"' " +
-                "classid='{"+classid+"}' ";
+            var objectHtml = "";
+            if (navigator.userAgent.indexOf("Linux") > -1) {
+                objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'>" +
+                    "<OBJECT id='"+this.getOfficeObjectId()+"' " +
+                    "type='application/ntko-plug' height='99%' width='100%' style='HEIGHT: 99%; WIDTH: 100%' "
+            }else{
+                objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id='"+this.getOfficeObjectId()+"' " +
+                    "type='application/ntko-plug' " +
+                    "style='HEIGHT: 99%; WIDTH: 100%' " +
+                    "height='99%' width='100%' " +
+                    "codeBase='"+codeBase+"#version="+version+"' " +
+                    "clsid='{"+classid+"}' ";
+            }
+
+
+
+
+            // var objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id='"+this.getOfficeObjectId()+"' " +
+            //     "type='application/ntko-plug' " +
+            //     "style='HEIGHT: 99%; WIDTH: 100%' " +
+            //     "height='99%' width='100%' " +
+            //     "codeBase='"+codeBase+"#version="+version+"' " +
+            //     "clsid='{"+classid+"}' ";
 
             objectHtml += "ForOnSaveToURL='OnComplete2' ";
             objectHtml += "ForOnBeginOpenFromURL='OnComplete' ";
@@ -854,6 +872,12 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice =  new Class(
             this.officeForm = this.officeNode.getFirst();
             this.officeOCX = this.officeNode.getFirst().getFirst();
 
+            if(window.navigator.platform=="Win64"){
+                this.officeOCX.AddDocTypePlugin(".pdf",pdfType,pdfVersion,pdfCodeBase64,51,true);
+            }
+            if(window.navigator.platform=="Win32"){
+                this.officeOCX.AddDocTypePlugin(".pdf",pdfType,pdfVersion,pdfCodeBase,51,true);
+            }
             this.doOfficeOCXEvents();
         }
 
@@ -882,17 +906,35 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice =  new Class(
 
             var objectHtml = "";
 
-            if(window.navigator.platform=="Win64"){
-                objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id='"+this.getOfficeObjectId()+"' " +
-                    "style='HEIGHT: 99%; WIDTH: 100%' " +
-                    "codeBase='"+codeBase64+"#version="+version+"' " +
-                    "classid='{"+classid64+"}'>";
-            }else{
-                objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id='"+this.getOfficeObjectId()+"' " +
+            // if (navigator.userAgent.indexOf("Linux") > -1) {
+            //     objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id='"+this.getOfficeObjectId()+"' " +
+            //         "type='application/ntko-plug' height='99%' width='100%' style='HEIGHT: 99%; WIDTH: 100%' "
+            // }else{
+                objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT type='application/ntko-plug' id='"+this.getOfficeObjectId()+"' " +
+                    "height='99%' width='100%' " +
                     "style='HEIGHT: 99%; WIDTH: 100%' " +
                     "codeBase='"+codeBase+"#version="+version+"' " +
-                    "classid='{"+classid+"}'";
-            }
+                    "clsid='{"+classid+"}'";
+            // }
+
+            // if(window.navigator.platform=="Win64"){
+            //     objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id='"+this.getOfficeObjectId()+"' " +
+            //         "style='HEIGHT: 99%; WIDTH: 100%' " +
+            //         "codeBase='"+codeBase64+"#version="+version+"' " +
+            //         "classid='{"+classid64+"}'>";
+            // }else{
+            //     objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id='"+this.getOfficeObjectId()+"' " +
+            //         "style='HEIGHT: 99%; WIDTH: 100%' " +
+            //         "codeBase='"+codeBase+"#version="+version+"' " +
+            //         "classid='{"+classid+"}'";
+            // }
+
+            // this.addOfficeEvent(id, "AfterOpenFromURL(doc, statusCode)", "if (layout.desktop.offices[\""+id+"\"]) layout.desktop.offices[\""+id+"\"].AfterOpenFromURL(doc, statusCode);");
+            // this.addOfficeEvent(id, "OnDocumentOpened(url, doc)", "if (layout.desktop.offices[\""+id+"\"]) layout.desktop.offices[\""+id+"\"].OnDocumentOpened(url, doc);");
+            // this.addOfficeEvent(id, "OnDocumentClosed()", "if (layout.desktop.offices[\""+id+"\"]) layout.desktop.offices[\""+id+"\"].OnDocumentClosed();");
+            // document.write('ForOnpublishAshtmltourl="ntkopublishashtml"');
+            // document.write('ForOnpublishAspdftourl="ntkopublishaspdf"');
+            // document.write('ForOnSaveAsOtherFormatToUrl="ntkosaveasotherurl"');
 
             objectHtml += "ForOnSaveToURL='OnComplete2' ";
             objectHtml += "ForOnBeginOpenFromURL='OnComplete' ";
@@ -916,22 +958,28 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice =  new Class(
 
             if(window.navigator.platform=="Win64"){
                 this.officeOCX.AddDocTypePlugin(".pdf",pdfType,pdfVersion,pdfCodeBase64,51,true);
-            }else{
+            }
+            if(window.navigator.platform=="Win32"){
                 this.officeOCX.AddDocTypePlugin(".pdf",pdfType,pdfVersion,pdfCodeBase,51,true);
             }
 
-            //this.doOfficeOCXEvents();
+            this.doOfficeOCXEvents();
         }
 
         var url = this.getOfficeFileUrl();
         if (url){
             this.officeOCX.BeginOpenFromURL(url, true, this.readonly);
         }else{
-            this.officeOCX.CreateNew(this.getProgID());
+            window.setTimeout(function(){
+                this.officeOCX.CreateNew("WPS.Document");
+            }.bind(this), 5000);
+
+            //this.officeOCX.CreateNew(this.getProgID());
             this.fireEvent("afterCreate");
         }
     },
     loadOfficeEdit: function(file){
+        debugger;
         if (Browser.name==="chrome"){
             this.loadOfficeEditChrome(file);
         }else if (Browser.name==="firefox") {