Main.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. MWF.xDesktop.requireApp("OnlineMeeting", "Actions.RestActions", null, false);
  2. MWF.require("MWF.widget.MaskNode", null, false);
  3. MWF.xApplication.OnlineMeeting.options.multitask = false;
  4. MWF.xApplication.OnlineMeeting.Main = new Class({
  5. Extends: MWF.xApplication.Common.Main,
  6. Implements: [Options, Events],
  7. options: {
  8. "style": "default",
  9. "name": "OnlineMeeting",
  10. "icon": "icon.png",
  11. "width": "500",
  12. "height": "600",
  13. "isResize": true,
  14. "isMax": true,
  15. "title": MWF.xApplication.OnlineMeeting.LP.title
  16. },
  17. onQueryLoad: function(){
  18. this.lp = MWF.xApplication.OnlineMeeting.LP;
  19. this.actions = new MWF.xApplication.OnlineMeeting.Actions.RestActions();
  20. },
  21. getLogin: function(success, failure){
  22. //if (success) success();
  23. if (failure) failure();
  24. },
  25. loginOpenMeeting: function(data, success, failure){
  26. var uri = this.actions.getLoginUri(data);
  27. var iframe = new Element("iframe", {"src": uri, "styles": {"display": "none"}}).inject(this.content);
  28. //window.open(uri);
  29. //window.setTimeout(function(){
  30. if (success) success();
  31. //}.bind(this), 5000);
  32. },
  33. mask: function(){
  34. if (!this.maskNode){
  35. this.maskNode = new MWF.widget.MaskNode(this.content, {"style": "bam"});
  36. this.maskNode.load();
  37. }
  38. },
  39. unmask: function(){
  40. if (this.maskNode) this.maskNode.hide(function(){
  41. MWF.release(this.maskNode);
  42. this.maskNode = null;
  43. }.bind(this));
  44. },
  45. loadApplication: function(callback) {
  46. this.actions.getOpenMeeting(function(json){
  47. this.meetingLoginData = json.data;
  48. this.getLogin(function(){
  49. this.loadMeetingRoom();
  50. }.bind(this), function(){
  51. if (this.meetingLoginData){
  52. this.mask();
  53. this.loginOpenMeeting(this.meetingLoginData, function(){
  54. this.loadMeetingRoom();
  55. }.bind(this));
  56. }
  57. }.bind(this));
  58. }.bind(this));
  59. },
  60. loadMeetingRoom: function(){
  61. this.titleNode = new Element("div", {"styles": this.css.titleNode}).inject(this.content);
  62. //this.titleIconNode = new Element("div", {"styles": this.css.titleNode});
  63. //this.titleTextNode = new Element("div", {"styles": this.css.titleNode});
  64. this.titleNode.set("text", this.lp.netMeetingRoom);
  65. this.contentNode = new Element("div", {"styles": this.css.contentNode}).inject(this.content);
  66. this.setContentSize();
  67. this.addEvent("resize", this.setContentSize.bind(this));
  68. //this.content.setStyle("overflow": "")
  69. this.loadCountent();
  70. },
  71. setContentSize: function(){
  72. var size = this.content.getSize();
  73. var titleSize = this.titleNode.getSize();
  74. var h = size.y-titleSize.y;
  75. this.contentNode.setStyle("height", ""+h+"px");
  76. },
  77. loadCountent: function(){
  78. this.actions.listRoom(function(json){
  79. json.data.each(function(d){
  80. d.url = this.actions.getRoomUri(this.meetingLoginData, d);
  81. new MWF.xApplication.OnlineMeeting.room(this, d);
  82. }.bind(this));
  83. this.unmask();
  84. }.bind(this));
  85. }
  86. });
  87. MWF.xApplication.OnlineMeeting.room = new Class({
  88. initialize: function(app, data){
  89. this.data = data
  90. this.app = app
  91. this.css = this.app.css;
  92. this.container = this.app.contentNode;
  93. this.lp = this.app.lp;
  94. this.load();
  95. },
  96. load: function(){
  97. this.node = new Element("div", {"styles": this.css.roomNode}).inject(this.container);
  98. this.iconNode = new Element("div", {"styles": this.css.roomIconNode}).inject(this.node);
  99. this.textNode = new Element("div", {"styles": this.css.roomTextNode}).inject(this.node);
  100. this.textNode.set("text", this.data.name);
  101. this.node.addEvent("click", function(e){
  102. window.open(this.data.url);
  103. // var _self = this;
  104. // var options = {"url": this.data.url};
  105. // this.app.desktop.openApplication(e, "OnlineMeetingRoom", options);
  106. }.bind(this));
  107. }
  108. });