WidgetExplorer.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. MWF.xDesktop.requireApp("process.ProcessManager", "Explorer", null, false);
  2. MWF.xApplication.portal.PortalManager.WidgetExplorer = new Class({
  3. Extends: MWF.xApplication.process.ProcessManager.Explorer,
  4. Implements: [Options, Events],
  5. options: {
  6. "style": "default",
  7. "tooltip": {
  8. "create": MWF.xApplication.portal.PortalManager.LP.widget.create,
  9. "search": MWF.xApplication.portal.PortalManager.LP.widget.search,
  10. "searchText": MWF.xApplication.portal.PortalManager.LP.widget.searchText,
  11. "noElement": MWF.xApplication.portal.PortalManager.LP.widget.noNoticeText
  12. }
  13. },
  14. _createElement: function(e){
  15. var _self = this;
  16. var options = {
  17. "style": layout.desktop.pageDesignerStyle || "default",
  18. //"templateId": "page.json",
  19. "onQueryLoad": function(){
  20. this.actions = _self.app.restActions;
  21. this.application = _self.app.options.application;
  22. }
  23. };
  24. this.app.desktop.openApplication(e, "portal.WidgetDesigner", options);
  25. },
  26. _loadItemDataList: function(callback){
  27. this.app.restActions.listWidget(this.app.options.application.id,callback);
  28. },
  29. _getItemObject: function(item){
  30. return new MWF.xApplication.portal.PortalManager.WidgetExplorer.Widget(this, item)
  31. },
  32. deleteItems: function(){
  33. this.hideDeleteAction();
  34. while (this.deleteMarkItems.length){
  35. var item = this.deleteMarkItems.shift();
  36. if (this.deleteMarkItems.length){
  37. item.deleteWidget();
  38. }else{
  39. item.deleteWidget(function(){
  40. // this.reloadItems();
  41. //this.hideDeleteAction();
  42. }.bind(this));
  43. }
  44. }
  45. }
  46. });
  47. MWF.xApplication.portal.PortalManager.WidgetExplorer.Widget= new Class({
  48. Extends: MWF.xApplication.process.ProcessManager.Explorer.Item,
  49. _open: function(e){
  50. var _self = this;
  51. var options = {
  52. "onQueryLoad": function(){
  53. this.actions = _self.explorer.actions;
  54. this.category = _self;
  55. this.options.id = _self.data.id;
  56. this.application = _self.explorer.app.options.application;
  57. }
  58. };
  59. this.explorer.app.desktop.openApplication(e, "portal.WidgetDesigner", options);
  60. },
  61. _getIcon: function(){
  62. var x = (Math.random()*49).toInt();
  63. return "process_icon_"+x+".png";
  64. },
  65. _getLnkPar: function(){
  66. return {
  67. "icon": this.explorer.path+this.explorer.options.style+"/processIcon/lnk.png",
  68. "title": this.data.name,
  69. "par": "portal.WidgetDesigner#{\"id\": \""+this.data.id+"\"}"
  70. };
  71. },
  72. // deleteItem: function(e){
  73. // var _self = this;
  74. // this.explorer.app.confirm("info", e, this.explorer.app.lp.process.deleteProcessTitle, this.explorer.app.lp.process.deleteProcess, 320, 110, function(){
  75. // _self.deleteProcess();
  76. // this.close();
  77. // },function(){
  78. // this.close();
  79. // });
  80. // },
  81. deleteWidget: function(callback){
  82. this.explorer.actions.deleteWidget(this.data.id, function(){
  83. this.node.destroy();
  84. if (callback) callback();
  85. }.bind(this));
  86. }
  87. });