Main.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. MWF.xDesktop.requireApp("service.ServiceManager", "package", null, false);
  2. MWF.xDesktop.requireApp("Selector", "package", null, false);
  3. MWF.require("MWF.widget.Identity", null,false);
  4. MWF.xApplication.process = MWF.xApplication.process || {};
  5. MWF.xApplication.process.ProcessManager = MWF.xApplication.process.ProcessManager || {};
  6. MWF.xDesktop.requireApp("process.ProcessManager", "", null, false);
  7. MWF.xApplication.service = MWF.xApplication.service || {};
  8. MWF.xApplication.service.ServiceManager.Main = new Class({
  9. Extends: MWF.xApplication.process.ProcessManager.Main,
  10. Implements: [Options, Events],
  11. options: {
  12. "style": "default",
  13. "name": "service.ServiceManager",
  14. "icon": "icon.png",
  15. "width": "1100",
  16. "height": "700",
  17. "title": MWF.xApplication.service.ServiceManager.LP.title
  18. },
  19. onQueryLoad: function(){
  20. this.lp = MWF.xApplication.service.ServiceManager.LP;
  21. this.currentContentNode = null;
  22. this.restActions = MWF.Actions.get("x_program_center");
  23. },
  24. loadApplication: function(callback){
  25. this.createNode();
  26. this.loadApplicationContent();
  27. if (callback) callback();
  28. },
  29. loadStartMenu: function(callback){
  30. this.startMenuNode = new Element("div", {
  31. "styles": this.css.startMenuNode
  32. }).inject(this.node);
  33. this.menu = new MWF.xApplication.service.ServiceManager.Menu(this, this.startMenuNode, {
  34. "onPostLoad": function(){
  35. if (this.status){
  36. if (this.status.navi!=null){
  37. this.menu.doAction(this.menu.startNavis[this.status.navi]);
  38. }else{
  39. this.menu.doAction(this.menu.startNavis[0]);
  40. }
  41. }else{
  42. this.menu.doAction(this.menu.startNavis[0]);
  43. }
  44. }.bind(this)
  45. });
  46. this.addEvent("resize", function(){
  47. if (this.menu) this.menu.onResize();
  48. }.bind(this));
  49. },
  50. clearContent: function(){
  51. if (this.agentConfiguratorContent){
  52. if (this.agentConfigurator) delete this.agentConfigurator;
  53. this.agentConfiguratorContent.destroy();
  54. this.agentConfiguratorContent = null;
  55. }
  56. if (this.invokeConfiguratorContent){
  57. if (this.invokeConfigurator) delete this.invokeConfigurator;
  58. this.invokeConfiguratorContent.destroy();
  59. this.invokeConfiguratorContent = null;
  60. }
  61. },
  62. selectConfig: function(){
  63. this.clearContent();
  64. this.selectConfiguratorContent = new Element("div", {
  65. "styles": this.css.rightContentNode
  66. }).inject(this.node);
  67. this.loadSelectConfig();
  68. },
  69. loadSelectConfig: function(){
  70. MWF.xDesktop.requireApp("service.ServiceManager", "SelectExplorer", function(){
  71. this.selectConfigurator = new MWF.xApplication.service.ServiceManager.SelectExplorer(this.selectConfiguratorContent, this.restActions);
  72. this.selectConfigurator.app = this;
  73. this.selectConfigurator.load();
  74. }.bind(this));
  75. },
  76. agentConfig: function(){
  77. this.clearContent();
  78. this.agentConfiguratorContent = new Element("div", {
  79. "styles": this.css.rightContentNode
  80. }).inject(this.node);
  81. this.loadAgentConfig();
  82. },
  83. loadAgentConfig: function(){
  84. MWF.xDesktop.requireApp("service.ServiceManager", "AgentExplorer", function(){
  85. this.agentConfigurator = new MWF.xApplication.service.ServiceManager.AgentExplorer(this.agentConfiguratorContent, this.restActions);
  86. this.agentConfigurator.app = this;
  87. this.agentConfigurator.load();
  88. }.bind(this));
  89. },
  90. invokeConfig: function(){
  91. this.clearContent();
  92. this.invokeConfiguratorContent = new Element("div", {
  93. "styles": this.css.rightContentNode
  94. }).inject(this.node);
  95. this.loadInvokeConfig();
  96. },
  97. loadInvokeConfig: function(){
  98. MWF.xDesktop.requireApp("service.ServiceManager", "InvokeExplorer", function(){
  99. this.invokeConfigurator = new MWF.xApplication.service.ServiceManager.InvokeExplorer(this.invokeConfiguratorContent, this.restActions);
  100. this.invokeConfigurator.app = this;
  101. this.invokeConfigurator.load();
  102. }.bind(this));
  103. },
  104. recordStatus: function(){
  105. var idx = null;
  106. if (this.menu.currentNavi){
  107. idx = this.menu.startNavis.indexOf(this.menu.currentNavi);
  108. }
  109. return {"navi": idx};
  110. }
  111. });
  112. MWF.xApplication.service.ServiceManager.Menu = new Class({
  113. Extends: MWF.xApplication.process.ProcessManager.Menu,
  114. Implements: [Options, Events]
  115. });