提交 bc51574b 编写于 作者: H huqi1980 提交者: GitHub

Merge pull request #25 from huqi1980/master

upload html load
......@@ -167,6 +167,96 @@
};
this.o2.runCallback = _runCallback;
var _getAllOptions = function(options){
return {
"noCache": !!(options && options.nocache),
"reload": !!(options && options.reload),
"sequence": !!(options && options.sequence),
"doc": (options && options.doc) || document,
"dom": (options && options.dom) || document.body,
"position": "beforeend" //'beforebegin' 'afterbegin' 'beforeend' 'afterend'
}
};
var _getCssOptions = function(options){
return {
"noCache": !!(options && options.nocache),
"reload": !!(options && options.reload),
"sequence": !!(options && options.sequence),
"doc": (options && options.doc) || document,
"dom": (options && options.dom) || null
}
};
var _getJsOptions = function(options){
return {
"noCache": !!(options && options.nocache),
"reload": !!(options && options.reload),
"sequence": !!(options && options.sequence),
"doc": (options && options.doc) || document
}
};
var _getHtmlOptions = function(options){
return {
"noCache": !!(options && options.nocache),
"reload": !!(options && options.reload),
"sequence": !!(options && options.sequence),
"doc": (options && options.doc) || document,
"dom": (options && options.dom) || null,
"position": "beforeend" //'beforebegin' 'afterbegin' 'beforeend' 'afterend'
}
};
var _xhr_get = function(url, success, failure){
var xhr = new _request();
xhr.open("GET", url, true);
var _checkCssLoaded= function(_, err){
if (!(xhr.readyState == 4 || err)) return;
_removeListener(xhr, 'readystatechange', _checkCssLoaded);
_removeListener(xhr, 'load', _checkCssLoaded);
_removeListener(xhr, 'error', _checkCssErrorLoaded);
if (err) {failure(xhr); return}
var status = xhr.status;
status = (status == 1223) ? 204 : status;
if ((status >= 200 && status < 300))
success(xhr);
else if ((status >= 300 && status < 400))
failure(xhr);
else
failure(xhr);
};
var _checkCssErrorLoaded= function(err){ _checkCssLoaded(err) };
if ("load" in xhr) _addListener(xhr, "load", _checkCssLoaded);
if ("error" in xhr) _addListener(xhr, "load", _checkCssErrorLoaded);
_addListener(xhr, "readystatechange", _checkCssLoaded);
xhr.send();
};
var _loadSequence = function(ms, cb, op, n, thisLoaded, loadSingle, uuid, fun){
loadSingle(ms[n], function(module){
if (module) thisLoaded.push(module);
n++;
if (fun) fun(module);
if (n===ms.length){
if (cb) cb(thisLoaded);
}else{
_loadSequence(ms, cb, op, n, thisLoaded, loadSingle, uuid, fun);
}
}, op, uuid);
};
var _loadDisarray = function(ms, cb, op, thisLoaded, loadSingle, uuid, fun){
var count=0;
for (var i=0; i<ms.length; i++){
loadSingle(ms[i], function(module){
if (module) thisLoaded.push(module);
count++;
if (fun) fun(module);
if (count===ms.length) if (cb) cb(thisLoaded);
}, op, uuid);
}
};
//use framework url
var _frameworks = {
"o2.core": ["/o2_core/o2/o2.core.js"],
......@@ -184,97 +274,98 @@
};
var _loaded = {};
var _loadedCss = {};
var _loadedHtml = {};
var _loadSingle = function(url, callback, reload){
var addr_uri = _frameworks[url] || url;
if (!_debug) if (addr_uri.indexOf("o2_lib")===-1) addr_uri = addr_uri.replace(/\.js/, ".min.js");
addr_uri = (addr_uri.indexOf("?")!==-1) ? addr_uri+"&v="+this.o2.version.v : addr_uri+"?v="+this.o2.version.v;
var _loadSingle = function(module, callback, op){
var url = module;
var uuid = _uuid();
if (op.noCache) url = (url.indexOf("?")!==-1) ? url+"&v="+uuid : addr_uri+"?v="+uuid;
var key = encodeURIComponent(url);
if (!op.reload) if (_loaded[key]){ if (callback)callback(); return; }
if (!reload) if (_loaded[key]){ if (callback)callback(); return; }
var head = (document.head || document.getElementsByTagName("head")[0] || document.documentElement);
var s = document.createElement('script');
s.src = addr_uri;
var head = (op.doc.head || op.doc.getElementsByTagName("head")[0] || op.doc.documentElement);
var s = op.doc.createElement('script');
head.appendChild(s);
s.id = uuid;
s.src = url;
var _checkScriptLoaded = function(_, isAbort){
var _checkScriptLoaded = function(_, isAbort, err){
if (isAbort || !s.readyState || s.readyState === "loaded" || s.readyState === "complete") {
_loaded[key] = true;
_removeListener(s, 'DOMContentLoaded', _checkScriptLoaded);
var scriptObj = {"module": module, "id": uuid, "script": s, "doc": op.doc};
if (!err) _loaded[key] = scriptObj;
_removeListener(s, 'readystatechange', _checkScriptLoaded);
if (!isAbort) if (callback)callback();
_removeListener(s, 'load', _checkScriptLoaded);
_removeListener(s, 'error', _checkScriptErrorLoaded);
if (!isAbort || err){
if (err){
if (s) head.removeChild(s);
if (callback)callback();
}else{
head.removeChild(s);
if (callback)callback(scriptObj);
}
}
}
};
var _checkScriptErrorLoaded = function(e, err){
console.log("Error: load javascript module: "+module);
_checkScriptLoaded(e, true, "error");
};
if ('onreadystatechange' in s) _addListener(s, 'readystatechange', _checkScriptLoaded);
_addListener(s, 'load', _checkScriptLoaded);
_addListener(s, 'error', _checkScriptErrorLoaded);
};
var _load = function(urls, callback, reload, doc){
var urltype = _typeOf(urls);
var modules;
if (urltype==="array"){
modules = [];
for (var i=0; i<urls.length; i++){
var url = urls[i];
var module = _frameworks[url] || url;
if (_typeOf(module)==="array"){
modules.concat(module)
}else{
modules.push(url)
}
}
}else{
modules = _frameworks[urls] || urls;
}
var type = _typeOf(modules);
if (type==="array"){
var thisLoaded = [];
for (var i=0; i<modules.length; i++){
_loadSingle(modules[i], function(){
thisLoaded.push(modules[i]);
if (thisLoaded.length===modules.length){
if (callback) callback();
}
}, reload, doc);
var _load = function(urls, options, callback){
var ms = (_typeOf(urls)==="array") ? urls : [urls];
var op = (_typeOf(options)==="object") ? _getJsOptions(options) : _getJsOptions(null);
var cb = (_typeOf(options)==="function") ? options : callback;
var modules = [];
for (var i=0; i<ms.length; i++){
var url = ms[i];
var module = _frameworks[url] || url;
if (_typeOf(module)==="array"){
modules = modules.concat(module)
}else{
modules.push(module)
}
}
if (type==="string"){
_loadSingle(modules, callback, reload);
var thisLoaded = [];
if (op.sequence){
_loadSequence(modules, cb, op, 0, thisLoaded, _loadSingle);
}else{
_loadDisarray(modules, cb, op, thisLoaded, _loadSingle);
}
};
this.o2.load = _load;
var _loadSingleCss = function(url, callback, uuid, reload, sourceDoc){
var key = encodeURIComponent(url);
if (!reload) if (_loadedCss[key]){ if (callback)callback(_loadedCss[key]); return; }
var cssurl = _frameworks[url] || url;
var _loadSingleCss = function(module, callback, op, uuid){
var url = module;
var uid = _uuid();
if (op.noCache) url = (url.indexOf("?")!==-1) ? url+"&v="+uid : url+"?v="+uid;
var xhr = new _request();
xhr.open("GET", cssurl, true);
var key = encodeURIComponent(url);
if (!op.reload) if (_loadedCss[key]){ if (callback)callback(_loadedCss[key]); return; }
var success = function(xhr){
var cssText = xhr.responseText;
try{
if (cssText){
if (uuid){
if (op.dom){
var rex = new RegExp("(.+)(?=\\{)", "g");
var match;
while ((match = rex.exec(cssText)) !== null) {
var prefix = "." + uuid + " ";
var rule = prefix + match[0];
cssText = cssText.substring(0, match.index) + rule + cssText.substring(rex.lastIndex, cssText.length)
cssText = cssText.substring(0, match.index) + rule + cssText.substring(rex.lastIndex, cssText.length);
rex.lastIndex = rex.lastIndex + prefix.length;
}
}
var doc = sourceDoc || document;
var style = doc.createElement("style");
var style = op.doc.createElement("style");
style.setAttribute("type", "text/css");
var head = (document.head || document.getElementsByTagName("head")[0] || document.documentElement);
var head = (op.doc.head || op.doc.getElementsByTagName("head")[0] || op.doc.documentElement);
head.appendChild(style);
if(style.styleSheet){
var setFunc = function(){
......@@ -286,41 +377,24 @@
setFunc();
}
}else{
var cssTextNode = doc.createTextNode(cssText);
var cssTextNode = op.doc.createTextNode(cssText);
style.appendChild(cssTextNode);
}
style.sheet.cssRules[0].cssText = "#layout_xxx {\n" +
" width: 500px;\n" +
" height: 300px;\n" +
" background: #FFCCBA;\n" +
"}"
}
_loadedCss[key] = style;
if (callback) callback(style);
style.id = uid;
var styleObj = {"module": module, "id": uid, "style": style, "doc": op.doc};
_loadedCss[key] = styleObj;
if (callback) callback(styleObj);
}catch (e){
if (callback) callback();
return;
}
};
var failure = function(xhr){
console.log("Error: load css module: "+module);
if (callback) callback();
};
var onreadystatechange= function(){
if (xhr.readyState != 4) return;
var status = xhr.status;
status = (status == 1223) ? 204 : status;
//var response = {text: xhr.responseText || '', xml: xhr.responseXML};
if ((status >= 200 && status < 300))
success(xhr);
else if ((status >= 300 && status < 400))
failure(xhr);
else
failure(xhr);
};
_addListener(xhr, "readystatechange", onreadystatechange);
//xhr.onreadystatechange = onreadystatechange;
xhr.send();
_xhr_get(url, success, failure);
};
var _parseDomString = function(dom, fn, sourceDoc){
......@@ -337,32 +411,88 @@
if (domType==="element") _parseDomElement(dom, fn);
if (domType==="array") for (var i=0; i<dom.length; i++) _parseDom(dom[i], fn, sourceDoc);
};
var _loadCss = function(urls, dom, callback, reload, sourceDoc){
var uuid = "";
if (dom){
uuid = "css"+_uuid();
_parseDom(dom, function(node){ node.className += ((node.className) ? " "+uuid : uuid)}, sourceDoc);
var _loadCss = function(modules, options, callback){
var ms = (_typeOf(modules)==="array") ? modules : [modules];
var op = (_typeOf(options)==="object") ? _getCssOptions(options) : _getCssOptions(null);
var cb = (_typeOf(options)==="function") ? options : callback;
var uuid = "css"+_uuid();
if (op.dom) _parseDom(op.dom, function(node){ node.className += ((node.className) ? " "+uuid : uuid)}, op.doc);
var thisLoaded = [];
if (op.sequence){
_loadSequence(ms, cb, op, 0, thisLoaded, _loadSingleCss, uuid);
}else{
_loadDisarray(ms, cb, op, thisLoaded, _loadSingleCss, uuid);
}
modules = _frameworks[urls] || urls;
var type = _typeOf(modules);
if (type==="array"){
var thisLoaded = [];
var styleList = [];
for (var i=0; i<modules.length; i++){
_loadSingleCss(modules[i], function(style){
thisLoaded.push(modules[i]);
if (style) styleList.push(styleList);
if (thisLoaded.length===modules.length){
if (callback) callback(styleList);
}
}, uuid, reload, sourceDoc);
};
var _removeCss = function(module){
var k = encodeURIComponent(module);
var removeCss = _loadedCss[k];
if (!removeCss) for (key in _loadedCss){
if (_loadedCss[key].id==module){
removeCss = _loadedCss[key];
k = key;
break;
}
}
if (type==="string"){
_loadSingleCss(modules, callback, uuid, reload, sourceDoc);
if (removeCss){
delete _loadedCss[k];
var styleNode = removeCss.doc.getElementById(removeCss.id);
if (styleNode) styleNode.parentNode.removeChild(styleNode);
removeCss = null;
}
};
this.o2.loadCss = _loadCss;
this.o2.removeCss = _removeCss;
Element.prototype.loadCss = function(modules, options, callback){
var op = (_typeOf(options)==="object") ? options : {};
var cb = (_typeOf(options)==="function") ? options : callback;
op.dom = this;
_loadCss(modules, op, cb);
};
_loadSingleHtml = function(module, callback, op){
var url = module;
var uid = _uuid();
if (op.noCache) url = (url.indexOf("?")!==-1) ? url+"&v="+uid : url+"?v="+uid;
var key = encodeURIComponent(url);
if (!op.reload) if (_loadedHtml[key]){ if (callback)callback(_loadedHtml[key]); return; }
var success = function(xhr){
var htmlObj = {"module": module, "id": uid, "data": xhr.responseText, "doc": op.doc};
_loadedHtml[key] = htmlObj;
if (callback) callback(htmlObj);
};
var failure = function(){
console.log("Error: load html module: "+module);
if (callback) callback();
};
_xhr_get(url, success, failure);
};
var _injectHtml = function(op, data){
if (op.dom) _parseDom(op.dom, function(node){ node.insertAdjacentHTML(op.position, data) }, op.doc);
};
var _loadHtml = function(modules, options, callback){
var ms = (_typeOf(modules)==="array") ? modules : [modules];
var op = (_typeOf(options)==="object") ? _getHtmlOptions(options) : _getHtmlOptions(null);
var cb = (_typeOf(options)==="function") ? options : callback;
var thisLoaded = [];
if (op.sequence){
_loadSequence(ms, cb, op, 0, thisLoaded, _loadSingleHtml, null, function(html){ if (html) _injectHtml(op, html.data ); });
}else{
_loadDisarray(ms, cb, op, thisLoaded, _loadSingleHtml, null, function(html){ if (html) _injectHtml(op, html.data ); });
}
};
this.o2.loadHtml = _loadHtml;
Element.prototype.loadHtml = function(modules, options, callback){
var op = (_typeOf(options)==="object") ? options : {};
var cb = (_typeOf(options)==="function") ? options : callback;
op.dom = this;
_loadHtml(modules, op, cb);
};
var _dom = {
ready: false,
......
......@@ -6,7 +6,7 @@ o2.widget.ace = {
if (!window.ace){
var jsLoaded = false;
var cssLoaded = false;
o2.load("ace", function(){
o2.load("ace", {"sequence": true}, function(){
//COMMON.AjaxModule.loadDom("ace-tools", function(){
if (callback) callback();
//}.bind(this))
......
......@@ -245,7 +245,10 @@ MWF.xApplication.Common.Main = new Class({
openInNewBrowser: function(){
this.desktop.openBrowserApp = this.options.name;
this.desktop.openBrowserStatus = (this.recordStatus) ? this.recordStatus() : null;
window.open("app.html", "_blank");
var status = (this.desktop.openBrowserStatus) ? JSON.encode(this.desktop.openBrowserStatus) : "";
var url = "app.html?app="+this.options.name+"&status="+status;
window.open(url, "_blank");
if (!this.inBrowser) this.close();
},
openInNewWindow: function(){
......
......@@ -1324,7 +1324,7 @@ MWF.xApplication.portal.PageDesigner.Main = new Class({
this.setTitle(this.options.appTitle + "-"+this.pageData.json.name);
this.taskitem.setText(this.options.appTitle + "-"+this.pageData.json.name);
if (this.taskitem) this.taskitem.setText(this.options.appTitle + "-"+this.pageData.json.name);
this.options.appTitle = this.options.appTitle + "-"+this.pageData.json.name;
if (!this.application){
......
......@@ -1297,7 +1297,7 @@ MWF.xApplication.process.FormDesigner.Main = new Class({
this.setTitle(this.options.appTitle + "-"+this.formData.json.name);
this.taskitem.setText(this.options.appTitle + "-"+this.formData.json.name);
if (this.taskitem) this.taskitem.setText(this.options.appTitle + "-"+this.formData.json.name);
this.options.appTitle = this.options.appTitle + "-"+this.formData.json.name;
if (!this.application){
......
MWF.xApplication.process = MWF.xApplication.process || {};
MWF.APPFD = MWF.xApplication.process.FormDesigner = MWF.xApplication.process.FormDesigner || {};
MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
MWF.xDesktop.requireApp("process.FormDesigner", "lp."+MWF.language, null, false);
......
......@@ -21,7 +21,7 @@
}
//layout.desktop = layout;
o2.addReady(function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
MWF.defaultPath = "/x_desktop"+MWF.defaultPath;
MWF.loadLP("zh-cn");
MWF.require("MWF.xDesktop.Layout", function(){
......
......@@ -14,7 +14,7 @@ o2.addReady(function(){
var options = (optionsStr) ? JSON.decode(optionsStr) : null;
var statusObj = (statusStr) ? JSON.decode(statusStr) : null;
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
MWF.defaultPath = "/x_desktop"+MWF.defaultPath;
MWF.loadLP("zh-cn");
......@@ -66,11 +66,18 @@ o2.addReady(function(){
var topWindow = window.opener;
if (topWindow){
topWindow.layout.desktop.openBrowserStatus = status;
var appName = topWindow.layout.desktop.openBrowserApp || appNames;
var m_status = status;
var option = topWindow.layout.desktop.openBrowserOption || options;
window.location.reload();
try{
topWindow.layout.desktop.openBrowserStatus = status;
var appName = topWindow.layout.desktop.openBrowserApp || appNames;
var m_status = status;
var option = topWindow.layout.desktop.openBrowserOption || options;
window.location.reload();
}catch(e){
statusStr = JSON.encode(status);
var port = uri.get("port");
var url = uri.get("scheme")+"://"+uri.get("host")+((port) ? ":"+port+"/" : "")+uri.get("directory ")+"?app="+appNames+"&status="+statusStr;
window.location = url;
}
}else{
statusStr = JSON.encode(status);
var port = uri.get("port");
......@@ -122,10 +129,17 @@ o2.addReady(function(){
this.node = $("layout");
var topWindow = window.opener;
if (topWindow){
var appName = topWindow.layout.desktop.openBrowserApp || appNames;
var m_status = topWindow.layout.desktop.openBrowserStatus || statusObj;
var option = topWindow.layout.desktop.openBrowserOption || options;
layout.openApplication(null, appName, option||{}, m_status);
try{
var appName = topWindow.layout.desktop.openBrowserApp || appNames;
var m_status = topWindow.layout.desktop.openBrowserStatus || statusObj;
var option = topWindow.layout.desktop.openBrowserOption || options;
layout.openApplication(null, appName, option||{}, m_status);
}catch(e){
var appName = appNames;
var m_status = statusObj;
var option = options;
layout.openApplication(null, appName, option||{}, m_status);
}
//topWindow.layout.desktop.openBrowserApp = null;
//topWindow.layout.desktop.openBrowserStatus = null;
//topWindow.layout.desktop.openBrowserOption = null;
......
......@@ -17,7 +17,7 @@ o2.addReady(function(){
var options = (optionsStr) ? JSON.decode(optionsStr) : null;
var statusObj = (statusStr) ? JSON.decode(statusStr) : null;
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
MWF.defaultPath = "/x_desktop"+MWF.defaultPath;
MWF.loadLP("zh-cn");
......@@ -206,11 +206,18 @@ o2.addReady(function(){
this.node = $("layout");
var topWindow = window.opener;
if (topWindow){
try{
var appName = topWindow.layout.desktop.openBrowserApp || appNames;
var m_status = topWindow.layout.desktop.openBrowserStatus || statusObj;
var option = topWindow.layout.desktop.openBrowserOption || options;
layout.openApplication(null, appName, option||{}, m_status);
}catch(e){
var appName = appNames;
var m_status = statusObj;
var option = options;
layout.openApplication(null, appName, option||{}, m_status);
}
var appName = topWindow.layout.desktop.openBrowserApp || appNames;
var m_status = topWindow.layout.desktop.openBrowserStatus || statusObj;
var option = topWindow.layout.desktop.openBrowserOption || options;
layout.openApplication(null, appName, option||{}, m_status);
//topWindow.layout.desktop.openBrowserApp = null;
//topWindow.layout.desktop.openBrowserStatus = null;
//topWindow.layout.desktop.openBrowserOption = null;
......
......@@ -7,7 +7,7 @@ layout.session = layout.session || {};
var href = locate.href;
if (href.indexOf("debugger")!=-1) layout.debugger = true;
o2.addReady(function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
MWF.defaultPath = "/x_desktop"+MWF.defaultPath;
MWF.loadLP("zh-cn");
......
......@@ -6,7 +6,7 @@ if (href.indexOf("debugger")!==-1) layout.debugger = true;
layout.desktop = layout;
layout.session = layout.session || {};
o2.addReady(function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
MWF.defaultPath = "/x_desktop"+MWF.defaultPath;
MWF.loadLP("zh-cn");
......
......@@ -6,7 +6,7 @@ var href = locate.href;
layout.session = layout.session || {};
if (href.indexOf("debugger")!=-1) layout.debugger = true;
o2.addReady(function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
MWF.defaultPath = "/x_desktop"+MWF.defaultPath;
MWF.loadLP("zh-cn");
......
......@@ -7,7 +7,7 @@ var href = locate.href;
layout.session = layout.session || {};
if (href.indexOf("debugger")!=-1) layout.debugger = true;
o2.addReady(function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
MWF.defaultPath = "/x_desktop"+MWF.defaultPath;
MWF.loadLP("zh-cn");
......
......@@ -21,7 +21,7 @@ o2.addReady(function(){
// COMMON.AjaxModule.load("/x_desktop/res/framework/mootools/plugin/mBox.Notice.js", null, false);
// COMMON.AjaxModule.load("/x_desktop/res/framework/mootools/plugin/mBox.Tooltip.js", null, false);
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
//COMMON.AjaxModule.load("mwf", function(){
MWF.defaultPath = "/x_desktop"+MWF.defaultPath;
MWF.loadLP("zh-cn");
......@@ -105,11 +105,18 @@ o2.addReady(function(){
var topWindow = window.opener;
if (topWindow){
topWindow.layout.desktop.openBrowserStatus = status;
var appName = topWindow.layout.desktop.openBrowserApp || appNames;
var m_status = status;
var option = topWindow.layout.desktop.openBrowserOption || options;
window.location.reload();
try{
topWindow.layout.desktop.openBrowserStatus = status;
var appName = topWindow.layout.desktop.openBrowserApp || appNames;
var m_status = status;
var option = topWindow.layout.desktop.openBrowserOption || options;
window.location.reload();
}catch(e){
statusStr = encodeURIComponent(JSON.encode(status));
var port = uri.get("port");
var url = uri.get("scheme")+"://"+uri.get("host")+((port) ? ":"+port+"" : "")+uri.get("directory")+uri.get("file")+"?app="+appNames+"&status="+statusStr;
window.location = url;
}
}else{
statusStr = encodeURIComponent(JSON.encode(status));
var port = uri.get("port");
......@@ -126,11 +133,18 @@ o2.addReady(function(){
this.node = $("layout");
var topWindow = window.opener;
if (topWindow){
try{
var appName = topWindow.layout.desktop.openBrowserApp || appNames;
var m_status = topWindow.layout.desktop.openBrowserStatus || statusObj;
var option = topWindow.layout.desktop.openBrowserOption || options;
layout.openApplication(null, appName, option||{}, m_status);
}catch(e){
var appName = appNames;
var m_status = statusObj;
var option = options;
layout.openApplication(null, appName, option||{}, m_status);
}
var appName = topWindow.layout.desktop.openBrowserApp || appNames;
var m_status = topWindow.layout.desktop.openBrowserStatus || statusObj;
var option = topWindow.layout.desktop.openBrowserOption || options;
layout.openApplication(null, appName, option||{}, m_status);
//topWindow.layout.desktop.openBrowserApp = null;
//topWindow.layout.desktop.openBrowserStatus = null;
//topWindow.layout.desktop.openBrowserOption = null;
......
......@@ -17,7 +17,7 @@ o2.addReady(function(){
var statusObj = {"portalId": id, "pageId": page};
var options = null;
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
MWF.defaultPath = "/x_desktop"+MWF.defaultPath;
MWF.loadLP("zh-cn");
......@@ -206,11 +206,18 @@ o2.addReady(function(){
this.node = $("layout");
var topWindow = window.opener;
if (topWindow){
try{
var appName = topWindow.layout.desktop.openBrowserApp || appNames;
var m_status = topWindow.layout.desktop.openBrowserStatus || statusObj;
var option = topWindow.layout.desktop.openBrowserOption || options;
layout.openApplication(null, appName, option||{}, m_status);
}catch(e){
var appName = appNames;
var m_status = statusObj;
var option = options;
layout.openApplication(null, appName, option||{}, m_status);
}
var appName = topWindow.layout.desktop.openBrowserApp || appNames;
var m_status = topWindow.layout.desktop.openBrowserStatus || statusObj;
var option = topWindow.layout.desktop.openBrowserOption || options;
layout.openApplication(null, appName, option||{}, m_status);
//topWindow.layout.desktop.openBrowserApp = null;
//topWindow.layout.desktop.openBrowserStatus = null;
//topWindow.layout.desktop.openBrowserOption = null;
......
......@@ -6,7 +6,7 @@ if (href.indexOf("debugger")!=-1) layout.debugger = true;
layout.desktop = layout;
layout.session = layout.session || {};
o2.addReady(function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
MWF.defaultPath = "/x_desktop"+MWF.defaultPath;
MWF.loadLP("zh-cn");
......
......@@ -6,7 +6,7 @@ if (href.indexOf("debugger")!=-1) layout.debugger = true;
layout.desktop = layout;
layout.session = layout.session || {};
o2.addReady(function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
MWF.defaultPath = "/x_desktop"+MWF.defaultPath;
MWF.loadLP("zh-cn");
......
......@@ -9,7 +9,7 @@ layout.desktop = layout;
var parentWindow = window.opener;
o2.addReady(function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
MWF.defaultPath = "/x_desktop"+MWF.defaultPath;
MWF.loadLP("zh-cn");
......
......@@ -8,7 +8,7 @@ layout.mobile = true;
layout.desktop = layout;
layout.desktop.session = {};
o2.addReady(function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
MWF.defaultPath = "/x_desktop"+MWF.defaultPath;
MWF.loadLP("zh-cn");
......
......@@ -8,7 +8,7 @@ layout.desktop = layout;
layout.desktop.session = {};
layout.session = layout.session || {};
o2.addReady(function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
MWF.defaultPath = "/x_desktop"+MWF.defaultPath;
MWF.loadLP("zh-cn");
......
......@@ -26,8 +26,8 @@ o2.addReady(function(){
//COMMON.setContentPath("/x_desktop");
//COMMON.AjaxModule.load("ie_adapter", function(){
o2.load("../o2_lib/mootools/plugin/mBox.Notice.js", function(){
o2.load("../o2_lib/mootools/plugin/mBox.Tooltip.js", function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
//o2.load("../o2_lib/mootools/plugin/mBox.Tooltip.js", function(){
//o2.load("mwf", function(){
o2.JSON.get("res/config/config.json", function(config){
......@@ -65,7 +65,7 @@ o2.addReady(function(){
}, false);
//});
});
//});
});
//});
});
......
......@@ -17,7 +17,7 @@ o2.addReady(function(){
var options = (optionsStr) ? JSON.decode(optionsStr) : null;
var statusObj = (statusStr) ? JSON.decode(statusStr) : null;
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
MWF.defaultPath = "/x_desktop" + MWF.defaultPath;
MWF.loadLP("zh-cn");
......
......@@ -91,7 +91,7 @@
MWF.require("MWF.xDesktop.Common", null, false);
MWF.require("MWF.xAction.RestActions", null, false);
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
o2.JSON.get("res/config/config.json", function (config) {
layout.config = config;
MWF.xDesktop.getServiceAddress(config, function (service, center) {
......
......@@ -23,7 +23,7 @@
layout.session = window.frameElement.ownerDocument.window.layout.session || {};
//layout.desktop = layout;
o2.addReady(function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
MWF.getJSON("res/config/config.json", function(config){
layout.config = config;
if (layout.config.app_protocol=="auto"){
......
......@@ -14,7 +14,7 @@
<script>
layout = window.layout || {};
o2.addReady(function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], function(){
o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
MWF.defaultPath = "/x_desktop"+MWF.defaultPath;
MWF.loadLP("zh-cn");
MWF.require("MWF.xDesktop.Layout", function(){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册