QueryViewExplorer.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. MWF.xDesktop.requireApp("cms.ColumnManager", "Explorer", null, false);
  2. MWF.xApplication.cms.ColumnManager.QueryViewExplorer = new Class({
  3. Extends: MWF.xApplication.cms.ColumnManager.Explorer,
  4. Implements: [Options, Events],
  5. options: {
  6. "create": MWF.CMSCM.LP.queryView.create,
  7. "search": MWF.CMSCM.LP.queryView.search,
  8. "searchText": MWF.CMSCM.LP.queryView.searchText,
  9. "noElement": MWF.CMSCM.LP.queryView.noViewNoticeText
  10. },
  11. setTooltip: function(){
  12. this.options.tooltip = {
  13. "create": MWF.CMSCM.LP.queryView.create,
  14. "search": MWF.CMSCM.LP.queryView.search,
  15. "searchText": MWF.CMSCM.LP.queryView.searchText,
  16. "noElement": MWF.CMSCM.LP.queryView.noViewNoticeText
  17. };
  18. },
  19. _createElement: function(e){
  20. var _self = this;
  21. var options = {
  22. "onQueryLoad": function(){
  23. this.actions = _self.app.restActions;
  24. this.application = _self.app.options.application;
  25. this.explorer = _self;
  26. },
  27. "onPostSave" : function(){
  28. _self.reload();
  29. }
  30. };
  31. this.app.desktop.openApplication(e, "cms.QueryViewDesigner", options);
  32. },
  33. _loadItemDataList: function(callback){
  34. this.app.restActions.listQueryView(this.app.options.application.id,callback);
  35. },
  36. _getItemObject: function(item, index){
  37. return new MWF.xApplication.cms.ColumnManager.QueryViewExplorer.View(this, item, {index : index})
  38. },
  39. deleteItems: function(){
  40. while (this.deleteMarkItems.length){
  41. var item = this.deleteMarkItems.shift();
  42. if (this.deleteMarkItems.length){
  43. item.deleteView();
  44. }else{
  45. item.deleteView(function(){
  46. // this.reloadItems();
  47. this.hideDeleteAction();
  48. this.reload();
  49. }.bind(this));
  50. }
  51. }
  52. }
  53. });
  54. MWF.xApplication.cms.ColumnManager.QueryViewExplorer.View = new Class({
  55. Extends: MWF.xApplication.cms.ColumnManager.Explorer.Item,
  56. _open: function(e){
  57. var _self = this;
  58. var options = {
  59. "appId": "cms.QueryViewDesigner"+_self.data.id,
  60. "id": _self.data.id,
  61. "application": _self.explorer.app.options.column.id,
  62. "onQueryLoad": function(){
  63. this.actions = _self.explorer.actions;
  64. this.category = _self;
  65. this.options.id = _self.data.id;
  66. this.application = _self.explorer.app.options.application;
  67. this.explorer = _self.explorer;
  68. }
  69. };
  70. this.explorer.app.desktop.openApplication(e, "cms.QueryViewDesigner", options);
  71. //layout.desktop.getFormDesignerStyle(function(){
  72. // var _self = this;
  73. // var options = {
  74. // "style": layout.desktop.formDesignerStyle,
  75. // "onQueryLoad": function(){
  76. // this.actions = _self.explorer.actions;
  77. // this.category = _self;
  78. // this.options.id = _self.data.id;
  79. // this.application = _self.explorer.app.options.application;
  80. // }
  81. // };
  82. // this.explorer.app.desktop.openApplication(e, "process.FormDesigner", options);
  83. //}.bind(this));
  84. },
  85. _getIcon: function(){
  86. var x = (Math.random()*33).toInt();
  87. return "process_icon_"+x+".png";
  88. },
  89. _getLnkPar: function(){
  90. return {
  91. "icon": this.explorer.path+this.explorer.options.style+"/queryViewIcon/lnk.png",
  92. "title": this.data.name,
  93. "par": "cms.QueryViewDesigner#{\"id\": \""+this.data.id+"\", \"application\": "+JSON.stringify( this.explorer.app.options.application )+"}"
  94. };
  95. },
  96. // deleteItem: function(e){
  97. // var _self = this;
  98. // this.explorer.app.confirm("info", e, this.explorer.app.lp.form.deleteFormTitle, this.explorer.app.lp.form.deleteForm, 320, 110, function(){
  99. // _self.deleteForm();
  100. // this.close();
  101. // },function(){
  102. // this.close();
  103. // });
  104. // },
  105. deleteView: function(callback){
  106. this.explorer.app.restActions.deleteQueryView(this.data.id, function(){
  107. this.node.destroy();
  108. if (callback) callback();
  109. }.bind(this));
  110. }
  111. });