Kaynağa Gözat

增加通过URL传入参数,在Default页面直接打开指定应用的功能。app=appName&option={}&default=false

huqi 5 yıl önce
ebeveyn
işleme
75fdfd83a4

+ 20 - 4
o2web/source/o2_core/o2/xDesktop/Default.js

@@ -29,16 +29,32 @@ o2.xDesktop.Default = new Class({
         this.session = {};
         this.serviceAddressList = layout.serviceAddressList;
         this.centerServer = layout.centerServer;
-        this.session.user = layout.session.user
-
-        this.status = layout.userLayout;
+        this.session.user = layout.session.user;
+
+        var uri = new URI(window.location.href);
+        var df = uri.getData("default") || "";
+        this.noDefault = df.toString().toLowerCase()==="false";
+        var appNames = uri.getData("app");
+        var optionsStr = uri.getData("option");
+        var options = (optionsStr) ? JSON.decode(optionsStr) : null;
+
+        if (appNames){
+            this.status = layout.userLayout;
+            this.status.apps = {};
+            this.status.apps[appNames] = options || {};
+            this.status.apps[appNames].name = appNames;
+            this.status.apps[appNames].appId = appNames;
+            this.status.currentApp = appNames;
+        }else{
+            this.status = layout.userLayout;
+        }
         if (this.status && this.status.flatStyle) this.options.style = this.status.flatStyle;
     },
 
     load: function(){
         this.loadLayout(function(){
             this.setEvent();
-            this.loadDefaultPage();
+            if (!this.noDefault) this.loadDefaultPage();
             window.setTimeout(function(){
                 var iconsPath = this.path+"icons.json";
                 o2.JSON.get(iconsPath, function(json) {

+ 3 - 0
o2web/source/x_component_Common/Main.js

@@ -119,6 +119,7 @@ MWF.xApplication.Common.Main = new Class({
 				this.fireAppEvent("postLoadWindow");
 				this.fireAppEvent("queryLoadApplication");
 				//load css
+				if (this.options.title) this.setTitle(this.options.title);
 				if (this.stylePath) {
 					this.content.loadCss(this.stylePath, this.loadWindowApplication.bind(this));
 				}else{
@@ -223,6 +224,7 @@ MWF.xApplication.Common.Main = new Class({
 		this.fireAppEvent("queryLoadApplication");
 
 		//load css
+		if (this.options.title) this.setTitle(this.options.title);
 		if (this.stylePath) {
 			this.content.loadCss(this.stylePath, this.loadWindowApplication.bind(this));
 		}else{
@@ -278,6 +280,7 @@ MWF.xApplication.Common.Main = new Class({
 		this.fireAppEvent("queryLoadApplication");
 		this.setContentEvent();
 
+		if (this.options.title) this.setTitle(this.options.title);
 		if (this.stylePath) o2.loadCss(this.stylePath);
 		this.loadApplication(function () {
 			this.fireAppEvent("postLoadApplication");