Răsfoiți Sursa

o2对于主流MVC前端框架支持

huqi 5 ani în urmă
părinte
comite
339593b51f

+ 42 - 3
o2web/source/o2_core/o2/framework.js

@@ -1,13 +1,52 @@
 layout.addReady(function(){
-    MWF.require("MWF.xScript.Environment", null, false);
-    MWF.require("MWF.xScript.PageEnvironment", null, false);
+    // MWF.require("MWF.xScript.Environment", null, false);
+    // MWF.require("MWF.xScript.PageEnvironment", null, false);
+    MWF.require("MWF.xScript.Macro", null, false);
+
 
     var page = {
         "businessData": {},
         "json": {
             "application": ""
         },
-        "options": {}
+        "options": {},
+        "confirm": o2.xApplication.Common.Main.prototype.confirm,
+        "alert": function(type, title, text, width, height){
+            var p = o2.getCenterPosition(document.body, width, height);
+            var e = {
+                "event": {
+                    "x": p.x,
+                    "y": p.y,
+                    "clientX": p.x,
+                    "clientY": p.y
+                }
+            };
+            o2.xApplication.Common.Main.prototype.alert(type, e, title, text, width, height);
+        },
+        "notice": function(content, type, target, where, offset, option){
+            o2.xDesktop.notice(type, where, content, target, offset, option);
+        },
+        "app": {
+            "content": document.body,
+            "toPortal": function(portal, page, par, nohis){
+                var url = "../x_desktop/portal.html?id="+portal;
+                if (page) url += "&page="+page;
+                if (par){
+                    if (o2.typeOf(par)==="object"){
+                        url += "&parameters="+JSON.stringify(par);
+                    }else{
+                        url += "&parameters="+par.toString();
+                    }
+
+                }
+                var a = document.createElement("a");
+                a.setAttribute("href", o2.filterUrl(url));
+                a.setAttribute("target", "_blank1");
+                a.click();
+                if (a.remove) a.remove();
+            },
+            "toPage": function(){}
+        }
     };
     var environment = {
         "form": page,

+ 3 - 1
o2web/source/o2_core/o2/xDesktop/Common.js

@@ -167,7 +167,9 @@ MWF.xDesktop.getUserLayout = function(callback){
 },
 
 MWF.xDesktop.notice = function(type, where, content, target, offset, option){
-    var noticeTarget = target || layout.desktop.desktopNode;
+    if (!where) where = { "x": "right", "y": "top" };
+    if (!type) type = "ok";
+    var noticeTarget = target || layout.desktop.desktopNode || document.body;
 
     var off = offset;
     if (!off){

+ 1 - 1
o2web/source/x_component_Common/Main.js

@@ -508,7 +508,7 @@ MWF.xApplication.Common.Main = new Class({
 	},
 	confirm: function (type, e, title, text, width, height, ok, cancel, callback, mask, style) {
 		MWF.require("MWF.xDesktop.Dialog", function () {
-			var content = layout.mobile ? $(document.body) : this.content;
+			var content = layout.mobile ? $(document.body) : this.content || $(document.body);
 			var size = content.getSize();
 			var x = 0;
 			var y = 0;

+ 1 - 2
o2web/source/x_desktop/js/app.js

@@ -12,7 +12,6 @@ layout.addReady(function(){
             // layout.message = new MWF.xDesktop.MessageMobile();
             // layout.message.load();
             //}.bind(this));
-
             layout.apps = [];
             layout.node = $("layout");
             var appName=appNames, m_status=statusObj, option=options;
@@ -29,4 +28,4 @@ layout.addReady(function(){
         };
         _load();
     })(layout);
-});
+});

+ 3 - 2
o2web/source/x_desktop/js/portal.js

@@ -5,15 +5,16 @@ layout.addReady(function(){
         var id = uri.getData("id");
         var page = uri.getData("page");
         var widget = uri.getData("widget");
+        var parameters = uri.getData("parameters");
         var statusObj = null;
-        var options = {"portalId": id, "pageId": page, "widgetId":widget };
+        var options = {"portalId": id, "pageId": page, "parameters": parameters, "widgetId":widget };
 
         var _load = function(){
             //o2.require("MWF.xDesktop.MessageMobile", function(){
             // layout.message = new MWF.xDesktop.MessageMobile();
             // layout.message.load();
             //}.bind(this));
-
+debugger;
             layout.apps = [];
             layout.node = $("layout");
             var appName=appNames, m_status=statusObj, option=options;