ScriptExplorer.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. MWF.xDesktop.requireApp("process.ProcessManager", "DictionaryExplorer", null, false);
  2. MWF.xApplication.process.ProcessManager.ScriptExplorer = new Class({
  3. Extends: MWF.xApplication.process.ProcessManager.DictionaryExplorer,
  4. Implements: [Options, Events],
  5. options: {
  6. "create": MWF.APPPM.LP.dictionary.create,
  7. "search": MWF.APPPM.LP.dictionary.search,
  8. "searchText": MWF.APPPM.LP.dictionary.searchText,
  9. "noElement": MWF.APPPM.LP.dictionary.noDictionaryNoticeText
  10. },
  11. _createElement: function(e){
  12. var _self = this;
  13. var options = {
  14. "onQueryLoad": function(){
  15. this.actions = _self.app.restActions;
  16. this.application = _self.app.options.application || _self.app.application;
  17. this.explorer = _self;
  18. }
  19. };
  20. this.app.desktop.openApplication(e, "process.ScriptDesigner", options);
  21. },
  22. _loadItemDataList: function(callback){
  23. var id = "";
  24. if (this.app.application) id = this.app.application.id;
  25. if (this.app.options.application) id = this.app.options.application.id;
  26. this.actions.listScript(id,callback);
  27. },
  28. _getItemObject: function(item){
  29. return new MWF.xApplication.process.ProcessManager.ScriptExplorer.Script(this, item)
  30. },
  31. setTooltip: function(){
  32. this.options.tooltip = {
  33. "create": MWF.APPPM.LP.script.create,
  34. "search": MWF.APPPM.LP.script.search,
  35. "searchText": MWF.APPPM.LP.script.searchText,
  36. "noElement": MWF.APPPM.LP.script.noScriptNoticeText
  37. };
  38. },
  39. deleteItems: function(){
  40. this.hideDeleteAction();
  41. while (this.deleteMarkItems.length){
  42. var item = this.deleteMarkItems.shift();
  43. if (this.deleteMarkItems.length){
  44. item.deleteScript();
  45. }else{
  46. item.deleteScript(function(){
  47. // this.reloadItems();
  48. // this.hideDeleteAction();
  49. }.bind(this));
  50. }
  51. }
  52. }
  53. });
  54. MWF.xApplication.process.ProcessManager.ScriptExplorer.Script = new Class({
  55. Extends: MWF.xApplication.process.ProcessManager.DictionaryExplorer.Dictionary,
  56. _customNodes: function(){
  57. if (!this.data.validated){
  58. new Element("div", {"styles": this.explorer.css.itemErrorNode}).inject(this.node);
  59. this.node.setStyle("background-color", "#f9e8e8");
  60. }
  61. },
  62. _open: function(e){
  63. var _self = this;
  64. var options = {
  65. "onQueryLoad": function(){
  66. this.actions = _self.explorer.actions;
  67. this.category = _self;
  68. this.options.id = _self.data.id;
  69. this.application = _self.explorer.app.options.application;
  70. this.explorer = _self.explorer
  71. }
  72. };
  73. this.explorer.app.desktop.openApplication(e, "process.ScriptDesigner", options);
  74. },
  75. _getIcon: function(){
  76. //var x = (Math.random()*33).toInt();
  77. //return "process_icon_"+x+".png";
  78. return "script.png";
  79. },
  80. _getLnkPar: function(){
  81. return {
  82. "icon": this.explorer.path+this.explorer.options.style+"/scriptIcon/lnk.png",
  83. "title": this.data.name,
  84. "par": "process.ScriptDesigner#{\"id\": \""+this.data.id+"\", \"applicationId\": \""+this.explorer.app.options.application.id+"\"}"
  85. };
  86. },
  87. // deleteItem: function(e){
  88. // var _self = this;
  89. // this.explorer.app.confirm("info", e, this.explorer.app.lp.form.deleteFormTitle, this.explorer.app.lp.form.deleteForm, 320, 110, function(){
  90. // _self.deleteForm();
  91. // this.close();
  92. // },function(){
  93. // this.close();
  94. // });
  95. // },
  96. deleteScript: function(callback){
  97. this.explorer.app.restActions.deleteScript(this.data.id, function(){
  98. this.node.destroy();
  99. if (callback) callback();
  100. }.bind(this));
  101. }
  102. });