Common.js 93 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222
  1. MWF.xDesktop.requireApp("Template", "MPopupForm", null, false);
  2. MWF.xDesktop.requireApp("Template", "MTooltips", null, false);
  3. MWF.require("MWF.widget.O2Identity", null, false);
  4. MWF.xDesktop.requireApp("Selector", "package", null, false);
  5. MWF.require("MWF.widget.AttachmentController",null,false);
  6. MWF.xApplication.Meeting = MWF.xApplication.Meeting || {};
  7. MWF.xApplication.Meeting.BuildingForm = new Class({
  8. Extends: MPopupForm,
  9. Implements: [Options, Events],
  10. options: {
  11. "style": "meeting",
  12. "width": "800",
  13. "height": "300",
  14. "hasTop": true,
  15. "hasIcon": false,
  16. "hasTopIcon" : false,
  17. "hasTopContent" : false,
  18. "hasBottom": false,
  19. "draggable": true,
  20. "closeAction": true
  21. },
  22. _createTableContent: function () {
  23. this.formTopTextNode.set( "text", this.lp.editBuilding );
  24. var html = "<table width='100%' bordr='0' cellpadding='7' cellspacing='0' styles='formTable'>" +
  25. "<tr><td styles='formTableTitle' lable='name'></td>" +
  26. " <td styles='formTableValue' item='name' colspan='3' ></td></tr>" +
  27. "<tr><td styles='formTableTitle' lable='address'></td>" +
  28. " <td styles='formTableValue' item='address' colspan='3'></td></tr>" +
  29. "<tr><td styles='formTableTitle'></td>" +
  30. " <td styles='formTableValue' colspan='3' style='padding-top: 30px;'>"+
  31. " <div item='saveAction' style='float:left;display:"+ ( (this.isEdited || this.isNew) ? "" : "none") +";'></div>"+
  32. " <div item='removeAction' style='float:left;display:"+ ( this.isEdited ? "" : "none") +";'></div>"+
  33. " <div item='cancelAction' style='"+( (this.isEdited || this.isNew ) ? "float:left;" : "float:right;margin-right:15px;")+"'></div>"+
  34. " </td></tr>" +
  35. "</table>";
  36. this.formTableArea.set("html", html);
  37. MWF.xDesktop.requireApp("Template", "MForm", function () {
  38. this.form = new MForm(this.formTableArea, this.data, {
  39. isEdited: this.isEdited || this.isNew,
  40. style : "meeting",
  41. itemTemplate: {
  42. name: { text : this.lp.name, notEmpty : true },
  43. address: { text : this.lp.address },
  44. saveAction : { type : "button", className : "inputOkButton", value : this.lp.save, event : {
  45. click : function(){ this.save();}.bind(this)
  46. } },
  47. removeAction : { type : "button", className : "inputCancelButton", value : this.lp.delete , event : {
  48. click : function( item, ev ){ this.removeBuilding(ev); }.bind(this)
  49. } },
  50. cancelAction : { type : "button", className : "inputCancelButton", value : this.lp.close , event : {
  51. click : function(){ this.close(); }.bind(this)
  52. } }
  53. }
  54. }, this.app);
  55. this.form.load();
  56. }.bind(this), true);
  57. },
  58. save: function(){
  59. var data = this.form.getResult(true,null,true,false,true);
  60. this.actions.saveBuilding( data, function(json){
  61. this.app.notice(this.lp.save_success, "success");
  62. var view = this.view;
  63. this.close();
  64. view.reload();
  65. }.bind(this));
  66. },
  67. removeBuilding: function(e) {
  68. var info = this.app.lp.delete_building;
  69. info = info.replace(/{name}/g, this.data.name);
  70. var _self = this;
  71. this.app.confirm("warn", e, this.app.lp.delete_building_title, info, 300, 120, function(){
  72. _self.remove();
  73. this.close();
  74. }, function(){
  75. this.close();
  76. });
  77. },
  78. remove: function(){
  79. var view = this.view;
  80. this.app.actions.deleteBuilding(this.data.id, function(){
  81. view.reload();
  82. }.bind(this));
  83. }
  84. });
  85. MWF.xApplication.Meeting.BuildingTooltip = new Class({
  86. Extends: MTooltips,
  87. _loadCustom : function( callback ){
  88. this.loadActionBar();
  89. if(callback)callback();
  90. },
  91. _getHtml : function(){
  92. var data = this.data;
  93. var html =
  94. "<div item='containr' style='height:16px;line-height:16px;'><div style='font-size: 14px;color:#666;float:left; '>"+ (data.address ? data.address : this.lp.noAddress) +"</div></div>";
  95. return html;
  96. },
  97. loadActionBar : function(){
  98. if( MWF.AC.isMeetingAdministrator() ){
  99. //this.actionBar = new Element("div", {
  100. // "styles": this.css.actionBar
  101. //}).inject(this.node);
  102. var container = this.node.getElement("[item='containr']");
  103. this.editAction = new Element("div", {
  104. styles: this.css.action_edit,
  105. title : this.lp.editAddress,
  106. events : {
  107. mouseover : function(){
  108. this.editAction.setStyles( this.css.action_edit_over );
  109. }.bind(this),
  110. mouseout : function(){
  111. this.editAction.setStyles( this.css.action_edit );
  112. }.bind(this),
  113. click : function(){
  114. this.editBuilding()
  115. }.bind(this)
  116. }
  117. }).inject(container);
  118. this.removeAction = new Element("div", {
  119. styles: this.css.action_remove,
  120. title: this.lp.removeBuilding,
  121. events : {
  122. mouseover : function(){
  123. this.removeAction.setStyles( this.css.action_remove_over );
  124. }.bind(this),
  125. mouseout : function(){
  126. this.removeAction.setStyles( this.css.action_remove );
  127. }.bind(this),
  128. click : function( e ){
  129. this.removeBuilding(e);
  130. }.bind(this)
  131. }
  132. }).inject(container);
  133. }
  134. },
  135. editBuilding : function(){
  136. var form = new MWF.xApplication.Meeting.BuildingForm(this,this.data, {}, {app:this.app});
  137. form.edit();
  138. },
  139. removeBuilding: function(e) {
  140. this.app.actions.getBuilding( this.data.id, function( json ){
  141. if( json.data.roomList && json.data.roomList.length > 0 ){
  142. this.app.notice( this.app.lp.delete_building_hasRoom.replace(/{name}/g, this.data.name),"error", e.target );
  143. }else{
  144. var info = this.app.lp.delete_building;
  145. info = info.replace(/{name}/g, this.data.name);
  146. var _self = this;
  147. this.app.confirm("warn", e, this.app.lp.delete_building_title, info, 300, 120, function(){
  148. _self.remove();
  149. this.close();
  150. }, function(){
  151. this.close();
  152. });
  153. }
  154. }.bind(this));
  155. },
  156. remove: function(){
  157. var view = this.view;
  158. this.app.actions.deleteBuilding(this.data.id, function(){
  159. view.reload();
  160. }.bind(this));
  161. },
  162. reload : function(){
  163. this.view.reload();
  164. }
  165. });
  166. MWF.xApplication.Meeting.RoomForm = new Class({
  167. Extends: MPopupForm,
  168. Implements: [Options, Events],
  169. options: {
  170. "style": "meeting",
  171. "width": "900",
  172. "height": "500",
  173. "hasTop": true,
  174. "hasIcon": false,
  175. "hasTopIcon" : false,
  176. "hasTopContent" : false,
  177. "hasBottom": false,
  178. "draggable": true,
  179. "closeAction": true
  180. },
  181. _createTableContent: function () {
  182. if( this.isNew ){
  183. this.formTopTextNode.set( "text", this.lp.addRoom );
  184. }else if( this.isEdited ){
  185. this.formTopTextNode.set( "text", this.lp.editRoom );
  186. //this.options.height = "550";
  187. }else{
  188. this.formTopTextNode.set( "text", this.lp.room );
  189. //this.options.height = "460";
  190. }
  191. var lp = this.lp.roomForm;
  192. var editEnable = ( !this.isEdited && !this.isNew && MWF.AC.isMeetingAdministrator() );
  193. var boxStyle = (this.isEdited || this.isNew) ? "border:1px solid #ccc; border-radius: 4px;overflow: hidden;padding:8px;" : "";
  194. var html = "<table width='100%' bordr='0' cellpadding='7' cellspacing='0' styles='formTable'>" +
  195. //"<tr><td colspan='2' styles='formTableHead'>申诉处理单</td></tr>" +
  196. "<tr><td styles='formTableTitle'>"+ lp.name+":</td>" +
  197. " <td styles='formTableValue' item='name' colspan='3' ></td></tr>" +
  198. "<tr><td styles='formTableTitle'>"+ lp.building +":</td>" +
  199. " <td styles='formTableValue' item='buildingName' colspan='3'></td></tr>" +
  200. "<tr><td styles='formTableTitle'>"+ lp.floor +":</td>" +
  201. " <td styles='formTableValue' item='floor'></td>"+
  202. " <td styles='formTableTitle2'>"+ lp.capacity +":</td>" +
  203. " <td styles='formTableValue' item='capacity'></td></tr>" +
  204. "<tr><td styles='formTableTitle'>"+lp.roomNumber+":</td>" +
  205. " <td styles='formTableValue' item='roomNumber'></td>" +
  206. " <td styles='formTableTitle2'>"+lp.phone+":</td>" +
  207. " <td styles='formTableValue' item='phoneNumber'></td></tr>" +
  208. "<tr><td styles='formTableTitle'>"+lp.device+":</td>" +
  209. " <td styles='formTableValue' colspan='3'>" +
  210. " <div item='deviceList' style='"+ boxStyle +"'></div>" +
  211. "</td></tr>" +
  212. "<tr><td styles='formTableTitle'>"+lp.available+":</td>" +
  213. " <td styles='formTableValue' colspan='3'>" +
  214. " <div item='available' style='"+ boxStyle +"'></div>" +
  215. "</td></tr>" +
  216. "<tr><td styles='formTableTitle'></td>" +
  217. " <td styles='formTableValue' colspan='3' style='padding-top: 30px;'>"+
  218. " <div item='saveAction' style='float:left;display:"+ ( (this.isEdited || this.isNew) ? "" : "none") +";'></div>"+
  219. " <div item='editAction' style='float:left;display:"+ ( editEnable ? "" : "none") +";'></div>"+
  220. " <div item='removeAction' style='float:left;display:"+ ( this.isEdited ? "" : "none") +";'></div>"+
  221. " <div item='cancelAction' style='"+( (this.isEdited || this.isNew || editEnable) ? "float:left;" : "float:right;margin-right:15px;")+"'></div>"+
  222. " </td></tr>" +
  223. "</table>";
  224. this.formTableArea.set("html", html);
  225. var data = this.data || {};
  226. this.buildingId = data.building;
  227. if( this.buildingId ){
  228. this.getBuliding()
  229. }
  230. MWF.xDesktop.requireApp("Template", "MForm", function () {
  231. this.form = new MForm(this.formTableArea, data, {
  232. isEdited: this.isEdited || this.isNew,
  233. style : "meeting",
  234. itemTemplate: {
  235. name: { text : lp.name, notEmpty : true },
  236. buildingName: {
  237. text : lp.building, notEmpty : true,
  238. value : this.buildingName || "",
  239. event : {
  240. "click": function(){this.listBuilding();}.bind(this),
  241. //"blur": function(){}.bind(this),
  242. "change": function(){ this.buildingId = null; }.bind(this),
  243. "focus": function(){
  244. this.listBuildingHide();
  245. this.listBuilding();
  246. },
  247. "keydown": function(e){
  248. //if ([13,40,38].indexOf(e.code)!=-1){
  249. // if (!this.selectBuildingNode){
  250. // this.listBuilding();
  251. // }
  252. //}
  253. switch (e.code){
  254. case 13:
  255. this.listBuildingHide();
  256. this.listBuilding();
  257. break;
  258. case 40:
  259. this.selectBuildingNext();
  260. break;
  261. case 38:
  262. this.selectBuildingPrev();
  263. break;
  264. case 38:
  265. this.selectBuildingConfirm();
  266. break;
  267. default:
  268. // this.listBuildingHide();
  269. // this.listBuilding();
  270. }
  271. // if (e.code==13){
  272. // this.listBuildingHide();
  273. // this.listBuilding();
  274. // }
  275. // if (e.code==40) this.selectBuildingNext();
  276. // if (e.code==38) this.selectBuildingPrev();
  277. // if (e.code==32) this.selectBuildingConfirm(e);
  278. }.bind(this)
  279. }
  280. },
  281. floor: { type: "select", defaultValue: "1", notEmpty : true, text : lp.floor,
  282. selectText : function(){
  283. var floors = [];
  284. for (var i=-2; i<=50; i++){
  285. if( i != 0 )floors.push(i+ this.lp.floor )
  286. }
  287. return floors;
  288. }.bind(this), selectValue : function(){
  289. var floors = [];
  290. for (var i=-2; i<=50; i++){
  291. if( i != 0 )floors.push(i)
  292. }
  293. return floors;
  294. }.bind(this)
  295. },
  296. capacity: { notEmpty : true, tType: "number", text : lp.capacity },
  297. roomNumber: {},
  298. phoneNumber: {},
  299. deviceList: { type : "checkbox",
  300. value : this.data.device ? this.data.device.split("#") : "",
  301. selectValue : function(){ return Object.keys(this.lp.device); }.bind(this),
  302. selectText : function(){ return Object.values(this.lp.device); }.bind(this)
  303. },
  304. available: { type : "radio", defaultValue : "true",
  305. selectValue : [ "true", "false" ],
  306. selectText : [ this.lp.enable, this.lp.disable ]
  307. },
  308. saveAction : { type : "button", className : "inputOkButton", value : this.lp.save, event : {
  309. click : function(){ this.save();}.bind(this)
  310. } },
  311. removeAction : { type : "button", className : "inputCancelButton", value : this.lp.delete , event : {
  312. click : function( item, ev ){ this.removeRoom(ev); }.bind(this)
  313. } },
  314. editAction : { type : "button", className : "inputOkButton", value : this.lp.editRoom , event : {
  315. click : function(){ this.editRoom(); }.bind(this)
  316. } },
  317. cancelAction : { type : "button", className : "inputCancelButton", value : this.lp.close , event : {
  318. click : function(){ this.close(); }.bind(this)
  319. } }
  320. }
  321. }, this.app);
  322. this.form.load();
  323. }.bind(this), true);
  324. },
  325. editRoom : function(){
  326. this.formTopNode = null;
  327. if(this.setFormNodeSizeFun && this.app ){
  328. this.app.removeEvent("resize",this.setFormNodeSizeFun);
  329. }
  330. if( this.formMaskNode )this.formMaskNode.destroy();
  331. this.formAreaNode.destroy();
  332. this.edit();
  333. },
  334. getBuliding : function(){
  335. this.actions.getBuilding( this.buildingId, function(json){
  336. this.buildingName = json.data.name
  337. }.bind(this), null, false )
  338. },
  339. reset: function(){
  340. this.formTableArea.empty();
  341. this._createTableContent();
  342. },
  343. removeRoom: function(e) {
  344. var info = this.app.lp.delete_room;
  345. info = info.replace(/{name}/g, this.data.name);
  346. var _self = this;
  347. this.app.confirm("warn", e, this.app.lp.delete_building_title, info, 300, 120, function(){
  348. _self.remove();
  349. this.close();
  350. }, function(){
  351. this.close();
  352. });
  353. },
  354. remove: function(){
  355. var view = this.view;
  356. this.app.actions.deleteRoom(this.data.id, function(){
  357. view.reload();
  358. }.bind(this));
  359. },
  360. selectBuildingNext: function(){
  361. if (this.selectBuildingNode){
  362. var node=null;
  363. if (this.selectBuildingNode.selectedNode){
  364. node = this.selectBuildingNode.selectedNode.getNext();
  365. if (!node) node = this.selectBuildingNode.getFirst();
  366. this.selectBuildingNode.selectedNode.setStyle("background-color", this.selectBuildingNode.selectedNode.retrieve("bg"));
  367. }else{
  368. node = this.selectBuildingNode.getFirst();
  369. }
  370. if (node){
  371. var color = node.getStyle("background-color");
  372. node.store("bg", color);
  373. node.setStyles(this.css.createRoomBuildingSelectItem_over);
  374. this.selectBuildingNode.selectedNode = node;
  375. }
  376. }
  377. },
  378. selectBuildingPrev: function(){
  379. if (this.selectBuildingNode){
  380. var node = null;
  381. if (this.selectBuildingNode.selectedNode){
  382. var node = this.selectBuildingNode.selectedNode.getPrevious();
  383. if (!node) node = this.selectBuildingNode.getLast();
  384. this.selectBuildingNode.selectedNode.setStyle("background-color", this.selectBuildingNode.selectedNode.retrieve("bg"));
  385. }else{
  386. node = this.selectBuildingNode.getLast();
  387. }
  388. if (node){
  389. var color = node.getStyle("background-color");
  390. node.store("bg", color);
  391. node.setStyles(this.css.createRoomBuildingSelectItem_over);
  392. this.selectBuildingNode.selectedNode = node;
  393. }
  394. }
  395. },
  396. selectBuildingConfirm: function(e){
  397. if (this.selectBuildingNode.selectedNode){
  398. this.selectBuilding(this.selectBuildingNode.selectedNode);
  399. e.preventDefault();
  400. }
  401. },
  402. //cancelCreateRoom: function(){
  403. // this.createRoomNode.destroy();
  404. //},
  405. listBuildingData: function(key, callback){
  406. if (key){
  407. this.actions.listBuildingByKey(key, function(json){
  408. if (callback) callback(json);
  409. });
  410. }else{
  411. this.actions.listBuilding(function(json){
  412. if (callback) callback(json);
  413. });
  414. }
  415. },
  416. listBuilding: function(){
  417. var item = this.form.getItem("buildingName");
  418. var key = item.getValue();
  419. this.listBuildingData(key, function(json){
  420. if (json.data && json.data.length){
  421. this.selectBuildingNode = new Element("div", {"styles": this.css.createRoomSelectBuildingNode}).inject(item.container);
  422. this.setSelectBuildingNodeSize();
  423. this.listBuildingHideFun = this.listBuildingHide.bind(this);
  424. this.formMaskNode.addEvent("mousedown", this.listBuildingHideFun);
  425. this.formNode.addEvent("mousedown", this.listBuildingHideFun);
  426. var _self = this;
  427. json.data.each(function(building, idx){
  428. var node = new Element("div", {"styles": this.css.createRoomBuildingSelectItem}).inject(this.selectBuildingNode);
  429. var nameNode = new Element("div", {"styles": this.css.createRoomBuildingSelectItemName, "text": building.name}).inject(node);
  430. var addrNode = new Element("div", {"styles": this.css.createRoomBuildingSelectItemAddr, "text": building.address}).inject(node);
  431. if ((idx % 2)==1) node.setStyle("background-color", "#f1f6ff");
  432. node.store("building", building.id);
  433. node.addEvents({
  434. "mouseover": function(e){
  435. var color = this.getStyle("background-color");
  436. this.store("bg", color);
  437. this.setStyles(_self.css.createRoomBuildingSelectItem_over);
  438. },
  439. "mouseout": function(e){
  440. this.setStyle("background-color", this.retrieve("bg"));
  441. },
  442. "mousedown": function(e){e.stopPropagation();},
  443. "click": function(e){
  444. _self.selectBuilding(this);
  445. }
  446. });
  447. }.bind(this));
  448. }
  449. }.bind(this));
  450. // if( !key ){
  451. // listBuilding
  452. // }else{
  453. //
  454. // }
  455. // this.actions.listBuildingByKey(key, function(json){
  456. //
  457. // }.bind(this));
  458. },
  459. selectBuilding: function(node){
  460. var id = node.retrieve("building");
  461. var text = node.getFirst().get("text");
  462. this.form.getItem("buildingName").setValue(text);
  463. this.buildingId = id;
  464. this.listBuildingHide();
  465. },
  466. setSelectBuildingNodeSize: function(){
  467. var buildingInput = this.form.getItem("buildingName").getElements()[0];
  468. //var p = buildingInput.getPosition(buildingInput.getOffsetParent());
  469. this.selectBuildingNode.position({
  470. relativeTo: buildingInput,
  471. position: 'bottomLeft',
  472. edge: 'upperCenter',
  473. offset: {x: 4, y: 0}
  474. });
  475. //this.selectBuildingNode.setStyle("left", p.x);
  476. var size = buildingInput.getSize();
  477. var w = size.x-8;
  478. this.selectBuildingNode.setStyle("width", ""+w+"px");
  479. },
  480. listBuildingHide: function(){
  481. if (this.selectBuildingNode){
  482. //this.removeEvent("resize", this.setSelectBuildingNodeSizeFun);
  483. this.selectBuildingNode.destroy();
  484. this.selectBuildingNode = null;
  485. this.formMaskNode.removeEvent("mousedown", this.listBuildingHideFun);
  486. this.formNode.removeEvent("mousedown", this.listBuildingHideFun);
  487. }
  488. },
  489. save: function(){
  490. this.getData(function(data){
  491. this.actions.saveRoom(data, function(json){
  492. this.app.notice(this.lp.roomForm.save_success, "success");
  493. var view = this.view;
  494. this.close();
  495. view.reload();
  496. }.bind(this));
  497. }.bind(this));
  498. },
  499. getData: function(callback){
  500. var data = this.form.getResult(true,null,true,false,true);
  501. if( !data )return;
  502. data.device = data.deviceList.join("#");
  503. data.available = data.available == "true";
  504. if (!this.buildingId){
  505. this.actions.saveBuilding({"name": data.buildingName, "address": ""}, function(json){
  506. data.building = json.data.id;
  507. if (callback) callback(data);
  508. }.bind(this));
  509. }else{
  510. data.building = this.buildingId;
  511. if (callback) callback(data);
  512. }
  513. }
  514. });
  515. MWF.xApplication.Meeting.RoomTooltip = new Class({
  516. Extends: MTooltips,
  517. _loadCustom : function( callback ){
  518. this.loadBuilding( function(){
  519. if(callback)callback();
  520. }.bind(this) );
  521. },
  522. _getHtml : function(){
  523. var data = this.data;
  524. var lp = this.lp.device;
  525. var titleStyle = "font-size:14px;color:#333";
  526. var valueStyle = "font-size:14px;color:#666;padding-right:20px";
  527. var device = [];
  528. data.device.split("#").each( function( d ){
  529. device.push( lp[d] );
  530. }.bind(this));
  531. lp = this.lp.roomForm;
  532. var html =
  533. "<div style='overflow: hidden;padding:15px 20px 20px 10px;height:16px;line-height:16px;'>" +
  534. " <div style='font-size: 16px;color:#333;float: left'>"+ this.lp.room +"</div>"+
  535. "</div>"+
  536. "<div style='font-size: 18px;color:#333;padding:0px 10px 15px 20px;'>"+ data.name +"</div>"+
  537. "<div style='height:1px;margin:0px 20px;border-bottom:1px solid #ccc;'></div>"+
  538. "<table width='100%' bordr='0' cellpadding='7' cellspacing='0' style='margin:13px 13px 13px 13px;'>" +
  539. "<tr><td style='"+titleStyle+"' width='100'>"+ lp.building+":</td>" +
  540. " <td style='"+valueStyle+"' item='building'></td></tr>" +
  541. "<tr><td style='"+titleStyle+"'>" + lp.floor+":</td>" +
  542. " <td style='"+valueStyle+"'>" + data.floor + "</td></tr>" +
  543. "<tr><td style='"+titleStyle+"'>"+ lp.capacity +":</td>" +
  544. " <td style='"+valueStyle+"'>"+ data.capacity+"</td></tr>" +
  545. "<tr><td style='"+titleStyle+"'>"+ lp.roomNumber +":</td>" +
  546. " <td style='"+valueStyle+"'>"+ data.roomNumber+"</td></tr>" +
  547. "<tr><td style='"+titleStyle+"'>"+ lp.phone+":</td>" +
  548. " <td style='"+valueStyle+"'>"+ data.phoneNumber +"</td></tr>" +
  549. "<tr><td style='"+titleStyle+"'>"+ lp.device +":</td>" +
  550. " <td style='"+valueStyle+"'>"+ device.join( "," ) +"</td></tr>"+
  551. "<tr><td style='"+titleStyle+"'>"+ lp.available +":</td>" +
  552. " <td style='"+valueStyle+"'>" + ( !data.available ? this.lp.disable : this.lp.enable ) + "</td></tr>"+
  553. "</table>";
  554. return html;
  555. },
  556. loadBuilding: function( callback ){
  557. var area = this.node.getElement("[item='building']");
  558. if (this.data.building){
  559. this.app.actions.getBuilding(this.data.building, function(bjson){
  560. area.set("text", bjson.data.name );
  561. if( callback )callback();
  562. }.bind(this));
  563. }
  564. }
  565. });
  566. MWF.xApplication.Meeting.MeetingForm = new Class({
  567. Extends: MPopupForm,
  568. Implements: [Options, Events],
  569. options: {
  570. "style": "meeting",
  571. "width": "900",
  572. "height": "640",
  573. "hasTop": true,
  574. "hasIcon": false,
  575. "hasTopIcon" : false,
  576. "hasTopContent" : false,
  577. "hasBottom": false,
  578. "draggable": true,
  579. "closeAction": true,
  580. "maxAction" : true
  581. },
  582. open: function (e) {
  583. this.fireEvent("queryOpen");
  584. this.isNew = false;
  585. this.isEdited = false;
  586. this.getMeetingData( function(){
  587. this._open();
  588. }.bind(this));
  589. this.fireEvent("postOpen");
  590. },
  591. create: function () {
  592. this.fireEvent("queryCreate");
  593. this.isNew = true;
  594. this._open();
  595. this.fireEvent("postCreate");
  596. },
  597. edit: function () {
  598. this.fireEvent("queryEdit");
  599. this.isEdited = true;
  600. this.getMeetingData( function(){
  601. this._open();
  602. }.bind(this));
  603. this.fireEvent("postEdit");
  604. },
  605. _createTableContent: function () {
  606. this.userName = layout.desktop.session.user.distinguishedName;
  607. this.userId = layout.desktop.session.user.id;
  608. if( this.isNew ){
  609. this.formTopTextNode.set( "text", this.lp.addMeeting );
  610. }else if( this.isEdited ){
  611. this.formTopTextNode.set( "text", this.lp.editMeeting );
  612. this.options.height = "610";
  613. }else{
  614. this.formTopTextNode.set( "text", this.lp.metting );
  615. this.options.height = "540";
  616. }
  617. var defaultDate, defaultBeginTime, date1, defaultEndTime;
  618. if( this.options.date || this.options.minute ){
  619. this.date = typeOf( this.options.date )=="string" ? Date.parse( this.options.date ) : this.options.date;
  620. defaultDate = this.date.clone().format("%Y-%m-%d");
  621. if( this.date.getHours() ){
  622. defaultBeginTime = this.getString( this.date.getHours() )+":"+ this.getString( this.date.getMinutes() );
  623. date1 = this.date.clone().increment("hour", this.options.hour ? parseInt( this.options.hour ) : 1 );
  624. if(this.options.minute)date1 = date1.increment("minute", parseInt( this.options.minute ) );
  625. defaultEndTime = this.getString( date1.getHours() )+":"+ this.getString( date1.getMinutes() );
  626. }else{
  627. var now = new Date();
  628. defaultBeginTime = (now.getHours()+1)+":"+"00";
  629. date1 = now.clone().increment("hour", this.options.hour ? parseInt( this.options.hour ) : 1 );
  630. if(this.options.minute)date1 = date1.increment("minute", parseInt( this.options.minute ) );
  631. defaultEndTime = (date1.getHours()+1)+":"+"00";
  632. }
  633. }else{
  634. this.date = new Date();
  635. defaultDate = this.date.clone().format("%Y-%m-%d");
  636. defaultBeginTime = (this.date.getHours()+1)+":"+"00";
  637. date1 = this.date.clone().increment("hour", this.options.hour ? parseInt( this.options.hour ) : 1 );
  638. if(this.options.minute)date1 = date1.increment("minute", parseInt( this.options.minute ) );
  639. defaultEndTime = (date1.getHours()+1)+":"+"00";
  640. }
  641. this.formTableArea.setStyle("position","relative");
  642. var data = this.data;
  643. var isEditer = this.userName == this.data.applicant || this.userId == this.data.applicant || MWF.AC.isMeetingAdministrator();
  644. var editEnable = ( !this.isEdited && !this.isNew && this.data.status == "wait" && isEditer );
  645. var html = "<div item='qrCode' style='position: absolute;right:0px;top:-20px;width:100px;height:130px;'></div><table width='100%' bordr='0' cellpadding='7' cellspacing='0' styles='formTable'>" +
  646. //"<tr><td colspan='2' styles='formTableHead'>申诉处理单</td></tr>" +
  647. "<tr>"+
  648. " <td styles='formTableTitle' width='70'>"+this.lp.applyPerson+":</td>" +
  649. " <td styles='formTableValue' item='applicant'></td>" +
  650. "</tr>"+
  651. "<tr><td styles='formTableTitle' width='100'>"+this.lp.beginDate+":</td>" +
  652. " <td styles='formTableValue' item='dateInput'></td>" +
  653. "</tr>" +
  654. "<tr><td styles='formTableTitle'>"+ this.lp.time +":</td>" +
  655. " <td styles='formTableValue'>" +
  656. " <div item='beginTimeInput' style='float:left'></div>"+
  657. " <div style='float:left; "+ ( this.isNew ? "margin:5px;" : "margin:0px 5px;") + "'>"+ this.lp.to+ "</div>"+
  658. " <div item='endTimeInput' style='float:left'></div>"+
  659. " </td></tr>" +
  660. "<tr><td styles='formTableTitle'>"+ this.lp.selectRoom +":</td>" +
  661. " <td styles='formTableValue' item='meetingRoom'></td></tr>" +
  662. "<tr><td styles='formTableTitle'>"+this.lp.invitePerson2+":</td>" +
  663. " <td styles='formTableValue'>" +
  664. " <div item='invitePersonList'></div>" +
  665. " <div style='display:"+ ( this.isEdited ? "" : "none") +";' item='selectinvitePerson'></div>" +
  666. (( !this.isNew && this.data.myWaitAccept ) ?
  667. " <tr><td></td><td styles='formTableValue'><div item='acceptAction'></div><div item='rejectAction'></div></td></tr>" : ""
  668. ) +
  669. " </td>" +
  670. "</tr>" +
  671. "<tr style='display:"+ ( this.isNew ? "none" : "") +" ;' item='checkPersonTr'><td styles='formTableTitle'>签到人员:</td>" +
  672. " <td styles='formTableValue' item='checkinPersonList'></td></tr>" +
  673. "<tr><td styles='formTableTitle'>"+this.lp.meetingSubject+":</td>" +
  674. " <td styles='formTableValue' item='subject'></td></tr>" +
  675. "<tr><td styles='formTableTitle'>"+this.lp.meetingDescription+":</td>" +
  676. " <td styles='formTableValue' item='summary'></td></tr>" +
  677. "<tr style='display:none ;' item='attachmentTr'><td styles='formTableTitle'>"+this.lp.meetingAttachment+":</td>" +
  678. " <td styles='formTableValue' item='attachment'></td></tr>" +
  679. "<tr><td styles='formTableTitle'></td>" +
  680. " <td styles='formTableValue' style='padding-top: 10px;'>"+
  681. " <div item='saveAction' style='float:left;display:"+ ( (this.isEdited || this.isNew) ? "" : "none") +";'></div>"+
  682. " <div item='editAction' style='float:left;display:"+ ( editEnable ? "" : "none") +";'></div>"+
  683. " <div item='removeAction' style='float:left;display:"+ ( this.isEdited ? "" : "none") +";'></div>"+
  684. " <div item='cancelAction' style='"+( (this.isEdited || this.isNew || editEnable) ? "float:left;" : "float:right;margin-right:15px;")+"'></div>"+
  685. " </td></tr>" +
  686. "</table>";
  687. this.formTableArea.set("html", html);
  688. if( data.startTime ){
  689. var beignDate = Date.parse( data.startTime );
  690. data.dateInput = beignDate.format("%Y-%m-%d");
  691. data.beginTimeInput = this.getString( beignDate.getHours() ) + ":" + this.getString( beignDate.getMinutes() );
  692. }
  693. if( data.completedTime ){
  694. var endDate = Date.parse( data.completedTime );
  695. data.endTimeInput = this.getString( endDate.getHours() ) + ":" + this.getString( endDate.getMinutes() );
  696. }
  697. this.meetingRoomArea = this.formTableArea.getElement("[item='meetingRoom']");
  698. this.attachmentTr = this.formTableArea.getElement("[item='attachmentTr']");
  699. this.attachmentArea = this.formTableArea.getElement("[item='attachment']");
  700. this.qrCodeArea = this.formTableArea.getElement("[item='qrCode']");
  701. MWF.xDesktop.requireApp("Template", "MForm", function () {
  702. this.form = new MForm(this.formTableArea, data, {
  703. isEdited: this.isEdited || this.isNew,
  704. style : "meeting",
  705. itemTemplate: {
  706. applicant : { type : "org", orgType : "person", isEdited : false,
  707. defaultValue : this.userName
  708. },
  709. dateInput: {tType: "date", isEdited : this.isNew, defaultValue: defaultDate,
  710. event : {
  711. change : function( item, ev ){
  712. this.clearRoom();
  713. }.bind(this)
  714. }
  715. },
  716. beginTimeInput: { tType: "time", isEdited : this.isNew,
  717. defaultValue: defaultBeginTime, className : ( this.isNew ? "inputTimeUnformatWidth" : "" ),
  718. event : {
  719. change : function( item, ev ){
  720. this.clearRoom();
  721. }.bind(this)
  722. }
  723. },
  724. endTimeInput: { tType: "time", isEdited : this.isNew,
  725. defaultValue: defaultEndTime, className : ( this.isNew ? "inputTimeUnformatWidth" : "" ),
  726. event : {
  727. change : function( item, ev ){
  728. this.clearRoom();
  729. }.bind(this)
  730. }
  731. },
  732. invitePersonList: { type: "org", isEdited : this.isNew, orgType: ["identity","person"], count : 0, orgWidgetOptions : {
  733. "onLoadedInfor": function(item){
  734. this.loadAcceptAndReject( item );
  735. }.bind(this)
  736. }},
  737. checkinPersonList : { type: "org", isEdited : false, orgType: ["identity","person"], count : 0},
  738. selectinvitePerson : { type : "button", value : this.lp.addInvitePerson1, style : {"margin-left": "20px"}, event : {
  739. click : function( it ){
  740. var options = {
  741. "type" : "",
  742. "types": ["identity","person"],
  743. "values": [],
  744. "count": 0,
  745. "onComplete": function(items){
  746. MWF.require("MWF.widget.O2Identity", function(){
  747. var invitePersonList = [];
  748. items.each(function(item){
  749. var _self = this;
  750. if( item.data.distinguishedName.split("@").getLast().toLowerCase() == "i" ){
  751. var person = new MWF.widget.O2Identity(item.data, it.form.getItem("invitePersonList").container, {"style": "room"});
  752. invitePersonList.push( item.data.distinguishedName );
  753. }else{
  754. var person = new MWF.widget.O2Person(item.data, it.form.getItem("invitePersonList").container, {"style": "room"});
  755. invitePersonList.push(item.data.distinguishedName);
  756. }
  757. }.bind(this));
  758. this.app.actions.addMeetingInvite(this.data.id, {"invitePersonList": invitePersonList, "id": this.data.id}, function(json){
  759. this.app.actions.getMeeting(json.data.id, function(meeting){
  760. this.invitePersonList = meeting.data.invitePersonList;
  761. this.app.notice(this.app.lp.addedInvitePerson1, "success", this.node );
  762. }.bind(this));
  763. }.bind(this));
  764. }.bind(this));
  765. }.bind(this)
  766. };
  767. var selector = new MWF.O2Selector(this.app.content, options);
  768. }.bind(this)
  769. } },
  770. subject: {},
  771. summary: {type: "textarea"},
  772. acceptAction : { type : "button", value : this.lp.accept, className : "inputAcceptButton",
  773. event : { click : function( it, ev ){ this.accept(ev); }.bind(this) }
  774. },
  775. rejectAction : { type : "button", value : this.lp.reject, style : {"margin-left": "20px"}, className : "inputDenyButton",
  776. event : { click : function( it, ev ){ this.reject(ev) }.bind(this) }
  777. },
  778. saveAction : { type : "button", className : "inputOkButton", value : this.lp.save, event : {
  779. click : function(){ this.save();}.bind(this)
  780. } },
  781. removeAction : { type : "button", className : "inputCancelButton", value : this.lp.cancelMeeting , event : {
  782. click : function( item, ev ){ this.cancelMeeting(ev); }.bind(this)
  783. } },
  784. editAction : { type : "button", className : "inputOkButton", value : this.lp.editMeeting , event : {
  785. click : function(){ this.editMeeting(); }.bind(this)
  786. } },
  787. cancelAction : { type : "button", className : "inputCancelButton", value : this.lp.close , event : {
  788. click : function(){ this.close(); }.bind(this)
  789. } }
  790. }
  791. }, this.app);
  792. this.form.load();
  793. this.loadSelectRoom();
  794. if( this.data.id )this.loadAttachment();
  795. if( isEditer && !this.isNew ){
  796. this.loadQrCode();
  797. }else{
  798. this.qrCodeArea.destroy();
  799. }
  800. }.bind(this), true);
  801. },
  802. getString : function( str ){
  803. var s = "00" + str;
  804. return s.substr(s.length - 2, 2 );
  805. },
  806. loadQrCode : function(){
  807. this.actions.getCheckinQrCode( this.data.id, function(json){
  808. var img = new Element("img",{
  809. src : "data:image/png;base64,"+json.data.image,
  810. styles : {
  811. width : "100px",
  812. height : "100px"
  813. }
  814. }).inject( this.qrCodeArea );
  815. var div = new Element("div",{
  816. text : "打印签到二维码",
  817. styles : {
  818. color : "#3c75b7",
  819. cursor : "pointer"
  820. },
  821. events : {
  822. click : function(){
  823. window.open( "/x_component_Meeting/$Main/qrPrint.html?meeting="+this.data.id, "_blank" );
  824. }.bind(this)
  825. }
  826. }).inject( this.qrCodeArea );
  827. }.bind(this));
  828. },
  829. loadAcceptAndReject : function( item ){
  830. var personName = item.data.distinguishedName;
  831. if(this.data.acceptPersonList){
  832. if (this.data.acceptPersonList.indexOf(personName)!==-1){
  833. var acceptNode = new Element("div", {"styles": this.css.acceptIconNode}).inject(item.node, "top");
  834. new Element("div", {
  835. "styles": this.css.acceptTextNode,
  836. "text": this.app.lp.accepted
  837. }).inject(item.inforNode);
  838. }
  839. }
  840. if(this.data.rejectPersonList){
  841. if (this.data.rejectPersonList.indexOf(personName)!==-1){
  842. var rejectNode = new Element("div", {"styles": this.css.rejectIconNode}).inject(item.node, "top");
  843. new Element("div", {
  844. "styles": this.css.rejectTextNode,
  845. "text": this.app.lp.rejected
  846. }).inject(item.inforNode);
  847. }
  848. }
  849. },
  850. getMeetingData : function( callback ){
  851. if( this.data && this.data.id ){
  852. ( this.app.actions || this.actions ).getMeeting( this.data.id, function( json ){
  853. this.data = json.data;
  854. if(callback)callback();
  855. }.bind(this))
  856. }else{
  857. if(callback)callback();
  858. }
  859. },
  860. editMeeting : function(){
  861. this.formTopNode = null;
  862. if(this.setFormNodeSizeFun && this.app ){
  863. this.app.removeEvent("resize",this.setFormNodeSizeFun);
  864. }
  865. if( this.formMaskNode )this.formMaskNode.destroy();
  866. this.formAreaNode.destroy();
  867. this.edit();
  868. },
  869. cancelMeeting: function(e){
  870. var _self = this;
  871. var text = this.app.lp.cancel_confirm.replace(/{name}/g, this.data.subject);
  872. this.app.confirm("infor", e, this.app.lp.cancel_confirm_title, text, 380, 200, function(){
  873. _self._cancelMeeting();
  874. this.close();
  875. _self.close();
  876. }, function(){
  877. this.close();
  878. });
  879. },
  880. _cancelMeeting: function(){
  881. var view = this.view;
  882. this.app.actions.deleteMeeting(this.data.id, function(){
  883. view.reload();
  884. }.bind(this))
  885. },
  886. reset: function(){
  887. this.formTableArea.empty();
  888. this._createTableContent();
  889. },
  890. clearRoom : function(){
  891. this.roomId = "";
  892. if(this.roomInput)this.roomInput.set("text", "");
  893. },
  894. loadSelectRoom: function(){
  895. var lineNode = new Element("div", {"styles": this.css.createMeetingInfoLineNode}).inject(this.meetingRoomArea);
  896. var editNode = new Element("div", {
  897. "styles": this.css.createMeetingInfoItemEditNode,
  898. "html": "<div></div>"
  899. }).inject(lineNode);
  900. this.roomInput = editNode.getFirst();
  901. this.roomInput.setStyles(this.css.createMeetingInfoItemDivNode);
  902. //var downNode = new Element("div", {"styles": this.css.createMeetingInfoItemDownNode}).inject(editNode);
  903. if( this.isNew ){
  904. this.roomInput.addEvents({
  905. "click": function(e){this.selectRooms();}.bind(this)
  906. });
  907. }
  908. var roomId = this.data.room || this.options.room;
  909. if (roomId){
  910. ( this.app.actions || this.actions ).getRoom(roomId, function(json){
  911. ( this.app.actions || this.actions ).getBuilding(json.data.building, function(bjson){
  912. this.roomId = roomId;
  913. this.roomInput.set("text", json.data.name+" ("+bjson.data.name+")");
  914. }.bind(this));
  915. }.bind(this));
  916. }
  917. },
  918. selectRooms: function(){
  919. this.createRoomNode(function(){
  920. this.loadSelectRooms();
  921. this.selectRoomNode.setStyle("display", "block");
  922. this.hideRoomNodeFun = this.hideRoomNode.bind(this);
  923. document.body.addEvent("mousedown", this.hideRoomNodeFun);
  924. //var p = this.selectRoomNode.getPosition(this.selectRoomNode.getOffsetParent());
  925. this.selectRoomNode.position({
  926. relativeTo: this.roomInput,
  927. position: 'bottomLeft',
  928. edge: 'upperLeft',
  929. offset: {x: 0, y: 0}
  930. });
  931. var size = this.roomInput.getSize();
  932. var w = size.x-2;
  933. this.selectRoomNode.setStyle("width", ""+w+"px");
  934. }.bind(this));
  935. },
  936. createRoomNode: function(callback){
  937. if (!this.selectRoomNode){
  938. this.selectRoomNode = new Element("div", {"styles": this.css.createMeetingInfoSelectRoomNode}).inject(this.formNode);
  939. this.selectRoomNode.addEvent("mousedown", function(e){e.stopPropagation();});
  940. if (callback) callback();
  941. }else{
  942. if (callback) callback();
  943. }
  944. },
  945. loadSelectRooms: function(){
  946. var result = this.form.getResult(false,null,false,false,true);
  947. var d = result.dateInput;
  948. var bt = result.beginTimeInput;
  949. var et = result.endTimeInput;
  950. var start = d+" "+bt;
  951. var completed = d+" "+et;
  952. this.app.actions.listBuildingByRange(start, completed, function(json){
  953. json.data.each(function(building){
  954. var node = new Element("div", {"styles": this.css.createMeetingInfoSelectRoomItem1Node}).inject(this.selectRoomNode);
  955. var nodeName = new Element("div", {"styles": this.css.createMeetingInfoSelectRoomItem1NameNode, "text": building.name}).inject(node);
  956. var nodeAddr = new Element("div", {"styles": this.css.createMeetingInfoSelectRoomItem1AddrNode, "text": building.address}).inject(node);
  957. building.roomList.each(function(room, i){
  958. if (room.available && room.idle) this.createRoomSelectNode(room, i, building);
  959. }.bind(this));
  960. }.bind(this));
  961. }.bind(this));
  962. },
  963. createRoomSelectNode: function(room, i, building){
  964. var roomNode = new Element("div", {"styles": this.css.roomTitleNode}).inject(this.selectRoomNode);
  965. var capacityNode = new Element("div", {"styles": this.css.roomTitleCapacityNode, "text": room.capacity+this.lp.person}).inject(roomNode);
  966. var inforNode = new Element("div", {"styles": this.css.roomTitleInforNode}).inject(roomNode);
  967. var node = new Element("div", {"styles": {"height": "20px"}}).inject(inforNode);
  968. var numberNode = new Element("div", {"styles": this.css.roomTitleNumberNode, "text": (room.roomNumber) ? "#"+room.roomNumber : ""}).inject(node);
  969. var nameNode = new Element("div", {"styles": this.css.roomTitleNameNode, "text": room.name}).inject(node);
  970. var iconsNode = new Element("div", {"styles": this.css.roomTitleIconsNode}).inject(inforNode);
  971. var deviceList = room.device.split("#");
  972. deviceList.each(function(name){
  973. var node = new Element("div", {"styles": this.css.roomTitleIconNode, "title": this.lp.device[name]}).inject(iconsNode);
  974. node.setStyle("background-image", "url(/x_component_Meeting/$RoomView/default/icon/device/"+name+"_disable.png)");
  975. }.bind(this));
  976. if ((i % 2)!=0) roomNode.setStyle("background-color", "#f4f8ff");
  977. roomNode.store("room", room);
  978. var _self = this;
  979. if (room.idle){
  980. roomNode.addEvents({
  981. "mouseover": function(e){
  982. var color = roomNode.getStyle("background-color");
  983. this.store("bgcolor", color);
  984. this.setStyle("background-color", "#e4edfc");
  985. },
  986. "mouseout": function(){
  987. var color = this.retrieve("bgcolor", "#FFF");
  988. this.setStyle("background-color", color);
  989. },
  990. "click": function(){
  991. var roomData = this.retrieve("room");
  992. _self.roomId = roomData.id;
  993. //roomNode.inject(_self.roomInput);
  994. _self.roomInput.set("text", roomData.name+" ("+building.name+")");
  995. _self.hideRoomNode();
  996. }
  997. });
  998. }else{
  999. roomNode.setStyle("background-color", "#fff6f6");
  1000. var disabledNode = new Element("div", {"styles": this.css.roomTitleDisabledIconNode}).inject(roomNode);
  1001. }
  1002. },
  1003. hideRoomNode: function(){
  1004. this.selectRoomNode.empty();
  1005. this.selectRoomNode.setStyle("display", "none");
  1006. document.body.removeEvent("mousedown", this.hideRoomNodeFun);
  1007. },
  1008. setCreateRoomSelectBuildingNodeSize: function(){
  1009. var p = this.createRoomBuildingInput.getPosition(this.createRoomBuildingInput.getOffsetParent());
  1010. this.createRoomSelectBuildingNode.position({
  1011. relativeTo: this.createRoomBuildingInput,
  1012. position: 'bottomCenter',
  1013. edge: 'upperCenter',
  1014. offset: {x: 0, y: 0}
  1015. });
  1016. this.createRoomSelectBuildingNode.setStyle("left", p.x);
  1017. var size = this.createRoomBuildingInput.getSize();
  1018. var w = size.x-2;
  1019. this.createRoomSelectBuildingNode.setStyle("width", ""+w+"px");
  1020. },
  1021. loadAttachment: function(){
  1022. this.attachmentTr.setStyle("display","");
  1023. this.attachmentNode = new Element("div", {"styles": this.css.createMeetingAttachmentNode}).inject(this.attachmentArea);
  1024. var attachmentContentNode = new Element("div", {"styles": this.css.createMeetingAttachmentContentNode}).inject(this.attachmentNode);
  1025. MWF.require("MWF.widget.AttachmentController", function(){
  1026. this.attachmentController = new MWF.widget.AttachmentController(attachmentContentNode, this, {
  1027. "size": "min",
  1028. "isSizeChange": false,
  1029. "isReplace": false,
  1030. "isUpload": this.isNew || this.isEdited,
  1031. "isDelete": this.isNew || this.isEdited,
  1032. "isDownload": true,
  1033. "readonly": !this.isNew && !this.isEdited
  1034. });
  1035. this.attachmentController.load();
  1036. if( this.data.attachmentList ){
  1037. this.data.attachmentList.each(function (att) {
  1038. att.person = att.lastUpdatePerson.split("@")[0];
  1039. var at = this.attachmentController.addAttachment(att);
  1040. }.bind(this));
  1041. }
  1042. }.bind(this));
  1043. },
  1044. uploadAttachment: function(e, node){
  1045. if (!this.uploadFileAreaNode){
  1046. this.createUploadFileNode();
  1047. }
  1048. this.fileUploadNode.click();
  1049. },
  1050. createUploadFileNode: function(){
  1051. this.uploadFileAreaNode = new Element("div");
  1052. var html = "<input name=\"file\" type=\"file\" multiple/>";
  1053. this.uploadFileAreaNode.set("html", html);
  1054. this.fileUploadNode = this.uploadFileAreaNode.getFirst();
  1055. this.fileUploadNode.addEvent("change", function(){
  1056. var files = this.fileUploadNode.files;
  1057. if (files.length){
  1058. for (var i = 0; i < files.length; i++) {
  1059. var file = files.item(i);
  1060. var formData = new FormData();
  1061. formData.append('file', file);
  1062. //formData.append('folder', folderId);
  1063. this.app.actions.addAttachment(this.data.id, formData, file, function(o, text){
  1064. if (o.id){
  1065. this.app.actions.getAttachment(o.id, function(json){
  1066. if (json.data) this.attachmentController.addAttachment(json.data);
  1067. this.attachmentController.checkActions();
  1068. }.bind(this))
  1069. }
  1070. this.attachmentController.checkActions();
  1071. }.bind(this));
  1072. }
  1073. }
  1074. }.bind(this));
  1075. },
  1076. deleteAttachments: function(e, node, attachments){
  1077. var names = [];
  1078. attachments.each(function(attachment){
  1079. names.push(attachment.data.name);
  1080. }.bind(this));
  1081. var _self = this;
  1082. this.app.confirm("warn", e, this.lp.deleteAttachmentTitle, this.lp.deleteAttachment+"( "+names.join(", ")+" )", 300, 120, function(){
  1083. while (attachments.length){
  1084. attachment = attachments.shift();
  1085. _self.deleteAttachment(attachment);
  1086. }
  1087. this.close();
  1088. }, function(){
  1089. this.close();
  1090. }, null);
  1091. },
  1092. deleteAttachment: function(attachment){
  1093. this.app.actions.deleteFile(attachment.data.id, function(josn){
  1094. this.attachmentController.removeAttachment(attachment);
  1095. this.attachmentController.checkActions();
  1096. }.bind(this));
  1097. },
  1098. downloadAttachment: function(e, node, attachments){
  1099. attachments.each(function(att){
  1100. this.app.actions.getFileDownload(att.data.id);
  1101. }.bind(this));
  1102. },
  1103. openAttachment: function(e, node, attachments){
  1104. attachments.each(function(att){
  1105. this.app.actions.getFile(att.data.id);
  1106. }.bind(this));
  1107. },
  1108. getAttachmentUrl: function(attachment, callback){
  1109. this.app.actions.getFileUrl(attachment.data.id, callback);
  1110. },
  1111. save: function(){
  1112. this._save(function(){
  1113. this.app.notice(this.lp.meeting_saveSuccess, "success");
  1114. if (!this.attachmentNode){
  1115. this.loadAttachment();
  1116. }
  1117. }.bind(this));
  1118. },
  1119. _save: function(callback){
  1120. this.getSaveData();
  1121. var now = new Date();
  1122. var errorText = "";
  1123. if (!this.data.subject) errorText +=this.lp.meeting_input_subject_error;
  1124. if (!this.data.room) errorText +=this.lp.meeting_input_room_error;
  1125. if (!this.data.invitePersonList.length) errorText +=this.lp.meeting_input_person_error;
  1126. if( this.data.startTimeDate ){
  1127. if (this.data.startTimeDate.diff(this.data.completedTimeDate, "minute")<1) errorText +=this.lp.meeting_input_time_error;
  1128. if (now.diff(this.data.startTimeDate, "minute")<0) errorText +=this.lp.meeting_input_date_error;
  1129. delete this.data.startTimeDate;
  1130. delete this.data.completedTimeDate;
  1131. }
  1132. if (errorText){
  1133. this.app.notice(this.lp.meeting_input_error+errorText, "error");
  1134. return false;
  1135. }
  1136. this.app.actions.saveMeeting(this.data, function(json){
  1137. this.data.id = json.data.id;
  1138. this.waitReload = true;
  1139. if (callback) callback();
  1140. }.bind(this));
  1141. },
  1142. getSaveData: function(){
  1143. this.data = this.form.getResult(false,null,false,false,true);
  1144. this.data.room = this.roomId;
  1145. if( this.invitePersonList ){
  1146. this.data.invitePersonList = this.invitePersonList;
  1147. }
  1148. var d = this.data.dateInput;
  1149. if( this.isNew ) {
  1150. var startTime = d + " " + this.data.beginTimeInput + ":0";
  1151. var completedTime = d + " " + this.data.endTimeInput + ":0";
  1152. var startTimeDate = Date.parse(startTime);
  1153. var completedTimeDate = Date.parse(completedTime);
  1154. this.data.startTime = startTime;
  1155. this.data.completedTime = completedTime;
  1156. this.data.startTimeDate = startTimeDate;
  1157. this.data.completedTimeDate = completedTimeDate;
  1158. }
  1159. if( this.isNew ){
  1160. delete this.data.applicant;
  1161. }else{
  1162. this.data.applicant = this.data.applicant.join(",")
  1163. }
  1164. },
  1165. getPersonByIdentity : function( identity ){
  1166. },
  1167. getPerson : function( source ){
  1168. if( typeOf(source) != "array" )source = [source];
  1169. var target = [];
  1170. source.each( function( s ){
  1171. if( s.split("@").getLast().toLowerCase() == "i" ){
  1172. target.push( this.getPersonByIdentity( s ) )
  1173. }else{
  1174. target.push( s )
  1175. }
  1176. }.bind(this));
  1177. return target;
  1178. },
  1179. reject: function(e){
  1180. var _self = this;
  1181. var text = this.app.lp.reject_confirm.replace(/{name}/g, this.data.subject);
  1182. this.app.confirm("infor", e, this.app.lp.reject_confirm_title, text, 300, 120, function(){
  1183. _self.rejectMeeting();
  1184. this.close();
  1185. _self.close();
  1186. }, function(){
  1187. this.close();
  1188. });
  1189. },
  1190. rejectMeeting: function(){
  1191. var view = this.view;
  1192. this.app.actions.rejectMeeting(this.data.id, function(){
  1193. view.reload();
  1194. }.bind(this))
  1195. },
  1196. accept: function(e){
  1197. var _self = this;
  1198. var text = this.app.lp.accept_confirm.replace(/{name}/g, this.data.subject);
  1199. this.app.confirm("infor", e, this.app.lp.accept_confirm_title, text, 300, 120, function(){
  1200. _self.acceptMeeting();
  1201. this.close();
  1202. _self.close();
  1203. }, function(){
  1204. this.close();
  1205. });
  1206. },
  1207. acceptMeeting: function(){
  1208. var view = this.view;
  1209. this.app.actions.acceptMeeting(this.data.id, function(){
  1210. view.reload();
  1211. }.bind(this))
  1212. },
  1213. close: function (e) {
  1214. this.fireEvent("queryClose");
  1215. this._close();
  1216. //if( this.form ){
  1217. // this.form.destroy();
  1218. //}
  1219. if(this.setFormNodeSizeFun && this.app ){
  1220. this.app.removeEvent("resize",this.setFormNodeSizeFun);
  1221. }
  1222. if( this.formMaskNode )this.formMaskNode.destroy();
  1223. this.formAreaNode.destroy();
  1224. this.fireEvent("postClose");
  1225. debugger;
  1226. if( this.waitReload )this.view.reload();
  1227. delete this;
  1228. }
  1229. });
  1230. MWF.xApplication.Meeting.MeetingTooltip = new Class({
  1231. Extends: MTooltips,
  1232. _loadCustom : function( callback ){
  1233. this.loadRoom( function(){
  1234. this.loadInvite();
  1235. this.loadAttachment();
  1236. if(callback)callback();
  1237. }.bind(this) );
  1238. },
  1239. _getHtml : function(){
  1240. var data = this.data;
  1241. var titleStyle = "font-size:14px;color:#333";
  1242. var valueStyle = "font-size:14px;color:#666;padding-right:20px";
  1243. var persons = [];
  1244. data.invitePersonList.each( function( p ){
  1245. persons.push(p.split("@")[0] )
  1246. }.bind(this));
  1247. var color = "#ccc";
  1248. switch (data.status){
  1249. case "wait":
  1250. color = "#4990E2";
  1251. break;
  1252. case "processing":
  1253. color = "#66CC7F";
  1254. break;
  1255. case "completed":
  1256. color = "#666";
  1257. break;
  1258. }
  1259. if (data.myWaitAccept){
  1260. color = "#F6A623";
  1261. }
  1262. if (data.confilct){
  1263. color = "#FF7F7F";
  1264. }
  1265. var beginDate = Date.parse(data.startTime);
  1266. var endDate = Date.parse(data.completedTime);
  1267. var dateStr = beginDate.format(this.app.lp.dateFormatDay);
  1268. var beginTime = this.getString( beginDate.getHours() ) + ":" + this.getString( beginDate.getMinutes() );
  1269. var endTime = this.getString( endDate.getHours() ) + ":" + this.getString( endDate.getMinutes() );
  1270. var meetingTime = dateStr + " " + beginTime + "-" + endTime;
  1271. var description = (data.description || "")+(data.summary || "");
  1272. var html =
  1273. "<div style='overflow: hidden;padding:15px 20px 20px 10px;height:16px;line-height:16px;'>" +
  1274. " <div style='font-size: 12px;color:#666; float: right'>"+ this.lp.applyPerson +":" + data.applicant.split("@")[0] +"</div>" +
  1275. " <div style='font-size: 16px;color:#333;float: left'>"+ this.lp.meetingDetail +"</div>"+
  1276. "</div>"+
  1277. "<div style='font-size: 18px;color:#333;padding:0px 10px 15px 20px;'>"+ data.subject +"</div>"+
  1278. "<div style='height:1px;margin:0px 20px;border-bottom:1px solid #ccc;'></div>"+
  1279. "<table width='100%' bordr='0' cellpadding='7' cellspacing='0' style='margin:13px 13px 13px 13px;'>" +
  1280. "<tr><td style='"+titleStyle+";' width='70'>"+this.lp.meetingTime+":</td>" +
  1281. " <td style='"+valueStyle+";color:"+ color +"'>" + meetingTime + "</td></tr>" +
  1282. //"<tr><td style='"+titleStyle+"' width='70'>"+this.lp.beginTime+":</td>" +
  1283. //" <td style='"+valueStyle+"'>" + data.startTime + "</td></tr>" +
  1284. //"<tr><td style='"+titleStyle+"'>"+this.lp.endTime+":</td>" +
  1285. //" <td style='"+valueStyle+"'>" + data.completedTime + "</td></tr>" +
  1286. "<tr><td style='"+titleStyle+"'>"+this.lp.selectRoom +":</td>" +
  1287. " <td style='"+valueStyle+"' item='meetingRoom'></td></tr>" +
  1288. "<tr><td style='"+titleStyle+"'>"+this.lp.invitePerson2+":</td>" +
  1289. " <td style='"+valueStyle+"' item='invitePerson'>"+persons.join(",")+"</td></tr>" +
  1290. "<tr><td style='"+titleStyle+"'>"+this.lp.meetingDescription+":</td>" +
  1291. " <td style='"+valueStyle+"'>"+ description +"</td></tr>" +
  1292. ( this.options.isHideAttachment ? "" :
  1293. "<tr><td style='"+titleStyle+"'>"+this.lp.meetingAttachment+":</td>" +
  1294. " <td style='"+valueStyle+"' item='attachment'></td></tr>"
  1295. )+
  1296. "</table>";
  1297. return html;
  1298. },
  1299. getString : function( str ){
  1300. var s = "00" + str;
  1301. return s.substr(s.length - 2, 2 );
  1302. },
  1303. loadRoom: function( callback ){
  1304. var area = this.node.getElement("[item='meetingRoom']");
  1305. if (this.data.room){
  1306. this.app.actions.getRoom(this.data.room, function(json){
  1307. this.app.actions.getBuilding(json.data.building, function(bjson){
  1308. area.set("text", json.data.name+" ("+bjson.data.name+")");
  1309. if( callback )callback();
  1310. }.bind(this));
  1311. }.bind(this));
  1312. }
  1313. },
  1314. loadInvite : function(){
  1315. this.O2PersonList = [];
  1316. var area = this.node.getElement("[item='invitePerson']");
  1317. MWF.require("MWF.widget.O2Identity", function(){
  1318. area.empty();
  1319. this.data.invitePersonList.each(function( person ){
  1320. var O2person = new MWF.widget.O2Person({name : person}, area, {"style": "room", "onLoadedInfor": function(item){
  1321. this.loadAcceptAndReject( item );
  1322. }.bind(this) });
  1323. this.O2PersonList.push( O2person );
  1324. }.bind(this));
  1325. }.bind(this));
  1326. },
  1327. loadAcceptAndReject : function( item ){
  1328. var personName = item.data.distinguishedName;
  1329. if( this.data.acceptPersonList ){
  1330. if (this.data.acceptPersonList.indexOf(personName)!==-1){
  1331. var acceptNode = new Element("div", {"styles": {
  1332. "height": "20px",
  1333. "width": "14px",
  1334. "margin-right": "3px",
  1335. "float": "left",
  1336. "background": "url(/x_component_Template/$MPopupForm/meeting/icon/accept.png) no-repeat center center"
  1337. }}).inject(item.node, "top");
  1338. new Element("div", {
  1339. "styles" : {"color": "#1fbf04", "clear":"both","text-align":"center"},
  1340. "text": this.app.lp.accepted
  1341. }).inject(item.inforNode);
  1342. }
  1343. }
  1344. if(this.data.rejectPersonList){
  1345. if (this.data.rejectPersonList.indexOf(personName)!==-1){
  1346. var rejectNode = new Element("div", {"styles": {
  1347. "height": "20px",
  1348. "width": "14px",
  1349. "margin-right": "3px",
  1350. "float": "left",
  1351. "background": "url(/x_component_Template/$MPopupForm/meeting/icon/reject.png) no-repeat center center"
  1352. }}).inject(item.node, "top");
  1353. new Element("div", {
  1354. "styles" : {"color": "#FF0000", "clear":"both","text-align":"center"},
  1355. "text": this.app.lp.rejected
  1356. }).inject(item.inforNode);
  1357. }
  1358. }
  1359. },
  1360. destroy: function(){
  1361. if( this.O2PersonList ){
  1362. this.O2PersonList.each(function(p){
  1363. p.destroy();
  1364. })
  1365. }
  1366. if( this.node ){
  1367. this.node.destroy();
  1368. this.node = null;
  1369. }
  1370. },
  1371. loadAttachment: function(){
  1372. if( this.options.isHideAttachment )return;
  1373. if( typeOf(this.data.attachmentList)=="array" && this.data.attachmentList[0] ){
  1374. var area = this.node.getElement("[item='attachment']");
  1375. this.attachmentNode = new Element("div"
  1376. //{"styles": this.css.createMeetingAttachmentNode}
  1377. ).inject(area);
  1378. var attachmentContentNode = new Element("div", {
  1379. //"styles": this.css.createMeetingAttachmentContentNode
  1380. }).inject(this.attachmentNode);
  1381. this.attachmentController = new MWF.xApplication.Meeting.MeetingTooltip.AttachmentController(attachmentContentNode, this, {
  1382. "size": "min",
  1383. "isSizeChange": false,
  1384. "isReplace": false,
  1385. "isUpload": false,
  1386. "isDelete": false,
  1387. "isDownload": true,
  1388. "readonly": true
  1389. });
  1390. this.attachmentController.load();
  1391. this.data.attachmentList.each(function (att) {
  1392. att.person = att.lastUpdatePerson.split("@")[0];
  1393. var at = this.attachmentController.addAttachment(att);
  1394. }.bind(this));
  1395. }
  1396. },
  1397. downloadAttachment: function(e, node, attachments){
  1398. attachments.each(function(att){
  1399. this.app.actions.getFileDownload(att.data.id);
  1400. }.bind(this));
  1401. },
  1402. openAttachment: function(e, node, attachments){
  1403. attachments.each(function(att){
  1404. this.app.actions.getFile(att.data.id);
  1405. }.bind(this));
  1406. },
  1407. getAttachmentUrl: function(attachment, callback){
  1408. this.app.actions.getFileUrl(attachment.data.id, callback);
  1409. }
  1410. });
  1411. MWF.xApplication.Meeting.MeetingTooltip.AttachmentController = new Class({
  1412. Extends : MWF.widget.AttachmentController,
  1413. loadMin: function(){
  1414. if (!this.node) this.node = new Element("div", {"styles": this.css.container_min});
  1415. if (!this.minActionAreaNode){
  1416. //this.minActionAreaNode = new Element("div", {"styles": this.css.minActionAreaNode}).inject(this.node);
  1417. this.minContent = new Element("div", {"styles": this.css.minContentNode}).inject(this.node);
  1418. this.minContent.setStyles({
  1419. "margin-right" : "0px"
  1420. });
  1421. //this.min_downloadAction = this.createAction(this.minActionAreaNode, "download", MWF.LP.widget.download, function(e, node){
  1422. // this.downloadAttachment(e, node);
  1423. //}.bind(this));
  1424. this.node.inject(this.container);
  1425. //if (this.options.readonly) this.setReadonly();
  1426. this.checkActions();
  1427. this.setEvent();
  1428. }else{
  1429. //this.minActionAreaNode.setStyle("display", "block");
  1430. this.minContent.setStyle("display", "block");
  1431. this.minContent.empty();
  1432. }
  1433. var atts = [];
  1434. while (this.attachments.length){
  1435. var att = this.attachments.shift();
  1436. atts.push(new MWF.xApplication.Meeting.MeetingTooltip.AttachmentMin(att.data, this));
  1437. }
  1438. this.attachments = atts;
  1439. },
  1440. addAttachment: function(data){
  1441. if (this.options.size=="min"){
  1442. this.attachments.push(new MWF.xApplication.Meeting.MeetingTooltip.AttachmentMin(data, this));
  1443. }else{
  1444. this.attachments.push(new MWF.widget.AttachmentController.Attachment(data, this));
  1445. }
  1446. }
  1447. });
  1448. MWF.xApplication.Meeting.MeetingTooltip.AttachmentMin = new Class({
  1449. Extends : MWF.widget.AttachmentController.AttachmentMin,
  1450. setEvent: function(){
  1451. this.node.addEvents({
  1452. "mouseover": function(){if (!this.isSelected) this.node.setStyles(this.css["minAttachmentNode_list_over"])}.bind(this),
  1453. "mouseout": function(){if (!this.isSelected) this.node.setStyles(this.css["minAttachmentNode_list"])}.bind(this),
  1454. "mousedown": function(e){this.selected(e);}.bind(this),
  1455. "click": function(e){this.downloadAttachment(e);}.bind(this)
  1456. });
  1457. },
  1458. downloadAttachment: function(e){
  1459. if (this.controller.module) this.controller.module.downloadAttachment(e, null, [this]);
  1460. }
  1461. });
  1462. MWF.xApplication.Meeting.MeetingArea = new Class({
  1463. initialize: function(container, view, data){
  1464. this.container = container;
  1465. this.view = view;
  1466. this.css = this.view.css;
  1467. this.app = this.view.app;
  1468. this.data = data;
  1469. this.beginDate = Date.parse(this.data.startTime);
  1470. this.endDate = Date.parse(this.data.completedTime);
  1471. this.userName = layout.desktop.session.user.distinguishedName;
  1472. this.userId = layout.desktop.session.user.id;
  1473. this.parseData();
  1474. this.path = "/x_component_Meeting/$Common/default/meetingarea/";
  1475. this.cssPath = "/x_component_Meeting/$Common/default/meetingarea/css.wcss";
  1476. this._loadCss();
  1477. this.load();
  1478. },
  1479. load: function(){
  1480. this.node = new Element("div", {"styles": this.css.meetingNode}).inject( this.container );
  1481. this.node.addEvents({
  1482. mouseenter : function(){
  1483. this.node.setStyles( this.css.meetingNode_over );
  1484. this.subjectNode.setStyles( this.css.meetingSubjectNode_over );
  1485. }.bind(this),
  1486. mouseleave : function(){
  1487. this.node.setStyles( this.css.meetingNode );
  1488. this.subjectNode.setStyles( this.css.meetingSubjectNode );
  1489. }.bind(this),
  1490. click : function(){
  1491. this.openMeeting()
  1492. }.bind(this)
  1493. });
  1494. this.colorNode = new Element("div", {"styles": this.css.meetingColorNode}).inject(this.node);
  1495. this.contentNode = new Element("div", {"styles": this.css.meetingContentNode}).inject(this.node);
  1496. var beginTime = (this.beginDate.getHours() < 12 ? this.app.lp.am : this.app.lp.pm) + " " + this.getString( this.beginDate.getHours() ) + ":" + this.getString( this.beginDate.getMinutes() );
  1497. var endTime = (this.endDate.getHours() < 12 ? this.app.lp.am : this.app.lp.pm) + " " + this.getString( this.endDate.getHours() ) + ":" + this.getString( this.endDate.getMinutes() );
  1498. this.timeNode = new Element("div", {
  1499. "styles": this.css.meetingTimeNode,
  1500. "text" : beginTime + "-" + endTime
  1501. }).inject(this.contentNode);
  1502. this.subjectNode = new Element("div", {
  1503. "styles": this.css.meetingSubjectNode,
  1504. "text": this.data.subject
  1505. }).inject(this.contentNode);
  1506. var description = (this.data.description || "")+(this.data.summary || "");
  1507. this.descriptionNode = new Element("div", {
  1508. "styles": this.css.meetingDescriptionNode,
  1509. "text" : description
  1510. }).inject(this.contentNode);
  1511. this.loadActionBar();
  1512. switch (this.data.status){
  1513. case "wait":
  1514. this.colorNode.setStyles({"background-color": "#4990E2"});
  1515. this.timeNode.setStyles({"color": "#4990E2"});
  1516. break;
  1517. case "processing":
  1518. this.colorNode.setStyles({"background-color": "#66CC7F"});
  1519. this.timeNode.setStyles({"color": "#66CC7F"});
  1520. break;
  1521. case "completed":
  1522. //add attachment
  1523. this.colorNode.setStyles({"background-color": "#ccc"});
  1524. this.timeNode.setStyles({"color": "#ccc"});
  1525. break;
  1526. }
  1527. if (this.data.myWaitAccept){
  1528. this.colorNode.setStyles({"background-color": "#F6A623"});
  1529. this.timeNode.setStyles({"color": "#F6A623"});
  1530. }
  1531. this.resetNodeSize();
  1532. this.loadTooltip();
  1533. },
  1534. parseData : function(){
  1535. if( !this.data.status ){
  1536. var now = new Date();
  1537. var status;
  1538. if( this.beginDate > now ){
  1539. status = "wait";
  1540. }else if( this.endDate < now ){
  1541. status = "completed";
  1542. }else{
  1543. status = "processing";
  1544. }
  1545. this.data.status = status;
  1546. }
  1547. if( typeOf( this.data.myWaitAccept ) != "boolean" ){
  1548. if( this.data.invitePersonList.contains( this.userName ) || this.data.invitePersonList.contains( this.userId ) ){
  1549. this.data.myWaitAccept = ( !this.data.acceptPersonList.contains( this.userName ) || this.data.acceptPersonList.contains( this.userId ) ) &&
  1550. ( !this.data.rejectPersonList.contains( this.userName ) || !this.data.rejectPersonList.contains( this.userId ) )
  1551. }
  1552. }
  1553. },
  1554. loadActionBar : function(){
  1555. if( this.userName == this.data.applicant || this.userId == this.data.applicant || MWF.AC.isMeetingAdministrator() || this.data.myWaitAccept ){
  1556. }else{
  1557. return;
  1558. }
  1559. this.actionBar = new Element("div", {
  1560. "styles": this.css.actionBar
  1561. }).inject(this.contentNode);
  1562. //this.viewAction = new Element("div", {
  1563. // styles: this.css.action_view,
  1564. // events : {
  1565. // mouseenter : function(){
  1566. // this.viewAction.setStyles( this.css.action_view_over );
  1567. // }.bind(this),
  1568. // mouseleave : function(){
  1569. // this.viewAction.setStyles( this.css.action_view );
  1570. // }.bind(this),
  1571. // click : function(){
  1572. // this.openMeeting()
  1573. // }.bind(this)
  1574. // }
  1575. //}).inject(this.actionBar);
  1576. if( this.userName == this.data.applicant || this.userId == this.data.applicant || MWF.AC.isMeetingAdministrator() ){
  1577. if( this.data.status=="wait" ){
  1578. this.editAction = new Element("div", {
  1579. styles: this.css.action_edit,
  1580. events : {
  1581. mouseover : function(){
  1582. this.editAction.setStyles( this.css.action_edit_over );
  1583. }.bind(this),
  1584. mouseout : function(){
  1585. this.editAction.setStyles( this.css.action_edit );
  1586. }.bind(this),
  1587. click : function(e){
  1588. this.editMeeting();
  1589. e.stopPropagation();
  1590. }.bind(this)
  1591. }
  1592. }).inject(this.actionBar);
  1593. //if (this.data.myWaitConfirm) this.createConfirmActions();
  1594. //if (this.data.myWaitAccept) this.createAcceptActions();
  1595. //if (this.data.status=="wait" && this.isEdit) this.createCancelActions();
  1596. this.removeAction = new Element("div", {
  1597. styles: this.css.action_remove,
  1598. events : {
  1599. mouseover : function(){
  1600. this.removeAction.setStyles( this.css.action_remove_over );
  1601. }.bind(this),
  1602. mouseout : function(){
  1603. this.removeAction.setStyles( this.css.action_remove );
  1604. }.bind(this),
  1605. click : function( e ){
  1606. this.cancel(e);
  1607. e.stopPropagation();
  1608. }.bind(this)
  1609. }
  1610. }).inject(this.actionBar);
  1611. }
  1612. }
  1613. if (this.data.myWaitAccept){
  1614. this.acceptAction = new Element("div", {
  1615. styles: this.css.action_accept,
  1616. title : this.app.lp.accept,
  1617. events : {
  1618. mouseover : function(){
  1619. this.acceptAction.setStyles( this.css.action_accept_over );
  1620. }.bind(this),
  1621. mouseout : function(){
  1622. this.acceptAction.setStyles( this.css.action_accept );
  1623. }.bind(this),
  1624. click : function( e ){
  1625. this.accept(e);
  1626. e.stopPropagation();
  1627. }.bind(this)
  1628. }
  1629. }).inject(this.actionBar);
  1630. this.rejectAction = new Element("div", {
  1631. styles: this.css.action_reject,
  1632. title : this.app.lp.reject,
  1633. events : {
  1634. mouseover : function(){
  1635. this.rejectAction.setStyles( this.css.action_reject_over );
  1636. }.bind(this),
  1637. mouseout : function(){
  1638. this.rejectAction.setStyles( this.css.action_reject );
  1639. }.bind(this),
  1640. click : function( e ){
  1641. this.reject(e);
  1642. e.stopPropagation();
  1643. }.bind(this)
  1644. }
  1645. }).inject(this.actionBar);
  1646. }
  1647. },
  1648. getString : function( str ){
  1649. var s = "00" + str;
  1650. return s.substr(s.length - 2, 2 );
  1651. },
  1652. _loadCss: function(){
  1653. var key = encodeURIComponent(this.cssPath);
  1654. if (MWF.widget.css[key]){
  1655. this.css = MWF.widget.css[key];
  1656. }else{
  1657. var r = new Request.JSON({
  1658. url: this.cssPath,
  1659. secure: false,
  1660. async: false,
  1661. method: "get",
  1662. noCache: false,
  1663. onSuccess: function(responseJSON, responseText){
  1664. this.css = responseJSON;
  1665. MWF.widget.css[key] = responseJSON;
  1666. }.bind(this),
  1667. onError: function(text, error){
  1668. alert(error + text);
  1669. }
  1670. });
  1671. r.send();
  1672. }
  1673. },
  1674. loadTooltip : function( isHideAttachment ){
  1675. this.tooltip = new MWF.xApplication.Meeting.MeetingTooltip(this.app.content, this.node, this.app, this.data, {
  1676. axis : "x",
  1677. hiddenDelay : 300,
  1678. displayDelay : 300,
  1679. isHideAttachment : isHideAttachment
  1680. });
  1681. },
  1682. showTooltip: function( ){
  1683. if( this.tooltip ){
  1684. this.tooltip.load();
  1685. }else{
  1686. this.tooltip = new MWF.xApplication.Meeting.MeetingTooltip(this.app.content, this.viewAction, this.app, this.data);
  1687. this.tooltip.load();
  1688. }
  1689. },
  1690. openMeeting: function(){
  1691. var form = new MWF.xApplication.Meeting.MeetingForm(this,this.data, {}, {app:this.app});
  1692. form.view = this.view;
  1693. form.open();
  1694. },
  1695. resetNodeSize: function(){
  1696. var contentSize = this.contentNode.getSize();
  1697. this.colorNode.setStyle("height", contentSize.y );
  1698. },
  1699. destroy: function(){
  1700. if(this.tooltip)this.tooltip.destroy();
  1701. this.node.destroy();
  1702. MWF.release(this);
  1703. },
  1704. editMeeting : function(){
  1705. var form = new MWF.xApplication.Meeting.MeetingForm(this,this.data, {}, {app:this.app});
  1706. form.view = this.view;
  1707. form.edit();
  1708. },
  1709. cancel: function(e){
  1710. var _self = this;
  1711. var text = this.app.lp.cancel_confirm.replace(/{name}/g, this.data.subject);
  1712. this.app.confirm("infor", e, this.app.lp.cancel_confirm_title, text, 380, 150, function(){
  1713. _self.cancelMeeting();
  1714. this.close();
  1715. }, function(){
  1716. this.close();
  1717. });
  1718. },
  1719. cancelMeeting: function(){
  1720. var view = this.view;
  1721. this.app.actions.deleteMeeting(this.data.id, function(){
  1722. view.reload();
  1723. }.bind(this))
  1724. },
  1725. reject: function(e){
  1726. var _self = this;
  1727. var text = this.app.lp.reject_confirm.replace(/{name}/g, this.data.subject);
  1728. this.app.confirm("infor", e, this.app.lp.reject_confirm_title, text, 300, 120, function(){
  1729. _self.rejectMeeting();
  1730. this.close();
  1731. }, function(){
  1732. this.close();
  1733. });
  1734. },
  1735. rejectMeeting: function(){
  1736. var view = this.view;
  1737. this.app.actions.rejectMeeting(this.data.id, function(){
  1738. view.reload();
  1739. }.bind(this))
  1740. },
  1741. accept: function(e){
  1742. var _self = this;
  1743. var text = this.app.lp.accept_confirm.replace(/{name}/g, this.data.subject);
  1744. this.app.confirm("infor", e, this.app.lp.accept_confirm_title, text, 300, 120, function(){
  1745. _self.acceptMeeting();
  1746. this.close();
  1747. }, function(){
  1748. this.close();
  1749. });
  1750. },
  1751. acceptMeeting: function(){
  1752. var view = this.view;
  1753. this.app.actions.acceptMeeting(this.data.id, function(){
  1754. view.reload();
  1755. }.bind(this))
  1756. },
  1757. disagree: function(e){
  1758. var _self = this;
  1759. var text = this.app.lp.disagree_confirm.replace(/{name}/g, this.data.subject);
  1760. this.app.confirm("infor", e, this.app.lp.disagree_confirm_title, text, 300, 120, function(){
  1761. _self.disagreeMeeting();
  1762. this.close();
  1763. }, function(){
  1764. this.close();
  1765. });
  1766. },
  1767. disagreeMeeting: function(){
  1768. var view = this.view;
  1769. this.app.actions.denyMeeting(this.data.id, function(){
  1770. view.reload();
  1771. }.bind(this))
  1772. },
  1773. agree: function(e){
  1774. var _self = this;
  1775. var text = this.app.lp.agree_confirm.replace(/{name}/g, this.data.subject);
  1776. this.app.confirm("infor", e, this.app.lp.agree_confirm_title, text, 300, 120, function(){
  1777. _self.agreeMeeting();
  1778. this.close();
  1779. }, function(){
  1780. this.close();
  1781. });
  1782. },
  1783. agreeMeeting: function(){
  1784. var view = this.view;
  1785. this.app.actions.allowMeeting(this.data.id, function(){
  1786. view.reload();
  1787. }.bind(this))
  1788. }
  1789. });
  1790. MWF.xApplication.Meeting.SideBar = new Class({
  1791. Extends: MWF.widget.Common,
  1792. Implements: [Options, Events],
  1793. options: {
  1794. "style": "default"
  1795. },
  1796. initialize : function( container, app, options){
  1797. this.setOptions( options );
  1798. this.container = container;
  1799. this.app = app;
  1800. //this.css = this.app.css;
  1801. this.lp = this.app.lp;
  1802. this.isHidden = false;
  1803. this.cssPath = "/x_component_Meeting/$Common/"+this.options.style+"/sidebar/css.wcss";
  1804. this._loadCss();
  1805. this.load();
  1806. },
  1807. load : function(){
  1808. this.node = new Element("div.sideBar", {
  1809. "styles": this.css.node,
  1810. events : {
  1811. mousedown : function( ev ){
  1812. ev.stopPropagation();
  1813. }
  1814. }
  1815. }).inject(this.container);
  1816. this.contentNode = new Element("div", {"styles": this.css.contentNode}).inject(this.node);
  1817. this.loadStatusArea();
  1818. new Element("div.contentLine", {
  1819. "styles" : this.css.contentLine
  1820. }).inject( this.contentNode );
  1821. this.loadTodayMeetingNode();
  1822. this.trapezoid = new Element("div.trapezoid",{
  1823. "styles":this.css.trapezoid_toRight,
  1824. events : {
  1825. click : function(){
  1826. this.trigger();
  1827. }.bind(this)
  1828. }
  1829. }).inject(this.node);
  1830. //this.contentNode.getElements("div.line").setStyles(this.css.configContentLine);
  1831. this.loadTodayMeeting( function(){
  1832. var x = this.node.getSize().x - 8;
  1833. this.node.setStyle( "right", "-"+x+"px" );
  1834. this.resetNodeSize();
  1835. this.resetNodeSizeFun = this.resetNodeSize.bind(this);
  1836. this.app.addEvent("resize", this.resetNodeSizeFun );
  1837. this.hideFun = this.hide.bind(this);
  1838. this.app.node.addEvent("mousedown", this.hideFun);
  1839. }.bind(this));
  1840. },
  1841. loadStatusArea : function(){
  1842. var area = new Element("div", {
  1843. "styles" : this.css.statusArea
  1844. }).inject( this.contentNode );
  1845. var html = "<div class='titleDiv'>"+this.lp.config.meetingStatus+"</div>" +
  1846. "<div class = 'statusStyle'>"+
  1847. " <div class='statusIconStyle' style='background-color:#4990E2'></div>" +
  1848. " <div class = 'statusTextStyle'>"+this.lp.config.wait+"</div></div>" +
  1849. "</div>"+
  1850. "<div class = 'statusStyle'>"+
  1851. " <div class='statusIconStyle' style='background-color:#66CC7F'></div>" +
  1852. " <div class = 'statusTextStyle'>"+this.lp.config.progress+"</div></div>" +
  1853. "</div>"+
  1854. "<div class = 'statusStyle'>"+
  1855. " <div class='statusIconStyle' style='background-color:#F6A623'></div>" +
  1856. " <div class = 'statusTextStyle'>"+this.lp.config.invite+"</div></div>" +
  1857. "</div>"+
  1858. "<div class = 'statusStyle'>"+
  1859. " <div class='statusIconStyle' style='background-color:#ccc'></div>" +
  1860. " <div class = 'statusTextStyle'>"+this.lp.config.completed+"</div></div>" +
  1861. "</div>"+
  1862. "<div class = 'statusStyle'>"+
  1863. " <div class='statusIconStyle2' style='border:2px solid #FF7F7F;'></div>" +
  1864. " <div class = 'statusTextStyle'>"+this.lp.config.conflict+"</div></div>" +
  1865. "</div>";
  1866. area.set("html", html);
  1867. area.getElements("div.titleDiv").setStyles( this.css.titleDiv );
  1868. area.getElements("div.statusStyle").setStyles( this.css.statusStyle );
  1869. area.getElements("div.statusIconStyle").setStyles( this.css.statusIconStyle );
  1870. area.getElements("div.statusIconStyle2").setStyles( this.css.statusIconStyle2 );
  1871. area.getElements("div.statusTextStyle").setStyles( this.css.statusTextStyle );
  1872. },
  1873. loadTodayMeetingNode: function(){
  1874. var area = new Element("div.meetingArea", {
  1875. "styles" : this.css.meetingArea
  1876. }).inject( this.contentNode );
  1877. new Element("div.titleDiv", {
  1878. "styles" : this.css.titleDiv,
  1879. "text" : this.lp.meetingNotice
  1880. }).inject( area );
  1881. this.meetingNode = Element("div", {
  1882. "styles" : this.css.meetingNode
  1883. }).inject( area );
  1884. },
  1885. loadTodayMeeting : function( callback ){
  1886. var today = new Date();
  1887. var user = layout.desktop.session.user;
  1888. var dn = user.distinguishedName;
  1889. var y = today.getFullYear();
  1890. var m = today.getMonth()+1;
  1891. var d = today.getDate();
  1892. this.app.actions.listMeetingDay(y, m, d, function(json) {
  1893. var data = [];
  1894. json.data.each( function( d ){
  1895. if( d.invitePersonList.contains( dn ) || d.applicant == dn ){
  1896. if( !d.rejectPersonList.contains( dn ) ){
  1897. data.push( d );
  1898. }
  1899. }
  1900. }.bind(this));
  1901. if( user.distinguishedName ){
  1902. var userName = user.distinguishedName.split("@")[0]
  1903. }else{
  1904. var userName = user.name
  1905. }
  1906. var lp = data.length ? this.lp.meetingTopInfor : this.lp.noMeetingTopInfor ;
  1907. this.meetingTopNode = new Element("div", {
  1908. "styles" : this.css.meetingTopNode,
  1909. "html" : lp.replace("{userName}",userName).replace("{count}",data.length )
  1910. }).inject( this.meetingNode );
  1911. this.scrollNode = new Element("div.scrollNode", {
  1912. "styles" : this.css.scrollNode
  1913. }).inject( this.meetingNode );
  1914. this.meetingItemContainer = new Element("div.meetingItemContainer", {
  1915. "styles" : this.css.meetingItemContainer
  1916. }).inject( this.scrollNode );
  1917. data.each( function( d, i ){
  1918. var itemNode = new Element("div.meetingItemNode", {
  1919. "styles" : this.css.meetingItemNode,
  1920. "events" : {
  1921. click : function(){
  1922. this.obj.openMeeting( this.data );
  1923. }.bind({ obj : this, data : d })
  1924. }
  1925. }).inject( this.meetingItemContainer );
  1926. this.tooltipList = this.tooltipList || [];
  1927. this.tooltipList.push( new MWF.xApplication.Meeting.MeetingTooltip(this.app.content, itemNode, this.app, d, {
  1928. axis : "x",
  1929. hiddenDelay : 300,
  1930. displayDelay : 300
  1931. })
  1932. );
  1933. var colorNode = new Element("div.meetingItemColorNode", {
  1934. "styles" : this.css.meetingItemColorNode,
  1935. "text" : i+1
  1936. }).inject( itemNode );
  1937. var textNode = new Element("div.meetingItemTextNode", {
  1938. "styles" : this.css.meetingItemTextNode,
  1939. "text" : d.subject
  1940. }).inject( itemNode );
  1941. switch (d.status){
  1942. case "wait":
  1943. colorNode.setStyles({"background-color": "#4990E2"});
  1944. break;
  1945. case "processing":
  1946. colorNode.setStyles({"background-color": "#66CC7F"});
  1947. break;
  1948. case "completed":
  1949. //add attachment
  1950. colorNode.setStyles({"background-color": "#ccc"});
  1951. break;
  1952. }
  1953. if (d.myWaitAccept){
  1954. colorNode.setStyles({"background-color": "#F6A623"});
  1955. }
  1956. var y = itemNode.getSize().y ;
  1957. colorNode.setStyle("margin-top", ( y - 20)/2 );
  1958. }.bind(this));
  1959. this.setScrollBar( this.scrollNode );
  1960. if( callback )callback();
  1961. }.bind(this));
  1962. },
  1963. trigger : function(){
  1964. this.isHidden ? this.show( true ) : this.hide( true )
  1965. },
  1966. hide: function( isFireEvent ){
  1967. var x = this.node.getSize().x - 9;
  1968. var fx = new Fx.Morph(this.node, {
  1969. "duration": "300",
  1970. "transition": Fx.Transitions.Expo.easeOut
  1971. });
  1972. fx.start({
  1973. //"opacity": 0
  1974. }).chain(function(){
  1975. this.isHidden = true;
  1976. //this.node.setStyle("display", "none");
  1977. this.node.setStyles({
  1978. "right": "-"+x+"px"
  1979. });
  1980. this.trapezoid.setStyles( this.css.trapezoid_toLeft );
  1981. //if(isFireEvent)this.app.fireEvent("resize");
  1982. }.bind(this));
  1983. },
  1984. show: function( isFireEvent ){
  1985. this.node.setStyles(this.css.node);
  1986. this.trapezoid.setStyles( this.css.trapezoid_toRight );
  1987. //var x = this.node.getSize().x - 8;
  1988. //this.node.setStyles( "right", "-"+x+"px" );
  1989. var fx = new Fx.Morph(this.node, {
  1990. "duration": "500",
  1991. "transition": Fx.Transitions.Expo.easeOut
  1992. });
  1993. this.app.fireAppEvent("resize");
  1994. fx.start({
  1995. "opacity": 1
  1996. }).chain(function(){
  1997. this.node.setStyles({
  1998. //"position": "static",
  1999. //"width": "auto"
  2000. "right": "0px"
  2001. });
  2002. this.isHidden = false;
  2003. //if(isFireEvent)this.app.fireEvent("resize");
  2004. }.bind(this))
  2005. },
  2006. //show: function(){
  2007. // this.node.setStyles(this.css.configNode);
  2008. // var fx = new Fx.Morph(this.node, {
  2009. // "duration": "500",
  2010. // "transition": Fx.Transitions.Expo.easeOut
  2011. // });
  2012. // fx.start({
  2013. // "opacity": 1
  2014. // }).chain(function(){
  2015. // this.hideFun = this.hide.bind(this);
  2016. // this.app.content.addEvent("mousedown", this.hideFun);
  2017. // }.bind(this));
  2018. //},
  2019. //hide: function(){
  2020. // this.node.destroy();
  2021. // this.app.content.removeEvent("mousedown", this.hideFun);
  2022. // MWF.release(this);
  2023. //},
  2024. resetNodeSize: function(){
  2025. var size = this.container.getSize();
  2026. this.node.setStyle("height", size.y - 50 );
  2027. this.trapezoid.setStyle("top", ( (size.y - 50)/2 - this.trapezoid.getSize().y/2 ));
  2028. var y = size.y - 395;
  2029. var meetContainerY = this.meetingItemContainer.getSize().y + 12;
  2030. this.scrollNode.setStyle("height", Math.min( y, meetContainerY ) );
  2031. },
  2032. getSize : function(){
  2033. //var size = this.node.getSize();
  2034. //return {
  2035. // x : this.isHidden ? 9 : size.x,
  2036. // y : size.y
  2037. //}
  2038. return { x : 9, y : 0 }
  2039. },
  2040. showByType : function( type ){
  2041. },
  2042. reload : function(){
  2043. this.destory();
  2044. this.app.reload();
  2045. },
  2046. openMeeting : function( data ){
  2047. var form = new MWF.xApplication.Meeting.MeetingForm(this, data, {}, {app:this.app});
  2048. form.view = this.app;
  2049. form.open();
  2050. },
  2051. destory : function(){
  2052. this.tooltipList.each( function( t ){
  2053. t.destory();
  2054. });
  2055. this.app.removeEvent("resize", this.resetNodeSizeFun );
  2056. this.app.node.removeEvent("mousedown", this.hideFun);
  2057. this.node.destory();
  2058. }
  2059. });