Main.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. MWF.xApplication.Homepage.options.multitask = false;
  2. o2.requireApp("Homepage", "TaskContent", null, false);
  3. MWF.xApplication.Homepage.Main = new Class({
  4. Extends: MWF.xApplication.Common.Main,
  5. Implements: [Options, Events],
  6. options: {
  7. "style1": "default",
  8. "style": "default",
  9. "mvcStyle": "style.css",
  10. "name": "Homepage",
  11. "icon": "icon.png",
  12. "width": "1200",
  13. "height": "800",
  14. "isResize": true,
  15. "isMax": true,
  16. "title": MWF.xApplication.Homepage.LP.title,
  17. "minHeight": 700
  18. },
  19. onQueryLoad: function(){
  20. this.lp = MWF.xApplication.Homepage.LP;
  21. this.viewPath = this.path+this.options.style+"/view.html";
  22. },
  23. loadApplication: function(callback){
  24. this.content.loadHtml(this.viewPath, {"bind": {"lp": this.lp}, "module": this}, function(){
  25. if (!this.options.isRefresh){
  26. this.maxSize(function(){
  27. this.loadApp(callback);
  28. }.bind(this));
  29. }else{
  30. this.loadApp(callback);
  31. }
  32. }.bind(this));
  33. },
  34. loadApp: function(callback){
  35. //this.initNode();
  36. this.initNodeSize();
  37. this.taskLoaded = false;
  38. this.inforLoaded = false;
  39. this.meetingLoaded = false;
  40. this.fileLoaded = false;
  41. this.calenderLoaded = false;
  42. this.loadTaskContent(function(){ this.taskLoaded = true; this.checkAppLoaded(callback); }.bind(this));
  43. this.loadInforContent(function(){ this.inforLoaded = true; this.checkAppLoaded(callback); }.bind(this));
  44. this.loadMeetingContent(function(){ this.meetingLoaded = true; this.checkAppLoaded(callback); }.bind(this));
  45. this.loadFileContent(function(){ this.fileLoaded = true; this.checkAppLoaded(callback); }.bind(this));
  46. this.loadCalendarContent(function(){ this.calenderLoaded = true; this.checkAppLoaded(callback); }.bind(this));
  47. },
  48. checkAppLoaded: function(callback){
  49. if (this.taskLoaded && this.inforLoaded && this.meetingLoaded && this.fileLoaded && this.calenderLoaded){
  50. if (callback) callback();
  51. }
  52. },
  53. // initNode: function(){
  54. // this.node = this.content.getElement(".o2_homepage_content");
  55. // this.calendarContentNode = this.content.getElement(".o2_homepage_calendar_content");
  56. // this.taskContentNode = this.content.getElement(".o2_homepage_task_content");
  57. // this.meetingContentNode = this.content.getElement(".o2_homepage_meeting_content");
  58. // this.inforContentNode = this.content.getElement(".o2_homepage_infor_content");
  59. // this.fileContentNode = this.content.getElement(".o2_homepage_file_content");
  60. //
  61. // this.rightLayout = this.content.getElement(".o2_homepage_layout_right");
  62. // this.ltlLayout = this.content.getElement(".o2_homepage_layout_leftTopLeft");
  63. // this.ltrLayout = this.content.getElement(".o2_homepage_layout_leftTopRight");
  64. // this.lblLayout = this.content.getElement(".o2_homepage_layout_leftBottomLeft");
  65. // this.lbrLayout = this.content.getElement(".o2_homepage_layout_leftBottomRight");
  66. // },
  67. initNodeSize: function(){
  68. this.resizeNodeSize();
  69. this.addEvent("resize", this.resizeNodeSize.bind(this));
  70. },
  71. resizeNodeSize: function(){
  72. var size = this.content.getSize();
  73. var edge = this.node.getEdgeHeight();
  74. var height = size.y - edge;
  75. if (height<this.options.minHeight) height = this.options.minHeight;
  76. this.node.setStyle("height", ""+height+"px");
  77. var rightHeight = height - this.calendarContentNode.getEdgeHeight();
  78. var leftHeight = this.ltlLayout.getSize().y - this.taskContentNode.getEdgeHeight();
  79. this.calendarContentNode.setStyle("height", ""+rightHeight+"px");
  80. this.taskContentNode.setStyle("height", ""+leftHeight+"px");
  81. this.meetingContentNode.setStyle("height", ""+leftHeight+"px");
  82. this.inforContentNode.setStyle("height", ""+leftHeight+"px");
  83. this.fileContentNode.setStyle("height", ""+leftHeight+"px");
  84. },
  85. loadTaskContent: function(callback){
  86. this.taskContent = new MWF.xApplication.Homepage.TaskContent(this, this.taskContentNode, {
  87. "onLoad": function(){if (callback) callback();}
  88. });
  89. },
  90. loadInforContent: function(callback){
  91. o2.requireApp("Homepage", "InforContent", function(){
  92. this.inforContent = new MWF.xApplication.Homepage.InforContent(this, this.inforContentNode, {
  93. "onLoad": function(){if (callback) callback();}
  94. });
  95. }.bind(this));
  96. },
  97. loadMeetingContent: function(callback){
  98. o2.requireApp("Homepage", "MeetingContent", function(){
  99. this.inforContent = new MWF.xApplication.Homepage.MeetingContent(this, this.meetingContentNode, {
  100. "onLoad": function(){if (callback) callback();}
  101. });
  102. }.bind(this));
  103. },
  104. loadFileContent: function(callback){
  105. o2.requireApp("Homepage", "FileContent", function(){
  106. this.inforContent = new MWF.xApplication.Homepage.FileContent(this, this.fileContentNode, {
  107. "onLoad": function(){if (callback) callback();}
  108. });
  109. }.bind(this));
  110. },
  111. loadCalendarContent: function(callback){
  112. o2.requireApp("Homepage", "CalendarContent", function(){
  113. this.inforContent = new MWF.xApplication.Homepage.CalendarContent(this, this.calendarContentNode, {
  114. "onLoad": function(){if (callback) callback();}
  115. });
  116. }.bind(this));
  117. }
  118. });