Main.js 70 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529
  1. MWF.require("MWF.xDesktop.UserData", null, false);
  2. MWF.require("MWF.xAction.org.express.RestActions", null,false);
  3. MWF.xDesktop.requireApp("Meeting", "Actions.RestActions", null, false);
  4. MWF.xDesktop.requireApp("Meeting", "MeetingView", null, false);
  5. MWF.xApplication.Meeting.options.multitask = false;
  6. MWF.xApplication.Meeting.Main = new Class({
  7. Extends: MWF.xApplication.Common.Main,
  8. Implements: [Options, Events],
  9. options: {
  10. "style": "default",
  11. "name": "Meeting",
  12. "icon": "icon.png",
  13. "width": "1000",
  14. "height": "600",
  15. "isResize": true,
  16. "isMax": true,
  17. "title": MWF.xApplication.Meeting.LP.title
  18. },
  19. onQueryLoad: function(){
  20. this.lp = MWF.xApplication.Meeting.LP;
  21. this.menuMode="show";
  22. this.isManager = MWF.AC.isMeetingAdministrator();
  23. if (!this.actions) this.actions = new MWF.xApplication.Meeting.Actions.RestActions();
  24. if (!this.personActions) this.personActions = new MWF.xAction.org.express.RestActions();
  25. },
  26. loadApplication: function(callback) {
  27. MWF.UD.getDataJson("meetingConfig", function(json){
  28. this.meetingConfig = json || {};
  29. this.createNode();
  30. if (!this.options.isRefresh) {
  31. this.maxSize(function () {
  32. this.loadLayout();
  33. }.bind(this));
  34. } else {
  35. this.loadLayout();
  36. }
  37. if (callback) callback();
  38. }.bind(this));
  39. },
  40. createNode: function(){
  41. this.content.setStyle("overflow", "hidden");
  42. this.node = new Element("div", {
  43. "styles": {"width": "100%", "height": "100%", "overflow": "hidden"}
  44. }).inject(this.content);
  45. },
  46. loadLayout: function(){
  47. this.topMenu = new Element("div", {"styles": this.css.topMenu}).inject(this.node);
  48. this.contentNode = new Element("div", {"styles": this.css.contentNode}).inject(this.node);
  49. this.bottomMenu = new Element("div", {"styles": this.css.bottomMenu}).inject(this.node);
  50. this.loadTopMenus();
  51. this.loadBottomMenus();
  52. this.hideMenu();
  53. this.node.addEvent("contextmenu", function(e){
  54. if (this.menuMode=="show"){
  55. this.hideMenu();
  56. }else{
  57. this.showMenu();
  58. }
  59. e.preventDefault();
  60. }.bind(this));
  61. this.setEvent();
  62. if (this.meetingConfig.defaultView){
  63. this[this.meetingConfig.defaultView]();
  64. }else{
  65. this.toMyMeeting();
  66. }
  67. },
  68. setEvent: function(){
  69. //this.topMenu.addEvent("mouseover", function(){this.showMenu();}.bind(this));
  70. //this.topMenu.addEvent("mouseout", function(){this.hideMenu();}.bind(this));
  71. //this.bottomMenu.addEvent("mouseover", function(){this.showMenu();}.bind(this));
  72. //this.bottomMenu.addEvent("mouseout", function(){this.hideMenu();}.bind(this));
  73. this.contentNode.addEvent("click", function(){this.hideMenu();}.bind(this));
  74. },
  75. loadTopMenus: function(){
  76. this.createTopMenu(this.lp.myMeeting, "myMeeting", "toMyMeeting");
  77. this.createTopMenu(this.lp.month, "month", "toMonth");
  78. this.createTopMenu(this.lp.day, "day", "toDay");
  79. this.createTopMenu(this.lp.list, "list", "toList");
  80. this.createTopMenu(this.lp.room, "room", "toRoom");
  81. },
  82. createTopMenu: function(text, icon, action){
  83. var actionNode = new Element("div", {"styles": this.css.topMenuNode}).inject(this.topMenu);
  84. var actionIconNode = new Element("div", {"styles": this.css.topMenuIconNode}).inject(actionNode);
  85. actionIconNode.setStyle("background", "url(/x_component_Meeting/$Main/default/icon/"+icon+".png) no-repeat center center");
  86. var actionTextNode = new Element("div", {"styles": this.css.topMenuTextNode, "text": text}).inject(actionNode);
  87. var _self = this;
  88. actionNode.addEvents({
  89. "mouseover": function(){this.setStyles(_self.css.topMenuNode_over);},
  90. "mouseout": function(){this.setStyles(_self.css.topMenuNode);},
  91. "mousedown": function(){this.setStyles(_self.css.topMenuNode_down);},
  92. "mouseup": function(){this.setStyles(_self.css.topMenuNode_over);},
  93. "click": function(){if (_self[action]) _self[action].apply(_self);}
  94. });
  95. return actionNode;
  96. },
  97. loadBottomMenus: function(){
  98. this.createBottomMenu(this.lp.addMeeting, "add", "addMeeting");
  99. if (this.isManager) this.createBottomMenu(this.lp.addRoom, "addRoom", "addRoom");
  100. var refreshNode = this.createBottomMenu(this.lp.refresh, "refresh", "refresh");
  101. refreshNode.setStyle("float", "right");
  102. var configNode = this.createBottomMenu(this.lp.config, "setup", "config");
  103. configNode.setStyle("float", "right");
  104. },
  105. createBottomMenu: function(text, icon, action){
  106. var actionNode = new Element("div", {"styles": this.css.bottomMenuNode, "title": text}).inject(this.bottomMenu);
  107. //var actionIconNode = new Element("div", {"styles": this.css.bottomMenuIconNode}).inject(actionNode);
  108. actionNode.setStyle("background", "url(/x_component_Meeting/$Main/default/icon/"+icon+".png) no-repeat center center");
  109. //var actionTextNode = new Element("div", {"styles": this.css.bottomMenuTextNode, "text": text}).inject(actionNode);
  110. var _self = this;
  111. actionNode.addEvents({
  112. "mouseover": function(){this.setStyle("background", "url(/x_component_Meeting/$Main/default/icon/"+icon+"_over.png) no-repeat center center");},
  113. "mouseout": function(){this.setStyle("background", "url(/x_component_Meeting/$Main/default/icon/"+icon+".png) no-repeat center center");},
  114. "mousedown": function(){this.setStyle("background", "url(/x_component_Meeting/$Main/default/icon/"+icon+"_down.png) no-repeat center center");},
  115. "mouseup": function(){this.setStyle("background", "url(/x_component_Meeting/$Main/default/icon/"+icon+"_over.png) no-repeat center center");},
  116. "click": function(){if (_self[action]) _self[action].apply(_self);}
  117. });
  118. return actionNode;
  119. },
  120. hideMenu: function(){
  121. if (!this.meetingConfig.hideMenu) this.meetingConfig.hideMenu="static";
  122. if (this.meetingConfig.hideMenu!="static"){
  123. if (this.menuMode=="show"){
  124. this.topMenu.set("tween", {duration: 100, transition: "bounce:out"});
  125. this.bottomMenu.set("tween", {duration: 100, transition: "bounce:out"});
  126. this.topMenu.tween("top", "0px", "-50px");
  127. this.bottomMenu.tween("bottom", "0px", "-50px");
  128. this.menuMode = "hide";
  129. if (!this.topMenuPoint){
  130. this.topMenuPoint = new Element("div", {"styles": this.css.topMenuPoint}).inject(this.topMenu);
  131. this.topMenuPointAction = new Element("div", {"styles": this.css.menuPointAction}).inject(this.topMenuPoint);
  132. this.topMenuPointAction.addEvent("mouseover", function(){this.showMenu();}.bind(this));
  133. }
  134. if (!this.bottomMenuPoint){
  135. this.bottomMenuPoint = new Element("div", {"styles": this.css.bottomMenuPoint}).inject(this.bottomMenu);
  136. this.bottomMenuPointAction = new Element("div", {"styles": this.css.menuPointAction}).inject(this.bottomMenuPoint);
  137. this.bottomMenuPointAction.addEvent("mouseover", function(){this.showMenu();}.bind(this));
  138. }
  139. this.topMenuPoint.setStyle("display", "block");
  140. this.bottomMenuPoint.setStyle("display", "block");
  141. }
  142. }
  143. },
  144. showMenu: function(){
  145. if (this.menuMode!="show") {
  146. this.topMenu.set("tween", {duration: 100, transition: "bounce:out"});
  147. this.bottomMenu.set("tween", {duration: 100, transition: "bounce:out"});
  148. this.topMenu.tween("top", "-50px", "0px");
  149. this.bottomMenu.tween("bottom", "-50px", "0px");
  150. this.menuMode = "show";
  151. if (this.topMenuPoint) this.topMenuPoint.setStyle("display", "none");
  152. if (this.bottomMenuPoint) this.bottomMenuPoint.setStyle("display", "none");
  153. }
  154. },
  155. hideCurrentView: function(){
  156. if (this.currentView){
  157. this.currentView.hide();
  158. this.currentView = null;
  159. }
  160. },
  161. toMyMeeting: function(){
  162. this.contentNode.setStyles(this.css.contentNode);
  163. if ((!this.myMeetingView) || this.currentView!=this.myMeetingView){
  164. this.hideCurrentView();
  165. this.getMyMeetingView(function(){
  166. this.myMeetingView.show();
  167. this.currentView = this.myMeetingView;
  168. }.bind(this));
  169. this.hideMenu();
  170. }
  171. },
  172. getMyMeetingView: function(callback){
  173. if (!this.myMeetingView){
  174. MWF.xDesktop.requireApp("Meeting", "MeetingView", function(){
  175. this.myMeetingView = new MWF.xApplication.Meeting.MeetingView(this.contentNode, this);
  176. if (callback) callback();
  177. }.bind(this));
  178. }else{
  179. if (callback) callback();
  180. }
  181. },
  182. toList: function(){
  183. this.contentNode.setStyle("background", "#EEE");
  184. if ((!this.listView) || this.currentView!=this.listView){
  185. this.hideCurrentView();
  186. this.getListView(function(){
  187. this.listView.show();
  188. this.currentView = this.listView;
  189. }.bind(this));
  190. this.hideMenu();
  191. }
  192. },
  193. getListView: function(callback){
  194. if (!this.listView){
  195. MWF.xDesktop.requireApp("Meeting", "ListView", function(){
  196. this.listView = new MWF.xApplication.Meeting.ListView(this.contentNode, this);
  197. if (callback) callback();
  198. }.bind(this));
  199. }else{
  200. if (callback) callback();
  201. }
  202. },
  203. toMonth: function(){
  204. this.contentNode.setStyle("background", "#EEE");
  205. if ((!this.monthView) || this.currentView!=this.monthView){
  206. this.hideCurrentView();
  207. this.getMonthView(function(){
  208. this.monthView.show();
  209. this.currentView = this.monthView;
  210. }.bind(this));
  211. this.hideMenu();
  212. }
  213. },
  214. getMonthView: function(callback){
  215. if (!this.monthView){
  216. MWF.xDesktop.requireApp("Meeting", "MonthView", function(){
  217. this.monthView = new MWF.xApplication.Meeting.MonthView(this.contentNode, this);
  218. if (callback) callback();
  219. }.bind(this));
  220. }else{
  221. if (callback) callback();
  222. }
  223. },
  224. toDay: function(d){
  225. this.contentNode.setStyle("background", "#EEE");
  226. if ((!this.dayView) || this.currentView!=this.dayView){
  227. this.hideCurrentView();
  228. this.getDayView(function(){
  229. this.dayView.show();
  230. this.currentView = this.dayView;
  231. }.bind(this), d);
  232. this.hideMenu();
  233. }
  234. },
  235. getDayView: function(callback, d){
  236. if (!this.dayView){
  237. MWF.xDesktop.requireApp("Meeting", "DayView", function(){
  238. this.dayView = new MWF.xApplication.Meeting.DayView(this.contentNode, this, {"date": d});
  239. if (callback) callback();
  240. }.bind(this));
  241. }else{
  242. this.dayView.toDay(d);
  243. if (callback) callback();
  244. }
  245. },
  246. toRoom: function(){
  247. this.contentNode.setStyle("background", "#EEE");
  248. if ((!this.roomView) || this.currentView!=this.roomView){
  249. this.hideCurrentView();
  250. this.getRoomView(function(){
  251. this.roomView.show();
  252. this.currentView = this.roomView;
  253. }.bind(this));
  254. this.hideMenu();
  255. }
  256. },
  257. getRoomView: function(callback){
  258. if (!this.roomView){
  259. MWF.xDesktop.requireApp("Meeting", "RoomView", function(){
  260. this.roomView = new MWF.xApplication.Meeting.RoomView(this.contentNode, this);
  261. if (callback) callback();
  262. }.bind(this));
  263. }else{
  264. if (callback) callback();
  265. }
  266. },
  267. refresh: function(){
  268. this.hideMenu();
  269. if (this.currentView) this.currentView.reload();
  270. },
  271. addMeeting: function(date, hour, room){
  272. MWF.UD.getPublicData("meetingConfig", function(json){
  273. var process = (json) ? json.process : null;
  274. if (process){
  275. }else{
  276. new MWF.xApplication.Meeting.Creator(this, date, hour, room);
  277. this.hideMenu();
  278. }
  279. }.bind(this));
  280. },
  281. config: function(){
  282. new MWF.xApplication.Meeting.Config(this, this.meetingConfig);
  283. this.hideMenu();
  284. },
  285. addRoom: function(){
  286. this.createAddRoomNodes();
  287. var createRoomFx = new Fx.Morph(this.createRoomNode, {
  288. "duration": "300",
  289. "transition": Fx.Transitions.Sine.easeOut
  290. });
  291. createRoomFx.start({"opacity": 1});
  292. },
  293. createAddRoomNodes: function(){
  294. this.createRoomNode = new Element("div", {"styles": this.css.createRoomNode}).inject(this.node);
  295. var createRoomAreaNode = new Element("div", {"styles": this.css.createRoomAreaNode}).inject(this.createRoomNode);
  296. var titleNode = new Element("div", {"styles": this.css.createRoomTitleNode, "text": this.lp.addRoom}).inject(createRoomAreaNode);
  297. var contentNode = new Element("div", {"styles": this.css.createRoomContentNode}).inject(createRoomAreaNode);
  298. var bottomNode = new Element("div", {"styles": this.css.createRoomBottomNode}).inject(createRoomAreaNode);
  299. var nameNode = new Element("div", {
  300. "styles": this.css.createRoomFormNode,
  301. "html": "<div>"+this.lp.roomForm.name+"</div><div><input type=\"text\"/></div>"
  302. }).inject(contentNode);
  303. nameNode.getFirst("div").setStyles(this.css.createRoomFormTitleNode);
  304. nameNode.getLast("div").setStyles(this.css.createRoomFormContentNode);
  305. this.createRoomNameInput = nameNode.getElement("input").setStyles(this.css.createRoomFormInput);
  306. var buildingNode = new Element("div", {
  307. "styles": this.css.createRoomFormNode,
  308. "html": "<div>"+this.lp.roomForm.building+"</div><div><input type=\"text\"/></div>"
  309. }).inject(contentNode);
  310. buildingNode.getFirst("div").setStyles(this.css.createRoomFormTitleNode);
  311. buildingNode.getLast("div").setStyles(this.css.createRoomFormContentNode);
  312. this.createRoomBuildingInput = buildingNode.getElement("input").setStyles(this.css.createRoomFormInput);
  313. var floorNode = new Element("div", {
  314. "styles": this.css.createRoomFormNode2,
  315. "html": "<div>"+this.lp.roomForm.floor+"</div><div></div>"
  316. }).inject(contentNode);
  317. floorNode.getFirst("div").setStyles(this.css.createRoomFormTitleNode);
  318. var node = floorNode.getLast("div").setStyles(this.css.createRoomFormContentNode);
  319. this.createRoomFloorSelect = new Element("select", {"styles": this.css.createRoomFormSelect}).inject(node);
  320. for (var i=-2; i<=50; i++){
  321. var option = new Element("option", {
  322. "value": i,
  323. "text": i+this.lp.floor,
  324. "selected": (i==1)
  325. }).inject(this.createRoomFloorSelect);
  326. }
  327. var capacityNode = new Element("div", {
  328. "styles": this.css.createRoomFormNode3,
  329. "html": "<div>"+this.lp.roomForm.capacity+"</div><div><input type=\"number\"/></div>"
  330. }).inject(contentNode);
  331. capacityNode.getFirst("div").setStyles(this.css.createRoomFormTitleNode);
  332. capacityNode.getLast("div").setStyles(this.css.createRoomFormContentNode);
  333. this.createRoomCapacityInput = capacityNode.getElement("input").setStyles(this.css.createRoomFormInput);
  334. var roomNumberNode = new Element("div", {
  335. "styles": this.css.createRoomFormNode2,
  336. "html": "<div>"+this.lp.roomForm.roomNumber+"</div><div><input type=\"text\"/></div>"
  337. }).inject(contentNode);
  338. roomNumberNode.getFirst("div").setStyles(this.css.createRoomFormTitleNode);
  339. roomNumberNode.getLast("div").setStyles(this.css.createRoomFormContentNode);
  340. this.createRoomRoomNumberInput = roomNumberNode.getElement("input").setStyles(this.css.createRoomFormInput);
  341. var phoneNode = new Element("div", {
  342. "styles": this.css.createRoomFormNode3,
  343. "html": "<div>"+this.lp.roomForm.phone+"</div><div><input type=\"text\"/></div>"
  344. }).inject(contentNode);
  345. phoneNode.getFirst("div").setStyles(this.css.createRoomFormTitleNode);
  346. phoneNode.getLast("div").setStyles(this.css.createRoomFormContentNode);
  347. this.createRoomRoomPhoneNode = phoneNode.getElement("input").setStyles(this.css.createRoomFormInput);
  348. var auditorNode = new Element("div", {
  349. "styles": this.css.createRoomFormNode,
  350. "html": "<div>"+this.lp.roomForm.auditor+"</div><div></div>"
  351. }).inject(contentNode);
  352. auditorNode.getFirst("div").setStyles(this.css.createRoomFormTitleNode);
  353. this.createRoomRoomAuditorNode = auditorNode.getLast("div").setStyles(this.css.createRoomFormAuditorNode);
  354. auditorNode.setStyle("display", "none");
  355. //this.createRoomRoomAuditorInput = auditorNode.getElement("input").setStyles(this.css.createRoomFormInput);
  356. var deviceNode = new Element("div", {
  357. "styles": this.css.createRoomFormNode2,
  358. "html": "<div>"+this.lp.roomForm.device+"</div><div></div>"
  359. }).inject(contentNode);
  360. deviceNode.getFirst("div").setStyles(this.css.createRoomFormTitleNode);
  361. this.createRoomDeviceChecks = deviceNode.getLast("div").setStyles(this.css.createRoomFormContentNode2);
  362. Object.each(this.lp.device, function(d, k){
  363. new Element("div", {
  364. "styles": {"float": "left", "width": "80px"},
  365. "html": "<input type=\"checkbox\" name=\"createRoomDeviceCheckbox\" value=\""+k+"\">"+d
  366. }).inject(this.createRoomDeviceChecks);
  367. }.bind(this));
  368. var availableNode = new Element("div", {
  369. "styles": this.css.createRoomFormNode3,
  370. "html": "<div>"+this.lp.roomForm.available+"</div><div></div>"
  371. }).inject(contentNode);
  372. availableNode.getFirst("div").setStyles(this.css.createRoomFormTitleNode);
  373. this.createRoomAvailableChecks = availableNode.getLast("div").setStyles(this.css.createRoomFormContentNode2);
  374. new Element("div", {
  375. "styles": {"float": "left"},
  376. "html": "<input type=\"radio\" name=\"createRoomAvailableRadio\" checked value=\"y\">"+this.lp.enable
  377. }).inject(this.createRoomAvailableChecks);
  378. new Element("div", {
  379. "styles": {"float": "left"},
  380. "html": "<input type=\"radio\" name=\"createRoomAvailableRadio\" value=\"n\">"+this.lp.disable
  381. }).inject(this.createRoomAvailableChecks);
  382. this.createRoomCancelActionNode = new Element("div", {
  383. "styles": this.css.createRoomCancelActionNode,
  384. "text": this.lp.cancel
  385. }).inject(bottomNode);
  386. this.createRoomOkActionNode = new Element("div", {
  387. "styles": this.css.createRoomOkActionNode,
  388. "text": this.lp.save
  389. }).inject(bottomNode);
  390. this.createRoomCancelActionNode.addEvent("click", function(e){
  391. this.createRoomCancel(e);
  392. }.bind(this));
  393. this.createRoomOkActionNode.addEvent("click", function(e){
  394. this.createRoomSave(e);
  395. }.bind(this));
  396. this.setCreateRoomEvent();
  397. },
  398. setCreateRoomEvent: function(){
  399. this.createRoomNameInput.addEvents({
  400. "focus": function(){
  401. var errorNode = this.createRoomNameInput.retrieve("errorNode", null);
  402. if (errorNode){
  403. errorNode.destroy();
  404. this.createRoomNameInput.eliminate("errorNode");
  405. this.createRoomNameInput.setStyle("border", "1px solid #999");
  406. }
  407. }.bind(this),
  408. "blur": function(){
  409. if (!this.createRoomNameInput.get("value")) this.createRoomVerification(this.createRoomNameInput, this.lp.roomForm.verification.inputName);
  410. }.bind(this),
  411. });
  412. this.createRoomBuildingInput.addEvents({
  413. "focus": function(){
  414. var errorNode = this.createRoomBuildingInput.retrieve("errorNode", null);
  415. if (errorNode){
  416. errorNode.destroy();
  417. this.createRoomBuildingInput.eliminate("errorNode");
  418. this.createRoomBuildingInput.setStyle("border", "1px solid #999");
  419. }
  420. }.bind(this),
  421. "blur": function(){
  422. var createBuilding = false;
  423. var building = this.createRoomBuildingInput.retrieve("buildingId");
  424. if (!building){
  425. var buildingName = this.createRoomBuildingInput.get("value");
  426. if (buildingName) createBuilding = true;
  427. }
  428. if (!building && !createBuilding) this.createRoomVerification(this.createRoomBuildingInput, this.lp.roomForm.verification.inputBuilding);
  429. }.bind(this),
  430. });
  431. this.createRoomCapacityInput.addEvents({
  432. "focus": function(){
  433. var errorNode = this.createRoomCapacityInput.retrieve("errorNode", null);
  434. if (errorNode){
  435. errorNode.destroy();
  436. this.createRoomCapacityInput.eliminate("errorNode");
  437. this.createRoomCapacityInput.setStyle("border", "1px solid #999");
  438. }
  439. }.bind(this),
  440. "blur": function(){
  441. if (!this.createRoomCapacityInput.get("value")) this.createRoomVerification(this.createRoomCapacityInput, this.lp.roomForm.verification.inputCapacity);
  442. }.bind(this),
  443. });
  444. this.createRoomBuildingInput.addEvents({
  445. "focus": function(){this.createRoomListBuilding();}.bind(this),
  446. //"blur": function(){}.bind(this),
  447. "change": function(){this.createRoomBuildingInput.eliminate("buildingId");}.bind(this),
  448. "keydown": function(e){
  449. //if ([13,40,38].indexOf(e.code)!=-1){
  450. // if (!this.createRoomSelectBuildingNode){
  451. // this.createRoomListBuilding();
  452. // }
  453. //}
  454. if (e.code==13){
  455. this.createRoomListBuildingHide();
  456. this.createRoomListBuilding();
  457. }
  458. if (e.code==40) this.createRoomSelectBuildingNext();
  459. if (e.code==38) this.createRoomSelectBuildingPrev();
  460. if (e.code==32) this.createRoomSelectBuildingConfirm(e);
  461. }.bind(this)
  462. });
  463. MWF.xDesktop.requireApp("Organization", "Selector.package", function(){
  464. var name = this.createRoomRoomAuditorNode.retrieve("names", null);
  465. this.createRoomRoomAuditorNode.addEvents({
  466. "click": function(){
  467. var options = {
  468. "type": "person",
  469. "names": (name) ? [name] : [],
  470. "count": 1,
  471. "onComplete": function(items){
  472. var op = this.createRoomRoomAuditorNode.retrieve("person");
  473. if (op){
  474. op.node.destroy();
  475. MWF.release(op);
  476. this.createRoomRoomAuditorNode.eliminate("person");
  477. }
  478. this.createRoomRoomAuditorNode.store("names", items[0].data.name);
  479. MWF.require("MWF.widget.Identity", function(){
  480. var explorer = {
  481. "actions": this.personActions,
  482. "app": {
  483. "lp": this.lp
  484. }
  485. }
  486. var _self = this;
  487. var person = new MWF.widget.Person(items[0].data, this.createRoomRoomAuditorNode, explorer, true, function(e){
  488. this.node.destroy();
  489. MWF.release(this);
  490. _self.createRoomRoomAuditorNode.eliminate("names");
  491. _self.createRoomRoomAuditorNode.eliminate("person");
  492. e.stopPropagation();
  493. }, {"style": "meeting"});
  494. this.createRoomRoomAuditorNode.store("person", person);
  495. }.bind(this));
  496. }.bind(this)
  497. };
  498. var selector = new MWF.OrgSelector(this.content, options);
  499. }.bind(this)
  500. });
  501. }.bind(this));
  502. },
  503. createRoomSelectBuildingNext: function(){
  504. if (this.createRoomSelectBuildingNode){
  505. var node=nu;;;
  506. if (this.createRoomSelectBuildingNode.selectedNode){
  507. var node = this.createRoomSelectBuildingNode.selectedNode.getNext();
  508. if (!node) node = this.createRoomSelectBuildingNode.getFirst();
  509. this.createRoomSelectBuildingNode.selectedNode.setStyle("background-color", this.createRoomSelectBuildingNode.selectedNode.retrieve("bg"));
  510. }else{
  511. node = this.createRoomSelectBuildingNode.getFirst();
  512. }
  513. if (node){
  514. var color = node.getStyle("background-color");
  515. node.store("bg", color);
  516. node.setStyles(this.css.createRoomBuildingSelectItem_over);
  517. this.createRoomSelectBuildingNode.selectedNode = node;
  518. }
  519. }
  520. },
  521. createRoomSelectBuildingPrev: function(){
  522. if (this.createRoomSelectBuildingNode){
  523. var node = null;
  524. if (this.createRoomSelectBuildingNode.selectedNode){
  525. var node = this.createRoomSelectBuildingNode.selectedNode.getPrevious();
  526. if (!node) node = this.createRoomSelectBuildingNode.getLast();
  527. this.createRoomSelectBuildingNode.selectedNode.setStyle("background-color", this.createRoomSelectBuildingNode.selectedNode.retrieve("bg"));
  528. }else{
  529. node = this.createRoomSelectBuildingNode.getLast();
  530. }
  531. if (node){
  532. var color = node.getStyle("background-color");
  533. node.store("bg", color);
  534. node.setStyles(this.css.createRoomBuildingSelectItem_over);
  535. this.createRoomSelectBuildingNode.selectedNode = node;
  536. }
  537. }
  538. },
  539. createRoomSelectBuildingConfirm: function(e){
  540. if (this.createRoomSelectBuildingNode.selectedNode){
  541. this.selectBuilding(this.createRoomSelectBuildingNode.selectedNode);
  542. e.preventDefault();
  543. }
  544. },
  545. //cancelCreateRoom: function(){
  546. // this.createRoomNode.destroy();
  547. //},
  548. createRoomListBuilding: function(){
  549. var key = this.createRoomBuildingInput.get("value");
  550. this.actions.listBuildingByKey(key, function(json){
  551. if (json.data && json.data.length){
  552. this.createRoomSelectBuildingNode = new Element("div", {"styles": this.css.createRoomSelectBuildingNode}).inject(this.createRoomNode);
  553. this.setCreateRoomSelectBuildingNodeSize();
  554. this.createRoomListBuildingHideFun = this.createRoomListBuildingHide.bind(this);
  555. this.node.addEvent("mousedown", this.createRoomListBuildingHideFun);
  556. var _self = this;
  557. json.data.each(function(building, idx){
  558. var node = new Element("div", {"styles": this.css.createRoomBuildingSelectItem}).inject(this.createRoomSelectBuildingNode);
  559. var nameNode = new Element("div", {"styles": this.css.createRoomBuildingSelectItemName, "text": building.name}).inject(node);
  560. var addrNode = new Element("div", {"styles": this.css.createRoomBuildingSelectItemAddr, "text": building.address}).inject(node);
  561. if ((idx % 2)==1) node.setStyle("background-color", "#f1f6ff");
  562. node.store("building", building.id);
  563. node.addEvents({
  564. "mouseover": function(e){
  565. var color = this.getStyle("background-color");
  566. this.store("bg", color);
  567. this.setStyles(_self.css.createRoomBuildingSelectItem_over);
  568. },
  569. "mouseout": function(e){
  570. this.setStyle("background-color", this.retrieve("bg"));
  571. },
  572. "mousedown": function(e){e.stopPropagation();},
  573. "click": function(e){
  574. _self.selectBuilding(this);
  575. },
  576. });
  577. }.bind(this));
  578. }
  579. }.bind(this));
  580. },
  581. selectBuilding: function(node){
  582. var id = node.retrieve("building");
  583. var text = node.getFirst().get("text");
  584. this.createRoomBuildingInput.set("value", text);
  585. this.createRoomBuildingInput.store("buildingId", id);
  586. this.createRoomListBuildingHide();
  587. var errorNode = this.createRoomBuildingInput.retrieve("errorNode", null);
  588. if (errorNode){
  589. errorNode.destroy();
  590. this.createRoomBuildingInput.eliminate("errorNode");
  591. this.createRoomBuildingInput.setStyle("border", "1px solid #999");
  592. }
  593. },
  594. setCreateRoomSelectBuildingNodeSize: function(){
  595. var p = this.createRoomBuildingInput.getPosition(this.createRoomBuildingInput.getOffsetParent());
  596. this.createRoomSelectBuildingNode.position({
  597. relativeTo: this.createRoomBuildingInput,
  598. position: 'bottomCenter',
  599. edge: 'upperCenter',
  600. offset: {x: 0- p.x, y: 0}
  601. });
  602. this.createRoomSelectBuildingNode.setStyle("left", p.x);
  603. var size = this.createRoomBuildingInput.getSize();
  604. var w = size.x-2
  605. this.createRoomSelectBuildingNode.setStyle("width", ""+w+"px");
  606. },
  607. createRoomListBuildingHide: function(){
  608. if (this.createRoomSelectBuildingNode){
  609. //this.removeEvent("resize", this.setCreateRoomSelectBuildingNodeSizeFun);
  610. this.createRoomSelectBuildingNode.destroy();
  611. this.createRoomSelectBuildingNode = null;
  612. this.node.removeEvent("mousedown", this.createRoomListBuildingHideFun);
  613. }
  614. },
  615. createRoomCancel: function(){
  616. var createRoomFx = new Fx.Morph(this.createRoomNode, {
  617. "duration": "300",
  618. "transition": Fx.Transitions.Sine.easeOut
  619. });
  620. createRoomFx.start({"opacity": 0}).chain(function(){
  621. this.createRoomNode.destroy();
  622. this.createRoomNode = null;
  623. this.createRoomNameInput = null;
  624. this.createRoomBuildingInput = null;
  625. this.createRoomFloorSelect = null;
  626. this.createRoomCapacityInput = null;
  627. this.createRoomRoomNumberInput = null;
  628. this.createRoomRoomAuditorNode = null;
  629. this.createRoomDeviceChecks = null;
  630. this.createRoomAvailableChecks = null;
  631. this.createRoomCancelActionNode = null;
  632. this.createRoomOkActionNode = null;
  633. this.createRoomSelectBuildingNode = null;
  634. delete this.createRoomNameInput;
  635. delete this.createRoomBuildingInput;
  636. delete this.createRoomFloorSelect;
  637. delete this.createRoomCapacityInput;
  638. delete this.createRoomRoomNumberInput;
  639. delete this.createRoomRoomAuditorNode;
  640. delete this.createRoomDeviceChecks;
  641. delete this.createRoomAvailableChecks;
  642. delete this.createRoomCancelActionNode;
  643. delete this.createRoomOkActionNode;
  644. delete this.createRoomSelectBuildingNode;
  645. }.bind(this));
  646. },
  647. createRoomSave: function(){
  648. this.getCreateRoomData(function(data){
  649. this.actions.saveRoom(data, function(json){
  650. this.notice(this.lp.roomForm.save_success, "success", this.node, {"x": "left", "y": "bottom"});
  651. this.createRoomCancel();
  652. }.bind(this));
  653. }.bind(this));
  654. },
  655. getCreateRoomData: function(callback){
  656. var flag = true;
  657. var name = this.createRoomNameInput.get("value");
  658. if (!name) flag = this.createRoomVerification(this.createRoomNameInput, this.lp.roomForm.verification.inputName);
  659. var createBuilding = false;
  660. var building = this.createRoomBuildingInput.retrieve("buildingId");
  661. if (!building){
  662. var buildingName = this.createRoomBuildingInput.get("value");
  663. if (buildingName) createBuilding = true;
  664. }
  665. if (!building && !createBuilding) flag = this.createRoomVerification(this.createRoomBuildingInput, this.lp.roomForm.verification.inputBuilding);
  666. var floor = this.createRoomFloorSelect.options[this.createRoomFloorSelect.selectedIndex].value;
  667. var capacity = this.createRoomCapacityInput.get("value");
  668. if (!capacity) flag = this.createRoomVerification(this.createRoomCapacityInput, this.lp.roomForm.verification.inputCapacity);
  669. var number = this.createRoomRoomNumberInput.get("value");
  670. var phoneNumber = this.createRoomRoomPhoneNode.get("value");
  671. var auditor = this.createRoomRoomAuditorNode.retrieve("names", "");
  672. var deviceList = [];
  673. var deviceChecks = this.createRoomDeviceChecks.getElements("input");
  674. deviceChecks.each(function(input){
  675. if (input.checked) deviceList.push(input.get("value"));
  676. }.bind(this));
  677. var device = deviceList.join("#");
  678. var available = true;
  679. var radios = this.createRoomAvailableChecks.getElements("input");
  680. for (var i=0; i<radios.length; i++){
  681. if (radios[i].checked){
  682. available = (radios[i].get("value")=="y") ? true : false;
  683. break;
  684. }
  685. }
  686. if (!flag) return false;
  687. if (createBuilding){
  688. this.actions.saveBuilding({"name": buildingName, "address": ""}, function(json){
  689. building = json.data.id;
  690. var roomData = {
  691. "name": name,
  692. "building": building,
  693. "floor": floor,
  694. "device": device,
  695. "capacity": capacity,
  696. "auditor": auditor,
  697. "available": available,
  698. "roomNumber": number,
  699. "phoneNumber": phoneNumber
  700. }
  701. if (callback) callback(roomData);
  702. }.bind(this));
  703. }else{
  704. var roomData = {
  705. "name": name,
  706. "building": building,
  707. "floor": floor,
  708. "device": device,
  709. "capacity": capacity,
  710. "auditor": auditor,
  711. "available": available,
  712. "roomNumber": number,
  713. "phoneNumber": phoneNumber
  714. }
  715. if (callback) callback(roomData);
  716. }
  717. },
  718. createRoomVerification: function(node, text){
  719. var infoNode = new Element("div", {"styles": this.css.createRoomErrorInfoNode, "text": text}).inject(node, "after");
  720. node.setStyle("border", "1px solid #F00");
  721. node.store("errorNode", infoNode);
  722. return false;
  723. }
  724. });
  725. MWF.xApplication.Meeting.Creator = new Class({
  726. Implements: [Events],
  727. initialize: function(app, date, hour, room){
  728. this.app = app;
  729. this.css = this.app.css;
  730. this.lp = this.app.lp;
  731. this.data = {};
  732. this.date = date || new Date();
  733. this.hour = hour;
  734. this.room = room;
  735. this.load();
  736. },
  737. load: function(){
  738. this.node = new Element("div", {"styles": this.css.createMeetingNode}).inject(this.app.node);
  739. this.infoAreaNode = new Element("div", {"styles": this.css.createMeetingInfoAreaNode}).inject(this.node);
  740. this.contentAreaNode = new Element("div", {"styles": this.css.createMeetingContentAreaNode}).inject(this.node);
  741. this.loadInfo();
  742. this.loadContent();
  743. this.cancelNode.addEvents({
  744. "mouseover": function(){this.cancelNode.setStyles(this.css.createMeetingCancelNode_over);}.bind(this),
  745. "mouseout": function(){this.cancelNode.setStyles(this.css.createMeetingCancelNode);}.bind(this),
  746. "mousedown": function(){this.cancelNode.setStyles(this.css.createMeetingCancelNode_down);}.bind(this),
  747. "mouseup": function(){this.cancelNode.setStyles(this.css.createMeetingCancelNode_over);}.bind(this),
  748. "click": function(e){this.cancelCreateMeeting(e);}.bind(this)
  749. });
  750. this.saveNode.addEvents({
  751. "mouseover": function(){this.saveNode.setStyles(this.css.createMeetingSaveNode_over);}.bind(this),
  752. "mouseout": function(){this.saveNode.setStyles(this.css.createMeetingSaveNode);}.bind(this),
  753. "mousedown": function(){this.saveNode.setStyles(this.css.createMeetingSaveNode_down);}.bind(this),
  754. "mouseup": function(){this.saveNode.setStyles(this.css.createMeetingSaveNode_over);}.bind(this),
  755. "click": function(e){this.saveCreateMeeting(e);}.bind(this)
  756. });
  757. this.show();
  758. },
  759. cancelCreateMeeting: function(e){
  760. debugger;
  761. if (this.data.id){
  762. this.save(function(){
  763. if (this.setDescriptionHeightFun) this.app.removeEvent("resize", this.setDescriptionHeightFun);
  764. this.app.currentView.reload();
  765. this.hide();
  766. }.bind(this));
  767. }else{
  768. var _self = this;
  769. this.app.confirm("warn", e, this.lp.cancel_createMeeting_title, this.lp.cancel_createMeeting, 300, 120, function(){
  770. if (_self.setDescriptionHeightFun) _self.app.removeEvent("resize", _self.setDescriptionHeightFun);
  771. _self.hide();
  772. this.close();
  773. }, function(){
  774. this.close();
  775. });
  776. }
  777. },
  778. getSaveData: function(){
  779. var subject = this.subjectInputNode.get("value");
  780. if (subject==this.lp.meetingSubject) subject = "";
  781. var description = this.descriptionInput.get("value");
  782. if (description==this.lp.meetingDescription) description = "";
  783. var room = this.roomId;
  784. var d = this.dateInput.get("value");
  785. var bh = this.beginHourSelect.options[this.beginHourSelect.selectedIndex].value;
  786. var bm = this.beginMinuteSelect.options[this.beginMinuteSelect.selectedIndex].value;
  787. var eh = this.endHourSelect.options[this.endHourSelect.selectedIndex].value;
  788. var em = this.endMinuteSelect.options[this.endMinuteSelect.selectedIndex].value;
  789. var startTime = d+" "+bh+":"+bm+":0";
  790. var completedTime = d+" "+eh+":"+em+":0";
  791. var invitePersonList = this.invitePersonNames;
  792. var startTimeDate = Date.parse(startTime);
  793. var completedTimeDate = Date.parse(completedTime);
  794. this.data.subject = subject;
  795. this.data.description = description;
  796. this.data.room = room;
  797. this.data.startTime = startTime;
  798. this.data.completedTime = completedTime;
  799. this.data.startTimeDate = startTimeDate;
  800. this.data.completedTimeDate = completedTimeDate;
  801. this.data.invitePersonList = invitePersonList;
  802. },
  803. save: function(callback){
  804. this.getSaveData();
  805. var now = new Date();
  806. var errorText = "";
  807. if (!this.data.subject) errorText +=this.lp.meeting_input_subject_error;
  808. if (!this.data.room) errorText +=this.lp.meeting_input_room_error;
  809. if (!this.data.invitePersonList.length) errorText +=this.lp.meeting_input_person_error;
  810. if (this.data.startTimeDate.diff(this.data.completedTimeDate, "minute")<1) errorText +=this.lp.meeting_input_time_error;
  811. if (now.diff(this.data.startTimeDate, "minute")<0) errorText +=this.lp.meeting_input_date_error;
  812. if (errorText){
  813. this.app.notice(this.lp.meeting_input_error+errorText, "error", this.app.content, {"x": "left", "y": "top"});
  814. return false;
  815. }
  816. this.app.actions.saveMeeting(this.data, function(json){
  817. this.data.id = json.data.id
  818. if (callback) callback();
  819. }.bind(this));
  820. },
  821. saveCreateMeeting: function(){
  822. this.save(function(){
  823. this.app.notice(this.lp.meeting_saveSuccess, "success", this.app.content, {"x": "right", "y": "top"});
  824. if (!this.attachmentNode){
  825. this.loadAttachment();
  826. }
  827. }.bind(this));
  828. },
  829. loadInfo: function(){
  830. var infoHeadNode = new Element("div", {"styles": this.css.createMeetingInfoHeadNode}).inject(this.infoAreaNode);
  831. this.cancelNode = new Element("div", {"styles": this.css.createMeetingCancelNode}).inject(infoHeadNode);
  832. titleNode = new Element("div", {"styles": this.css.createMeetingInfoTitleNode}).inject(infoHeadNode);
  833. var text = this.lp.meetingApply.replace(/{person}/g, this.app.desktop.session.user.name);
  834. titleNode.set("text", text);
  835. this.infoContentNode = new Element("div", {"styles": this.css.createMeetingInfoContentNode}).inject(this.infoAreaNode);
  836. this.loadBeginDate();
  837. this.loadBeginTime();
  838. this.loadEndTime();
  839. this.loadSelectRoom();
  840. this.loadInvite();
  841. },
  842. loadContent: function(){
  843. this.contentHeadNode = new Element("div", {"styles": this.css.createMeetingContentHeadNode}).inject(this.contentAreaNode);
  844. this.saveNode = new Element("div", {"styles": this.css.createMeetingSaveNode}).inject(this.contentHeadNode);
  845. this.subjectNode = new Element("div", {"styles": this.css.createMeetingSubjectNode}).inject(this.contentHeadNode);
  846. this.subjectInputNode = new Element("input", {
  847. "styles": this.css.createMeetingSubjectInputNode,
  848. "type": "text",
  849. "value": this.lp.meetingSubject
  850. }).inject(this.subjectNode);
  851. var descriptionNode = new Element("div", {"styles": this.css.createMeetingDescriptionNode}).inject(this.contentAreaNode);
  852. var descriptionAreaNode = new Element("div", {"styles": this.css.createMeetingDescriptionAreaNode}).inject(descriptionNode);
  853. this.descriptionInput = new Element("textarea", {"styles": this.css.createMeetingDescriptionInputNode}).inject(descriptionAreaNode);
  854. this.descriptionInput.set("value", this.lp.meetingDescription);
  855. this.setDescriptionHeight();
  856. this.setDescriptionHeightFun = this.setDescriptionHeight.bind(this);
  857. this.app.addEvent("resize", this.setDescriptionHeightFun);
  858. this.subjectInputNode.addEvents({
  859. "focus": function(){
  860. if (this.subjectInputNode.get("value")==this.lp.meetingSubject) this.subjectInputNode.set("value", "");
  861. }.bind(this),
  862. "blur": function(){
  863. if (!this.subjectInputNode.get("value")) this.subjectInputNode.set("value", this.lp.meetingSubject);
  864. }.bind(this)
  865. });
  866. this.descriptionInput.addEvents({
  867. "focus": function(){
  868. if (this.descriptionInput.get("value")==this.lp.meetingDescription) this.descriptionInput.set("value", "");
  869. }.bind(this),
  870. "blur": function(){
  871. if (!this.descriptionInput.get("value")) this.descriptionInput.set("value", this.lp.meetingDescription);
  872. }.bind(this)
  873. });
  874. },
  875. loadAttachment: function(){
  876. this.attachmentNode = new Element("div", {"styles": this.css.createMeetingAttachmentNode}).inject(this.contentHeadNode, "after");
  877. var attachmentTitleNode = new Element("div", {"styles": this.css.createMeetingAttachmentTitleNode}).inject(this.attachmentNode);
  878. attachmentTitleNode.set("text", this.lp.meetingAttachment);
  879. var attachmentContentNode = new Element("div", {"styles": this.css.createMeetingAttachmentContentNode}).inject(this.attachmentNode);
  880. MWF.require("MWF.widget.AttachmentController", function(){
  881. this.attachmentController = new MWF.widget.AttachmentController(attachmentContentNode, this, {"size": "min", "isSizeChange": false, "isReplace": false});
  882. this.attachmentController.load();
  883. }.bind(this));
  884. },
  885. uploadAttachment: function(e, node){
  886. if (!this.uploadFileAreaNode){
  887. this.createUploadFileNode();
  888. }
  889. this.fileUploadNode.click();
  890. },
  891. createUploadFileNode: function(){
  892. this.uploadFileAreaNode = new Element("div");
  893. var html = "<input name=\"file\" type=\"file\" multiple/>";
  894. this.uploadFileAreaNode.set("html", html);
  895. this.fileUploadNode = this.uploadFileAreaNode.getFirst();
  896. this.fileUploadNode.addEvent("change", function(){
  897. var files = this.fileUploadNode.files;
  898. if (files.length){
  899. for (var i = 0; i < files.length; i++) {
  900. var file = files.item(i);
  901. var formData = new FormData();
  902. formData.append('file', file);
  903. //formData.append('folder', folderId);
  904. this.app.actions.addAttachment(function(o, text){
  905. debugger;
  906. if (o.id){
  907. this.app.actions.getAttachment(o.id, function(json){
  908. if (json.data) this.attachmentController.addAttachment(json.data);
  909. this.attachmentController.checkActions();
  910. }.bind(this))
  911. }
  912. this.attachmentController.checkActions();
  913. }.bind(this), null, formData, this.data.id, file);
  914. }
  915. }
  916. }.bind(this));
  917. },
  918. deleteAttachments: function(e, node, attachments){
  919. var names = [];
  920. attachments.each(function(attachment){
  921. names.push(attachment.data.name);
  922. }.bind(this));
  923. var _self = this;
  924. this.app.confirm("warn", e, this.lp.deleteAttachmentTitle, this.lp.deleteAttachment+"( "+names.join(", ")+" )", 300, 120, function(){
  925. while (attachments.length){
  926. attachment = attachments.shift();
  927. _self.deleteAttachment(attachment);
  928. }
  929. this.close();
  930. }, function(){
  931. this.close();
  932. }, null);
  933. },
  934. deleteAttachment: function(attachment){
  935. this.app.actions.deleteFile(attachment.data.id, function(josn){
  936. this.attachmentController.removeAttachment(attachment);
  937. this.attachmentController.checkActions();
  938. }.bind(this));
  939. },
  940. downloadAttachment: function(e, node, attachments){
  941. attachments.each(function(att){
  942. this.app.actions.getFileDownload(att.data.id);
  943. }.bind(this));
  944. },
  945. openAttachment: function(e, node, attachments){
  946. attachments.each(function(att){
  947. this.app.actions.getFile(att.data.id);
  948. }.bind(this));
  949. },
  950. getAttachmentUrl: function(attachment, callback){
  951. this.app.actions.getFileUrl(attachment.data.id, callback);
  952. },
  953. setDescriptionHeight: function(){
  954. var size = this.node.getSize();
  955. var y = size.y-190;
  956. this.descriptionInput.setStyle("height", ""+y+"px");
  957. },
  958. loadBeginDate: function(){
  959. var lineNode = new Element("div", {"styles": this.css.createMeetingInfoLineNode}).inject(this.infoContentNode);
  960. var titleNode = new Element("div", {"styles": this.css.createMeetingInfoItemTitleNode, "text": this.lp.beginDate}).inject(lineNode);
  961. var editNode = new Element("div", {
  962. "styles": this.css.createMeetingInfoItemEditNode,
  963. "html": "<input type=\"rext\" readonly />"
  964. }).inject(lineNode);
  965. this.dateInput = editNode.getFirst();
  966. this.dateInput.setStyles(this.css.createMeetingInfoItemInputNode);
  967. this.dateInput.set("value", this.date.format("%Y-%m-%d"));
  968. var downNode = new Element("div", {"styles": this.css.createMeetingInfoItemDownNode}).inject(editNode);
  969. MWF.require("MWF.widget.Calendar", function(){
  970. new MWF.widget.Calendar(this.dateInput, {"style":"meeting", "target": this.node});
  971. }.bind(this));
  972. downNode.addEvent("click", function(){
  973. this.dateInput.focus();
  974. }.bind(this));
  975. },
  976. loadBeginTime: function(){
  977. var lineNode = new Element("div", {"styles": this.css.createMeetingInfoLineNode}).inject(this.infoContentNode);
  978. var titleNode = new Element("div", {"styles": this.css.createMeetingInfoItemTitleNode, "text": this.lp.beginTime}).inject(lineNode);
  979. var editNode = new Element("div", {"styles": this.css.createMeetingInfoItemEditNode}).inject(lineNode);
  980. this.beginHourSelect = new Element("select", {"styles": this.css.createMeetingInfoItemSelectNode}).inject(editNode);
  981. this.beginMinuteSelect = new Element("select", {"styles": this.css.createMeetingInfoItemSelectNode}).inject(editNode);
  982. var hour = this.hour;
  983. if (!hour){
  984. var now = (new Date()).increment("hour", 1);
  985. var hour = now.getHours();
  986. }
  987. for (i=0; i<24; i++){
  988. var op = new Element("option", {
  989. "value": i,
  990. "text": i
  991. }).inject(this.beginHourSelect);
  992. if (i==hour) op.set("selected", true);
  993. }
  994. for (i=0; i<60; i = i+5){
  995. var op = new Element("option", {
  996. "value": i,
  997. "text": i
  998. }).inject(this.beginMinuteSelect);
  999. if (i==0) op.set("selected", true);
  1000. }
  1001. },
  1002. loadEndTime: function(){
  1003. var lineNode = new Element("div", {"styles": this.css.createMeetingInfoLineNode}).inject(this.infoContentNode);
  1004. var titleNode = new Element("div", {"styles": this.css.createMeetingInfoItemTitleNode, "text": this.lp.endTime}).inject(lineNode);
  1005. var editNode = new Element("div", {"styles": this.css.createMeetingInfoItemEditNode}).inject(lineNode);
  1006. this.endHourSelect = new Element("select", {"styles": this.css.createMeetingInfoItemSelectNode}).inject(editNode);
  1007. this.endMinuteSelect = new Element("select", {"styles": this.css.createMeetingInfoItemSelectNode}).inject(editNode);
  1008. var hour = this.hour;
  1009. if (!hour){
  1010. var now = (new Date()).increment("hour", 1);
  1011. var hour = now.getHours();
  1012. }
  1013. hour++;
  1014. for (i=0; i<24; i++){
  1015. var op = new Element("option", {
  1016. "value": i,
  1017. "text": i
  1018. }).inject(this.endHourSelect);
  1019. if (i==hour) op.set("selected", true);
  1020. }
  1021. for (i=0; i<60; i = i+5){
  1022. var op = new Element("option", {
  1023. "value": i,
  1024. "text": i
  1025. }).inject(this.endMinuteSelect);
  1026. if (i==0) op.set("selected", true);
  1027. }
  1028. },
  1029. loadSelectRoom: function(){
  1030. var lineNode = new Element("div", {"styles": this.css.createMeetingInfoLineNode}).inject(this.infoContentNode);
  1031. var titleNode = new Element("div", {"styles": this.css.createMeetingInfoItemTitleNode, "text": this.lp.selectRoom}).inject(lineNode);
  1032. var editNode = new Element("div", {
  1033. "styles": this.css.createMeetingInfoItemEditNode,
  1034. "html": "<div></div>"
  1035. }).inject(lineNode);
  1036. this.roomInput = editNode.getFirst();
  1037. this.roomInput.setStyles(this.css.createMeetingInfoItemDivNode);
  1038. var downNode = new Element("div", {"styles": this.css.createMeetingInfoItemDownNode}).inject(editNode);
  1039. this.roomInput.addEvents({
  1040. "click": function(e){this.selectRooms();}.bind(this)
  1041. });
  1042. downNode.addEvent("click", function(){
  1043. this.selectRooms();
  1044. }.bind(this));
  1045. if (this.room){
  1046. this.app.actions.getRoom(this.room, function(json){
  1047. this.app.actions.getBuilding(json.data.building, function(bjson){
  1048. this.roomId = this.room;
  1049. this.roomInput.set("text", json.data.name+" ("+bjson.data.name+")");
  1050. }.bind(this));
  1051. }.bind(this));
  1052. }
  1053. },
  1054. selectRooms: function(){
  1055. this.createRoomNode(function(){
  1056. this.loadSelectRooms();
  1057. this.selectRoomNode.setStyle("display", "block");
  1058. this.hideRoomNodeFun = this.hideRoomNode.bind(this);
  1059. document.body.addEvent("mousedown", this.hideRoomNodeFun);
  1060. //var p = this.selectRoomNode.getPosition(this.selectRoomNode.getOffsetParent());
  1061. this.selectRoomNode.position({
  1062. relativeTo: this.roomInput,
  1063. position: 'bottomLeft',
  1064. edge: 'upperLeft',
  1065. offset: {x: 0, y: 0}
  1066. });
  1067. var size = this.roomInput.getSize();
  1068. var w = size.x-2
  1069. this.selectRoomNode.setStyle("width", ""+w+"px");
  1070. }.bind(this));
  1071. },
  1072. createRoomNode: function(callback){
  1073. if (!this.selectRoomNode){
  1074. this.selectRoomNode = new Element("div", {"styles": this.css.createMeetingInfoSelectRoomNode}).inject(this.node);
  1075. this.selectRoomNode.addEvent("mousedown", function(e){e.stopPropagation();});
  1076. if (callback) callback();
  1077. }else{
  1078. if (callback) callback();
  1079. }
  1080. },
  1081. loadSelectRooms: function(){
  1082. var d = this.dateInput.get("value");
  1083. var bh = this.beginHourSelect.options[this.beginHourSelect.selectedIndex].value;
  1084. var bm = this.beginMinuteSelect.options[this.beginMinuteSelect.selectedIndex].value;
  1085. var eh = this.endHourSelect.options[this.endHourSelect.selectedIndex].value;
  1086. var em = this.endMinuteSelect.options[this.endMinuteSelect.selectedIndex].value;
  1087. var start = d+" "+bh+":"+bm;
  1088. var completed = d+" "+eh+":"+em;
  1089. this.app.actions.listBuildingByRange(start, completed, function(json){
  1090. json.data.each(function(building){
  1091. var node = new Element("div", {"styles": this.css.createMeetingInfoSelectRoomItem1Node}).inject(this.selectRoomNode);
  1092. var nodeName = new Element("div", {"styles": this.css.createMeetingInfoSelectRoomItem1NameNode, "text": building.name}).inject(node);
  1093. var nodeAddr = new Element("div", {"styles": this.css.createMeetingInfoSelectRoomItem1AddrNode, "text": building.address}).inject(node);
  1094. building.roomList.each(function(room, i){
  1095. if (room.available) this.createRoomSelectNode(room, i, building);
  1096. }.bind(this));
  1097. }.bind(this));
  1098. }.bind(this));
  1099. },
  1100. createRoomSelectNode: function(room, i, building){
  1101. var roomNode = new Element("div", {"styles": this.css.roomTitleNode}).inject(this.selectRoomNode);
  1102. var capacityNode = new Element("div", {"styles": this.css.roomTitleCapacityNode, "text": room.capacity+this.lp.person}).inject(roomNode);
  1103. var inforNode = new Element("div", {"styles": this.css.roomTitleInforNode}).inject(roomNode);
  1104. var node = new Element("div", {"styles": {"height": "20px"}}).inject(inforNode);
  1105. var numberNode = new Element("div", {"styles": this.css.roomTitleNumberNode, "text": (room.roomNumber) ? "#"+room.roomNumber : ""}).inject(node);
  1106. var nameNode = new Element("div", {"styles": this.css.roomTitleNameNode, "text": room.name}).inject(node);
  1107. var iconsNode = new Element("div", {"styles": this.css.roomTitleIconsNode}).inject(inforNode);
  1108. var deviceList = room.device.split("#");
  1109. deviceList.each(function(name){
  1110. var node = new Element("div", {"styles": this.css.roomTitleIconNode, "title": this.lp.device[name]}).inject(iconsNode);
  1111. node.setStyle("background-image", "url(/x_component_Meeting/$RoomView/default/icon/"+name+".png)");
  1112. }.bind(this));
  1113. if ((i % 2)!=0) roomNode.setStyle("background-color", "#f4f8ff");
  1114. roomNode.store("room", room);
  1115. var _self = this;
  1116. if (room.idle){
  1117. roomNode.addEvents({
  1118. "mouseover": function(){
  1119. var color = roomNode.getStyle("background-color");
  1120. this.store("bgcolor", color);
  1121. this.setStyle("background-color", "#e4edfc");
  1122. },
  1123. "mouseout": function(){
  1124. var color = this.retrieve("bgcolor", "#FFF");
  1125. this.setStyle("background-color", color);
  1126. },
  1127. "click": function(){
  1128. var roomData = this.retrieve("room");
  1129. _self.roomId = roomData.id;
  1130. //roomNode.inject(_self.roomInput);
  1131. _self.roomInput.set("text", roomData.name+" ("+building.name+")");
  1132. _self.hideRoomNode();
  1133. }
  1134. });
  1135. }else{
  1136. roomNode.setStyle("background-color", "#fff6f6");
  1137. var disabledNode = new Element("div", {"styles": this.css.roomTitleDisabledIconNode}).inject(roomNode);
  1138. }
  1139. },
  1140. hideRoomNode: function(){
  1141. this.selectRoomNode.empty();
  1142. this.selectRoomNode.setStyle("display", "none");
  1143. document.body.removeEvent("mousedown", this.hideRoomNodeFun);
  1144. },
  1145. setCreateRoomSelectBuildingNodeSize: function(){
  1146. var p = this.createRoomBuildingInput.getPosition(this.createRoomBuildingInput.getOffsetParent());
  1147. this.createRoomSelectBuildingNode.position({
  1148. relativeTo: this.createRoomBuildingInput,
  1149. position: 'bottomCenter',
  1150. edge: 'upperCenter',
  1151. offset: {x: 0, y: 0}
  1152. });
  1153. this.createRoomSelectBuildingNode.setStyle("left", p.x);
  1154. var size = this.createRoomBuildingInput.getSize();
  1155. var w = size.x-2
  1156. this.createRoomSelectBuildingNode.setStyle("width", ""+w+"px");
  1157. },
  1158. loadInvite: function(){
  1159. var lineNode = new Element("div", {"styles": this.css.createMeetingInfoLineNode}).inject(this.infoContentNode);
  1160. var titleNode = new Element("div", {"styles": this.css.createMeetingInfoItemTitleNode, "text": this.lp.invitePerson}).inject(lineNode);
  1161. var editNode = new Element("div", {
  1162. "styles": this.css.createMeetingInfoItemEditNode,
  1163. "html": "<div></div>"
  1164. }).inject(lineNode);
  1165. this.inviteInput = editNode.getFirst();
  1166. this.inviteInput.setStyles(this.css.createMeetingInfoItemDivNode);
  1167. this.invitePersons = [];
  1168. this.invitePersonNames = [];
  1169. MWF.xDesktop.requireApp("Organization", "Selector.package", function(){
  1170. this.inviteInput.addEvents({
  1171. "click": function(){
  1172. var options = {
  1173. "type": "person",
  1174. "names": this.invitePersonNames,
  1175. "count": 0,
  1176. "onComplete": function(items){
  1177. this.invitePersons.each(function(op){
  1178. op.node.destroy();
  1179. MWF.release(op);
  1180. }.bind(this));
  1181. this.invitePersons = [];
  1182. this.invitePersonNames = [];
  1183. var explorer = {
  1184. "actions": this.app.personActions,
  1185. "app": {
  1186. "lp": this.lp
  1187. }
  1188. }
  1189. MWF.require("MWF.widget.Identity", function(){
  1190. items.each(function(item){
  1191. var _self = this;
  1192. var person = new MWF.widget.Person(item.data, this.inviteInput, explorer, false, null, {"style": "room"});
  1193. this.invitePersonNames.push(item.data.name);
  1194. this.invitePersons.push(person);
  1195. }.bind(this));
  1196. }.bind(this));
  1197. }.bind(this)
  1198. };
  1199. var selector = new MWF.OrgSelector(this.app.content, options);
  1200. }.bind(this)
  1201. });
  1202. }.bind(this));
  1203. },
  1204. show: function(){
  1205. var fx = new Fx.Morph(this.node, {
  1206. "duration": "300",
  1207. "transition": Fx.Transitions.Sine.easeOut
  1208. });
  1209. fx.start({"opacity": 1});
  1210. },
  1211. hide: function(){
  1212. var fx = new Fx.Morph(this.node, {
  1213. "duration": "300",
  1214. "transition": Fx.Transitions.Sine.easeOut
  1215. });
  1216. fx.start({"opacity": 0}).chain(function(){
  1217. this.node.destroy();
  1218. MWF.release(this);
  1219. }.bind(this));
  1220. }
  1221. });
  1222. MWF.xApplication.Meeting.Config = new Class({
  1223. Implements: [Events],
  1224. initialize: function(app){
  1225. this.app = app;
  1226. this.css = this.app.css;
  1227. this.lp = this.app.lp;
  1228. this.configData = this.app.meetingConfig || {};
  1229. MWF.UD.getPublicData("meetingConfig", function(json){
  1230. var jsonData = json || {};
  1231. if (jsonData.process){
  1232. this.configData.process = jsonData.process;
  1233. }else{
  1234. this.configData.process = "";
  1235. }
  1236. this.load();
  1237. }.bind(this));
  1238. },
  1239. load: function(){
  1240. this.node = new Element("div", {"styles": this.css.configNode}).inject(this.app.node);
  1241. this.contentNode = new Element("div", {"styles": this.css.configContentNode}).inject(this.node);
  1242. var html = "<div class='line'><div class='configTitle'>"+this.lp.config.navi+
  1243. "</div><div><input type='checkbox' "+((this.configData.hideMenu!="static") ? "checked" : "")+" value='auto' />"+this.lp.config.autoHide+"</div></div>" +
  1244. "<div class='line'><div class='configTitle'>"+this.lp.config["default"]+"</div><div>" +
  1245. "<input type='radio' name='configSelectDefaultView' "+(((!this.configData.defaultView) || this.configData.defaultView=="toMyMeeting") ? "checked" : "")+" value='toMyMeeting'>"+this.lp.myMeeting+
  1246. "<input type='radio' name='configSelectDefaultView' "+((this.configData.defaultView=="toMonth") ? "checked" : "")+" value='toMonth'>"+this.lp.month+
  1247. "<input type='radio' name='configSelectDefaultView' "+((this.configData.defaultView=="toDay") ? "checked" : "")+" value='toDay'>"+this.lp.day+
  1248. "<input type='radio' name='configSelectDefaultView' "+((this.configData.defaultView=="toList") ? "checked" : "")+" value='toList'>"+this.lp.list+
  1249. "<input type='radio' name='configSelectDefaultView' "+((this.configData.defaultView=="toRoom") ? "checked" : "")+" value='toRoom'>"+this.lp.room+"</div></div>" +
  1250. "<div class='line'><div class='configTitle'>"+this.lp.config.legend+"</div><div style='overflow: hidden; height: 50px'>" +
  1251. "<div style='float: left; width: 80px; height: 20px;margin-right:10px'>" +
  1252. "<div style='float: left; width: 10px; height: 20px; background-color:#2968cf'></div>" +
  1253. "<div style='margin-left:15px; line-height:20px; height:20px'>"+this.lp.config.wait+"</div></div>" +
  1254. "<div style='float: left; width: 80px; height: 20px;margin-right:10px'>" +
  1255. "<div style='float: left; width: 10px; height: 20px; background-color:#18da14'></div>" +
  1256. "<div style='margin-left:15px; line-height:20px; height:20px'>"+this.lp.config.progress+"</div></div>" +
  1257. "<div style='float: left; width: 80px; height: 20px;margin-right:10px'>" +
  1258. "<div style='float: left; width: 10px; height: 20px; background-color:#ecd034'></div>" +
  1259. "<div style='margin-left:15px; line-height:20px; height:20px'>"+this.lp.config.invite+"</div></div>" +
  1260. "<div style='float: left; width: 80px; height: 20px;margin-right:10px'>" +
  1261. "<div style='float: left; width: 10px; height: 20px; background-color:#555555'></div>" +
  1262. "<div style='margin-left:15px; line-height:20px; height:20px'>"+this.lp.config.completed+"</div></div>" +
  1263. "</div></div>"+
  1264. "<div class='line'><div class='configTitle'>"+this.lp.config.applyProcess+"</div><div></div></div>";;
  1265. this.contentNode.set("html", html);
  1266. this.contentNode.getElements("div.line").setStyles(this.css.configContentLine);
  1267. this.contentNode.getElements("div.configTitle").setStyles(this.css.configTitleDiv);
  1268. this.processNode = this.contentNode.getLast("div").getLast("div");
  1269. if (this.app.isManager && false){ //@todo no process
  1270. this.createApplicationSelect();
  1271. }else{
  1272. this.contentNode.getLast("div").setStyle("display", "none");
  1273. }
  1274. this.actionNode = new Element("div", {"styles": this.css.configActionNode}).inject(this.node);
  1275. this.cancelNode = new Element("div", {"styles": this.css.configActionCancelNode, "text": this.app.lp.cancel}).inject(this.actionNode);
  1276. this.saveNode = new Element("div", {"styles": this.css.configActionSaveNode, "text": this.app.lp.save}).inject(this.actionNode);
  1277. this.cancelNode.addEvent("click", this.hide.bind(this));
  1278. this.saveNode.addEvent("click", this.save.bind(this));
  1279. this.node.addEvent("mousedown", function(e){e.stopPropagation();}.bind(this));
  1280. this.show();
  1281. },
  1282. createApplicationSelect: function(){
  1283. MWF.xDesktop.requireApp("process.ApplicationExplorer", "Actions.RestActions", function(){
  1284. this.appActions = new MWF.xApplication.process.ApplicationExplorer.Actions.RestActions();
  1285. this.getCurrentProcess(function(){
  1286. this.applicationSelect = new Element("select").inject(this.processNode);
  1287. var op = new Element("option", {"text": "", "value": "", "selected": true}).inject(this.applicationSelect);
  1288. this.appActions.listApplication("", function(json){
  1289. json.data.each(function(app){
  1290. var op = new Element("option", {
  1291. "text": app.name,
  1292. "value": app.id,
  1293. "selected": (this.currentProcess) ? (this.currentProcess.application==app.id) : false
  1294. }).inject(this.applicationSelect);
  1295. }.bind(this));
  1296. if (this.applicationSelect.selectedIndex && this.applicationSelect.selectedIndex!=0){
  1297. var id = this.applicationSelect.options[this.applicationSelect.selectedIndex].get("value");
  1298. if (id) this.createProcessSelect(id);
  1299. }
  1300. this.applicationSelect.addEvent("change", function(){
  1301. var id = this.applicationSelect.options[this.applicationSelect.selectedIndex].get("value");
  1302. this.createProcessSelect(id);
  1303. }.bind(this));
  1304. }.bind(this))
  1305. }.bind(this));
  1306. }.bind(this));
  1307. },
  1308. createProcessSelect: function(id){
  1309. if (id){
  1310. if (!this.processSelect){
  1311. this.processSelect = new Element("select").inject(this.processNode);
  1312. }else{
  1313. this.processSelect.empty();
  1314. }
  1315. var op = new Element("option", {"text": "", "value": "", "selected": true}).inject(this.processSelect);
  1316. this.appActions.listProcess(id, function(json){
  1317. json.data.each(function(process){
  1318. var op = new Element("option", {
  1319. "text": process.name,
  1320. "value": process.id,
  1321. "selected": (this.currentProcess) ? (this.currentProcess.id==process.id) : false
  1322. }).inject(this.processSelect);
  1323. }.bind(this));
  1324. }.bind(this));
  1325. }else{
  1326. if (this.processSelect){
  1327. this.processSelect.destroy();
  1328. this.processSelect = null;
  1329. }
  1330. }
  1331. },
  1332. getCurrentProcess: function(callback){
  1333. if (this.configData.process){
  1334. this.appActions.getProcess(this.configData.process, function(json){
  1335. this.currentProcess = json.data;
  1336. if (callback) callback();
  1337. }.bind(this));
  1338. }else{
  1339. this.currentProcess = null;
  1340. if (callback) callback();
  1341. }
  1342. },
  1343. save: function(){
  1344. var hideMenu = "auto";
  1345. var defaultView = "toMyMeeting";
  1346. var process = "";
  1347. var node = this.contentNode.getFirst("div");
  1348. var hideMenuNode = node.getElement("input");
  1349. if (hideMenuNode) if (!hideMenuNode.checked) hideMenu = "static";
  1350. node = node.getNext();
  1351. var viewNodes = node.getElements("input");
  1352. for (var i=0; i<viewNodes.length; i++){
  1353. if (viewNodes[i].checked){
  1354. defaultView = viewNodes[i].get("value");
  1355. break;
  1356. }
  1357. }
  1358. if (this.processSelect){
  1359. process = this.processSelect.options[this.processSelect.selectedIndex].get("value");
  1360. MWF.UD.putPublicData("meetingConfig", {"process": process});
  1361. }
  1362. MWF.UD.putData("meetingConfig", {"hideMenu": hideMenu, "defaultView": defaultView});
  1363. this.hide();
  1364. },
  1365. show: function(){
  1366. this.node.setStyles(this.css.configNode);
  1367. var fx = new Fx.Morph(this.node, {
  1368. "duration": "500",
  1369. "transition": Fx.Transitions.Expo.easeOut
  1370. });
  1371. fx.start({
  1372. "opacity": 1
  1373. }).chain(function(){
  1374. this.hideFun = this.hide.bind(this);
  1375. this.app.content.addEvent("mousedown", this.hideFun);
  1376. }.bind(this));
  1377. },
  1378. hide: function(){
  1379. this.node.destroy();
  1380. this.app.content.removeEvent("mousedown", this.hideFun);
  1381. MWF.release(this);
  1382. }
  1383. });