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

Merge pull request #37 from huqi1980/master

同步web
......@@ -2,10 +2,8 @@
<html>
<head>
<meta charset="UTF-8"/>
<meta property="qc:admins" content="15567714566004146725645301" />
<meta property="qc:admins" content="1556771456600414672564530" />
<meta http-equiv="refresh" content="0;url=/x_desktop/index.html"/>
</head>
<body style="margin:0;font-size: 1.0em;font-family:Microsoft Yahei">
121
</body>
</html>
<body style="margin:0;font-size: 1.0em;font-family:Microsoft Yahei"></body>
</html>
\ No newline at end of file
......@@ -135,6 +135,8 @@
var _rand = function(max) {
return Math.floor(Math.random() * (max + 1));
};
//uuid
var _uuid = function(){
var dg = new Date(1582, 10, 15, 0, 0, 0, 0);
var dc = new Date();
......@@ -167,6 +169,8 @@
};
this.o2.runCallback = _runCallback;
//load js, css, html adn all.
var _getAllOptions = function(options){
var doc = (options && options.doc) || document;
if (!doc.unid) doc.unid = _uuid();
......@@ -176,6 +180,7 @@
"sequence": !!(options && options.sequence),
"doc": doc,
"dom": (options && options.dom) || document.body,
"bind": (options && options.bind) || null,
"position": "beforeend" //'beforebegin' 'afterbegin' 'beforeend' 'afterend'
}
};
......@@ -209,15 +214,20 @@
"sequence": !!(options && options.sequence),
"doc": doc,
"dom": (options && options.dom) || null,
"bind": (options && options.bind) || null,
"position": "beforeend" //'beforebegin' 'afterbegin' 'beforeend' 'afterend'
}
};
var _xhr_get = function(url, success, failure){
var _xhr_get = function(url, success, failure, completed){
var xhr = new _request();
xhr.open("GET", url, true);
var _checkCssLoaded= function(_, err){
if (!(xhr.readyState == 4 || err)) return;
if (!(xhr.readyState == 4)) return;
if (err){
if (completed) completed(xhr);
return;
}
_removeListener(xhr, 'readystatechange', _checkCssLoaded);
_removeListener(xhr, 'load', _checkCssLoaded);
......@@ -232,6 +242,7 @@
failure(xhr);
else
failure(xhr);
if (completed) completed(xhr);
};
var _checkCssErrorLoaded= function(err){ _checkCssLoaded(err) };
......@@ -265,6 +276,7 @@
}
};
//load js
//use framework url
var _frameworks = {
"o2.core": ["/o2_core/o2/o2.core.js"],
......@@ -286,6 +298,8 @@
var _loaded = {};
var _loadedCss = {};
var _loadedHtml = {};
var _loadCssRunning = {};
var _loadCssQueue = [];
var _loadSingle = function(module, callback, op){
var url = module;
......@@ -354,18 +368,44 @@
};
this.o2.load = _load;
//load css
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 key = encodeURIComponent(url+op.doc.unid);
if (!op.reload) if (_loadedCss[key]){ if (callback)callback(_loadedCss[key]); return; }
if (_loadCssRunning[key]){
_loadCssQueue.push(function(){
_loadSingleCss(module, callback, op, uuid);
});
return;
}
if (_loadedCss[key]) uuid = _loadedCss[key]["class"];
if (op.dom) _parseDom(op.dom, function(node){ if (node.className.indexOf(uuid) == -1) node.className += ((node.className) ? " "+uuid : uuid);}, op.doc);
var completed = function(){
if (_loadCssRunning[key]){
_loadCssRunning[key] = false;
delete _loadCssRunning[key];
}
if (_loadCssQueue && _loadCssQueue.length){
(_loadCssQueue.shift())();
}
};
if (_loadedCss[key])if (!op.reload){
if (callback)callback(_loadedCss[key]);
completed();
return;
}
var success = function(xhr){
var cssText = xhr.responseText;
try{
if (cssText){
if (op.bind) cssText = cssText.bindJson(op.bind);
if (op.dom){
var rex = new RegExp("(.+)(?=\\{)", "g");
var match;
......@@ -395,7 +435,7 @@
}
}
style.id = uid;
var styleObj = {"module": module, "id": uid, "style": style, "doc": op.doc};
var styleObj = {"module": module, "id": uid, "style": style, "doc": op.doc, "class": uuid};
_loadedCss[key] = styleObj;
if (callback) callback(styleObj);
}catch (e){
......@@ -407,7 +447,10 @@
console.log("Error: load css module: "+module);
if (callback) callback();
};
_xhr_get(url, success, failure);
_loadCssRunning[key] = true;
_xhr_get(url, success, failure, completed);
};
var _parseDomString = function(dom, fn, sourceDoc){
......@@ -430,8 +473,6 @@
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);
......@@ -466,6 +507,7 @@
_loadCss(modules, op, cb);
};
//load html
_loadSingleHtml = function(module, callback, op){
var url = module;
var uid = _uuid();
......@@ -486,6 +528,7 @@
};
var _injectHtml = function(op, data){
if (op.bind) data = data.bindJson(op.bind);
if (op.dom) _parseDom(op.dom, function(node){ node.insertAdjacentHTML(op.position, data) }, op.doc);
};
var _loadHtml = function(modules, options, callback){
......@@ -508,6 +551,128 @@
_loadHtml(modules, op, cb);
};
//load all
_loadAll = function(modules, options, callback){
//var ms = (_typeOf(modules)==="array") ? modules : [modules];
var op = (_typeOf(options)==="object") ? _getAllOptions(options) : _getAllOptions(null);
var cb = (_typeOf(options)==="function") ? options : callback;
var ms, htmls, styles, sctipts;
var _htmlLoaded=(!modules.html), _cssLoaded=(!modules.css), _jsLoaded=(!modules.js);
var _checkloaded = function(){
if (_htmlLoaded && _cssLoaded && _jsLoaded) if (cb) cb(htmls, styles, sctipts);
};
if (modules.html){
_loadHtml(modules.html, op, function(h){
htmls = h;
_htmlLoaded = true;
_checkloaded();
});
}
if (modules.css){
_loadCss(modules.css, op, function(s){
styles = s;
_cssLoaded = true;
_checkloaded();
});
}
if (modules.js){
_load(modules.js, op, function(s){
sctipts = s;
_jsLoaded = true;
_checkloaded();
});
}
};
this.o2.loadAll = _loadAll;
Element.prototype.loadAll = function(modules, options, callback){
var op = (_typeOf(options)==="object") ? options : {};
var cb = (_typeOf(options)==="function") ? options : callback;
op.dom = this;
_loadAll(modules, op, cb);
};
//json template
_parseText = function(html, json){
var _ht = html;
var regexp = /(text\{).+?\}/g;
var r = _ht.match(regexp);
if(r) if (r.length){
for (var i=0; i<r.length; i++){
var text = r[i].substr(0,r[i].lastIndexOf("}"));
text = text.substr(text.indexOf("{")+1,text.length);
var value = _jsonText(json ,text);
_ht = _ht.replace(/(text\{).+?\}/,value);
}
}
return _ht;
};
_parseEach = function(html, json){
var _ht = html;
var regexp = /(\{each\([\s\S]+\)\})[\s\S]+?(\{endEach\})/g;
var r = _ht.match(regexp);
if(r){
if (r.length){
for (var i=0; i<r.length; i++){
var eachItemsStr = r[i].substr(0,r[i].indexOf(")"));
eachItemsStr = eachItemsStr.substr(eachItemsStr.indexOf("(")+1,eachItemsStr.length);
var pars = eachItemsStr.split(/,[\s]*/g);
eachItemsPar = pars[0];
eachItemsCount = pars[1].toInt();
var eachItems = _jsonText(json ,eachItemsPar);
if (eachItems) if (eachItemsCount==0) eachItemsCount = eachItems.length;
var eachContentStr = r[i].substr(0,r[i].lastIndexOf("{endEach}"));
eachContentStr = eachContentStr.substr(eachContentStr.indexOf("}")+1,eachContentStr.length);
var eachContent = [];
if (eachItems){
for (var n=0; n<Math.min(eachItems.length, eachItemsCount); n++){
var item = eachItems[n];
if (item){
var tmpEachContentStr = eachContentStr;
var textReg = /(eachText\{).+?\}/g;
texts = tmpEachContentStr.match(textReg);
if (texts){
if (texts.length){
for (var j=0; j<texts.length; j++){
var text = texts[j].substr(0,texts[j].lastIndexOf("}"));
text = text.substr(text.indexOf("{")+1,text.length);
var value = _jsonText(item ,text);
tmpEachContentStr = tmpEachContentStr.replace(/(eachText\{).+?\}/,value);
}
}
}
eachContent.push(tmpEachContentStr);
}
}
}
_ht = _ht.replace(/(\{each\([\s\S]+\)\})[\s\S]+?(\{endEach\})/,eachContent.join(""));
}
}
}
return _ht;
};
_jsonText = function(json, text){
var $ = json;
var f = eval("(x = function($){\n return "+text+";\n})");
returnValue = f.apply(json, [$]);
if (returnValue===undefined) returnValue="";
returnValue = returnValue.toString();
return returnValue || "";
};
_bindJson = function(str, json){
return _parseEach(_parseText(str, json), json);
};
o2.bindJson = _bindJson;
String.prototype.bindJson = function(json){
return _parseEach(_parseText(this, json), json);
};
//dom ready
var _dom = {
ready: false,
loaded: false,
......
......@@ -397,7 +397,7 @@ var mBox = new Class({
}
this.wrapper.inject(document.body, 'bottom');
if (this.wrapper) this.wrapper.inject(document.body, 'bottom');
// set new position
this.setPosition(null, options.position || null, options.offset || null);
......@@ -480,9 +480,11 @@ var mBox = new Class({
this.wrapper.setStyle('display', 'none');
this.fireEvent('systemCloseComplete').fireEvent('closeComplete');
var target = this.target || $(this.options.target) || this.options.target || $(this.options.attach);
if (target && typeOf(target)==="element"){
this.wrapper.inject(target);
if (this.wrapper){
var target = this.target || $(this.options.target) || this.options.target || $(this.options.attach);
if (target && typeOf(target)==="element"){
this.wrapper.inject(target);
}
}
}.bind(this);
......
MWF.require("MWF.widget.MaskNode", null, false);
MWF.xApplication.AppMarket.Main = new Class({
Extends: MWF.xApplication.Common.Main,
Implements: [Options, Events],
......@@ -14,8 +15,20 @@ MWF.xApplication.AppMarket.Main = new Class({
this.lp = MWF.xApplication.AppMarket.LP;
this.actions = MWF.Actions.get("x_program_center");
},
mask: function(){
if (!this.maskNode){
this.maskNode = new MWF.widget.MaskNode(this.contentNode, {"style": "bam"});
this.maskNode.load();
}
},
unmask: function(){
if (this.maskNode) this.maskNode.hide(function(){
MWF.release(this.maskNode);
this.maskNode = null;
}.bind(this));
},
loadApplication: function(callback){
this.components = [];
this.components = [];
this.loadTitle();
this.contentNode = new Element("div", {"styles": this.css.contentNode}).inject(this.content);
......@@ -23,6 +36,7 @@ MWF.xApplication.AppMarket.Main = new Class({
this.setContentSize();
this.addEvent("resize", this.setContentSize);
this.mask();
this.loadCloudAppsContent();
},
......@@ -129,6 +143,8 @@ MWF.xApplication.AppMarket.Main = new Class({
this.itemList.push(new MWF.xApplication.AppMarket.Module(this, module));
}.bind(this));
}.bind(this));
this.unmask();
}.bind(this));
}
});
......
......@@ -13,7 +13,7 @@
<span MWFnodetype="MWFToolBarMenu" MWFButtonImage="formImplode.gif" title="表单导入" MWFButtonText="">
<span MWFnodetype="MWFToolBarMenuItem" MWFButtonImage="o216.png" title="导入O2格式表单" MWFButtonAction="pageImplode" MWFButtonText="从O2数据导入"></span>
<span MWFnodetype="MWFToolBarMenuItem" MWFButtonImage="html.png" title="从HTML导入" MWFButtonAction="htmlImplode" MWFButtonText="从HTML导入"></span>
<span MWFnodetype="MWFToolBarMenuItem" MWFButtonImage="word.png" title="从WORD或EXCEL导入" MWFButtonAction="officeImplode" MWFButtonText="从WORD或EXCEL导入"></span>
<span MWFnodetype="MWFToolBarMenuItem" MWFButtonImage="word.png" title="从WORD导入" MWFButtonAction="officeImplode" MWFButtonText="从WORD导入"></span>
</span>
<span MWFnodetype="MWFToolBarSeparator"></span>
......
......@@ -13,7 +13,7 @@
<span MWFnodetype="MWFToolBarMenu" MWFButtonImage="formImplode.gif" title="表单导入" MWFButtonText="">
<span MWFnodetype="MWFToolBarMenuItem" MWFButtonImage="o216.png" title="导入O2格式表单" MWFButtonAction="pageImplode" MWFButtonText="从O2数据导入"></span>
<span MWFnodetype="MWFToolBarMenuItem" MWFButtonImage="html.png" title="从HTML导入" MWFButtonAction="htmlImplode" MWFButtonText="从HTML导入"></span>
<span MWFnodetype="MWFToolBarMenuItem" MWFButtonImage="word.png" title="从WORD或EXCEL导入" MWFButtonAction="officeImplode" MWFButtonText="从WORD或EXCEL导入"></span>
<span MWFnodetype="MWFToolBarMenuItem" MWFButtonImage="word.png" title="从WORD导入" MWFButtonAction="officeImplode" MWFButtonText="从WORD导入"></span>
</span>
<!--<span MWFnodetype="MWFToolBarSeparator"></span>-->
......
......@@ -11,7 +11,7 @@
<span MWFnodetype="MWFToolBarMenu" MWFButtonImage="formImplode.gif" title="表单导入" MWFButtonText="">
<span MWFnodetype="MWFToolBarMenuItem" MWFButtonImage="o216.png" title="导入O2格式表单" MWFButtonAction="formImplode" MWFButtonText="从O2数据导入"></span>
<span MWFnodetype="MWFToolBarMenuItem" MWFButtonImage="html.png" title="从HTML导入" MWFButtonAction="htmlImplode" MWFButtonText="从HTML导入"></span>
<span MWFnodetype="MWFToolBarMenuItem" MWFButtonImage="word.png" title="从WORD或EXCEL导入" MWFButtonAction="officeImplode" MWFButtonText="从WORD或EXCEL导入"></span>
<span MWFnodetype="MWFToolBarMenuItem" MWFButtonImage="word.png" title="从WORD导入" MWFButtonAction="officeImplode" MWFButtonText="从WORD导入"></span>
</span>
<span MWFnodetype="MWFToolBarSeparator"></span>
......
......@@ -13,7 +13,7 @@
<span MWFnodetype="MWFToolBarMenu" MWFButtonImage="formImplode.gif" title="表单导入" MWFButtonText="">
<span MWFnodetype="MWFToolBarMenuItem" MWFButtonImage="o216.png" title="导入O2格式表单" MWFButtonAction="formImplode" MWFButtonText="从O2数据导入"></span>
<span MWFnodetype="MWFToolBarMenuItem" MWFButtonImage="html.png" title="从HTML导入" MWFButtonAction="htmlImplode" MWFButtonText="从HTML导入"></span>
<span MWFnodetype="MWFToolBarMenuItem" MWFButtonImage="word.png" title="从WORD或EXCEL导入" MWFButtonAction="officeImplode" MWFButtonText="从WORD或EXCEL导入"></span>
<span MWFnodetype="MWFToolBarMenuItem" MWFButtonImage="word.png" title="从WORD导入" MWFButtonAction="officeImplode" MWFButtonText="从WORD导入"></span>
</span>
<span MWFnodetype="MWFToolBarSeparator"></span>
......
.o2_fileItemNode {
padding: 5px;
height: 40px;
margin-top: 10px;
margin-left: 0;
border: 1px solid #CCC;
background-color: #FFF;
cursor: default;
}
.o2_fileDeleteActionNode {
padding: 0;
float: right;
width: 16px;
height: 16px;
opacity: 0;
cursor: pointer;
background: url('/x_component_process_ProcessManager/$Explorer/default/processIcon/deleteProcess.png') no-repeat center center;
}
.o2_fileItemIconNode {
padding: 0;
float: left;
margin-left: 10px;
width: 40px;
height: 40px;
}
.o2_fileItemInforNode {
margin-left: 60px;
margin-right: 26px;
height: 40px;
overflow: hidden;
}
.o2_fileItemInforBaseNode {
height: 20px;
line-height: 20px;
font-size: 12px;
}
.o2_fileItemTextTitleNode {
height: 20px;
font-weight: bold;
overflow: hidden;
cursor: pointer;
color: #333;
width: 38%;
float: left;
}
.o2_fileItemTextAliasNode {
height: 20px;
overflow: hidden;
cursor: pointer;
color: #777;
float: left;
width: 38%;
}
.o2_fileItemTextDateNode {
height: 20px;
overflow: hidden;
cursor: pointer;
color: #777;
float: left;
text-align: right;
width: 24%;
}
.o2_fileItemTextDescriptionNode {
font-size: 12px;
line-height: 20px;
height: 20px;
color: #888;
overflow: hidden;
white-space: normal;
}
\ No newline at end of file
<!--<div class="o2_fileItemNode">-->
<div class="o2_fileItemIconNode" style="background: url(text{$.iconUrl}) center center no-repeat"></div>
<div class="o2_fileDeleteActionNode"></div>
<div class="o2_fileItemInforNode">
<div class="o2_fileItemInforBaseNode">
<div class="o2_fileItemTextTitleNode" title="text{$.name}">text{$.name}</div>
<div class="o2_fileItemTextAliasNode" title="text{$.alias}">text{$.alias}</div>
<div class="o2_fileItemTextDateNode" title="text{$.updateTime}">text{$.updateTime}</div>
</div>
<div class="o2_fileItemTextDescriptionNode" title="text{$.description}">text{$.description}</div>
</div>
<!--</div>-->
\ No newline at end of file
......@@ -9,15 +9,15 @@ MWF.xApplication.process.ProcessManager.FileExplorer = new Class({
"noElement": MWF.APPPM.LP.file.noDictionaryNoticeText
},
createSearchElementNode: function(){
this.titleActionNodeNode = new Element("div", {
"styles": this.css.titleActionNode,
"text": MWF.APPPM.LP.file.loadFiles
}).inject(this.toolbarNode);
this.titleActionNodeNode.addEvent("click", function(){
this.implodeFiles();
}.bind(this));
},
// createSearchElementNode: function(){
// this.titleActionNodeNode = new Element("div", {
// "styles": this.css.titleActionNode,
// "text": MWF.APPPM.LP.file.loadFiles
// }).inject(this.toolbarNode);
// this.titleActionNodeNode.addEvent("click", function(){
// this.implodeFiles();
// }.bind(this));
// },
getNewData: function(){
return {
"id": "",
......@@ -73,16 +73,8 @@ MWF.xApplication.process.ProcessManager.FileExplorer = new Class({
},
_createElement: function(e){
// var _self = this;
// var options = {
// "onQueryLoad": function(){
// this.actions = _self.app.restActions;
// this.application = _self.app.options.application || _self.app.application;
// this.explorer = _self;
// }
// };
// this.app.desktop.openApplication(e, "process.FileDesigner", options);
new MWF.xApplication.process.ProcessManager.FileDesigner(this);
this.implodeFiles();
//new MWF.xApplication.process.ProcessManager.FileDesigner(this);
},
_loadItemDataList: function(callback){
var id = "";
......@@ -120,11 +112,59 @@ MWF.xApplication.process.ProcessManager.FileExplorer = new Class({
MWF.xApplication.process.ProcessManager.FileExplorer.File = new Class({
Extends: MWF.xApplication.process.ProcessManager.DictionaryExplorer.Dictionary,
load: function(){
var css = "/x_component_process_ProcessManager/$DictionaryExplorer/"+this.explorer.options.style+"/file.css";
var view = "/x_component_process_ProcessManager/$DictionaryExplorer/"+this.explorer.options.style+"/file.html";
this.container.loadCss(css);
this.node = new Element("div", {
"styles": this.explorer.css.itemNode,
"events": {
"mouseover": function(){
if (this.deleteActionNode) this.deleteActionNode.fade("in");
if (this.saveasActionNode) this.saveasActionNode.fade("in");
}.bind(this),
"mouseout": function(){
if (this.deleteActionNode) this.deleteActionNode.fade("out");
if (this.saveasActionNode) this.saveasActionNode.fade("out");
}.bind(this)
}
}).inject(this.container);
if (this.data.name.icon) this.icon = this.data.name.icon;
this.data.iconUrl = this.explorer.path+""+this.explorer.options.style+"/processIcon/"+this.icon;
this.node.loadHtml(view, {"bind": this.data}, function(){
debugger;
var itemIconNode = this.node.getElement(".o2_fileItemIconNode");
this.deleteActionNode = this.node.getElement(".o2_fileDeleteActionNode");
var itemTextTitleNode = this.node.getElement(".o2_fileItemTextTitleNode");
itemIconNode.addEvent("click", function(e){
this.toggleSelected();
e.stopPropagation();
}.bind(this));
itemIconNode.makeLnk({
"par": this._getLnkPar()
});
if (!this.explorer.options.noDelete) this._createActions();
itemTextTitleNode.addEvent("click", function(e){
this._open(e);
e.stopPropagation();
}.bind(this));
this._customNodes();
this._isNew();
}.bind(this));
},
_createActions: function(){
this.deleteActionNode = new Element("div", {
"styles": this.explorer.css.deleteActionNode
}).inject(this.node);
this.deleteActionNode.addEvent("click", function(e){
// this.deleteActionNode = new Element("div", {
// "styles": this.explorer.css.deleteActionNode
// }).inject(this.node);
if (this.deleteActionNode) this.deleteActionNode.addEvent("click", function(e){
this.deleteItem(e);
}.bind(this));
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册