Common.js 69 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572
  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. var MWFCalendar = MWF.xApplication.Calendar = MWF.xApplication.Calendar || {};
  7. MWFCalendar.ColorOptions = {
  8. deep : ["#428ffc","#5bcc61","#f9bf24","#f75f59","#f180f7","#9072f1","#909090","#1462be"],
  9. light : ["#cae2ff","#d0f1b0","#fef4bb","#fdd9d9","#f4c5f7","#d6ccf9","#e7e7e7","#cae2ff"],
  10. getLightColor : function( deepColor ){
  11. var index = this.deep.indexOf(deepColor);
  12. return index > -1 ? this.light[index] : this.light[0];
  13. },
  14. getDeepColor : function( lightColor ){
  15. var index = this.light.indexOf(lightColor);
  16. return index > -1 ? this.deep[index] : this.deep[0];
  17. }
  18. };
  19. MWFCalendar.EventForm = new Class({
  20. Extends: MPopupForm,
  21. Implements: [Options, Events],
  22. options: {
  23. "style": "meeting",
  24. "width": "800",
  25. "height": "475",
  26. "hasTop": true,
  27. "hasIcon": false,
  28. "hasTopIcon" : false,
  29. "hasTopContent" : false,
  30. "draggable": true,
  31. "maxAction" : true,
  32. "closeAction": true,
  33. "isFull" : false,
  34. "startTime" : null,
  35. "endTime" : null,
  36. "isWholeday" : false,
  37. "defaultCalendarId" : ""
  38. },
  39. open: function (e) {
  40. if( this.options.isFull ){
  41. this.options.width = "800";
  42. this.options.height = "630";
  43. }
  44. this.fireEvent("queryOpen");
  45. this.isNew = false;
  46. this.isEdited = false;
  47. this._open();
  48. this.fireEvent("postOpen");
  49. },
  50. create: function () {
  51. if( this.options.isFull ){
  52. this.options.width = "1100";
  53. this.options.height = "630";
  54. }
  55. this.fireEvent("queryCreate");
  56. this.isNew = true;
  57. this._open();
  58. this.fireEvent("postCreate");
  59. },
  60. edit: function () {
  61. if( this.options.isFull ){
  62. this.options.width = "1100";
  63. this.options.height = "630";
  64. }
  65. this.fireEvent("queryEdit");
  66. this.isEdited = true;
  67. this._open();
  68. this.fireEvent("postEdit");
  69. },
  70. _createTableContent : function(){
  71. var path = "/o2_lib/rrule/";
  72. COMMON.AjaxModule.load(path+"rrule.js", function () {
  73. this.app.actions.listMyCalendar( function( json ){
  74. this.calendarIds = [];
  75. this.calendarNames = [];
  76. this.calendarList = [];
  77. (json.data.myCalendars || []).each( function(c){
  78. if(c.publishable || c.manageable )this.calendarList.push(c)
  79. }.bind(this));
  80. ( json.data.unitCalendars || [] ).each( function(c){
  81. if(c.publishable || c.manageable )this.calendarList.push(c)
  82. }.bind(this));
  83. this.calendarList.each( function( d ){
  84. this.calendarIds.push(d.id);
  85. this.calendarNames.push(d.name);
  86. }.bind(this));
  87. if( this.isEdited || this.isNew ){
  88. this._createTableContent_Edit();
  89. }else{
  90. this._createTableContent_Read();
  91. }
  92. }.bind(this))
  93. }.bind(this));
  94. },
  95. _createTableContent_Read : function(){
  96. this.formTopTextNode.set( "text", this.lp.readEvent );
  97. this.formTableContainer.setStyle("width","86%");
  98. var data = this.data;
  99. var beginD = Date.parse(data.startTime);
  100. var endD = Date.parse(data.endTime);
  101. var begin = beginD.format(this.lp.dateFormatAll) + "(" + this.lp.weeks.arr[beginD.get("day")] + ")";
  102. var end = endD.format(this.lp.dateFormatAll) + "(" + this.lp.weeks.arr[endD.get("day")] + ")";
  103. if( data.recurrenceRule ){
  104. this.oldRecurrenceRule = data.recurrenceRule;
  105. this.rRule = RRule.fromString(data.recurrenceRule).origOptions;
  106. }else{
  107. this.rRule = {};
  108. }
  109. var text = ["不","每天","每周","每月(当日)","每年(当日)"];
  110. var value = ["NONE",RRule["DAILY"],RRule["WEEKLY"],RRule["MONTHLY"],RRule["YEARLY"] ];
  111. var repeat;
  112. if( this.rRule.freq ){
  113. repeat = text[ value.indexOf( this.rRule.freq ) ];
  114. if( this.rRule.byweekday ){
  115. var repeatWeeks = this.rRule.byweekday.toString().split(",");
  116. var repeatWeekTextList = [];
  117. var weekArr = this.lp.weeks.arr;
  118. var rruleArr = this.lp.weeks.rruleArr;
  119. repeatWeeks.each( function(r){
  120. repeatWeekTextList.push( weekArr[ rruleArr.indexOf( r ) ] );
  121. });
  122. repeat = "每"+ repeatWeekTextList.join("、")+"重复";
  123. }else{
  124. repeat = repeat+"重复";
  125. }
  126. if( this.rRule.until && repeat!="不重复" ){
  127. repeat += " 结束日期:"+this.rRule.until.format("%Y-%m-%d");
  128. }
  129. }else{
  130. repeat = "不重复"
  131. }
  132. var remind;
  133. if( data.valarmTime_config ){ //天、时、分、秒
  134. var valarmTime_configList = data.valarmTime_config.split(",");
  135. valarmTime_configList.each( function( v, i ){
  136. var unit;
  137. if( i == 0 ){
  138. unit = "天"
  139. }else if( i == 1 ){
  140. unit = "小时";
  141. }else if( i==2 ){
  142. unit = "分钟"
  143. }else{
  144. unit = "秒"
  145. }
  146. if( v && v!="0" ){
  147. remind = "提前"+ Math.abs(v)+unit+"提醒";
  148. }
  149. }.bind(this))
  150. }
  151. var calendarName = this.calendarNames[ this.calendarIds.indexOf( data.calendarId ) ];
  152. var html = "<table width='100%' bordr='0' cellpadding='7' cellspacing='0' styles='formTable' style='table-layout:fixed;'>" +
  153. //"<tr><td colspan='2' styles='formTableHead'>申诉处理单</td></tr>" +
  154. "<tr><td styles='formTableTitle' width='40'>日历:</td>" +
  155. " <td styles='formTableValue' width='400'>"+calendarName+"</td>" +
  156. "</tr>" +
  157. "<tr><td styles='formTableTitle'>标题:</td>" +
  158. " <td styles='formTableValue'><div styles='colorItem'></div>"+ data.title +"</td></tr>" +
  159. "<tr><td styles='formTableTitle'>开始:</td>" +
  160. " <td styles='formTableValue'>"+ begin +"</td>" +
  161. "</tr>" +
  162. "<tr><td styles='formTableTitle'>结束:</td>" +
  163. " <td styles='formTableValue'>"+end+"</td>" +
  164. "</tr>"+
  165. "<tr><td styles='formTableTitle'>地点:</td>" +
  166. " <td styles='formTableValue'>"+( data.locationName || "" )+"</td>" +
  167. "</tr>";
  168. if( remind ){
  169. html += "<tr><td styles='formTableTitle'>提醒:</td>" +
  170. " <td styles='formTableValue'>"+remind+"</td>" +
  171. "</tr>";
  172. }
  173. if( repeat && repeat!="不" && repeat!="不重复" ){
  174. "<tr><td styles='formTableTitle'>重复:</td>" +
  175. " <td styles='formTableValue'>"+ repeat +"</td>" +
  176. "</tr>";
  177. }
  178. if( data.comment ){
  179. html += "<tr><td styles='formTableTitle'>内容:</td>" +
  180. " <td styles='formTableValue'>"+data.comment+"</td>" +
  181. "</tr>";
  182. }
  183. this.formTableArea.set("html", html );
  184. this.formTableArea.getElements("[styles='formTableTitle']").setStyles({
  185. "color" : "#333",
  186. "font-size": "16px",
  187. "padding": "0px 20px 0px 0px",
  188. "height" : "35px",
  189. "line-height" : "35px",
  190. "text-align": "left"
  191. });
  192. this.formTableArea.getElements("[styles='formTableValue']").setStyles({
  193. "text-align": "left",
  194. "font-size": "16px"
  195. });
  196. var colorItem = this.formTableArea.getElement("[styles='colorItem']");
  197. var div = new Element("div", {
  198. styles : this.css.colorNode
  199. }).inject( colorItem );
  200. div.setStyle("background-color",this.data.color);
  201. },
  202. _createTableContent_Edit: function () {
  203. this.oldCoordinate = null;
  204. var editEnable = this.editEnable = ( this.isEdited || this.isNew );
  205. this.userName = layout.desktop.session.user.distinguishedName;
  206. this.userId = layout.desktop.session.user.id;
  207. if( this.options.isFull ){
  208. this.formTableContainer.setStyles({
  209. "width" : "auto",
  210. "padding-left" : "40px"
  211. });
  212. }else{
  213. this.formTableContainer.setStyle("width","80%");
  214. }
  215. if( this.isNew ){
  216. this.formTopTextNode.set( "text", this.lp.addEvent );
  217. }else if( this.isEdited ){
  218. this.formTopTextNode.set( "text", this.lp.editEvent );
  219. this.options.height = "590";
  220. }
  221. var startTime, endTime, defaultStartDate, defaultStartTime, defaultEndDate, defaultEndTime;
  222. if( this.options.startTime && this.options.endTime ){
  223. startTime= this.date = typeOf( this.options.startTime )=="string" ? Date.parse( this.options.startTime ) : this.options.startTime;
  224. endTime= typeOf( this.options.endTime )=="string" ? Date.parse( this.options.endTime ) : this.options.endTime;
  225. defaultStartDate = startTime.format("%Y-%m-%d");
  226. defaultStartTime = startTime.format("%H:%M");
  227. defaultEndDate = endTime.format("%Y-%m-%d");
  228. defaultEndTime = endTime.format("%H:%M");
  229. }else{
  230. startTime = this.date = new Date().increment("hour",1);
  231. endTime = startTime.clone().increment("hour",1);
  232. defaultStartDate = startTime.format("%Y-%m-%d");
  233. defaultStartTime = startTime.format("%H") + ":00";
  234. defaultEndDate = endTime.format("%Y-%m-%d");
  235. defaultEndTime = endTime.format("%H") + ":00";
  236. }
  237. var data = this.data;
  238. if( this.options.isWholeday && this.isNew ){
  239. data.isAllDayEvent = true;
  240. }
  241. if( data.startTime ){
  242. var beignDate = Date.parse( data.startTime );
  243. data.startDateInput = beignDate.format("%Y-%m-%d");
  244. data.startTimeInput = this.getString( beignDate.getHours() ) + ":" + this.getString( beignDate.getMinutes() );
  245. }
  246. if( data.endTime ){
  247. var endDate = Date.parse( data.endTime );
  248. data.endDateInput = endDate.format("%Y-%m-%d");
  249. data.endTimeInput = this.getString( endDate.getHours() ) + ":" + this.getString( endDate.getMinutes() );
  250. }
  251. //data.rRuleString = "FREQ=WEEKLY;DTSTART=20180523T090000Z;UNTIL=20180523T160000Z;BYDAY=WE,TH,FR";
  252. if( data.recurrenceRule ){
  253. this.oldRecurrenceRule = data.recurrenceRule;
  254. this.rRule = RRule.fromString(data.recurrenceRule).origOptions;
  255. }else{
  256. this.rRule = {};
  257. }
  258. data.repeat = this.rRule.freq || "";
  259. if( this.rRule.until ){
  260. data.repeatUntilAvailable = "AVAILABLE";
  261. data.repeatUntilDate = this.rRule.until.format("%Y-%m-%d");
  262. }
  263. if( this.rRule.byweekday ){
  264. data.repeatWeeks = this.rRule.byweekday.toString().split(",");
  265. }
  266. if( data.valarmTime_config ){ //天、时、分、秒
  267. var valarmTime_configList = data.valarmTime_config.split(",");
  268. valarmTime_configList.each( function( v, i ){
  269. var unit;
  270. if( i == 0 ){
  271. unit = "d"
  272. }else if( i == 1 ){
  273. unit = "h";
  274. }else if( i==2 ){
  275. unit = "m"
  276. }else{
  277. unit = "s"
  278. }
  279. if( v && v!="0" ){
  280. data.remind = v+"_"+unit;
  281. }
  282. }.bind(this))
  283. }
  284. this.formTableArea.set("html", this.getHtml());
  285. this.colorItem = this.formTableArea.getElement("[item='color']");
  286. //this.attachmentTr = this.formTableArea.getElement("[item='attachmentTr']");
  287. //this.attachmentArea = this.formTableArea.getElement("[item='attachment']");
  288. if( !this.data.color ){
  289. if( this.options.defaultCalendarId ){
  290. this.data.color = this.getColorByCalendarId( this.options.defaultCalendarId );
  291. }else{
  292. this.data.color = this.calendarList[0].color;
  293. }
  294. }
  295. MWF.xDesktop.requireApp("Template", "MForm", function () {
  296. this.form = new MForm(this.formTableArea, data, {
  297. isEdited: this.isEdited || this.isNew,
  298. style : "meeting",
  299. hasColon : true,
  300. itemTemplate: {
  301. calendarId : { text : this.lp.calendar, defaultValue : this.options.defaultCalendarId, type : "select", selectValue : this.calendarIds, selectText : this.calendarNames, event : {
  302. change : function( item ){
  303. this.setColorByCalendarId( item.getValue() )
  304. }.bind(this)
  305. }},
  306. startDateInput: { text : this.lp.beginTime ,tType: "date", defaultValue: defaultStartDate , notEmpty : true },
  307. startTimeInput: { tType: "time",
  308. defaultValue: defaultStartTime, className : ( (this.isNew || this.isEdited ) ? "inputTimeUnformatWidth" : "" ),
  309. disable : data.isAllDayEvent
  310. },
  311. endDateInput: { text : this.lp.endTime, tType: "date", defaultValue: defaultEndDate, notEmpty : true },
  312. endTimeInput: { tType: "time",
  313. defaultValue: defaultEndTime, className : ( (this.isNew || this.isEdited ) ? "inputTimeUnformatWidth" : "" ),
  314. disable : data.isAllDayEvent
  315. },
  316. remind : { text : this.lp.remind, type : "select", selectText : ["不提醒","开始时","提前5分钟","提前10分钟","提前15分钟","提前30分钟","提前1小时","提前2小时"],
  317. selectValue : ["", "-5_s","-5_m","-10_m","-15_m","-30_m","-1_h","-2_h"] },
  318. isAllDayEvent : { type : "checkbox", selectValue : ["true"], selectText : ["全天"], event : {
  319. change : function(item ){
  320. var itemStart = item.form.getItem("startTimeInput");
  321. var itemEnd = item.form.getItem("endTimeInput");
  322. if( item.getValue() == "true" && !itemStart.options.disable && !itemEnd.options.disable ){
  323. itemStart.getElements().setStyle("display","none");
  324. itemEnd.getElements().setStyle("display","none")
  325. }else{
  326. if( itemStart.options.disable )itemStart.enable();
  327. if( itemEnd.options.disable )itemEnd.enable();
  328. itemStart.getElements().setStyle("display","");
  329. itemEnd.getElements().setStyle("display","")
  330. }
  331. }.bind(this)
  332. } },
  333. title: { text : this.lp.eventSubject, notEmpty : true },
  334. description: {type: "textarea"},
  335. locationName : { text : "地点" },
  336. repeat : { text : this.lp.repeat, type : "select", defaultValue : "NONE",
  337. selectText : ["不重复","每天","每周","每月(当日)","每年(当日)"],
  338. selectValue : ["NONE",RRule["DAILY"],RRule["WEEKLY"],RRule["MONTHLY"],RRule["YEARLY"] ], event : {
  339. change : function(item){
  340. var val = item.getValue();
  341. var area = this.formTableArea.getElement("[item='repeatUntilArea']");
  342. area.setStyle("display", val == "NONE" ? "none" : "");
  343. if( val == RRule["WEEKLY"] ){
  344. this.showWeek()
  345. }else{
  346. area = this.formTableArea.getElement("[item='repeatWeekArea']");
  347. area.setStyle("display","none");
  348. }
  349. }.bind(this)
  350. }},
  351. repeatUntilAvailable : { text : this.lp.repeatUntilAvailable, type : "radio",
  352. selectText : ["永不", "结束日期"],
  353. selectValue : ["NONE", "AVAILABLE"],
  354. defaultValue : "NONE"
  355. },
  356. repeatUntilDate : { tType : "date", event : {
  357. click : function(){ this.form.getItem("repeatUntilAvailable").setValue("AVAILABLE") }.bind(this)
  358. }},
  359. comment : { text : this.lp.content, type : "rtf", RTFConfig : {
  360. skin : "bootstrapck",
  361. "resize_enabled": false,
  362. toolbar : [
  363. { name: 'document', items : [ 'Preview' ] },
  364. //{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
  365. { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','-','RemoveFormat' ] },
  366. //{ name: 'paragraph', items : [ 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock' ] },
  367. { name: 'list', items : [ 'NumberedList','BulletedList'] },
  368. //{ name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] },
  369. //{ name: 'colors', items : [ 'TextColor','BGColor' ] },
  370. { name: 'links', items : [ 'Link','Unlink' ] }
  371. //{ name: 'insert', items : [ 'Image' ] },
  372. //{ name: 'tools', items : [ 'Maximize','-','About' ] }
  373. ]
  374. }
  375. }}
  376. }, this.app);
  377. this.form.load();
  378. if( this.data.repeat == RRule["WEEKLY"] ){
  379. this.showWeek()
  380. }
  381. this.loadColor();
  382. //if( this.data.id )
  383. // this.loadAttachment();
  384. }.bind(this), true);
  385. },
  386. getRRuleString : function( data ){
  387. if( !data )data = this.form.getResult(false,null,false,false,false);
  388. if( !data.repeat || data.repeat == "NONE" )return "";
  389. //var startDate;
  390. //if( data.isAllDayEvent == "true" ){
  391. // startDate = Date.parse( data.startDateInput )
  392. //}else{
  393. // startDate = Date.parse( data.startDateInput + " " + data.startTimeInput )
  394. //}
  395. var options = {
  396. freq : data.repeat //RRule[data.repeat],
  397. //dtstart : startDate
  398. };
  399. if( data.repeatUntilAvailable != "NONE" && data.repeatUntilDate!="" ){
  400. options.until = Date.parse( data.repeatUntilDate )
  401. }
  402. if( data.repeat == RRule["WEEKLY"] ){
  403. options.byweekday = [];
  404. this.getSelectWeek().each( function( w ){
  405. options.byweekday.push( RRule[w] )
  406. })
  407. }
  408. var rule = new RRule( options );
  409. return rule.toString();
  410. },
  411. getHtml : function(){
  412. var boxStyle = (this.isEdited || this.isNew) ? "border:1px solid #ccc; border-radius: 4px;overflow: hidden;padding:8px;" : "";
  413. if( this.options.isFull ){
  414. var html = "<div style='overflow: hidden;'>" +
  415. "<div item='baseInforContainer' style='float: left; width : 500px;'>" +
  416. "<table width='100%' bordr='0' cellpadding='7' cellspacing='0' styles='formTable' style='table-layout:fixed;'>" +
  417. //"<tr><td colspan='2' styles='formTableHead'>申诉处理单</td></tr>" +
  418. "<tr><td styles='formTableTitle' width='80' lable='calendarId'></td>" +
  419. " <td styles='formTableValue' item='calendarId' colspan='2' width='400'></td>" +
  420. "</tr>" +
  421. "<tr><td styles='formTableTitle' lable='title'></td>" +
  422. " <td styles='formTableValue' item='title' colspan='2'></td></tr>" +
  423. "<tr><td styles='formTableTitle' lable='startDateInput'></td>" +
  424. " <td styles='formTableValue' item='startDateInput' width='" + ( this.editEnable ? "260" : "100" ) + "'></td>" +
  425. " <td styles='formTableValue' item='startTimeInput'></td>" +
  426. "</tr>" +
  427. "<tr><td styles='formTableTitle' lable='endDateInput'></td>" +
  428. " <td styles='formTableValue' item='endDateInput'></td>" +
  429. " <td styles='formTableValue' item='endTimeInput'></td>" +
  430. "</tr>"+
  431. "<tr><td styles='formTableTitle'></td>" +
  432. " <td styles='formTableValue' item='isAllDayEvent' colspan='2'></td>" +
  433. "</tr>"+
  434. "<tr><td styles='formTableTitle' lable='locationName'></td>" +
  435. " <td styles='formTableValue' item='locationName' colspan='2'></td>" +
  436. "</tr>" +
  437. "<tr><td styles='formTableTitle' lable='remind'></td>" +
  438. " <td styles='formTableValue' item='remind' colspan='2'></td>" +
  439. "</tr>" +
  440. "<tr><td styles='formTableTitle' lable='repeat'></td>" +
  441. " <td styles='formTableValue' item='repeat' colspan='2'></td>" +
  442. "</tr>" +
  443. "<tr item='repeatWeekArea' style='display:"+ ( this.data.repeat == RRule["WEEKLY"] ? "" : "none") +";'><td styles='formTableTitle'></td>" +
  444. " <td styles='formTableValue' item='repeatWeek' colspan='2' style='overflow:hidden;'></td>" +
  445. "</tr>" +
  446. "<tr item='repeatUntilArea' style='display:"+ ( (!this.data.repeat || this.data.repeat == "") ? "none" : "") +";'><td styles='formTableTitle'></td>" +
  447. " <td styles='formTableValue' colspan='2' style='overflow: hidden;line-height:34px;'>" +
  448. " <div lable='repeatUntilAvailable' style='float: left;'></div>"+
  449. " <div item='repeatUntilAvailable' style='float: left;'></div>"+
  450. " <div item='repeatUntilDate' style='float: left;width:170px;'></div>"+
  451. " </td>" +
  452. "</tr>" +
  453. "<tr><td styles='formTableTitle'>"+this.lp.color+":</td>" +
  454. " <td styles='formTableValue' item='color' colspan='2' style='overflow: hidden;'></td>" +
  455. "</tr>" +
  456. "</table>"+
  457. "</div>" +
  458. "<div style='float: left; width : 500px;' item='commentContainer'>" +
  459. "<table width='100%' bordr='0' cellpadding='7' cellspacing='0' styles='formTable'>" +
  460. //"<tr><td colspan='2' styles='formTableHead'>申诉处理单</td></tr>" +
  461. "<tr><td styles='formTableTitle' ></td>" +
  462. " <td styles='formTableValue' lable='comment' colspan='2'></td>" +
  463. "</tr>" +
  464. "<tr><td styles='formTableTitle' ></td>" +
  465. " <td styles='formTableValue' item='comment' colspan='2'></td>" +
  466. "</tr>" +
  467. //"<tr><td styles='formTableTitle'>"+this.lp.eventDescription+":</td>" +
  468. //" <td styles='formTableValue' item='description' colspan='2'></td></tr>" +
  469. "<tr item='attachmentTr'><td styles='formTableTitle'></td>" +
  470. " <td styles='formTableValue' item='attachment'></td></tr>" +
  471. "</table>"+
  472. "</div>" +
  473. "</div>";
  474. return html;
  475. }else{
  476. return "<table width='100%' bordr='0' cellpadding='7' cellspacing='0' styles='formTable'>" +
  477. //"<tr><td colspan='2' styles='formTableHead'>申诉处理单</td></tr>" +
  478. "<tr><td styles='formTableTitle' lable='calendarId'></td>" +
  479. " <td styles='formTableValue' item='calendarId' colspan='2'></td></tr>" +
  480. "<tr><td styles='formTableTitle' lable='title'></td>" +
  481. " <td styles='formTableValue' item='title' colspan='2'></td></tr>" +
  482. "<tr><td styles='formTableTitle' width='100' lable='startDateInput'></td>" +
  483. " <td styles='formTableValue' item='startDateInput' width='300'></td>" +
  484. " <td styles='formTableValue' item='startTimeInput'></td>" +
  485. "</tr>" +
  486. "<tr><td styles='formTableTitle' lable='endDateInput'></td>" +
  487. " <td styles='formTableValue' item='endDateInput'></td>" +
  488. " <td styles='formTableValue' item='endTimeInput'></td>" +
  489. "</tr>" +
  490. "<tr><td styles='formTableTitle'></td>" +
  491. " <td styles='formTableValue' item='isAllDayEvent' colspan='2'></td>" +
  492. "</tr>" +
  493. "<tr><td styles='formTableTitle' lable='remind'></td>" +
  494. " <td styles='formTableValue' item='remind' colspan='2'></td>" +
  495. "</tr>" +
  496. "</table>";
  497. }
  498. },
  499. _setNodesSize : function(width, height, formContentHeight, formTableHeight ){
  500. if( this.options.isFull ){
  501. var baseInforContainer = this.formAreaNode.getElement("[item='baseInforContainer']");
  502. var commentContainer = this.formAreaNode.getElement("[item='commentContainer']");
  503. if(baseInforContainer)baseInforContainer.setStyle("width", (width-100) / 2);
  504. if(commentContainer)commentContainer.setStyle("width", (width-100) / 2)
  505. }
  506. },
  507. getColorByCalendarId : function( calendarId ){
  508. var color;
  509. this.calendarList.each( function( d ){
  510. if( d.id == calendarId ){
  511. color = d.color;
  512. }
  513. }.bind(this));
  514. return color;
  515. },
  516. setColorByCalendarId : function( calendarId ){
  517. var color = this.getColorByCalendarId( calendarId );
  518. if( color ){
  519. this.data.color = color;
  520. this.setColor(color);
  521. }
  522. },
  523. setColor : function( color ){
  524. (this.colorOptions || []).each( function( div ){
  525. if( div.retrieve("color") == color ){
  526. div.click();
  527. }
  528. })
  529. },
  530. loadColor : function(){
  531. if( this.isEdited || this.isNew ){
  532. this.loadColor_Edited();
  533. }else{
  534. this.loadColor_Read();
  535. }
  536. },
  537. loadColor_Read : function(){
  538. if( !this.colorItem )return;
  539. var div = new Element("div", {
  540. styles : this.css.colorNode
  541. }).inject( this.colorItem );
  542. div.setStyle("background-color",this.data.color);
  543. div.setStyles( this.css.colorNode_current );
  544. },
  545. loadColor_Edited : function(){
  546. if( !this.colorItem )return;
  547. this.colorOptions = [];
  548. if( !this.data.color ){
  549. if( this.options.defaultCalendarId ){
  550. this.getColorByCalendarId( this.options.defaultCalendarId );
  551. }else{
  552. this.data.color = this.calendarList[0].color;
  553. }
  554. }
  555. MWFCalendar.ColorOptions.deep.each( function( color , i){
  556. var div = new Element("div", {
  557. styles : this.css.colorNode,
  558. events : {
  559. click : function(ev){
  560. if(this.currentColorNode)this.currentColorNode.setStyles( this.css.colorNode );
  561. ev.target.setStyles( this.css.colorNode_current );
  562. this.currentColorNode = ev.target;
  563. }.bind(this)
  564. }
  565. }).inject( this.colorItem );
  566. div.setStyle("background-color",color);
  567. div.store("color",color);
  568. if( this.data.color ){
  569. if( this.data.color == color ){
  570. div.setStyles( this.css.colorNode_current );
  571. this.currentColorNode = div;
  572. }
  573. }else if(i==0){
  574. div.setStyles( this.css.colorNode_current );
  575. this.currentColorNode = div;
  576. }
  577. this.colorOptions.push( div )
  578. }.bind(this))
  579. },
  580. showWeek : function(){
  581. var area = this.formTableArea.getElement("[item='repeatWeekArea']");
  582. if( !area )return;
  583. area.setStyle("display","");
  584. if( this.isWeekSelectCreated )return;
  585. this.weekItems = [];
  586. var container = this.formTableArea.getElement("[item='repeatWeek']");
  587. var weekDayStyle = this.css.weekDayStyle = {
  588. "border" : "1px solid #ccc",
  589. "border-radius" : "3px",
  590. "height" : "20px",
  591. "line-heigh" : "20px",
  592. "background" : "#f7f7f7",
  593. "color" : "#666",
  594. "padding" : "0px 9px",
  595. "margin-right" : "9px",
  596. "float" : "left",
  597. "font-size" : "12px",
  598. "cursor" : "pointer"
  599. };
  600. var weekDayOnStyle = this.css.weekDayOnStyle = Object.merge( Object.clone(weekDayStyle), {
  601. "border" : "1px solid #3c75b7",
  602. "background" : "#3c75b7",
  603. "color" : "#fff"
  604. });
  605. var repeatWeeks = this.data.repeatWeeks || [ this.lp.weeks.rruleArr[ this.date.getDay() ] ];
  606. for( var i=0; i<7; i++ ){
  607. var rruleWeekString = this.lp.weeks.rruleArr[i];
  608. var isCurrentDay = repeatWeeks.contains( rruleWeekString );
  609. var div = new Element("div",{
  610. styles : isCurrentDay ? weekDayOnStyle : weekDayStyle,
  611. text : this.lp.weeks.arr[i],
  612. events : {
  613. click : function(ev){
  614. this.triggerWeek( ev.target )
  615. }.bind(this)
  616. }
  617. }).inject(container);
  618. if( isCurrentDay ){
  619. if( this.date.getDay() == i ){
  620. this.currrentWeekDayItem = div;
  621. }
  622. div.store("isOn", true);
  623. }
  624. div.store( "weekDay", rruleWeekString );
  625. this.weekItems.push(div);
  626. }
  627. this.isWeekSelectCreated = true;
  628. },
  629. triggerWeek : function(item){
  630. if(item.retrieve("isOn")){
  631. item.store("isOn", false);
  632. item.setStyles( this.css.weekDayStyle )
  633. }else{
  634. item.store("isOn", true);
  635. item.setStyles( this.css.weekDayOnStyle )
  636. }
  637. if( this.getSelectWeek().length==0 ){
  638. this.triggerWeek( this.currrentWeekDayItem );
  639. }
  640. },
  641. getSelectWeek : function(){
  642. if( !this.weekItems )return [];
  643. var weekDay = [];
  644. this.weekItems.each(function(item){
  645. if( item.retrieve("isOn") ){
  646. weekDay.push( item.retrieve("weekDay"));
  647. }
  648. });
  649. return weekDay;
  650. },
  651. _createBottomContent : function(){
  652. var html = "<div style='width:700px;margin:0px auto;'><table width='700' bordr='0' cellpadding='7' cellspacing='0' styles='formTable'>" +
  653. "<tr><td styles='formTableValue' width='100'></td>" +
  654. " <td styles='formTableValue' style='padding-top: 15px;'>"+
  655. " <div item='saveAction' style='float:left;display:"+ ( (this.isEdited || this.isNew) ? "" : "none") +";'></div>"+
  656. " <div item='editAction' style='float:left;display:"+ ( (this.isEdited || this.isNew) ? "none" : "") +";'></div>"+
  657. " <div item='removeAction' style='float:left;display:"+ ( this.isEdited ? "" : "none") +";'></div>"+
  658. " <div item='cancelAction' style='"+( (this.isEdited || this.isNew ) ? "float:left;" : "float:left")+"'></div>"+
  659. " <div item='moreInfor' style='float: right;margin-top:5px;'></div>"+
  660. " </td></tr>" +
  661. "</table></div>";
  662. this.formBottomNode.set("html", html);
  663. MWF.xDesktop.requireApp("Template", "MForm", function () {
  664. var form = new MForm(this.formBottomNode, {}, {
  665. isEdited: this.isEdited || this.isNew,
  666. style : "meeting",
  667. hasColon : true,
  668. itemTemplate: {
  669. moreInfor : {
  670. type : "a", value : "更多编辑", event : {
  671. click : function(){ this.openMoreInfor() }.bind(this)
  672. }, disable : this.options.isFull
  673. },
  674. saveAction : { type : "button", className : "inputOkButton", value : this.lp.save, event : {
  675. click : function(){ this.save();}.bind(this)
  676. } },
  677. removeAction : { type : "button", className : "inputCancelButton", value : this.lp.cancelEvent , event : {
  678. click : function( item, ev ){ this.cancelEvent(ev); }.bind(this)
  679. } },
  680. editAction : { type : "button", className : "inputOkButton", value : this.lp.editEvent , event : {
  681. click : function(){ this.editEvent(); }.bind(this)
  682. } },
  683. cancelAction : { type : "button", className : "inputCancelButton", value : this.lp.close , event : {
  684. click : function(){ this.close(); }.bind(this)
  685. } }
  686. }
  687. }, this.app);
  688. form.load();
  689. }.bind(this), true);
  690. },
  691. openMoreInfor : function(){
  692. this.options.isFull = true;
  693. this.options.width = "1100";
  694. this.options.height = "620";
  695. this.isWeekSelectCreated = false;
  696. this.reload( true );
  697. },
  698. getString : function( str ){
  699. var s = "00" + str;
  700. return s.substr(s.length - 2, 2 );
  701. },
  702. getEventData : function( callback ){
  703. if( this.data && this.data.id ){
  704. this.app.actions.getEvent( this.data.id, function( json ){
  705. this.data = json.data;
  706. if(callback)callback();
  707. }.bind(this))
  708. }else{
  709. if(callback)callback();
  710. }
  711. },
  712. editEvent : function(){
  713. this.isWeekSelectCreated = false;
  714. this.formTopNode = null;
  715. if(this.setFormNodeSizeFun && this.app ){
  716. this.app.removeEvent("resize",this.setFormNodeSizeFun);
  717. }
  718. if( this.formMaskNode )this.formMaskNode.destroy();
  719. this.formAreaNode.destroy();
  720. this.edit();
  721. },
  722. reset: function(){
  723. this.formTableArea.empty();
  724. this._createTableContent();
  725. },
  726. loadAttachment: function(){
  727. if(!this.attachmentTr)return;
  728. this.attachmentTr.setStyle("display","");
  729. this.attachmentNode = new Element("div", {"styles": this.css.createEventAttachmentNode}).inject(this.attachmentArea);
  730. var attachmentContentNode = new Element("div", {"styles": this.css.createEventAttachmentContentNode}).inject(this.attachmentNode);
  731. MWF.require("MWF.widget.AttachmentController", function(){
  732. this.attachmentController = new MWF.widget.AttachmentController(attachmentContentNode, this, {
  733. "size": "min",
  734. "isSizeChange": false,
  735. "isReplace": false,
  736. "isUpload": this.isNew || this.isEdited,
  737. "isDelete": this.isNew || this.isEdited,
  738. "isDownload": true,
  739. "readonly": !this.isNew && !this.isEdited
  740. });
  741. this.attachmentController.load();
  742. if( this.data.attachmentList ){
  743. this.data.attachmentList.each(function (att) {
  744. att.person = att.lastUpdatePerson.split("@")[0];
  745. var at = this.attachmentController.addAttachment(att);
  746. }.bind(this));
  747. }
  748. }.bind(this));
  749. },
  750. uploadAttachment: function(e, node){
  751. if (!this.uploadFileAreaNode){
  752. this.createUploadFileNode();
  753. }
  754. this.fileUploadNode.click();
  755. },
  756. createUploadFileNode: function(){
  757. this.uploadFileAreaNode = new Element("div");
  758. var html = "<input name=\"file\" type=\"file\" multiple/>";
  759. this.uploadFileAreaNode.set("html", html);
  760. this.fileUploadNode = this.uploadFileAreaNode.getFirst();
  761. this.fileUploadNode.addEvent("change", function(){
  762. var files = this.fileUploadNode.files;
  763. if (files.length){
  764. for (var i = 0; i < files.length; i++) {
  765. var file = files.item(i);
  766. var formData = new FormData();
  767. formData.append('file', file);
  768. //formData.append('folder', folderId);
  769. this.app.actions.addAttachment(function(o, text){
  770. if (o.id){
  771. this.app.actions.getAttachment(o.id, function(json){
  772. if (json.data) this.attachmentController.addAttachment(json.data);
  773. this.attachmentController.checkActions();
  774. }.bind(this))
  775. }
  776. this.attachmentController.checkActions();
  777. }.bind(this), null, formData, this.data.id, file);
  778. }
  779. }
  780. }.bind(this));
  781. },
  782. deleteAttachments: function(e, node, attachments){
  783. var names = [];
  784. attachments.each(function(attachment){
  785. names.push(attachment.data.name);
  786. }.bind(this));
  787. var _self = this;
  788. this.app.confirm("warn", e, this.lp.deleteAttachmentTitle, this.lp.deleteAttachment+"( "+names.join(", ")+" )", 300, 120, function(){
  789. while (attachments.length){
  790. attachment = attachments.shift();
  791. _self.deleteAttachment(attachment);
  792. }
  793. this.close();
  794. }, function(){
  795. this.close();
  796. }, null);
  797. },
  798. deleteAttachment: function(attachment){
  799. this.app.actions.deleteFile(attachment.data.id, function(josn){
  800. this.attachmentController.removeAttachment(attachment);
  801. this.attachmentController.checkActions();
  802. }.bind(this));
  803. },
  804. downloadAttachment: function(e, node, attachments){
  805. attachments.each(function(att){
  806. this.app.actions.getFileDownload(att.data.id);
  807. }.bind(this));
  808. },
  809. openAttachment: function(e, node, attachments){
  810. attachments.each(function(att){
  811. this.app.actions.getFile(att.data.id);
  812. }.bind(this));
  813. },
  814. getAttachmentUrl: function(attachment, callback){
  815. this.app.actions.getFileUrl(attachment.data.id, callback);
  816. },
  817. cancelEvent: function(e){
  818. var _self = this;
  819. var data = this.data;
  820. var postDelete = function(){
  821. this.view.reload();
  822. this.close();
  823. }.bind(this);
  824. if( this.oldRecurrenceRule ) { //如果是原来是重复的
  825. this.openDeleteOptionForm( function( saveOptions ){
  826. if( saveOptions == "single" ){
  827. this.app.actions.deleteSingleEvent(data.id, function(json){ postDelete(json); }.bind(this));
  828. }else if( saveOptions == "after" ){
  829. this.app.actions.deleteAfterEvent(data.id, function(json){ postDelete(json); }.bind(this));
  830. }else if( saveOptions == "all" ){
  831. this.app.actions.deleteAllEventsWithRepeatMaster(data.id, function(json){ postDelete(json); }.bind(this));
  832. }
  833. }.bind(this))
  834. }else if( data.id ){ //编辑
  835. var text = this.app.lp.cancel_confirm.replace(/{name}/g, this.data.title);
  836. this.app.confirm("infor", e, this.app.lp.cancel_confirm_title, text, 380, 200, function(){
  837. _self._cancelEvent();
  838. this.close();
  839. }, function(){
  840. this.close();
  841. });
  842. }
  843. },
  844. _cancelEvent: function(){
  845. var view = this.view;
  846. this.app.actions.deleteSingleEvent(this.data.id, function(){
  847. view.reload();
  848. this.close();
  849. }.bind(this))
  850. },
  851. openDeleteOptionForm : function( callback ){
  852. this.deleteOptionsForm = new MWFCalendar.DeleteOptionDialog( this, {}, {
  853. onPostOk : function( saveOptions ){
  854. if(callback){
  855. callback(saveOptions)
  856. }
  857. }.bind(this)
  858. }, {});
  859. this.deleteOptionsForm.edit();
  860. },
  861. save: function(){
  862. this._save(function(){
  863. this.app.notice(this.lp.event_saveSuccess, "success");
  864. this.close();
  865. //if (!this.attachmentNode){
  866. // this.loadAttachment();
  867. //}
  868. }.bind(this));
  869. },
  870. _save: function(callback){
  871. var data = this.getSaveData();
  872. if( !data )return;
  873. var errorText = "";
  874. if (!data.title) errorText +=this.lp.event_input_subject_error;
  875. if( data.startTime ){
  876. if ( (Date.parse(data.startTime) - Date.parse(data.endTime)) > 0) errorText +=this.lp.event_input_time_error;
  877. //if (now.diff(this.data.startTime, "minute")<0) errorText +=this.lp.event_input_date_error;
  878. //
  879. //delete this.data.startTimeDate;
  880. //delete this.data.completedTimeDate;
  881. }
  882. if (errorText){
  883. this.app.notice(this.lp.event_input_error+errorText, "error");
  884. return false;
  885. }
  886. var postSave = function( json ){
  887. this.data.id = json.data.id;
  888. this.oldRecurrenceRule = data.recurrenceRule;
  889. this.waitReload = true;
  890. if (callback) callback();
  891. }.bind(this);
  892. this.data = data;
  893. if( this.oldRecurrenceRule ) { //如果是原来是重复的
  894. this.openSaveOptionForm( function( saveOptions ){
  895. if( saveOptions == "single" ){
  896. this.app.actions.updateSingleEvent(data.id, this.data, function(json){ postSave(json); }.bind(this));
  897. }else if( saveOptions == "after" ){
  898. this.app.actions.updateAfterEvent(data.id, this.data, function(json){ postSave(json); }.bind(this));
  899. }else if( saveOptions == "all" ){
  900. this.app.actions.updateAllEventsWithRepeatMaster(data.id, this.data, function(json){ postSave(json); }.bind(this));
  901. }
  902. }.bind(this))
  903. }else if( data.id ){ //编辑
  904. this.app.actions.updateSingleEvent(data.id, this.data, function(json){ postSave(json); }.bind(this));
  905. }else{ //新增
  906. this.app.actions.addEvent(this.data, function(json){ postSave(json); }.bind(this));
  907. }
  908. },
  909. openSaveOptionForm : function( callback ){
  910. this.saveOptionsForm = new MWFCalendar.SaveOptionDialog( this, {}, {
  911. onPostOk : function( saveOptions ){
  912. if(callback){
  913. callback(saveOptions)
  914. }
  915. }.bind(this)
  916. }, {});
  917. this.saveOptionsForm.edit();
  918. },
  919. getSaveData: function(){
  920. var data = this.form.getResult(true,"",true,false,true);
  921. if( !data )return null;
  922. if( data ){
  923. data.isAllDayEvent = typeOf( data.isAllDayEvent ) == "array" ? data.isAllDayEvent.join("") : data.isAllDayEvent;
  924. if( data.isAllDayEvent == "true"){
  925. data.startTime = this.data.startDateInput + " " + "00:00:00";
  926. data.endTime = this.data.endDateInput + " " + "23:59:59";
  927. }else{
  928. data.startTime = this.data.startDateInput + " " + this.data.startTimeInput + ":00";
  929. data.endTime = this.data.endDateInput + " " + this.data.endTimeInput + ":00";
  930. }
  931. data.recurrenceRule = this.getRRuleString( data );
  932. if( data.remind ){
  933. var valarmTime_config = [0,0,0,0];
  934. var r = data.remind.split("_");
  935. var n = parseInt( r[0] );
  936. if( r[1] == "d" ){
  937. valarmTime_config[0] = n;
  938. }else if( r[1] == "h" ){
  939. valarmTime_config[1] = n;
  940. }else if( r[1] == "m" ){
  941. valarmTime_config[2] = n;
  942. }else if( r[1] == "s" ){
  943. valarmTime_config[3] = n;
  944. }
  945. data.valarmTime_config = valarmTime_config.join(",");
  946. }
  947. if( !data.calendarId ){
  948. data.calendarId = this.app.currentCalendarData.id;
  949. }
  950. if( this.currentColorNode ){
  951. data.color = this.currentColorNode.retrieve("color");
  952. }else if( data.calendarId ){
  953. data.color = this.getColorByCalendarId(data.calendarId);
  954. }else{
  955. data.color = MWFCalendar.ColorOptions.deep[0];
  956. }
  957. delete data.range;
  958. }
  959. return data;
  960. },
  961. close: function (e) {
  962. this.fireEvent("queryClose");
  963. this._close();
  964. //if( this.form ){
  965. // this.form.destroy();
  966. //}
  967. if(this.setFormNodeSizeFun && this.app ){
  968. this.app.removeEvent("resize",this.setFormNodeSizeFun);
  969. }
  970. if( this.formMaskNode )this.formMaskNode.destroy();
  971. this.formAreaNode.destroy();
  972. this.fireEvent("postClose");
  973. if( this.waitReload )this.view.reload();
  974. delete this;
  975. }
  976. });
  977. MWFCalendar.CalendarForm = new Class({
  978. Extends: MPopupForm,
  979. Implements: [Options, Events],
  980. options: {
  981. "style": "meeting",
  982. "width": "800",
  983. "height": "500",
  984. "hasTop": true,
  985. "hasIcon": false,
  986. "hasTopIcon" : false,
  987. "hasTopContent" : false,
  988. "draggable": true,
  989. "maxAction" : true,
  990. "resizeable" : true,
  991. "closeAction": true,
  992. "resultSeparator" : null
  993. },
  994. _createTableContent: function () {
  995. var data = this.data;
  996. var editEnable = this.editEnable = ( !this.isEdited && !this.isNew && this.data.manageable );
  997. this.userName = ( layout.desktop.session.user || layout.user ).distinguishedName;
  998. this.userId = ( layout.desktop.session.user || layout.user ).id;
  999. if( data.type == "UNIT" ){
  1000. this.options.height = "650"
  1001. }
  1002. if( this.isNew ){
  1003. this.formTopTextNode.set( "text", "新建日历" );
  1004. }else if( this.isEdited ){
  1005. this.formTopTextNode.set( "text", "编辑日历" );
  1006. }else{
  1007. this.formTopTextNode.set( "text", "日历" );
  1008. }
  1009. this.formTableArea.set("html", this.getHtml());
  1010. this.formTableContainer.setStyle("width","80%");
  1011. this.colorItem = this.formTableArea.getElement("[item='color']");
  1012. MWF.xDesktop.requireApp("Template", "MForm", function () {
  1013. this.form = new MForm(this.formTableArea, data, {
  1014. isEdited: this.isEdited || this.isNew,
  1015. style : "meeting",
  1016. hasColon : true,
  1017. itemTemplate: {
  1018. name: { text : "日历名称", notEmpty : true },
  1019. description: {text : "备注", type: "textarea"},
  1020. type : { text : "类型", type : "select", isEdited : this.isNew,
  1021. selectValue : ["PERSON", "UNIT"],
  1022. selectText : ["个人日历", "组织日历"],
  1023. defaultValue : "PERSON",
  1024. event : {
  1025. change : function(item){
  1026. this.changeType( item.getValue() )
  1027. }.bind(this)
  1028. }
  1029. },
  1030. target : { text : "所属组织", type : "org", orgType : "unit", validRule : { empty : function( value, item){
  1031. if( item.form.getItem("type").getValue() == "UNIT" && value == ""){ return false }else{ return true };
  1032. }}, validMessage : { empty : "所属组织不能为空"} },
  1033. isPublic : { text : "是否公开", type : "select", selectValue : ["true","false"], selectText : ["是","否"], defaultValue : "false" },
  1034. status : { text : "是否启用", type : "radio", selectValue : ["OPEN","CLOSE"], selectText : ["是","否"], defaultValue : "OPEN" },
  1035. manageablePersonList : { text : "管理者", type : "org", orgType : "person", count : 0},
  1036. viewerList : { text : "可见范围", type : "org", orgType : ["person","unit","group"], count : 0, value : function(){
  1037. return ( data.viewablePersonList || [] ).combine( data.viewableUnitList || [] ).combine( data.viewableGroupList || [] )
  1038. }.bind(this)},
  1039. publisherList : { text : "可新建范围", type : "org", orgType : ["person","unit","group"], count : 0, value : function(){
  1040. return ( data.publishablePersonList || [] ).combine( data.publishableUnitList || [] ).combine( data.publishableGroupList || [] )
  1041. }.bind(this)}
  1042. }
  1043. }, this.app);
  1044. this.form.load();
  1045. this.loadColor();
  1046. //this.loadPermission();
  1047. }.bind(this), true);
  1048. },
  1049. getHtml : function(){
  1050. var boxStyle = (this.isEdited || this.isNew) ? "border:1px solid #ccc; border-radius: 4px;overflow: hidden;padding:8px;" : "";
  1051. var targetStyle = this.data.type != "UNIT" ? "style='display:none'" : "";
  1052. var permissionStyle = this.data.type != "UNIT" ? "style='display:none'" : "";
  1053. return "<table width='100%' bordr='0' cellpadding='7' cellspacing='0' styles='formTable' style='table-layout:fixed;'>" +
  1054. "<tr><td styles='formTableTitle' width='80' lable='name'></td>" +
  1055. " <td styles='formTableValue' item='name' width='400' colspan='3'></td></tr>" +
  1056. "<tr><td styles='formTableTitle'>"+this.lp.color+":</td>" +
  1057. " <td styles='formTableValue' item='color' style='overflow: hidden;' colspan='3'></td></tr>" +
  1058. "<tr><td styles='formTableTitle' lable='type' width='80'></td>" +
  1059. " <td styles='formTableValue' item='type'></td>" +
  1060. " <td styles='formTableTitleRight' lable='isPublic' width='50'></td>" +
  1061. " <td styles='formTableValue' item='isPublic'></td></tr>" +
  1062. "<tr><td styles='formTableTitle' lable='description'></td>" +
  1063. " <td styles='formTableValue' item='description' colspan='3'></td></tr>" +
  1064. "<tr "+targetStyle+"><td styles='formTableTitle' lable='target'></td>" +
  1065. " <td styles='formTableValue' item='target' colspan='3'></td></tr>" +
  1066. "<tr "+permissionStyle+"><td styles='formTableTitle' lable='manageablePersonList'></td>" +
  1067. " <td styles='formTableValue' item='manageablePersonList' colspan='3'></td></tr>" +
  1068. "<tr "+permissionStyle+"><td styles='formTableTitle' lable='viewerList'></td>" +
  1069. " <td styles='formTableValue' item='viewerList' colspan='3'></td></tr>" +
  1070. "<tr "+permissionStyle+"><td styles='formTableTitle' lable='publisherList'></td>" +
  1071. " <td styles='formTableValue' item='publisherList' colspan='3'></td></tr>" +
  1072. "</tr>" +
  1073. "<tr><td styles='formTableTitle' lable='status'></td>" +
  1074. " <td styles='formTableValue' item='status' colspan='3'></td></tr>" +
  1075. "</table>"
  1076. },
  1077. changeType : function( type ){
  1078. var changeItemName = ["target","manageablePersonList","viewerList","publisherList"];
  1079. changeItemName.each( function(name){
  1080. this.formTableArea.getElement("[item='"+name+"']").getParent().setStyle("display",type == "UNIT" ? "" : "none");
  1081. }.bind(this));
  1082. this.options.height = type == "UNIT" ? "650" : "500";
  1083. this.setFormNodeSize();
  1084. },
  1085. loadColor : function(){
  1086. if( this.isEdited || this.isNew ){
  1087. this.loadColor_Edited();
  1088. }else{
  1089. this.loadColor_Read();
  1090. }
  1091. },
  1092. loadColor_Read : function(){
  1093. if( !this.colorItem )return;
  1094. var div = new Element("div", {
  1095. styles : this.css.colorNode
  1096. }).inject( this.colorItem );
  1097. div.setStyle("background-color",this.data.color);
  1098. div.setStyles( this.css.colorNode_current );
  1099. },
  1100. loadColor_Edited : function(){
  1101. if( !this.colorItem )return;
  1102. this.colorOptions = [];
  1103. MWFCalendar.ColorOptions.deep.each( function( color , i){
  1104. var div = new Element("div", {
  1105. styles : this.css.colorNode,
  1106. events : {
  1107. click : function(ev){
  1108. if(this.currentColorNode)this.currentColorNode.setStyles( this.css.colorNode );
  1109. ev.target.setStyles( this.css.colorNode_current );
  1110. this.currentColorNode = ev.target;
  1111. }.bind(this)
  1112. }
  1113. }).inject( this.colorItem );
  1114. div.setStyle("background-color",color);
  1115. div.store("color",color);
  1116. if( this.data.color ){
  1117. if( this.data.color == color ){
  1118. div.setStyles( this.css.colorNode_current );
  1119. this.currentColorNode = div;
  1120. }
  1121. }else if(i==0){
  1122. div.setStyles( this.css.colorNode_current );
  1123. this.currentColorNode = div;
  1124. }
  1125. this.colorOptions.push( div )
  1126. }.bind(this))
  1127. },
  1128. _createBottomContent : function(){
  1129. var html = "<div style='width:700px;margin:0px auto;'><table width='700' bordr='0' cellpadding='7' cellspacing='0' styles='formTable'>" +
  1130. "<tr><td styles='formTableValue' width='100'></td>" +
  1131. " <td styles='formTableValue' style='padding-top: 15px;'>"+
  1132. " <div item='saveAction' style='float:left;display:"+ ( (this.isEdited || this.isNew) ? "" : "none") +";'></div>"+
  1133. " <div item='editAction' style='float:left;display:"+ ( this.editEnable ? "" : "none") +";'></div>"+
  1134. " <div item='removeAction' style='float:left;display:"+ ( this.isEdited ? "" : "none") +";'></div>"+
  1135. " <div item='cancelAction' style='"+( (this.isEdited || this.isNew || this.editEnable) ? "float:left;" : "float:right;margin-right:15px;")+"'></div>"+
  1136. " </td></tr>" +
  1137. "</table></div>";
  1138. this.formBottomNode.set("html", html);
  1139. MWF.xDesktop.requireApp("Template", "MForm", function () {
  1140. var form = new MForm(this.formBottomNode, {}, {
  1141. isEdited: this.isEdited || this.isNew,
  1142. style : "meeting",
  1143. hasColon : true,
  1144. itemTemplate: {
  1145. saveAction : { type : "button", className : "inputOkButton", value : this.lp.save, event : {
  1146. click : function(){ this.ok();}.bind(this)
  1147. } },
  1148. removeAction : { type : "button", className : "inputCancelButton", value : this.lp.deleteCalendar , event : {
  1149. click : function( item, ev ){ this.deleteCalendar(ev); }.bind(this)
  1150. } },
  1151. editAction : { type : "button", className : "inputOkButton", value : this.lp.editCalendar , event : {
  1152. click : function(){ this.editCalendar(); }.bind(this)
  1153. } },
  1154. cancelAction : { type : "button", className : "inputCancelButton", value : this.lp.close , event : {
  1155. click : function(){ this.close(); }.bind(this)
  1156. } }
  1157. }
  1158. }, this.app);
  1159. form.load();
  1160. }.bind(this), true);
  1161. },
  1162. deleteCalendar : function(){
  1163. },
  1164. editCalendar : function(){
  1165. this.formTopNode = null;
  1166. if(this.setFormNodeSizeFun && this.app ){
  1167. this.app.removeEvent("resize",this.setFormNodeSizeFun);
  1168. }
  1169. if( this.formMaskNode )this.formMaskNode.destroy();
  1170. this.formAreaNode.destroy();
  1171. this.edit();
  1172. },
  1173. reset: function(){
  1174. this.formTableArea.empty();
  1175. this._createTableContent();
  1176. },
  1177. _ok : function( data, callback ){
  1178. if( data.type == "UNIT" ){
  1179. var viewerItem = this.form.getItem("viewerList").dom;
  1180. data.viewablePersonList = viewerItem.getValueByType("person");
  1181. data.viewableUnitList = viewerItem.getValueByType("unit");
  1182. data.viewableGroupList = viewerItem.getValueByType("group");
  1183. var publisherItem = this.form.getItem("publisherList").dom;
  1184. data.publishablePersonList = publisherItem.getValueByType("person");
  1185. data.publishableUnitList = publisherItem.getValueByType("unit");
  1186. data.publishableGroupList = publisherItem.getValueByType("group");
  1187. data.target = data.target.join("");
  1188. }else{
  1189. data.target = this.userName;
  1190. ["manageablePersonList","viewablePersonList","publishablePersonList"].each( function( name ){
  1191. data[name] = [ this.userName ];
  1192. }.bind(this));
  1193. ["viewableUnitList","viewableGroupList","publishableUnitList","publishableGroupList"].each( function( name ){
  1194. data[name] = [];
  1195. });
  1196. }
  1197. if( this.currentColorNode ){
  1198. data.color = this.currentColorNode.retrieve("color");
  1199. }else{
  1200. data.color = MWFCalendar.ColorOptions.deep[0];
  1201. }
  1202. delete data.viewerList;
  1203. delete data.publisherList;
  1204. this.app.actions.saveCalendar(data, function(json){
  1205. if( this.view )this.view.reload();
  1206. callback(json);
  1207. }.bind(this));
  1208. },
  1209. close: function (e) {
  1210. this.fireEvent("queryClose");
  1211. this._close();
  1212. //if( this.form ){
  1213. // this.form.destroy();
  1214. //}
  1215. if(this.setFormNodeSizeFun && this.app ){
  1216. this.app.removeEvent("resize",this.setFormNodeSizeFun);
  1217. }
  1218. if( this.formMaskNode )this.formMaskNode.destroy();
  1219. this.formAreaNode.destroy();
  1220. this.fireEvent("postClose");
  1221. if( this.waitReload )this.view.reload();
  1222. delete this;
  1223. }
  1224. });
  1225. MWFCalendar.SaveOptionDialog = new Class({
  1226. Extends: MPopupForm,
  1227. Implements: [Options, Events],
  1228. options: {
  1229. "style": "meeting",
  1230. "width": "470",
  1231. "height": "325",
  1232. "hasTop": true,
  1233. "hasIcon": false,
  1234. "hasTopIcon" : false,
  1235. "hasTopContent" : false,
  1236. "draggable": true,
  1237. //"maxAction" : true,
  1238. "closeAction": true,
  1239. "title" : "修改重复日程"
  1240. },
  1241. _createTableContent : function(){
  1242. this.formTableContainer.setStyles({
  1243. "width" : "auto",
  1244. "padding-top" : "20px",
  1245. "padding-left" : "40px"
  1246. });
  1247. this.lp = { ok : "确定修改", cancel : "取消" };
  1248. var html = "<table width='80%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>" +
  1249. //"<tr><td colspan='2' styles='formTableHead'>申诉处理单</td></tr>" +
  1250. "<tr><td styles='formTableTitle' lable='saveOption'></td>" +
  1251. "<tr><td styles='formTableValue' item='saveOption'></td></tr>" +
  1252. "</table>";
  1253. this.formTableArea.set("html", html);
  1254. MWF.xDesktop.requireApp("Template", "MForm", function () {
  1255. this.form = new MForm(this.formTableArea, {empName: "xadmin"}, {
  1256. style : "meeting",
  1257. isEdited: this.isEdited || this.isNew,
  1258. itemTemplate: {
  1259. saveOption: {
  1260. defaultValue : "single",
  1261. text: "请选择您要修改日程的类型",
  1262. type: "radio",
  1263. selectText: ["只修改当前日程", "修改当前日程和之后的此重复日程","修改所有此重复日程"],
  1264. selectValue: ["single", "after", "all"]
  1265. }
  1266. }
  1267. }, this.app);
  1268. this.form.load();
  1269. }.bind(this), true);
  1270. },
  1271. ok: function (e) {
  1272. this.fireEvent("queryOk");
  1273. var data = this.form.getResult(true, this.options.resultSeparator, true, false, true);
  1274. if (data) {
  1275. if( this.formMaskNode )this.formMaskNode.destroy();
  1276. this.formAreaNode.destroy();
  1277. this.fireEvent("postOk", data.saveOption );
  1278. }
  1279. }
  1280. });
  1281. MWFCalendar.DeleteOptionDialog = new Class({
  1282. Extends: MPopupForm,
  1283. Implements: [Options, Events],
  1284. options: {
  1285. "style": "meeting",
  1286. "width": "470",
  1287. "height": "325",
  1288. "hasTop": true,
  1289. "hasIcon": false,
  1290. "hasTopIcon" : false,
  1291. "hasTopContent" : false,
  1292. "draggable": true,
  1293. //"maxAction" : true,
  1294. "closeAction": true,
  1295. "title" : "删除重复日程"
  1296. },
  1297. _createTableContent : function(){
  1298. this.formTableContainer.setStyles({
  1299. "width" : "auto",
  1300. "padding-top" : "20px",
  1301. "padding-left" : "40px"
  1302. });
  1303. this.lp = { ok : "确定删除", cancel : "取消" };
  1304. var html = "<table width='80%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>" +
  1305. //"<tr><td colspan='2' styles='formTableHead'>申诉处理单</td></tr>" +
  1306. "<tr><td styles='formTableTitle' lable='saveOption'></td>" +
  1307. "<tr><td styles='formTableValue' item='saveOption'></td></tr>" +
  1308. "</table>";
  1309. this.formTableArea.set("html", html);
  1310. MWF.xDesktop.requireApp("Template", "MForm", function () {
  1311. this.form = new MForm(this.formTableArea, {empName: "xadmin"}, {
  1312. isEdited: this.isEdited || this.isNew,
  1313. style : "meeting",
  1314. itemTemplate: {
  1315. saveOption: {
  1316. defaultValue : "single",
  1317. text: "请选择您要删除日程的类型",
  1318. type: "radio",
  1319. selectText: ["只删除当前日程", "删除当前日程和之后的此重复日程","删除所有此重复日程"],
  1320. selectValue: ["single", "after", "all"]
  1321. }
  1322. }
  1323. }, this.app);
  1324. this.form.load();
  1325. }.bind(this), true);
  1326. },
  1327. ok: function (e) {
  1328. this.fireEvent("queryOk");
  1329. var data = this.form.getResult(true, this.options.resultSeparator, true, false, true);
  1330. if (data) {
  1331. if( this.formMaskNode )this.formMaskNode.destroy();
  1332. this.formAreaNode.destroy();
  1333. this.fireEvent("postOk", data.saveOption );
  1334. }
  1335. }
  1336. });
  1337. MWFCalendar.EventTooltip = new Class({
  1338. Extends: MTooltips,
  1339. options : {
  1340. displayDelay : 300
  1341. },
  1342. _loadCustom : function( callback ){
  1343. this.loadAttachment();
  1344. this.loadButton();
  1345. if(callback)callback();
  1346. },
  1347. _getHtml : function(){
  1348. var data = this.data;
  1349. var titleStyle = "font-size:14px;color:#333";
  1350. var valueStyle = "font-size:14px;color:#666;padding-right:10px";
  1351. var beginD = Date.parse(this.data.startTime);
  1352. var endD = Date.parse(this.data.endTime);
  1353. var begin = beginD.format(this.lp.dateFormatAll) + "(" + this.lp.weeks.arr[beginD.get("day")] + ")";
  1354. var end = endD.format(this.lp.dateFormatAll) + "(" + this.lp.weeks.arr[endD.get("day")] + ")";
  1355. var html =
  1356. "<div style='font-size: 16px;color:#333;padding:10px 10px 10px 20px;'>"+ data.title +"</div>"+
  1357. "<div style='height:1px;margin:0px 20px;border-bottom:1px solid #ccc;'></div>"+
  1358. "<table width='100%' bordr='0' cellpadding='7' cellspacing='0' style='margin:13px 13px 13px 13px;'>" +
  1359. "<tr><td style='"+titleStyle+";' width='40'>开始:</td>" +
  1360. " <td style='"+valueStyle+"'>" + begin + "</td></tr>" +
  1361. "<tr><td style='"+titleStyle+"'>结束:</td>" +
  1362. " <td style='"+valueStyle+ "'>"+ end +"</td></tr>" +
  1363. "<tr><td style='"+titleStyle+"'>"+this.lp.locationName+":</td>" +
  1364. " <td style='"+valueStyle+ "'>"+ (this.data.locationName||"") +"</td></tr>" +
  1365. //( this.options.isHideAttachment ? "" :
  1366. //"<tr><td style='"+titleStyle+"'>"+this.lp.eventAttachment+":</td>" +
  1367. //" <td style='"+valueStyle+"' item='attachment'></td></tr>"+
  1368. //)+
  1369. "<tr><td style='"+titleStyle+"'></td>" +
  1370. " <td style='"+valueStyle+ "' item='seeMore'></td></tr>"+
  1371. "</table>";
  1372. return html;
  1373. },
  1374. destroy: function(){
  1375. if( this.node ){
  1376. this.node.destroy();
  1377. this.node = null;
  1378. }
  1379. },
  1380. loadButton : function(){
  1381. var area = this.node.getElement("[item='seeMore']");
  1382. new Element("div",{
  1383. styles : {
  1384. "background-color" : "#3c75b7",
  1385. "height" : "28px",
  1386. "line-height" : "28px",
  1387. "border-radius" : "5px",
  1388. "width" : "80px",
  1389. "text-align" : "center",
  1390. "font-size" : "12px",
  1391. "cursor" : "pointer",
  1392. "color" : "#fff"
  1393. },
  1394. events : { click : function() {
  1395. var form = new MWFCalendar.EventForm(this, this.data, {
  1396. isFull : true
  1397. }, {app:this.app});
  1398. form.view = this.view;
  1399. form.edit();
  1400. this.hide();
  1401. }.bind(this)},
  1402. text : "查看更多"
  1403. }).inject(area);
  1404. },
  1405. loadAttachment: function(){
  1406. if( this.options.isHideAttachment )return;
  1407. if( typeOf(this.data.attachmentList)=="array" && this.data.attachmentList[0] ){
  1408. var area = this.node.getElement("[item='attachment']");
  1409. this.attachmentNode = new Element("div"
  1410. //{"styles": this.css.createCalendarAttachmentNode}
  1411. ).inject(area);
  1412. var attachmentContentNode = new Element("div", {
  1413. //"styles": this.css.createCalendarAttachmentContentNode
  1414. }).inject(this.attachmentNode);
  1415. this.attachmentController = new MWFCalendar.EventTooltip.AttachmentController(attachmentContentNode, this, {
  1416. "size": "min",
  1417. "isSizeChange": false,
  1418. "isReplace": false,
  1419. "isUpload": false,
  1420. "isDelete": false,
  1421. "isDownload": true,
  1422. "readonly": true
  1423. });
  1424. this.attachmentController.load();
  1425. this.data.attachmentList.each(function (att) {
  1426. att.person = att.lastUpdatePerson.split("@")[0];
  1427. var at = this.attachmentController.addAttachment(att);
  1428. }.bind(this));
  1429. }
  1430. },
  1431. downloadAttachment: function(e, node, attachments){
  1432. attachments.each(function(att){
  1433. this.app.actions.getFileDownload(att.data.id);
  1434. }.bind(this));
  1435. },
  1436. openAttachment: function(e, node, attachments){
  1437. attachments.each(function(att){
  1438. this.app.actions.getFile(att.data.id);
  1439. }.bind(this));
  1440. },
  1441. getAttachmentUrl: function(attachment, callback){
  1442. this.app.actions.getFileUrl(attachment.data.id, callback);
  1443. }
  1444. });
  1445. MWFCalendar.EventTooltip.AttachmentController = new Class({
  1446. Extends : MWF.widget.AttachmentController,
  1447. loadMin: function(){
  1448. if (!this.node) this.node = new Element("div", {"styles": this.css.container_min});
  1449. if (!this.minActionAreaNode){
  1450. //this.minActionAreaNode = new Element("div", {"styles": this.css.minActionAreaNode}).inject(this.node);
  1451. this.minContent = new Element("div", {"styles": this.css.minContentNode}).inject(this.node);
  1452. this.minContent.setStyles({
  1453. "margin-right" : "0px"
  1454. });
  1455. //this.min_downloadAction = this.createAction(this.minActionAreaNode, "download", MWF.LP.widget.download, function(e, node){
  1456. // this.downloadAttachment(e, node);
  1457. //}.bind(this));
  1458. this.node.inject(this.container);
  1459. //if (this.options.readonly) this.setReadonly();
  1460. this.checkActions();
  1461. this.setEvent();
  1462. }else{
  1463. //this.minActionAreaNode.setStyle("display", "block");
  1464. this.minContent.setStyle("display", "block");
  1465. this.minContent.empty();
  1466. }
  1467. var atts = [];
  1468. while (this.attachments.length){
  1469. var att = this.attachments.shift();
  1470. atts.push(new MWFCalendar.EventTooltip.AttachmentMin(att.data, this));
  1471. }
  1472. this.attachments = atts;
  1473. },
  1474. addAttachment: function(data){
  1475. if (this.options.size=="min"){
  1476. this.attachments.push(new MWFCalendar.EventTooltip.AttachmentMin(data, this));
  1477. }else{
  1478. this.attachments.push(new MWF.widget.AttachmentController.Attachment(data, this));
  1479. }
  1480. }
  1481. });
  1482. MWFCalendar.EventTooltip.AttachmentMin = new Class({
  1483. Extends : MWF.widget.AttachmentController.AttachmentMin,
  1484. setEvent: function(){
  1485. this.node.addEvents({
  1486. "mouseover": function(){if (!this.isSelected) this.node.setStyles(this.css["minAttachmentNode_list_over"])}.bind(this),
  1487. "mouseout": function(){if (!this.isSelected) this.node.setStyles(this.css["minAttachmentNode_list"])}.bind(this),
  1488. "mousedown": function(e){this.selected(e);}.bind(this),
  1489. "click": function(e){this.downloadAttachment(e);}.bind(this)
  1490. });
  1491. },
  1492. downloadAttachment: function(e){
  1493. if (this.controller.module) this.controller.module.downloadAttachment(e, null, [this]);
  1494. }
  1495. });