- FlowManagerView:[
- __ctxPath+'/js/flow/ProTypeForm.js',
- __ctxPath+'/js/flow/ProDefinitionForm.js',
- __ctxPath+'/js/flow/ProDefinitionView.js',
- __ctxPath+'/js/flow/FlowManagerView.js',
- __ctxPath+'/js/flow/ProDefinitionDetail.js',
- __ctxPath+'/js/flow/ProcessRunStart.js',
- __ctxPath+'/js/flow/ProDefinitionSetting.js',
- __ctxPath+'/js/flow/MyTaskView.js',
- __ctxPath+'/js/flow/ProcessNextForm.js',
- __ctxPath+'/js/flow/FormDesignWindow.js',
- __ctxPath+'/js/flow/FormEditorWindow.js',
- __ctxPath+'/js/flowDesign/FlowDesignerWindow.js'
- ]
- function $ImportJs(viewName,callback,params) {
- var b = jsCache[viewName];
- if (b != null) {
- var view =newView(viewName,params);
- callback.call(this, view);
- } else {
- var jsArr = eval('App.importJs.' + viewName);
- if(jsArr==undefined || jsArr.length==0){
- try{
- var view = newView(viewName,params);
- callback.call(this, view);
- }catch(e){
- }
- return ;
- }
- ScriptMgr.load({
- scripts : jsArr,
- callback : function() {
- jsCache[viewName]=0;
- var view = newView(viewName,params);
- callback.call(this, view);
- }
- });
- }
- }
- $ImportJs('FlowManagerView',function(){
- return new FlowManagerView();
- });
- ScriptLoaderMgr = function() {
- this.loader = new ScriptLoader();
- this.load = function(o) {
- if (!Ext.isArray(o.scripts)) {
- o.scripts = [o.scripts];
- }
- o.url = o.scripts.shift();
- if (o.scripts.length == 0) {
- this.loader.load(o);
- } else {
- o.scope = this;
- this.loader.load(o, function() {
- this.load(o);
- }); [size=medium][/size]
- }
- };
- };
- /**
- * 用于动态加载js
- * sample is here
- * ScriptMgr.load({
- * scripts: ['/js/other-prerequisite.js', '/js/other.js'],
- * callback: function() {
- * var other = new OtherObject();
- * alert(other); //just loaded
- * }
- * });
- */
- ScriptLoader = function() {
- this.timeout = 10;
- this.scripts = [];
- this.disableCaching = true;//false
- this.loadMask = null;
- };
- ScriptLoader.prototype = {
- showMask : function() {
- if (!this.loadMask) {
- this.loadMask = new Ext.LoadMask(Ext.getBody());
- this.loadMask.show();
- }
- },
- hideMask : function() {
- if (this.loadMask) {
- this.loadMask.hide();
- this.loadMask = null;
- }
- },
- processSuccess : function(response) {
- this.scripts[response.argument.url] = true;
- window.execScript ? window.execScript(response.responseText) : window
- .eval(response.responseText);
- //if (response.argument.options.scripts.length == 0) {
- this.hideMask();
- //}
- if (typeof response.argument.callback == 'function') {
- response.argument.callback.call(response.argument.scope);
- }
- },
- processFailure : function(response) {
- this.hideMask();
- Ext.MessageBox.show({
- title : '应用程序出错',
- msg : 'Js脚本库加载出错,服务器可能停止,请联系管理员。',
- closable : false,
- icon : Ext.MessageBox.ERROR,
- minWidth : 200
- });
- setTimeout(function() {Ext.MessageBox.hide();}, 3000);
- },
- load : function(url, callback) {
- var cfg, callerScope;
- if (typeof url == 'object') { // must be config object
- cfg = url;
- url = cfg.url;
- callback = callback || cfg.callback;
- callerScope = cfg.scope;
- if (typeof cfg.timeout != 'undefined') {
- this.timeout = cfg.timeout;
- }
- if (typeof cfg.disableCaching != 'undefined') {
- this.disableCaching = cfg.disableCaching;
- }
- }
- if (this.scripts[url]) {
- if (typeof callback == 'function') {
- callback.call(callerScope || window);
- }
- return null;
- }
- this.showMask();
- //alert('load now?');
- Ext.Ajax.request({
- url : url,
- success : this.processSuccess,
- failure : this.processFailure,
- scope : this,
- timeout : (this.timeout * 1000),
- disableCaching : this.disableCaching,
- argument : {
- 'url' : url,
- 'scope' : callerScope || window,
- 'callback' : callback,
- 'options' : cfg
- }
- });
- }
- };
- ScriptLoaderMgr = function() {
- this.loader = new ScriptLoader();
- this.load = function(o) {
- if (!Ext.isArray(o.scripts)) {
- o.scripts = [o.scripts];
- }
- //记数器
- o.lfiles=0;
- for(var i=0;i<o.scripts.length;i++){
- o.url = o.scripts[i];
- o.scope = this;
- this.loader.load(o, function() {
- o.lfiles++;
- if(o.lfiles==o.scripts.length){
- if(o.callback!=null){
- this.loader.hideMask();
- o.callback.call(this);
- }
- }
- });
- }
- };
- };