Common.js 96 KB

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