123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- MWF.xDesktop.requireApp("service.ServiceManager", "package", null, false);
- MWF.xDesktop.requireApp("Selector", "package", null, false);
- MWF.require("MWF.widget.Identity", null,false);
- MWF.xApplication.process = MWF.xApplication.process || {};
- MWF.xApplication.process.ProcessManager = MWF.xApplication.process.ProcessManager || {};
- MWF.xDesktop.requireApp("process.ProcessManager", "", null, false);
- MWF.xApplication.service = MWF.xApplication.service || {};
- MWF.xApplication.service.ServiceManager.Main = new Class({
- Extends: MWF.xApplication.process.ProcessManager.Main,
- Implements: [Options, Events],
- options: {
- "style": "default",
- "name": "service.ServiceManager",
- "icon": "icon.png",
- "width": "1100",
- "height": "700",
- "title": MWF.xApplication.service.ServiceManager.LP.title
- },
- onQueryLoad: function(){
- this.lp = MWF.xApplication.service.ServiceManager.LP;
- this.currentContentNode = null;
- this.restActions = MWF.Actions.get("x_program_center");
- },
- loadApplication: function(callback){
- this.createNode();
- this.loadApplicationContent();
- if (window.clipboardData){
- this.addKeyboardEvents();
- }else{
- this.keyCopyItemsFun = this.keyCopyItems.bind(this);
- this.keyPasteItemsFun = this.keyPasteItems.bind(this);
- document.addEventListener('copy', this.keyCopyItemsFun);
- document.addEventListener('paste', this.keyPasteItemsFun);
- this.addEvent("queryClose", function(){
- if (this.keyCopyItemsFun) document.removeEventListener('copy', this.keyCopyItemsFun);
- if (this.keyPasteItemsFun) document.removeEventListener('paste', this.keyPasteItemsFun);
- }.bind(this));
- }
- if (callback) callback();
- },
- loadStartMenu: function(callback){
- this.startMenuNode = new Element("div", {
- "styles": this.css.startMenuNode
- }).inject(this.node);
- this.menu = new MWF.xApplication.service.ServiceManager.Menu(this, this.startMenuNode, {
- "onPostLoad": function(){
- if (this.status){
- if (this.status.navi!=null){
- this.menu.doAction(this.menu.startNavis[this.status.navi]);
- }else{
- this.menu.doAction(this.menu.startNavis[0]);
- }
- }else{
- this.menu.doAction(this.menu.startNavis[0]);
- }
- }.bind(this)
- });
- this.addEvent("resize", function(){
- if (this.menu) this.menu.onResize();
- }.bind(this));
- },
- clearContent: function(){
- if (this.agentConfiguratorContent){
- if (this.agentConfigurator) delete this.agentConfigurator;
- this.agentConfiguratorContent.destroy();
- this.agentConfiguratorContent = null;
- }
- if (this.invokeConfiguratorContent){
- if (this.invokeConfigurator) delete this.invokeConfigurator;
- this.invokeConfiguratorContent.destroy();
- this.invokeConfiguratorContent = null;
- }
- if (this.scriptConfiguratorContent){
- if (this.scriptConfigurator) delete this.scriptConfigurator;
- this.scriptConfiguratorContent.destroy();
- this.scriptConfiguratorContent = null;
- }
- if (this.dictionaryConfiguratorContent){
- if (this.dictionaryConfigurator) delete this.dictionaryConfigurator;
- this.dictionaryConfiguratorContent.destroy();
- this.dictionaryConfiguratorContent = null;
- }
- },
- selectConfig: function(){
- this.clearContent();
- this.selectConfiguratorContent = new Element("div", {
- "styles": this.css.rightContentNode
- }).inject(this.node);
- this.loadSelectConfig();
- },
- loadSelectConfig: function(){
- MWF.xDesktop.requireApp("service.ServiceManager", "SelectExplorer", function(){
- this.selectConfigurator = new MWF.xApplication.service.ServiceManager.SelectExplorer(this.selectConfiguratorContent, this.restActions);
- this.selectConfigurator.app = this;
- this.selectConfigurator.load();
- }.bind(this));
- },
- agentConfig: function(){
- this.clearContent();
- this.agentConfiguratorContent = new Element("div", {
- "styles": this.css.rightContentNode
- }).inject(this.node);
- this.loadAgentConfig();
- },
- loadAgentConfig: function(){
- MWF.xDesktop.requireApp("service.ServiceManager", "AgentExplorer", function(){
- this.agentConfigurator = new MWF.xApplication.service.ServiceManager.AgentExplorer(this.agentConfiguratorContent, this.restActions);
- this.agentConfigurator.app = this;
- this.agentConfigurator.load();
- }.bind(this));
- },
- invokeConfig: function(){
- this.clearContent();
- this.invokeConfiguratorContent = new Element("div", {
- "styles": this.css.rightContentNode
- }).inject(this.node);
- this.loadInvokeConfig();
- },
- loadInvokeConfig: function(){
- MWF.xDesktop.requireApp("service.ServiceManager", "InvokeExplorer", function(){
- this.invokeConfigurator = new MWF.xApplication.service.ServiceManager.InvokeExplorer(this.invokeConfiguratorContent, this.restActions);
- this.invokeConfigurator.app = this;
- this.invokeConfigurator.load();
- }.bind(this));
- },
- scriptConfig: function(){
- this.clearContent();
- this.scriptConfiguratorContent = new Element("div", {
- "styles": this.css.rightContentNode
- }).inject(this.node);
- this.loadScriptConfig();
- },
- loadScriptConfig: function(){
- MWF.xDesktop.requireApp("service.ServiceManager", "ScriptExplorer", function(){
- this.scriptConfigurator = new MWF.xApplication.service.ServiceManager.ScriptExplorer(this.scriptConfiguratorContent, this.restActions);
- this.scriptConfigurator.app = this;
- this.scriptConfigurator.load();
- }.bind(this));
- },
- dataConfig: function(){
- this.clearContent();
- this.dictionaryConfiguratorContent = new Element("div", {
- "styles": this.css.rightContentNode
- }).inject(this.node);
- this.loadDataConfig();
- },
- loadDataConfig: function(){
- MWF.xDesktop.requireApp("service.ServiceManager", "DictionaryExplorer", function(){
- this.dictionaryConfigurator = new MWF.xApplication.service.ServiceManager.DictionaryExplorer(this.dictionaryConfiguratorContent, this.restActions);
- this.dictionaryConfigurator.app = this;
- this.dictionaryConfigurator.load();
- }.bind(this));
- },
- recordStatus: function(){
- var idx = null;
- if (this.menu.currentNavi){
- idx = this.menu.startNavis.indexOf(this.menu.currentNavi);
- }
- return {"navi": idx};
- },
- addKeyboardEvents: function(){
- this.addEvent("copy", function(){
- this.keyCopyItems();
- }.bind(this));
- this.addEvent("paste", function(){
- this.keyPasteItems();
- }.bind(this));
- },
- keyCopyItems: function(e){
- if (layout.desktop.currentApp && layout.desktop.currentApp.appId===this.appId){
- if (this.agentConfigurator){
- this.agentConfigurator.keyCopy(e);
- if (e) e.preventDefault();
- }
- if (this.invokeConfigurator){
- this.invokeConfigurator.keyCopy(e);
- if (e) e.preventDefault();
- }
- if (this.scriptConfigurator){
- this.scriptConfigurator.keyCopy(e);
- if (e) e.preventDefault();
- }
- if (this.dictionaryConfigurator){
- this.dictionaryConfigurator.keyCopy(e);
- if (e) e.preventDefault();
- }
- }
- },
- keyPasteItems: function(e){
- if (layout.desktop.currentApp && layout.desktop.currentApp.appId===this.appId) {
- if (this.agentConfigurator){
- this.agentConfigurator.keyPaste(e);
- }
- if (this.invokeConfigurator){
- this.invokeConfigurator.keyPaste(e);
- }
- if (this.scriptConfigurator){
- this.scriptConfigurator.keyPaste(e);
- }
- if (this.dictionaryConfigurator){
- this.dictionaryConfigurator.keyPaste(e);
- }
- }
- //if (e) e.preventDefault();
- }
- });
- MWF.xApplication.service.ServiceManager.Menu = new Class({
- Extends: MWF.xApplication.process.ProcessManager.Menu,
- Implements: [Options, Events]
- });
|