RecycleBinExplorer.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. //MWF.xDesktop.requireApp("Minder", "Actions.RestActions", null, false);
  2. MWF.xDesktop.requireApp("Template", "Explorer", null, false);
  3. MWF.xDesktop.requireApp("Template", "MForm", null, false);
  4. MWF.xDesktop.requireApp("Minder", "Common", null, false);
  5. MWF.xApplication.Minder.RecycleBinExplorer = new Class({
  6. Extends: MWF.widget.Common,
  7. Implements: [Options, Events],
  8. options: {
  9. "style": "default",
  10. "defaultTreeNode" : "root",
  11. "defaultViewType" : "list"
  12. },
  13. initialize: function(node, app, options){
  14. this.setOptions(options);
  15. this.path = "../x_component_Minder/$MineExplorer/";
  16. this.cssPath = "../x_component_Minder/$MineExplorer/"+this.options.style+"/css.wcss";
  17. this._loadCss();
  18. this.app = app;
  19. this.container = $(node);
  20. },
  21. load : function(){
  22. this.rightNode = new Element("div.rightNode",{
  23. "styles" : this.css.rightNode
  24. }).inject(this.container);
  25. //this.historyContentNode = new Element("div",{
  26. // "styles" : this.css.historyContentNode
  27. //}).inject(this.rightNode);
  28. //this.app.histroy.load( this.historyContentNode );
  29. this.toolbarNode = new Element("div",{
  30. "styles" : this.css.toolbarNode
  31. }).inject(this.rightNode);
  32. this.toolbar = new MWF.xApplication.Minder.Toolbar(this.toolbarNode, this, {
  33. "availableTool" : [
  34. ["destroyFromRecycle"],
  35. //["import", "export"],
  36. ["restore"]
  37. ],
  38. viewType : this.options.defaultViewType
  39. });
  40. this.toolbar.load();
  41. this.listNode = new Element("div",{
  42. "styles" : this.css.listNode
  43. }).inject(this.rightNode);
  44. this.loadList({});
  45. this.resizeContent();
  46. this.resizeFun = this.resizeContent.bind(this);
  47. this.app.addEvent("resize", this.resizeFun);
  48. },
  49. destroy : function(){
  50. this.container.empty();
  51. this.app.removeEvent("resize", this.resizeFun);
  52. },
  53. resizeContent : function(){
  54. var size = this.app.content.getSize();
  55. this.rightNode.setStyle("width", size.x - 70 );
  56. this.listNode.setStyle("height", size.y - 92 );
  57. this.listNode.setStyle("width", size.x - 113 );
  58. this.toolbarNode.setStyle("width", size.x - 70 );
  59. },
  60. loadList: function( filterData ){
  61. if (this.currentView) this.currentView.destroy();
  62. this.currentView = new MWF.xApplication.Minder.RecycleBinExplorer.List( this.listNode, this.app, this, {
  63. templateUrl : this.path + this.options.style + ( this.getViewType() == "list" ? "/listItem_recycle.json" : "/tileItem_recycle.json" ),
  64. "scrollEnable" : true
  65. });
  66. this.currentView.viewType = this.getViewType();
  67. this.currentView.filterData = filterData;
  68. this.currentView.load();
  69. },
  70. getViewType : function(){
  71. return this.toolbar.getListType();
  72. },
  73. getCurrentFolderId : function(){
  74. return this.tree.getCurrentFolderId();
  75. },
  76. recordStatus : function(){
  77. return {
  78. defaultViewType : this.getViewType()
  79. }
  80. }
  81. });
  82. MWF.xApplication.Minder.RecycleBinExplorer.List = new Class({
  83. Extends: MWF.xApplication.Minder.List,
  84. options : {
  85. "scrollEnable" : true,
  86. "scrollType" : "window"
  87. },
  88. _createDocument: function(data, index){
  89. return new MWF.xApplication.Minder.Document(this.viewNode, data, this.explorer, this, null, index);
  90. },
  91. _getCurrentPageData: function(callback, count){
  92. if(!count)count=30;
  93. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  94. var filter = this.filterData || {};
  95. if( this.sortType && this.sortField ){
  96. filter.orderField = this.sortField;
  97. filter.orderType = this.sortType;
  98. }
  99. //{"name":"","folderId":"root","description":"","creator":"","creatorUnit":"","shared":"","orderField":"","orderType":""}//
  100. this.actions.listMyRecycledMind(id, count, filter, function(json){
  101. if( !json.data )json.data = [];
  102. if (callback)callback(json);
  103. });
  104. },
  105. _openDocument: function( documentData,index ){
  106. }
  107. });