MainInContainer.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. MWF.xApplication.Forum = MWF.xApplication.Forum || {};
  2. MWF.xApplication.Forum.options = MWF.xApplication.Forum.options || {};
  3. MWF.xDesktop.requireApp("Forum", "lp."+MWF.language, null, false) ;
  4. MWF.xDesktop.requireApp("Forum", "Main", null, false);
  5. MWF.xApplication.Forum.MainInContainer = new Class({
  6. Extends: MWF.xApplication.Forum.Main,
  7. Implements: [Options, Events],
  8. options: {
  9. "style": "default",
  10. "name": "Forum",
  11. "naviMode" : false
  12. },
  13. initialize: function(desktop, options, container, content, scrollNode ){
  14. this.setOptions(options);
  15. this.desktop = desktop;
  16. this.container = container;
  17. this.content = content;
  18. this.scrollNode = scrollNode;
  19. this.path = "../x_component_"+this.options.name.replace(/\./g, "_")+"/$Main/";
  20. this.options.icon = this.path+this.options.style+"/"+this.options.icon;
  21. this.cssPath =this.path+this.options.style+"/css.wcss";
  22. this.naviMode = this.options.naviMode;
  23. //this.inBrowser = true;
  24. this.inContainer = true;
  25. this._loadCss();
  26. },
  27. loadNoAnimation: function(isCurrent, max, hide){
  28. this.fireAppEvent("queryLoad");
  29. if (!this.inContainer){
  30. this.loadWindow(isCurrent, false, max, hide);
  31. }else{
  32. this.loadInBrowser(isCurrent);
  33. }
  34. },
  35. load : function(isCurrent){
  36. this.fireAppEvent("queryLoad");
  37. if (!this.inContainer){
  38. this.loadWindow(isCurrent);
  39. }else{
  40. this.loadInBrowser(isCurrent);
  41. }
  42. },
  43. close: function(){
  44. this.fireAppEvent("queryClose");
  45. this.setUncurrent();
  46. if (this.inBrowser){
  47. window.close();
  48. }else{
  49. this.window.close(function(){
  50. this.taskitem.destroy();
  51. delete this.window;
  52. delete this.taskitem;
  53. this.desktop.closeApp(this);
  54. this.fireAppEvent("postClose");
  55. //MWF.recycleCount = 0;
  56. //debugger;
  57. MWF.release(this);
  58. //
  59. //alert(MWF.recycleCount)
  60. //debugger;
  61. }.bind(this));
  62. }
  63. },
  64. loadInBrowser: function(){
  65. this.window = {
  66. "isHide": false,
  67. "isMax": true,
  68. "maxSize": function(){},
  69. "restore": function(){},
  70. "setCurrent": function(){},
  71. "hide": function(){},
  72. "maxOrRestoreSize": function(){},
  73. "restoreSize": function(){},
  74. "close": function(){},
  75. "titleText" : {
  76. set : function(){}
  77. }
  78. };
  79. this.window.content = this.content;
  80. //this.content = this.window.content;
  81. //this.content.setStyles({"height": "100%", "overflow": "hidden"});
  82. //window.addEvent("resize", function(){
  83. // this.fireAppEvent("resize");
  84. //}.bind(this));
  85. //window.onbeforeunload = function(e){
  86. // this.fireAppEvent("queryClose");
  87. //}.bind(this);
  88. this.fireAppEvent("postLoadWindow");
  89. this.fireAppEvent("queryLoadApplication");
  90. this.setContentEvent();
  91. this.loadApplication(function(){
  92. this.fireAppEvent("postLoadApplication");
  93. }.bind(this));
  94. //this.content.setStyle("height", document.body.getSize().y);
  95. this.fireAppEvent("postLoad");
  96. },
  97. createNode: function(){
  98. this.content.setStyle("overflow", "hidden");
  99. this.node = new Element("div.node", {
  100. "styles": {"width": "100%", "height": "100%", "overflow": "hidden"}
  101. }).inject(this.container);
  102. }
  103. });