Common.js 94 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250
  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 = "610";
  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 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'>" +
  658. //"<tr><td colspan='2' styles='formTableHead'>申诉处理单</td></tr>" +
  659. "<tr>"+
  660. " <td styles='formTableTitle' width='70'>"+this.lp.applyPerson+":</td>" +
  661. " <td styles='formTableValue' item='applicant'></td>" +
  662. "</tr>"+
  663. "<tr><td styles='formTableTitle' width='100'>"+this.lp.beginDate+":</td>" +
  664. " <td styles='formTableValue' item='dateInput'></td>" +
  665. "</tr>" +
  666. "<tr><td styles='formTableTitle'>"+ this.lp.time +":</td>" +
  667. " <td styles='formTableValue'>" +
  668. " <div item='beginTimeInput' style='float:left'></div>"+
  669. " <div style='float:left; "+ ( this.isNew ? "margin:5px;" : "margin:0px 5px;") + "'>"+ this.lp.to+ "</div>"+
  670. " <div item='endTimeInput' style='float:left'></div>"+
  671. " </td></tr>" +
  672. "<tr><td styles='formTableTitle'>"+ this.lp.selectRoom +":</td>" +
  673. " <td styles='formTableValue' item='meetingRoom'></td></tr>" +
  674. "<tr><td styles='formTableTitle'>"+this.lp.invitePerson2+":</td>" +
  675. " <td styles='formTableValue'>" +
  676. " <div item='invitePersonList'></div>" +
  677. " <div style='display:"+ ( this.isEdited ? "" : "none") +";' item='selectinvitePerson'></div>" +
  678. (( !this.isNew && this.data.myWaitAccept ) ?
  679. " <tr><td></td><td styles='formTableValue'><div item='acceptAction'></div><div item='rejectAction'></div></td></tr>" : ""
  680. ) +
  681. " </td>" +
  682. "</tr>" +
  683. "<tr style='display:"+ ( this.isNew ? "none" : "") +" ;' item='checkPersonTr'><td styles='formTableTitle'>签到人员:</td>" +
  684. " <td styles='formTableValue' item='checkinPersonList'></td></tr>" +
  685. "<tr><td styles='formTableTitle'>"+this.lp.meetingSubject+":</td>" +
  686. " <td styles='formTableValue' item='subject'></td></tr>" +
  687. "<tr><td styles='formTableTitle'>"+this.lp.meetingDescription+":</td>" +
  688. " <td styles='formTableValue' item='summary'></td></tr>" +
  689. "<tr style='display:none ;' item='attachmentTr'><td styles='formTableTitle'>"+this.lp.meetingAttachment+":</td>" +
  690. " <td styles='formTableValue' item='attachment'></td></tr>" +
  691. "<tr><td styles='formTableTitle'></td>" +
  692. " <td styles='formTableValue' style='padding-top: 10px;'>"+
  693. " <div item='saveAction' style='float:left;display:"+ ( (this.isEdited || this.isNew) ? "" : "none") +";'></div>"+
  694. " <div item='editAction' style='float:left;display:"+ ( editEnable ? "" : "none") +";'></div>"+
  695. " <div item='removeAction' style='float:left;display:"+ ( this.isEdited ? "" : "none") +";'></div>"+
  696. " <div item='cancelAction' style='"+( (this.isEdited || this.isNew || editEnable) ? "float:left;" : "float:right;margin-right:15px;")+"'></div>"+
  697. " </td></tr>" +
  698. "</table>";
  699. this.formTableArea.set("html", html);
  700. if( data.startTime ){
  701. var beignDate = Date.parse( data.startTime );
  702. data.dateInput = beignDate.format("%Y-%m-%d");
  703. data.beginTimeInput = this.getString( beignDate.getHours() ) + ":" + this.getString( beignDate.getMinutes() );
  704. }
  705. if( data.completedTime ){
  706. var endDate = Date.parse( data.completedTime );
  707. data.endTimeInput = this.getString( endDate.getHours() ) + ":" + this.getString( endDate.getMinutes() );
  708. }
  709. this.meetingRoomArea = this.formTableArea.getElement("[item='meetingRoom']");
  710. this.attachmentTr = this.formTableArea.getElement("[item='attachmentTr']");
  711. this.attachmentArea = this.formTableArea.getElement("[item='attachment']");
  712. this.qrCodeArea = this.formTableArea.getElement("[item='qrCode']");
  713. MWF.xDesktop.requireApp("Template", "MForm", function () {
  714. this.form = new MForm(this.formTableArea, data, {
  715. isEdited: this.isEdited || this.isNew,
  716. style : "meeting",
  717. itemTemplate: {
  718. applicant : { type : "org", orgType : "person", isEdited : false,
  719. defaultValue : this.userName
  720. },
  721. dateInput: {tType: "date", isEdited : this.isNew, defaultValue: defaultDate,
  722. event : {
  723. change : function( item, ev ){
  724. this.clearRoom();
  725. }.bind(this)
  726. }
  727. },
  728. beginTimeInput: { tType: "time", isEdited : this.isNew,
  729. defaultValue: defaultBeginTime, className : ( this.isNew ? "inputTimeUnformatWidth" : "" ),
  730. event : {
  731. change : function( item, ev ){
  732. this.clearRoom();
  733. }.bind(this)
  734. }
  735. },
  736. endTimeInput: { tType: "time", isEdited : this.isNew,
  737. defaultValue: defaultEndTime, className : ( this.isNew ? "inputTimeUnformatWidth" : "" ),
  738. event : {
  739. change : function( item, ev ){
  740. this.clearRoom();
  741. }.bind(this)
  742. }
  743. },
  744. invitePersonList: { type: "org", isEdited : this.isNew, orgType: ["identity","person"], count : 0, orgWidgetOptions : {
  745. "onLoadedInfor": function(item){
  746. this.loadAcceptAndReject( item );
  747. }.bind(this)
  748. }},
  749. checkinPersonList : { type: "org", isEdited : false, orgType: ["identity","person"], count : 0},
  750. selectinvitePerson : { type : "button", value : this.lp.addInvitePerson1, style : {"margin-left": "20px"}, event : {
  751. click : function( it ){
  752. var options = {
  753. "type" : "",
  754. "types": ["identity","person"],
  755. "exclude" : this.getInvitePersonExclude(),
  756. "values": [],
  757. "count": 0,
  758. "onComplete": function(items){
  759. MWF.require("MWF.widget.O2Identity", function(){
  760. var invitePersonList = [];
  761. items.each(function(item){
  762. var _self = this;
  763. if( item.data.distinguishedName.split("@").getLast().toLowerCase() == "i" ){
  764. var person = new MWF.widget.O2Identity(item.data, it.form.getItem("invitePersonList").container, {"style": "room"});
  765. invitePersonList.push( item.data.distinguishedName );
  766. }else{
  767. var person = new MWF.widget.O2Person(item.data, it.form.getItem("invitePersonList").container, {"style": "room"});
  768. invitePersonList.push(item.data.distinguishedName);
  769. }
  770. }.bind(this));
  771. this.app.actions.addMeetingInvite(this.data.id, {"invitePersonList": invitePersonList, "id": this.data.id}, function(json){
  772. this.app.actions.getMeeting(json.data.id, function(meeting){
  773. this.invitePersonList = meeting.data.invitePersonList;
  774. this.app.notice(this.app.lp.addedInvitePerson1, "success", this.node );
  775. }.bind(this));
  776. }.bind(this));
  777. }.bind(this));
  778. }.bind(this)
  779. };
  780. var selector = new MWF.O2Selector(this.app.content, options);
  781. }.bind(this)
  782. } },
  783. subject: {},
  784. summary: {type: "textarea"},
  785. acceptAction : { type : "button", value : this.lp.accept, className : "inputAcceptButton",
  786. event : { click : function( it, ev ){ this.accept(ev); }.bind(this) }
  787. },
  788. rejectAction : { type : "button", value : this.lp.reject, style : {"margin-left": "20px"}, className : "inputDenyButton",
  789. event : { click : function( it, ev ){ this.reject(ev) }.bind(this) }
  790. },
  791. saveAction : { type : "button", className : "inputOkButton", value : this.lp.save, event : {
  792. click : function(){ this.save();}.bind(this)
  793. } },
  794. removeAction : { type : "button", className : "inputCancelButton", value : this.lp.cancelMeeting , event : {
  795. click : function( item, ev ){ this.cancelMeeting(ev); }.bind(this)
  796. } },
  797. editAction : { type : "button", className : "inputOkButton", value : this.lp.editMeeting , event : {
  798. click : function(){ this.editMeeting(); }.bind(this)
  799. } },
  800. cancelAction : { type : "button", className : "inputCancelButton", value : this.lp.close , event : {
  801. click : function(){ this.close(); }.bind(this)
  802. } }
  803. }
  804. }, this.app);
  805. this.form.load();
  806. this.loadSelectRoom();
  807. if( this.data.id )this.loadAttachment();
  808. if( isEditer && !this.isNew ){
  809. this.loadQrCode();
  810. }else{
  811. this.qrCodeArea.destroy();
  812. }
  813. }.bind(this), true);
  814. },
  815. getInvitePersonExclude : function(){
  816. var invitePersonList = this.invitePersonList || this.data.invitePersonList;
  817. var identityList = [];
  818. if( invitePersonList.length > 0 ){
  819. o2.Actions.load("x_organization_assemble_express").IdentityAction.listWithPerson({
  820. personList : invitePersonList
  821. }, function( json ){
  822. identityList = json.data ? json.data.identityList : [];
  823. }, null ,false );
  824. return ( identityList || [] ).concat(invitePersonList);
  825. }else{
  826. return [];
  827. }
  828. },
  829. getString : function( str ){
  830. var s = "00" + str;
  831. return s.substr(s.length - 2, 2 );
  832. },
  833. loadQrCode : function(){
  834. this.actions.getCheckinQrCode( this.data.id, function(json){
  835. var img = new Element("img",{
  836. src : "data:image/png;base64,"+json.data.image,
  837. styles : {
  838. width : "100px",
  839. height : "100px"
  840. }
  841. }).inject( this.qrCodeArea );
  842. var div = new Element("div",{
  843. text : "打印签到二维码",
  844. styles : {
  845. color : "#3c75b7",
  846. cursor : "pointer"
  847. },
  848. events : {
  849. click : function(){
  850. window.open(o2.filterUrl("../x_component_Meeting/$Main/qrPrint.html?meeting="+this.data.id), "_blank" );
  851. }.bind(this)
  852. }
  853. }).inject( this.qrCodeArea );
  854. }.bind(this));
  855. },
  856. loadAcceptAndReject : function( item ){
  857. var personName = item.data.distinguishedName;
  858. if(this.data.acceptPersonList){
  859. if (this.data.acceptPersonList.indexOf(personName)!==-1){
  860. var acceptNode = new Element("div", {"styles": this.css.acceptIconNode}).inject(item.node, "top");
  861. new Element("div", {
  862. "styles": this.css.acceptTextNode,
  863. "text": this.app.lp.accepted
  864. }).inject(item.inforNode);
  865. }
  866. }
  867. if(this.data.rejectPersonList){
  868. if (this.data.rejectPersonList.indexOf(personName)!==-1){
  869. var rejectNode = new Element("div", {"styles": this.css.rejectIconNode}).inject(item.node, "top");
  870. new Element("div", {
  871. "styles": this.css.rejectTextNode,
  872. "text": this.app.lp.rejected
  873. }).inject(item.inforNode);
  874. }
  875. }
  876. },
  877. getMeetingData : function( callback ){
  878. if( this.data && this.data.id ){
  879. ( this.app.actions || this.actions ).getMeeting( this.data.id, function( json ){
  880. this.data = json.data;
  881. if(callback)callback();
  882. }.bind(this))
  883. }else{
  884. if(callback)callback();
  885. }
  886. },
  887. editMeeting : function(){
  888. this.formTopNode = null;
  889. if(this.setFormNodeSizeFun && this.app ){
  890. this.app.removeEvent("resize",this.setFormNodeSizeFun);
  891. }
  892. if( this.formMaskNode )this.formMaskNode.destroy();
  893. this.formAreaNode.destroy();
  894. this.edit();
  895. },
  896. cancelMeeting: function(e){
  897. var _self = this;
  898. var text = this.app.lp.cancel_confirm.replace(/{name}/g, this.data.subject);
  899. this.app.confirm("infor", e, this.app.lp.cancel_confirm_title, text, 380, 200, function(){
  900. _self._cancelMeeting();
  901. this.close();
  902. _self.close();
  903. }, function(){
  904. this.close();
  905. });
  906. },
  907. _cancelMeeting: function(){
  908. var view = this.view;
  909. this.app.actions.deleteMeeting(this.data.id, function(){
  910. view.reload();
  911. }.bind(this))
  912. },
  913. reset: function(){
  914. this.formTableArea.empty();
  915. this._createTableContent();
  916. },
  917. clearRoom : function(){
  918. this.roomId = "";
  919. if(this.roomInput)this.roomInput.set("text", "");
  920. },
  921. loadSelectRoom: function(){
  922. var lineNode = new Element("div", {"styles": this.css.createMeetingInfoLineNode}).inject(this.meetingRoomArea);
  923. var editNode = new Element("div", {
  924. "styles": this.css.createMeetingInfoItemEditNode,
  925. "html": "<div></div>"
  926. }).inject(lineNode);
  927. this.roomInput = editNode.getFirst();
  928. this.roomInput.setStyles(this.css.createMeetingInfoItemDivNode);
  929. //var downNode = new Element("div", {"styles": this.css.createMeetingInfoItemDownNode}).inject(editNode);
  930. if( this.isNew ){
  931. this.roomInput.addEvents({
  932. "click": function(e){this.selectRooms();}.bind(this)
  933. });
  934. }
  935. var roomId = this.data.room || this.options.room;
  936. if (roomId){
  937. ( this.app.actions || this.actions ).getRoom(roomId, function(json){
  938. ( this.app.actions || this.actions ).getBuilding(json.data.building, function(bjson){
  939. this.roomId = roomId;
  940. this.roomInput.set("text", json.data.name+" ("+bjson.data.name+")");
  941. }.bind(this));
  942. }.bind(this));
  943. }
  944. },
  945. selectRooms: function(){
  946. this.createRoomNode(function(){
  947. this.loadSelectRooms();
  948. this.selectRoomNode.setStyle("display", "block");
  949. this.hideRoomNodeFun = this.hideRoomNode.bind(this);
  950. document.body.addEvent("mousedown", this.hideRoomNodeFun);
  951. //var p = this.selectRoomNode.getPosition(this.selectRoomNode.getOffsetParent());
  952. this.selectRoomNode.position({
  953. relativeTo: this.roomInput,
  954. position: 'bottomLeft',
  955. edge: 'upperLeft',
  956. offset: {x: 0, y: 0}
  957. });
  958. var size = this.roomInput.getSize();
  959. var w = size.x-2;
  960. this.selectRoomNode.setStyle("width", ""+w+"px");
  961. }.bind(this));
  962. },
  963. createRoomNode: function(callback){
  964. if (!this.selectRoomNode){
  965. this.selectRoomNode = new Element("div", {"styles": this.css.createMeetingInfoSelectRoomNode}).inject(this.formNode);
  966. this.selectRoomNode.addEvent("mousedown", function(e){e.stopPropagation();});
  967. if (callback) callback();
  968. }else{
  969. if (callback) callback();
  970. }
  971. },
  972. loadSelectRooms: function(){
  973. var result = this.form.getResult(false,null,false,false,true);
  974. var d = result.dateInput;
  975. var bt = result.beginTimeInput;
  976. var et = result.endTimeInput;
  977. var start = d+" "+bt;
  978. var completed = d+" "+et;
  979. this.app.actions.listBuildingByRange(start, completed, function(json){
  980. json.data.each(function(building){
  981. var node = new Element("div", {"styles": this.css.createMeetingInfoSelectRoomItem1Node}).inject(this.selectRoomNode);
  982. var nodeName = new Element("div", {"styles": this.css.createMeetingInfoSelectRoomItem1NameNode, "text": building.name}).inject(node);
  983. var nodeAddr = new Element("div", {"styles": this.css.createMeetingInfoSelectRoomItem1AddrNode, "text": building.address}).inject(node);
  984. building.roomList.each(function(room, i){
  985. if (room.available && room.idle) this.createRoomSelectNode(room, i, building);
  986. }.bind(this));
  987. }.bind(this));
  988. }.bind(this));
  989. },
  990. createRoomSelectNode: function(room, i, building){
  991. var roomNode = new Element("div", {"styles": this.css.roomTitleNode}).inject(this.selectRoomNode);
  992. var capacityNode = new Element("div", {"styles": this.css.roomTitleCapacityNode, "text": room.capacity+this.lp.person}).inject(roomNode);
  993. var inforNode = new Element("div", {"styles": this.css.roomTitleInforNode}).inject(roomNode);
  994. var node = new Element("div", {"styles": {"height": "20px"}}).inject(inforNode);
  995. var numberNode = new Element("div", {"styles": this.css.roomTitleNumberNode, "text": (room.roomNumber) ? "#"+room.roomNumber : ""}).inject(node);
  996. var nameNode = new Element("div", {"styles": this.css.roomTitleNameNode, "text": room.name}).inject(node);
  997. var iconsNode = new Element("div", {"styles": this.css.roomTitleIconsNode}).inject(inforNode);
  998. var deviceList = room.device.split("#");
  999. deviceList.each(function(name){
  1000. if( name ){
  1001. var node = new Element("div", {"styles": this.css.roomTitleIconNode, "title": this.lp.device[name]}).inject(iconsNode);
  1002. node.setStyle("background-image", "url(../x_component_Meeting/$RoomView/default/icon/device/"+name+"_disable.png)");
  1003. }
  1004. }.bind(this));
  1005. if ((i % 2)!=0) roomNode.setStyle("background-color", "#f4f8ff");
  1006. roomNode.store("room", room);
  1007. var _self = this;
  1008. if (room.idle){
  1009. roomNode.addEvents({
  1010. "mouseover": function(e){
  1011. var color = roomNode.getStyle("background-color");
  1012. this.store("bgcolor", color);
  1013. this.setStyle("background-color", "#e4edfc");
  1014. },
  1015. "mouseout": function(){
  1016. var color = this.retrieve("bgcolor", "#FFF");
  1017. this.setStyle("background-color", color);
  1018. },
  1019. "click": function(){
  1020. var roomData = this.retrieve("room");
  1021. _self.roomId = roomData.id;
  1022. //roomNode.inject(_self.roomInput);
  1023. _self.roomInput.set("text", roomData.name+" ("+building.name+")");
  1024. _self.hideRoomNode();
  1025. }
  1026. });
  1027. }else{
  1028. roomNode.setStyle("background-color", "#fff6f6");
  1029. var disabledNode = new Element("div", {"styles": this.css.roomTitleDisabledIconNode}).inject(roomNode);
  1030. }
  1031. },
  1032. hideRoomNode: function(){
  1033. this.selectRoomNode.empty();
  1034. this.selectRoomNode.setStyle("display", "none");
  1035. document.body.removeEvent("mousedown", this.hideRoomNodeFun);
  1036. },
  1037. setCreateRoomSelectBuildingNodeSize: function(){
  1038. var p = this.createRoomBuildingInput.getPosition(this.createRoomBuildingInput.getOffsetParent());
  1039. this.createRoomSelectBuildingNode.position({
  1040. relativeTo: this.createRoomBuildingInput,
  1041. position: 'bottomCenter',
  1042. edge: 'upperCenter',
  1043. offset: {x: 0, y: 0}
  1044. });
  1045. this.createRoomSelectBuildingNode.setStyle("left", p.x);
  1046. var size = this.createRoomBuildingInput.getSize();
  1047. var w = size.x-2;
  1048. this.createRoomSelectBuildingNode.setStyle("width", ""+w+"px");
  1049. },
  1050. loadAttachment: function(){
  1051. this.attachmentTr.setStyle("display","");
  1052. this.attachmentNode = new Element("div", {"styles": this.css.createMeetingAttachmentNode}).inject(this.attachmentArea);
  1053. var attachmentContentNode = new Element("div", {"styles": this.css.createMeetingAttachmentContentNode}).inject(this.attachmentNode);
  1054. MWF.require("MWF.widget.AttachmentController", function(){
  1055. this.attachmentController = new MWF.widget.AttachmentController(attachmentContentNode, this, {
  1056. "size": "min",
  1057. "isSizeChange": false,
  1058. "isReplace": false,
  1059. "isUpload": this.isNew || this.isEdited,
  1060. "isDelete": this.isNew || this.isEdited,
  1061. "isDownload": true,
  1062. "readonly": !this.isNew && !this.isEdited
  1063. });
  1064. this.attachmentController.load();
  1065. if( this.data.attachmentList ){
  1066. this.data.attachmentList.each(function (att) {
  1067. att.person = att.lastUpdatePerson.split("@")[0];
  1068. var at = this.attachmentController.addAttachment(att);
  1069. }.bind(this));
  1070. }
  1071. }.bind(this));
  1072. },
  1073. uploadAttachment: function(e, node){
  1074. if (!this.uploadFileAreaNode){
  1075. this.createUploadFileNode();
  1076. }
  1077. this.fileUploadNode.click();
  1078. },
  1079. createUploadFileNode: function(){
  1080. this.uploadFileAreaNode = new Element("div");
  1081. var html = "<input name=\"file\" type=\"file\" multiple/>";
  1082. this.uploadFileAreaNode.set("html", html);
  1083. this.fileUploadNode = this.uploadFileAreaNode.getFirst();
  1084. this.fileUploadNode.addEvent("change", function(){
  1085. var files = this.fileUploadNode.files;
  1086. if (files.length){
  1087. for (var i = 0; i < files.length; i++) {
  1088. var file = files.item(i);
  1089. var formData = new FormData();
  1090. formData.append('file', file);
  1091. //formData.append('folder', folderId);
  1092. this.app.actions.addAttachment(this.data.id, formData, file, function(o, text){
  1093. if (o.id){
  1094. this.app.actions.getAttachment(o.id, function(json){
  1095. if (json.data) this.attachmentController.addAttachment(json.data);
  1096. this.attachmentController.checkActions();
  1097. }.bind(this))
  1098. }
  1099. this.attachmentController.checkActions();
  1100. }.bind(this));
  1101. }
  1102. }
  1103. }.bind(this));
  1104. },
  1105. deleteAttachments: function(e, node, attachments){
  1106. var names = [];
  1107. attachments.each(function(attachment){
  1108. names.push(attachment.data.name);
  1109. }.bind(this));
  1110. var _self = this;
  1111. this.app.confirm("warn", e, this.lp.deleteAttachmentTitle, this.lp.deleteAttachment+"( "+names.join(", ")+" )", 300, 120, function(){
  1112. while (attachments.length){
  1113. attachment = attachments.shift();
  1114. _self.deleteAttachment(attachment);
  1115. }
  1116. this.close();
  1117. }, function(){
  1118. this.close();
  1119. }, null);
  1120. },
  1121. deleteAttachment: function(attachment){
  1122. this.app.actions.deleteFile(attachment.data.id, function(josn){
  1123. this.attachmentController.removeAttachment(attachment);
  1124. this.attachmentController.checkActions();
  1125. }.bind(this));
  1126. },
  1127. downloadAttachment: function(e, node, attachments){
  1128. attachments.each(function(att){
  1129. this.app.actions.getFileDownload(att.data.id);
  1130. }.bind(this));
  1131. },
  1132. openAttachment: function(e, node, attachments){
  1133. attachments.each(function(att){
  1134. this.app.actions.getFile(att.data.id);
  1135. }.bind(this));
  1136. },
  1137. getAttachmentUrl: function(attachment, callback){
  1138. this.app.actions.getFileUrl(attachment.data.id, callback);
  1139. },
  1140. save: function(){
  1141. this._save(function(){
  1142. this.app.notice(this.lp.meeting_saveSuccess, "success");
  1143. if (!this.attachmentNode){
  1144. this.loadAttachment();
  1145. }
  1146. }.bind(this));
  1147. },
  1148. _save: function(callback){
  1149. this.getSaveData();
  1150. var now = new Date();
  1151. var errorText = "";
  1152. if (!this.data.subject) errorText +=this.lp.meeting_input_subject_error;
  1153. if (!this.data.room) errorText +=this.lp.meeting_input_room_error;
  1154. if (!this.data.invitePersonList.length) errorText +=this.lp.meeting_input_person_error;
  1155. if( this.data.startTimeDate ){
  1156. if (this.data.startTimeDate.diff(this.data.completedTimeDate, "minute")<1) errorText +=this.lp.meeting_input_time_error;
  1157. if (now.diff(this.data.startTimeDate, "minute")<0) errorText +=this.lp.meeting_input_date_error;
  1158. delete this.data.startTimeDate;
  1159. delete this.data.completedTimeDate;
  1160. }
  1161. if (errorText){
  1162. this.app.notice(this.lp.meeting_input_error+errorText, "error");
  1163. return false;
  1164. }
  1165. this.app.actions.saveMeeting(this.data, function(json){
  1166. this.data.id = json.data.id;
  1167. this.waitReload = true;
  1168. if (callback) callback();
  1169. }.bind(this));
  1170. },
  1171. getSaveData: function(){
  1172. this.data = this.form.getResult(false,null,false,false,true);
  1173. this.data.room = this.roomId;
  1174. if( this.invitePersonList ){
  1175. this.data.invitePersonList = this.invitePersonList;
  1176. }
  1177. var d = this.data.dateInput;
  1178. if( this.isNew ) {
  1179. var startTime = d + " " + this.data.beginTimeInput + ":0";
  1180. var completedTime = d + " " + this.data.endTimeInput + ":0";
  1181. var startTimeDate = Date.parse(startTime);
  1182. var completedTimeDate = Date.parse(completedTime);
  1183. this.data.startTime = startTime;
  1184. this.data.completedTime = completedTime;
  1185. this.data.startTimeDate = startTimeDate;
  1186. this.data.completedTimeDate = completedTimeDate;
  1187. }
  1188. if( this.isNew ){
  1189. delete this.data.applicant;
  1190. }else{
  1191. this.data.applicant = this.data.applicant.join(",")
  1192. }
  1193. },
  1194. getPersonByIdentity : function( identity ){
  1195. },
  1196. getPerson : function( source ){
  1197. if( typeOf(source) != "array" )source = [source];
  1198. var target = [];
  1199. source.each( function( s ){
  1200. if( s.split("@").getLast().toLowerCase() == "i" ){
  1201. target.push( this.getPersonByIdentity( s ) )
  1202. }else{
  1203. target.push( s )
  1204. }
  1205. }.bind(this));
  1206. return target;
  1207. },
  1208. reject: function(e){
  1209. var _self = this;
  1210. var text = this.app.lp.reject_confirm.replace(/{name}/g, this.data.subject);
  1211. this.app.confirm("infor", e, this.app.lp.reject_confirm_title, text, 300, 120, function(){
  1212. _self.rejectMeeting();
  1213. this.close();
  1214. _self.close();
  1215. }, function(){
  1216. this.close();
  1217. });
  1218. },
  1219. rejectMeeting: function(){
  1220. var view = this.view;
  1221. this.app.actions.rejectMeeting(this.data.id, function(){
  1222. view.reload();
  1223. }.bind(this))
  1224. },
  1225. accept: function(e){
  1226. var _self = this;
  1227. var text = this.app.lp.accept_confirm.replace(/{name}/g, this.data.subject);
  1228. this.app.confirm("infor", e, this.app.lp.accept_confirm_title, text, 300, 120, function(){
  1229. _self.acceptMeeting();
  1230. this.close();
  1231. _self.close();
  1232. }, function(){
  1233. this.close();
  1234. });
  1235. },
  1236. acceptMeeting: function(){
  1237. var view = this.view;
  1238. this.app.actions.acceptMeeting(this.data.id, function(){
  1239. view.reload();
  1240. }.bind(this))
  1241. },
  1242. close: function (e) {
  1243. this.fireEvent("queryClose");
  1244. this._close();
  1245. //if( this.form ){
  1246. // this.form.destroy();
  1247. //}
  1248. if(this.setFormNodeSizeFun && this.app ){
  1249. this.app.removeEvent("resize",this.setFormNodeSizeFun);
  1250. }
  1251. if( this.formMaskNode )this.formMaskNode.destroy();
  1252. this.formAreaNode.destroy();
  1253. this.fireEvent("postClose");
  1254. if( this.waitReload )this.view.reload();
  1255. delete this;
  1256. }
  1257. });
  1258. MWF.xApplication.Meeting.MeetingTooltip = new Class({
  1259. Extends: MTooltips,
  1260. _loadCustom : function( callback ){
  1261. this.loadRoom( function(){
  1262. this.loadInvite();
  1263. this.loadAttachment();
  1264. if(callback)callback();
  1265. }.bind(this) );
  1266. },
  1267. _getHtml : function(){
  1268. var data = this.data;
  1269. var titleStyle = "font-size:14px;color:#333";
  1270. var valueStyle = "font-size:14px;color:#666;padding-right:20px";
  1271. var persons = [];
  1272. data.invitePersonList.each( function( p ){
  1273. persons.push(p.split("@")[0] )
  1274. }.bind(this));
  1275. var color = "#ccc";
  1276. switch (data.status){
  1277. case "wait":
  1278. color = "#4990E2";
  1279. break;
  1280. case "processing":
  1281. color = "#66CC7F";
  1282. break;
  1283. case "completed":
  1284. color = "#666";
  1285. break;
  1286. }
  1287. if (data.myWaitAccept){
  1288. color = "#F6A623";
  1289. }
  1290. if (data.confilct){
  1291. color = "#FF7F7F";
  1292. }
  1293. var beginDate = Date.parse(data.startTime);
  1294. var endDate = Date.parse(data.completedTime);
  1295. var dateStr = beginDate.format(this.app.lp.dateFormatDay);
  1296. var beginTime = this.getString( beginDate.getHours() ) + ":" + this.getString( beginDate.getMinutes() );
  1297. var endTime = this.getString( endDate.getHours() ) + ":" + this.getString( endDate.getMinutes() );
  1298. var meetingTime = dateStr + " " + beginTime + "-" + endTime;
  1299. var description = (data.description || "")+(data.summary || "");
  1300. var html =
  1301. "<div style='overflow: hidden;padding:15px 20px 20px 10px;height:16px;line-height:16px;'>" +
  1302. " <div style='font-size: 12px;color:#666; float: right'>"+ this.lp.applyPerson +":" + data.applicant.split("@")[0] +"</div>" +
  1303. " <div style='font-size: 16px;color:#333;float: left'>"+ this.lp.meetingDetail +"</div>"+
  1304. "</div>"+
  1305. "<div style='font-size: 18px;color:#333;padding:0px 10px 15px 20px;'>"+ data.subject +"</div>"+
  1306. "<div style='height:1px;margin:0px 20px;border-bottom:1px solid #ccc;'></div>"+
  1307. "<table width='100%' bordr='0' cellpadding='7' cellspacing='0' style='margin:13px 13px 13px 13px;'>" +
  1308. "<tr><td style='"+titleStyle+";' width='70'>"+this.lp.meetingTime+":</td>" +
  1309. " <td style='"+valueStyle+";color:"+ color +"'>" + meetingTime + "</td></tr>" +
  1310. //"<tr><td style='"+titleStyle+"' width='70'>"+this.lp.beginTime+":</td>" +
  1311. //" <td style='"+valueStyle+"'>" + data.startTime + "</td></tr>" +
  1312. //"<tr><td style='"+titleStyle+"'>"+this.lp.endTime+":</td>" +
  1313. //" <td style='"+valueStyle+"'>" + data.completedTime + "</td></tr>" +
  1314. "<tr><td style='"+titleStyle+"'>"+this.lp.selectRoom +":</td>" +
  1315. " <td style='"+valueStyle+"' item='meetingRoom'></td></tr>" +
  1316. "<tr><td style='"+titleStyle+"'>"+this.lp.invitePerson2+":</td>" +
  1317. " <td style='"+valueStyle+"' item='invitePerson'>"+persons.join(",")+"</td></tr>" +
  1318. "<tr><td style='"+titleStyle+"'>"+this.lp.meetingDescription+":</td>" +
  1319. " <td style='"+valueStyle+"'>"+ description +"</td></tr>" +
  1320. ( this.options.isHideAttachment ? "" :
  1321. "<tr><td style='"+titleStyle+"'>"+this.lp.meetingAttachment+":</td>" +
  1322. " <td style='"+valueStyle+"' item='attachment'></td></tr>"
  1323. )+
  1324. "</table>";
  1325. return html;
  1326. },
  1327. getString : function( str ){
  1328. var s = "00" + str;
  1329. return s.substr(s.length - 2, 2 );
  1330. },
  1331. loadRoom: function( callback ){
  1332. var area = this.node.getElement("[item='meetingRoom']");
  1333. if (this.data.room){
  1334. this.app.actions.getRoom(this.data.room, function(json){
  1335. this.app.actions.getBuilding(json.data.building, function(bjson){
  1336. area.set("text", json.data.name+" ("+bjson.data.name+")");
  1337. if( callback )callback();
  1338. }.bind(this));
  1339. }.bind(this));
  1340. }
  1341. },
  1342. loadInvite : function(){
  1343. this.O2PersonList = [];
  1344. var area = this.node.getElement("[item='invitePerson']");
  1345. MWF.require("MWF.widget.O2Identity", function(){
  1346. area.empty();
  1347. this.data.invitePersonList.each(function( person ){
  1348. var O2person = new MWF.widget.O2Person({name : person}, area, {"style": "room", "onLoadedInfor": function(item){
  1349. this.loadAcceptAndReject( item );
  1350. }.bind(this) });
  1351. this.O2PersonList.push( O2person );
  1352. }.bind(this));
  1353. }.bind(this));
  1354. },
  1355. loadAcceptAndReject : function( item ){
  1356. var personName = item.data.distinguishedName;
  1357. if( this.data.acceptPersonList ){
  1358. if (this.data.acceptPersonList.indexOf(personName)!==-1){
  1359. var acceptNode = new Element("div", {"styles": {
  1360. "height": "20px",
  1361. "width": "14px",
  1362. "margin-right": "3px",
  1363. "float": "left",
  1364. "background": "url(../x_component_Template/$MPopupForm/meeting/icon/accept.png) no-repeat center center"
  1365. }}).inject(item.node, "top");
  1366. new Element("div", {
  1367. "styles" : {"color": "#1fbf04", "clear":"both","text-align":"center"},
  1368. "text": this.app.lp.accepted
  1369. }).inject(item.inforNode);
  1370. }
  1371. }
  1372. if(this.data.rejectPersonList){
  1373. if (this.data.rejectPersonList.indexOf(personName)!==-1){
  1374. var rejectNode = new Element("div", {"styles": {
  1375. "height": "20px",
  1376. "width": "14px",
  1377. "margin-right": "3px",
  1378. "float": "left",
  1379. "background": "url(../x_component_Template/$MPopupForm/meeting/icon/reject.png) no-repeat center center"
  1380. }}).inject(item.node, "top");
  1381. new Element("div", {
  1382. "styles" : {"color": "#FF0000", "clear":"both","text-align":"center"},
  1383. "text": this.app.lp.rejected
  1384. }).inject(item.inforNode);
  1385. }
  1386. }
  1387. },
  1388. destroy: function(){
  1389. if( this.O2PersonList ){
  1390. this.O2PersonList.each(function(p){
  1391. p.destroy();
  1392. })
  1393. }
  1394. if( this.node ){
  1395. this.node.destroy();
  1396. this.node = null;
  1397. }
  1398. },
  1399. loadAttachment: function(){
  1400. if( this.options.isHideAttachment )return;
  1401. if( typeOf(this.data.attachmentList)=="array" && this.data.attachmentList[0] ){
  1402. var area = this.node.getElement("[item='attachment']");
  1403. this.attachmentNode = new Element("div"
  1404. //{"styles": this.css.createMeetingAttachmentNode}
  1405. ).inject(area);
  1406. var attachmentContentNode = new Element("div", {
  1407. //"styles": this.css.createMeetingAttachmentContentNode
  1408. }).inject(this.attachmentNode);
  1409. this.attachmentController = new MWF.xApplication.Meeting.MeetingTooltip.AttachmentController(attachmentContentNode, this, {
  1410. "size": "min",
  1411. "isSizeChange": false,
  1412. "isReplace": false,
  1413. "isUpload": false,
  1414. "isDelete": false,
  1415. "isDownload": true,
  1416. "readonly": true
  1417. });
  1418. this.attachmentController.load();
  1419. this.data.attachmentList.each(function (att) {
  1420. att.person = att.lastUpdatePerson.split("@")[0];
  1421. var at = this.attachmentController.addAttachment(att);
  1422. }.bind(this));
  1423. }
  1424. },
  1425. downloadAttachment: function(e, node, attachments){
  1426. attachments.each(function(att){
  1427. this.app.actions.getFileDownload(att.data.id);
  1428. }.bind(this));
  1429. },
  1430. openAttachment: function(e, node, attachments){
  1431. attachments.each(function(att){
  1432. this.app.actions.getFile(att.data.id);
  1433. }.bind(this));
  1434. },
  1435. getAttachmentUrl: function(attachment, callback){
  1436. this.app.actions.getFileUrl(attachment.data.id, callback);
  1437. }
  1438. });
  1439. MWF.xApplication.Meeting.MeetingTooltip.AttachmentController = new Class({
  1440. Extends : MWF.widget.AttachmentController,
  1441. loadMin: function(){
  1442. if (!this.node) this.node = new Element("div", {"styles": this.css.container_min});
  1443. if (!this.minActionAreaNode){
  1444. //this.minActionAreaNode = new Element("div", {"styles": this.css.minActionAreaNode}).inject(this.node);
  1445. this.minContent = new Element("div", {"styles": this.css.minContentNode}).inject(this.node);
  1446. this.minContent.setStyles({
  1447. "margin-right" : "0px"
  1448. });
  1449. //this.min_downloadAction = this.createAction(this.minActionAreaNode, "download", MWF.LP.widget.download, function(e, node){
  1450. // this.downloadAttachment(e, node);
  1451. //}.bind(this));
  1452. this.node.inject(this.container);
  1453. //if (this.options.readonly) this.setReadonly();
  1454. this.checkActions();
  1455. this.setEvent();
  1456. }else{
  1457. //this.minActionAreaNode.setStyle("display", "block");
  1458. this.minContent.setStyle("display", "block");
  1459. this.minContent.empty();
  1460. }
  1461. var atts = [];
  1462. while (this.attachments.length){
  1463. var att = this.attachments.shift();
  1464. atts.push(new MWF.xApplication.Meeting.MeetingTooltip.AttachmentMin(att.data, this));
  1465. }
  1466. this.attachments = atts;
  1467. },
  1468. addAttachment: function(data){
  1469. if (this.options.size=="min"){
  1470. this.attachments.push(new MWF.xApplication.Meeting.MeetingTooltip.AttachmentMin(data, this));
  1471. }else{
  1472. this.attachments.push(new MWF.widget.AttachmentController.Attachment(data, this));
  1473. }
  1474. }
  1475. });
  1476. MWF.xApplication.Meeting.MeetingTooltip.AttachmentMin = new Class({
  1477. Extends : MWF.widget.AttachmentController.AttachmentMin,
  1478. setEvent: function(){
  1479. this.node.addEvents({
  1480. "mouseover": function(){if (!this.isSelected) this.node.setStyles(this.css["minAttachmentNode_list_over"])}.bind(this),
  1481. "mouseout": function(){if (!this.isSelected) this.node.setStyles(this.css["minAttachmentNode_list"])}.bind(this),
  1482. "mousedown": function(e){this.selected(e);}.bind(this),
  1483. "click": function(e){this.downloadAttachment(e);}.bind(this)
  1484. });
  1485. },
  1486. downloadAttachment: function(e){
  1487. if (this.controller.module) this.controller.module.downloadAttachment(e, null, [this]);
  1488. }
  1489. });
  1490. MWF.xApplication.Meeting.MeetingArea = new Class({
  1491. initialize: function(container, view, data){
  1492. this.container = container;
  1493. this.view = view;
  1494. this.css = this.view.css;
  1495. this.app = this.view.app;
  1496. this.data = data;
  1497. this.beginDate = Date.parse(this.data.startTime);
  1498. this.endDate = Date.parse(this.data.completedTime);
  1499. this.userName = layout.desktop.session.user.distinguishedName;
  1500. this.userId = layout.desktop.session.user.id;
  1501. this.parseData();
  1502. this.path = "../x_component_Meeting/$Common/default/meetingarea/";
  1503. this.cssPath = "../x_component_Meeting/$Common/default/meetingarea/css.wcss";
  1504. this._loadCss();
  1505. this.load();
  1506. },
  1507. load: function(){
  1508. this.node = new Element("div", {"styles": this.css.meetingNode}).inject( this.container );
  1509. this.node.addEvents({
  1510. mouseenter : function(){
  1511. this.node.setStyles( this.css.meetingNode_over );
  1512. this.subjectNode.setStyles( this.css.meetingSubjectNode_over );
  1513. }.bind(this),
  1514. mouseleave : function(){
  1515. this.node.setStyles( this.css.meetingNode );
  1516. this.subjectNode.setStyles( this.css.meetingSubjectNode );
  1517. }.bind(this),
  1518. click : function(){
  1519. this.openMeeting()
  1520. }.bind(this)
  1521. });
  1522. this.colorNode = new Element("div", {"styles": this.css.meetingColorNode}).inject(this.node);
  1523. this.contentNode = new Element("div", {"styles": this.css.meetingContentNode}).inject(this.node);
  1524. var beginTime = (this.beginDate.getHours() < 12 ? this.app.lp.am : this.app.lp.pm) + " " + this.getString( this.beginDate.getHours() ) + ":" + this.getString( this.beginDate.getMinutes() );
  1525. var endTime = (this.endDate.getHours() < 12 ? this.app.lp.am : this.app.lp.pm) + " " + this.getString( this.endDate.getHours() ) + ":" + this.getString( this.endDate.getMinutes() );
  1526. this.timeNode = new Element("div", {
  1527. "styles": this.css.meetingTimeNode,
  1528. "text" : beginTime + "-" + endTime
  1529. }).inject(this.contentNode);
  1530. this.subjectNode = new Element("div", {
  1531. "styles": this.css.meetingSubjectNode,
  1532. "text": this.data.subject
  1533. }).inject(this.contentNode);
  1534. var description = (this.data.description || "")+(this.data.summary || "");
  1535. this.descriptionNode = new Element("div", {
  1536. "styles": this.css.meetingDescriptionNode,
  1537. "text" : description
  1538. }).inject(this.contentNode);
  1539. this.loadActionBar();
  1540. switch (this.data.status){
  1541. case "wait":
  1542. this.colorNode.setStyles({"background-color": "#4990E2"});
  1543. this.timeNode.setStyles({"color": "#4990E2"});
  1544. break;
  1545. case "processing":
  1546. this.colorNode.setStyles({"background-color": "#66CC7F"});
  1547. this.timeNode.setStyles({"color": "#66CC7F"});
  1548. break;
  1549. case "completed":
  1550. //add attachment
  1551. this.colorNode.setStyles({"background-color": "#ccc"});
  1552. this.timeNode.setStyles({"color": "#ccc"});
  1553. break;
  1554. }
  1555. if (this.data.myWaitAccept){
  1556. this.colorNode.setStyles({"background-color": "#F6A623"});
  1557. this.timeNode.setStyles({"color": "#F6A623"});
  1558. }
  1559. this.resetNodeSize();
  1560. this.loadTooltip();
  1561. },
  1562. parseData : function(){
  1563. if( !this.data.status ){
  1564. var now = new Date();
  1565. var status;
  1566. if( this.beginDate > now ){
  1567. status = "wait";
  1568. }else if( this.endDate < now ){
  1569. status = "completed";
  1570. }else{
  1571. status = "processing";
  1572. }
  1573. this.data.status = status;
  1574. }
  1575. if( typeOf( this.data.myWaitAccept ) != "boolean" ){
  1576. if( this.data.invitePersonList.contains( this.userName ) || this.data.invitePersonList.contains( this.userId ) ){
  1577. this.data.myWaitAccept = ( !this.data.acceptPersonList.contains( this.userName ) || this.data.acceptPersonList.contains( this.userId ) ) &&
  1578. ( !this.data.rejectPersonList.contains( this.userName ) || !this.data.rejectPersonList.contains( this.userId ) )
  1579. }
  1580. }
  1581. },
  1582. loadActionBar : function(){
  1583. if( this.userName == this.data.applicant || this.userId == this.data.applicant || MWF.AC.isMeetingAdministrator() || this.data.myWaitAccept ){
  1584. }else{
  1585. return;
  1586. }
  1587. this.actionBar = new Element("div", {
  1588. "styles": this.css.actionBar
  1589. }).inject(this.contentNode);
  1590. //this.viewAction = new Element("div", {
  1591. // styles: this.css.action_view,
  1592. // events : {
  1593. // mouseenter : function(){
  1594. // this.viewAction.setStyles( this.css.action_view_over );
  1595. // }.bind(this),
  1596. // mouseleave : function(){
  1597. // this.viewAction.setStyles( this.css.action_view );
  1598. // }.bind(this),
  1599. // click : function(){
  1600. // this.openMeeting()
  1601. // }.bind(this)
  1602. // }
  1603. //}).inject(this.actionBar);
  1604. if( this.userName == this.data.applicant || this.userId == this.data.applicant || MWF.AC.isMeetingAdministrator() ){
  1605. if( this.data.status=="wait" ){
  1606. this.editAction = new Element("div", {
  1607. styles: this.css.action_edit,
  1608. events : {
  1609. mouseover : function(){
  1610. this.editAction.setStyles( this.css.action_edit_over );
  1611. }.bind(this),
  1612. mouseout : function(){
  1613. this.editAction.setStyles( this.css.action_edit );
  1614. }.bind(this),
  1615. click : function(e){
  1616. this.editMeeting();
  1617. e.stopPropagation();
  1618. }.bind(this)
  1619. }
  1620. }).inject(this.actionBar);
  1621. //if (this.data.myWaitConfirm) this.createConfirmActions();
  1622. //if (this.data.myWaitAccept) this.createAcceptActions();
  1623. //if (this.data.status=="wait" && this.isEdit) this.createCancelActions();
  1624. this.removeAction = new Element("div", {
  1625. styles: this.css.action_remove,
  1626. events : {
  1627. mouseover : function(){
  1628. this.removeAction.setStyles( this.css.action_remove_over );
  1629. }.bind(this),
  1630. mouseout : function(){
  1631. this.removeAction.setStyles( this.css.action_remove );
  1632. }.bind(this),
  1633. click : function( e ){
  1634. this.cancel(e);
  1635. e.stopPropagation();
  1636. }.bind(this)
  1637. }
  1638. }).inject(this.actionBar);
  1639. }
  1640. }
  1641. if (this.data.myWaitAccept){
  1642. this.acceptAction = new Element("div", {
  1643. styles: this.css.action_accept,
  1644. title : this.app.lp.accept,
  1645. events : {
  1646. mouseover : function(){
  1647. this.acceptAction.setStyles( this.css.action_accept_over );
  1648. }.bind(this),
  1649. mouseout : function(){
  1650. this.acceptAction.setStyles( this.css.action_accept );
  1651. }.bind(this),
  1652. click : function( e ){
  1653. this.accept(e);
  1654. e.stopPropagation();
  1655. }.bind(this)
  1656. }
  1657. }).inject(this.actionBar);
  1658. this.rejectAction = new Element("div", {
  1659. styles: this.css.action_reject,
  1660. title : this.app.lp.reject,
  1661. events : {
  1662. mouseover : function(){
  1663. this.rejectAction.setStyles( this.css.action_reject_over );
  1664. }.bind(this),
  1665. mouseout : function(){
  1666. this.rejectAction.setStyles( this.css.action_reject );
  1667. }.bind(this),
  1668. click : function( e ){
  1669. this.reject(e);
  1670. e.stopPropagation();
  1671. }.bind(this)
  1672. }
  1673. }).inject(this.actionBar);
  1674. }
  1675. },
  1676. getString : function( str ){
  1677. var s = "00" + str;
  1678. return s.substr(s.length - 2, 2 );
  1679. },
  1680. _loadCss: function(){
  1681. var key = encodeURIComponent(this.cssPath);
  1682. if (MWF.widget.css[key]){
  1683. this.css = MWF.widget.css[key];
  1684. }else{
  1685. var r = new Request.JSON({
  1686. url: this.cssPath,
  1687. secure: false,
  1688. async: false,
  1689. method: "get",
  1690. noCache: false,
  1691. onSuccess: function(responseJSON, responseText){
  1692. this.css = responseJSON;
  1693. MWF.widget.css[key] = responseJSON;
  1694. }.bind(this),
  1695. onError: function(text, error){
  1696. alert(error + text);
  1697. }
  1698. });
  1699. r.send();
  1700. }
  1701. },
  1702. loadTooltip : function( isHideAttachment ){
  1703. this.tooltip = new MWF.xApplication.Meeting.MeetingTooltip(this.app.content, this.node, this.app, this.data, {
  1704. axis : "x",
  1705. hiddenDelay : 300,
  1706. displayDelay : 300,
  1707. isHideAttachment : isHideAttachment
  1708. });
  1709. },
  1710. showTooltip: function( ){
  1711. if( this.tooltip ){
  1712. this.tooltip.load();
  1713. }else{
  1714. this.tooltip = new MWF.xApplication.Meeting.MeetingTooltip(this.app.content, this.viewAction, this.app, this.data);
  1715. this.tooltip.load();
  1716. }
  1717. },
  1718. openMeeting: function(){
  1719. var form = new MWF.xApplication.Meeting.MeetingForm(this,this.data, {}, {app:this.app});
  1720. form.view = this.view;
  1721. form.open();
  1722. },
  1723. resetNodeSize: function(){
  1724. var contentSize = this.contentNode.getSize();
  1725. this.colorNode.setStyle("height", contentSize.y );
  1726. },
  1727. destroy: function(){
  1728. if(this.tooltip)this.tooltip.destroy();
  1729. this.node.destroy();
  1730. MWF.release(this);
  1731. },
  1732. editMeeting : function(){
  1733. var form = new MWF.xApplication.Meeting.MeetingForm(this,this.data, {}, {app:this.app});
  1734. form.view = this.view;
  1735. form.edit();
  1736. },
  1737. cancel: function(e){
  1738. var _self = this;
  1739. var text = this.app.lp.cancel_confirm.replace(/{name}/g, this.data.subject);
  1740. this.app.confirm("infor", e, this.app.lp.cancel_confirm_title, text, 380, 150, function(){
  1741. _self.cancelMeeting();
  1742. this.close();
  1743. }, function(){
  1744. this.close();
  1745. });
  1746. },
  1747. cancelMeeting: function(){
  1748. var view = this.view;
  1749. this.app.actions.deleteMeeting(this.data.id, function(){
  1750. view.reload();
  1751. }.bind(this))
  1752. },
  1753. reject: function(e){
  1754. var _self = this;
  1755. var text = this.app.lp.reject_confirm.replace(/{name}/g, this.data.subject);
  1756. this.app.confirm("infor", e, this.app.lp.reject_confirm_title, text, 300, 120, function(){
  1757. _self.rejectMeeting();
  1758. this.close();
  1759. }, function(){
  1760. this.close();
  1761. });
  1762. },
  1763. rejectMeeting: function(){
  1764. var view = this.view;
  1765. this.app.actions.rejectMeeting(this.data.id, function(){
  1766. view.reload();
  1767. }.bind(this))
  1768. },
  1769. accept: function(e){
  1770. var _self = this;
  1771. var text = this.app.lp.accept_confirm.replace(/{name}/g, this.data.subject);
  1772. this.app.confirm("infor", e, this.app.lp.accept_confirm_title, text, 300, 120, function(){
  1773. _self.acceptMeeting();
  1774. this.close();
  1775. }, function(){
  1776. this.close();
  1777. });
  1778. },
  1779. acceptMeeting: function(){
  1780. var view = this.view;
  1781. this.app.actions.acceptMeeting(this.data.id, function(){
  1782. view.reload();
  1783. }.bind(this))
  1784. },
  1785. disagree: function(e){
  1786. var _self = this;
  1787. var text = this.app.lp.disagree_confirm.replace(/{name}/g, this.data.subject);
  1788. this.app.confirm("infor", e, this.app.lp.disagree_confirm_title, text, 300, 120, function(){
  1789. _self.disagreeMeeting();
  1790. this.close();
  1791. }, function(){
  1792. this.close();
  1793. });
  1794. },
  1795. disagreeMeeting: function(){
  1796. var view = this.view;
  1797. this.app.actions.denyMeeting(this.data.id, function(){
  1798. view.reload();
  1799. }.bind(this))
  1800. },
  1801. agree: function(e){
  1802. var _self = this;
  1803. var text = this.app.lp.agree_confirm.replace(/{name}/g, this.data.subject);
  1804. this.app.confirm("infor", e, this.app.lp.agree_confirm_title, text, 300, 120, function(){
  1805. _self.agreeMeeting();
  1806. this.close();
  1807. }, function(){
  1808. this.close();
  1809. });
  1810. },
  1811. agreeMeeting: function(){
  1812. var view = this.view;
  1813. this.app.actions.allowMeeting(this.data.id, function(){
  1814. view.reload();
  1815. }.bind(this))
  1816. }
  1817. });
  1818. MWF.xApplication.Meeting.SideBar = new Class({
  1819. Extends: MWF.widget.Common,
  1820. Implements: [Options, Events],
  1821. options: {
  1822. "style": "default"
  1823. },
  1824. initialize : function( container, app, options){
  1825. this.setOptions( options );
  1826. this.container = container;
  1827. this.app = app;
  1828. //this.css = this.app.css;
  1829. this.lp = this.app.lp;
  1830. this.isHidden = false;
  1831. this.cssPath = "../x_component_Meeting/$Common/"+this.options.style+"/sidebar/css.wcss";
  1832. this._loadCss();
  1833. this.load();
  1834. },
  1835. load : function(){
  1836. this.node = new Element("div.sideBar", {
  1837. "styles": this.css.node,
  1838. events : {
  1839. mousedown : function( ev ){
  1840. ev.stopPropagation();
  1841. }
  1842. }
  1843. }).inject(this.container);
  1844. this.contentNode = new Element("div", {"styles": this.css.contentNode}).inject(this.node);
  1845. this.loadStatusArea();
  1846. new Element("div.contentLine", {
  1847. "styles" : this.css.contentLine
  1848. }).inject( this.contentNode );
  1849. this.loadTodayMeetingNode();
  1850. this.trapezoid = new Element("div.trapezoid",{
  1851. "styles":this.css.trapezoid_toRight,
  1852. events : {
  1853. click : function(){
  1854. this.trigger();
  1855. }.bind(this)
  1856. }
  1857. }).inject(this.node);
  1858. //this.contentNode.getElements("div.line").setStyles(this.css.configContentLine);
  1859. this.loadTodayMeeting( function(){
  1860. var x = this.node.getSize().x - 8;
  1861. this.node.setStyle( "right", "-"+x+"px" );
  1862. this.resetNodeSize();
  1863. this.resetNodeSizeFun = this.resetNodeSize.bind(this);
  1864. this.app.addEvent("resize", this.resetNodeSizeFun );
  1865. this.hideFun = this.hide.bind(this);
  1866. this.app.node.addEvent("mousedown", this.hideFun);
  1867. }.bind(this));
  1868. },
  1869. loadStatusArea : function(){
  1870. var area = new Element("div", {
  1871. "styles" : this.css.statusArea
  1872. }).inject( this.contentNode );
  1873. var html = "<div class='titleDiv'>"+this.lp.config.meetingStatus+"</div>" +
  1874. "<div class = 'statusStyle'>"+
  1875. " <div class='statusIconStyle' style='background-color:#4990E2'></div>" +
  1876. " <div class = 'statusTextStyle'>"+this.lp.config.wait+"</div></div>" +
  1877. "</div>"+
  1878. "<div class = 'statusStyle'>"+
  1879. " <div class='statusIconStyle' style='background-color:#66CC7F'></div>" +
  1880. " <div class = 'statusTextStyle'>"+this.lp.config.progress+"</div></div>" +
  1881. "</div>"+
  1882. "<div class = 'statusStyle'>"+
  1883. " <div class='statusIconStyle' style='background-color:#F6A623'></div>" +
  1884. " <div class = 'statusTextStyle'>"+this.lp.config.invite+"</div></div>" +
  1885. "</div>"+
  1886. "<div class = 'statusStyle'>"+
  1887. " <div class='statusIconStyle' style='background-color:#ccc'></div>" +
  1888. " <div class = 'statusTextStyle'>"+this.lp.config.completed+"</div></div>" +
  1889. "</div>"+
  1890. "<div class = 'statusStyle'>"+
  1891. " <div class='statusIconStyle2' style='border:2px solid #FF7F7F;'></div>" +
  1892. " <div class = 'statusTextStyle'>"+this.lp.config.conflict+"</div></div>" +
  1893. "</div>";
  1894. area.set("html", html);
  1895. area.getElements("div.titleDiv").setStyles( this.css.titleDiv );
  1896. area.getElements("div.statusStyle").setStyles( this.css.statusStyle );
  1897. area.getElements("div.statusIconStyle").setStyles( this.css.statusIconStyle );
  1898. area.getElements("div.statusIconStyle2").setStyles( this.css.statusIconStyle2 );
  1899. area.getElements("div.statusTextStyle").setStyles( this.css.statusTextStyle );
  1900. },
  1901. loadTodayMeetingNode: function(){
  1902. var area = new Element("div.meetingArea", {
  1903. "styles" : this.css.meetingArea
  1904. }).inject( this.contentNode );
  1905. new Element("div.titleDiv", {
  1906. "styles" : this.css.titleDiv,
  1907. "text" : this.lp.meetingNotice
  1908. }).inject( area );
  1909. this.meetingNode = Element("div", {
  1910. "styles" : this.css.meetingNode
  1911. }).inject( area );
  1912. },
  1913. loadTodayMeeting : function( callback ){
  1914. var today = new Date();
  1915. var user = layout.desktop.session.user;
  1916. var dn = user.distinguishedName;
  1917. var y = today.getFullYear();
  1918. var m = today.getMonth()+1;
  1919. var d = today.getDate();
  1920. this.app.actions.listMeetingDay(y, m, d, function(json) {
  1921. var data = [];
  1922. json.data.each( function( d ){
  1923. if( d.invitePersonList.contains( dn ) || d.applicant == dn ){
  1924. if( !d.rejectPersonList.contains( dn ) ){
  1925. data.push( d );
  1926. }
  1927. }
  1928. }.bind(this));
  1929. if( user.distinguishedName ){
  1930. var userName = user.distinguishedName.split("@")[0]
  1931. }else{
  1932. var userName = user.name
  1933. }
  1934. var lp = data.length ? this.lp.meetingTopInfor : this.lp.noMeetingTopInfor ;
  1935. this.meetingTopNode = new Element("div", {
  1936. "styles" : this.css.meetingTopNode,
  1937. "html" : lp.replace("{userName}",userName).replace("{count}",data.length )
  1938. }).inject( this.meetingNode );
  1939. this.scrollNode = new Element("div.scrollNode", {
  1940. "styles" : this.css.scrollNode
  1941. }).inject( this.meetingNode );
  1942. this.meetingItemContainer = new Element("div.meetingItemContainer", {
  1943. "styles" : this.css.meetingItemContainer
  1944. }).inject( this.scrollNode );
  1945. data.each( function( d, i ){
  1946. var itemNode = new Element("div.meetingItemNode", {
  1947. "styles" : this.css.meetingItemNode,
  1948. "events" : {
  1949. click : function(){
  1950. this.obj.openMeeting( this.data );
  1951. }.bind({ obj : this, data : d })
  1952. }
  1953. }).inject( this.meetingItemContainer );
  1954. this.tooltipList = this.tooltipList || [];
  1955. this.tooltipList.push( new MWF.xApplication.Meeting.MeetingTooltip(this.app.content, itemNode, this.app, d, {
  1956. axis : "x",
  1957. hiddenDelay : 300,
  1958. displayDelay : 300
  1959. })
  1960. );
  1961. var colorNode = new Element("div.meetingItemColorNode", {
  1962. "styles" : this.css.meetingItemColorNode,
  1963. "text" : i+1
  1964. }).inject( itemNode );
  1965. var textNode = new Element("div.meetingItemTextNode", {
  1966. "styles" : this.css.meetingItemTextNode,
  1967. "text" : d.subject
  1968. }).inject( itemNode );
  1969. switch (d.status){
  1970. case "wait":
  1971. colorNode.setStyles({"background-color": "#4990E2"});
  1972. break;
  1973. case "processing":
  1974. colorNode.setStyles({"background-color": "#66CC7F"});
  1975. break;
  1976. case "completed":
  1977. //add attachment
  1978. colorNode.setStyles({"background-color": "#ccc"});
  1979. break;
  1980. }
  1981. if (d.myWaitAccept){
  1982. colorNode.setStyles({"background-color": "#F6A623"});
  1983. }
  1984. var y = itemNode.getSize().y ;
  1985. colorNode.setStyle("margin-top", ( y - 20)/2 );
  1986. }.bind(this));
  1987. this.setScrollBar( this.scrollNode );
  1988. if( callback )callback();
  1989. }.bind(this));
  1990. },
  1991. trigger : function(){
  1992. this.isHidden ? this.show( true ) : this.hide( true )
  1993. },
  1994. hide: function( isFireEvent ){
  1995. var x = this.node.getSize().x - 9;
  1996. var fx = new Fx.Morph(this.node, {
  1997. "duration": "300",
  1998. "transition": Fx.Transitions.Expo.easeOut
  1999. });
  2000. fx.start({
  2001. //"opacity": 0
  2002. }).chain(function(){
  2003. this.isHidden = true;
  2004. //this.node.setStyle("display", "none");
  2005. this.node.setStyles({
  2006. "right": "-"+x+"px"
  2007. });
  2008. this.trapezoid.setStyles( this.css.trapezoid_toLeft );
  2009. //if(isFireEvent)this.app.fireEvent("resize");
  2010. }.bind(this));
  2011. },
  2012. show: function( isFireEvent ){
  2013. this.node.setStyles(this.css.node);
  2014. this.trapezoid.setStyles( this.css.trapezoid_toRight );
  2015. //var x = this.node.getSize().x - 8;
  2016. //this.node.setStyles( "right", "-"+x+"px" );
  2017. var fx = new Fx.Morph(this.node, {
  2018. "duration": "500",
  2019. "transition": Fx.Transitions.Expo.easeOut
  2020. });
  2021. this.app.fireAppEvent("resize");
  2022. fx.start({
  2023. "opacity": 1
  2024. }).chain(function(){
  2025. this.node.setStyles({
  2026. //"position": "static",
  2027. //"width": "auto"
  2028. "right": "0px"
  2029. });
  2030. this.isHidden = false;
  2031. //if(isFireEvent)this.app.fireEvent("resize");
  2032. }.bind(this))
  2033. },
  2034. //show: function(){
  2035. // this.node.setStyles(this.css.configNode);
  2036. // var fx = new Fx.Morph(this.node, {
  2037. // "duration": "500",
  2038. // "transition": Fx.Transitions.Expo.easeOut
  2039. // });
  2040. // fx.start({
  2041. // "opacity": 1
  2042. // }).chain(function(){
  2043. // this.hideFun = this.hide.bind(this);
  2044. // this.app.content.addEvent("mousedown", this.hideFun);
  2045. // }.bind(this));
  2046. //},
  2047. //hide: function(){
  2048. // this.node.destroy();
  2049. // this.app.content.removeEvent("mousedown", this.hideFun);
  2050. // MWF.release(this);
  2051. //},
  2052. resetNodeSize: function(){
  2053. var size = this.container.getSize();
  2054. this.node.setStyle("height", size.y - 50 );
  2055. this.trapezoid.setStyle("top", ( (size.y - 50)/2 - this.trapezoid.getSize().y/2 ));
  2056. var y = size.y - 395;
  2057. var meetContainerY = this.meetingItemContainer.getSize().y + 12;
  2058. this.scrollNode.setStyle("height", Math.min( y, meetContainerY ) );
  2059. },
  2060. getSize : function(){
  2061. //var size = this.node.getSize();
  2062. //return {
  2063. // x : this.isHidden ? 9 : size.x,
  2064. // y : size.y
  2065. //}
  2066. return { x : 9, y : 0 }
  2067. },
  2068. showByType : function( type ){
  2069. },
  2070. reload : function(){
  2071. this.destory();
  2072. this.app.reload();
  2073. },
  2074. openMeeting : function( data ){
  2075. var form = new MWF.xApplication.Meeting.MeetingForm(this, data, {}, {app:this.app});
  2076. form.view = this.app;
  2077. form.open();
  2078. },
  2079. destory : function(){
  2080. this.tooltipList.each( function( t ){
  2081. t.destory();
  2082. });
  2083. this.app.removeEvent("resize", this.resetNodeSizeFun );
  2084. this.app.node.removeEvent("mousedown", this.hideFun);
  2085. this.node.destory();
  2086. }
  2087. });