diff --git a/o2web/source/index.html b/o2web/source/index.html index 6fc9508c855834a4e21fc1d0f0acc45d6924298f..d09c643f2f29aa052d19e62cd3dfd5cc6cfb55a2 100644 --- a/o2web/source/index.html +++ b/o2web/source/index.html @@ -2,10 +2,8 @@ - + - -121 - - + + \ No newline at end of file diff --git a/o2web/source/o2_core/o2.js b/o2web/source/o2_core/o2.js index 3010cfb0c2fdc1d7c120d55a66c62b96e56bc887..d7ba3e0219c2ce96cfa99252c2a15ff72e1bc1ed 100644 --- a/o2web/source/o2_core/o2.js +++ b/o2web/source/o2_core/o2.js @@ -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 - + diff --git a/o2web/source/x_component_portal_PageDesigner/$Main/default/pageToolbars.html b/o2web/source/x_component_portal_PageDesigner/$Main/default/pageToolbars.html index 158d0eda78c91821756bda7712c88baeca6a1435..e906d80083ee320548b86e3e0efe23ab291f4167 100644 --- a/o2web/source/x_component_portal_PageDesigner/$Main/default/pageToolbars.html +++ b/o2web/source/x_component_portal_PageDesigner/$Main/default/pageToolbars.html @@ -13,7 +13,7 @@ - + diff --git a/o2web/source/x_component_process_FormDesigner/$Main/bottom/formToolbars.html b/o2web/source/x_component_process_FormDesigner/$Main/bottom/formToolbars.html index b20ffe60c37bcb2d350a201b067f06ef869bbadb..aac422686294dccf69e6cea368e5df21cfe4e88f 100644 --- a/o2web/source/x_component_process_FormDesigner/$Main/bottom/formToolbars.html +++ b/o2web/source/x_component_process_FormDesigner/$Main/bottom/formToolbars.html @@ -11,7 +11,7 @@ - + diff --git a/o2web/source/x_component_process_FormDesigner/$Main/default/formToolbars.html b/o2web/source/x_component_process_FormDesigner/$Main/default/formToolbars.html index a339d3dba1709198c3ba0f0c163672f4bc13f644..8802c0473a8c2f9c8f60062632b3d730c7f2bc60 100644 --- a/o2web/source/x_component_process_FormDesigner/$Main/default/formToolbars.html +++ b/o2web/source/x_component_process_FormDesigner/$Main/default/formToolbars.html @@ -13,7 +13,7 @@ - + diff --git a/o2web/source/x_component_process_ProcessManager/$DictionaryExplorer/default/file.css b/o2web/source/x_component_process_ProcessManager/$DictionaryExplorer/default/file.css new file mode 100644 index 0000000000000000000000000000000000000000..81d712fc06f1dbbc5d848426640d930e5d39f438 --- /dev/null +++ b/o2web/source/x_component_process_ProcessManager/$DictionaryExplorer/default/file.css @@ -0,0 +1,71 @@ +.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 diff --git a/o2web/source/x_component_process_ProcessManager/$DictionaryExplorer/default/file.html b/o2web/source/x_component_process_ProcessManager/$DictionaryExplorer/default/file.html new file mode 100644 index 0000000000000000000000000000000000000000..938fb8f43bbb2a9fbfbd20b4fea1617ee71cebc5 --- /dev/null +++ b/o2web/source/x_component_process_ProcessManager/$DictionaryExplorer/default/file.html @@ -0,0 +1,12 @@ + +
+
+
+
+
text{$.name}
+
text{$.alias}
+
text{$.updateTime}
+
+
text{$.description}
+
+ \ No newline at end of file diff --git a/o2web/source/x_component_process_ProcessManager/FileExplorer.js b/o2web/source/x_component_process_ProcessManager/FileExplorer.js index f5aca219153c1358be99e116df5b39d6ff99fece..9d77947b579667ce495be5e07ad76b9c782a1b7a 100644 --- a/o2web/source/x_component_process_ProcessManager/FileExplorer.js +++ b/o2web/source/x_component_process_ProcessManager/FileExplorer.js @@ -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)); },