Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 426.51 KB | None | 0 0
  1. /*
  2. * Isomorphic SmartClient
  3. * Version v11.1p_2017-08-06 (2017-08-06)
  4. * Copyright(c) 1998 and beyond Isomorphic Software, Inc. All rights reserved.
  5. * "SmartClient" is a trademark of Isomorphic Software, Inc.
  6. *
  7. * licensing@smartclient.com
  8. *
  9. * http://smartclient.com/license
  10. */
  11. if (window.isc && window.isc.module_Core && !window.isc.module_Calendar) {
  12. isc.module_Calendar = 1;
  13. isc._moduleStart = isc._Calendar_start = (isc.timestamp ? isc.timestamp() : new Date().getTime());
  14. if (isc._moduleEnd && (!isc.Log || (isc.Log && isc.Log.logIsDebugEnabled('loadTime')))) {
  15. isc._pTM = {
  16. message: 'Calendar load/parse time: ' + (isc._moduleStart - isc._moduleEnd) + 'ms',
  17. category: 'loadTime'
  18. };
  19. if (isc.Log && isc.Log.logDebug) isc.Log.logDebug(isc._pTM.message, 'loadTime');
  20. else if (isc._preLog) isc._preLog[isc._preLog.length] = isc._pTM;
  21. else isc._preLog = [isc._pTM]
  22. }
  23. isc.definingFramework = true;
  24. if (window.isc && isc.version != "v11.1p_2017-08-06/LGPL Development Only" && !isc.DevUtil) {
  25. isc.logWarn("SmartClient module version mismatch detected: This application is loading the core module from SmartClient version '" + isc.version + "' and additional modules from 'v11.1p_2017-08-06/LGPL Development Only'. Mixing resources from different SmartClient packages is not supported and may lead to unpredictable behavior. If you are deploying resources from a single package you may need to clear your browser cache, or restart your browser." + (isc.Browser.isSGWT ? " SmartGWT developers may also need to clear the gwt-unitCache and run a GWT Compile." : ""))
  26. }
  27. isc.ClassFactory.defineClass("CalendarView", "ListGrid");
  28. isc.A = isc.CalendarView.getPrototype();
  29. isc.B = isc._allFuncs;
  30. isc.C = isc.B._maxIndex;
  31. isc.D = isc._funcClasses;
  32. isc.D[isc.C] = isc.A.Class;
  33. isc.A.isCalendarView = true;
  34. isc.A.verticalEvents = true;
  35. isc.A.hiliteRowOnFocus = false;
  36. isc.A.canHover = true;
  37. isc.A.showHover = null;
  38. isc.A.hoverByCell = null;
  39. isc.A.canFreezeFields = false;
  40. isc.A.alternateFieldStyles = false;
  41. isc.A.canTabToHeader = false;
  42. isc.A.rangeCriteriaMode = null;
  43. isc.A.showLaneFields = null;
  44. isc.A.useEventCanvasPool = true;
  45. isc.A.eventCanvasPoolingMode = "data";
  46. isc.A.hoverDelay = 0;
  47. isc.A.eventDragTargetDefaults = {
  48. _constructor: "Canvas",
  49. border: "1px dashed red",
  50. width: 1,
  51. height: 1,
  52. snapToGrid: false,
  53. autoDraw: false,
  54. moveWithMouse: false,
  55. dragAppearance: "target",
  56. dragTarget: this,
  57. visibility: "hidden",
  58. keepInParentRect: true,
  59. hoverMoveWithMouse: true,
  60. showHover: true,
  61. hoverDelay: 0,
  62. hoverProps: {
  63. overflow: "visible",
  64. hoverMoveWithMouse: this.hoverMoveWithMouse
  65. },
  66. getHoverHTML: function() {
  67. var _1 = this.eventCanvas,
  68. _2 = _1.event,
  69. _3 = _1.$1245;
  70. if (!_3) return;
  71. var _4 = _3.$131e,
  72. _5 = _3.$131f,
  73. _6 = this.view.calendar.createEventObject(_2, _4, _5, _3.$130b, _3.$1298);
  74. return this.view.calendar.$140a(this.view, _6)
  75. },
  76. setView: function(_1) {
  77. this.view = _1
  78. },
  79. getEventPadding: function() {
  80. var _1 = this.eventCanvas.calendar;
  81. return _1.useDragPadding ? _1.getLanePadding(this.view) : 0
  82. },
  83. fillOverlapSlots: true,
  84. positionToEventCanvas: function(_1) {
  85. var _2 = this.eventCanvas,
  86. _3 = _2.calendar,
  87. _4 = this.view,
  88. _5 = _4.getEventLeft(_2.event) + this.getEventPadding(),
  89. _6 = _2.getTop(),
  90. _7 = (_4.$732 ? _4.$732(_2.event) : _2.getVisibleWidth()),
  91. _8 = _2.getVisibleHeight(),
  92. _9 = _2.$1245;
  93. if (this.fillOverlapSlots) {
  94. if (_4.isTimelineView()) {
  95. var _10 = _2.$1245.$8l;
  96. _6 = _4.body.getRowTop(_10);
  97. if (_2.isIndicatorCanvas) {
  98. _8 = _2.getVisibleHeight();
  99. _9.$142h = true
  100. } else if (!_9.$1297) {
  101. _8 = _4.getLaneHeight(_10)
  102. } else {
  103. _6 += _9.$1298.top;
  104. _8 = _9.$1298.height
  105. }
  106. } else {
  107. var _11 = _2.$1245.$644;
  108. _5 = _4.body.getColumnLeft(_11);
  109. if (_9.$1299) {
  110. if (!_9.$1297) {
  111. _7 = _4.getLaneWidth(_11)
  112. } else {
  113. _5 += _9.$1298.left;
  114. _7 = _9.$1298.width
  115. }
  116. } else {
  117. _7 = _4.body.getColumnWidth(_11)
  118. }
  119. }
  120. }
  121. if (this.$1244) {
  122. if (_4.isTimelineView()) {
  123. _6 = _4.body.getRowTop(_2.$1245.$8l)
  124. } else {
  125. _5 = _4.body.getColumnLeft(_2.$1245.$644)
  126. }
  127. }
  128. if (_5 < 0) _5 = 0;
  129. this.moveTo(_5, _6);
  130. this.resizeTo(_7, _8);
  131. if (_1) {
  132. if (!this.isDrawn()) this.draw();
  133. this.show();
  134. this.bringToFront()
  135. }
  136. if (_4.shouldShowDragHovers()) isc.Hover.show(this.getHoverHTML(), this.hoverProps)
  137. },
  138. moveToEvent: function() {},
  139. dragRepositionStart: function() {
  140. var _1 = this.eventCanvas,
  141. _2 = _1.event,
  142. _3 = _1.calendar,
  143. _4 = this.view,
  144. _5 = _4.body;
  145. if (!_3.canDragEvent(_2)) return false;
  146. this.$1246 = true;
  147. var _6 = _5.getEventRow(),
  148. _7 = _5.getRowTop(_6),
  149. _8 = _5.getRowHeight(_4.getRecord(_6), _6),
  150. _9 = _4.getEventLeft(_2) + 1,
  151. _10 = _5.getEventColumn(_9),
  152. _11 = _5.getColumnLeft(_10),
  153. _12 = _5.getColumnWidth(_10),
  154. _13 = _5.getOffsetX() - _1.getLeft(),
  155. _14 = _5.getOffsetY() - _1.getTop();
  156. var _15 = _4.isTimelineView();
  157. var _16 = _1.$1245 = {};
  158. _16.$126l = !_15;
  159. _16.$8l = _6;
  160. _16.$644 = _10;
  161. _16.$1249 = _8;
  162. _16.$1248 = _12;
  163. _16.$117y = _15 ? _4.$732(_2) : _16.$1248;
  164. _16.$126o = _15 ? _16.$1249 : _1.getVisibleHeight();
  165. _16.$936 = _6;
  166. _16.$937 = _10;
  167. _16.$116y = _13;
  168. _16.$1247 = _14;
  169. _16.$126p = Math.round(_16.$126o / _16.$1249);
  170. _16.$126q = _4.data.getLength() - _16.$126p;
  171. _16.$126r = _4.getRowTop(_16.$126q);
  172. _16.$126s = _15 ? _5.getScrollWidth() - _16.$117y : _5.getColumnLeft(_5.fields.length - 1);
  173. _16.$126t = _15 ? _5.getEventColumn(_16.$126s) : _5.fields.length - 1;
  174. _16.$131e = _3.getEventStartDate(_2);
  175. _16.$131f = _3.getEventEndDate(_2);
  176. _16.$142s = _16.$131e.duplicate();
  177. _16.$142t = _16.$131f.duplicate();
  178. _16.$1670 = _4.getDateFromPoint() || _16.$131e.duplicate();
  179. _16.$131h = _16.$1670.duplicate();
  180. _16.$1299 = _4.hasLanes() && !_1.isIndicatorCanvas && !_1.isZoneCanvas;
  181. if (_16.$1299) {
  182. var _17 = _4.getLane(_2[_3.laneNameField]),
  183. _18 = !_17 || !_17.sublanes ? null : _17.sublanes.find(_3.laneNameField, _2[_3.sublaneNameField]);
  184. _16.$130a = _17;
  185. _16.$130b = _17;
  186. _16.$1297 = _3.useSublanes && _17 && _17.sublanes && _17.sublanes.length > 0;
  187. _16.$130c = _18;
  188. _16.$1298 = _18;
  189. _16.$130d = !_3.canEditEventLane(_2, _4);
  190. _16.$130e = !_3.canEditEventSublane(_2, _4)
  191. }
  192. this.positionToEventCanvas(true);
  193. return isc.EH.STOP_BUBBLING
  194. },
  195. dragRepositionMove: function() {
  196. var _1 = this.eventCanvas,
  197. _2 = _1.$1245,
  198. _3 = _1.event,
  199. _4 = _1.calendar,
  200. _5 = this.view,
  201. _6 = _4.getSnapGapPixels(_5),
  202. _7 = _5.isTimelineView(),
  203. _8 = _5.body,
  204. _9 = this.getEventPadding(),
  205. _10 = _2.$142h != null ? _2.$142h : -1,
  206. _11 = -1,
  207. _12 = -1,
  208. _13 = -1;
  209. var _14 = _5.getDateFromPoint();
  210. if (!_14) return;
  211. var _15 = _5.getLaneFromPoint();
  212. if (_2.$1299 && !_15) return;
  213. if (_2.$131h && _2.$131h.getTime() == _14.getTime() && _2.$130b && _2.$130b == _15) return;
  214. if (_2.$1299) {
  215. var _16 = _15,
  216. _17 = _2.$1297 ? _5.getSublaneFromPoint() : null;
  217. if (!_16 || _5.isGroupNode(_16)) {
  218. _16 = _2.$130b;
  219. _17 = _2.$1298
  220. } else {
  221. if (_2.$130d) {
  222. _16 = _2.$130a;
  223. if (_2.$1297 && (_2.$130e || !_16.sublanes.contains(_17))) {
  224. _17 = _2.$130c
  225. }
  226. } else {
  227. if (_2.$1297) {
  228. if (_2.$130e) {
  229. var _18 = _16.sublanes ? _16.sublanes.find(_4.laneNameField, _2.$130c.name) : null;
  230. if (_18) {
  231. _17 = _18
  232. } else {
  233. _16 = _2.$130b;
  234. _17 = _2.$1298
  235. }
  236. } else {
  237. if (_16 != _2.$130b) {
  238. if (!_16.sublanes) {
  239. _16 = _2.$130b;
  240. _17 = _2.$1298
  241. }
  242. }
  243. }
  244. }
  245. }
  246. }
  247. if (_7) {
  248. var _19 = _5.getRecordIndex(_16);
  249. _10 = _5.getRowTop(_19);
  250. if (_17) _10 += _17.top;
  251. _13 = (_17 ? _17.height : _16.height);
  252. _2.$936 = _19
  253. } else {
  254. var _19 = _5.getLaneIndex(_16[_4.laneNameField]);
  255. _11 = _5.body.getColumnLeft(_19);
  256. _12 = _5.getLaneWidth(_16[_4.laneNameField]);
  257. if (_17) {
  258. _11 += _17.left;
  259. _12 = _17.width
  260. }
  261. _2.$937 = _19
  262. }
  263. }
  264. var _20 = _8.getEventRow(),
  265. _21 = Math.min(_2.$126q, (_20 < 0 ? 0 : _20)),
  266. _22 = _8.getRowTop(_21),
  267. _23 = _8.getOffsetY(),
  268. _24 = Math.floor((Math.floor((_23 - _22) / _6)) * _6),
  269. _25 = _7 ? _22 : Math.min(_2.$126r, _22 + _24),
  270. _26 = this.getVisibleHeight(),
  271. _27 = _26;
  272. var _28 = _14.getTime() - _2.$131h.getTime(),
  273. _29 = _28 < 0 ? -1 : _28 == 0 ? 0 : 1,
  274. _30 = Math.floor(Math.abs(_28) / _5.getTimePerSnapGap("ms"));
  275. var _31 = _4.addSnapGapsToDate(_2.$131e, _5, _30 * _29);
  276. var _32 = _4.addSnapGapsToDate(_2.$131f, _5, _30 * _29);
  277. var _33 = _31.duplicate();
  278. var _34 = _32.duplicate();
  279. if (_7) {
  280. if (_31.getTime() < _4.startDate.getTime()) {
  281. _33 = _4.startDate.duplicate()
  282. }
  283. if (_32.getTime() > _4.endDate.getTime()) {
  284. _34 = _4.endDate.duplicate()
  285. }
  286. }
  287. var _35 = Math.min(_2.$126t, _8.getEventColumn()),
  288. _36 = _8.getColumnLeft(_35),
  289. _37 = (_8.getOffsetX() - _2.$116y),
  290. _38 = Math.max(0, _37 - ((_37 - _36) % _6) + 1),
  291. _39 = _5.getDateFromPoint(_38, _25, null, true),
  292. _40 = Math.min(_2.$126s, (_7 ? _4.getDateLeftOffset(_39, _5) : _36)),
  293. _41 = _40 + (_7 ? (_2.$117y) : _1.getVisibleWidth());
  294. if (!_7) {
  295. if (_21 != _2.$936) {
  296. if (_21 < 0) {
  297. _21 = 0;
  298. _25 = 0
  299. } else {
  300. var _42 = _22 + _2.$126o;
  301. var _43 = _8.getEventRow(_22 + _2.$126o - _2.$1249);
  302. if (_43 < 0) {
  303. _21 = _2.$936;
  304. _25 = _8.getRowTop(_21)
  305. } else {
  306. _2.$936 = _21
  307. }
  308. }
  309. }
  310. }
  311. var _44 = _5.isTimelineView() ? (_10 >= 0 && _13 >= 0) : (_2.$1299 ? (_11 >= 0 && _12 >= 0) : false)
  312. if (!_44) {
  313. _2.$936 = _21
  314. }
  315. if (_35 != _2.$937) {
  316. if (_5.isDayView() || _5.isWeekView()) {
  317. if (_5.isDayView() && _4.showDayLanes && !_4.canEditEventLane(_3, _5)) {
  318. _35 = _2.$937;
  319. _40 = _2.$117z
  320. } else {
  321. if (_35 == -1) _2.$937 = 0;
  322. else if (_35 == -2) _2.$937 = _2.$937;
  323. else _2.$937 = _35;
  324. _40 = _8.getColumnLeft(_2.$937)
  325. }
  326. } else {
  327. _2.$937 = Math.max(1, _35)
  328. }
  329. }
  330. var _45 = Math.max(0, (_10 >= 0 ? _10 : _25)),
  331. _42 = Math.min(_5.body.getScrollHeight(), _45 + _2.$126o);
  332. if (!_5.isTimelineView()) {
  333. _31 = _5.getDateFromPoint(_40 + 1, _45 + 1);
  334. _32 = _5.getDateFromPoint(_41 - (!_5.isTimelineView() ? 1 : 0), _42);
  335. _33 = _31.duplicate();
  336. _34 = _32.duplicate()
  337. }
  338. if (_5.isDayView() || _5.isWeekView()) {
  339. if (_31.getDate() != _32.getDate()) {
  340. _32 = isc.DateUtil.getEndOf(_31, "d")
  341. }
  342. }
  343. var _46 = _32.duplicate();
  344. _46.setTime(_32.getTime() - 1);
  345. var _47 = true;
  346. var _48 = _4.createEventObject(_3, _31, _46, _16 && _16[_4.laneNameField], _17 && _17[_4.laneNameField]);
  347. _47 = _4.eventRepositionMove(_3, _48, this);
  348. if (_44) {
  349. if (_7) {
  350. _45 = _10;
  351. _2.$125b = _13;
  352. _40 = _5.getDateLeftOffset(_33);
  353. _41 = _5.getDateRightOffset(_34);
  354. _2.$117y = _41 - _40;
  355. this.resizeTo(_2.$117y, _13)
  356. } else {
  357. _40 = _11;
  358. _2.$131b = _12;
  359. this.resizeTo(_12, null)
  360. }
  361. _2.$1298 = _17;
  362. _2.$130b = _16
  363. } else {
  364. if (_45 + _27 > _5.body.getScrollHeight() - 1) {
  365. _27 = _5.body.getScrollHeight() - 1 - _45
  366. }
  367. _2.$125b = _27;
  368. this.resizeTo(null, _27)
  369. }
  370. _2.$125a = _45;
  371. _2.$117z = _40;
  372. _2.$131e = _31.duplicate();
  373. _2.$131f = _32.duplicate();
  374. _2.$131h = _14.duplicate();
  375. if (_47) {
  376. _2.$142s = _31.duplicate();
  377. _2.$142t = _32.duplicate();
  378. this.setDragCursor("default")
  379. } else {
  380. this.setDragCursor("not-allowed")
  381. }
  382. this.moveTo(_2.$117z, _2.$125a);
  383. if (_5.shouldShowDragHovers()) isc.Hover.show(this.getHoverHTML(), this.hoverProps);
  384. return isc.EH.STOP_BUBBLING
  385. },
  386. dragRepositionStop: function() {
  387. var _1 = this.eventCanvas,
  388. _2 = _1.$1245,
  389. _3 = _1.calendar,
  390. _4 = this.view,
  391. _5 = _4.body,
  392. _6 = _1.event;
  393. if (_4.shouldShowDragHovers()) isc.Hover.hide();
  394. this.hide();
  395. var _7 = (this.cursor != "default" && _3.eventUseLastValidDropDates != true);
  396. this.setDragCursor("default");
  397. if (_7) return;
  398. if (_1.isIndicatorCanvas) {
  399. var _8 = _3.indicators.find(_3.nameField, _6[_3.nameField]);
  400. _8[_3.startDateField] = _2.$142s;
  401. _1.calendarView.drawIndicators();
  402. _1.calendarView.drawZones();
  403. return isc.EH.STOP_BUBBLING
  404. }
  405. var _9 = _2.$1299 && _3.canEditEventLane(_6, _4),
  406. _10 = _2.$1299 && _3.canEditEventSublane(_6, _4),
  407. _11, _12;
  408. if (_4.isTimelineView()) {
  409. if (_9 || _10) {
  410. if (_9) _11 = _2.$130b[_3.laneNameField];
  411. if (_10 && _3.useSublanes && _2.$1298) {
  412. _12 = _2.$1298[_3.laneNameField]
  413. }
  414. }
  415. } else if (_4.isDayView() && _3.showDayLanes) {
  416. if (_9 || _10) {
  417. if (_9) _11 = _2.$130b[_3.laneNameField];
  418. if (_10 && _3.useSublanes && _2.$1298) {
  419. _12 = _2.$1298[_3.laneNameField]
  420. }
  421. } else return false
  422. }
  423. var _13 = [_2.$142s.duplicate(), _2.$142t.duplicate()];
  424. var _14 = _13[0].getTime() - _3.getEventStartDate(_6).getTime(),
  425. _15 = Math.floor(_14 / (1000 * 60)),
  426. _16 = {};
  427. if (_4.isTimelineView()) {
  428. if (_6[_3.leadingDateField] && _6[_3.trailingDateField]) {
  429. _13.add(_6[_3.leadingDateField].duplicate());
  430. _13[2].setMinutes(_13[2].getMinutes() + _15);
  431. _13.add(_6[_3.trailingDateField].duplicate());
  432. _13[3].setMinutes(_13[3].getMinutes() + _15);
  433. _16[_3.leadingDateField] = _13[2];
  434. _16[_3.trailingDateField] = _13[3]
  435. }
  436. }
  437. if (_11 == null) _11 = _6[_3.laneNameField];
  438. if (_3.adjustEventTimes) {
  439. var _17 = _3.adjustEventTimes(_6, _1, _13[0], _13[1], _11);
  440. if (_17) {
  441. _13[0] = _17[0].duplicate();
  442. _13[1] = _17[1].duplicate()
  443. }
  444. }
  445. if (_3.allowEventOverlap == false) {
  446. var _18 = _3.checkForOverlap(_4, _1, _6, _13[0], _13[1], _11);
  447. if (_18 == true) {
  448. if (_3.timelineEventOverlap) {
  449. _3.timelineEventOverlap(false, _6, _1, _13[0], _13[1], _11)
  450. }
  451. return false
  452. } else if (isc.isAn.Array(_18)) {
  453. _13[0] = _18[0].duplicate();
  454. _13[1] = _18[1].duplicate();
  455. if (_3.timelineEventOverlap) {
  456. _3.timelineEventOverlap(true, _6, _1, _13[0], _13[1], _11)
  457. }
  458. }
  459. }
  460. if (_3.isZeroLengthEvent(_6)) _13[1] = null;
  461. if (_13[0] != _2.$142s) _2.$142s = _13[0];
  462. if (_13[1] != _2.$142t) _2.$142t = _13[1];
  463. var _19 = _3.createEventObject(_6, _2.$142s, _2.$142t, _2.$130b && _2.$130b[_3.laneNameField], _2.$1298 && _2.$1298[_3.laneNameField]);
  464. var _20 = _3.eventRepositionStop(_6, _19, _16, this);
  465. this.$1246 = false;
  466. if (_20 != false) {
  467. if (_4.isTimelineView()) {
  468. if (_3.timelineEventMoved(_6, _2.$142s, _2.$142t, _11) == false) return false
  469. } else {
  470. if (_3.eventMoved(_2.$142s, _6, _11) == false) return false
  471. }
  472. _3.updateCalendarEvent(_6, _19)
  473. }
  474. delete _1.$1245;
  475. return isc.EH.STOP_BUBBLING
  476. },
  477. dragResizeStart: function() {
  478. var _1 = this.eventCanvas,
  479. _2 = _1.event,
  480. _3 = _1.calendar,
  481. _4 = this.view,
  482. _5 = _4.body;
  483. if (!_3.canResizeEvent(_1.event)) return false;
  484. this.$1244 = true;
  485. var _6 = _5.getEventRow(),
  486. _7 = _5.getRowTop(_6),
  487. _8 = _5.getRowHeight(_4.getRecord(_6), _6),
  488. _9 = _5.getEventColumn(),
  489. _10 = _5.getColumnLeft(_9),
  490. _11 = _5.getColumnWidth(_9),
  491. _12 = _5.getOffsetX() - _1.getLeft(),
  492. _13 = _5.getOffsetY() - _1.getTop(),
  493. _14 = _1.getVisibleWidth(),
  494. _15 = _4.hasLanes(),
  495. _16 = _4.isTimelineView(),
  496. _17 = _16 && (_12 < _14 / 2),
  497. _18 = _15 ? _4.getLaneFromPoint() : null,
  498. _19 = _18 && _3.useSublanes ? _3.getSublaneFromPoint() : null;
  499. var _20 = {
  500. $1299: _4.hasLanes(),
  501. $1297: _3.useSublanes,
  502. $117z: _16 ? _4.getDateLeftOffset(_3.getEventStartDate(_2)) : _10 + (_15 && _19 ? _19.left : 0),
  503. $1171: _1.getLeft() + _14,
  504. $125a: _16 ? _7 + (_19 ? _19.top : 0) : _1.getTop(),
  505. $125b: (_16 ? (_19 ? _19.height : _18.height) : _1.getVisibleHeight()),
  506. $131b: _16 ? _1.getVisibleWidth() : (_19 ? _19.width : (_18 && _4.getLaneWidth ? _4.getLaneWidth(_2[_3.laneNameField]) : _11)),
  507. $1172: _17,
  508. $131q: _16 && !_17,
  509. $131g: !_16,
  510. $131e: _3.getEventStartDate(_1.event),
  511. $131f: _3.getEventEndDate(_1.event),
  512. $130b: _18,
  513. $1298: _19
  514. };
  515. if (_20.$125a == -1) {
  516. _20.$125a = 0;
  517. _20.$125b -= _5.getScrollTop()
  518. }
  519. _1.$1245 = _20;
  520. this.positionToEventCanvas(true);
  521. _20.$1827 = false;
  522. return isc.EH.STOP_BUBBLING
  523. },
  524. dragResizeMove: function() {
  525. var _1 = this.eventCanvas,
  526. _2 = _1.$1245,
  527. _3 = _1.event,
  528. _4 = _1.calendar,
  529. _5 = this.view,
  530. _6 = _2.$125a,
  531. _7 = _2.$117z,
  532. _8 = _2.$125b,
  533. _9 = _2.$131b,
  534. _10 = _2.$131e,
  535. _11 = _2.$131f,
  536. _12 = isc.DateUtil;
  537. var _13 = _5.getDateFromPoint();
  538. if (_2.$131g) {
  539. _11 = _4.addSnapGapsToDate(_13, _5, 1);
  540. if (_11.getDate() != _10.getDate()) {
  541. _11 = isc.DateUtil.getEndOf(_10, "d")
  542. }
  543. var _14 = _5.getDateTopOffset(_11);
  544. _8 = _14 - _6
  545. } else if (_2.$1172) {
  546. if (!_13) _13 = _5.startDate.duplicate();
  547. _10 = _13;
  548. var _15 = _7 + _9;
  549. if (_3[_4.durationField] != null) {
  550. var _16 = _11.getTime() - _10.getTime(),
  551. _17 = _3[_4.durationUnitField],
  552. _18 = _12.getTimeUnitMilliseconds(_17);
  553. if (_16 % _18 != 0) {
  554. var _19 = Math.round(_12.convertPeriodUnit(_16, "ms", _17)),
  555. _10 = _12.dateAdd(_11.duplicate(), _17, _19 * -1)
  556. }
  557. }
  558. _7 = _5.getDateLeftOffset(_10);
  559. _9 = (_15 - _7)
  560. } else {
  561. if (!_13) _13 = _5.endDate.duplicate();
  562. else _13 = _4.addSnapGapsToDate(_13.duplicate(), _5, 1);
  563. _11 = _13.duplicate();
  564. var _20 = _4.getVisibleEndDate(_5);
  565. if (_11.getTime() > _20.getTime()) {
  566. _11.setTime(_20.getTime())
  567. }
  568. if (_3[_4.durationField] != null) {
  569. var _16 = _11.getTime() - _10.getTime(),
  570. _17 = _3[_4.durationUnitField],
  571. _18 = _12.getTimeUnitMilliseconds(_17);
  572. if (_16 % _18 != 0) {
  573. var _19 = Math.round(_12.convertPeriodUnit(_16, "ms", _17)),
  574. _11 = _12.dateAdd(_10.duplicate(), _17, _19)
  575. }
  576. }
  577. var _7 = _5.getDateLeftOffset(_10),
  578. _15 = _5.getDateLeftOffset(_11);
  579. _9 = _15 - _7
  580. }
  581. if (_11.getTime() <= _10.getTime() || _9 <= 0 || _8 <= 0) {
  582. return isc.EH.STOP_BUBBLING
  583. }
  584. var _21 = _4.createEventObject(_3, _10, _11)
  585. var _22 = _4.eventResizeMove(_3, _21, _5, _2);
  586. _2.$131e = _10;
  587. _2.$131f = _11;
  588. _2.$125a = _6;
  589. _2.$117z = _7;
  590. _2.$131b = _9;
  591. _2.$125b = _8;
  592. this.resizeTo(_2.$131b, _2.$125b);
  593. this.moveTo(_2.$117z, _2.$125a);
  594. if (_22 != false) {
  595. _2.$1827 = false;
  596. _2.$142s = _10.duplicate();
  597. _2.$142t = _11.duplicate();
  598. this.setDragCursor("default")
  599. } else {
  600. _2.$1827 = true;
  601. this.setDragCursor("not-allowed")
  602. }
  603. if (_5.shouldShowDragHovers()) isc.Hover.show(this.getHoverHTML(), this.hoverProps);
  604. return isc.EH.STOP_BUBBLING
  605. },
  606. setDragCursor: function(_1) {
  607. var _2 = this.getCurrentCursor();
  608. if (_2 == _1) return;
  609. this.setCursor(_1);
  610. this.view.setCursor(_1);
  611. if (this.view.body) this.view.body.setCursor(_1);
  612. if (this.view.frozenBody) this.view.frozenBody.setCursor(_1);
  613. isc.EH.lastEvent.target.setCursor(_1)
  614. },
  615. dragResizeStop: function() {
  616. var _1 = this.eventCanvas,
  617. _2 = _1.$1245,
  618. _3 = _1.calendar,
  619. _4 = this.view,
  620. _5 = _1.event,
  621. _6 = _2.$142s,
  622. _7 = _2.$142t;
  623. if (_2.$1827 && !_3.eventUseLastValidDropDates) {
  624. _6 = null;
  625. _7 = null
  626. }
  627. this.setDragCursor("default");
  628. if (_4.shouldShowDragHovers()) isc.Hover.hide();
  629. this.hide();
  630. if ((_2.$1172 && !_6) || (_2.$131q && !_7)) {
  631. this.$1244 = false;
  632. return isc.EH.STOP_BUBBLING
  633. }
  634. var _8 = _3.createEventObject(_5, _6);
  635. if (_5[_3.durationField] != null) {
  636. var _9 = _7.getTime() - _6.getTime();
  637. var _10 = Math.round(isc.DateUtil.convertPeriodUnit(_9, "ms", _5[_3.durationUnitField]));
  638. _8[_3.durationField] = _10;
  639. _7 = _2.$142t = _3.getEventEndDate(_8)
  640. }
  641. _8[_3.endDateField] = _7;
  642. var _11 = _3.eventResizeStop(_5, _8, null, this);
  643. if (_11 != false) {
  644. if (_4.isTimelineView()) {
  645. if (_3.timelineEventResized(_5, _6, _7) == false) return false
  646. } else {
  647. if (_3.eventResized(_7, _5) == false) return false
  648. }
  649. _3.updateCalendarEvent(_5, _8)
  650. }
  651. this.$1244 = false;
  652. return isc.EH.STOP_BUBBLING
  653. }
  654. };
  655. isc.A.$171d = "center";
  656. isc.B.push(isc.A.mouseUp = function isc_CalendarView_mouseUp() {
  657. return isc.EH.STOP_BUBBLING
  658. }, isc.A.mouseDown = function isc_CalendarView_mouseDown() {
  659. return isc.EH.STOP_BUBBLING
  660. }, isc.A.initWidget = function isc_CalendarView_initWidget() {
  661. this.$27q = {};
  662. this.$1743 = [];
  663. this.$1725 = [];
  664. var _1 = this.calendar;
  665. var _2 = this.showHover;
  666. if (_2 == null) _2 = _1.showViewHovers;
  667. this.setShowHover(_2);
  668. this.Super("initWidget", arguments);
  669. if (this.installLocalHandlers) this.installLocalHandlers()
  670. }, isc.A.setEventData = function isc_CalendarView_setEventData(_1) {
  671. this.$1743 = _1
  672. }, isc.A.getEventData = function isc_CalendarView_getEventData() {
  673. if (!this.$1743) this.$1743 = [];
  674. return this.$1743
  675. }, isc.A.addEventData = function isc_CalendarView_addEventData(_1) {
  676. var _2 = this.getEventData();
  677. if (!_2.contains(_1)) {
  678. _2.add(_1);
  679. return true
  680. }
  681. return false
  682. }, isc.A.removeEventData = function isc_CalendarView_removeEventData(_1) {
  683. this.getEventData().remove(_1)
  684. }, isc.A.viewMouseMove = function isc_CalendarView_viewMouseMove(_1, _2, _3, _4, _5) {
  685. if (!this.showRollOver || !this.isTimelineView()) return true;
  686. if (!this.isDrawn() || !this.isVisible()) return;
  687. if (!this.body || !this.body.isDrawn() || !this.body.isVisible()) return;
  688. var _6 = isc.EH.lastEvent,
  689. _7 = this.body.containsPoint(_6.x, _6.y, true),
  690. _8 = !_7 && this.frozenBody && this.frozenBody.containsPoint(_6.x, _6.y, true);
  691. if (_8 || _7) {
  692. var _9 = _7 ? this.body : this.frozenBody;
  693. var _10 = this.$1744 = {};
  694. _10.x = _9.getOffsetX();
  695. _10.y = _9.getOffsetY();
  696. _10.rowNum = _9.getEventRow(_10.y);
  697. _10.colNum = _9.getEventColumn(_10.x);
  698. if (_7) {}
  699. if (this.showRollOver && this.body.lastOverRow != _10.rowNum && this.hasLanes()) {
  700. if (_10.rowNum < 0) this.updateLaneRollover(null);
  701. else this.updateLaneRollover(_10.rowNum)
  702. }
  703. if (this.mouseDataChanged) this.mouseDataChanged(this.$1744)
  704. }
  705. }, isc.A.viewDragMove = function isc_CalendarView_viewDragMove(_1) {
  706. this.logInfo("In viewDragMove");
  707. this.viewMouseMove()
  708. }, isc.A.getMouseData = function isc_CalendarView_getMouseData() {
  709. return this.$1744
  710. }, isc.A.getFieldTitle = function isc_CalendarView_getFieldTitle(_1) {
  711. var _2 = this.calendar,
  712. _3 = this.Super("getFieldTitle", arguments),
  713. _4 = this.getUnderlyingField(_1);
  714. if (_4) {
  715. var _5 = _4.date,
  716. _6 = _5 ? _5.getDay() : _4.$654;
  717. if (_6 != null) {
  718. if (_2.getDateHeaderTitle) {
  719. _3 = _2.getDateHeaderTitle(_5, _6, _3, this) || _3
  720. }
  721. }
  722. }
  723. return _3
  724. }, isc.A.getMinimumSnapGapTime = function isc_CalendarView_getMinimumSnapGapTime(_1) {
  725. var _2 = this.$27q,
  726. _3 = _2.minimumSnapGapMillis;
  727. if (!_3) {
  728. var _4 = [1, 5, 10, 15, 20, 30, 60, 120, 180, 240, 360, 480, 720, 1440];
  729. var _5 = isc.DateUtil.convertPeriodUnit(_2.millisPerPixel, "ms", "mn");
  730. for (var i = 0; i < _4.length; i++) {
  731. if (_5 <= _4[i]) {
  732. _5 = _4[i];
  733. break
  734. }
  735. }
  736. _3 = isc.DateUtil.convertPeriodUnit(_5, "mn", "ms")
  737. }
  738. if (!_1) _1 = "mn";
  739. return Math.floor(isc.DateUtil.convertPeriodUnit(_3, "ms", _1))
  740. }, isc.A.getTimePerCell = function isc_CalendarView_getTimePerCell(_1) {
  741. var _2 = this.calendar,
  742. _3 = this.$27q,
  743. _4 = _3.millisPerCell;
  744. if (!_4) {
  745. _4 = isc.DateUtil.convertPeriodUnit(_2.minutesPerRow, "mn", "ms")
  746. }
  747. if (!_1) _1 = "mn";
  748. return Math.floor(isc.DateUtil.convertPeriodUnit(_4, "ms", _1))
  749. }, isc.A.getTimePerSnapGap = function isc_CalendarView_getTimePerSnapGap(_1) {
  750. var _2 = this.calendar,
  751. _3 = this.$27q,
  752. _4 = _3.millisPerSnapGap;
  753. if (!_4) {
  754. if (_3.calendarEventSnapGap == null) {
  755. _4 = this.getTimePerCell("ms")
  756. } else if (_3.calendarEventSnapGap == 0) {
  757. _4 = this.getMinimumSnapGapTime("ms")
  758. } else {
  759. _4 = isc.DateUtil.convertPeriodUnit(_3.calendarEventSnapGap, "mn", "ms")
  760. }
  761. _3.millisPerSnapGap = _4
  762. }
  763. if (!_1) _1 = "mn";
  764. return isc.DateUtil.convertPeriodUnit(_4, "ms", _1)
  765. }, isc.A.getTimePerPixel = function isc_CalendarView_getTimePerPixel(_1) {
  766. var _2 = this.calendar,
  767. _3 = this.$27q;
  768. var _4 = Math.floor(this.getTimePerCell("ms") / this.getRowHeight(this.getRecord(0), 0));
  769. if (!_1) _1 = "mn";
  770. return isc.DateUtil.convertPeriodUnit(_4, "ms", _1)
  771. }, isc.A.getSnapGapPixels = function isc_CalendarView_getSnapGapPixels(_1, _2) {
  772. var _3 = this.getTimePerCell() / this.getTimePerSnapGap();
  773. return this.getRowHeight(this.getRecord(_1), _1) / _3
  774. }, isc.A.getDateLabelText = function isc_CalendarView_getDateLabelText(_1, _2) {
  775. return null
  776. }, isc.A.setShowHover = function isc_CalendarView_setShowHover(_1) {
  777. if (this.showViewHovers == false) return;
  778. this.showHover = _1;
  779. this.canHover = _1
  780. }, isc.A.shouldShowEventHovers = function isc_CalendarView_shouldShowEventHovers() {
  781. if (this.showHover == false || this.calendar.showViewHovers == false) return false;
  782. if (this.showEventHovers != null) return this.showEventHovers;
  783. return this.calendar.showEventHovers
  784. }, isc.A.shouldShowHeaderHovers = function isc_CalendarView_shouldShowHeaderHovers() {
  785. if (this.showHover == false || this.calendar.showViewHovers == false) return false;
  786. if (this.showHeaderHovers != null) return this.showHeaderHovers;
  787. return this.calendar.showHeaderHovers
  788. }, isc.A.shouldShowLaneFieldHovers = function isc_CalendarView_shouldShowLaneFieldHovers() {
  789. if (this.showHover == false) return false;
  790. if (this.showLaneFieldHovers != null) return this.showLaneFieldHovers;
  791. return this.calendar.showLaneFieldHovers
  792. }, isc.A.shouldShowCellHovers = function isc_CalendarView_shouldShowCellHovers() {
  793. if (this.showHover == false) return false;
  794. if (this.showCellHovers != null) return this.showCellHovers;
  795. return this.calendar.showCellHovers
  796. }, isc.A.shouldShowDragHovers = function isc_CalendarView_shouldShowDragHovers() {
  797. if (this.showHover == false) return false;
  798. if (this.showDragHovers != null) return this.showDragHovers;
  799. return this.calendar.showDragHovers
  800. }, isc.A.shouldShowZoneHovers = function isc_CalendarView_shouldShowZoneHovers() {
  801. if (this.shouldShowCellHovers()) return false;
  802. if (this.showZoneHovers != null) return this.showZoneHovers;
  803. return this.calendar.showZoneHovers
  804. }, isc.A.isSelectedView = function isc_CalendarView_isSelectedView() {
  805. return this.calendar.getCurrentViewName() == this.viewName
  806. }, isc.A.isTimelineView = function isc_CalendarView_isTimelineView() {
  807. return this.viewName == "timeline"
  808. }, isc.A.isDayView = function isc_CalendarView_isDayView() {
  809. return this.viewName == "day"
  810. }, isc.A.isWeekView = function isc_CalendarView_isWeekView() {
  811. return this.viewName == "week"
  812. }, isc.A.isMonthView = function isc_CalendarView_isMonthView() {
  813. return this.viewName == "month"
  814. }, isc.A.updateLaneRollover = function isc_CalendarView_updateLaneRollover(_1) {
  815. if (!this.isTimelineView()) return;
  816. this.clearLastHilite();
  817. if (_1 == null) return;
  818. this.body.lastOverRow = _1;
  819. this.body.updateRollOver(_1)
  820. }, isc.A.rebuild = function isc_CalendarView_rebuild(_1) {
  821. if (_1 == null) _1 = true;
  822. if (this.$152e) this.$152e(_1);
  823. else if (this.rebuildFields) this.rebuildFields();
  824. else this.refreshEvents()
  825. }, isc.A.initCacheValues = function isc_CalendarView_initCacheValues() {
  826. var _1 = this.calendar;
  827. this.$27q = {
  828. firstDayOfWeek: this.firstDayOfWeek,
  829. rangeStartDate: _1.getPeriodStartDate(this),
  830. rangeEndDate: _1.getPeriodEndDate(this),
  831. calendarEventSnapGap: _1.eventSnapGap
  832. };
  833. this.$27q.rangeStartMillis = this.$27q.rangeStartDate.getTime();
  834. this.$27q.rangeEndMillis = this.$27q.rangeEndDate.getTime();
  835. this.updateSnapProperties();
  836. return this.$27q
  837. }, isc.A.updateSnapProperties = function isc_CalendarView_updateSnapProperties() {
  838. delete this.$27q.millisPerCell;
  839. delete this.$27q.millisPerSnapGap;
  840. delete this.$27q.millisPerPixel;
  841. delete this.$27q.snapGapPixels;
  842. this.$27q.millisPerCell = this.getTimePerCell("ms");
  843. this.$27q.millisPerPixel = this.getTimePerPixel("ms");
  844. this.$27q.minimumSnapGapMillis = this.getMinimumSnapGapTime("ms");
  845. this.$27q.millisPerSnapGap = this.getTimePerSnapGap("ms")
  846. }, isc.A.getLaneIndex = function isc_CalendarView_getLaneIndex(_1) {
  847. return null
  848. }, isc.A.getLane = function isc_CalendarView_getLane(_1) {
  849. return null
  850. }, isc.A.getLaneFromPoint = function isc_CalendarView_getLaneFromPoint(_1, _2) {
  851. return null
  852. }, isc.A.getSublane = function isc_CalendarView_getSublane(_1, _2) {
  853. if (!this.hasSublanes()) return null;
  854. var _3 = this.getLane(_1),
  855. _4 = _3 && _3.sublanes ? isc.isAn.Object(_2) ? _2 : _3.sublanes.find(this.calendar.laneNameField, _2) : null;
  856. return _4
  857. }, isc.A.getSublaneFromPoint = function isc_CalendarView_getSublaneFromPoint(_1, _2) {
  858. return null
  859. }, isc.A.hasLanes = function isc_CalendarView_hasLanes() {
  860. return this.isTimelineView() || (this.isDayView() && this.calendar.showDayLanes)
  861. }, isc.A.hasSublanes = function isc_CalendarView_hasSublanes() {
  862. return this.calendar.useSublanes && this.hasLanes()
  863. }, isc.A.useLanePadding = function isc_CalendarView_useLanePadding() {
  864. if (this.isTimelineView()) return true;
  865. if (this.hasLanes()) {
  866. return this.calendar.eventOverlap ? false : true
  867. }
  868. return false
  869. }, isc.A.getCellCSSText = function isc_CalendarView_getCellCSSText(_1, _2, _3) {
  870. var _4 = this.calendar.$116j(this, _1, _2, _3);
  871. return _4
  872. }, isc.A.getEventCanvasStyle = function isc_CalendarView_getEventCanvasStyle(_1) {
  873. if (this.hasLanes()) {
  874. var _2 = this.calendar,
  875. _3 = _2.laneNameField,
  876. _4 = _2.sublaneNameField,
  877. _5 = _2.eventStyleNameField,
  878. _6 = this.getLane(_1[_3]),
  879. _7 = _6 && _2.useSublanes ? this.getSublane(_6[_3], _1[_4]) : null;
  880. return (_7 && _7.eventStyleName) || (_6 && _6.eventStyleName) || this.eventStyleName
  881. }
  882. return this.eventStyleName
  883. }, isc.A.getDateFromPoint = function isc_CalendarView_getDateFromPoint() {
  884. return this.getCellDate()
  885. }, isc.A.mouseMove = function isc_CalendarView_mouseMove() {
  886. var _1 = this.calendar,
  887. _2 = this.$131h,
  888. _3 = isc.EH.lastEvent.target,
  889. _4 = (_3 != this.body ? this.frozenBody && this.frozenBody.lastMouseOverRow : this.body && this.body.lastMouseOverRow),
  890. _5 = (_3 != this.body ? this.frozenBody && this.frozenBody.lastMouseOverCol : (this.body && this.body.lastMouseOverCol) + (this.frozenFields ? this.frozenFields.length : 0)),
  891. _6 = this.getDateFromPoint();
  892. this.$140b = _3;
  893. _1.$140c(this, _3, _6 ? _6.duplicate() : null, _2, _4, _5);
  894. this.$131h = _6;
  895. if (this.$53r) {
  896. if (this.isTimelineView()) this.cellOver()
  897. }
  898. return true
  899. });
  900. isc.evalBoundary;
  901. isc.B.push(isc.A.getHoverHTML = function isc_CalendarView_getHoverHTML() {
  902. var _1 = this.getEventRow(),
  903. _2 = this.getEventColumn(),
  904. _3 = this.getRecord(_1);
  905. var _4 = this.calendar.$140d(this, _3, _1, _2);
  906. return _4
  907. }, isc.A.getPrintHTML = function isc_CalendarView_getPrintHTML(_1, _2) {
  908. if (this.isMonthView()) return this.Super("getPrintHTML", arguments);
  909. if (_2) {
  910. this.delayCall("asyncGetPrintHTML", [_1, _2]);
  911. return null
  912. } else {
  913. return this.asyncGetPrintHTML(_1, _2)
  914. }
  915. }, isc.A.asyncGetPrintHTML = function isc_CalendarView_asyncGetPrintHTML(_1, _2) {
  916. this.$158l = true;
  917. this.refreshVisibleEvents(null, true, "asyncGetPrintHTML");
  918. _1 = isc.addProperties({}, _1);
  919. this.body.printChildrenAbsolutelyPositioned = true;
  920. var _3 = this.calendar,
  921. _4 = this.isTimelineView(),
  922. _5 = this.isWeekView(),
  923. _6 = this.isDayView(),
  924. _7 = this.isMonthView();
  925. if (_7) return;
  926. var _8 = this.getFields(),
  927. _9 = this.getData(),
  928. _10 = isc.StringBuffer.create(),
  929. _11 = 0,
  930. _12 = [];
  931. for (var i = 0; i < _8.length; i++) {
  932. var _14 = _8[i];
  933. var _15 = this.getFieldHeaderButton(_14.masterIndex);
  934. var _16 = _15 ? _15.width || _15.getVisibleWidth() : null;
  935. if (_16 == null) _16 = this.getFieldWidth(_14);
  936. _12.add(_16)
  937. }
  938. _11 = _12.sum();
  939. var _17 = "<TR",
  940. _18 = "</TR>",
  941. _19 = ">",
  942. _20 = " HEIGHT=",
  943. _21 = " VALIGN=";
  944. var _22 = 40;
  945. _10.append("<div style='position:relative;'>");
  946. _10.append("<TABLE cellpadding='0' cellspacing='0' WIDTH=", _11, " style='", "border: 1px solid grey;'>");
  947. _10.append("<THEAD>");
  948. if (this.showHeader) {
  949. _10.append(this.getPrintHeaders(0, this.fields.length, _12))
  950. }
  951. _10.append("</THEAD>");
  952. _22 += this.getHeaderHeight();
  953. _10.append("<TBODY>");
  954. for (var i = 0; i < _9.length; i++) {
  955. var _23 = this.getRowHeight(_9[i], i);
  956. _10.append(_17, _20, _23, _19);
  957. for (var j = 0; j < _8.length; j++) {
  958. var _25 = this.getCellValue(_9[i], i, j);
  959. _10.append("<TD class='", this.getCellStyle(_9[i], i, j), "' ", "style='width:", _12[j] - 1, "px; min-width:", _12[j] - 1 + "px;", "border-width: 0px 1px 1px 0px; ", "border-bottom: 1px solid #ABABAB; border-right: 1px solid #ABABAB; ", "border-top: none; border-left: none;", this.getCellCSSText(_9[i], i, j), "'>");
  960. _10.append(this.getCellValue(_9[i], i, j) || "&nbsp;");
  961. _10.append("</TD>")
  962. }
  963. _10.append(_18)
  964. }
  965. _10.append("</TBODY>");
  966. _10.append("</TABLE>");
  967. var _26 = this.body.children;
  968. for (var i = 0, _27 = _26.length; i < _27; i++) {
  969. var _28 = _26[i],
  970. _29 = _28.isEventCanvas || _28.isZoneCanvas || _28.isIndicatorCanvas;
  971. if (!_29) continue;
  972. if (!_28.isDrawn() || !_28.isVisible()) continue;
  973. if (_28.isZoneCanvas) _1.i = 0;
  974. else if (_28.isIndicatorCanvas) _1.i = _27;
  975. else _1.i = i;
  976. var _30 = _28.getPrintHTML(_1);
  977. _10.append(_30)
  978. }
  979. _10.append("</div>");
  980. var _16 = _10.release(false);
  981. if (_2) {
  982. this.fireCallback(_2, "HTML", [_16])
  983. }
  984. delete this.$158l;
  985. return _16
  986. }, isc.A.getPrintHeaders = function isc_CalendarView_getPrintHeaders(_1, _2, _3) {
  987. var _4 = (this.isRTL() ? isc.Canvas.LEFT : isc.Canvas.RIGHT),
  988. _5 = this.headerBaseStyle,
  989. _6 = this.getHeaderHeight(),
  990. _7;
  991. if (this.headerSpans) {
  992. var _8 = [],
  993. _9 = 1;
  994. for (var i = _1; i < _2; i++) {
  995. var _11 = this.getField(i);
  996. _8[i] = [_11];
  997. var _12 = this.spanMap[_11.name];
  998. while (_12 != null) {
  999. _8[i].add(_12);
  1000. _12 = _12.parentSpan
  1001. }
  1002. _9 = Math.max(_8[i].length, _9)
  1003. }
  1004. _7 = [];
  1005. for (var i = _9 - 1; i >= 0; i--) {
  1006. _7[_7.length] = "<TR HEIGHT=23>";
  1007. var _13 = null,
  1008. _14 = null;
  1009. for (var _15 = _1; _15 < _2; _15++) {
  1010. var _16 = 1,
  1011. _17 = 1;
  1012. var _18 = (i == 0);
  1013. var _19 = _8[_15][i];
  1014. if (_19 == "spanned") {
  1015. continue
  1016. }
  1017. var _20, _21 = _15,
  1018. _22 = [];
  1019. _17 = 0;
  1020. while (_21 < _2) {
  1021. var _23 = null,
  1022. _24 = false;
  1023. for (var _25 = 0;
  1024. (i - _25) >= 0; _25++) {
  1025. _23 = _8[_21][i - _25];
  1026. if (_23 != null) {
  1027. if (_19 == null) {
  1028. _19 = _23;
  1029. _20 = _25;
  1030. if (i - _25 == 0) {
  1031. _18 = true
  1032. }
  1033. }
  1034. if (_19 == _23) {
  1035. _22[_17] = _25;
  1036. _20 = Math.min(_25, _20)
  1037. } else {
  1038. _24 = true
  1039. }
  1040. break
  1041. }
  1042. }
  1043. if (_24) {
  1044. break
  1045. }
  1046. _21++;
  1047. _17++
  1048. }
  1049. if (_20 != null) {
  1050. _16 = _20 + 1
  1051. }
  1052. for (var _26 = 0; _26 < _22.length; _26++) {
  1053. var _27 = _8[_26 + _15],
  1054. _25 = _22[_26];
  1055. for (var _28 = 0; _28 <= _25; _28++) {
  1056. if (_26 == 0 && _28 == 0) {
  1057. _27[i - _28] = _19
  1058. } else if (_28 <= _20) {
  1059. _27[i - _28] = "spanned"
  1060. } else {
  1061. _27[i - _28] = null
  1062. }
  1063. }
  1064. }
  1065. if (_19 == null) {
  1066. this.logWarn("Error in getPrintHeaders() - unable to generate print header HTML from this component's specified headerSpans")
  1067. }
  1068. var _29 = "center",
  1069. _30;
  1070. if (_18) {
  1071. _29 = _19.align || _4;
  1072. _30 = this.getHeaderButtonTitle(_19.masterIndex)
  1073. } else {
  1074. _30 = _19.title
  1075. }
  1076. var _31 = _7.length;
  1077. _7[_7.length] = "<TD class='";
  1078. _7[_7.length] = _5;
  1079. _7[_7.length] = "' align='";
  1080. _7[_7.length] = "center";
  1081. _7[_7.length] = "' rowSpan='";
  1082. _7[_7.length] = _16;
  1083. _7[_7.length] = "' colSpan='";
  1084. _7[_7.length] = _17;
  1085. _7[_7.length] = "' ";
  1086. _7[_7.length] = "style='margin: 0px; padding: 0px; width:" + _3[_19.masterIndex] + "px; height:23px; border-width: 0px 1px 1px 0px;' ";
  1087. _7[_7.length] = ">";
  1088. _7[_7.length] = _30;
  1089. _7[_7.length] = "</TD>"
  1090. }
  1091. _7[_7.length] = "</TR>"
  1092. }
  1093. } else {
  1094. _7 = ["<TR HEIGHT=23>"];
  1095. var _32 = ["<TD CLASS='", _5, "' ALIGN="].join(""),
  1096. _33 = this.frozenBody ? this.frozenBody.fields.length : 0;
  1097. if (this.frozenBody) {
  1098. for (var _34 = 0; _34 < _33; _34++) {
  1099. var _11 = this.frozenBody.fields[_34];
  1100. if (!_11) continue;
  1101. var _29 = _11.align || _4;
  1102. var _35 = _3[_34];
  1103. _7.addList([_32, _29, " style='width:" + _35 + "px; padding:0px; margin:0px;'>", this.getHeaderButtonTitle(_11.masterIndex), "</TD>"])
  1104. }
  1105. }
  1106. for (var _34 = 0; _34 < (_2 - _33); _34++) {
  1107. var _11 = this.body.fields[_34];
  1108. if (!_11) continue;
  1109. var _29 = _11.align || _4;
  1110. var _35 = _3[_34 + _33];
  1111. _7.addList([_32, _29, " style='width:" + _35 + "px;'>", this.getHeaderButtonTitle(_11.masterIndex), "</TD>"])
  1112. }
  1113. _7[_7.length] = "</TR>"
  1114. }
  1115. return _7.join(isc.emptyString)
  1116. }, isc.A.scrolled = function isc_CalendarView_scrolled() {
  1117. if (this.renderEventsOnDemand && this.refreshVisibleEvents) {
  1118. delete this.$27q.viewportStartMillis;
  1119. delete this.$27q.viewportEndMillis;
  1120. var _1 = this;
  1121. if (this.$57s) isc.Timer.clear(this.$57s);
  1122. this.$57s = isc.Timer.setTimeout(function() {
  1123. this.$57s = null;
  1124. _1.refreshVisibleEvents(null, null, "scrolled")
  1125. })
  1126. }
  1127. }, isc.A.resized = function isc_CalendarView_resized(_1, _2, _3) {
  1128. this.Super('resized', arguments);
  1129. if (this.renderEventsOnDemand && !this.$81r && this.isDrawn()) {
  1130. this.refreshVisibleEvents(null, null, "resized");
  1131. this.logInfo("Calendar " + this.viewName + " view resized - reason is '" + (_3 || "no reason") + " -- w/h is " + this.body.getVisibleWidth() + "/" + this.body.getVisibleHeight(), "calendar")
  1132. }
  1133. }, isc.A.forceDataSort = function isc_CalendarView_forceDataSort(_1, _2) {
  1134. var _3 = this.calendar,
  1135. _4 = [];
  1136. if (this.isTimelineView() || (this.isDayView() && _3.showDayLanes)) {
  1137. _4.add({
  1138. property: _3.laneNameField,
  1139. direction: "ascending"
  1140. })
  1141. }
  1142. if (_3.overlapSortSpecifiers) {
  1143. _4.addList(_3.overlapSortSpecifiers)
  1144. } else {
  1145. _4.add({
  1146. property: _3.startDateField,
  1147. direction: "ascending"
  1148. })
  1149. }
  1150. if (_2 || !_1) {
  1151. if (!_1) _1 = this.getEventData()
  1152. }
  1153. _1.setSort(_4)
  1154. }, isc.A.findEventsInRange = function isc_CalendarView_findEventsInRange(_1, _2, _3, _4) {
  1155. var _5 = this.calendar,
  1156. _6 = {},
  1157. _7 = _3 != null && (this.isTimelineView() || (this.isDayView() && _5.showDayLanes));
  1158. _6[_5.startDateField] = _1;
  1159. _6[_5.endDateField] = _2;
  1160. if (_7) _6[_5.laneNameField] = _3;
  1161. var _8 = this.findOverlappingEvents(_6, _6, [_6], _7, _4, true);
  1162. return _8
  1163. }, isc.A.findOverlappingEvents = function isc_CalendarView_findOverlappingEvents(_1, _2, _3, _4, _5, _6) {
  1164. var _7 = this.calendar,
  1165. _8 = _5 != null;
  1166. var _9 = _8 ? _5 : this.getEventData();
  1167. if (!_8) this.forceDataSort(_9, _6);
  1168. var _10 = [],
  1169. _11 = _9.getLength(),
  1170. _12 = _7.getEventStartDate(_2),
  1171. _13 = _7.getEventEndDate(_2);
  1172. var _14 = {};
  1173. var _15 = _4 ? _1[_7.laneNameField] : null,
  1174. _16 = 0;
  1175. if (_15) _16 = _9.findIndex(_7.laneNameField, _15);
  1176. if (_16 < 0) return _10;
  1177. var _17 = this.isTimelineView();
  1178. for (var i = _16; i < _11; i++) {
  1179. var _19 = _9.get(i);
  1180. if (!_19) {
  1181. isc.logWarn('findOverlappingEvents: potentially invalid index: ' + i);
  1182. break
  1183. }
  1184. if (_4 && _19[_7.laneNameField] != _15) break;
  1185. var _20 = false;
  1186. if (_3 && _3.length > 0) {
  1187. for (var j = 0; j < _3.length; j++) {
  1188. if (_7.eventsAreSame(_19, _3[j])) {
  1189. _20 = true;
  1190. break
  1191. }
  1192. }
  1193. if (_20) continue
  1194. }
  1195. if (_17) {
  1196. if (_19[_7.leadingDateField] && _19[_7.trailingDateField]) {
  1197. _14[_7.leadingDateField] = _2[_7.leadingDateField];
  1198. _14[_7.trailingDateField] = _2[_7.trailingDateField];
  1199. if (_14[_7.trailingDateField].getTime() > this.endDate.getTime()) {
  1200. _14[_7.trailingDateField].setTime(this.endDate.getTime() - 1)
  1201. }
  1202. } else {
  1203. _14[_7.startDateField] = _12;
  1204. _14[_7.endDateField] = _13;
  1205. if (_14[_7.endDateField].getTime() > this.endDate.getTime()) {
  1206. _14[_7.endDateField].setTime(this.endDate.getTime() - 1)
  1207. }
  1208. }
  1209. } else {
  1210. var _22 = isc.DateUtil.getStartOf(_13, "d").getTime(),
  1211. _23 = isc.DateUtil.getEndOf(_12, "d").getTime(),
  1212. _24 = _7.getEventStartDate(_19),
  1213. _25 = _24.getTime(),
  1214. _26 = _7.getEventEndDate(_19),
  1215. _27 = _26.getTime();
  1216. if (_25 > _23 || _27 < _22) continue;
  1217. if (_25 < _22 && _27 > _23) {
  1218. if (this.isWeekView()) continue;
  1219. _25 = _22
  1220. }
  1221. _14[_7.startDateField] = _12;
  1222. _14[_7.endDateField] = _13;
  1223. if (_14[_7.endDateField].getTime() > _23) {
  1224. _14[_7.endDateField].setTime(_23)
  1225. }
  1226. }
  1227. _14[_7.laneNameField] = _19[_7.laneNameField];
  1228. if (this.eventsOverlap(_14, _19, _4)) {
  1229. _10.add(_19)
  1230. }
  1231. }
  1232. return _10
  1233. }, isc.A.eventsOverlap = function isc_CalendarView_eventsOverlap(_1, _2, _3) {
  1234. var a = _1,
  1235. _5 = a["_" + this.viewName] || {},
  1236. b = _2,
  1237. _7 = b["_" + this.viewName] || {},
  1238. _8 = this.calendar,
  1239. _9 = _8.startDateField,
  1240. _10 = _8.endDateField;
  1241. if (_3 && a[_8.laneNameField] != b[_8.laneNameField]) return false;
  1242. if (this.isTimelineView()) {
  1243. if (a[_8.leadingDateField] && b[_8.leadingDateField]) _9 = _8.leadingDateField;
  1244. if (a[_8.trailingDateField] && b[_8.trailingDateField]) _10 = _8.trailingDateField
  1245. }
  1246. var _11 = a[_9],
  1247. _12 = a[_10] || _8.getEventEndDate(a),
  1248. _13 = _11.duplicate(),
  1249. _14 = _12.duplicate(),
  1250. _15 = b[_9],
  1251. _16 = b[_10] || _8.getEventEndDate(b),
  1252. _17 = _15.duplicate(),
  1253. _18 = _16.duplicate();
  1254. if (this.isTimelineView()) {
  1255. if (_15.getTime() > this.endDate.getTime()) return false;
  1256. if (_16.getTime() < this.startDate.getTime()) return false;
  1257. if (_17.getTime() < _14.getTime() && _18.getTime() > _13.getTime()) return true;
  1258. var _19 = Math.round(_8.getSnapGapPixels(this));
  1259. _13 = _5.snapStartLeftOffset || this.getDateLeftOffset(_11);
  1260. _14 = Math.max((_5.snapEndLeftOffset || this.getDateRightOffset(_12)), (_13 + _19));
  1261. _17 = _7.snapStartLeftOffset || this.getDateLeftOffset(_15);
  1262. _18 = Math.max((_7.snapEndLeftOffset || this.getDateRightOffset(_16)), (_17 + _19))
  1263. }
  1264. if (_8.equalDatesOverlap && _8.allowEventOverlap) {
  1265. if ((_13 < _17 && _14 >= _18 && _13 <= _18) || (_13 <= _18 && _14 > _18) || (_13 <= _17 && _14 >= _18) || (_13 >= _17 && _14 <= _18)) {
  1266. return true
  1267. } else {
  1268. return false
  1269. }
  1270. } else {
  1271. if (_17 < _14 && _18 > _13) return true;
  1272. return false
  1273. }
  1274. }, isc.A.updateEventRange = function isc_CalendarView_updateEventRange(_1, _2) {
  1275. if (!isc.isAn.Object(_2)) _2 = this.overlapRanges.ranges[_2];
  1276. var _3 = _2.events;
  1277. _3.remove(_1);
  1278. this.updateOverlapRanges(_3)
  1279. }, isc.A.updateOverlapRanges = function isc_CalendarView_updateOverlapRanges(_1) {
  1280. var _2 = this.calendar,
  1281. _3 = _1 || this.getEventData(),
  1282. _4 = this.overlapRanges || [],
  1283. _5 = _3.getLength(),
  1284. _6 = this.isTimelineView(),
  1285. _7 = _6 || (this.isDayView() && _2.showDayLanes),
  1286. _8 = !_6,
  1287. _9 = [],
  1288. _10 = this.startDate,
  1289. _11 = this.endDate;
  1290. if (isc.isA.ResultSet(_3)) {
  1291. _3 = _3.allRows
  1292. }
  1293. _3.setProperty("$122k", false);
  1294. _3.setProperty("$646", null);
  1295. _3.setProperty("$126u", null);
  1296. var _12 = _7 && _2.lanes ? isc.getKeys(_2.getLaneMap()) : [];
  1297. _3.setSort([{
  1298. property: _2.laneNameField,
  1299. direction: "ascending"
  1300. }, {
  1301. property: _2.startDateField,
  1302. direction: "ascending"
  1303. }, {
  1304. property: _2.endDateField,
  1305. direction: "descending"
  1306. }]);
  1307. for (var i = 0; i < _5; i++) {
  1308. var _14 = _3.get(i);
  1309. var _15 = {
  1310. events: [_14]
  1311. };
  1312. _15[_2.startDateField] = _2.getEventStartDate(_14);
  1313. _15[_2.endDateField] = _2.getEventEndDate(_14);
  1314. _15[_2.laneNameField] = _15.lane = _7 ? _14[_2.laneNameField] : null;
  1315. var _16 = true;
  1316. for (var j = 0; j < _4.length; j++) {
  1317. if (_15[_2.laneNameField] != _4[j][_2.laneNameField]) continue;
  1318. if (this.eventsOverlap(_15, _4[j], _7)) {
  1319. this.mergeOverlapRanges(_15, _4[j]);
  1320. _16 = false
  1321. }
  1322. if (!_16) break
  1323. }
  1324. if (_16) {
  1325. _4.add(_15);
  1326. if (!_9.contains(_15)) _9.add(_15)
  1327. }
  1328. }
  1329. for (i = 0; i < _4.length; i++) {
  1330. var _18 = _4[i];
  1331. _18.id = "range_" + i + "_lane_" + _18.lane;
  1332. _18.events.setProperty("overlapRangeId", _18.id);
  1333. if (!_6) _18.colNum = this.getColFromDate(_18[_2.startDateField], _18[_2.laneNameField])
  1334. }
  1335. this.overlapRanges = _4;
  1336. return _9
  1337. }, isc.A.getTouchedOverlapRanges = function isc_CalendarView_getTouchedOverlapRanges(_1, _2, _3) {
  1338. if (!this.overlapRanges) this.overlapRanges = [];
  1339. var _4 = true,
  1340. _5 = this.calendar,
  1341. _6 = this.overlapRanges,
  1342. r = {},
  1343. _8 = [];
  1344. r[_5.startDateField] = _1;
  1345. r[_5.endDateField] = _2;
  1346. r[_5.laneNameField] = _3;
  1347. for (var k = 0; k < _6.length; k++) {
  1348. var _10 = _6[k];
  1349. if (_3 != null && _10[_5.laneNameField] != _3) continue;
  1350. var _11 = this.eventsOverlap(r, _10, true);
  1351. if (_11) {
  1352. _8.add(_10)
  1353. }
  1354. }
  1355. return _8
  1356. }, isc.A.mergeOverlapRanges = function isc_CalendarView_mergeOverlapRanges(_1, _2) {
  1357. if (!isc.isAn.Array(_1)) _1 = [_1];
  1358. var _3 = this.calendar,
  1359. _4 = _3.startDateField,
  1360. _5 = _3.endDateField,
  1361. b = _2;
  1362. for (var i = 0; i < _1.length; i++) {
  1363. var a = _1[i];
  1364. if (a[_4] < b[_4]) b[_4] = a[_4];
  1365. if (a[_5] > b[_5]) b[_5] = a[_5];
  1366. if (a.totalSlots > b.totalSlots) b.totalSlots = a.totalSlots;
  1367. b.events.addList(a.events);
  1368. b.events = b.events.getUniqueItems()
  1369. }
  1370. }, isc.A.getEventLaneIndex = function isc_CalendarView_getEventLaneIndex(_1) {
  1371. return this.getLaneIndex(_1[this.calendar.laneNameField])
  1372. }, isc.A.getEventLane = function isc_CalendarView_getEventLane(_1) {
  1373. return this.getLane(_1[this.calendar.laneNameField])
  1374. }, isc.A.hasOverlapRanges = function isc_CalendarView_hasOverlapRanges() {
  1375. return this.overlapRanges != null && this.overlapRanges.length > 0
  1376. }, isc.A.getLaneOverlapRanges = function isc_CalendarView_getLaneOverlapRanges(_1) {
  1377. if (!this.hasOverlapRanges()) return;
  1378. var _2 = this.calendar,
  1379. _3 = [];
  1380. this.overlapRanges.map(function(_4) {
  1381. if (_4[_2.laneNameField] == _1) _3.add(_4)
  1382. });
  1383. return _3
  1384. }, isc.A.getDayOverlapRanges = function isc_CalendarView_getDayOverlapRanges(_1) {
  1385. if (!this.hasOverlapRanges()) return;
  1386. var _2 = this.getColFromDate(_1);
  1387. if (_2 >= 0) return this.getColOverlapRanges(_2)
  1388. }, isc.A.getColOverlapRanges = function isc_CalendarView_getColOverlapRanges(_1) {
  1389. if (!this.hasOverlapRanges()) return;
  1390. var _2 = this.overlapRanges.findAll("colNum", _1);
  1391. return _2
  1392. }, isc.A.removeOverlapRanges = function isc_CalendarView_removeOverlapRanges(_1) {
  1393. if (!this.hasOverlapRanges() || !_1) return;
  1394. _1.map(function(_2) {
  1395. _2.events.setProperty("overlapRangeId", null)
  1396. });
  1397. this.overlapRanges.removeList(_1)
  1398. }, isc.A.getEventOverlapRange = function isc_CalendarView_getEventOverlapRange(_1) {
  1399. if (!this.hasOverlapRanges()) return;
  1400. return this.overlapRanges.find("id", _1.overlapRangeId);
  1401. }, isc.A.getDateOverlapRange = function isc_CalendarView_getDateOverlapRange(_1, _2) {
  1402. if (!this.hasOverlapRanges()) return;
  1403. var _3 = this.calendar,
  1404. _4 = _1.getTime();
  1405. var _5 = this.overlapRanges.map(function(_6) {
  1406. if (_4 >= _6[_3.startDateField].getTime() && _4 <= _6[_3.endDateField].getTime() && (!_2 || _2 == _6[_3.laneNameField])) {
  1407. return _6
  1408. }
  1409. });
  1410. if (_5) _5.removeEmpty();
  1411. return _5 && _5.length && _5[0] ? _5[0] : null
  1412. }, isc.A.retagLaneEvents = function isc_CalendarView_retagLaneEvents(_1) {
  1413. if (!this.hasLanes()) return;
  1414. var _2 = this.getLane(_1);
  1415. if (this.isTimelineView()) {
  1416. this.retagRowEvents(_2, true)
  1417. } else {
  1418. this.retagColumnEvents(_2, true)
  1419. }
  1420. }, isc.A.retagDayEvents = function isc_CalendarView_retagDayEvents(_1) {
  1421. if (this.isTimelineView()) return;
  1422. var _2 = this.getColFromDate(_1);
  1423. this.retagColumnEvents(_2, false)
  1424. }, isc.A.retagColumnEvents = function isc_CalendarView_retagColumnEvents(_1, _2) {
  1425. if (this.isTimelineView()) return;
  1426. var _3;
  1427. if (isc.isA.Number(_1)) {
  1428. _3 = this.body.getField(_1)
  1429. } else {
  1430. _3 = _1;
  1431. _1 = this.body.getFieldNum(_3)
  1432. }
  1433. this.removeOverlapRanges(this.getColOverlapRanges(_1));
  1434. var _4 = this.getDateFromCol(_1);
  1435. if (!_4) return;
  1436. var _5 = _4,
  1437. _6 = isc.DateUtil.getEndOf(_4, "d");
  1438. var _7 = this.findEventsInRange(_5, _6, (_2 ? _3.name : null));
  1439. this.renderEvents(_7, _2)
  1440. }, isc.A.retagRowEvents = function isc_CalendarView_retagRowEvents(_1) {
  1441. if (!this.isTimelineView()) return;
  1442. var _2 = this.calendar,
  1443. _3;
  1444. if (isc.isA.Number(_1)) {
  1445. _3 = this.getRecord(_1)
  1446. } else {
  1447. _3 = _1;
  1448. _1 = this.isGrouped ? this.getGroupedRecordIndex() : this.getRecordIndex(_3)
  1449. }
  1450. var _4 = _3[_2.laneNameField];
  1451. this.removeOverlapRanges(this.getLaneOverlapRanges(_4));
  1452. var _5 = this.startDate,
  1453. _6 = this.endDate;
  1454. var _7 = this.findEventsInRange(_5, _6, _4);
  1455. this.renderEvents(_7, true)
  1456. }, isc.A.retagOverlapRange = function isc_CalendarView_retagOverlapRange(_1, _2, _3) {
  1457. var _4 = this.calendar,
  1458. _5 = this.getTouchedOverlapRanges(_1, _2, _3),
  1459. _6 = _5 ? _5[0] : null,
  1460. _7 = _1.duplicate(),
  1461. _8 = _2.duplicate();
  1462. if (_6) {
  1463. _5.removeAt(0);
  1464. this.mergeOverlapRanges(_5, _6);
  1465. _7 = _6[_4.startDateField];
  1466. _8 = _6[_4.endDateField];
  1467. this.removeOverlapRanges(_5);
  1468. this.removeOverlapRanges([_6]);
  1469. var _9 = this.findEventsInRange(_7, _8, _3, _6.events);
  1470. this.renderEvents(_9, (_3 != null))
  1471. } else {
  1472. var _9 = this.findEventsInRange(_7, _8, _3, this.getEventData());
  1473. this.renderEvents(_9, (_3 != null))
  1474. }
  1475. }, isc.A.sortForRender = function isc_CalendarView_sortForRender(_1) {
  1476. var _2 = this.calendar,
  1477. _3 = [];
  1478. if (this.isTimelineView() || (this.isDayView() && _2.showDayLanes)) {
  1479. _3.add({
  1480. property: _2.laneNameField,
  1481. direction: "ascending"
  1482. })
  1483. }
  1484. if (_2.overlapSortSpecifiers) {
  1485. _3.addList(_2.overlapSortSpecifiers)
  1486. } else {
  1487. _3.addList([{
  1488. property: "$126u",
  1489. direction: "ascending"
  1490. }, {
  1491. property: _2.startDateField,
  1492. direction: "ascending"
  1493. }])
  1494. }
  1495. _1.setSort(_3)
  1496. }, isc.A.renderEvents = function isc_CalendarView_renderEvents(_1, _2) {
  1497. if (!_1 || _1.length == 0) return;
  1498. this.tagDataForOverlap(_1, _2);
  1499. this.sortForRender(_1);
  1500. var _3 = this.calendar,
  1501. _4 = this.isTimelineView(),
  1502. _5 = _2 ? (_4 ? this.body.getVisibleRows() : this.body.getVisibleColumns()) : [],
  1503. _6 = this;
  1504. for (var i = 0; i < _1.length; i++) {
  1505. var _8 = _1.get(i),
  1506. _9 = _8.$646,
  1507. _10 = _2 ? _6.getLaneIndex(_8[_3.laneNameField]) : null;
  1508. if (!_2 || (_10 >= _5[0] && _10 <= _5[1])) {
  1509. var _11 = this.getCurrentEventCanvas(_8);
  1510. if (_11) {
  1511. if (_11.setEvent) _11.setEvent(_8);
  1512. else _11.event = _8;
  1513. _6.sizeEventCanvas(_11, false)
  1514. } else {
  1515. this.addEvent(_8)
  1516. }
  1517. }
  1518. }
  1519. }, isc.A.sizeEventCanvas = function isc_CalendarView_sizeEventCanvas(_1, _2) {
  1520. if (!_1 || !_1.event || Array.isLoading(_1.event)) return;
  1521. var _3 = this.calendar;
  1522. if (_3 == null) return;
  1523. var _4 = _1.event,
  1524. _5 = this.isTimelineView(),
  1525. _6 = this.isWeekView(),
  1526. _7 = this.hasLanes(),
  1527. _8 = _3.getEventStartDate(_4),
  1528. _9 = _3.getEventEndDate(_4);
  1529. if (_2) _1.hide();
  1530. var _10, _11, _12, _13, _14 = _7 ? this.getLaneIndex(_4[_3.laneNameField]) : null,
  1531. _15 = _7 ? this.getLane(_4[_3.laneNameField]) : null,
  1532. _16 = _3.getLanePadding(this);;
  1533. if (_5) {
  1534. if (!_15) return;
  1535. _13 = this.getLaneHeight(_15);
  1536. _12 = Math.round(this.$732(_4));
  1537. var _17 = Math.round(_3.getSnapGapPixels(this));
  1538. if (_3.isDurationEvent(_4) && _3.getEventDuration(_4) == 0) {
  1539. _17 = _3.zeroLengthEventSize + (_16 * 2)
  1540. }
  1541. _12 = Math.max(_12, _17);
  1542. _11 = this.getDateLeftOffset(_8);
  1543. _10 = this.getRowTop(_14);
  1544. if (_16 > 0) {
  1545. _10 += _16;
  1546. _11 += _16;
  1547. _12 -= (_16 * 2);
  1548. _13 -= (_16 * 2);
  1549. if (_17 > (_16 * 2)) _17 -= (_16 * 2)
  1550. }
  1551. if (_3.eventsOverlapGridLines) {
  1552. _11 -= 1;
  1553. _12 += 1;
  1554. _10 -= 1;
  1555. _13 += 1
  1556. }
  1557. if (this.eventDragGap > 0) {
  1558. _12 = Math.max(this.eventDragGap, _12 - this.eventDragGap)
  1559. }
  1560. _12 = Math.max(_12, _17)
  1561. } else {
  1562. if (_1.$172y) {
  1563. delete _1.$172y.$184b;
  1564. delete _1.$172y.$963
  1565. }
  1566. var _18;
  1567. if (this.isDayView()) {
  1568. if (_3.showDayLanes) _18 = _14;
  1569. else _18 = 0
  1570. } else {
  1571. _18 = this.getColFromDate(_8)
  1572. }
  1573. _11 = this.body.getColumnLeft(_18);
  1574. _12 = this.body.getColumnWidth(_18);
  1575. var _19 = this.body.getRowHeight(this.getRecord(1), 1),
  1576. _20 = _9.getHours() == 0 && _9.getDate() != _8.getDate() ? 24 : _9.getHours(),
  1577. _21 = false,
  1578. _22 = this.getTimePerCell(),
  1579. _23 = _3.getRowsPerHour(this);
  1580. if (_9.getDate() > _8.getDate()) {
  1581. _21 = true;
  1582. _20 = 24
  1583. }
  1584. _10 = this.getRowTop(_8.getHours() * _23);
  1585. _13 = (_20 - _8.getHours()) * (_19 * _23);
  1586. _13 -= 1;
  1587. if (_3.showDayLanes) {
  1588. if (_16 > 0) {
  1589. _10 += _16;
  1590. _11 += _16;
  1591. _12 -= (_16 * 2);
  1592. _13 -= (_16 * 2)
  1593. }
  1594. }
  1595. var _24 = _8.getMinutes();
  1596. if (_24 > 0) {
  1597. var _25 = _3.getMinutePixels(_24, _19, this);
  1598. _13 -= _25;
  1599. _10 += _25
  1600. }
  1601. if (_9.getMinutes() > 0 && !_21) {
  1602. _13 += _3.getMinutePixels(_9.getMinutes(), _19, this)
  1603. }
  1604. if (_3.eventsOverlapGridLines) {
  1605. _11 -= 1;
  1606. _12 += 1;
  1607. _10 -= 1;
  1608. _13 += 1
  1609. }
  1610. }
  1611. if (_3.useSublanes && _15 && _15.sublanes) {
  1612. this.sizeEventCanvasToSublane(_1, _15, _11, _10, _12, _13)
  1613. } else {
  1614. this.adjustDimensionsForOverlap(_1, _11, _10, _12, _13)
  1615. }
  1616. if (_1.setDescriptionText) {
  1617. if (_3.showEventDescriptions != false) {
  1618. _1.setDescriptionText(_4[_3.descriptionField])
  1619. } else {
  1620. _1.setDescriptionText(_4[_3.nameField])
  1621. }
  1622. } else {
  1623. _1.markForRedraw()
  1624. }
  1625. if (_5 && _4 != null) {
  1626. if (_4[_3.leadingDateField] && _4[_3.trailingDateField]) {
  1627. if (_1.$645) this.addLeadingAndTrailingLines(_1);
  1628. else this.delayCall("addLeadingAndTrailingLines", [_1])
  1629. }
  1630. }
  1631. }, isc.A.adjustDimensionsForOverlap = function isc_CalendarView_adjustDimensionsForOverlap(_1, _2, _3, _4, _5) {
  1632. var _6 = this.calendar,
  1633. _7 = _1.event.$646,
  1634. _8 = this.isTimelineView(),
  1635. _9 = this.useLanePadding(),
  1636. _10 = _9 ? _6.getLanePadding(this) : 0,
  1637. _11 = _9 ? Math.floor(_10 / 2) : 0,
  1638. _12 = _9 && _7 ? (_7.totalSlots - 1) * _10 : 0;
  1639. if (_7.slotNum == null) {
  1640. _7.slotNum = 1
  1641. }
  1642. if (_7 && _7.totalSlots > 0) {
  1643. var _13;
  1644. if (_8) {
  1645. _13 = Math.floor((_5 - _12) / _7.totalSlots);
  1646. _5 = _13;
  1647. if (_7.slotCount) {
  1648. _5 *= _7.slotCount;
  1649. _5 += (_7.slotCount - 1) * _10
  1650. }
  1651. if (_7.totalSlots != 1) {
  1652. if (_7.slotNum == _7.totalSlots) _5 -= _11
  1653. }
  1654. _3 = _3 + Math.floor((_13 * (_7.slotNum - 1)));
  1655. if (_7.slotNum > 1) _3 += (_10 * (_7.slotNum - 1))
  1656. } else {
  1657. _13 = Math.floor((_4 - _12) / _7.totalSlots);
  1658. _4 = _13;
  1659. if (_7.slotCount) {
  1660. _4 *= _7.slotCount;
  1661. _4 += (_7.slotCount - 1) * _10
  1662. }
  1663. if (_7.totalSlots != 1) {
  1664. if (_7.slotNum == _7.totalSlots) _4 -= _11
  1665. }
  1666. _2 = _2 + Math.floor((_13 * (_7.slotNum - 1)));
  1667. if (!_6.eventOverlap && _7.slotNum > 1) _2 += (_10 * (_7.slotNum - 1));
  1668. if (_6.eventOverlap && _7.$64m != false) {
  1669. if (_7.slotNum > 1) {
  1670. _2 -= Math.floor(_13 * (_6.eventOverlapPercent / 100));
  1671. _4 += Math.floor(_13 * (_6.eventOverlapPercent / 100))
  1672. }
  1673. }
  1674. var _14 = !_7 ? true : (_7.slotNum == _7.totalSlots || (_7.slotNum + _7.slotCount) - 1 == _7.totalSlots);
  1675. if (_14) {
  1676. _4 -= _6.eventDragGap || 1
  1677. }
  1678. }
  1679. } else {
  1680. if (_8) {} else {
  1681. _4 -= _6.eventDragGap || 1
  1682. }
  1683. }
  1684. if (_6.eventsOverlapGridLines) {
  1685. if (_8) {
  1686. if (_7 && _7.totalSlots > 1) _5 += 1
  1687. } else {
  1688. _5 += 1;
  1689. if (_7 && _7.slotNum > 0 && !_6.eventOverlap) {
  1690. _4 += 1
  1691. }
  1692. }
  1693. }
  1694. _1.renderEvent(_3, _2, _4, _5)
  1695. }, isc.A.sizeEventCanvasToSublane = function isc_CalendarView_sizeEventCanvasToSublane(_1, _2, _3, _4, _5, _6) {
  1696. var _7 = this.calendar,
  1697. _8 = _1.event,
  1698. _9 = _2.sublanes,
  1699. _10 = _9.findIndex("name", _8[this.calendar.sublaneNameField]),
  1700. _11 = this.isTimelineView(),
  1701. _12 = _9.length,
  1702. _13 = _7.getLanePadding(this),
  1703. _14 = 0;
  1704. if (_10 < 0) return;
  1705. for (var i = 0; i <= _10; i++) {
  1706. if (i == _10) {
  1707. if (_11) {
  1708. _4 += _14;
  1709. _6 = _9[i].height - _13
  1710. } else {
  1711. _3 += _14;
  1712. _5 = _9[i].width - _13;
  1713. if (_3 + _5 + 1 < this.body.getScrollWidth()) _5 += 1;
  1714. if (_4 + _6 + 1 < this.body.getScrollHeight()) _6 += 1
  1715. }
  1716. break
  1717. }
  1718. if (_11) _14 += _9[i].height;
  1719. else _14 += _9[i].width
  1720. }
  1721. if (_10 > 0 && _13 > 0) {
  1722. if (_11) _6 -= Math.floor(_13 / _9.length);
  1723. else _5 -= Math.floor(_13 / _9.length)
  1724. }
  1725. _1.renderEvent(_4, _3, _5, _6)
  1726. }, isc.A.getOverlapSlot = function isc_CalendarView_getOverlapSlot(_1, _2) {
  1727. var _3 = {
  1728. slotNum: _1,
  1729. events: [],
  1730. snapGaps: []
  1731. };
  1732. for (var i = 0; i < _2; i++) _3.snapGaps[i] = 0;
  1733. return _3
  1734. }, isc.A.getSnapData = function isc_CalendarView_getSnapData(_1, _2, _3, _4, _5, _6) {
  1735. var _7 = this.calendar,
  1736. _8 = this.getTimePerSnapGap("mn"),
  1737. _9 = this.getSnapGapPixels(0),
  1738. _10 = {};
  1739. if (_3 != null) {
  1740. var d = (isc.isA.Date(_3) ? _3.duplicate() : new Date(_3));
  1741. if (!_6) d.setTime(d.getTime() + 1);
  1742. _10.startY = this.getDateTopOffset(d, _5);
  1743. var _12 = isc.DateUtil.dateAdd(d.duplicate(), "mn", _8);
  1744. if (d.getDate() == _12.getDate()) {
  1745. _10.endY = this.getDateTopOffset(d, _5)
  1746. } else {
  1747. _10.endY = this.body.getScrollHeight()
  1748. }
  1749. _10.index = Math.floor(_10.startY / _9);
  1750. _10[_7.startDateField] = this.getDateFromPoint(null, _10.startY);
  1751. _10[_7.endDateField] = this.getDateFromPoint(null, _10.endY)
  1752. }
  1753. return _10
  1754. }, isc.A.tagDataForOverlap = function isc_CalendarView_tagDataForOverlap(_1, _2) {
  1755. _1 = _1 || this.getEventData();
  1756. if (_1.getLength() == 0) return;
  1757. var _3 = this.calendar,
  1758. _4 = [],
  1759. _5 = 0,
  1760. _6 = 0,
  1761. _7 = 0,
  1762. _8 = this.isTimelineView();
  1763. if (_3.eventAutoArrange == false) return;
  1764. this.forceDataSort(_1);
  1765. var _9 = _1.get(0),
  1766. _10 = _9[_3.laneNameField];
  1767. var _11 = [];
  1768. _1.setProperty("$646", null);
  1769. _1.setProperty("$126u", null);
  1770. var _12 = this.isTimelineView() || (this.isDayView() && _3.showDayLanes);
  1771. var _13 = this.updateOverlapRanges(_1);
  1772. var _14 = [];
  1773. if (_12) {
  1774. _14.add({
  1775. property: _3.laneNameField,
  1776. direction: "ascending"
  1777. })
  1778. }
  1779. if (_3.overlapSortSpecifiers) {
  1780. _14.addList(_3.overlapSortSpecifiers)
  1781. } else {
  1782. _14.add({
  1783. property: "eventLength",
  1784. direction: "descending"
  1785. });
  1786. _14.add({
  1787. property: _3.startDateField,
  1788. direction: "ascending"
  1789. });
  1790. _14.add({
  1791. property: _3.endDateField,
  1792. direction: "ascending"
  1793. })
  1794. }
  1795. var _15 = false;
  1796. if (_15) {
  1797. this.logWarn("tagDataForOverlap: about to loop over " + _13.length + " overlap ranges")
  1798. }
  1799. for (var j = 0; j < _13.length; j++) {
  1800. var _17 = _13[j];
  1801. if (_15) {
  1802. this.logWarn("range: " + isc.echoFull(_17) + "")
  1803. }
  1804. var _18 = this.getSnapData(null, null, _17[_3.startDateField], null, _17[_3.laneNameField]),
  1805. _19 = _18 ? _18.index : 0,
  1806. _20 = this.getSnapData(null, null, _17[_3.endDateField], null, _17[_3.laneNameField], true),
  1807. _21 = _20 ? _20.index : this.$1725.length - 1,
  1808. _22 = (_21 - _19) + 1,
  1809. _23 = [],
  1810. _24 = 1;
  1811. _23[0] = this.getOverlapSlot(0, _22);
  1812. var _25 = _17.events;
  1813. _25.setSort(_14);
  1814. for (var _26 = 0; _26 < _25.length; _26++) {
  1815. var _27 = _25[_26];
  1816. _27.$646 = {};
  1817. var _28 = _27.$646;
  1818. var _29 = _3.getEventStartDate(_27),
  1819. _30 = _3.getEventEndDate(_27);
  1820. _28.eventStartSnap = this.getSnapData(null, null, _29.getTime() + 1, null, _27[_3.laneNameField]);
  1821. _28.eventEndSnap = this.getSnapData(null, null, _30.getTime() - 1, null, _27[_3.laneNameField]);
  1822. var _31 = (_28.eventStartSnap ? _28.eventStartSnap.index : _28.nextValidSnap.index) - _19;
  1823. var _32 = (_28.eventEndSnap ? _28.eventEndSnap.index : _28.lastValidSnap.index) - _19;
  1824. var _33 = false;
  1825. var _34 = null;
  1826. for (var _35 = 0; _35 < _24; _35++) {
  1827. var _36 = _23[_35].snapGaps.slice(_31, _32 + 1);
  1828. var _37 = _36.sum() > 0;
  1829. if (!_37) {
  1830. _33 = true;
  1831. _23[_35].snapGaps.fill(1, _31, _32 + 1);
  1832. _23[_35].events.add(_27);
  1833. _27.$646.slotNum = _35
  1834. if (_15) {
  1835. this.logWarn("event " + _27.name + " occupying slot " + _35)
  1836. }
  1837. break
  1838. }
  1839. }
  1840. if (!_33) {
  1841. _23[_24] = this.getOverlapSlot(_24, _22);
  1842. _23[_24].snapGaps.fill(1, _31, _32 + 1);
  1843. _23[_24].events.add(_27);
  1844. _27.$646.slotNum = _24
  1845. if (_15) {
  1846. this.logWarn("event " + _27.name + " added to new slot index " + _24)
  1847. }
  1848. _24++
  1849. }
  1850. }
  1851. for (var i = 0; i < _23.length; i++) {
  1852. var _34 = _23[i];
  1853. for (var _39 = 0; _39 < _34.events.length; _39++) {
  1854. var _27 = _34.events[_39];
  1855. var _28 = _27.$646;
  1856. _28.totalSlots = _24;
  1857. var _31 = (_28.eventStartSnap ? _28.eventStartSnap.index : _19) - _19;
  1858. var _32 = (_28.eventEndSnap ? _28.eventEndSnap.index : _19) - _19;
  1859. var _33 = false;
  1860. for (var _40 = i + 1; _40 < _23.length; _40++) {
  1861. var _36 = _23[_40].snapGaps.slice(_31, _32 + 1);
  1862. var _37 = _36.sum() > 0;
  1863. if (_37) {
  1864. _28.slotCount = _40 - _28.slotNum;
  1865. _33 = true;
  1866. break
  1867. }
  1868. }
  1869. if (!_33) {
  1870. _28.slotCount = _24 - _28.slotNum
  1871. }
  1872. _28.slotNum++;
  1873. _27.$126u = _28.slotNum
  1874. }
  1875. }
  1876. _17.slotList = _23;
  1877. if (_15) {
  1878. this.logWarn("***** slotList *****\n" + isc.echoFull(_23))
  1879. }
  1880. }
  1881. }, isc.A.getVisibleDateRange = function isc_CalendarView_getVisibleDateRange(_1) {
  1882. var _2 = this.calendar;
  1883. if (_1) {
  1884. return [_2.getVisibleStartDate(this), _2.getVisibleEndDate(this)]
  1885. } else if (this.$27q.viewportStartMillis) {
  1886. return [new Date(this.$27q.viewportStartMillis), new Date(this.$27q.viewportEndMillis)]
  1887. }
  1888. if (!this.renderEventsOnDemand) {
  1889. if (this.isTimelineView()) {
  1890. return [this.startDate.duplicate(), this.endDate.duplicate()]
  1891. } else if (this.isWeekView()) {
  1892. return [_2.chosenWeekStart, _2.chosenWeekEnd]
  1893. } else if (this.isDayView()) {
  1894. return [_2.chosenDateStart, _2.chosenDateEnd]
  1895. } else if (this.isMonthView()) {
  1896. return [isc.DateUtil.getStartOf(_2.chosenDate, "M"), isc.DateUtil.getEndOf(_2.chosenDate, "M")]
  1897. }
  1898. }
  1899. if (this.isTimelineView()) {}
  1900. var _3 = this.body.getScrollLeft(),
  1901. _4 = _3 + this.body.getVisibleWidth(),
  1902. _5 = this.body.getEventColumn(_3 + 1),
  1903. _6 = this.body.getEventColumn(_4),
  1904. _7 = this.body.getScrollTop(),
  1905. _8 = _7 + this.body.getVisibleHeight(),
  1906. _9 = this.body.getEventRow(_7 + 1),
  1907. _10 = this.body.getEventRow(_8);
  1908. if (_10 < 0 || isNaN(_10)) _10 = this.data.getLength() - 1;
  1909. if (_6 < 0 || isNaN(_6)) {
  1910. if (this.isTimelineView()) {
  1911. _6 = this.$116z
  1912. } else {
  1913. _6 = this.body.fields.length - 1
  1914. }
  1915. }
  1916. _6 = Math.min(_6, this.body.fields.length - 1);
  1917. _10 = Math.min(_10, this.data.length - 1);
  1918. var _11 = this.getCellDate(_9, _5) || this.startDate,
  1919. _12 = (this.getCellEndDate ? this.getCellEndDate(_10, _6) : this.getCellDate(_10, _6)) || this.endDate;
  1920. this.$27q.viewportStartMillis = _11.getTime();
  1921. this.$27q.viewportEndMillis = _12.getTime();
  1922. return [_11, _12]
  1923. });
  1924. isc.evalBoundary;
  1925. isc.B.push(isc.A.getVisibleRowRange = function isc_CalendarView_getVisibleRowRange() {
  1926. if (!this.renderEventsOnDemand) {
  1927. return [0, this.data.getLength()]
  1928. }
  1929. return this.getVisibleRows()
  1930. }, isc.A.getVisibleColumnRange = function isc_CalendarView_getVisibleColumnRange() {
  1931. if (!this.renderEventsOnDemand) {
  1932. return [0, this.fields.getLength()]
  1933. }
  1934. return this.body.getVisibleColumns()
  1935. }, isc.A.refreshVisibleEvents = function isc_CalendarView_refreshVisibleEvents(_1, _2, _3) {
  1936. if (!this.isDrawn() || !this.body || !this.body.isDrawn()) return;
  1937. if (this.hasLanes() && (!this.lanes || this.lanes.length == 0)) return;
  1938. if (!this.$128q) {
  1939. this.refreshEvents();
  1940. return
  1941. }
  1942. _1 = _1 || this.getVisibleEvents(_2);
  1943. this.sortForRender(_1);
  1944. var _4 = _1.getLength();
  1945. var _5 = this.useEventCanvasPool ? this.$128q.duplicate() : [],
  1946. _6 = [];
  1947. this.logDebug('refreshing visible events', 'calendar');
  1948. for (var i = 0; i < _4; i++) {
  1949. var _8 = _1.get(i),
  1950. _9 = this.$128q.contains(_8);
  1951. _8.$174a = 2000 + i;
  1952. if (_9) {
  1953. _5.remove(_8);
  1954. if (this.isGrouped || this.useEventCanvasPool) {
  1955. var _10 = this.getCurrentEventCanvas(_8);
  1956. this.sizeEventCanvas(_10, true)
  1957. }
  1958. continue
  1959. }
  1960. _6.add(_8)
  1961. }
  1962. if (this.isGrouped || (this.useEventCanvasPool && this.eventCanvasPoolingMode == "viewport")) {
  1963. for (var i = 0; i < _5.length; i++) {
  1964. var _10 = this.getCurrentEventCanvas(_5[i]);
  1965. if (_10) this.clearEventCanvas(_10)
  1966. }
  1967. }
  1968. if (_6.length > 0) {
  1969. var _11 = _6.length;
  1970. for (var i = 0; i < _11; i++) {
  1971. var _8 = _6[i];
  1972. if (!this.$128q.contains(_8)) this.$128q.add(_8);
  1973. this.addEvent(_8, false)
  1974. }
  1975. }
  1976. if (!this.$158l) {
  1977. this.drawZones();
  1978. this.drawIndicators()
  1979. }
  1980. var _12 = this.calendar;
  1981. if (_12.eventsRendered && isc.isA.Function(_12.eventsRendered))
  1982. _12.eventsRendered()
  1983. }, isc.A.getVisibleEvents = function isc_CalendarView_getVisibleEvents(_1) {
  1984. var _2 = this.calendar;
  1985. if (!this.renderEventsOnDemand) return this.getEventData();
  1986. var _3 = this.isTimelineView(),
  1987. _4 = _2.showDayLanes && this.isDayView(),
  1988. _5 = this.getVisibleDateRange(_1),
  1989. _6 = (_3 || _4),
  1990. _7 = _6 ? (_3 ? this.getVisibleRowRange() : this.getVisibleColumnRange()) : null;
  1991. var _8 = this.getEventData(),
  1992. _9 = _5[0].getTime(),
  1993. _10 = _5[1].getTime(),
  1994. _11 = _8.getLength(),
  1995. _12 = [],
  1996. _13 = this.isWeekView(),
  1997. _14 = this.isGrouped ? this.data.getOpenList() : null;
  1998. for (var i = 0; i < _11; i++) {
  1999. var _16 = _8.get(i);
  2000. if (!_16) {
  2001. isc.logWarn('getVisibleEvents: potentially invalid index: ' + i);
  2002. break
  2003. }
  2004. if (isc.isA.String(_16)) return [];
  2005. if (_2.shouldShowEvent(_16, this) == false) continue;
  2006. if (_2.shouldShowLane(this.getLane(_16.lane), this) == false) continue;
  2007. var _17 = _2.getEventLeadingDate(_16) || _2.getEventStartDate(_16);
  2008. if (!_17) {
  2009. if (_16.loadingMarker) {
  2010. this.logWarn(this.viewName + ".getVisibleEvents() encountered a place-holder for a loading record, rather than a valid record. Can't continue: " + isc.echoFull(this.getStackTrace()));
  2011. break
  2012. }
  2013. this.logWarn(this.viewName + ".getVisibleEvents() - event has no start-date: " + isc.echoFull(_16));
  2014. continue
  2015. }
  2016. var _18 = _2.getEventTrailingDate(_16) || _2.getEventEndDate(_16),
  2017. _19 = _18.getTime();
  2018. if (_19 <= _9) continue;
  2019. if (_17.getTime() >= _10) continue;
  2020. if (_13) {
  2021. if (_18.getDate() != _17.getDate()) {
  2022. _18 = isc.DateUtil.getEndOf(_17.duplicate(), "d")
  2023. }
  2024. if (_18.getHours() < _5[0].getHours()) continue;
  2025. if (_17.getHours() > _5[1].getHours()) continue
  2026. }
  2027. var _20 = {};
  2028. if (_6) {
  2029. if (this.isGrouped) {
  2030. var _21 = _14.findIndex(_2.laneNameField, _16[_2.laneNameField]);
  2031. if (_21 < 0) continue
  2032. } else {
  2033. if (_1 != true) {
  2034. var _22 = this.getEventLaneIndex(_16);
  2035. if (_22 == null || _22 < _7[0] || _22 > _7[1])
  2036. continue
  2037. }
  2038. }
  2039. _20[_2.laneNameField] = _16[_2.laneNameField]
  2040. }
  2041. if (_3) {
  2042. if (_16[_2.leadingDateField] && _16[_2.trailingDateField]) {
  2043. _20[_2.leadingDateField] = _5[0];
  2044. _20[_2.trailingDateField] = _5[1]
  2045. } else {
  2046. _20[_2.startDateField] = _5[0];
  2047. _20[_2.endDateField] = _5[1]
  2048. }
  2049. } else {
  2050. _20[_2.startDateField] = _5[0];
  2051. _20[_2.endDateField] = _5[1]
  2052. }
  2053. if (this.eventsOverlap(_20, _16, _6)) {
  2054. _12.add(_16)
  2055. }
  2056. }
  2057. return _12
  2058. }, isc.A.clearEventCanvas = function isc_CalendarView_clearEventCanvas(_1, _2) {
  2059. if (_1) {
  2060. if (!isc.isAn.Array(_1)) _1 = [_1];
  2061. var _3 = _1.length;
  2062. while (--_3 >= 0) {
  2063. var _4 = _1[_3];
  2064. if (_4.hide) _4.hide();
  2065. if (_4.clear) _4.clear();
  2066. if (this.$129c) this.$129c.remove(_4);
  2067. if (this.$128q) this.$128q.remove(_4.event);
  2068. if (this.useEventCanvasPool && !_2) {
  2069. this.poolEventCanvas(_4)
  2070. } else {
  2071. _4.destroy();
  2072. _4 = null
  2073. }
  2074. }
  2075. }
  2076. }, isc.A.clearEvents = function isc_CalendarView_clearEvents(_1, _2) {
  2077. var _3 = this.$128h;
  2078. if (!this.body || !this.body.children || !_3) return;
  2079. if (!_1) _1 = 0;
  2080. if (_2 == null) _2 = !this.useEventCanvasPool;
  2081. var _4 = this.$129c,
  2082. _5 = _4.length;
  2083. while (--_5 >= 0) {
  2084. if (_4[_5]) {
  2085. if (_4[_5].$128k) {
  2086. this.clearEventCanvas(_4[_5], _2)
  2087. }
  2088. }
  2089. }
  2090. _4.removeEmpty()
  2091. }, isc.A.areSame = function isc_CalendarView_areSame(_1, _2) {
  2092. if (!_1 || !_2) return false;
  2093. var _3 = this.calendar;
  2094. if (_3.dataSource) {
  2095. var _4 = _3.getEventPKs(),
  2096. _5 = true;
  2097. for (var i = 0, _7 = _4.length; i < _7; i++) {
  2098. if (_1[_4[i]] != _2[_4[i]]) {
  2099. _5 = false;
  2100. break
  2101. }
  2102. }
  2103. return _5
  2104. } else {
  2105. return (_1 === _2)
  2106. }
  2107. }, isc.A.getEventCanvasConstructor = function isc_CalendarView_getEventCanvasConstructor(_1) {
  2108. return this.eventCanvasConstructor
  2109. }, isc.A.getCurrentEventCanvas = function isc_CalendarView_getCurrentEventCanvas(_1) {
  2110. var _2 = this.calendar.getEventCanvasID(this, _1);
  2111. var _3 = window[_2];
  2112. return _3
  2113. }, isc.A.poolEventCanvas = function isc_CalendarView_poolEventCanvas(_1) {
  2114. if (!this.$128h) this.$128h = [];
  2115. if (this.body) {
  2116. if (_1.event) {
  2117. this.calendar.setEventCanvasID(this, _1.event, null);
  2118. _1.event = null
  2119. }
  2120. _1.$128k = true;
  2121. if (this.$129c) this.$129c.remove(_1);
  2122. if (!this.$128h.contains(_1)) this.$128h.add(_1);
  2123. return true
  2124. } else return false
  2125. }, isc.A.getPooledEventCanvas = function isc_CalendarView_getPooledEventCanvas(_1) {
  2126. if (!this.$128h) this.$128h = [];
  2127. if (!this.body) return;
  2128. var _2 = this.$128h,
  2129. _3 = this.calendar,
  2130. _4;
  2131. if (_2.length > 0) {
  2132. var _5 = _2.findIndex("event", _1);
  2133. if (_5 < 0) _5 = _2.findIndex("$128k", true);
  2134. if (_5 < 0) return null;
  2135. _4 = _2[_5];
  2136. _4.$128k = false;
  2137. _3.setEventCanvasID(this, _1, _4.ID);
  2138. _2.remove(_4)
  2139. }
  2140. return _4
  2141. }, isc.A.addEvent = function isc_CalendarView_addEvent(_1, _2) {
  2142. if (!this.$129c) this.$129c = [];
  2143. if (!this.$128h) this.$128h = [];
  2144. this.clearSelection();
  2145. this.addEventData(_1);
  2146. var _3 = this.calendar,
  2147. _4 = _3.$129r(_1, this),
  2148. _5 = false;
  2149. if (_4.isDrawn()) _4.hide();
  2150. if (!this.$129c.contains(_4)) this.$129c.add(_4);
  2151. _4.$53i = this.isWeekView();
  2152. if (this.isDayView() && _3.showDayLanes) {
  2153. var _6 = _1[_3.laneNameField],
  2154. _7 = this.lanes.find("name", _6);
  2155. if (!_7) _5 = true
  2156. }
  2157. var _8 = _3.canEditEvent(_1);
  2158. _4.setDragProperties(_8, _8, this.eventDragTarget);
  2159. if (!_5 && this.body && this.body.isDrawn()) {
  2160. if (_2) {
  2161. if (this.body) this.body.addChild(_4, null, false);
  2162. this.retagOverlapRange(_3.getEventStartDate(_1), _3.getEventEndDate(_1), _1[_3.laneNameField])
  2163. } else {
  2164. if (this.body) this.body.addChild(_4, null, false);
  2165. this.sizeEventCanvas(_4);
  2166. _4.bringToFront()
  2167. }
  2168. }
  2169. }, isc.A.removeEvent = function isc_CalendarView_removeEvent(_1) {
  2170. var _2 = this.getCurrentEventCanvas(_1);
  2171. if (_2) {
  2172. this.clearEventCanvas(_2, !this.useEventCanvasPool);
  2173. this.removeEventData(_1);
  2174. return true
  2175. } else {
  2176. return false
  2177. }
  2178. }, isc.A.clearZones = function isc_CalendarView_clearZones() {
  2179. var _1 = (this.$131c || []),
  2180. _2 = this.body && this.body.children;
  2181. for (var i = 0; i < _1.length; i++) {
  2182. if (_1[i]) {
  2183. if (_2 && _2.contains(_1[i])) this.body.removeChild(_1[i]);
  2184. if (_1[i].destroy) _1[i].destroy();
  2185. _1[i] = null
  2186. }
  2187. }
  2188. this.$131c = []
  2189. }, isc.A.drawZones = function isc_CalendarView_drawZones() {
  2190. if (this.$131c) this.clearZones();
  2191. if (!this.calendar.showZones) return;
  2192. var _1 = this.calendar,
  2193. _2 = _1.zones || [],
  2194. _3 = this.$131c = [];
  2195. if (this.isGrouped) {
  2196. this.logInfo("Zones are not currently supported in grouped Calendar views.");
  2197. return
  2198. }
  2199. if (!_2 || _2.length <= 0) return;
  2200. var _4 = [],
  2201. _5 = this.getVisibleDateRange(),
  2202. _6 = _5[0].getTime(),
  2203. _7 = _5[1].getTime();
  2204. for (var i = 0; i < _2.length; i++) {
  2205. var _9 = _2[i];
  2206. if (_9[_1.startDateField].getTime() < _7 && _9[_1.endDateField].getTime() > _6) {
  2207. _4.add(_9)
  2208. }
  2209. _9.styleName = _1.getZoneCanvasStyle(_9, this)
  2210. }
  2211. for (var i = 0; i < _4.length; i++) {
  2212. var _9 = _4[i],
  2213. _10 = _1.getZoneCanvas(_9, this),
  2214. _11 = this.getDateLeftOffset(_9[_1.startDateField]),
  2215. _12 = this.getDateLeftOffset(_9[_1.endDateField]),
  2216. _13 = this.data.getProperty("height").sum();
  2217. this.body.addChild(_10)
  2218. _10.renderEvent(0, _11, _12 - _11, _13, true);
  2219. _3.add(_10)
  2220. }
  2221. }, isc.A.clearIndicators = function isc_CalendarView_clearIndicators() {
  2222. var _1 = (this.$131d || []),
  2223. _2 = this.body && this.body.children;
  2224. for (var i = 0; i < _1.length; i++) {
  2225. if (_1[i]) {
  2226. if (_2 && _2.contains(_1[i])) this.body.removeChild(_1[i]);
  2227. if (_1[i].destroy) _1[i].destroy();
  2228. _1[i] = null
  2229. }
  2230. }
  2231. this.$131d = []
  2232. }, isc.A.drawIndicators = function isc_CalendarView_drawIndicators() {
  2233. if (this.$131d) this.clearIndicators();
  2234. if (!this.calendar.showIndicators) return;
  2235. var _1 = this.calendar,
  2236. _2 = _1.indicators || [],
  2237. _3 = this.$131d = [];
  2238. if (this.isGrouped) {
  2239. this.logInfo("Indicators are not currently supported in grouped Calendar views.");
  2240. return
  2241. }
  2242. if (!_2 || _2.length <= 0) return;
  2243. var _4 = [],
  2244. _5 = this.getVisibleDateRange(),
  2245. _6 = _5[0].getTime(),
  2246. _7 = _5[1].getTime();
  2247. for (var i = 0; i < _2.length; i++) {
  2248. var _9 = _2[i];
  2249. delete _9.endDate;
  2250. _9.duration = 0;
  2251. _9.durationUnit = "minute";
  2252. var _10 = _1.getEventStartDate(_9).getTime();
  2253. if (_10 >= _6 && _10 < _7) {
  2254. _4.add(_9)
  2255. }
  2256. };
  2257. for (var i = 0; i < _4.length; i++) {
  2258. var _9 = _4[i],
  2259. _11 = _1.getIndicatorCanvas(_9, this),
  2260. _12 = this.getDateLeftOffset(_9[_1.startDateField]),
  2261. _13 = this.data.getProperty("height").sum();
  2262. this.body.addChild(_11)
  2263. _11.renderEvent(0, _12, _1.zeroLengthEventSize, _13, !_1.showIndicatorsInFront);
  2264. _3.add(_11)
  2265. }
  2266. }, isc.A.$1739 = function isc_CalendarView__refreshEvents() {
  2267. if (!this.isDrawn()) {
  2268. this.$128r = true;
  2269. return
  2270. }
  2271. if (this.calendar.shouldIncludeRangeCriteria(this)) {
  2272. this.$116v();
  2273. return
  2274. }
  2275. this.refreshEvents()
  2276. }, isc.A.refreshEvents = function isc_CalendarView_refreshEvents() {
  2277. if (this.$132n) return;
  2278. this.$129s = true;
  2279. if (!this.$129c) this.$129c = [];
  2280. if (!this.$128q) this.$128q = [];
  2281. var _1 = this.calendar;
  2282. if (!this.body || !_1.hasData()) return;
  2283. this.$132n = true;
  2284. this.clearZones();
  2285. this.clearIndicators();
  2286. var _2 = this.$129c;
  2287. if (_2.length > 0) {
  2288. _2.setProperty("$128k", true);
  2289. this.clearEvents(0, !this.useEventCanvasPool)
  2290. }
  2291. this.$128q = [];
  2292. this.$129c = [];
  2293. if (!this.isTimelineView()) this.initCacheValues();
  2294. var _3 = _1.getVisibleStartDate(this),
  2295. _4 = _3.getTime(),
  2296. _5 = _1.getVisibleEndDate(this),
  2297. _6 = _5.getTime();
  2298. this.overlapRanges = [];
  2299. var _7 = _1.data.getLength();
  2300. var _8 = _1.data.getRange(0, _7);
  2301. var _9 = [];
  2302. var _10 = this.hasLanes() && _1.lanes;
  2303. while (--_7 >= 0) {
  2304. var _11 = _8.get(_7);
  2305. if (!_11) continue;
  2306. if (!isc.isA.String(_11)) {
  2307. if (_1.shouldShowEvent(_11, this) == false) continue;
  2308. if (_10 && _11[_1.laneNameField] && !_10.find("name", _11[_1.laneNameField])) {
  2309. continue
  2310. }
  2311. var _12 = _1.getEventStartDate(_11);
  2312. if (!_12) {
  2313. if (_11.loadingMarker) {
  2314. this.logWarn(this.viewName + ".refreshEvents() encountered a place-holder for a loading record, rather than a valid record. Can't continue: " + isc.echoFull(this.getStackTrace()));
  2315. break
  2316. }
  2317. this.logWarn(this.viewName + ".refreshEvents() - event has no start-date: " + isc.echoFull(_11));
  2318. continue
  2319. }
  2320. var _13 = _1.getEventLeadingDate(_11) || _12,
  2321. _14 = _13.getTime(),
  2322. _15 = _1.getEventTrailingDate(_11) || _1.getEventEndDate(_11),
  2323. _16 = _15.getTime();
  2324. if ((_14 >= _4 && _14 < _6) || (_16 > _4 && _16 <= _6) || (_14 <= _4 && _16 >= _6)) {
  2325. _11.eventLength = (_15 - _13);
  2326. if (_11[_1.durationField] != null) {
  2327. _11.isDuration = true;
  2328. _11.isZeroDuration = _11[_1.durationField] == 0
  2329. }
  2330. _9.add(_11)
  2331. }
  2332. }
  2333. };
  2334. if (_10) {
  2335. var _17 = _1.lanes.length,
  2336. _18 = [],
  2337. _19 = false;
  2338. for (var i = 0; i < _17; i++) {
  2339. var _21 = _10[i];
  2340. if (this.isGroupNode(_21)) continue;
  2341. if (_1.shouldShowLane(_21)) {
  2342. _18.add(_21);
  2343. _19 = true
  2344. }
  2345. }
  2346. if (!_19 && _18.length == 0) _19 = true;
  2347. if (_19 && (!this.lanes || this.lanes.length != _18.length)) {
  2348. this.setLanes(_18, true);
  2349. this.redraw()
  2350. }
  2351. }
  2352. this.setEventData(_9);
  2353. this.tagDataForOverlap();
  2354. this.refreshVisibleEvents(null, null, "refreshEvents");
  2355. if (this.$123r) {
  2356. this.body.scrollTo(null, this.$123r);
  2357. delete this.$123r
  2358. }
  2359. delete this.$123s;
  2360. delete this.$132n
  2361. }, isc.A.$116v = function isc_CalendarView__refreshData() {
  2362. var _1 = this.calendar;
  2363. if (_1.dataSource && isc.ResultSet && isc.isA.ResultSet(_1.data)) {
  2364. _1.$53e = true;
  2365. _1.invalidateCache();
  2366. _1.fetchData(_1.getCriteria())
  2367. } else {
  2368. _1.dataChanged()
  2369. }
  2370. }, isc.A.getFrozenLength = function isc_CalendarView_getFrozenLength() {
  2371. if (this.frozenBody && this.frozenBody.fields) return this.frozenBody.fields.length;
  2372. return 0
  2373. }, isc.A.getCellAlign = function isc_CalendarView_getCellAlign(_1, _2, _3) {
  2374. if (this.isMonthView()) return;
  2375. var _4 = this.calendar,
  2376. _5 = this.fields[_3],
  2377. _6 = _1 ? _1.cellAlign : null,
  2378. _7 = null;
  2379. if (_5) {
  2380. if (_5.frozen) {
  2381. return _5.cellAlign || _6 || this.labelColumnAlign
  2382. }
  2383. var _8 = this.getFrozenLength();
  2384. if (_4.getDateCellAlign) {
  2385. var _9 = this.getCellDate(_2, _3 - _8);
  2386. if (_9) _7 = _4.getDateCellAlign(_9, _2, _3 - _8, this)
  2387. }
  2388. _5 = this.body.fields[_3 - _8];
  2389. if (_7 || _5.cellAlign || _6) {
  2390. return _7 || _5.cellAlign || _6
  2391. }
  2392. }
  2393. return this.Super("getCellAlign", arguments)
  2394. }, isc.A.getCellVAlign = function isc_CalendarView_getCellVAlign(_1, _2, _3) {
  2395. if (this.isMonthView()) return;
  2396. var _4 = this.calendar,
  2397. _5 = this.fields[_3],
  2398. _6 = _1 ? _1.cellVAlign : null,
  2399. _7 = null;
  2400. if (_5) {
  2401. if (_5.frozen) {
  2402. return _5.cellVAlign || _6 || this.labelColumnVAlign || this.$171d
  2403. }
  2404. var _8 = this.getFrozenLength();
  2405. if (_4.getDateCellVAlign) {
  2406. var _9 = this.getCellDate(_2, _3 - _8);
  2407. if (_9) _7 = _4.getDateCellVAlign(_9, _2, _3 - _8, this)
  2408. }
  2409. _5 = this.body.fields[_3 - _8];
  2410. if (_7 || _6 || _5.cellVAlign) {
  2411. return _7 || _6 || _5.cellVAlign
  2412. }
  2413. }
  2414. return _6 || this.$171d
  2415. }, isc.A.getCellValue = function isc_CalendarView_getCellValue(_1, _2, _3) {
  2416. if (!this.calendar.getDateHTML) return this.Super("getCellValue", arguments);
  2417. if (this.isMonthView()) return this.Super("getCellValue", arguments);
  2418. var _4 = this.calendar,
  2419. _5 = this.getFrozenLength();
  2420. if (_3 - _5 >= 0) {
  2421. var _6 = this.getCellDate(_2, _3 - _5);
  2422. if (_6) {
  2423. var _7 = _4.getDateHTML(_6, _2, _3 - _5, this);
  2424. if (_7) return _7
  2425. }
  2426. }
  2427. return this.Super("getCellValue", arguments)
  2428. }, isc.A.destroyEvents = function isc_CalendarView_destroyEvents() {
  2429. if (!this.body || !this.body.children) return;
  2430. var _1 = this.body.children.length;
  2431. while (--_1 >= 0) {
  2432. var _2 = this.body.children[_1];
  2433. if (_2) {
  2434. this.body.removeChild(_2);
  2435. _2.destroy();
  2436. _2 = null
  2437. }
  2438. }
  2439. this.$128q = null;
  2440. this.$129c = null;
  2441. this.$128h = null
  2442. }, isc.A.destroy = function isc_CalendarView_destroy() {
  2443. if (this.removeLocalHandlers) this.removeLocalHandlers();
  2444. this.calendar = null;
  2445. this.destroyEvents(true);
  2446. if (this.clearZones) this.clearZones();
  2447. if (this.clearIndicators) this.clearIndicators();
  2448. this.Super("destroy", arguments)
  2449. });
  2450. isc.B._maxIndex = isc.C + 108;
  2451. isc.ClassFactory.defineClass("DaySchedule", "CalendarView");
  2452. isc.DaySchedule.changeDefaults("bodyProperties", {
  2453. snapToCells: false,
  2454. suppressVSnapOffset: true,
  2455. suppressHSnapOffset: true,
  2456. childrenSnapToGrid: false
  2457. });
  2458. isc.A = isc.DaySchedule.getPrototype();
  2459. isc.B = isc._allFuncs;
  2460. isc.C = isc.B._maxIndex;
  2461. isc.D = isc._funcClasses;
  2462. isc.D[isc.C] = isc.A.Class;
  2463. isc.A.autoDraw = false;
  2464. isc.A.canSort = false;
  2465. isc.A.canResizeFields = false;
  2466. isc.A.canReorderFields = false;
  2467. isc.A.showHeader = false;
  2468. isc.A.showHeaderContextMenu = false;
  2469. isc.A.showAllRecords = true;
  2470. isc.A.fixedRecordHeights = true;
  2471. isc.A.labelColumnWidth = 60;
  2472. isc.A.labelColumnAlign = "right";
  2473. isc.A.showLabelColumn = true;
  2474. isc.A.labelColumnPosition = "left";
  2475. isc.A.labelColumnBaseStyle = "labelColumn";
  2476. isc.A.showRollOver = true;
  2477. isc.A.useCellRollOvers = true;
  2478. isc.A.canAutoFitFields = false;
  2479. isc.A.canSelectCells = true;
  2480. isc.B.push(isc.A.getDateLabelText = function isc_DaySchedule_getDateLabelText(_1, _2) {
  2481. if (this.isWeekView()) {
  2482. return "<b>" + isc.DateUtil.getFormattedDateRangeString(_1, _2) + "</b>"
  2483. }
  2484. return "<b>" + isc.DateUtil.getFormattedDateRangeString(_1) + "</b>"
  2485. }, isc.A.initWidget = function isc_DaySchedule_initWidget() {
  2486. this.fields = [];
  2487. var _1 = this.calendar;
  2488. if (_1.showDayLanes && this.isDayView() && _1.alternateLaneStyles) {
  2489. this.alternateFieldStyles = true;
  2490. this.alternateFieldFrequency = _1.alternateFieldFrequency
  2491. }
  2492. if (_1.labelColumnWidth && _1.labelColumnWidth != this.labelColumnWidth) {
  2493. this.labelColumnWidth = _1.labelColumnWidth
  2494. }
  2495. this.renderEventsOnDemand = _1.renderEventsOnDemand;
  2496. this.eventDragGap = _1.eventDragGap;
  2497. this.fields = [];
  2498. this.Super("initWidget");
  2499. if (isc.isAn.Array(_1.data)) {
  2500. this.$128r = true;
  2501. this.$53e = true
  2502. }
  2503. this.rebuildFields();
  2504. this.addAutoChild("eventDragTarget");
  2505. this.body.addChild(this.eventDragTarget);
  2506. this.dragTarget = this.eventDragTarget
  2507. }, isc.A.getFirstDateColumn = function isc_DaySchedule_getFirstDateColumn() {
  2508. return this.frozenBody ? this.frozenBody.fields.length : 0
  2509. }, isc.A.reorderFields = function isc_DaySchedule_reorderFields(_1, _2, _3) {
  2510. this.Super("reorderFields", arguments);
  2511. this.refreshEvents()
  2512. }, isc.A.rebuildFields = function isc_DaySchedule_rebuildFields() {
  2513. this.initCacheValues();
  2514. var _1 = this.calendar,
  2515. _2 = [],
  2516. _3 = {
  2517. autoFitWidth: true,
  2518. minWidth: this.labelColumnWidth,
  2519. width: this.labelColumnWidth,
  2520. name: "label",
  2521. frozen: true,
  2522. isLabelField: true,
  2523. title: " ",
  2524. cellAlign: "right",
  2525. calendar: _1,
  2526. formatCellValue: function(_29, _30, _31, _32, _33) {
  2527. var _1 = _33.calendar;
  2528. var _4 = isc.DateUtil.getLogicalTimeOnly(_30.time);
  2529. var _5 = (_4.getHours() * 60) + _4.getMinutes();
  2530. if (_5 % _1.rowTitleFrequency == 0) {
  2531. var _6 = Math.floor(_5 / 60);
  2532. var _7 = _5 % 60;
  2533. var _8 = isc.Time.parseInput(_6 + ":" + _7);
  2534. return isc.Time.toTime(_8, _33.creator.timeFormatter, true)
  2535. } else {
  2536. return ""
  2537. }
  2538. }
  2539. };
  2540. if (this.showLabelColumn && this.labelColumnPosition == "left") {
  2541. _2.add(_3)
  2542. }
  2543. if (this.hasLanes()) {
  2544. var _9 = this.lanes = this.lanes || _1.lanes.duplicate() || [];
  2545. _2[0].frozen = true;
  2546. var d = _1.chosenDate.duplicate(),
  2547. _11 = isc.DaySchedule.$126v(_1, this, d),
  2548. _12 = isc.DateUtil.createLogicalDate(d.getFullYear(), d.getMonth(), d.getDate()),
  2549. _13 = {
  2550. date: _12,
  2551. align: "center",
  2552. canReorder: _1.canReorderLanes
  2553. };
  2554. for (var i = 0; i < _9.length; i++) {
  2555. var _15 = _9[i],
  2556. _16 = _15.name || _15[_1.laneNameField],
  2557. p = isc.addProperties({}, _13, {
  2558. name: _16
  2559. });
  2560. p[_1.laneNameField] = _16;
  2561. if (_15.sublanes) {
  2562. var _18 = this.getLaneWidth(_15),
  2563. _19 = _15.sublanes.length,
  2564. _20 = Math.floor(_18 / _19),
  2565. _21 = 0;
  2566. for (var j = 0; j < _19; j++) {
  2567. var _23 = _15.sublanes[j];
  2568. _23[_1.laneNameField] = _23.name;
  2569. _23.left = _21;
  2570. if (_23.width == null) _23.width = _20;
  2571. _21 += _23.width
  2572. }
  2573. _15.width = _15.sublanes.getProperty("width").sum()
  2574. }
  2575. _2.add(isc.addProperties(p, _15))
  2576. }
  2577. _11.setProperty(_16, "");
  2578. this.setShowHeader(true);
  2579. if (_1.canReorderLanes) this.canReorderFields = _1.canReorderLanes;
  2580. if (_1.minLaneWidth != null) this.minFieldWidth = _1.minLaneWidth;
  2581. this.data = _11
  2582. } else {
  2583. var _24 = _1.chosenDate;
  2584. _2[0].frozen = true;
  2585. _2.add({
  2586. name: "day1",
  2587. align: "center",
  2588. date: _1.chosenDate,
  2589. width: "*",
  2590. autoFitWidth: false
  2591. });
  2592. if (this.isWeekView()) {
  2593. var _25 = 8;
  2594. for (var i = 2; i < _25; i++) {
  2595. _2.add({
  2596. name: "day" + i,
  2597. align: "center",
  2598. width: "*",
  2599. autoFitWidth: false
  2600. })
  2601. }
  2602. this.setShowHeader(true);
  2603. if (!_1.showWeekends) {
  2604. var _26 = this.showLabelColumn && this.labelColumnPosition == "left" ? 1 : 0;
  2605. var _27 = _1.getWeekendDays();
  2606. for (var i = _26; i < _2.length; i++) {
  2607. var _28 = ((i - _26) + _1.firstDayOfWeek) % 7;
  2608. if (_27.contains(_28)) {
  2609. _2[i].showIf = "return false;"
  2610. }
  2611. }
  2612. }
  2613. _24 = this.chosenWeekStart
  2614. } else {
  2615. this.setShowHeader(false)
  2616. }
  2617. this.data = isc.DaySchedule.$126v(_1, this, _24)
  2618. }
  2619. if (this.showLabelColumn && this.labelColumnPosition == "right") {
  2620. _2.add(_3)
  2621. }
  2622. this.setFields(_2)
  2623. }, isc.A.getDateFromPoint = function isc_DaySchedule_getDateFromPoint(_1, _2, _3, _4) {
  2624. var _5 = this.calendar;
  2625. if (_4) {}
  2626. if (_1 == null && _2 == null) {
  2627. _2 = this.body.getOffsetY();
  2628. _1 = this.body.getOffsetX()
  2629. }
  2630. var _6 = this.body.getEventRow(_2);
  2631. if (_6 == -1) _6 = 0;
  2632. else if (_6 == -2) _6 = this.getTotalRows() - 1;
  2633. var _7 = this.body.getRowHeight(this.getRecord(_6), _6),
  2634. _8 = this.body.getRowTop(_6),
  2635. _9 = this.body.getEventColumn(_1),
  2636. _10 = (_9 < 0);
  2637. if (_9 == -1) _9 = 0;
  2638. else if (_9 == -2) _9 = this.body.fields.length - 1;
  2639. var _11 = this.getCellDate(_6, _9);
  2640. if (!_11) return null;
  2641. var _12 = this.getTimePerCell(),
  2642. _13 = _5.getRowsPerHour(this),
  2643. _14 = _2 - _8,
  2644. _15 = _5.getSnapGapPixels(this),
  2645. _16 = _14 - (_14 % _15),
  2646. _17 = Math.round(_12 / (_7 / _15)),
  2647. _18 = _16 / _15,
  2648. _19 = _17 * _18;
  2649. _11.setMinutes(_11.getMinutes() + _19);
  2650. return _11
  2651. }, isc.A.getCellDate = function isc_DaySchedule_getCellDate(_1, _2) {
  2652. if (!this.body || !this.body.fields || !this.$129f || !this.body.fields[_2]) {
  2653. return null
  2654. }
  2655. if (_1 < 0) _1 = this.data.getLength() - 1;
  2656. var _3 = this.isDayView() ? "day1" : this.body.fields[_2][this.fieldIdProperty];
  2657. if (!_3.startsWith("day")) return;
  2658. var _4 = this.$129f[_1];
  2659. return _4 && _4[_3] ? _4[_3].duplicate() : null
  2660. }, isc.A.getEventLeft = function isc_DaySchedule_getEventLeft(_1) {
  2661. var _2 = this.getColFromDate(this.calendar.getEventStartDate(_1), _1[this.calendar.laneNameField]);
  2662. return this.body.getColumnLeft(_2)
  2663. }, isc.A.getEventRight = function isc_DaySchedule_getEventRight(_1) {
  2664. var _2 = this.getColFromDate(this.calendar.getEventEndDate(_1), _1[this.calendar.laneNameField]);
  2665. return this.body.getColumnLeft(_2) + this.body.getColumnWidth(_2)
  2666. }, isc.A.getDateLeftOffset = function isc_DaySchedule_getDateLeftOffset(_1) {
  2667. for (var i = 0; i < this.fields.length; i++) {
  2668. var f = this.fields[i];
  2669. if (f.$66a != null && f.$659 != null && f.$658 != null) {
  2670. var _4 = isc.DateUtil.createLogicalDate(f.$66a, f.$659, f.$658);
  2671. if (isc.DateUtil.compareLogicalDates(_1, _4) == 0) {
  2672. return this.getColumnLeft(this.getFieldNum(f))
  2673. }
  2674. }
  2675. }
  2676. return 0
  2677. }, isc.A.getDateTopOffset = function isc_DaySchedule_getDateTopOffset(_1, _2) {
  2678. if (!_1) return null;
  2679. var _3 = this.calendar,
  2680. _4 = _3.getSnapGapPixels(this),
  2681. _5 = _1.getTime(),
  2682. _6 = this.getColFromDate(_1, _2),
  2683. _7 = this.data.length;
  2684. for (var i = 0; i <= _7; i++) {
  2685. var _9 = this.getCellDate(i, _6),
  2686. _10 = _9.getTime();
  2687. if (_10 >= _5) {
  2688. var _11 = i - (i == 0 ? 0 : 1),
  2689. _12 = this.getRowTop(_11),
  2690. _13 = this.getRowHeight(this.getRecord(_11), _11);
  2691. if (_13 / _4 != 1) {
  2692. var _14 = _10 - _5,
  2693. _15 = this.getTimePerCell() - Math.floor(_14 / 1000 / 60),
  2694. _16 = _3.getSnapGapMinutes(this),
  2695. _17 = Math.floor((_15 / _16) * _4);
  2696. _12 += _17
  2697. } else {
  2698. _12 += _13
  2699. }
  2700. return _12
  2701. }
  2702. }
  2703. return this.body.getScrollHeight() - 1
  2704. }, isc.A.setLanes = function isc_DaySchedule_setLanes(_1) {
  2705. this.lanes = _1.duplicate();
  2706. this.rebuildFields();
  2707. this.refreshEvents()
  2708. }, isc.A.getLane = function isc_DaySchedule_getLane(_1) {
  2709. var _2 = isc.isA.Number(_1) ? _1 : -1;
  2710. if (_2 == -1) {
  2711. if (isc.isAn.Object(_1)) _2 = this.body.fields.indexOf(_1);
  2712. else if (isc.isA.String(_1)) _2 = this.getLaneIndex(_1)
  2713. }
  2714. if (_2 >= 0) return this.body.fields[_2]
  2715. }, isc.A.getLaneIndex = function isc_DaySchedule_getLaneIndex(_1) {
  2716. if (!this.isDayView() || !this.calendar.showDayLanes) return;
  2717. var _2 = this.body.fields,
  2718. _3 = -1;
  2719. if (isc.isAn.Object(_1)) _3 = _2.indexOf(_1)
  2720. else if (isc.isA.String(_1)) {
  2721. _3 = _2.findIndex("name", _1);
  2722. if (_3 < 0) _3 = _2.findIndex(this.calendar.laneNameField, _1)
  2723. }
  2724. return _3
  2725. }, isc.A.getLaneWidth = function isc_DaySchedule_getLaneWidth(_1) {
  2726. var _2 = null;
  2727. if (isc.isA.String(_1)) _1 = this.getLane(_1);
  2728. if (_1) {
  2729. if (_1.width) _2 = _1.width;
  2730. else {
  2731. var _3 = this.calendar.laneNameField,
  2732. _4 = this.body.fields.findIndex(_3, _1[_3]);
  2733. _2 = _4 >= 0 ? this.body.getColumnWidth(_4) : null
  2734. }
  2735. }
  2736. return _2
  2737. }, isc.A.getLaneFromPoint = function isc_DaySchedule_getLaneFromPoint(_1, _2) {
  2738. if (!this.hasLanes()) return null;
  2739. if (_1 == null) _1 = this.body.getOffsetX();
  2740. var _3 = this.body.getEventColumn(_1),
  2741. _4 = this.body.fields[_3];
  2742. return !this.isGroupNode(_4) ? _4 : null
  2743. }, isc.A.getSublaneFromPoint = function isc_DaySchedule_getSublaneFromPoint(_1, _2) {
  2744. if (!this.hasSublanes()) return null;
  2745. if (_1 == null) _1 = this.body.getOffsetX();
  2746. var _3 = this.body.getEventColumn(_1),
  2747. _4 = this.body.fields[_3],
  2748. _5 = _4 ? _4.sublanes : null;
  2749. if (!_5) return null;
  2750. var _6 = this.body.getColumnLeft(_3),
  2751. _7 = _1 - _6,
  2752. _8 = this.getLaneWidth(_4),
  2753. _9 = _5.length,
  2754. _10 = 0;
  2755. for (var i = 0; i < _9; i++) {
  2756. if (_10 + _5[i].width > _7) {
  2757. return _5[i]
  2758. }
  2759. _10 += _5[i].width
  2760. }
  2761. return null
  2762. }, isc.A.draw = function isc_DaySchedule_draw(_1, _2, _3, _4) {
  2763. this.invokeSuper(isc.DaySchedule, "draw", _1, _2, _3, _4);
  2764. this.logDebug('draw', 'calendar');
  2765. this.body.addChild(this.eventDragTarget);
  2766. this.eventDragTarget.setView(this);
  2767. if (this.$128r) {
  2768. delete this.$128r;
  2769. this.refreshEvents()
  2770. }
  2771. this.setSnapGap();
  2772. if (this.calendar.scrollToWorkday) this.scrollToWorkdayStart()
  2773. }, isc.A.setSnapGap = function isc_DaySchedule_setSnapGap() {
  2774. var _1 = this.calendar.getSnapGapPixels(this);
  2775. this.body.snapVGap = Math.round((_1 / this.getTimePerCell()) *
  2776. this.body.getRowSize(0));
  2777. this.body.snapHGap = null
  2778. }, isc.A.scrollToWorkdayStart = function isc_DaySchedule_scrollToWorkdayStart() {
  2779. var _1 = this.calendar;
  2780. if (this.$166u) return;
  2781. if (_1.scrollToWorkday && !this.hasLanes()) {
  2782. var _2 = this.calcRowHeight();
  2783. if (_2 != _1.rowHeight) {
  2784. this.$166u = true;
  2785. _1.setRowHeight(_2, true);
  2786. delete this.$166u
  2787. }
  2788. }
  2789. this.updateSnapProperties();
  2790. var _3 = this.getWorkdayRange(),
  2791. _4 = _3.start;
  2792. var _5 = this.getTimePerCell(),
  2793. _6 = _1.getRowsPerHour(this),
  2794. _7 = _4.getHours() * _6,
  2795. _8 = _4.getMinutes(),
  2796. _9 = _8 % _5,
  2797. _10 = Math.floor((_8 - _9) / _5);
  2798. _7 += _10;
  2799. if (_9 > 0) _7++;
  2800. var _11 = _1.rowHeight * _7;
  2801. this.body.delayCall("scrollTo", [0, _11])
  2802. }, isc.A.getWorkdayRange = function isc_DaySchedule_getWorkdayRange() {
  2803. var _1 = this.body.fields,
  2804. _2 = {
  2805. start: isc.Time.parseInput("23:59"),
  2806. end: isc.Time.parseInput("00:01")
  2807. },
  2808. _3 = this.calendar,
  2809. _4 = _3.chosenDate,
  2810. _5;
  2811. if (this.isWeekView()) {
  2812. for (var i = 0; i < _1.length; i++) {
  2813. _4 = this.getDateFromCol(i);
  2814. if (isc.isA.Date(_4)) {
  2815. _5 = isc.Time.parseInput(_3.getWorkdayStart(_4));
  2816. if (isc.DateUtil.compareDates(_2.start, _5) < 0) {
  2817. _2.start = _5
  2818. }
  2819. _5 = isc.Time.parseInput(_3.getWorkdayEnd(_4));
  2820. if (isc.DateUtil.compareDates(_2.end, _5) > 0) {
  2821. _2.end = _5
  2822. }
  2823. }
  2824. }
  2825. } else if (_3.showDayLanes) {
  2826. for (var i = 0; i < _1.length; i++) {
  2827. var _7 = _1[i],
  2828. _8 = _7[_3.laneNameField];
  2829. if (isc.isA.Date(_4)) {
  2830. _5 = isc.Time.parseInput(_3.getWorkdayStart(_4, _8));
  2831. if (isc.DateUtil.compareDates(_2.start, _5) < 0) {
  2832. _2.start = _5
  2833. }
  2834. _5 = isc.Time.parseInput(_3.getWorkdayEnd(_4, _8));
  2835. if (isc.DateUtil.compareDates(_2.end, _5) > 0) {
  2836. _2.end = _5
  2837. }
  2838. }
  2839. }
  2840. } else {
  2841. _2.start = isc.Time.parseInput(_3.getWorkdayStart(_3.chosenDate));
  2842. _2.end = isc.Time.parseInput(_3.getWorkdayEnd(_3.chosenDate))
  2843. }
  2844. return _2
  2845. }, isc.A.calcRowHeight = function isc_DaySchedule_calcRowHeight() {
  2846. var _1 = this.getWorkdayRange(),
  2847. _2 = _1.end.getHours() - _1.start.getHours(),
  2848. _3 = this.calendar.rowHeight;
  2849. if (_2 <= 0) return _3;
  2850. var _4 = Math.ceil(this.body.getViewportHeight() /
  2851. (_2 * this.calendar.getRowsPerHour(this))) - 1;
  2852. return _4 < _3 ? _3 : _4
  2853. }, isc.A.getRowHeight = function isc_DaySchedule_getRowHeight(_1, _2) {
  2854. return this.calendar.rowHeight
  2855. }, isc.A.getDayFromCol = function isc_DaySchedule_getDayFromCol(_1) {
  2856. if (_1 < 0) return null;
  2857. var _2 = this.body.fields.get(_1).$654;
  2858. return _2
  2859. }, isc.A.getDateFromCol = function isc_DaySchedule_getDateFromCol(_1) {
  2860. if (_1 < 0) return null;
  2861. var _2 = this.getCellDate(0, _1);
  2862. return _2
  2863. }, isc.A.getColFromDate = function isc_DaySchedule_getColFromDate(_1, _2) {
  2864. for (var i = 0; i < this.body.fields.length; i++) {
  2865. var _4 = this.body.fields.get(i);
  2866. if (!_4.date) continue;
  2867. if (isc.DateUtil.compareLogicalDates(_1, _4.date) == 0) {
  2868. if (this.calendar.showDayLanes && _2) {
  2869. if (_4.lane == _2) return i
  2870. } else return i
  2871. }
  2872. }
  2873. return null
  2874. }, isc.A.isLabelCol = function isc_DaySchedule_isLabelCol(_1) {
  2875. var _2 = this.frozenFields ? this.frozenFields.length : 0;
  2876. if (_1 < _2) return true;
  2877. var _3 = this.getCellDate(1, _1 - _2);
  2878. return _3 == null
  2879. }, isc.A.cellDisabled = function isc_DaySchedule_cellDisabled(_1, _2) {
  2880. var _3 = this.getFieldBody(_2);
  2881. if (!_3 || _3 == this.frozenBody) return false;
  2882. var _4 = this.getLocalFieldNum(_2),
  2883. _5 = this.getCellDate(_1, _4);
  2884. if (this.$142y) {
  2885. var _6 = this.$142y;
  2886. for (var i = 0; i < _6.length; i++) {
  2887. if (_6[i].rowNum == _1 && _6[i].colNum == _4) {
  2888. return true
  2889. }
  2890. }
  2891. }
  2892. return this.calendar.shouldDisableDate(_5, this)
  2893. }, isc.A.refreshStyle = function isc_DaySchedule_refreshStyle() {
  2894. if (!this.body) return;
  2895. if (this.isWeekView() || this.calendar.showDayLanes) {
  2896. this.markForRedraw();
  2897. return
  2898. }
  2899. for (var i = 0; i < this.data.length; i++) {
  2900. this.body.refreshCellStyle(i, 1)
  2901. }
  2902. }, isc.A.headerClick = function isc_DaySchedule_headerClick(_1, _2) {
  2903. var _3 = this.calendar;
  2904. if (this.isLabelCol(_1)) return true;
  2905. if (_3.showDayLanes && !this.isWeekView()) return true;
  2906. var _4 = this.getField(_1);
  2907. _3.dateChooser.dateClick(_4.$66a, _4.$659, _4.$658);
  2908. _3.selectTab(0);
  2909. return true
  2910. }, isc.A.cellMouseDown = function isc_DaySchedule_cellMouseDown(_1, _2, _3) {
  2911. if (this.isLabelCol(_3) || this.cellDisabled(_2, _3)) return true;
  2912. var _4 = this.calendar;
  2913. var _5 = this.getCellDate(this.body.getEventRow(), this.body.getEventColumn());
  2914. if (_4.backgroundMouseDown && _4.backgroundMouseDown(_5) == false) return;
  2915. if (!_4.canCreateEvents) return true;
  2916. this.clearSelection();
  2917. this.$53q = {};
  2918. this.$53q.colNum = _3;
  2919. this.$53q.startRowNum = _2;
  2920. this.$53q.endRowNum = _2;
  2921. this.$53r = true;
  2922. this.refreshCellStyle(_2, _3)
  2923. }, isc.A.cellOver = function isc_DaySchedule_cellOver(_1, _2, _3) {
  2924. if (this.calendar.canDragCreateEvents == false) return;
  2925. if (this.$53r && this.$53q) {
  2926. var _4;
  2927. if (this.$53q.startRowNum < this.$53q.endRowNum) {
  2928. if (_2 > this.$53q.endRowNum) {
  2929. _4 = _2
  2930. } else {
  2931. _4 = this.$53q.endRowNum
  2932. }
  2933. this.$53q.endRowNum = _2
  2934. } else {
  2935. if (_2 < this.$53q.endRowNum) {
  2936. _4 = _2
  2937. } else {
  2938. _4 = this.$53q.endRowNum
  2939. }
  2940. this.$53q.endRowNum = _2
  2941. }
  2942. var _5 = 6,
  2943. _6 = this.$53q.colNum,
  2944. _7 = this.getTotalRows();
  2945. for (var i = _4 - _5; i < _4 + _5; i++) {
  2946. if (i >= 0 && i < _7) this.refreshCellStyle(i, _6)
  2947. }
  2948. }
  2949. }, isc.A.cellMouseUp = function isc_DaySchedule_cellMouseUp(_1, _2, _3) {
  2950. if (!this.$53q) return true;
  2951. this.$53r = false;
  2952. var _4, _5, _6;
  2953. if (this.$53q.startRowNum > this.$53q.endRowNum) {
  2954. _4 = this.$53q.endRowNum;
  2955. _5 = this.$53q.startRowNum
  2956. } else {
  2957. _5 = this.$53q.endRowNum;
  2958. _4 = this.$53q.startRowNum
  2959. }
  2960. _6 = _5 - _4 + 1;
  2961. var _7 = this.calendar,
  2962. _8 = _7.getCellDate(_4, _3, this),
  2963. _9 = _7.getCellDate(_4 + _6, _3, this);
  2964. if (_6 == 1 && _7.backgroundClick) {
  2965. if (_7.backgroundClick(_8, _9) == false) {
  2966. this.clearSelection();
  2967. return
  2968. }
  2969. }
  2970. if (_7.backgroundMouseUp) {
  2971. if (_7.backgroundMouseUp(_8, _9) == false) {
  2972. this.clearSelection();
  2973. return
  2974. }
  2975. }
  2976. var _10, _11;
  2977. if (_7.showDayLanes && _7.dayViewSelected()) {
  2978. _10 = this.getLaneFromPoint();
  2979. _11 = _10 ? this.getSublaneFromPoint() : null
  2980. }
  2981. var _12 = _7.createEventObject(null, _8, _9, _10 && _10[_7.laneNameField], _11 && _11[_7.laneNameField]);
  2982. _7.showEventDialog(_12, true);
  2983. return isc.EH.STOP_BUBBLING
  2984. }, isc.A.getCellStyle = function isc_DaySchedule_getCellStyle(_1, _2, _3) {
  2985. var _4 = this.calendar,
  2986. _5 = this.getBaseStyle(_1, _2, _3);
  2987. if (this.isLabelCol(_3)) return _5;
  2988. if (this.cellDisabled(_2, _3)) return _5 + "Disabled";
  2989. if (this.$53q && this.$53q.colNum == _3) {
  2990. var _6 = this.$53q.startRowNum,
  2991. _7 = this.$53q.endRowNum;
  2992. if (_2 >= _6 && _2 <= _7 || _2 >= _7 && _2 <= _6) {
  2993. if (_5 == _4.workdayBaseStyle) return _5 + "Selected";
  2994. return _4.selectedCellStyle
  2995. }
  2996. }
  2997. if (!this.isWeekView() && this.alternateRecordStyles && _2 % 2 != 0) {
  2998. if (_5 == _4.workdayBaseStyle) return _5;
  2999. return _5 + "Dark"
  3000. }
  3001. if (_4.dayViewSelected() && _4.showDayLanes && this.alternateFieldStyles && _3 % 2 != 0) {
  3002. if (_5 == _4.workdayBaseStyle) return _5;
  3003. return _5 + "Dark"
  3004. }
  3005. return _5
  3006. }, isc.A.getBaseStyle = function isc_DaySchedule_getBaseStyle(_1, _2, _3) {
  3007. var _4 = this.calendar,
  3008. _5 = _4.getCellDate(_2, _3, this),
  3009. _6 = _5 && _4.getDateStyle ? _4.getDateStyle(_5, _2, _3, this) : null,
  3010. _7 = this.isWeekView();
  3011. if (_6) {
  3012. return _6
  3013. }
  3014. if (this.isLabelCol(_3)) return this.labelColumnBaseStyle;
  3015. if (!_4.showWorkday) return this.baseStyle;
  3016. var _8 = this.getFieldBody(_3),
  3017. _9 = _3;
  3018. if (_8 == this.body) _9 = this.getLocalFieldNum(_3);
  3019. var _10 = _7 ? this.getDayFromCol(_9) : _4.chosenDate.getDay();
  3020. var _11 = _7 ? this.getDateFromCol(_9) : _4.chosenDate.duplicate(),
  3021. _12 = _11.duplicate(),
  3022. _13 = _5 ? _5.duplicate() : null,
  3023. _14 = _4.showDayLanes ? this.body.getField(_9)[_4.laneNameField] : null;
  3024. if (_13) {
  3025. var _15 = isc.Time.parseInput(_4.getWorkdayStart(_13, _14)),
  3026. _16 = isc.Time.parseInput(_4.getWorkdayEnd(_13, _14));
  3027. _11.setHours(_15.getHours(), _15.getMinutes(), 0, 0);
  3028. _12.setHours(_16.getHours(), _16.getMinutes(), 0, 0);
  3029. var _17 = _4.dateIsWorkday(_13, _14);
  3030. _13 = _13.getTime();
  3031. if (_17 && _11.getTime() <= _13 && _13 < _12.getTime()) {
  3032. return _4.workdayBaseStyle
  3033. } else {
  3034. return this.baseStyle
  3035. }
  3036. } else {
  3037. return this.baseStyle
  3038. }
  3039. }, isc.A.clearSelection = function isc_DaySchedule_clearSelection() {
  3040. if (this.$53q) {
  3041. var _1, _2, _3 = this.$53q.colNum;
  3042. if (this.$53q.startRowNum < this.$53q.endRowNum) {
  3043. _1 = this.$53q.startRowNum;
  3044. _2 = this.$53q.endRowNum
  3045. } else {
  3046. _1 = this.$53q.endRowNum;
  3047. _2 = this.$53q.startRowNum
  3048. }
  3049. this.$53q = null;
  3050. for (var i = _1; i < _2 + 1; i++) {
  3051. this.refreshCellStyle(i, _3)
  3052. }
  3053. }
  3054. }, isc.A.destroyEvents = function isc_DaySchedule_destroyEvents() {
  3055. if (!this.body || !this.body.children) return;
  3056. var _1 = this.body.children.length;
  3057. while (--_1 >= 0) {
  3058. var _2 = this.body.children[_1];
  3059. if (_2) {
  3060. this.body.removeChild(_2);
  3061. _2.destroy();
  3062. _2 = null
  3063. }
  3064. }
  3065. this.$128q = null;
  3066. this.$129c = null;
  3067. this.$128h = null
  3068. }, isc.A.destroy = function isc_DaySchedule_destroy() {
  3069. this.calendar = null;
  3070. this.destroyEvents(true);
  3071. if (this.clearZones) this.clearZones();
  3072. if (this.clearIndicators) this.clearIndicators();
  3073. this.Super("destroy", arguments)
  3074. }, isc.A.updateEventWindow = function isc_DaySchedule_updateEventWindow(_1) {
  3075. if (!this.body || !this.body.children) return;
  3076. var _2 = this.body.children,
  3077. _3 = this.calendar;
  3078. for (var i = 0; i < _2.length; i++) {
  3079. if (_2[i] && _2[i].isEventCanvas && this.areSame(_2[i].event, _1)) {
  3080. _2[i].event = _1;
  3081. this.sizeEventCanvas(_2[i]);
  3082. if (_2[i].setDescriptionText)
  3083. _2[i].setDescriptionText(_1[_3.descriptionField]);
  3084. return true
  3085. }
  3086. }
  3087. return false
  3088. });
  3089. isc.B._maxIndex = isc.C + 39;
  3090. isc.ClassFactory.defineClass("WeekSchedule", "DaySchedule");
  3091. isc.ClassFactory.defineClass("MonthSchedule", "CalendarView");
  3092. isc.ClassFactory.defineClass("MonthScheduleBody", "GridBody");
  3093. isc.MonthSchedule.changeDefaults("headerButtonProperties", {
  3094. showRollOver: false,
  3095. showDown: false,
  3096. cursor: "default"
  3097. });
  3098. isc.MonthSchedule.changeDefaults("bodyProperties", {
  3099. redrawOnResize: true,
  3100. fixedRowHeights: false
  3101. });
  3102. isc.A = isc.MonthSchedule.getPrototype();
  3103. isc.B = isc._allFuncs;
  3104. isc.C = isc.B._maxIndex;
  3105. isc.D = isc._funcClasses;
  3106. isc.D[isc.C] = isc.A.Class;
  3107. isc.A.autoDraw = false;
  3108. isc.A.leaveScrollbarGap = false;
  3109. isc.A.showAllRecords = true;
  3110. isc.A.showHeader = true;
  3111. isc.A.showHeaderContextMenu = false;
  3112. isc.A.canSort = false;
  3113. isc.A.canResizeFields = false;
  3114. isc.A.canReorderFields = false;
  3115. isc.A.canAutoFitFields = false;
  3116. isc.A.canHover = true;
  3117. isc.A.showHover = true;
  3118. isc.A.hoverWrap = false;
  3119. isc.A.showRollOver = true;
  3120. isc.A.useCellRollOvers = true;
  3121. isc.A.hoverByCell = true;
  3122. isc.A.showViewHovers = false;
  3123. isc.A.canSelectCells = true;
  3124. isc.A.dayHeaderHeight = 20;
  3125. isc.A.alternateRecordStyles = false;
  3126. isc.A.$160h = "date";
  3127. isc.A.cellHeight = 1;
  3128. isc.A.enforceVClipping = true;
  3129. isc.B.push(isc.A.getDateLabelText = function isc_MonthSchedule_getDateLabelText(_1, _2) {
  3130. return "<b>" + _1.getShortMonthName() + " " + _1.getFullYear() + "</b>"
  3131. }, isc.A.initWidget = function isc_MonthSchedule_initWidget() {
  3132. var _1 = this.calendar;
  3133. if (_1.data) this.data = this.getDayArray();
  3134. this.fields = [{
  3135. name: "day1",
  3136. align: "center"
  3137. }, {
  3138. name: "day2",
  3139. align: "center"
  3140. }, {
  3141. name: "day3",
  3142. align: "center"
  3143. }, {
  3144. name: "day4",
  3145. align: "center"
  3146. }, {
  3147. name: "day5",
  3148. align: "center"
  3149. }, {
  3150. name: "day6",
  3151. align: "center"
  3152. }, {
  3153. name: "day7",
  3154. align: "center"
  3155. }];
  3156. this.firstDayOfWeek = _1.firstDayOfWeek;
  3157. var _2 = isc.DateUtil.getShortDayNames();
  3158. var _3 = _1.getWeekendDays();
  3159. for (var i = 0; i < 7; i++) {
  3160. var _5 = (i + this.firstDayOfWeek) % 7;
  3161. this.fields[i].title = _2[_5];
  3162. this.fields[i].$654 = _5;
  3163. this.fields[i].$66b = i + 1;
  3164. if (!_1.showWeekends && _3.contains(_5)) {
  3165. this.fields[i].showIf = "return false;"
  3166. }
  3167. }
  3168. this.minimumDayHeight = _1.minimumDayHeight;
  3169. this.Super("initWidget");
  3170. this.selectChosenDateCells()
  3171. }, isc.A.canSelectCell = function isc_MonthSchedule_canSelectCell(_1, _2) {
  3172. return !this.calendar.shouldDisableDate(this.calendar.getCellDate(_1, _2, this))
  3173. }, isc.A.getCalendar = function isc_MonthSchedule_getCalendar() {
  3174. return this.calendar
  3175. }, isc.A.getTimePerCell = function isc_MonthSchedule_getTimePerCell(_1) {
  3176. return isc.DateUtil.convertPeriodUnit(1, "d", "mn")
  3177. }, isc.A.getTimePerSnapGap = function isc_MonthSchedule_getTimePerSnapGap(_1) {
  3178. return isc.DateUtil.convertPeriodUnit(1, "d", "mn")
  3179. }, isc.A.getDayArray = function isc_MonthSchedule_getDayArray() {
  3180. var _1 = [],
  3181. _2, _3, _4 = new Date(this.calendar.year, this.calendar.month, 1),
  3182. _5 = this.calendar;
  3183. while (_4.getDay() != _5.firstDayOfWeek) {
  3184. this.incrementDate(_4, -1)
  3185. }
  3186. if (!_5.showWeekends) {
  3187. var _6 = _5.getWeekendDays();
  3188. var _7 = _4.duplicate();
  3189. var _8 = true;
  3190. for (var i = 0; i <= 7 - _6.length; i++) {
  3191. if (_7.getMonth() == _5.month) {
  3192. _8 = false;
  3193. break
  3194. }
  3195. this.incrementDate(_7, 1)
  3196. }
  3197. if (_8) this.incrementDate(_4, 7)
  3198. }
  3199. _3 = new Date(_5.year, _5.month, _4.getDate() + 40);
  3200. _2 = _5.$53g(_4, _3, this);
  3201. _2.sortByProperty("name", true, function(_10, _11, _12) {
  3202. return _10[_12.startDateField].getTime()
  3203. }, _5);
  3204. this.$53t = 0;
  3205. for (var i = 0; i < 6; i++) {
  3206. if (_5.showDayHeaders) _1.add(this.getHeaderRowObject(_4));
  3207. _1.add(this.getEventRowObject(_4, _2));
  3208. this.incrementDate(_4, 7);
  3209. if (_4.getMonth() != _5.month) break
  3210. }
  3211. return _1
  3212. }, isc.A.getHeaderRowObject = function isc_MonthSchedule_getHeaderRowObject(_1) {
  3213. var _2 = {};
  3214. var _3 = _1.duplicate();
  3215. for (var i = 0; i < 7; i++) {
  3216. _2["day" + (i + 1)] = _3.getDate();
  3217. _2["date" + (i + 1)] = _3.duplicate();
  3218. this.incrementDate(_3, 1)
  3219. }
  3220. return _2
  3221. }, isc.A.getCellDate = function isc_MonthSchedule_getCellDate(_1, _2) {
  3222. if (_1 == null && _2 == null) {
  3223. _1 = this.getEventRow();
  3224. _2 = this.getEventColumn()
  3225. }
  3226. if (_1 < 0 || _2 < 0) return null;
  3227. var _3 = this.body.fields.get(_2).$66b,
  3228. _4 = this.getRecord(_1),
  3229. _5 = [this.$160h, _3].join(""),
  3230. _6 = _4[_5];
  3231. return _6
  3232. }, isc.A.getCellEndDate = function isc_MonthSchedule_getCellEndDate(_1, _2) {
  3233. var _3 = this.getCellDate(_1, _2);
  3234. if (!_3) return null;
  3235. return isc.DateUtil.getEndOf(_3, "d")
  3236. }, isc.A.incrementDate = function isc_MonthSchedule_incrementDate(_1, _2) {
  3237. var _3 = _1.getDate();
  3238. _1.setDate(_3 + _2);
  3239. if (_1.getDate() == (_3 + _2) - 1) {
  3240. _1.setHours(_1.getHours() + 1);
  3241. _1.setDate(_3 + _2)
  3242. }
  3243. return _1
  3244. }, isc.A.getEventRowObject = function isc_MonthSchedule_getEventRowObject(_1, _2) {
  3245. var _3 = {};
  3246. var _4 = _1.duplicate();
  3247. for (var i = 0; i < 7; i++) {
  3248. var _6 = [];
  3249. while (this.$53t < _2.length) {
  3250. var _7 = _2[this.$53t];
  3251. if (_7[this.calendar.startDateField].getMonth() != _4.getMonth() || _7[this.calendar.startDateField].getDate() != _4.getDate()) {
  3252. break
  3253. } else {
  3254. _6.add(_7);
  3255. this.$53t += 1
  3256. }
  3257. }
  3258. _3["day" + (i + 1)] = _4.getDate();
  3259. _3["date" + (i + 1)] = _4.duplicate();
  3260. _3["event" + (i + 1)] = _6;
  3261. this.incrementDate(_4, 1)
  3262. }
  3263. return _3
  3264. }, isc.A.getEvents = function isc_MonthSchedule_getEvents(_1, _2) {
  3265. var _3 = this.getFieldBody(_2);
  3266. if (!_3 || _3 == this.frozenBody) return false;
  3267. var _4 = this.getLocalFieldNum(_2);
  3268. var _5 = this.getDayFromCol(_4);
  3269. var _6 = this.fields.get(_4).$66b;
  3270. var _7 = this.data[_1]["event" + _6];
  3271. return _7
  3272. }, isc.A.getEventCell = function isc_MonthSchedule_getEventCell(_1) {
  3273. var _2 = this.data;
  3274. for (var _3 = 0; _3 < this.fields.length; _3++) {
  3275. var _4 = this.fields[_3].$66b,
  3276. _5 = "event" + _4;
  3277. for (var _6 = 0; _6 < _2.length; _6++) {
  3278. var _7 = _2.get(_6)[_5];
  3279. if (_7 != null && _7.contains(_1)) {
  3280. return [_6, _3]
  3281. }
  3282. }
  3283. }
  3284. }, isc.A.getDayFromCol = function isc_MonthSchedule_getDayFromCol(_1) {
  3285. var _2 = this.body.fields.get(_1).$654;
  3286. return _2
  3287. }, isc.A.getDateCells = function isc_MonthSchedule_getDateCells(_1) {
  3288. for (var i = 0; i < this.data.length; i++) {
  3289. var _3 = this.data[i];
  3290. for (var _4 in _3) {
  3291. if (_4.startsWith("date") && isc.DateUtil.compareLogicalDates(_1, _3[_4]) == 0) {
  3292. var _5 = [];
  3293. if (this.calendar.showDayHeaders)
  3294. _5.add([i + 1, new Number(_4.substring(4, 5)) - 1]);
  3295. _5.add([i, new Number(_4.substring(4, 5)) - 1])
  3296. return _5
  3297. }
  3298. }
  3299. }
  3300. return null
  3301. }, isc.A.cellDisabled = function isc_MonthSchedule_cellDisabled(_1, _2) {
  3302. var _3 = this.getFieldBody(_2);
  3303. if (!_3 || _3 == this.frozenBody) return false;
  3304. var _4 = this.getLocalFieldNum(_2),
  3305. _5 = this.getCellDate(_1, _4);
  3306. return this.calendar.shouldDisableDate(_5, this)
  3307. }, isc.A.refreshEvents = function isc_MonthSchedule_refreshEvents() {
  3308. var _1 = this.calendar;
  3309. if (!_1.hasData()) return;
  3310. this.logDebug('refreshEvents: month', 'calendar');
  3311. this.year = _1.year;
  3312. this.month = _1.month;
  3313. this.setData(this.getDayArray());
  3314. this.selectChosenDateCells();
  3315. if (_1.eventsRendered && isc.isA.Function(_1.eventsRendered))
  3316. _1.eventsRendered()
  3317. }, isc.A.rowIsHeader = function isc_MonthSchedule_rowIsHeader(_1) {
  3318. var _2 = this.calendar;
  3319. if (!_2.showDayHeaders || (_2.showDayHeaders && _1 % 2 == 1)) return false;
  3320. else return true
  3321. }, isc.A.formatCellValue = function isc_MonthSchedule_formatCellValue(_1, _2, _3, _4) {
  3322. if (!_2) return;
  3323. var _5 = this.calendar,
  3324. _6 = this.fields.get(_4).$66b,
  3325. _7 = _2["event" + _6],
  3326. _8 = _2["date" + _6],
  3327. _9 = _8.getMonth() != _5.month;
  3328. if (this.rowIsHeader(_3)) {
  3329. if (!_5.showOtherDays && _9) {
  3330. return ""
  3331. } else {
  3332. return _5.getDayHeaderHTML(_8, _7, _5, _3, _4)
  3333. }
  3334. } else {
  3335. if (!_5.showOtherDays && _9) {
  3336. return ""
  3337. } else {
  3338. return _5.getDayBodyHTML(_8, _7, _5, _3, _4)
  3339. }
  3340. }
  3341. }, isc.A.getRowHeight = function isc_MonthSchedule_getRowHeight(_1, _2) {
  3342. var _3 = this.calendar,
  3343. _4 = _3.showDayHeaders,
  3344. _5 = this.dayHeaderHeight;
  3345. if (isc.Canvas.$177z) {
  3346. _5 += isc.Canvas.$177z
  3347. }
  3348. if (this.rowIsHeader(_2)) {
  3349. return _5
  3350. } else {
  3351. var _6 = this.data.length,
  3352. _7 = _4 ? _6 / 2 : 0,
  3353. _8 = _7 * _5,
  3354. _9 = this.body.getVisibleHeight() - _8,
  3355. _10 = _4 ? this.minimumDayHeight - _5 : null,
  3356. _11 = _6 - _7;
  3357. if (_9 / _11 <= _10) {
  3358. return _10
  3359. } else {
  3360. if (_2 == this.data.length - 1) {
  3361. return Math.floor(_9 / _11) - 1
  3362. }
  3363. return Math.round(_9 / _11)
  3364. }
  3365. }
  3366. }, isc.A.getCellAlign = function isc_MonthSchedule_getCellAlign(_1, _2, _3) {
  3367. if (this.rowIsHeader(_2)) return "right";
  3368. else return "left"
  3369. }, isc.A.getCellVAlign = function isc_MonthSchedule_getCellVAlign(_1, _2, _3) {
  3370. if (!this.rowIsHeader(_2)) return "top";
  3371. else return "center"
  3372. }, isc.A.cellHoverHTML = function isc_MonthSchedule_cellHoverHTML(_1, _2, _3) {
  3373. var _4 = this.fields.get(_3).$66b;
  3374. var _5 = _1["date" + _4];
  3375. var _6 = _1["event" + _4];
  3376. if (!this.rowIsHeader(_2) && _6 != null) {
  3377. var _7 = this.calendar;
  3378. return _7.getMonthViewHoverHTML(_5, _6)
  3379. }
  3380. }, isc.A.getBaseStyle = function isc_MonthSchedule_getBaseStyle(_1, _2, _3) {
  3381. var _4 = this.calendar,
  3382. _5 = this.fields.get(_3).$66b;
  3383. var _6;
  3384. if (this.rowIsHeader(_2)) {
  3385. if ((_2 == 0 && _1["day" + _5] > 7) || (_2 == this.data.length - 2 && _1["day" + _5] < 7)) {
  3386. if (!_4.showOtherDays) return _4.otherDayBlankStyle;
  3387. else _6 = _4.otherDayHeaderBaseStyle
  3388. } else _6 = _4.dayHeaderBaseStyle
  3389. } else {
  3390. var _7 = this.cellDisabled(_2, _3),
  3391. _8 = _4.showDayHeaders ? 1 : 0,
  3392. _9 = this.data.length - 1;
  3393. if ((_2 == _8 && this.data[_8]["day" + _5] > 7) || (_2 == _9 && this.data[_9]["day" + _5] < 7)) {
  3394. if (!_4.showOtherDays) return _4.otherDayBlankStyle;
  3395. else _6 = _7 ? _4.otherDayBodyBaseStyle + "Disabled" : _4.otherDayBodyBaseStyle
  3396. } else _6 = _7 ? _4.dayBodyBaseStyle + "Disabled" : _4.dayBodyBaseStyle
  3397. }
  3398. return _6
  3399. }, isc.A.selectChosenDateCells = function isc_MonthSchedule_selectChosenDateCells() {
  3400. var _1 = this.calendar;
  3401. if (_1.selectChosenDate) {
  3402. this.getCellSelection().deselectAll();
  3403. var _2 = isc.Calendar.$1833(_1.chosenDate),
  3404. _3 = this.getDateCells(_2);
  3405. this.getCellSelection().selectCellList(_3)
  3406. }
  3407. }, isc.A.cellClick = function isc_MonthSchedule_cellClick(_1, _2, _3) {
  3408. var _4 = this.calendar,
  3409. _5, _6, _7 = this.fields.get(_3).$66b,
  3410. _8 = _1["date" + _7],
  3411. _9 = _1["event" + _7],
  3412. _10 = _4.month != _8.getMonth(),
  3413. _11 = false;
  3414. _4.setChosenDate(isc.DateUtil.createDatetime(_8.getFullYear(), _8.getMonth(), _8.getDate(), 12, 0, 0));
  3415. if (this.rowIsHeader(_2)) {
  3416. if (!(!_4.showOtherDays && _10)) {
  3417. _11 = _4.dayHeaderClick(_8, _9, _4, _2, _3)
  3418. }
  3419. if (_11) {
  3420. _4.selectTab(0)
  3421. }
  3422. } else {
  3423. if (_10) return;
  3424. if (!this.cellDisabled(_2, _3) && !(!_4.showOtherDays && _10)) {
  3425. _11 = _4.dayBodyClick(_8, _9, _4, _2, _3);
  3426. if (_11 && _4.canCreateEvents) {
  3427. var _12 = _4.getCellDate(_2, _3, this),
  3428. _13 = _4.getCellDate(_2, _3 + 1, this);
  3429. var _14 = _4.createEventObject(null, _12, _13);
  3430. _4.showEventDialog(_14, true)
  3431. }
  3432. }
  3433. }
  3434. }, isc.A.draw = function isc_MonthSchedule_draw() {
  3435. this.Super("draw", arguments);
  3436. if (this.$128r) {
  3437. delete this.$128r;
  3438. this.refreshEvents()
  3439. }
  3440. });
  3441. isc.B._maxIndex = isc.C + 28;
  3442. isc.ClassFactory.defineClass("TimelineView", "CalendarView");
  3443. isc.TimelineView.changeDefaults("bodyProperties", {
  3444. snapToCells: false,
  3445. suppressVSnapOffset: true,
  3446. suppressHSnapOffset: true,
  3447. childrenSnapToGrid: false
  3448. });
  3449. isc.A = isc.TimelineView.getPrototype();
  3450. isc.B = isc._allFuncs;
  3451. isc.C = isc.B._maxIndex;
  3452. isc.D = isc._funcClasses;
  3453. isc.D[isc.C] = isc.A.Class;
  3454. isc.A.canSort = false;
  3455. isc.A.canResizeFields = false;
  3456. isc.A.canAutoFitFields = false;
  3457. isc.A.canReorderFields = false;
  3458. isc.A.showHeaderContextMenu = false;
  3459. isc.A.showAllRecords = true;
  3460. isc.A.alternateRecordStyles = false;
  3461. isc.A.showRollOver = false;
  3462. isc.A.useCellRollOvers = false;
  3463. isc.A.canSelectCells = false;
  3464. isc.A.selectionType = "multiple";
  3465. isc.A.laneNameField = "lane";
  3466. isc.A.columnWidth = 60;
  3467. isc.A.laneHeight = 60;
  3468. isc.A.labelColumnWidth = 75;
  3469. isc.A.labelColumnBaseStyle = "labelColumn";
  3470. isc.A.labelColumnAlign = "left";
  3471. isc.A.eventPageSize = 30;
  3472. isc.A.trailIconSize = 16;
  3473. isc.A.leadIconSize = 16;
  3474. isc.A.scrollToToday = false;
  3475. isc.A.lineImage = "[SKINIMG]Stretchbar/hsplit_over_stretch.gif";
  3476. isc.A.trailingEndPointImage = "[SKINIMG]actions/prev.png";
  3477. isc.A.leadingEndPointImage = "[SKINIMG]actions/next.png";
  3478. isc.A.headerSpanHeight = 24;
  3479. isc.A.headerProperties = {
  3480. inherentWidth: false
  3481. };
  3482. isc.A.verticalEvents = false;
  3483. isc.A.animateFolders = false;
  3484. isc.A.includeRangeCriteria = true;
  3485. isc.A.unitSnapGapsPerCell = {
  3486. minute: 1,
  3487. hour: 15,
  3488. day: 60,
  3489. week: 1440,
  3490. month: 1440,
  3491. year: 1440 * 30
  3492. };
  3493. isc.A.dragSelectCanvasDefaults = {
  3494. _constructor: "Canvas",
  3495. styleName: "calendarCellSelected",
  3496. opacity: 60,
  3497. width: 1,
  3498. height: 1,
  3499. disabled: true,
  3500. visibility: "hidden",
  3501. autoDraw: false,
  3502. resizeNow: function(_1) {
  3503. var _2 = this.creator,
  3504. _3 = _2.calendar,
  3505. p = isc.addProperties({}, this.props, _1);
  3506. if (p.top == null) {
  3507. p.top = _2.getRowTop(_2.getLaneIndex(p.lane));
  3508. if (p.sublane) p.top += p.sublane.top
  3509. }
  3510. if (p.height == null) {
  3511. p.height = p.sublane ? p.sublane.height : _2.getLaneHeight(p.lane[_3.laneNameField])
  3512. }
  3513. var _5 = p.startSnap.startLeftOffset,
  3514. _6 = p.endSnap.endLeftOffset,
  3515. _7 = Math.abs(_6 - _5);
  3516. this.props = p;
  3517. this.moveTo(_5, p.top);
  3518. this.resizeTo(_7, p.height);
  3519. if (!this.isDrawn()) this.draw();
  3520. if (!this.isVisible()) {
  3521. this.show()
  3522. }
  3523. if (_2.shouldShowDragHovers()) isc.Hover.show(this.getHoverHTML())
  3524. },
  3525. hoverMoveWithMouse: true,
  3526. showHover: true,
  3527. hoverDelay: 0,
  3528. hoverProps: {
  3529. overflow: "visible",
  3530. hoverMoveWithMouse: this.hoverMoveWithMouse
  3531. },
  3532. getHoverHTML: function() {
  3533. var _1 = this.creator,
  3534. _2 = this.props,
  3535. _3 = _2.startSnap.startDate,
  3536. _4 = _2.endSnap.endDate;
  3537. var _5 = _1.calendar.createEventObject({}, _3, _4, _2.lane, _2.sublane);
  3538. return _1.calendar.$140a(_1, _5)
  3539. }
  3540. };
  3541. isc.A.groupRowHeight = 30;
  3542. isc.A.rangeCriteriaMode = "view";
  3543. isc.A.maximumTimelineColumns = 400;
  3544. isc.B.push(isc.A.getTimePerCell = function isc_TimelineView_getTimePerCell(_1) {
  3545. var _2 = this.calendar,
  3546. _3 = this.$27q,
  3547. _4 = _3.millisPerCell;
  3548. if (!_4) {
  3549. _4 = isc.DateUtil.convertPeriodUnit(1 * _3.unitsPerColumn, _3.granularity, "ms")
  3550. }
  3551. if (!_1) _1 = "mn";
  3552. return Math.floor(isc.DateUtil.convertPeriodUnit(_4, "ms", _1))
  3553. }, isc.A.getTimePerSnapGap = function isc_TimelineView_getTimePerSnapGap(_1) {
  3554. var _2 = this.calendar,
  3555. _3 = this.$27q,
  3556. _4 = _3.millisPerSnapGap;
  3557. if (!_4) {
  3558. if (_3.calendarEventSnapGap == null) {
  3559. _4 = this.getTimePerCell("ms")
  3560. } else if (_3.calendarEventSnapGap == 0) {
  3561. if (_3.unitsPerColumn > 1) {
  3562. _4 = isc.DateUtil.convertPeriodUnit(1, _3.innerHeaderUnit || _3.granularity, "ms")
  3563. } else {
  3564. _4 = isc.DateUtil.convertPeriodUnit(this.unitSnapGapsPerCell[_3.granularity], "mn", "ms");
  3565. _4 = Math.max(_4, _3.minimumSnapGapMillis)
  3566. }
  3567. } else {
  3568. _4 = isc.DateUtil.convertPeriodUnit(_3.calendarEventSnapGap, "mn", "ms");
  3569. var _5 = _3.minimumSnapGapMillis;
  3570. if (_4 < _5) {
  3571. this.logWarn("Invalid eventSnapGap - " + ((_4 / 1000) / 60) + " minutes - altered to the lowest sensible time that can be represented by the column-widths in the current view: " + ((_5 / 1000) / 60) + " minutes.");
  3572. _4 = _5
  3573. } else {
  3574. var _6 = _3.millisPerCell;
  3575. if (_4 > _6) {}
  3576. }
  3577. }
  3578. _3.calendarEventSnapGap = isc.DateUtil.convertPeriodUnit(_4, "ms", "mn")
  3579. }
  3580. if (!_1) _1 = "mn";
  3581. return isc.DateUtil.convertPeriodUnit(_4, "ms", _1)
  3582. }, isc.A.getHeaderButtonWidth = function isc_TimelineView_getHeaderButtonWidth(_1) {
  3583. return this.columnWidth
  3584. }, isc.A.getTimePerPixel = function isc_TimelineView_getTimePerPixel(_1) {
  3585. var _2 = this.calendar,
  3586. _3 = this.$27q,
  3587. _4 = _3.millisPerPixel;
  3588. if (!_4) {
  3589. _4 = this.getTimePerCell("ms") / this.getHeaderButtonWidth()
  3590. }
  3591. if (!_1) _1 = "mn";
  3592. return isc.DateUtil.convertPeriodUnit(_4, "ms", _1)
  3593. }, isc.A.getSnapGapPixels = function isc_TimelineView_getSnapGapPixels(_1, _2) {
  3594. var _3 = this.getTimePerCell() / this.getTimePerSnapGap();
  3595. return this.getHeaderButtonWidth() / _3
  3596. }, isc.A.getDateLabelText = function isc_TimelineView_getDateLabelText(_1, _2) {
  3597. return "<b>" + this.formatDateForDisplay(_1) + " - " + this.formatDateForDisplay(_2) + "</b>"
  3598. }, isc.A.initWidget = function isc_TimelineView_initWidget() {
  3599. this.fields = [];
  3600. var c = this.calendar;
  3601. if (c.alternateLaneStyles) {
  3602. this.alternateRecordStyles = c.alternateLaneStyles
  3603. }
  3604. if (c.showLaneRollOver != null) {
  3605. this.showRollOver = c.showLaneRollOver;
  3606. this.useCellRollOvers = false
  3607. }
  3608. if (c.canGroupLanes != null) {
  3609. this.canGroupBy = c.canGroupLanes;
  3610. if (this.canGroupBy) this.groupByField = c.laneGroupByField;
  3611. if (c.laneGroupStartOpen != null) this.groupStartOpen = c.laneGroupStartOpen
  3612. }
  3613. if (c.canReorderLanes) {
  3614. this.canReorderRecords = c.canReorderLanes
  3615. }
  3616. this.firstDayOfWeek = c.firstDayOfWeek;
  3617. if (c.laneNameField) this.laneNameField = c.laneNameField;
  3618. if (c.renderEventsOnDemand) this.renderEventsOnDemand = c.renderEventsOnDemand;
  3619. if (c.startDate) this.startDate = c.startDate.duplicate();
  3620. if (c.endDate) this.endDate = c.endDate.duplicate();
  3621. if (c.labelColumnWidth && c.labelColumnWidth != this.labelColumnWidth) {
  3622. this.labelColumnWidth = c.labelColumnWidth
  3623. }
  3624. if (c.eventDragGap != null) this.eventDragGap = c.eventDragGap;
  3625. this.$963 = this.headerHeight;
  3626. this.cellHeight = this.laneHeight;
  3627. if (c.headerLevels) {
  3628. this.headerLevels = isc.shallowClone(c.headerLevels)
  3629. }
  3630. var _2 = this.headerLevels && this.headerLevels.length > 0 ? this.headerLevels[this.headerLevels.length - 1] : null;
  3631. if (_2) {
  3632. this.timelineGranularity = _2.unit;
  3633. c.timelineGranularity = _2.unit
  3634. } else {
  3635. this.timelineGranularity = c.timelineGranularity
  3636. }
  3637. var _3 = isc.DateUtil.getTimeUnitKey(this.timelineGranularity);
  3638. if (!this.startDate) {
  3639. this.startDate = c.startDate = isc.DateUtil.getAbsoluteDate("-0" + _3, c.chosenDate)
  3640. }
  3641. if (!this.endDate) {
  3642. this.endDate = c.endDate = isc.DateUtil.getAbsoluteDate("+" + c.defaultTimelineColumnSpan + _3, this.startDate)
  3643. } else if (isc.DateUtil.compareDates(this.startDate, this.endDate) == -1) {
  3644. var s = this.startDate;
  3645. this.startDate = c.startDate = this.endDate.duplicate();
  3646. this.endDate = c.endDate = s;
  3647. this.logWarn("Timeline startDate is later than endDate - switching the values.")
  3648. }
  3649. this.initCacheValues();
  3650. this.fields = this.calcFields();
  3651. this.Super("initWidget");
  3652. this.$152e(!c.autoFetchData);
  3653. this.addAutoChild("eventDragTarget");
  3654. this.initCacheValues()
  3655. }, isc.A.installLocalHandlers = function isc_TimelineView_installLocalHandlers() {
  3656. if (this.calendar.showLaneRollOver) {
  3657. this.viewMouseMoveEventId = isc.Page.setEvent("mouseMove", this.getID() + ".viewMouseMove()");
  3658. this.viewDragMoveEventId = isc.Page.setEvent("dragMove", this.getID() + ".viewDragMove()");
  3659. this.viewDragRepositionMoveEventId = isc.Page.setEvent("dragRepositionMove", this.getID() + ".viewDragMove()");
  3660. this.$1745 = true
  3661. }
  3662. }, isc.A.removeLocalHandlers = function isc_TimelineView_removeLocalHandlers() {
  3663. if (this.$1745) {
  3664. isc.Page.clearEvent("mouseMove", this.viewMouseMoveEventId);
  3665. isc.Page.clearEvent("dragMove", this.viewDragMoveEventId);
  3666. isc.Page.clearEvent("dragRepositionMove", this.viewDragRepositionMoveEventId);
  3667. delete this.$1745
  3668. }
  3669. }, isc.A.initCacheValues = function isc_TimelineView_initCacheValues() {
  3670. var _1 = this.calendar;
  3671. this.$27q = {
  3672. alternateLaneStyles: this.alternateRecordStyles,
  3673. firstDayOfWeek: this.firstDayOfWeek,
  3674. granularity: this.timelineGranularity,
  3675. unitsPerColumn: this.timelineUnitsPerColumn || 1,
  3676. rangeStartDate: this.startDate,
  3677. rangeEndDate: this.endDate,
  3678. calendarEventSnapGap: _1.eventSnapGap
  3679. };
  3680. this.$27q.rangeStartMillis = this.$27q.rangeStartDate.getTime();
  3681. this.$27q.rangeEndMillis = this.$27q.rangeEndDate.getTime();
  3682. this.updateSnapProperties();
  3683. return this.$27q
  3684. }, isc.A.updateSnapProperties = function isc_TimelineView_updateSnapProperties() {
  3685. if (this.fieldHeaderLevel) this.$27q.innerHeaderUnit = this.fieldHeaderLevel.unit;
  3686. this.Super("updateSnapProperties", arguments)
  3687. }, isc.A.getDragSelectCanvas = function isc_TimelineView_getDragSelectCanvas(_1) {
  3688. if (!this.body) return null;
  3689. if (!this.dragSelectCanvas) {
  3690. this.dragSelectCanvas = this.createAutoChild("dragSelectCanvas", {
  3691. eventProxy: this.body
  3692. });
  3693. this.body.addChild(this.dragSelectCanvas)
  3694. }
  3695. return this.dragSelectCanvas
  3696. }, isc.A.cellMouseDown = function isc_TimelineView_cellMouseDown(_1, _2, _3) {
  3697. if ((_1 && _1.$52e) || this.isLabelCol(_3)) {
  3698. return true
  3699. }
  3700. var _4 = this.calendar;
  3701. if (_4.canDragCreateEvents == false && this.canDragScroll) {
  3702. this.$50p = true;
  3703. this.$171u = this.body.getScrollLeft();
  3704. this.$171v = this.$171w = this.getOffsetX();
  3705. this.$53r = true;
  3706. return false
  3707. }
  3708. var _5 = this.getMouseData() || {
  3709. x: this.body.getOffsetX(),
  3710. y: this.body.getOffsetY()
  3711. },
  3712. _6 = this.getSnapData(_5.x, _5.y),
  3713. _7 = _6 && _6.startDate;
  3714. if (_4.shouldDisableDate(_7, this)) {
  3715. return false
  3716. }
  3717. if (_4.backgroundMouseDown && _4.backgroundMouseDown(_7) == false) return;
  3718. if (!_4.canCreateEvents || _4.canDragCreateEvents == false) return true;
  3719. this.clearSelection();
  3720. var _8 = this.getDragSelectCanvas(),
  3721. _9 = _6.endDate,
  3722. _10 = this.getLaneFromPoint(),
  3723. _11 = this.getSublaneFromPoint();
  3724. var p = {
  3725. top: null,
  3726. height: null
  3727. };
  3728. p.lane = _10;
  3729. p.sublane = _11;
  3730. p.draggingLeftEdge = false;
  3731. p.startSnap = _6;
  3732. p.endSnap = _6;
  3733. _8.resizeNow(p);
  3734. this.$53r = true;
  3735. return false
  3736. }, isc.A.cellOver = function isc_TimelineView_cellOver(_1, _2, _3) {
  3737. _3 -= 1;
  3738. this.$152f = _2;
  3739. if (this.$50p) {
  3740. var _4 = this.body.getScrollLeft(),
  3741. _5 = this.getOffsetX(),
  3742. _6 = this.$171w - _5;
  3743. this.$171w = _5;
  3744. var _7 = Math.max(0, this.$171u + _6);
  3745. this.body.scrollBy(_6)
  3746. } else if (this.$53r) {
  3747. var _8 = this.getDragSelectCanvas(),
  3748. _9 = _8.props,
  3749. _10 = this.getMouseData() || {
  3750. x: this.body.getOffsetX(),
  3751. y: this.body.getOffsetY()
  3752. },
  3753. _11 = this.getSnapData(_10.x, _10.y);
  3754. if (_11.index < _9.startSnap.index) {
  3755. if (_9.draggingLeftEdge) _9.startSnap = _11;
  3756. else {
  3757. _9.endSnap = _9.startSnap;
  3758. _9.startSnap = _11;
  3759. _9.draggingLeftEdge = true
  3760. }
  3761. } else if (_11.index > _9.endSnap.index) {
  3762. if (!_9.draggingLeftEdge) _9.endSnap = _11;
  3763. else {
  3764. _9.startSnap = _9.endSnap;
  3765. _9.endSnap = _11;
  3766. _9.draggingLeftEdge = false
  3767. }
  3768. } else {
  3769. if (_9.draggingLeftEdge) _9.startSnap = _11;
  3770. else _9.endSnap = _11
  3771. }
  3772. _8.resizeNow(_9)
  3773. }
  3774. return this.Super("cellOver", arguments)
  3775. }, isc.A.cellMouseUp = function isc_TimelineView_cellMouseUp(_1, _2, _3) {
  3776. if (!this.$53r) return;
  3777. this.$53r = false;
  3778. if (this.shouldShowDragHovers()) isc.Hover.hide();
  3779. if (this.$50p) {
  3780. this.$171v = null;
  3781. this.$171u = null;
  3782. this.$50p = false;
  3783. return isc.EH.STOP_BUBBLING
  3784. }
  3785. var _4 = this.calendar,
  3786. _5 = this.getDragSelectCanvas(),
  3787. _6 = _5.props,
  3788. _7 = _6.startSnap.startDate,
  3789. _8 = _6.endSnap.endDate;
  3790. if (_4.backgroundClick) {
  3791. if (_4.backgroundClick(_7, _8) == false) {
  3792. this.clearSelection();
  3793. return
  3794. }
  3795. }
  3796. if (_4.backgroundMouseUp) {
  3797. if (_4.backgroundMouseUp(_7, _8) == false) {
  3798. this.clearSelection();
  3799. return
  3800. }
  3801. }
  3802. if (_4.shouldDisableDate(isc.DateUtil.dateAdd(_8.duplicate(), "ms", -1), this)) {
  3803. this.clearSelection();
  3804. return false
  3805. }
  3806. var _9 = _4.createEventObject(null, _7, _8, _6.lane && _6.lane[_4.laneNameField], _6.sublane && _6.sublane[_4.laneNameField]);
  3807. _4.showEventDialog(_9, true);
  3808. return isc.EH.STOP_BUBBLING
  3809. }, isc.A.clearSelection = function isc_TimelineView_clearSelection() {
  3810. var _1 = this.getDragSelectCanvas();
  3811. if (_1) _1.hide()
  3812. }, isc.A.getCellDate = function isc_TimelineView_getCellDate(_1, _2) {
  3813. if (!this.body) return null;
  3814. var _3 = this.body.getField(_2);
  3815. if (!_3 || !_3.date) return null;
  3816. return _3.date
  3817. }, isc.A.getCellEndDate = function isc_TimelineView_getCellEndDate(_1, _2) {
  3818. if (!this.body) return null;
  3819. var _3 = this.body.getField(_2);
  3820. if (!_3 || !_3.endDate) return null;
  3821. return _3.endDate
  3822. }, isc.A.recordDrop = function isc_TimelineView_recordDrop(_1, _2, _3, _4) {
  3823. this.Super("recordDrop", arguments);
  3824. this.$116v();
  3825. this.markForRedraw()
  3826. }, isc.A.getFirstDateColumn = function isc_TimelineView_getFirstDateColumn() {
  3827. return this.frozenBody ? this.frozenBody.fields.length : 0
  3828. }, isc.A.setFields = function isc_TimelineView_setFields() {
  3829. this.Super("setFields", arguments)
  3830. }, isc.A.updateOverlapRanges = function isc_TimelineView_updateOverlapRanges(_1) {
  3831. var _2 = this.calendar,
  3832. _3 = _1 || this.getEventData(),
  3833. _4 = _3.getLength(),
  3834. _5 = this.overlapRanges || [],
  3835. _6 = [],
  3836. _7 = this.startDate,
  3837. _8 = this.endDate;
  3838. if (isc.isA.ResultSet(_3)) {
  3839. _3 = _3.allRows
  3840. }
  3841. _3.setProperty("$122k", false);
  3842. _3.setProperty("$646", null);
  3843. _3.setProperty("$126u", null);
  3844. _3.setSort([{
  3845. property: _2.laneNameField,
  3846. direction: "ascending"
  3847. }, {
  3848. property: _2.startDateField,
  3849. direction: "ascending"
  3850. }, {
  3851. property: _2.endDateField,
  3852. direction: "descending"
  3853. }]);
  3854. for (var i = 0; i < _4; i++) {
  3855. var _10 = _3.get(i);
  3856. var _11 = {
  3857. events: [_10]
  3858. };
  3859. _11[_2.startDateField] = _2.getEventStartDate(_10);
  3860. _11[_2.endDateField] = _2.getEventEndDate(_10);
  3861. _11[_2.laneNameField] = _11.lane = _10[_2.laneNameField];
  3862. var _12 = true;
  3863. for (var j = 0; j < _5.length; j++) {
  3864. if (_11[_2.laneNameField] != _5[j][_2.laneNameField]) continue;
  3865. if (this.eventsOverlap(_11, _5[j], true)) {
  3866. this.mergeOverlapRanges(_11, _5[j]);
  3867. _12 = false
  3868. }
  3869. if (!_12) break
  3870. }
  3871. if (_12) {
  3872. _5.add(_11);
  3873. if (!_6.contains(_11)) _6.add(_11)
  3874. }
  3875. }
  3876. for (i = 0; i < _5.length; i++) {
  3877. var _14 = _5[i];
  3878. _14.id = "range_" + i + "_lane_" + _14.lane;
  3879. _14.events.setProperty("overlapRangeId", _14.id)
  3880. }
  3881. this.overlapRanges = _5;
  3882. return _6
  3883. }, isc.A.getOverlapSlot = function isc_TimelineView_getOverlapSlot(_1, _2) {
  3884. var _3 = {
  3885. slotNum: _1,
  3886. events: [],
  3887. snapGaps: []
  3888. };
  3889. for (var i = 0; i < _2; i++) _3.snapGaps[i] = 0;
  3890. return _3
  3891. }, isc.A.tagDataForOverlap = function isc_TimelineView_tagDataForOverlap(_1, _2) {
  3892. _1 = _1 || this.getEventData();
  3893. if (_1.getLength() == 0) return;
  3894. var _3 = false;
  3895. var _4 = this.calendar;
  3896. if (_4.eventAutoArrange == false) return;
  3897. this.forceDataSort(_1);
  3898. var _5 = this.isTimelineView() || (this.isDayView() && _4.showDayLanes);
  3899. var _6 = this.updateOverlapRanges(_1);
  3900. var _7 = [];
  3901. if (_5) {
  3902. _7.add({
  3903. property: _4.laneNameField,
  3904. direction: "ascending"
  3905. })
  3906. }
  3907. if (_4.overlapSortSpecifiers) {
  3908. _7.addList(_4.overlapSortSpecifiers)
  3909. } else {
  3910. _7.add({
  3911. property: "eventLength",
  3912. direction: "descending"
  3913. });
  3914. _7.add({
  3915. property: _4.startDateField,
  3916. direction: "ascending"
  3917. });
  3918. _7.add({
  3919. property: _4.endDateField,
  3920. direction: "ascending"
  3921. })
  3922. }
  3923. if (_3) {
  3924. this.logWarn("tagDataForOverlap: about to loop over " + _6.length + " overlap ranges")
  3925. }
  3926. for (var j = 0; j < _6.length; j++) {
  3927. var _9 = _6[j];
  3928. if (_3) {
  3929. this.logWarn("range: " + isc.echoFull(_9) + "")
  3930. }
  3931. var _10 = this.getSnapData(null, null, _9[_4.startDateField]),
  3932. _11 = _10 ? _10.index : 0,
  3933. _12 = this.getSnapData(null, null, _9[_4.endDateField]),
  3934. _13 = _12 ? _12.index : this.$1725.length - 1,
  3935. _14 = (_13 - _11) + 1,
  3936. _15 = [],
  3937. _16 = 1;
  3938. _15[0] = this.getOverlapSlot(0, _14);
  3939. var _17 = _9.events;
  3940. _17.setSort(_7);
  3941. for (var _18 = 0; _18 < _17.length; _18++) {
  3942. var _19 = _17[_18];
  3943. _19.$646 = {};
  3944. var _20 = _19.$646;
  3945. var _21 = _4.getEventStartDate(_19),
  3946. _22 = _4.getEventEndDate(_19);
  3947. _20.eventStartSnap = this.getSnapData(null, null, _21.getTime() + 1, true);
  3948. _20.eventEndSnap = this.getSnapData(null, null, _22.getTime() - 1, true);
  3949. var _23 = (_20.eventStartSnap ? _20.eventStartSnap.index : _20.nextValidSnap.index) - _11;
  3950. var _24 = (_20.eventEndSnap ? _20.eventEndSnap.index : _20.lastValidSnap.index) - _11;
  3951. var _25 = false;
  3952. var _26 = null;
  3953. for (var _27 = 0; _27 < _16; _27++) {
  3954. var _28 = _15[_27].snapGaps.slice(_23, _24 + 1);
  3955. var _29 = _28.sum() > 0;
  3956. if (!_29) {
  3957. _25 = true;
  3958. _15[_27].snapGaps.fill(1, _23, _24 + 1);
  3959. _15[_27].events.add(_19);
  3960. _19.$646.slotNum = _27
  3961. if (_3) {
  3962. this.logWarn("event " + _19.name + " occupying slot " + _27)
  3963. }
  3964. break
  3965. }
  3966. }
  3967. if (!_25) {
  3968. _15[_16] = this.getOverlapSlot(_16, _14);
  3969. _15[_16].snapGaps.fill(1, _23, _24 + 1);
  3970. _15[_16].events.add(_19);
  3971. _19.$646.slotNum = _16
  3972. if (_3) {
  3973. this.logWarn("event " + _19.name + " added to new slot index " + _16)
  3974. }
  3975. _16++
  3976. }
  3977. }
  3978. for (var i = 0; i < _15.length; i++) {
  3979. var _26 = _15[i];
  3980. for (var _31 = 0; _31 < _26.events.length; _31++) {
  3981. var _19 = _26.events[_31];
  3982. var _20 = _19.$646;
  3983. _20.totalSlots = _16;
  3984. var _23 = (_20.eventStartSnap ? _20.eventStartSnap.index : _11) - _11;
  3985. var _24 = (_20.eventEndSnap ? _20.eventEndSnap.index : _11) - _11;
  3986. var _25 = false;
  3987. for (var _32 = i + 1; _32 < _15.length; _32++) {
  3988. var _28 = _15[_32].snapGaps.slice(_23, _24 + 1);
  3989. var _29 = _28.sum() > 0;
  3990. if (_29) {
  3991. _20.slotCount = _32 - _20.slotNum;
  3992. _25 = true;
  3993. break
  3994. }
  3995. }
  3996. if (!_25) {
  3997. _20.slotCount = _16 - _20.slotNum
  3998. }
  3999. _20.slotNum++;
  4000. _19.$126u = _20.slotNum
  4001. }
  4002. }
  4003. _9.slotList = _15;
  4004. if (_3) {
  4005. this.logWarn("***** slotList *****\n" + isc.echoFull(_15))
  4006. }
  4007. }
  4008. }, isc.A.getSnapData = function isc_TimelineView_getSnapData(_1, _2, _3, _4) {
  4009. var _5 = this.$1725,
  4010. _6 = _5.length,
  4011. _7 = (_3 != null),
  4012. _8 = null;
  4013. if (_7) {
  4014. if (isc.isA.Number(_3)) _8 = _3;
  4015. else if (_3.getTime) _8 = _3.getTime()
  4016. } else {
  4017. if (_1 == null) _1 = this.body.getOffsetX()
  4018. }
  4019. if (_4) {
  4020. if (_8 != null) {
  4021. if (_8 < _5[0].startMillis) return _5[0];
  4022. if (_8 > _5[_5.length - 1].endMillis) return _5[_5.length - 1]
  4023. }
  4024. }
  4025. for (var i = 0; i < _6; i++) {
  4026. var _10 = _5[i];
  4027. if (_7) {
  4028. if (_10.startMillis <= _8 && _10.endMillis >= _8) {
  4029. return _10
  4030. }
  4031. } else {
  4032. if (_10.startHidden && _10.endHidden) continue;
  4033. if (_1 >= _10.startLeftOffset && _1 <= _10.endLeftOffset) return _10
  4034. }
  4035. }
  4036. return null
  4037. }, isc.A.buildSnapGapList = function isc_TimelineView_buildSnapGapList(_1) {
  4038. if (!this.body) return;
  4039. var _2 = this.calendar,
  4040. _3 = this.frozenBody ? this.body.fields : this.getFields(),
  4041. _4 = _2.getSnapGapPixels(this),
  4042. _5 = this.getTimePerPixel("ms"),
  4043. _6 = this.getTimePerSnapGap("ms"),
  4044. _7 = this.getTimePerSnapGap("mn"),
  4045. _8 = this.$27q.rangeStartDate,
  4046. _9 = this.$27q.rangeStartMillis,
  4047. _10 = this.$27q.rangeEndMillis,
  4048. _11 = this.$27q.rangeEndDate,
  4049. _12 = this.$27q.rangeStartDate.duplicate(),
  4050. _13 = _9,
  4051. i = 0,
  4052. _15 = [],
  4053. _16 = false,
  4054. _17 = null,
  4055. _18 = 0,
  4056. _19;
  4057. while (_13 < _10) {
  4058. var _20 = _13 + _6;
  4059. if (_20 == _19) {
  4060. this.logWarn("snapGaps " + i + " and " + (i + 1) + " have identical times")
  4061. } else if (_20 >= _10) {
  4062. _20 = _10;
  4063. _16 = true
  4064. }
  4065. if (_7 == 1440) {
  4066. _12.setDate(_12.getDate() + 1);
  4067. _20 = _12.getTime()
  4068. } else {
  4069. _12.setTime(_20 - 1)
  4070. }
  4071. _19 = _20;
  4072. _19--;
  4073. var _21 = {
  4074. index: i++,
  4075. startMillis: _13,
  4076. endMillis: _19,
  4077. startDate: new Date(_13),
  4078. endDate: new Date(_19)
  4079. };
  4080. _21.startField = this.getFieldContainingDate(_13 + 1, true);
  4081. if (_21.startField) {
  4082. _21.startCol = _3.indexOf(_21.startField)
  4083. } else {
  4084. _21.startHidden = true
  4085. }
  4086. if (_21.startField) {
  4087. if (_21.startCol == _17) {
  4088. _18++
  4089. } else {
  4090. _17 = _21.startCol;
  4091. _18 = 0
  4092. }
  4093. _21.fieldSnapIndex = _18;
  4094. var _22 = _2.getMinutePixels(Math.floor((_13 - _21.startField.date.getTime()) / 1000 / 60), null, this);
  4095. _21.startLeftOffset = _21.startField.startLeftOffset + _22
  4096. }
  4097. _21.endField = this.getFieldContainingDate(_19, true);
  4098. if (!_21.endField) {
  4099. _21.endField = this.getFieldContainingDate(_19, false)
  4100. }
  4101. if (_21.endField) {
  4102. _21.endCol = _3.indexOf(_21.endField)
  4103. } else {
  4104. _21.endHidden = true
  4105. }
  4106. if (_21.endField) {
  4107. var _23 = _2.getMinutePixels(Math.floor((_21.endField.endDate.getTime() - _19) / 1000 / 60), null, this);
  4108. _21.endLeftOffset = _21.endField.endLeftOffset - _23
  4109. }
  4110. _21.startDate = new Date(_13);
  4111. _21.endDate = new Date(_19);
  4112. _15.add(_21);
  4113. if (_16) break;
  4114. _13 = _19 + 1
  4115. }
  4116. var _24;
  4117. var _25;
  4118. var _26;
  4119. for (var i = 0; i < _15.length; i++) {
  4120. var _21 = _15[i];
  4121. if (_21.startHidden) {
  4122. if (_25 == null) _25 = i
  4123. } else {
  4124. if (_25 != null) {
  4125. for (var j = _25; j < i; j++) {
  4126. _15[j].nextValidSnap = _21
  4127. }
  4128. _25 = null
  4129. }
  4130. }
  4131. if (_21.endHidden) {
  4132. _21.lastValidSnap = _15[_26]
  4133. } else {
  4134. _26 = i
  4135. }
  4136. _24 = _21
  4137. }
  4138. this.$1725 = _15
  4139. }, isc.A.$1731 = function isc_TimelineView__rebuildFields() {
  4140. this.$171x = true;
  4141. var _1 = this.calcFields();
  4142. if (this.isDrawn()) {
  4143. this.body.removeChild(this.eventDragTarget);
  4144. this.setFields(_1);
  4145. this.body.addChild(this.eventDragTarget)
  4146. } else this.fields = _1
  4147. }, isc.A.$152e = function isc_TimelineView__rebuild(_1) {
  4148. if (this.$129c && this.$129c.length > 0) {
  4149. this.$129c.setProperty("$128k", true);
  4150. this.clearEvents()
  4151. }
  4152. this.setShowHover(this.calendar.showViewHovers);
  4153. this.$1731();
  4154. var _2 = this.lanes || this.calendar.lanes || [];
  4155. this.setLanes(_2.duplicate(), true);
  4156. this.$730();
  4157. if (_1) {
  4158. this.$116v()
  4159. } else {
  4160. this.refreshEvents()
  4161. }
  4162. }, isc.A.refreshEvents = function isc_TimelineView_refreshEvents() {
  4163. this.buildSnapGapList("refreshEvents");
  4164. return this.Super("refreshEvents", arguments)
  4165. }, isc.A.setLanes = function isc_TimelineView_setLanes(_1, _2) {
  4166. var _3 = this.calendar,
  4167. _4 = _3.laneNameField;
  4168. this.lanes = _1.duplicate();
  4169. var _5 = _1.length;
  4170. for (var i = 0; i < _5; i++) {
  4171. var _7 = _1[i];
  4172. if (!_7[_4]) _7[_4] = _7.name;
  4173. if (_7.sublanes) {
  4174. var _8 = this.getLaneHeight(_7),
  4175. _9 = _7.sublanes.length,
  4176. _10 = Math.floor(_8 / _9),
  4177. _11 = 0;
  4178. for (var j = 0; j < _9; j++) {
  4179. var _13 = _7.sublanes[j];
  4180. _13[_4] = _13.name;
  4181. _13.top = _11;
  4182. if (_13.height == null) _13.height = _10;
  4183. _11 += _13.height
  4184. }
  4185. _7.height = _7.sublanes.getProperty("height").sum()
  4186. } else {
  4187. _7.height = this.getLaneHeight(_7)
  4188. }
  4189. }
  4190. this.setData(_1);
  4191. if (this.isDrawn()) this.redraw();
  4192. if (!_2) {
  4193. delete _3.$53e;
  4194. this.$116v()
  4195. }
  4196. }, isc.A.getLaneIndex = function isc_TimelineView_getLaneIndex(_1) {
  4197. var _2;
  4198. if (isc.isAn.Object(_1)) _2 = _1;
  4199. else if (this.data) {
  4200. _2 = this.data.find("name", _1) || this.data.find(this.calendar.laneNameField, _1)
  4201. } else return -1;
  4202. var _3 = this.getRecordIndex(_2);
  4203. return _3
  4204. }, isc.A.getLane = function isc_TimelineView_getLane(_1) {
  4205. var _2 = this.getLaneIndex(_1);
  4206. if (_2 >= 0) return this.getRecord(_2)
  4207. }, isc.A.getLaneFromPoint = function isc_TimelineView_getLaneFromPoint(_1, _2) {
  4208. if (_2 == null) _2 = this.body.getOffsetY();
  4209. var _3 = this.getEventRow(_2),
  4210. _4 = this.getRecord(_3);
  4211. return !this.isGroupNode(_4) ? _4 : null
  4212. }, isc.A.getSublaneFromPoint = function isc_TimelineView_getSublaneFromPoint(_1, _2) {
  4213. if (_2 == null) _2 = this.body.getOffsetY();
  4214. var _3 = this.getEventRow(_2),
  4215. _4 = this.getRecord(_3),
  4216. _5 = _4 ? _4.sublanes : null;
  4217. if (!_5) return null;
  4218. var _6 = this.getRowTop(_3),
  4219. _7 = _2 - _6,
  4220. _8 = this.getLaneHeight(_4),
  4221. _9 = _5.length,
  4222. _10 = 0;
  4223. for (var i = 0; i < _9; i++) {
  4224. if (_10 + _5[i].height >= _7) {
  4225. return _5[i]
  4226. }
  4227. _10 += _5[i].height
  4228. }
  4229. return null
  4230. }, isc.A.$730 = function isc_TimelineView__scrubDateRange() {
  4231. var _1 = this.calendar.timelineGranularity;
  4232. if (_1 == "month") {
  4233. this.startDate.setDate(1)
  4234. } else if (_1 == "week") {
  4235. this.startDate = isc.DateUtil.getStartOf(this.startDate, "w", true, this.calendar.firstDayOfWeek)
  4236. } else if (_1 == "day") {
  4237. this.startDate.setHours(0);
  4238. this.startDate.setMinutes(0);
  4239. this.startDate.setSeconds(0);
  4240. this.startDate.setMilliseconds(0)
  4241. } else if (_1 == "hour") {
  4242. this.startDate.setMinutes(0);
  4243. this.startDate.setSeconds(0);
  4244. this.startDate.setMilliseconds(0)
  4245. } else if (_1 == "minute") {
  4246. this.startDate.setSeconds(0);
  4247. this.startDate.setMilliseconds(0)
  4248. }
  4249. }, isc.A.scrollTimelineTo = function isc_TimelineView_scrollTimelineTo(_1) {
  4250. this.bodies[1].scrollTo(_1)
  4251. }, isc.A.setLaneHeight = function isc_TimelineView_setLaneHeight(_1) {
  4252. this.laneHeight = _1;
  4253. this.setCellHeight(_1);
  4254. this.refreshEvents()
  4255. }, isc.A.getRowHeight = function isc_TimelineView_getRowHeight(_1, _2) {
  4256. var _3 = null;
  4257. if (_1) {
  4258. if (this.isGroupNode(_1)) _3 = this.groupRowHeight;
  4259. else _3 = _1.height
  4260. }
  4261. return _3 || this.Super("getRowHeight", arguments)
  4262. }, isc.A.setInnerColumnWidth = function isc_TimelineView_setInnerColumnWidth(_1) {
  4263. this.columnWidth = _1;
  4264. this.$152e(true)
  4265. }, isc.A.setTimelineRange = function isc_TimelineView_setTimelineRange(_1, _2, _3, _4, _5, _6, _7) {
  4266. var _8 = this.calendar;
  4267. if (_3) _8.timelineGranularity = _3;
  4268. else _3 = _8.timelineGranularity;
  4269. this.timelineGranularity = _3;
  4270. if (_5) _8.timelineUnitsPerColumn = _5;
  4271. else _5 = _8.timelineUnitsPerColumn;
  4272. this.timelineUnitsPerColumn = _5;
  4273. var _9 = _4 || this.$178u || _8.defaultTimelineColumnSpan,
  4274. _10 = false,
  4275. _11 = (_3 || _8.timelineGranularity).toLowerCase(),
  4276. _12 = isc.DateUtil.getTimeUnitKey(_11);;
  4277. if (_6) {
  4278. _8.headerLevels = _6
  4279. }
  4280. _1 = _1 || this.startDate;
  4281. _1 = isc.DateUtil.getStartOf(_1, _12);
  4282. if (!_2) {
  4283. if (_1.getTime() == this.startDate.getTime() && this.endDate) _2 = this.endDate;
  4284. else _2 = isc.DateUtil.getAbsoluteDate("+" + (_9 * _5) + _12, _1)
  4285. }
  4286. var _13 = this.rangeCriteriaMode || _8.rangeCriteriaMode;
  4287. if (_13 && _13 != "none") _10 = true;
  4288. if (_1.logicalDate) _1 = isc.DateUtil.getStartOf(_1.duplicate(), _12, false, this.firstDayOfWeek);
  4289. if (_2.logicalDate) _2 = isc.DateUtil.getEndOf(_2.duplicate(), _12, false, this.firstDayOfWeek);
  4290. if (isc.DateUtil.compareLogicalDates(_1, _2) == 0) {
  4291. if (_8.showWeekends == false && _8.dateIsWeekend(_1)) {
  4292. _8.showWeekends = true;
  4293. this.logWarn("showWeekends was automatically switched on because the dates provided for the timeline spanned less than one day and the day is a weekend.")
  4294. }
  4295. }
  4296. this.startDate = _1.duplicate();
  4297. this.endDate = _2.duplicate();
  4298. _8.startDate = _1.duplicate();
  4299. _8.endDate = _2.duplicate();
  4300. this.initCacheValues();
  4301. _8.dateChooser.setData(this.startDate);
  4302. if (!_7) _8.setChosenDate(this.startDate, true);
  4303. if (_8.autoFetchData && _8.$1737) _10 = false;
  4304. this.$152e(_10)
  4305. }, isc.A.addUnits = function isc_TimelineView_addUnits(_1, _2, _3) {
  4306. _3 = _3 || this.calendar.timelineGranularity;
  4307. if (_3 == "century") {
  4308. _1.setFullYear(_1.getFullYear() + (_2 * 100))
  4309. } else if (_3 == "decade") {
  4310. _1.setFullYear(_1.getFullYear() + (_2 * 10))
  4311. } else if (_3 == "year") {
  4312. _1.setFullYear(_1.getFullYear() + _2)
  4313. } else if (_3 == "quarter") {
  4314. _1.setMonth(_1.getMonth() + (_2 * 3))
  4315. } else if (_3 == "month") {
  4316. _1.setMonth(_1.getMonth() + _2)
  4317. } else if (_3 == "week") {
  4318. _1.setDate(_1.getDate() + (_2 * 7))
  4319. } else if (_3 == "day") {
  4320. _1.setDate(_1.getDate() + _2)
  4321. } else if (_3 == "hour") {
  4322. _1.setHours(_1.getHours() + _2)
  4323. } else if (_3 == "minute") {
  4324. _1.setMinutes(_1.getMinutes() + _2)
  4325. } else if (_3 == "second") {
  4326. _1.setSeconds(_1.getSeconds() + _2)
  4327. } else if (_3 == "millisecond") {
  4328. _1.setMilliseconds(_1.getMilliseconds() + _2)
  4329. }
  4330. return _1
  4331. }, isc.A.getColFromDate = function isc_TimelineView_getColFromDate(_1) {
  4332. var _2 = this.frozenBody ? this.body.fields : this.getFields(),
  4333. _3 = (_1 && _1.getTime) ? _1.getTime() : _1;
  4334. if (_1) {
  4335. for (var i = 0; i < _2.length; i++) {
  4336. var _5 = _2[i],
  4337. _6 = _5 && _5.date ? _5.date.getTime() : null,
  4338. _7 = _5 && _5.endDate ? _5.endDate.getTime() : null;
  4339. if (!_6 || !_7) continue;
  4340. if (_6 >= _3) {
  4341. return i - 1
  4342. }
  4343. }
  4344. }
  4345. return null
  4346. }, isc.A.getFieldContainingDate = function isc_TimelineView_getFieldContainingDate(_1, _2) {
  4347. var _3 = this.frozenBody ? this.body.fields : this.getFields(),
  4348. _4 = (_1 && _1.getTime) ? _1.getTime() : _1;
  4349. if (_4) {
  4350. if (_4 < this.startDate.getTime()) return _3[0];
  4351. if (_4 >= this.endDate.getTime()) {
  4352. return _2 ? null : _3[_3.length - 1]
  4353. }
  4354. for (var i = 0; i < _3.length; i++) {
  4355. var _6 = _3[i],
  4356. _7 = _6 && _6.date ? _6.date.getTime() : null,
  4357. _8 = _6 && _6.endDate ? _6.endDate.getTime() : null;
  4358. if (_4 >= _7 && _4 <= _8) {
  4359. return _6
  4360. }
  4361. }
  4362. }
  4363. return null
  4364. }, isc.A.calcFields = function isc_TimelineView_calcFields() {
  4365. var _1 = [],
  4366. _2 = this.calendar;
  4367. var _3 = {
  4368. hoverDelay: this.hoverDelay + 1,
  4369. hoverMoveWithMouse: true,
  4370. canHover: this.shouldShowHeaderHovers(),
  4371. showHover: this.shouldShowHeaderHovers(),
  4372. mouseMove: function() {
  4373. var _4 = this.grid,
  4374. _5 = _4.getEventRow(),
  4375. _6 = _5 < 0;
  4376. if (_4.shouldShowHeaderHovers()) {
  4377. isc.Hover.show(this.getHoverHTML());
  4378. return isc.EH.STOP_BUBBLING
  4379. }
  4380. },
  4381. getHoverHTML: function() {
  4382. var _4 = this.grid;
  4383. return _4.calendar.$140e(_4, _4.fieldHeaderLevel, this, this.date, this.endDate)
  4384. }
  4385. };
  4386. if (this.showLaneFields != false) {
  4387. if (_2.laneFields) {
  4388. var _7 = _2.laneFields;
  4389. _7.setProperty("frozen", true);
  4390. _7.setProperty("isLaneField", true);
  4391. for (var i = 0; i < _7.length; i++) {
  4392. var _9 = _7[i];
  4393. if (_9.minWidth == null) _9.minWidth = this.labelColumnWidth;
  4394. if (_9.width == null) _9.width = _9.minWidth || this.labelColumnWidth;
  4395. _1.add(_9)
  4396. }
  4397. } else {
  4398. var _10 = isc.addProperties({
  4399. autoFitWidth: true,
  4400. width: this.labelColumnWidth,
  4401. minWidth: this.labelColumnWidth,
  4402. name: "title",
  4403. title: " ",
  4404. showTitle: false,
  4405. frozen: true,
  4406. isLaneField: true
  4407. }, _3);
  4408. _1.add(_10)
  4409. }
  4410. }
  4411. if (!_2.headerLevels && !this.headerLevels) {
  4412. _2.headerLevels = [{
  4413. unit: _2.timelineGranularity
  4414. }]
  4415. }
  4416. if (_2.headerLevels) {
  4417. this.headerLevels = isc.shallowClone(_2.headerLevels)
  4418. }
  4419. if (this.headerLevels) {
  4420. this.fieldHeaderLevel = this.headerLevels[this.headerLevels.length - 1];
  4421. this.headerLevels.remove(this.fieldHeaderLevel);
  4422. _2.timelineGranularity = this.fieldHeaderLevel.unit;
  4423. this.$27q.innerHeaderLevel = this.fieldHeaderLevel;
  4424. this.$27q.granularity = _2.timelineGranularity;
  4425. this.updateSnapProperties()
  4426. }
  4427. this.adjustTimelineForHeaders();
  4428. var _11 = this.startDate.duplicate(),
  4429. _12 = this.endDate.duplicate(),
  4430. _13 = _2.timelineUnitsPerColumn,
  4431. _14 = 0,
  4432. _15 = this.fieldHeaderLevel,
  4433. _16 = _15 && _15.titles ? _15.titles : [];
  4434. if (_15.headerWidth) this.columnWidth = _15.headerWidth;
  4435. var _17 = _12.getTime(),
  4436. _18 = this.getHeaderButtonWidth(),
  4437. _19 = 0,
  4438. _20 = _19 + _18,
  4439. _21 = this.getTimePerCell("d"),
  4440. _22 = _21 > 1,
  4441. _23;
  4442. this.$178u = 0;
  4443. while (_11.getTime() <= _17) {
  4444. var _24 = _11.duplicate(),
  4445. _25 = _22 || _2.shouldShowDate(_11, this);
  4446. _24 = isc.DateUtil.getStartOf(_24.duplicate(), _2.timelineGranularity);
  4447. if (_24.getTime() >= _17) break;
  4448. this.$178u++;
  4449. _23 = isc.DateUtil.getEndOf(this.addUnits(_11.duplicate(), _13), _2.timelineGranularity);
  4450. var _26 = null;
  4451. if (_23.getTime() > _17) {
  4452. _23.setTime(_17)
  4453. }
  4454. if (_25) {
  4455. var _27 = this.getInnerFieldTitle(_15, _14, _11);
  4456. _26 = isc.addProperties({}, {
  4457. name: "f" + _14,
  4458. headerLevel: _15,
  4459. title: _27,
  4460. width: _15.headerWidth || this.getHeaderButtonWidth(),
  4461. cellAlign: _15.cellAlign,
  4462. cellVAlign: _15.cellVAlign,
  4463. date: _24.duplicate(),
  4464. logicalDate: isc.DateUtil.getLogicalDateOnly(_24),
  4465. logicalTime: isc.DateUtil.getLogicalTimeOnly(_24),
  4466. canGroup: false,
  4467. canSort: false,
  4468. canFreeze: false,
  4469. canFocus: false,
  4470. startLeftOffset: _19,
  4471. endLeftOffset: _20
  4472. }, _3, this.getFieldProperties(_24))
  4473. }
  4474. _11 = _23.duplicate();
  4475. if (_25) {
  4476. _26.endDate = _11.duplicate();
  4477. _26.endDate.setTime(_26.endDate.getTime() - 1);
  4478. _26.logicalEndDate = isc.DateUtil.getLogicalDateOnly(_11);
  4479. _26.logicalEndTime = isc.DateUtil.getLogicalTimeOnly(_11), _1.add(_26);
  4480. _14++;
  4481. _19 += _18;
  4482. _20 += _18
  4483. }
  4484. if (_1.length >= this.maximumTimelineColumns) {
  4485. this.endDate = _11.duplicate();
  4486. this.logWarn("Date-range too large - limiting to " + this.maximumTimelineColumns + " columns.");
  4487. break
  4488. }
  4489. }
  4490. this.$178u--;
  4491. for (var i = 0, _28 = _1.length; i < _28; i++) {
  4492. var _29 = _1[i];
  4493. isc.addProperties(_29, _3);
  4494. _29.headerLevel = this.fieldHeaderLevel
  4495. }
  4496. this.buildHeaderSpans(_1, this.headerLevels, this.startDate, this.endDate);
  4497. this.$116z = _14 - 1;
  4498. this.buildSnapGapList("calcFields");
  4499. return _1
  4500. });
  4501. isc.evalBoundary;
  4502. isc.B.push(isc.A.redraw = function isc_TimelineView_redraw() {
  4503. this.Super("redraw", arguments);
  4504. if (!this.animateFolders && this.$129z) {
  4505. delete this.$129z;
  4506. this.refreshVisibleEvents(null, null, "redraw")
  4507. }
  4508. }, isc.A.toggleFolder = function isc_TimelineView_toggleFolder(_1) {
  4509. this.Super("toggleFolder", arguments);
  4510. if (!this.animateFolders) {
  4511. this.$129z = true;
  4512. this.markForRedraw()
  4513. }
  4514. }, isc.A.rowAnimationComplete = function isc_TimelineView_rowAnimationComplete(_1, _2) {
  4515. this.Super("rowAnimationComplete", arguments);
  4516. if (!this.$64v) {
  4517. delete this.body.$8s;
  4518. this.refreshVisibleEvents()
  4519. }
  4520. }, isc.A.adjustTimelineForHeaders = function isc_TimelineView_adjustTimelineForHeaders() {
  4521. var _1 = this.calendar,
  4522. _2 = this.fieldHeaderLevel ? this.fieldHeaderLevel.unit : _1.timelineGranularity,
  4523. _3 = _1.startDate,
  4524. _4 = new Date(_1.endDate.getTime() - 1);
  4525. var _5 = isc.DateUtil.getTimeUnitKey(_2);
  4526. _1.startDate = this.startDate = isc.DateUtil.getStartOf(_3, _5, false, _1.firstDayOfWeek);
  4527. _1.endDate = this.endDate = isc.DateUtil.getEndOf(_4, _5, false, _1.firstDayOfWeek)
  4528. }, isc.A.buildHeaderSpans = function isc_TimelineView_buildHeaderSpans(_1, _2, _3, _4) {
  4529. var _5 = _3.duplicate(),
  4530. c = this.calendar,
  4531. _7 = [],
  4532. _8 = [];
  4533. if (_2 && _2.length > 0) {
  4534. _8 = this.getHeaderSpans(_3, _4, _2, 0, _1);
  4535. this.headerHeight = this.$963 + (_2.length * this.headerSpanHeight)
  4536. }
  4537. if (_8 && _8.length > 0) {
  4538. this.setHeaderSpans(_8, true)
  4539. }
  4540. }, isc.A.getHeaderSpans = function isc_TimelineView_getHeaderSpans(_1, _2, _3, _4, _5) {
  4541. var _6 = _1.duplicate(),
  4542. c = this.calendar,
  4543. _8 = _3[_4],
  4544. _9 = _8.unit,
  4545. _10 = _4 > 0 ? _3[_4 - 1].unit : _9,
  4546. _11 = c.timelineUnitsPerColumn,
  4547. _12 = _8.titles || [],
  4548. _13 = [],
  4549. _14 = 0;
  4550. if (_4 > 0) {
  4551. if (isc.DateUtil.compareTimeUnits(_9, _10) > 0) {
  4552. isc.logWarn("The order of the specified HeaderLevels is incorrect - '" + _9 + "' is of a larger granularity than '" + _10 + "'")
  4553. }
  4554. }
  4555. var _15 = isc.DateUtil;
  4556. var _16 = true;
  4557. while (_6 <= _2) {
  4558. _15.dateAdd(_6, "mn", 1, 1);
  4559. if (_16) {
  4560. _16 = false;
  4561. var _17 = isc.DateUtil.getEndOf(_6.duplicate(), isc.DateUtil.getTimeUnitKey(_9), false, c.firstDayOfWeek)
  4562. } else {
  4563. var _17 = this.addUnits(_6.duplicate(), _11, _9)
  4564. }
  4565. var _18 = {
  4566. unit: _9,
  4567. hoverDelay: this.hoverDelay + 1,
  4568. hoverMoveWithMouse: true,
  4569. canHover: this.shouldShowHeaderHovers(),
  4570. showHover: this.shouldShowHeaderHovers(),
  4571. canFocus: false,
  4572. headerLevel: _8,
  4573. mouseMove: function() {
  4574. var _19 = this.creator;
  4575. if (_19.shouldShowHeaderHovers()) {
  4576. if (isc.Hover.lastHoverTarget != _19) _19.startHover();
  4577. else _19.updateHover();
  4578. return isc.EH.STOP_BUBBLING
  4579. }
  4580. },
  4581. getHoverHTML: function() {
  4582. var _19 = this.creator;
  4583. return _19.calendar.$140e(_19, this.headerLevel, this, this.startDate, this.endDate)
  4584. }
  4585. };
  4586. _18[c.startDateField] = _6.duplicate();
  4587. _18[c.endDateField] = _17.duplicate();
  4588. this.setSpanDates(_18, _6.duplicate());
  4589. _17 = _18.endDate;
  4590. var _20 = this.getHeaderLevelTitle(_8, _14, _6, _17);
  4591. _18.title = _20;
  4592. _18.fields = [];
  4593. for (var i = 0; i < _5.length; i++) {
  4594. var _22 = _5[i];
  4595. if (_22.isLaneField || _22.date < _18.startDate) continue;
  4596. if (_22.date >= _18.endDate) break;
  4597. _22.headerLevel = _3[_4];
  4598. _18.fields.add(_22.name)
  4599. }
  4600. if (_4 < _3.length - 1) {
  4601. _18.spans = this.getHeaderSpans(_18.startDate, _18.endDate, _3, _4 + 1, _5);
  4602. if (_18.spans && _18.spans.length > 0) _18.fields = null;
  4603. if (_8.titles && _8.titles.length != _18.spans.length) {
  4604. isc.logWarn("The titles array provided for the " + _8.unit + " levelHeader has a length mismatch: expected " + _18.spans.length + " but " + _8.titles.length + " are present. Some titles may be auto-generated according to TimeUnit.")
  4605. }
  4606. }
  4607. _13.add(isc.clone(_18));
  4608. _6 = _17.duplicate();
  4609. _14++
  4610. }
  4611. return _13
  4612. }, isc.A.getHeaderLevelTitle = function isc_TimelineView_getHeaderLevelTitle(_1, _2, _3, _4) {
  4613. var _5 = _1.unit,
  4614. _6 = _1.titles ? _1.titles[_2] : null;
  4615. if (!_6) {
  4616. if (_5 == "century" || _5 == "decade") {
  4617. _6 = _3.getFullYear() + " - " + _3.getFullYear()
  4618. } else if (_5 == "year") {
  4619. _6 = _3.getFullYear()
  4620. } else if (_5 == "quarter") {
  4621. _6 = _3.getShortMonthName() + " - " + _4.getShortMonthName()
  4622. } else if (_5 == "month") {
  4623. _6 = _3.getShortMonthName()
  4624. } else if (_5 == "week") {
  4625. var _7 = isc.DateUtil.getStartOf(_3.duplicate(), "W", null, this.calendar.firstDayOfWeek);
  4626. _7.setDate(_7.getDate() + (_7.firstWeekIncludesDay - this.calendar.firstDayOfWeek));
  4627. _6 = this.calendar.weekPrefix + " " + _7.getWeek(this.calendar.firstDayOfWeek)
  4628. } else if (_5 == "day") {
  4629. _6 = _3.getShortDayName()
  4630. } else {
  4631. if (_5 == "hour") _6 = _3.getHours();
  4632. if (_5 == "minute") _6 = _3.getMinutes();
  4633. if (_5 == "second") _6 = _3.getSeconds();
  4634. if (_5 == "millisecond") _6 = _3.getMilliseconds();
  4635. if (_5 == "hour") _6 = _3.getHours()
  4636. }
  4637. _6 = "" + _6;
  4638. if (isc.isA.Function(_1.titleFormatter)) {
  4639. _6 = _1.titleFormatter(_1, _3, _4, _6, this.calendar)
  4640. }
  4641. }
  4642. return _6
  4643. }, isc.A.setSpanDates = function isc_TimelineView_setSpanDates(_1, _2) {
  4644. var _3 = isc.DateUtil.getTimeUnitKey(_1.unit);
  4645. _1.startDate = isc.DateUtil.getStartOf(_2, _3, null, this.calendar.firstDayOfWeek);
  4646. _1.endDate = isc.DateUtil.getEndOf(_1.startDate, _3, null, this.calendar.firstDayOfWeek)
  4647. }, isc.A.getFieldProperties = function isc_TimelineView_getFieldProperties(_1) {
  4648. return null
  4649. }, isc.A.getInnerFieldTitle = function isc_TimelineView_getInnerFieldTitle(_1, _2, _3, _4) {
  4650. var _5 = _1.unit,
  4651. _6 = _1.titles ? _1.titles[_2] : null;
  4652. if (!_6) {
  4653. if (_5 == "year") {
  4654. _6 = _3.getFullYear()
  4655. } else if (_5 == "month") {
  4656. _6 = _3.getShortMonthName()
  4657. } else if (_5 == "week") {
  4658. var _7 = isc.DateUtil.getStartOf(_3.duplicate(), "W", null, this.calendar.firstDayOfWeek);
  4659. _7.setDate(_7.getDate() + (_7.firstWeekIncludesDay - this.calendar.firstDayOfWeek));
  4660. _6 = this.calendar.weekPrefix + " " + _7.getWeek(this.calendar.firstDayOfWeek)
  4661. } else if (_5 == "day") {
  4662. _6 = (_3.getMonth() + 1) + "/" + _3.getDate()
  4663. } else {
  4664. var _8 = _3.getMinutes().toString();
  4665. if (_8.length == 1) _8 = "0" + _8;
  4666. _6 = _3.getHours() + ":" + _8
  4667. }
  4668. if (isc.isA.Function(_1.titleFormatter)) {
  4669. _6 = _1.titleFormatter(_1, _3, _4, _6, this.calendar)
  4670. }
  4671. }
  4672. return _6
  4673. }, isc.A.draw = function isc_TimelineView_draw(_1, _2, _3, _4) {
  4674. this.invokeSuper(isc.TimelineView, "draw", _1, _2, _3, _4);
  4675. this.body.snapHGap = this.getHeaderButtonWidth();
  4676. if (this.scrollToToday != false) {
  4677. var _5 = new Date();
  4678. _5.setDate(_5.getDate() - this.scrollToToday);
  4679. var _6 = this.calendar.getDayDiff(this.startDate, _5);
  4680. var _7 = _6 * this.getHeaderButtonWidth();
  4681. this.bodies[1].scrollTo(_7, 0)
  4682. }
  4683. this.logDebug('draw', 'calendar');
  4684. this.body.addChild(this.eventDragTarget);
  4685. this.eventDragTarget.setView(this)
  4686. }, isc.A.formatDateForDisplay = function isc_TimelineView_formatDateForDisplay(_1) {
  4687. return _1.getShortMonthName() + " " + _1.getDate() + ", " + _1.getFullYear()
  4688. }, isc.A.getLabelColCount = function isc_TimelineView_getLabelColCount() {
  4689. if (this.calendar.laneFields) {
  4690. return this.calendar.laneFields.length
  4691. } else {
  4692. return 1
  4693. }
  4694. }, isc.A.isLabelCol = function isc_TimelineView_isLabelCol(_1) {
  4695. var _2 = this.getField(_1);
  4696. return _2 && _2.frozen
  4697. }, isc.A.showField = function isc_TimelineView_showField() {
  4698. this.Super("showField", arguments);
  4699. this.refreshEvents()
  4700. }, isc.A.hideField = function isc_TimelineView_hideField() {
  4701. this.Super("hideField", arguments);
  4702. this.refreshEvents()
  4703. }, isc.A.getCellStyle = function isc_TimelineView_getCellStyle(_1, _2, _3) {
  4704. if (_1.$52e) return this.Super("getCellStyle", arguments);
  4705. var _4 = this.getBaseStyle(_1, _2, _3);
  4706. if (_3 == null) return _4;
  4707. var _5 = !this.isLabelCol(_3);
  4708. if (_5) {
  4709. var _6 = _3 - (this.frozenBody ? this.frozenBody.fields.length : 0);
  4710. var _7 = this.getCellDate(_2, _6);
  4711. if (_7 && this.calendar.shouldDisableDate(_7, this)) {
  4712. _4 += "Disabled"
  4713. }
  4714. }
  4715. if (!this.$158l && this.calendar.showLaneRollOver) {
  4716. var _8 = this.getFieldBody(_3),
  4717. _9 = _8.lastOverRow;
  4718. if (_2 != null && _9 != null && _2 == _9) _4 += "Over"
  4719. }
  4720. if (this.alternateRecordStyles && _2 % 2 != 0) _4 += "Dark";
  4721. return _4
  4722. }, isc.A.getBaseStyle = function isc_TimelineView_getBaseStyle(_1, _2, _3) {
  4723. var _4 = this.calendar;
  4724. if (_1.$52e) return this.groupNodeBaseStyle;
  4725. else if (this.isLabelCol(_3)) return this.labelColumnBaseStyle;
  4726. else {
  4727. var _5 = _4.getCellDate(_2, _3, this),
  4728. _6 = _5 && _4.getDateStyle ? _4.getDateStyle(_5, _2, _3, this) : null;
  4729. return _6 || this.baseStyle
  4730. }
  4731. }, isc.A.slideRange = function isc_TimelineView_slideRange(_1) {
  4732. var c = this.calendar,
  4733. _3 = c.timelineGranularity.toLowerCase(),
  4734. _4 = isc.DateUtil.getTimeUnitKey(_3),
  4735. _5 = c.timelineUnitsPerColumn || 1,
  4736. _6 = this.startDate.duplicate(),
  4737. _7 = this.endDate.duplicate(),
  4738. _8 = _1 ? 1 : -1,
  4739. _9 = c.columnsPerPage || (this.getFields().length - this.getLabelColCount());
  4740. _6 = isc.DateUtil.dateAdd(_6, _4, _9 * _5, _8, false);
  4741. _6 = isc.DateUtil.getStartOf(_6, _4, false, c.firstDayOfWeek);
  4742. _7 = isc.DateUtil.dateAdd(_7, _4, _9 * _5, _8, false);
  4743. _7 = isc.DateUtil.getEndOf(_7, _4, false, c.firstDayOfWeek);
  4744. this.setTimelineRange(_6, _7, _3, null, _5, null, false)
  4745. }, isc.A.nextOrPrev = function isc_TimelineView_nextOrPrev(_1) {
  4746. this.slideRange(_1)
  4747. }, isc.A.compareDates = function isc_TimelineView_compareDates(_1, _2, _3) {
  4748. if (_1.getFullYear() < _2.getFullYear()) {
  4749. return 1
  4750. } else if (_1.getFullYear() > _2.getFullYear()) {
  4751. return -1
  4752. }
  4753. if (_1.getMonth() < _2.getMonth()) {
  4754. return 1
  4755. } else if (_1.getMonth() > _2.getMonth()) {
  4756. return -1
  4757. }
  4758. if (_1.getDate() < _2.getDate()) {
  4759. return 1
  4760. } else if (_1.getDate() > _2.getDate()) {
  4761. return -1
  4762. }
  4763. return 0
  4764. }, isc.A.getDateFromPoint = function isc_TimelineView_getDateFromPoint(_1, _2, _3, _4) {
  4765. var _5 = this.calendar;
  4766. if (_1 == null && _2 == null) {
  4767. _1 = this.body.getOffsetX()
  4768. }
  4769. var _6 = this.getSnapData(_1, null, null, true);
  4770. if (_6) {
  4771. if (_6.nextValidSnap) {
  4772. return _6.nextValidSnap.startDate.duplicate()
  4773. } else if (_6.lastValidSnap) {
  4774. return _6.lastValidSnap.endDate.duplicate()
  4775. }
  4776. return _6.startDate.duplicate()
  4777. }
  4778. if (_1 < 0 || _2 < 0) return null;
  4779. var _7 = this.body.getEventColumn(_1);
  4780. if (_7 == -2) _7 = this.body.fields.length - 1;
  4781. if (_7 == -1) return null;
  4782. if (_4 == null) _4 = true;
  4783. var _8 = Math.max(_5.getSnapGapPixels(this), 1);
  4784. if (_4) {
  4785. var r = _1 % _8;
  4786. if (r) _1 -= r
  4787. }
  4788. var _10 = this.body.fields[_7].date,
  4789. _11 = this.body.getColumnLeft(_7),
  4790. _12 = _1 - _11,
  4791. _13 = Math.floor(_12 / _8);
  4792. if (_13) _10 = _5.addSnapGapsToDate(_10.duplicate(), this, _13);
  4793. return _10
  4794. }, isc.A.$732 = function isc_TimelineView__getEventBreadth(_1, _2) {
  4795. var _3 = _1 && _1["_" + this.viewName];
  4796. if (_3) {
  4797. if (_2 && _3.exactBreadth) return _3.exactBreadth;
  4798. if (!_2 && _3.snapBreadth) return _3.snapBreadth
  4799. }
  4800. var _4 = this.calendar,
  4801. _5 = _4.getEventStartDate(_1).getTime(),
  4802. _6 = _4.getEventEndDate(_1).getTime(),
  4803. _7 = this.$27q.rangeStartMillis || _4.getVisibleStartDate(this).getTime(),
  4804. _8 = this.$27q.rangeEndMillis || _4.getVisibleEndDate(this).getTime();
  4805. var _9 = this.getDateLeftOffset(_5, null, _2),
  4806. _10 = this.getDateRightOffset(_6 - 1, _2),
  4807. _11 = _10 - _9;
  4808. if (_3) {
  4809. if (_2) _3.exactBreadth = _11;
  4810. else _3.snapBreadth = _11
  4811. }
  4812. return _11
  4813. }, isc.A.getDateRightOffset = function isc_TimelineView_getDateRightOffset(_1, _2) {
  4814. if (!_1) return 0;
  4815. var _3 = this.getSnapData(null, null, _1, true);
  4816. if (_3) {
  4817. if (_3.lastValidSnap) {
  4818. return _3.lastValidSnap.endLeftOffset
  4819. }
  4820. return _3.endLeftOffset
  4821. }
  4822. }, isc.A.getDateLeftOffset = function isc_TimelineView_getDateLeftOffset(_1, _2, _3) {
  4823. if (!_1) return 0;
  4824. var _4 = this.getSnapData(null, null, _1, true);
  4825. if (_4) {
  4826. if (_4.nextValidSnap) {
  4827. return _4.nextValidSnap.startLeftOffset
  4828. } else if (_4.lastValidSnap) {
  4829. return _4.lastValidSnap.endLeftOffset
  4830. }
  4831. return _4.startLeftOffset
  4832. }
  4833. var _5 = this.calendar.getVisibleStartDate(this).getTime();
  4834. var _6 = this.calendar.getVisibleEndDate(this).getTime();
  4835. var _7 = isc.isA.Number(_1) ? _1 : _1.getTime();
  4836. if (_7 <= _5) _7 = _5 + 1;
  4837. if (_7 >= _6) _7 = _6;
  4838. var _8 = this.calendar,
  4839. _9 = _8.getSnapGapPixels(this),
  4840. _10 = _8.getSnapGapMinutes(this);
  4841. var _11 = this.body.fields,
  4842. _12 = _11.getLength(),
  4843. _13 = Math.floor(_7 / 60000),
  4844. _14 = this.body.getColumnWidth(0),
  4845. _15 = this.getTimePerCell("mn");
  4846. for (var i = 0; i < _12; i++) {
  4847. var _17 = _11[i];
  4848. var _18 = _17.date.getTime(),
  4849. _19 = _17.endDate.getTime(),
  4850. _20 = Math.floor(_17.date.getTime() / 60000),
  4851. _21 = Math.floor(_17.endDate.getTime() / 60000);
  4852. if (_13 == _21) {
  4853. return this.body.getColumnLeft(i) + _14
  4854. } else if (_13 < _21) {
  4855. if (_13 == _20) {
  4856. return this.body.getColumnLeft(i)
  4857. } else if (_13 > _20) {
  4858. var _22 = (_14 * i),
  4859. _23 = _13 - _20,
  4860. _24 = Math.floor(_23 / _10),
  4861. _25 = _23 % _10;
  4862. if (_2) {
  4863. if (_25 > 0 || _23 < _10) _24++
  4864. }
  4865. var _26 = _22 + Math.round((_24 * _9));
  4866. if (_3) _26 += Math.round(_8.getMinutePixels(_25, null, this));
  4867. return _26
  4868. } else {
  4869. return (_14 * i)
  4870. }
  4871. }
  4872. }
  4873. return -1
  4874. }, isc.A.getEventLeft = function isc_TimelineView_getEventLeft(_1) {
  4875. return this.getDateLeftOffset(this.calendar.getEventStartDate(_1))
  4876. }, isc.A.getEventRight = function isc_TimelineView_getEventRight(_1) {
  4877. return this.getDateRightOffset(this.calendar.getEventEndDate(_1))
  4878. }, isc.A.getLaneHeight = function isc_TimelineView_getLaneHeight(_1) {
  4879. if (_1 == null) return;
  4880. if (isc.isA.Number(_1)) _1 = this.getRecord(_1);
  4881. else if (isc.isA.String(_1)) _1 = this.getLane(_1);
  4882. return (_1 && _1.height) || this.cellHeight
  4883. }, isc.A.getSublaneHeight = function isc_TimelineView_getSublaneHeight(_1, _2) {
  4884. if (!isc.isAn.Object(_1)) {
  4885. if (!_2 || !_2.sublanes) return null;
  4886. if (isc.isA.Number(_1)) _1 = _2.sublanes[_1];
  4887. else if (isc.isA.String(_1)) {
  4888. _1 = _2.sublanes.find(this.calendar.laneNameField, _1)
  4889. }
  4890. }
  4891. return _1 ? _1.height : null
  4892. }, isc.A.addLeadingAndTrailingLines = function isc_TimelineView_addLeadingAndTrailingLines(_1) {
  4893. var _2, _3, _4, _5;
  4894. if (_1.$645) {
  4895. _2 = _1.$645[0];
  4896. _3 = _1.$645[1];
  4897. _4 = _1.$645[2];
  4898. _5 = _1.$645[3]
  4899. } else {
  4900. _2 = this.$65r();
  4901. _3 = this.$65s(_1, "lead");
  4902. _4 = this.$65r();
  4903. _5 = this.$65s(_1, "trail")
  4904. }
  4905. var _6 = this.$65t(_3, _2);
  4906. var _7 = this.$65t(_5, _4);
  4907. if (!_1.$645) {
  4908. this.body.addChild(_2);
  4909. this.body.addChild(_3);
  4910. this.body.addChild(_4);
  4911. this.body.addChild(_5);
  4912. _1.$645 = [_2, _3, _4, _5]
  4913. }
  4914. }, isc.A.$65t = function isc_TimelineView__positionIcon(_1, _2) {
  4915. var _3 = this.calendar,
  4916. _4 = _1.eventCanvas,
  4917. _5 = _4.event,
  4918. _6 = _1.type,
  4919. _7 = this.getHeaderButtonWidth(),
  4920. _8 = _4.getVisibleHeight(),
  4921. _9 = _4.getTop(),
  4922. _10 = _4.getLeft();
  4923. var _11, _12, _13 = true;
  4924. if (_6 == "trail") {
  4925. if (this.compareDates(_5[_3.trailingDateField], this.endDate) < 0) {
  4926. _11 = _3.getDayDiff(this.endDate, _5[_3.startDateField]);
  4927. if (_11 < 1) _11 = 1;
  4928. _12 = _11 * _7;
  4929. _13 = false
  4930. } else {
  4931. _11 = _3.getDayDiff(_5[_3.trailingDateField], _5[_3.startDateField]);
  4932. _12 = (_11 * _7) - (Math.round(_7 / 2))
  4933. }
  4934. } else {
  4935. if (this.compareDates(this.startDate, _5[_3.leadingDateField]) < 0) {
  4936. _11 = _3.getDayDiff(this.startDate, _3.getEventStartDate(_5));
  4937. if (_11 < 1) _11 = 1;
  4938. _12 = _11 * _7;
  4939. _13 = false
  4940. } else {
  4941. _11 = _3.getDayDiff(_5[_3.leadingDateField], _3.getEventStartDate(_5));
  4942. _12 = (_11 * _7) - (Math.round(_7 / 2))
  4943. }
  4944. }
  4945. var _14 = (_6 == "trail" ? _10 + _7 : _10 - _12);
  4946. _2.moveTo(_14, _9 + (Math.round(_8 / _3.getRowsPerHour(this))));
  4947. _2.setWidth(_12);
  4948. var _15 = 0;
  4949. if (_5.$646 && _5.$646.slotNum > 0) {
  4950. _15 = (_5.$646.slotNum - 1) * _8
  4951. }
  4952. var _16 = (_6 == "trail" ? this.trailIconSize : this.leadIconSize);
  4953. var _17;
  4954. if (_13 == false) _17 = -50;
  4955. else if (_6 == "trail") _17 = _10 + _7 + _12 - Math.round(_16 / 2);
  4956. else _17 = _10 - _12 - Math.round(_16 / 2);
  4957. _1.moveTo(_17, _9 + Math.round(_8 / 2) - Math.round(_16 / 2));
  4958. _1.$647 = Math.round(_8 / 2) - Math.round(_16 / 2) + _15;
  4959. _1.$648 = Math.round(_7 / 2) - Math.round(_16 / 2);
  4960. _1.$65f = _3.getDayDiff(_3.getEventStartDate(_5), this.startDate);
  4961. return _13
  4962. }, isc.A.$65s = function isc_TimelineView__makeIcon(_1, _2) {
  4963. var _3 = (_2 == "trail" ? this.trailIconSize : this.leadIconSize);
  4964. var _4 = isc.Img.create({
  4965. eventCanvas: _1,
  4966. type: _2,
  4967. autoDraw: false,
  4968. _redrawWithParent: false,
  4969. src: (_2 == "trail" ? this.trailingEndPointImage : this.leadingEndPointImage),
  4970. width: _3,
  4971. height: _3,
  4972. canDragReposition: (this.calendar.canEditEvents == true),
  4973. dragRepositionStart: function() {
  4974. this.$1245.$8l = this.parentElement.getEventRow();
  4975. this.$1245.$644 = this.parentElement.getEventColumn();
  4976. this.parentElement.VSnapOrigin = this.$647;
  4977. this.parentElement.HSnapOrigin = this.$648
  4978. },
  4979. dragRepositionStop: function() {
  4980. var _5 = this.$65f,
  4981. _6 = this.$1245.$644,
  4982. _7 = this.parentElement.getEventColumn(),
  4983. _8 = _7 - _6,
  4984. _9 = this.eventCanvas.event,
  4985. _10 = this.eventCanvas.calendar,
  4986. _11 = this.type == "trail" ? _7 - _5 : _5 - _7;
  4987. if (_11 < 1) return false;
  4988. var _12 = {};
  4989. var _13 = this.type == "trail" ? _10.trailingDateField : _10.leadingDateField;
  4990. var _14 = _9[_13].duplicate();
  4991. _14.setDate(_14.getDate() + _8);
  4992. _12[_13] = _14;
  4993. _10.updateEvent(_9, _10.getEventStartDate(_9), _10.getEventEndDate(_9), _9[_10.nameField], _9[_10.descriptionField], _12, true);
  4994. return true
  4995. }
  4996. });
  4997. return _4
  4998. }, isc.A.$65r = function isc_TimelineView__makeLine() {
  4999. var _1 = isc.Canvas.create({
  5000. autoDraw: false,
  5001. _redrawWithParent: false,
  5002. height: 2,
  5003. overflow: "hidden",
  5004. styleName: "eventLine"
  5005. });
  5006. return _1
  5007. }, isc.A.updateEventWindow = function isc_TimelineView_updateEventWindow(_1) {
  5008. if (!this.body || !this.body.children) return;
  5009. var _2 = this.calendar,
  5010. _3 = _1[_2.laneNameField];
  5011. var _4 = this.tagDataForOverlap(_2.data.getRange(0, _2.data.getLength()), _3);
  5012. if (this.renderEventsOnDemand) {
  5013. this.refreshVisibleEvents(null, null, "updateEventWindow")
  5014. } else {
  5015. for (var i = 0; i < _4.length; i++) {
  5016. var _6 = _4.get(i),
  5017. _7 = this.getCurrentEventCanvas(this, _6);
  5018. _7.event = _6;
  5019. this.sizeEventCanvas(_7)
  5020. }
  5021. }
  5022. }, isc.A.getEventCanvasConstructor = function isc_TimelineView_getEventCanvasConstructor(_1) {
  5023. if (this.eventCanvasConstructor) return this.eventCanvasConstructor;
  5024. if (this.calendar.eventCanvasConstructor == "EventWindow") return "TimelineWindow";
  5025. return null
  5026. });
  5027. isc.B._maxIndex = isc.C + 79;
  5028. isc.A = isc.DaySchedule;
  5029. isc.B = isc._allFuncs;
  5030. isc.C = isc.B._maxIndex;
  5031. isc.D = isc._funcClasses;
  5032. isc.D[isc.C] = isc.A.Class;
  5033. isc.B.push(isc.A.$126v = function isc_c_DaySchedule__getEventScaffolding(_1, _2, _3) {
  5034. var _4 = _2.getTimePerCell(),
  5035. _5 = (60 / _4) * 24,
  5036. _6 = [],
  5037. _7 = {
  5038. label: "",
  5039. day1: "",
  5040. day2: "",
  5041. day3: "",
  5042. day4: "",
  5043. day5: "",
  5044. day6: "",
  5045. day7: ""
  5046. },
  5047. _8 = _3 || new Date(),
  5048. _9 = new Date(_8.getFullYear(), _8.getMonth(), _8.getDate(), 0, 0, 0, 0),
  5049. _10 = [],
  5050. _11 = _2.isDayView();
  5051. if (_11) isc.DaySchedule.$129g(_1, _2, _9.duplicate());
  5052. for (var i = 0; i < _5; i++) {
  5053. var _13 = _9.duplicate();
  5054. _6.add(isc.addProperties({}, _7, {
  5055. time: _13
  5056. }));
  5057. _9 = isc.DateUtil.dateAdd(_9, "mn", _4, 1)
  5058. }
  5059. return _6
  5060. }, isc.A.$129g = function isc_c_DaySchedule__getCellDates(_1, _2, _3) {
  5061. _3 = _3 || new Date();
  5062. var _4 = _2.getTimePerCell(),
  5063. _5 = _3.duplicate(),
  5064. _6 = new Date(_5.getFullYear(), _5.getMonth(), _5.getDate(), 0, 0, 0, 0),
  5065. _7 = (60 / _4) * 24,
  5066. _8 = _2.isDayView() ? 1 : 7,
  5067. _9 = [];
  5068. _2.$142y = null;
  5069. for (var j = 0; j < _8; j++) {
  5070. var _11 = _6.duplicate(),
  5071. _12 = _11.duplicate();
  5072. for (var i = 0; i <= _7; i++) {
  5073. if (!_9[i]) _9[i] = {};
  5074. _9[i]["day" + (j + 1)] = _12;
  5075. var _14 = _4 * (i + 1);
  5076. var _15 = isc.DateUtil.dateAdd(_11.duplicate(), "mn", _14, 1);
  5077. var _16 = isc.DateUtil.getLogicalTimeOnly(_15, true);
  5078. var _16 = isc.DateUtil.getLogicalTimeOnly(_11, true);
  5079. _16.setTime(_16.getTime() + (_14 * 60000));
  5080. var _17 = _12.getDate(),
  5081. _18 = _15.getDate(),
  5082. _19 = _16.getHours(),
  5083. _20 = _16.getMinutes(),
  5084. _21 = _15.getHours(),
  5085. _22 = _15.getMinutes();
  5086. if (_2.calendar.ignoreDST) {
  5087. _12 = _15.duplicate()
  5088. } else {
  5089. if (_19 != _21 || _20 != _22) {
  5090. if (!_2.$142y) _2.$142y = [];
  5091. _2.$142y.add({
  5092. rowNum: i + 1,
  5093. colNum: j
  5094. })
  5095. } else {
  5096. _12 = _15.duplicate()
  5097. }
  5098. }
  5099. }
  5100. _6 = isc.DateUtil.dateAdd(_6.duplicate(), "d", 1)
  5101. }
  5102. _2.$129f = _9;
  5103. return _9
  5104. });
  5105. isc.B._maxIndex = isc.C + 2;
  5106. isc.ClassFactory.defineClass("Calendar", "Canvas", "DataBoundComponent");
  5107. isc.A = isc.Calendar.getPrototype();
  5108. isc.B = isc._allFuncs;
  5109. isc.C = isc.B._maxIndex;
  5110. isc.D = isc._funcClasses;
  5111. isc.D[isc.C] = isc.A.Class;
  5112. isc.A.defaultWidth = "100%";
  5113. isc.A.defaultHeight = "100%";
  5114. isc.A.year = new Date().getFullYear();
  5115. isc.A.month = new Date().getMonth();
  5116. isc.A.baseStyle = "calendar";
  5117. isc.A.dayHeaderBaseStyle = "calMonthDayHeader";
  5118. isc.A.dayBodyBaseStyle = "calMonthDayBody";
  5119. isc.A.otherDayHeaderBaseStyle = "calMonthOtherDayHeader";
  5120. isc.A.otherDayBodyBaseStyle = "calMonthOtherDayBody";
  5121. isc.A.otherDayBlankStyle = "calMonthOtherDayBlank";
  5122. isc.A.minimumDayHeight = 80;
  5123. isc.A.selectedCellStyle = "calendarCellSelected";
  5124. isc.A.eventStyleName = "eventWindow";
  5125. isc.A.calMonthEventLinkStyle = "calMonthEventLink";
  5126. isc.A.workdayBaseStyle = "calendarWorkday";
  5127. isc.A.workdayStart = "9:00am";
  5128. isc.A.workdayEnd = "5:00pm";
  5129. isc.A.showWorkday = false;
  5130. isc.A.workdays = [1, 2, 3, 4, 5];
  5131. isc.A.scrollToWorkday = false;
  5132. isc.A.minutesPerRow = 30;
  5133. isc.A.rowTitleFrequency = 60;
  5134. isc.A.nameField = "name";
  5135. isc.A.descriptionField = "description";
  5136. isc.A.startDateField = "startDate";
  5137. isc.A.endDateField = "endDate";
  5138. isc.A.durationField = "duration";
  5139. isc.A.durationUnitField = "durationUnit";
  5140. isc.A.laneNameField = "lane";
  5141. isc.A.sublaneNameField = "sublane";
  5142. isc.A.leadingDateField = "leadingDate";
  5143. isc.A.trailingDateField = "trailingDate";
  5144. isc.A.labelColumnWidth = 60;
  5145. isc.A.eventWindowStyleField = "eventWindowStyle";
  5146. isc.A.eventStyleNameField = "styleName";
  5147. isc.A.canEditField = "canEdit";
  5148. isc.A.canEditLaneField = "canEditLane";
  5149. isc.A.canEditSublaneField = "canEditSublane";
  5150. isc.A.canRemoveField = "canRemove";
  5151. isc.A.canDragEventField = "canDrag";
  5152. isc.A.canResizeEventField = "canResize";
  5153. isc.A.durationUnitOptions = ["minute", "hour", "day", "week"];
  5154. isc.A.laneEventPadding = 0;
  5155. isc.A.eventDragGap = 10;
  5156. isc.A.weekEventBorderOverlap = false;
  5157. isc.A.showQuickEventDialog = true;
  5158. isc.A.canCreateEvents = true;
  5159. isc.A.canEditEvents = true;
  5160. isc.A.canRemoveEvents = true;
  5161. isc.A.canDragEvents = null;
  5162. isc.A.canResizeEvents = true;
  5163. isc.A.showDateChooser = false;
  5164. isc.A.disableWeekends = true;
  5165. isc.A.showWeekends = true;
  5166. isc.A.showDayHeaders = true;
  5167. isc.A.showOtherDays = true;
  5168. isc.A.selectChosenDate = true;
  5169. isc.A.eventAutoArrange = true;
  5170. isc.A.eventOverlap = true;
  5171. isc.A.eventOverlapPercent = 10;
  5172. isc.A.minimalUI = null;
  5173. isc.A.canDragCreateEvents = null;
  5174. isc.A.alternateLaneFrequency = 1;
  5175. isc.A.showTimelineView = false;
  5176. isc.A.renderEventsOnDemand = true;
  5177. isc.A.timelineGranularity = "day";
  5178. isc.A.timelineUnitsPerColumn = 1;
  5179. isc.A.canResizeTimelineEvents = false;
  5180. isc.A.defaultTimelineColumnSpan = 20;
  5181. isc.A.weekPrefix = "Week";
  5182. isc.A.hoverDelay = 0;
  5183. isc.A.laneGroupStartOpen = "first";
  5184. isc.A.showEventDescriptions = true;
  5185. isc.A.showEventHeaders = true;
  5186. isc.A.eventHeaderWrap = true;
  5187. isc.A.eventHeaderHeight = 14;
  5188. isc.A.allowEventOverlap = true;
  5189. isc.A.sizeEventsToGrid = true;
  5190. isc.A.dayViewTitle = "Day";
  5191. isc.A.weekViewTitle = "Week";
  5192. isc.A.monthViewTitle = "Month";
  5193. isc.A.timelineViewTitle = "Timeline";
  5194. isc.A.eventNameFieldTitle = "Event Name";
  5195. isc.A.eventStartDateFieldTitle = "From";
  5196. isc.A.eventEndDateFieldTitle = "To";
  5197. isc.A.eventDescriptionFieldTitle = "Description";
  5198. isc.A.eventLaneFieldTitle = "Lane";
  5199. isc.A.eventSublaneFieldTitle = "Sublane";
  5200. isc.A.eventDurationFieldTitle = "Duration";
  5201. isc.A.eventDurationUnitFieldTitle = "&nbsp;";
  5202. isc.A.saveButtonTitle = "Save Event";
  5203. isc.A.detailsButtonTitle = "Edit Details";
  5204. isc.A.removeButtonTitle = "Remove Event";
  5205. isc.A.cancelButtonTitle = "Cancel";
  5206. isc.A.monthButtonTitle = "&lt; ${monthName}";
  5207. isc.A.monthMoreEventsLinkTitle = "+ ${eventCount} more...";
  5208. isc.A.backButtonTitle = "Back";
  5209. isc.A.previousButtonHoverText = "Previous";
  5210. isc.A.nextButtonHoverText = "Next";
  5211. isc.A.addEventButtonHoverText = "Add an event";
  5212. isc.A.datePickerHoverText = "Choose a date";
  5213. isc.A.invalidDateMessage = "From must be before To";
  5214. isc.A.dayViewConstructor = "DaySchedule";
  5215. isc.A.weekViewConstructor = "WeekSchedule";
  5216. isc.A.monthViewConstructor = "MonthSchedule";
  5217. isc.A.timelineViewConstructor = "TimelineView";
  5218. isc.A.mainViewDefaults = {
  5219. _constructor: isc.TabSet,
  5220. defaultWidth: "80%",
  5221. defaultHeight: "100%",
  5222. tabBarAlign: "right",
  5223. selectedTab: 1
  5224. };
  5225. isc.A.dateChooserConstructor = "DateChooser";
  5226. isc.A.dateChooserDefaults = {
  5227. visibility: "hidden"
  5228. };
  5229. isc.A.eventDialogConstructor = "Window";
  5230. isc.A.eventDialogDefaults = {
  5231. showHeaderIcon: false,
  5232. showMinimizeButton: false,
  5233. showMaximumButton: false,
  5234. canDragReposition: true,
  5235. overflow: "visible",
  5236. bodyProperties: {
  5237. overflow: "visible"
  5238. },
  5239. keepInParentRect: true,
  5240. maxWidth: 400,
  5241. height: 100,
  5242. visibility: "hidden"
  5243. };
  5244. isc.A.eventEditorLayoutConstructor = "Window";
  5245. isc.A.eventEditorLayoutDefaults = {
  5246. showHeaderIcon: false,
  5247. showShadow: false,
  5248. showMinimizeButton: false,
  5249. showMaximumButton: false,
  5250. canDragReposition: false,
  5251. visibility: "hidden"
  5252. };
  5253. isc.A.eventEditorConstructor = "DynamicForm";
  5254. isc.A.eventEditorDefaults = {
  5255. padding: 4,
  5256. numCols: 5,
  5257. colWidths: [80, 40, 40, "*", "*"],
  5258. showInlineErrors: false,
  5259. width: 460,
  5260. titleWidth: 80,
  5261. wrapItemTitles: false,
  5262. visiibililty: "hidden"
  5263. };
  5264. isc.A.eventEditorButtonLayoutConstructor = "HLayout";
  5265. isc.A.eventEditorButtonLayoutDefaults = {
  5266. width: "100%",
  5267. height: "100%",
  5268. membersMargin: 5,
  5269. layoutMargin: 10
  5270. };
  5271. isc.A.saveButtonConstructor = "IButton";
  5272. isc.A.saveButtonDefaults = {
  5273. autoFit: true,
  5274. click: function() {
  5275. this.calendar.addEventOrUpdateEventFields()
  5276. }
  5277. };
  5278. isc.A.removeButtonConstructor = "IButton";
  5279. isc.A.removeButtonDefaults = {
  5280. autoFit: true,
  5281. click: function() {
  5282. var _1 = this.calendar;
  5283. if (_1.eventRemoveClick(_1.eventEditorLayout.event, _1.getCurrentViewName()) != false) {
  5284. _1.removeEvent(_1.eventEditorLayout.event)
  5285. }
  5286. _1.eventEditorLayout.hide()
  5287. }
  5288. };
  5289. isc.A.cancelButtonConstructor = "IButton";
  5290. isc.A.cancelButtonDefaults = {
  5291. autoFit: true,
  5292. click: function() {
  5293. this.calendar.eventEditorLayout.hide()
  5294. }
  5295. };
  5296. isc.A.addEventButtonConstructor = "ImgButton";
  5297. isc.A.addEventButtonDefaults = {
  5298. title: "",
  5299. src: "[SKINIMG]actions/add.png",
  5300. showRollOver: false,
  5301. showDown: false,
  5302. showFocused: false,
  5303. width: 16,
  5304. height: 16
  5305. };
  5306. isc.A.datePickerButtonConstructor = "ImgButton";
  5307. isc.A.datePickerButtonDefaults = {
  5308. title: "",
  5309. src: "[SKIN]/controls/date_control.gif",
  5310. width: 16,
  5311. height: 16,
  5312. showRollOver: false,
  5313. showFocused: false
  5314. };
  5315. isc.A.showControlsBar = true;
  5316. isc.A.controlsBarConstructor = "HLayout";
  5317. isc.A.controlsBarDefaults = {
  5318. defaultLayoutAlign: "center",
  5319. layoutAlign: "center",
  5320. width: 1,
  5321. height: 1,
  5322. overflow: "visible",
  5323. membersMargin: 5
  5324. };
  5325. isc.A.monthButtonConstructor = "NavigationButton";
  5326. isc.A.monthButtonDefaults = {
  5327. click: function() {
  5328. var _1 = this.creator,
  5329. _2 = _1.getCurrentViewName();
  5330. if (_2 != "month") {
  5331. this.previousViewName = _2;
  5332. this.creator.setCurrentViewName("month");
  5333. _1.updateMonthButton()
  5334. } else {
  5335. this.creator.setCurrentViewName(this.previousViewName);
  5336. delete this.previousViewName;
  5337. _1.updateMonthButton()
  5338. }
  5339. }
  5340. };
  5341. isc.A.previousButtonConstructor = "ImgButton";
  5342. isc.A.previousButtonDefaults = {
  5343. title: "",
  5344. src: "[SKINIMG]actions/back.png",
  5345. showFocused: false,
  5346. width: 16,
  5347. height: 16,
  5348. click: function() {
  5349. this.creator.previous()
  5350. },
  5351. showRollOver: false,
  5352. showDown: false
  5353. };
  5354. isc.A.nextButtonConstructor = "ImgButton";
  5355. isc.A.nextButtonDefaults = {
  5356. title: "",
  5357. src: "[SKINIMG]actions/forward.png",
  5358. showFocused: false,
  5359. width: 16,
  5360. height: 16,
  5361. click: function() {
  5362. this.creator.next()
  5363. },
  5364. showRollOver: false,
  5365. showDown: false
  5366. };
  5367. isc.A.dateLabelConstructor = "Label";
  5368. isc.A.dateLabelDefaults = {
  5369. wrap: false,
  5370. width: 5,
  5371. contents: "-"
  5372. };
  5373. isc.A.DAY = "day";
  5374. isc.A.WEEK = "week";
  5375. isc.A.MONTH = "month";
  5376. isc.A.TIMELINE = "timeline";
  5377. isc.A.rowHeight = isc.ListGrid.getInstanceProperty("cellHeight");
  5378. isc.A.$1716 = null;
  5379. isc.A.zeroLengthEventSize = 2;
  5380. isc.A.$1290 = "mn";
  5381. isc.A.dateFormatter = null;
  5382. isc.A.timeFormatter = "toShortPaddedTime";
  5383. isc.A.showIndicatorsInFront = true;
  5384. isc.A.showCellHovers = false;
  5385. isc.A.showHeaderHovers = false;
  5386. isc.A.showViewHovers = true;
  5387. isc.A.showEventHovers = true;
  5388. isc.A.showZoneHovers = true;
  5389. isc.A.showLaneFieldHovers = false;
  5390. isc.A.showDragHovers = false;
  5391. isc.A.eventCanvasConstructor = "EventCanvas";
  5392. isc.A.eventCanvasContextMenuConstructor = "Menu";
  5393. isc.A.eventCanvasContextMenuStyle = "eventWindowContextMenu";
  5394. isc.A.eventCanvasContextMenuDefaults = {};
  5395. isc.A.useEventCanvasRolloverControls = true;
  5396. isc.A.eventCanvasGripperConstructor = "Img";
  5397. isc.A.eventCanvasGripperDefaults = {
  5398. width: 11,
  5399. height: 10,
  5400. padding: 0,
  5401. margin: 0,
  5402. overflow: "visible",
  5403. imageType: "center",
  5404. autoDraw: false,
  5405. visibility: "hidden",
  5406. showDown: false,
  5407. showOver: false,
  5408. showRollOver: false,
  5409. canDrag: true,
  5410. layoutAlign: "center",
  5411. cursor: "move"
  5412. };
  5413. isc.A.eventCanvasGripperIcon = "[SKIN]/Calendar/gripper.png";
  5414. isc.A.eventCanvasLabelConstructor = "Label";
  5415. isc.A.eventCanvasLabelDefaults = {
  5416. height: 1,
  5417. width: 1,
  5418. autoSize: true,
  5419. wrap: false,
  5420. overflow: "visible",
  5421. autoDraw: false,
  5422. visibility: "hidden",
  5423. padding: 2,
  5424. minWidth: 40,
  5425. maxWidth: 150,
  5426. showOver: false,
  5427. showDown: false,
  5428. showRollOver: true,
  5429. layoutAlign: "center",
  5430. click: function() {},
  5431. isEventCanvasLabel: true
  5432. };
  5433. isc.A.eventCanvasButtonLayoutConstructor = "HLayout";
  5434. isc.A.eventCanvasButtonLayoutDefaults = {
  5435. width: 1,
  5436. height: 1,
  5437. overflow: "visible",
  5438. autoDraw: false,
  5439. snapTo: "TR",
  5440. membersMargin: 1,
  5441. layoutTopMargin: 3,
  5442. layoutRightMargin: 3,
  5443. mouseOver: function() {
  5444. return isc.EH.STOP_BUBBLING
  5445. }
  5446. };
  5447. isc.A.eventCanvasCloseButtonConstructor = "ImgButton";
  5448. isc.A.eventCanvasCloseButtonDefaults = {
  5449. width: 11,
  5450. height: 10,
  5451. autoDraw: false,
  5452. showDown: false,
  5453. showRollOver: true,
  5454. layoutAlign: "center",
  5455. src: "[SKIN]/headerIcons/close.png",
  5456. styleName: "eventCanvasCloseButton",
  5457. click: function() {
  5458. var _1 = this.eventCanvas;
  5459. this.creator.$174b(_1);
  5460. return false
  5461. }
  5462. };
  5463. isc.A.eventCanvasContextButtonConstructor = "ImgButton";
  5464. isc.A.eventCanvasContextButtonDefaults = {
  5465. width: 11,
  5466. height: 10,
  5467. autoDraw: false,
  5468. showDown: false,
  5469. showRollOver: true,
  5470. layoutAlign: "left",
  5471. src: "[SKIN]/headerIcons/arrow_down.png",
  5472. click: function() {
  5473. this.creator.$1700(this.eventCanvas);
  5474. return false
  5475. }
  5476. };
  5477. isc.A.eventCanvasVResizerConstructor = "Img";
  5478. isc.A.eventCanvasVResizerDefaults = {
  5479. width: 12,
  5480. height: 6,
  5481. overflow: "hidden",
  5482. src: "[SKIN]/Window/v_resizer.png",
  5483. autoDraw: false,
  5484. canDragResize: true
  5485. };
  5486. isc.A.eventCanvasHResizerConstructor = "Img";
  5487. isc.A.eventCanvasHResizerDefaults = {
  5488. width: 6,
  5489. height: 12,
  5490. overflow: "hidden",
  5491. src: "[SKIN]/Window/h_resizer.png",
  5492. autoDraw: false,
  5493. canDragResize: true
  5494. };
  5495. isc.A.zoneStyleName = "zoneCanvas";
  5496. isc.A.zoneCanvasConstructor = "ZoneCanvas";
  5497. isc.A.zoneTitleOrientation = "bottom";
  5498. isc.A.indicatorStyleName = "indicatorCanvas";
  5499. isc.A.indicatorCanvasConstructor = "IndicatorCanvas";
  5500. isc.A.eventsOverlapGridLines = true;
  5501. isc.A.includeRangeCriteria = false;
  5502. isc.A.$81i = /^\d{4}.\d\d?.\d\d?$/;
  5503. isc.A.$81j = /^\d\d?.\d\d.\d{4}?$/;
  5504. isc.A.newEventEditorWindowTitle = "New Event";
  5505. isc.A.monthMoreEventsMenuConstructor = "Menu";
  5506. isc.A.monthMoreEventsMenuDefaults = {
  5507. autoDraw: false,
  5508. visibility: "hidden",
  5509. keepInParentRect: true
  5510. };
  5511. isc.B.push(isc.A.getMinutesPerRow = function isc_Calendar_getMinutesPerRow(_1) {
  5512. _1 = _1 || this.getSelectedView();
  5513. if (_1 && _1.verticalEvents) return _1.getTimePerCell("mn");
  5514. return null
  5515. }, isc.A.getMinutesPerCol = function isc_Calendar_getMinutesPerCol(_1) {
  5516. _1 = _1 || this.getSelectedView();
  5517. if (_1 && !_1.verticalEvents) return _1.getTimePerCell("mn");
  5518. return null
  5519. }, isc.A.getSnapGapMinutes = function isc_Calendar_getSnapGapMinutes(_1, _2, _3) {
  5520. _1 = _1 || this.getSelectedView();
  5521. if (_1) return _1.getTimePerSnapGap("mn")
  5522. }, isc.A.getSnapGapPixels = function isc_Calendar_getSnapGapPixels(_1, _2, _3) {
  5523. _1 = _1 || this.getSelectedView();
  5524. if (_1.$171x || _1.$27q.snapGapPixels == null) {
  5525. if (_2 == null) _2 = 0;
  5526. if (_3 == null) _3 = 0;
  5527. var _4 = _1 && _1.verticalEvents == false,
  5528. _5 = this.getSnapGapMinutes(_1, _2, _3),
  5529. _6 = _1.getTimePerCell(),
  5530. _7;
  5531. if (_1 && _1.body) {
  5532. _7 = _4 ? _1.body.getColumnWidth(_3) : _1.getRowHeight(_1.getRecord(_2), _2)
  5533. } else {
  5534. if (_4) {
  5535. var _8 = _1 && _1.fieldHeaderLevel;
  5536. _7 = (_8 && _8.headerWidth) || (_1 && _1.columnWidth)
  5537. } else _7 = this.rowHeight
  5538. }
  5539. var _9 = _7 / ((_6 / _5));
  5540. delete _1.$171x;
  5541. _1.$27q.snapGapPixels = Math.max(_9, 1)
  5542. }
  5543. return _1.$27q.snapGapPixels
  5544. }, isc.A.addSnapGapsToDate = function isc_Calendar_addSnapGapsToDate(_1, _2, _3) {
  5545. if (!_1) return null;
  5546. if (_3 == 0) return _1.duplicate();
  5547. _2 = _2 || this.getSelectedView();
  5548. if (_3 == null) _3 = 1;
  5549. var _4 = this.getSnapGapMinutes(_2),
  5550. _5 = (_4 * _3) * 60000,
  5551. _6 = _1.duplicate();
  5552. if (_4 == 1440) _6.setDate(_6.getDate() + _3);
  5553. else _6.setTime(_6.getTime() + _5);
  5554. return _6
  5555. }, isc.A.getRowsPerHour = function isc_Calendar_getRowsPerHour(_1) {
  5556. return Math.floor(60 / _1.getTimePerCell("mn"))
  5557. }, isc.A.getRowFromDate = function isc_Calendar_getRowFromDate(_1, _2) {
  5558. var _3 = _1.getTimePerCell("mn"),
  5559. _4 = this.getRowsPerHour(_1),
  5560. _5 = Math.floor(_2.getMinutes() / _3),
  5561. _6 = (_2.getMinutes() % _3 == 0 ? 0 : 1),
  5562. _7 = (_2.getHours() * _4) + _5 + _6;
  5563. return _7
  5564. }, isc.A.getMinutePixels = function isc_Calendar_getMinutePixels(_1, _2, _3) {
  5565. _3 = _3 || this.getSelectedView();
  5566. if (_3.isTimelineView()) {
  5567. var _4 = _3.getTimePerCell() / _3.columnWidth;
  5568. return Math.round(_1 / _4)
  5569. } else if (_3.isDayView() || _3.isWeekView()) {
  5570. var _5 = (_2 != null ? _2 : _3.getRowHeight(_3.getRecord(0), 0)) *
  5571. this.getRowsPerHour(_3);
  5572. return Math.round((_5 / 60) * _1)
  5573. }
  5574. }, isc.A.scrollToTime = function isc_Calendar_scrollToTime(_1, _2) {
  5575. if (!this.isDrawn()) {
  5576. this.$187g = _1;
  5577. return
  5578. }
  5579. _2 = _2 || this.getSelectedView();
  5580. _1 = isc.Time.parseInput(_1);
  5581. if (isc.isA.Date(_1)) {
  5582. var _3 = this.getRowFromDate(_2, _1);
  5583. var _4 = _2.getRowHeight(_2.getRecord(0), 0) * _3;
  5584. _2.body.scrollTo(0, _4);
  5585. _2.redraw()
  5586. }
  5587. }, isc.A.moveToEvent = function isc_Calendar_moveToEvent(_1, _2) {
  5588. _2 = _2 || this.getSelectedView();
  5589. this.setChosenDate(this.getEventStartDate(_1))
  5590. }, isc.A.getDurationUnitMap = function isc_Calendar_getDurationUnitMap() {
  5591. var _1 = this.durationUnitOptions,
  5592. _2 = isc.DateUtil,
  5593. _3 = {};
  5594. for (var i = 0; i < _1.length; i++) {
  5595. _3[_2.getTimeUnitKey(_1[i])] = _2.getTimeUnitTitle(_1[i]) + "s"
  5596. }
  5597. return _3
  5598. }, isc.A.setHeaderLevels = function isc_Calendar_setHeaderLevels(_1) {
  5599. this.headerLevels = _1;
  5600. if (this.timelineView) this.timelineView.rebuild(true)
  5601. }, isc.A.dateIsWeekend = function isc_Calendar_dateIsWeekend(_1) {
  5602. return this.getWeekendDays().contains(_1.getDay())
  5603. }, isc.A.getWeekendDays = function isc_Calendar_getWeekendDays() {
  5604. return this.weekendDays
  5605. }, isc.A.shouldDisableDate = function isc_Calendar_shouldDisableDate(_1, _2, _3) {
  5606. if (!_1) return false;
  5607. _2 = _2 || this.getSelectedView();
  5608. if (this.disableWeekends && !_3 && this.dateIsWeekend(_1)) {
  5609. return true
  5610. }
  5611. return false
  5612. }, isc.A.shouldShowDate = function isc_Calendar_shouldShowDate(_1, _2) {
  5613. _2 = _2 || this.getSelectedView();
  5614. if (_2.isTimelineView()) {
  5615. if (!this.showWeekends && this.dateIsWeekend(_1)) return false
  5616. }
  5617. return true
  5618. }, isc.A.shouldShowLane = function isc_Calendar_shouldShowLane(_1, _2) {
  5619. _2 = _2 || this.getSelectedView();
  5620. if (this.hideUnusedLanes && this.getLaneEvents(_1).length == 0) {
  5621. return false
  5622. }
  5623. return true
  5624. }, isc.A.shouldShowEvent = function isc_Calendar_shouldShowEvent(_1, _2) {
  5625. return true
  5626. }, isc.A.getWorkdayStart = function isc_Calendar_getWorkdayStart(_1, _2) {
  5627. return this.workdayStart
  5628. }, isc.A.getWorkdayEnd = function isc_Calendar_getWorkdayEnd(_1, _2) {
  5629. return this.workdayEnd
  5630. }, isc.A.getVisibleStartDate = function isc_Calendar_getVisibleStartDate(_1) {
  5631. _1 = _1 || this.getSelectedView();
  5632. if (!_1 || isc.isAn.emptyString(_1)) return null;
  5633. if (_1.isMonthView() || (_1.body && _1.bodies.length > 1)) return _1.getCellDate(0, 0);
  5634. return _1.startDate
  5635. }, isc.A.getVisibleEndDate = function isc_Calendar_getVisibleEndDate(_1) {
  5636. _1 = _1 || this.getSelectedView();
  5637. if (!_1 || isc.isAn.emptyString(_1)) return null;
  5638. if (!_1.body || (_1.bodies.length == 1 && !_1.isMonthView())) return _1.endDate;
  5639. var _2 = _1.getData().length - 1,
  5640. _3 = _1.body.fields.length - 1;
  5641. if (_1.getCellEndDate) return _1.getCellEndDate(_2, _3);
  5642. return _1.getCellDate(_2, _3)
  5643. }, isc.A.getPeriodStartDate = function isc_Calendar_getPeriodStartDate(_1) {
  5644. _1 = _1 || this.getSelectedView();
  5645. if (_1.isDayView()) {
  5646. return this.chosenDateStart.duplicate()
  5647. } else if (_1.isWeekView()) {
  5648. return this.chosenWeekStart.duplicate()
  5649. } else if (_1.isMonthView()) {
  5650. return isc.DateUtil.getStartOf(this.chosenDate, isc.DateUtil.getTimeUnitKey("month"))
  5651. } else if (_1.isTimelineView()) {
  5652. return this.getVisibleStartDate(_1)
  5653. }
  5654. }, isc.A.getPeriodEndDate = function isc_Calendar_getPeriodEndDate(_1) {
  5655. _1 = _1 || this.getSelectedView();
  5656. if (_1.isDayView()) {
  5657. return this.chosenDateEnd.duplicate()
  5658. } else if (_1.isWeekView()) {
  5659. return this.chosenWeekEnd.duplicate()
  5660. } else if (_1.isMonthView()) {
  5661. return isc.DateUtil.getEndOf(this.chosenDate, isc.DateUtil.getTimeUnitKey("month"))
  5662. } else if (_1.isTimelineView()) {
  5663. return this.getVisibleEndDate(_1)
  5664. }
  5665. }, isc.A.groupLanesBy = function isc_Calendar_groupLanesBy(_1) {
  5666. if (this.timelineView) {
  5667. this.timelineView.groupBy(_1)
  5668. }
  5669. }, isc.A.setLanes = function isc_Calendar_setLanes(_1) {
  5670. if (!_1) {
  5671. return
  5672. }
  5673. this.lanes = _1;
  5674. if (this.timelineView) {
  5675. this.timelineView.setLanes(this.lanes)
  5676. }
  5677. if (this.showDayLanes && this.dayView) {
  5678. this.dayView.setLanes(this.lanes)
  5679. }
  5680. }, isc.A.addLane = function isc_Calendar_addLane(_1, _2) {
  5681. var _3;
  5682. if (this.timelineViewSelected()) {
  5683. _3 = this.timelineView
  5684. } else if (this.dayViewSelected() && this.showDayLanes) {
  5685. _3 = this.dayView
  5686. }
  5687. if (!_3) {
  5688. return
  5689. }
  5690. if (!this.lanes) this.lanes = [];
  5691. if (_2 == null) _2 = this.lanes.length;
  5692. this.lanes.add(_1, _2);
  5693. _3.setLanes(this.lanes)
  5694. }, isc.A.removeLane = function isc_Calendar_removeLane(_1) {
  5695. var _2;
  5696. if (this.timelineViewSelected()) _2 = this.timelineView;
  5697. else if (this.dayViewSelected() && this.showDayLanes) _2 = this.dayView;
  5698. if (!_2 || !this.lanes) return;
  5699. if (isc.isA.String(_1)) _1 = this.lanes.find("name", _1);
  5700. else if (isc.isAn.Object(_1)) _1 = this.lanes.find("name", _1.name);
  5701. if (_1) {
  5702. this.lanes.remove(_1);
  5703. _2.setLanes(this.lanes)
  5704. }
  5705. }, isc.A.setShowDayLanes = function isc_Calendar_setShowDayLanes(_1) {
  5706. if (this.showDayLanes == _1) return;
  5707. this.showDayLanes = _1;
  5708. if (this.dayView) {
  5709. this.dayView.$123r = this.dayView.body.getScrollTop();
  5710. this.dayView.rebuildFields();
  5711. if (this.dayViewSelected()) {
  5712. this.dayView.refreshEvents()
  5713. } else {
  5714. this.dayView.$123s = true
  5715. }
  5716. }
  5717. }, isc.A.initWidget = function isc_Calendar_initWidget() {
  5718. if (!this.chosenDate) {
  5719. if (this.startDate) this.chosenDate = this.startDate.duplicate();
  5720. else this.chosenDate = new Date()
  5721. }
  5722. var _1 = isc.Calendar.$1833(this.chosenDate);
  5723. this.year = _1.getFullYear();
  5724. this.month = _1.getMonth();
  5725. if (this.firstDayOfWeek == null)
  5726. this.firstDayOfWeek = Number(isc.DateChooser.getInstanceProperty("firstDayOfWeek"));
  5727. if (!this.weekendDays) this.weekendDays = isc.DateUtil.getWeekendDays();
  5728. if (this.laneGroupByField && !isc.isAn.Array(this.laneGroupByField)) {
  5729. this.laneGroupByField = [this.laneGroupByField]
  5730. }
  5731. if (this.timelineSnapGap != null) {
  5732. this.snapGap = this.timelineSnapGap;
  5733. delete this.timelineSnapGap
  5734. }
  5735. if (this.timelineStartDate != null) {
  5736. this.startDate = this.timelineStartDate.duplicate();
  5737. delete this.timelineStartDate
  5738. }
  5739. if (this.timelineEndDate != null) {
  5740. this.endDate = this.timelineEndDate.duplicate();
  5741. delete this.timelineEndDate
  5742. }
  5743. if (this.timelineLabelFields != null) {
  5744. this.laneFields = this.timelineLabelFields;
  5745. this.timelineLabelFields = null
  5746. }
  5747. if (this.eventTypeData != null) {
  5748. this.lanes = isc.clone(this.eventTypeData);
  5749. this.eventTypeData = null
  5750. }
  5751. if (this.eventTypeField != null) {
  5752. this.laneNameField = this.eventTypeField;
  5753. delete this.eventTypeField
  5754. }
  5755. if (this.showDescription != null) {
  5756. this.showEventDescriptions = this.showDescription;
  5757. delete this.showDescription
  5758. }
  5759. if (this.canEditEventType != null) {
  5760. this.canEditLane = this.canEditEventType;
  5761. delete this.canEditEventType
  5762. }
  5763. if (this.canDeleteEvents != null) {
  5764. this.canRemoveEvents = this.canDeleteEvents;
  5765. delete this.canDeleteEvents
  5766. }
  5767. var _2 = isc.Browser.isTouch ? true : false;
  5768. if (this.canDragCreateEvents == null) this.canDragCreateEvents = !_2;
  5769. if (this.canDragEvents == null) this.canDragEvents = !_2;
  5770. if (this.minimalUI == null) this.minimalUI = isc.Browser.isHandset;
  5771. if (this.minimalUI) {
  5772. this.mainViewDefaults.showTabBar = false;
  5773. var _3 = this;
  5774. this.orientationEventId = isc.Page.setEvent("orientationChange", function() {
  5775. _3.pageOrientationChanged()
  5776. })
  5777. }
  5778. if (this.eventWindowDefaults != null) {
  5779. this.eventCanvasDefaults = isc.addProperties({}, this.eventWindowDefaults, this.eventCanvasDefaults);
  5780. delete this.eventWindowDefaults
  5781. }
  5782. if (this.eventWindowProperties != null) {
  5783. this.eventCanvasProperties = isc.addProperties({}, this.eventWindowProperties, this.eventCanvasProperties);
  5784. delete this.eventWindowProperties
  5785. }
  5786. if (this.overlapSortSpecifiers && !isc.isAn.Array(this.overlapSortSpecifiers)) {
  5787. this.overlapSortSpecifiers = [this.overlapSortSpecifiers]
  5788. }
  5789. if (!this.data) this.data = this.getDefaultData();
  5790. this.previousButtonDefaults.prompt = this.previousButtonHoverText;
  5791. this.nextButtonDefaults.prompt = this.nextButtonHoverText;
  5792. this.datePickerButtonDefaults.prompt = this.datePickerHoverText;
  5793. this.addEventButtonDefaults.prompt = this.addEventButtonHoverText;
  5794. if (this.dataSource) this.autoDetectFieldNames();
  5795. this.$129t(this.chosenDate);
  5796. this.createChildren();
  5797. this.$53a();
  5798. this.invokeSuper(isc.Calendar, "initWidget");
  5799. this.createEditors()
  5800. }, isc.A.updateMonthButton = function isc_Calendar_updateMonthButton() {
  5801. if (this.getCurrentViewName() == "month") {
  5802. this.monthButton.setTitle(this.backButtonTitle)
  5803. } else {
  5804. var _1 = this.chosenDate.getMonthName();
  5805. this.monthButton.setTitle(this.monthButtonTitle.evalDynamicString(this, {
  5806. monthName: _1
  5807. }))
  5808. }
  5809. }, isc.A.pageOrientationChanged = function isc_Calendar_pageOrientationChanged(_1) {
  5810. _1 = _1 || isc.Page.getOrientation();
  5811. if (_1 == "landscape" && this.weekView) this.setCurrentViewName("week");
  5812. if (_1 == "portrait" && this.dayView) this.setCurrentViewName("day")
  5813. }, isc.A.autoDetectFieldNames = function isc_Calendar_autoDetectFieldNames() {
  5814. this.dataSource = isc.DS.getDataSource(this.dataSource);
  5815. var _1 = this.dataSource,
  5816. _2 = isc.getValues(_1.getFields()),
  5817. _3 = 1024000,
  5818. _4 = null,
  5819. _5;
  5820. if (this.fieldIsMissing(this.nameField, _1)) {
  5821. this.nameField = _1.getTitleField();
  5822. if (this.fieldIsMissing(this.nameField, _1)) {
  5823. this.logWarn("Specified field '" + this.nameField + "' is not present in the DataSource and no suitable alternative was auto-detected.")
  5824. } else {
  5825. this.logInfo("Specified event name field is not present in the DataSource - using DataSource.getTitleField() instead: '" + this.nameField + "'")
  5826. }
  5827. }
  5828. if (this.fieldIsMissing(this.descriptionField, _1)) {
  5829. _2.sortByProperties(["length"], [false]);
  5830. _4 = {
  5831. length: 0
  5832. };
  5833. for (var i = 0; i < _2.length; i++) {
  5834. _5 = _2.get(i);
  5835. if (!_5.type || _5.type == "text" || _5.type == "string") {
  5836. if (_5.length > 255 && _5.length < _3) {
  5837. this.descriptionField = _5.name;
  5838. break
  5839. } else if (_5.length && _5.length < _3 && _5.length > _4.length) {
  5840. _4 = _5
  5841. } else if (!_5.length) {
  5842. if (!_4) _4 = _5
  5843. }
  5844. }
  5845. }
  5846. if (_4 != null && this.fieldIsMissing(this.descriptionField, _1))
  5847. this.descriptionField = _4.name;
  5848. if (this.fieldIsMissing(this.descriptionField, _1)) {
  5849. this.logWarn("Specified field '" + this.descriptionField + "' is not present in the DataSource and no suitable alternative was auto-detected.")
  5850. } else {
  5851. this.logInfo("Specified event description field is not present in the DataSource - using auto-detected field '" + this.descriptionField + "' instead.")
  5852. }
  5853. }
  5854. if (this.fieldIsMissing(this.startDateField, _1)) {
  5855. _4 = null;
  5856. for (var i = 0; i < _2.length; i++) {
  5857. _5 = _2.get(i);
  5858. if ((_5.type == "date" || _5.type == "datetime")) {
  5859. if (_5.name.toLowerCase().indexOf("start") >= 0 || _5.name.toLowerCase().indexOf("begin") >= 0) {
  5860. this.startDateField = _5.name;
  5861. break
  5862. } else _4 = _5
  5863. }
  5864. }
  5865. if (_4 != null && this.fieldIsMissing(this.startDateField, _1))
  5866. this.startDateField = _4.name;
  5867. if (this.fieldIsMissing(this.startDateField, _1)) {
  5868. this.logWarn("Specified field '" + this.startDateField + "' is not present in the DataSource and no suitable alternative was auto-detected.")
  5869. } else {
  5870. this.logInfo("Specified event startDate field is not present in the DataSource - using auto-detected field '" + this.startDateField + "' instead.")
  5871. }
  5872. }
  5873. if (this.fieldIsMissing(this.endDateField, _1)) {
  5874. _4 = null;
  5875. for (var i = 0; i < _2.length; i++) {
  5876. _5 = _2.get(i);
  5877. if ((_5.type == "date" || _5.type == "datetime")) {
  5878. if (_5.name.toLowerCase().indexOf("end") >= 0 || _5.name.toLowerCase().indexOf("stop") >= 0) {
  5879. this.endDateField = _5.name;
  5880. break
  5881. } else if (_5.name != this.startDateField)
  5882. _4 = _5
  5883. }
  5884. }
  5885. if (_4 != null && this.fieldIsMissing(this.endDateField, _1))
  5886. this.endDateField = _4.name;
  5887. if (this.fieldIsMissing(this.endDateField, _1)) {
  5888. this.logWarn("Specified field '" + this.endDateField + "' is not present in the DataSource and no suitable alternative was auto-detected.")
  5889. } else {
  5890. this.logInfo("Specified event endDate field is not present in the DataSource - using auto-detected field '" + this.endDateField + "' instead.")
  5891. }
  5892. }
  5893. if (this.showTimelineView != false || (this.showDayView != false && this.showDayLanes)) {
  5894. if (this.useSublanes && this.fieldIsMissing(this.sublaneNameField, _1)) {
  5895. _4 = null;
  5896. for (var i = 0; i < _2.length; i++) {
  5897. _5 = _2.get(i);
  5898. if (!_5.type || _5.type == "text" || _5.type == "string") {
  5899. var _7 = _5.name.toLowerCase();
  5900. if (_7.contains("sublane")) {
  5901. this.sublaneNameField = _5.name;
  5902. break
  5903. }
  5904. }
  5905. }
  5906. if (this.fieldIsMissing(this.sublaneNameField, _1)) {
  5907. this.logWarn("Specified field '" + this.sublaneNameField + "' is not present in the DataSource and no suitable alternative was auto-detected.")
  5908. } else {
  5909. this.logInfo("Specified event sublane field is not present in the DataSource - using auto-detected field '" + this.sublaneNameField + "' instead.")
  5910. }
  5911. }
  5912. if (this.fieldIsMissing(this.laneNameField, _1)) {
  5913. _4 = null;
  5914. for (var i = 0; i < _2.length; i++) {
  5915. _5 = _2.get(i);
  5916. if (!_5.type || _5.type == "text" || _5.type == "string") {
  5917. var _7 = _5.name.toLowerCase();
  5918. if (_7.contains("lane") && _7 != this.sublaneNameField) {
  5919. this.laneNameField = _5.name;
  5920. break
  5921. }
  5922. }
  5923. }
  5924. if (this.fieldIsMissing(this.laneNameField, _1)) {
  5925. this.logWarn("Specified field '" + this.laneNameField + "' is not present in the DataSource and no suitable alternative was auto-detected.")
  5926. } else {
  5927. this.logInfo("Specified event lane field is not present in the DataSource - using auto-detected field '" + this.laneNameField + "' instead.")
  5928. }
  5929. }
  5930. }
  5931. }, isc.A.fieldIsMissing = function isc_Calendar_fieldIsMissing(_1, _2) {
  5932. return (!_1 || _1 == "" || (_2 && !_2.getField(_1)))
  5933. }, isc.A.getDefaultData = function isc_Calendar_getDefaultData() {
  5934. return []
  5935. }, isc.A.setData = function isc_Calendar_setData(_1) {
  5936. if (this.data == _1) return;
  5937. if (this.data) {
  5938. this.ignore(this.data, "dataChanged");
  5939. if (this.data.$31k && isc.isA.Function(this.data.destroy))
  5940. this.data.destroy()
  5941. }
  5942. if (_1) this.data = _1;
  5943. if (!this.data) return;
  5944. this.observe(this.data, "dataChanged", "observer.dataChanged()");
  5945. if (this.hasData()) {
  5946. this.dataChanged()
  5947. }
  5948. }, isc.A.getData = function isc_Calendar_getData() {
  5949. return this.data
  5950. }, isc.A.hasData = function isc_Calendar_hasData() {
  5951. if (!this.data || (isc.ResultSet && isc.isA.ResultSet(this.data) && !this.data.lengthIsKnown())) {
  5952. return false
  5953. } else {
  5954. return true
  5955. }
  5956. }, isc.A.dataChanged = function isc_Calendar_dataChanged() {
  5957. if (this.destroying || this.destroyed) return;
  5958. if (!this.dataIsAvailable()) {
  5959. this.$53e = true;
  5960. this.$1746 = true
  5961. } else {
  5962. delete this.$1746
  5963. }
  5964. if (this.$53e) {
  5965. this.logDebug('dataChanged, ignoring', 'calendar');
  5966. this.$53e = false
  5967. } else {
  5968. this.logDebug('dataChanged, refreshing', 'calendar');
  5969. delete this.$1746;
  5970. this.refreshSelectedView()
  5971. }
  5972. }, isc.A.dataIsAvailable = function isc_Calendar_dataIsAvailable() {
  5973. if (isc.isAn.Array(this.data)) return true;
  5974. if (this.data.allMatchingRowsCached()) return true;
  5975. return false
  5976. }, isc.A.destroy = function isc_Calendar_destroy() {
  5977. if (this.orientationEventId) isc.Page.clearEvent("orientationChange", this.orientationEventId);
  5978. if (this.data) this.ignore(this.data, "dataChanged");
  5979. if (this.controlsBar) this.controlsBar.destroy();
  5980. if (this.controlsBarContainer) this.controlsBarContainer.destroy();
  5981. if (this.dateChooser) this.dateChooser.destroy();
  5982. if (this.eventCanvasButtonLayout) this.eventCanvasButtonLayout.destroy();
  5983. if (this.mainLayout) this.mainLayout.destroy();
  5984. this.Super("destroy", arguments)
  5985. }, isc.A.refreshSelectedView = function isc_Calendar_refreshSelectedView() {
  5986. var _1 = this.getSelectedView();
  5987. if (!_1) return;
  5988. if (!_1.isDrawn()) {
  5989. _1.$128r = true
  5990. return
  5991. }
  5992. if (this.dayViewSelected()) {
  5993. this.dayView.refreshEvents();
  5994. if (this.weekView) this.weekView.$123s = true;
  5995. if (this.monthView) this.monthView.$123s = true
  5996. } else if (this.weekViewSelected()) {
  5997. this.weekView.refreshEvents();
  5998. if (this.dayView) this.dayView.$123s = true;
  5999. if (this.monthView) this.monthView.$123s = true
  6000. } else if (this.monthViewSelected()) {
  6001. this.monthView.refreshEvents();
  6002. if (this.dayView) this.dayView.$123s = true;
  6003. if (this.weekView) this.weekView.$123s = true
  6004. } else if (this.timelineViewSelected()) {
  6005. this.timelineView.refreshEvents()
  6006. }
  6007. }, isc.A.getSelectedView = function isc_Calendar_getSelectedView() {
  6008. if (this.dayViewSelected()) {
  6009. return this.dayView
  6010. } else if (this.weekViewSelected()) {
  6011. return this.weekView
  6012. } else if (this.monthViewSelected()) {
  6013. return this.monthView
  6014. } else if (this.timelineViewSelected()) {
  6015. return this.timelineView
  6016. }
  6017. }, isc.A.getView = function isc_Calendar_getView(_1) {
  6018. if (!_1) return this.getSelectedView();
  6019. if (_1 == "day") return this.dayView;
  6020. if (_1 == "week") return this.weekView;
  6021. if (_1 == "month") return this.monthView;
  6022. if (_1 == "timeline") return this.timelineView
  6023. }, isc.A.setRowHeight = function isc_Calendar_setRowHeight(_1, _2) {
  6024. this.rowHeight = _1;
  6025. if (this.dayView) {
  6026. this.dayView.setCellHeight(this.rowHeight);
  6027. this.dayView.refreshEvents();
  6028. if (this.scrollToWorkday && !_2) this.dayView.scrollToWorkdayStart()
  6029. }
  6030. if (this.weekView) {
  6031. this.weekView.setCellHeight(this.rowHeight);
  6032. this.weekView.refreshEvents();
  6033. if (this.scrollToWorkday && !_2) this.weekView.scrollToWorkdayStart()
  6034. }
  6035. }, isc.A.getCurrentViewName = function isc_Calendar_getCurrentViewName() {
  6036. var _1 = this.getSelectedView();
  6037. return _1 != null ? _1.viewName : null
  6038. }, isc.A.setCurrentViewName = function isc_Calendar_setCurrentViewName(_1) {
  6039. this.$567 = _1;
  6040. if (this.mainView && this.mainView.tabs) {
  6041. var _2 = this.mainView.tabs.findIndex("viewName", _1);
  6042. if (_2 != null) {
  6043. this.selectTab(_2)
  6044. }
  6045. }
  6046. return _1
  6047. }, isc.A.getEventPKs = function isc_Calendar_getEventPKs(_1) {
  6048. if (!this.$129u) {
  6049. _1 = _1 || this.getDataSource();
  6050. if (_1) {
  6051. this.$129u = _1.getPrimaryKeyFieldNames()
  6052. }
  6053. }
  6054. return this.$129u || []
  6055. }, isc.A.getEventCanvasID = function isc_Calendar_getEventCanvasID(_1, _2) {
  6056. if (!_2 || !_1 || !_1.$128i) return null;
  6057. var _3 = this.getEventKey(_2);
  6058. if (_3) {
  6059. return _1.$128i[_3]
  6060. } else {
  6061. return _2.$128i ? _2.$128i[this.getID() + "_" + _1.viewName] : null
  6062. }
  6063. }, isc.A.getEventKey = function isc_Calendar_getEventKey(_1) {
  6064. var _2 = this.getEventPKs().duplicate(),
  6065. _3 = this.$1716;
  6066. if (!_3) _3 = isc.StringBuffer.create();
  6067. if (_2.length > 0) {
  6068. _3.append(this.getID(), "_event_");
  6069. for (var i = 0; i < _2.length; i++) {
  6070. _3.append(_1[_2[i]]);
  6071. if (i == _2.length) break
  6072. }
  6073. }
  6074. var _5 = _3.release(false);
  6075. return _5 == "" ? null : _5
  6076. }, isc.A.setEventCanvasID = function isc_Calendar_setEventCanvasID(_1, _2, _3) {
  6077. if (!_1.$128i) _1.$128i = {};
  6078. var _4 = this.getEventKey(_2);
  6079. if (_4) {
  6080. _1.$128i[_4] = _3
  6081. } else {
  6082. if (!_2.$128i) _2.$128i = {};
  6083. _2.$128i[this.getID() + "_" + _1.viewName] = _3
  6084. }
  6085. }, isc.A.clearViewSelection = function isc_Calendar_clearViewSelection(_1) {
  6086. if (_1) {
  6087. if (_1.clearSelection) _1.clearSelection()
  6088. } else {
  6089. if (this.dayView) this.dayView.clearSelection();
  6090. if (this.weekView) this.weekView.clearSelection();
  6091. if (this.timelineView) this.timelineView.clearSelection()
  6092. }
  6093. }, isc.A.getDayDiff = function isc_Calendar_getDayDiff(_1, _2, _3) {
  6094. return Math.abs(isc.DateUtil.$1094(_1, _2, _3, false, this.getWeekendDays()))
  6095. }, isc.A.getEventStartCol = function isc_Calendar_getEventStartCol(_1, _2, _3) {
  6096. var _4 = _3 || (_2 ? _2.calendarView : this.getSelectedView()),
  6097. _5 = _2 || _4.getCurrentEventCanvas(_1),
  6098. _6 = _4.getEventColumn(_5.getLeft() + 1);
  6099. return _6
  6100. }, isc.A.getEventEndCol = function isc_Calendar_getEventEndCol(_1, _2, _3) {
  6101. var _4 = _4 || (_2 ? _2.calendarView : this.getSelectedView()),
  6102. _5 = _2 || _4.getCurrentEventCanvas(_1),
  6103. _6 = _4.getEventColumn(_5.getLeft() + _5.getVisibleWidth() + 1);
  6104. return _6
  6105. }, isc.A.getEventLeft = function isc_Calendar_getEventLeft(_1, _2) {
  6106. _2 = _2 || this.getSelectedView();
  6107. if (_2.getEventLeft) return _2.getEventLeft(_1);
  6108. var _3 = _2.body.getColumnWidth(0),
  6109. _4 = 0;
  6110. if (_2.isWeekView()) {
  6111. var _5 = this.getDayDiff(this.getEventStartDate(_1), this.chosenWeekStart, (this.showWeekends == false));
  6112. _4 = (_5 * _3)
  6113. } else if (this.showDayLanes) {
  6114. var _6 = _2.completeFields.findIndex("name", _1[this.laneNameField]);
  6115. if (_6) {
  6116. _4 = _2.body.getColumnLeft(_6)
  6117. }
  6118. } else {
  6119. var _6 = _2.getColFromDate(this.getEventStartDate(_1));
  6120. if (_6) {
  6121. _4 = _2.body.getColumnLeft(_6)
  6122. }
  6123. }
  6124. if (this.logIsDebugEnabled("calendar")) {
  6125. this.logDebug('calendar.getEventLeft() = ' + _4 + ' for:' + isc.Log.echoFull(_1), 'calendar')
  6126. }
  6127. return _4
  6128. }, isc.A.getEventHeaderHTML = function isc_Calendar_getEventHeaderHTML(_1, _2) {
  6129. if (!_1) return null;
  6130. var _3 = _2.isTimelineView() ? null : isc.Time.toTime(this.getEventStartDate(_1), this.timeFormatter, true),
  6131. _4 = (_3 ? _3 + " " : "") + (_1[this.nameField] || "");
  6132. return _4
  6133. }, isc.A.getEventBodyHTML = function isc_Calendar_getEventBodyHTML(_1, _2) {
  6134. if (!_1) return null;
  6135. return _1[this.descriptionField]
  6136. }, isc.A.getEventLeadingDate = function isc_Calendar_getEventLeadingDate(_1, _2) {
  6137. if (!_1) return null;
  6138. var _3 = _1[this.leadingDateField];
  6139. return _3 ? _3.duplicate() : null
  6140. }, isc.A.getEventTrailingDate = function isc_Calendar_getEventTrailingDate(_1, _2) {
  6141. if (!_1) return null;
  6142. var _3 = _1[this.trailingDateField];
  6143. return _3 ? _3.duplicate() : null
  6144. }, isc.A.getEventStartDate = function isc_Calendar_getEventStartDate(_1, _2) {
  6145. if (!_1 || !_1[this.startDateField]) return null;
  6146. return _1[this.startDateField].duplicate()
  6147. }, isc.A.getEventEndDate = function isc_Calendar_getEventEndDate(_1, _2) {
  6148. if (!_1) return null;
  6149. var _3 = this.getEventDuration(_1),
  6150. _4 = _1[this.endDateField];
  6151. if (_3 != null) {
  6152. var _5 = this.getEventDurationUnit(_1) || "mn"
  6153. _4 = this.getEventStartDate(_1);
  6154. if (_5) _4 = isc.DateUtil.dateAdd(_4, _5, _3)
  6155. }
  6156. return _4 ? _4.duplicate() : null
  6157. }, isc.A.isDurationEvent = function isc_Calendar_isDurationEvent(_1) {
  6158. return (!_1[this.endDateField] && _1[this.durationField] != null)
  6159. }, isc.A.getEventDuration = function isc_Calendar_getEventDuration(_1, _2) {
  6160. return _1[this.durationField]
  6161. }, isc.A.getEventDurationUnit = function isc_Calendar_getEventDurationUnit(_1, _2) {
  6162. return _1[this.durationUnitField] || this.$1290
  6163. }, isc.A.isZeroLengthEvent = function isc_Calendar_isZeroLengthEvent(_1) {
  6164. var _2 = this.isDurationEvent(_1),
  6165. _3 = _2 && this.getEventDuration(_1) == 0;
  6166. return _3
  6167. }, isc.A.setShowWeekends = function isc_Calendar_setShowWeekends(_1) {
  6168. this.showWeekends = _1;
  6169. if (isc.isA.TabSet(this.mainView)) {
  6170. var _2 = this.mainView.getSelectedTabNumber();
  6171. this.mainView.removeTabs(this.mainView.tabs);
  6172. if (this.dayView) this.dayView.destroy();
  6173. if (this.weekView) this.weekView.destroy();
  6174. if (this.monthView) this.monthView.destroy();
  6175. var _3 = this.$653();
  6176. this.$53a();
  6177. this.mainView.addTabs(_3);
  6178. this.mainView.selectTab(_2)
  6179. } else {
  6180. var _4 = this.children[0].members[1];
  6181. if (!_4) return;
  6182. var _5 = _4.members[1];
  6183. var _6 = this.$653()[0].pane;
  6184. _4.removeMember(_5);
  6185. _5.destroy();
  6186. _4.addMember(_6);
  6187. this.$53a()
  6188. }
  6189. this.setDateLabel()
  6190. });
  6191. isc.evalBoundary;
  6192. isc.B.push(isc.A.canEditEvent = function isc_Calendar_canEditEvent(_1) {
  6193. if (!_1) return false;
  6194. else if (_1[this.canEditField] != null) return _1[this.canEditField];
  6195. else return this.canEditEvents
  6196. }, isc.A.canDragEvent = function isc_Calendar_canDragEvent(_1) {
  6197. if (!_1 || !this.canEditEvent(_1)) return false;
  6198. if (_1[this.canDragEventField] != null) return _1[this.canDragEventField];
  6199. else return this.canDragEvents
  6200. }, isc.A.canResizeEvent = function isc_Calendar_canResizeEvent(_1) {
  6201. if (!_1 || !this.canEditEvent(_1) || !this.canDragEvent(_1)) return false;
  6202. else if (_1[this.canResizeEventField] != null) return _1[this.canResizeEventField];
  6203. else if (this.isZeroLengthEvent(_1)) return false;
  6204. else return this.canResizeEvents
  6205. }, isc.A.canRemoveEvent = function isc_Calendar_canRemoveEvent(_1) {
  6206. if (!_1) return false;
  6207. else if (_1[this.canRemoveField] != null) return _1[this.canRemoveField];
  6208. else return this.canRemoveEvents && this.canEditEvent(_1)
  6209. }, isc.A.getDateEditingStyle = function isc_Calendar_getDateEditingStyle() {
  6210. if (!this.timelineView) {
  6211. return "time"
  6212. }
  6213. var _1 = this.dateEditingStyle;
  6214. if (!_1) {
  6215. if (this.dataSource) _1 = this.getDataSource().getField(this.startDateField).type;
  6216. if (!_1) {
  6217. switch (this.timelineGranularity) {
  6218. case "day":
  6219. if (!this.timelineView) _1 = "date";
  6220. else if (this.getSnapGapPixels(this.timelineView) < this.timelineView.columnWidth) {
  6221. _1 = "datetime"
  6222. } else {
  6223. _1 = "date"
  6224. }
  6225. break;
  6226. case "hour":
  6227. _1 = "datetime";
  6228. break;
  6229. case "millisecond":
  6230. case "second":
  6231. case "minute":
  6232. _1 = "time";
  6233. break;
  6234. default:
  6235. _1 = "date";
  6236. break
  6237. }
  6238. }
  6239. }
  6240. return _1
  6241. }, isc.A.addLaneEvent = function isc_Calendar_addLaneEvent(_1, _2, _3, _4, _5, _6) {
  6242. _6 = _6 || {};
  6243. var _7 = this.createEventObject(null, _2, _3, _1, _6[this.sublaneNameField], _4, _5);
  6244. this.addCalendarEvent(_7, _6)
  6245. }, isc.A.getCleanEventRecord = function isc_Calendar_getCleanEventRecord(_1) {
  6246. if (isc.propertyDefined(_1, "$646")) delete _1.$646;
  6247. if (isc.propertyDefined(_1, "$126u")) delete _1.$126u;
  6248. if (isc.propertyDefined(_1, "$122k")) delete _1.$122k;
  6249. return _1
  6250. }, isc.A.createEventObject = function isc_Calendar_createEventObject(_1, _2, _3, _4, _5, _6, _7) {
  6251. var _8 = isc.addProperties({}, _1);
  6252. if (_2) _8[this.startDateField] = _2;
  6253. if (_3) _8[this.endDateField] = _3;
  6254. if (_4) _8[this.laneNameField] = _4;
  6255. if (_5) _8[this.sublaneNameField] = _5;
  6256. if (_6) _8[this.nameField] = _6;
  6257. if (_7) _8[this.descriptionField] = _7;
  6258. delete _8.eventLength;
  6259. delete _8.__ref;
  6260. return _8
  6261. }, isc.A.addEvent = function isc_Calendar_addEvent(_1, _2, _3, _4, _5, _6, _7) {
  6262. _5 = _5 || {};
  6263. var _8;
  6264. if (isc.isA.Date(_1)) {
  6265. _8 = this.createEventObject(null, _1, _2, _6 || _5[this.laneNameField], _5[this.sublaneNameField], _3, _4)
  6266. } else if (isc.isAn.Object(_1)) {
  6267. _8 = _1
  6268. } else {
  6269. isc.logWarn('addEvent error: startDate parameter must be either a Date or a CalendarEvent');
  6270. return
  6271. }
  6272. this.addCalendarEvent(_8, _5, _7)
  6273. }, isc.A.addCalendarEvent = function isc_Calendar_addCalendarEvent(_1, _2, _3) {
  6274. if (!_1) return;
  6275. if (_3 == null) _3 = true;
  6276. var _4 = this.getEventStartDate(_1);
  6277. if (!isc.isA.Date(_4)) {
  6278. isc.logWarn('addCalendarEvent: passed event has no start date');
  6279. return
  6280. }
  6281. _1 = this.getCleanEventRecord(isc.addProperties(_1, _2));
  6282. if (_3) this.$53e = true;
  6283. if (this.dataSource) {
  6284. var _5 = this;
  6285. isc.DataSource.get(this.dataSource).addData(_1, function(_6, _7, _8) {
  6286. _5.processSaveResponse(_6, _7, _8)
  6287. }, {
  6288. componentId: this.ID,
  6289. willHandleError: true
  6290. });
  6291. return
  6292. } else {
  6293. this.$53e = true;
  6294. this.data.add(_1);
  6295. this.processSaveResponse({
  6296. status: 0
  6297. }, [_1], {
  6298. operationType: "add"
  6299. })
  6300. }
  6301. }, isc.A.removeEvent = function isc_Calendar_removeEvent(_1, _2) {
  6302. if (_2 == null) _2 = true;
  6303. var _3 = this.getEventStartDate(_1),
  6304. _4 = this.getEventEndDate(_1);
  6305. var _5 = this;
  6306. var _6 = function() {
  6307. if (_5.$53b(_3, _4)) {
  6308. _5.dayView.removeEvent(_1)
  6309. }
  6310. if (_5.$53c(_3, _4)) {
  6311. _5.weekView.removeEvent(_1)
  6312. }
  6313. if (_5.$53d(_3, _4)) {
  6314. _5.monthView.refreshEvents()
  6315. }
  6316. if (_5.$131r(_3, _4)) {
  6317. _5.timelineView.removeEvent(_1);
  6318. if (!_5.dataSource) _5.timelineView.retagLaneEvents(_1[_5.laneNameField])
  6319. }
  6320. if (_5.eventAutoArrange) {
  6321. if (_5.dayView) {
  6322. if (_5.dayView.isSelectedView()) _5.dayView.refreshEvents();
  6323. else _5.dayView.$123s = true
  6324. }
  6325. if (_5.weekView) {
  6326. if (_5.weekView.isSelectedView()) _5.weekView.refreshEvents();
  6327. else _5.weekView.$123s = true
  6328. }
  6329. }
  6330. if (_5.eventRemoved) _5.eventRemoved(_1)
  6331. };
  6332. if (_2) this.$53e = true;
  6333. _1 = this.getCleanEventRecord(_1);
  6334. if (this.dataSource) {
  6335. isc.DataSource.get(this.dataSource).removeData(_1, _6, {
  6336. componentId: this.ID,
  6337. oldValues: _1
  6338. });
  6339. return
  6340. } else {
  6341. this.data.remove(_1);
  6342. _6()
  6343. }
  6344. }, isc.A.updateEvent = function isc_Calendar_updateEvent(_1, _2, _3, _4, _5, _6, _7, _8, _9) {
  6345. if (_7 == null) _7 = true;
  6346. if (!isc.isAn.Object(_6)) _6 = {};
  6347. var _10 = this.createEventObject(_1, _2, _3, _8 || _6[this.laneNameField], _9 || _6[this.sublaneNameField], _4, _5);
  6348. this.updateCalendarEvent(_1, _10, _6, _7)
  6349. }, isc.A.updateCalendarEvent = function isc_Calendar_updateCalendarEvent(_1, _2, _3, _4) {
  6350. if (_4) this.$53e = true;
  6351. _3 = _3 || {};
  6352. var _5 = this.getSelectedView();
  6353. var _6 = _5.getCurrentEventCanvas(_1);
  6354. if (_6) {
  6355. _5.clearEventCanvas(_6)
  6356. }
  6357. if (this.dataSource) {
  6358. var _7 = isc.DataSource.get(this.dataSource);
  6359. var _8 = this.getCleanEventRecord(isc.addProperties({}, _2, _3));
  6360. var _9 = this;
  6361. _7.updateData(_8, function(_11, _12, _13) {
  6362. _9.processSaveResponse(_11, _12, _13, _1)
  6363. }, {
  6364. oldValues: _1,
  6365. componentId: this.ID,
  6366. willHandleError: true
  6367. });
  6368. return
  6369. } else {
  6370. var _10 = isc.addProperties({}, _1);
  6371. isc.addProperties(_1, _2, _3);
  6372. this.processSaveResponse({
  6373. status: 0
  6374. }, [_1], {
  6375. operationType: "update"
  6376. }, _10)
  6377. }
  6378. }, isc.A.processSaveResponse = function isc_Calendar_processSaveResponse(_1, _2, _3, _4) {
  6379. var _5 = isc.isAn.Array(_2) ? _2[0] : _2,
  6380. _6 = _3 ? _3.operationType : null,
  6381. _7 = _6 == "update",
  6382. _8 = _6 == "add",
  6383. _9 = this.$1115,
  6384. _10 = this.$1116;
  6385. delete this.$1115;
  6386. delete this.$1116;
  6387. if (_1 && _1.status < 0) {
  6388. var _11 = _1 ? _1.errors : null;
  6389. if (_9) {
  6390. if (_11) this.eventDialog.items[0].setErrors(_11, true);
  6391. this.displayEventDialog()
  6392. } else if (_10) {
  6393. this.eventEditorLayout.show();
  6394. if (_11) this.eventEditor.setErrors(_11, true)
  6395. } else if (_7 && _4) {
  6396. var _12 = this.getSelectedView();
  6397. if (_12) _12.addEvent(_4);
  6398. if (_11) isc.RPCManager.$a0(_1, _3)
  6399. }
  6400. if (!_11) isc.RPCManager.$a0(_1, _3);
  6401. return
  6402. }
  6403. if (!_5 || isc.isA.String(_5)) {
  6404. if (_8) {
  6405. this.logWarn("Calendar Add operation did not return a record. The operation succeeded but no CalendarViews will be refreshed.")
  6406. return
  6407. } else _5 = _4
  6408. }
  6409. var _13 = _7 && _4 ? this.getEventStartDate(_4) : null,
  6410. _14 = _7 && _4 ? this.getEventEndDate(_4) : null,
  6411. _15 = _7 && _4 ? _4[this.laneNameField] : null,
  6412. _16 = this.getEventStartDate(_5),
  6413. _17 = this.getEventEndDate(_5),
  6414. _18 = _5[this.laneNameField];
  6415. _5.eventLength = (_17.getTime() - _16.getTime());
  6416. if (_5[this.durationField] != null) {
  6417. _5.isDuration = true;
  6418. _5.isZeroDuration = _5[this.durationField] == 0
  6419. }
  6420. var _12 = this.getSelectedView();
  6421. if (this.$53b(_16, _17) || (_7 && this.$53b(_13, _14))) {
  6422. if (!this.dayViewSelected()) this.dayView.$123s = true;
  6423. else {
  6424. if (_7) {
  6425. var _12 = this.dayView;
  6426. if (this.showDayLanes) {
  6427. _12.retagLaneEvents(_15);
  6428. if (_18 != _15) _12.retagLaneEvents(_18)
  6429. } else {
  6430. _12.retagColumnEvents(0)
  6431. }
  6432. } else if (_8) {
  6433. this.dayView.refreshEvents()
  6434. }
  6435. }
  6436. }
  6437. if (this.$53c(_16, _17)) {
  6438. if (!this.weekViewSelected()) this.weekView.$123s = true;
  6439. else {
  6440. var _12 = this.weekView;
  6441. if (_7) {
  6442. _12.retagDayEvents(_13);
  6443. if (isc.DateUtil.compareLogicalDates(_13, _16) != 0) {
  6444. _12.retagDayEvents(_16)
  6445. }
  6446. } else if (_8) {
  6447. _12.addEvent(_5, true);
  6448. _12.retagDayEvents(_16)
  6449. }
  6450. }
  6451. }
  6452. if (this.$53d(_16, _17)) {
  6453. if (!this.monthViewSelected()) this.monthView.$123s = true;
  6454. else this.monthView.refreshEvents()
  6455. }
  6456. if (this.$131r(_16, _17)) {
  6457. if (!this.timelineViewSelected()) this.timelineView.$123s = true;
  6458. else {
  6459. var _12 = this.timelineView;
  6460. if (_7) {
  6461. if (_15 && _15 != _18) _12.retagLaneEvents(_15);
  6462. _12.retagLaneEvents(_18)
  6463. } else if (_8) {
  6464. _12.refreshEvents()
  6465. }
  6466. }
  6467. }
  6468. if (this.$53e) delete this.$53e;
  6469. if (_7 && this.eventChanged) this.eventChanged(_5);
  6470. if (_8 && this.eventAdded) this.eventAdded(_5)
  6471. }, isc.A.refreshEvent = function isc_Calendar_refreshEvent(_1) {
  6472. var _2 = this.getSelectedView();
  6473. var _3 = _2.getCurrentEventCanvas(_1);
  6474. if (_3) {
  6475. _3.setEvent(_1)
  6476. _3.markForRedraw()
  6477. }
  6478. }, isc.A.setEventStyle = function isc_Calendar_setEventStyle(_1, _2) {
  6479. _1.eventWindowStyle = _2;
  6480. var _3 = this.getSelectedView().getCurrentEventCanvas(_1);
  6481. if (_3) {
  6482. _3.setEventStyle(_2);
  6483. _3.markForRedraw()
  6484. }
  6485. }, isc.A.eventsAreSame = function isc_Calendar_eventsAreSame(_1, _2) {
  6486. if (!_1 || !_2) return false;
  6487. if (this.dataSource) {
  6488. var _3 = isc.DataSource.get(this.dataSource),
  6489. _4 = this.getEventPKs(),
  6490. _5 = true;
  6491. for (var i = 0; i < _4.length; i++) {
  6492. var _7 = _4[i];
  6493. if (_1[_7] != _2[_7]) {
  6494. _5 = false;
  6495. break
  6496. }
  6497. }
  6498. return _5
  6499. } else {
  6500. return (_1 === _2)
  6501. }
  6502. }, isc.A.$141h = function isc_Calendar__getEventHoverHTML(_1, _2, _3) {
  6503. var _4 = this,
  6504. _5 = _4.getEventStartDate(_1),
  6505. _6 = _5.toShortDate(this.dateFormatter, false),
  6506. _7 = isc.Time.toTime(_5, this.timeFormatter, false),
  6507. _8 = this.getEventEndDate(_1),
  6508. _9 = _8.toShortDate(this.dateFormatter, false),
  6509. _10 = isc.Time.toTime(_8, this.timeFormatter, false),
  6510. _11 = _1[_4.nameField],
  6511. _12 = _1[_4.descriptionField],
  6512. _13 = isc.StringBuffer.create();
  6513. _13.append("<nobr>");
  6514. if (_3.isTimelineView()) {
  6515. if (isc.DateUtil.compareLogicalDates(_5, _8) != 0) {
  6516. _13.append(_6, "&nbsp;", _7, "&nbsp;-&nbsp;", _9, "&nbsp;", _10)
  6517. } else {
  6518. _13.append(_6, "&nbsp;", _7, "&nbsp;-&nbsp;", _10)
  6519. }
  6520. } else {
  6521. _13.append(_6, "&nbsp;", _7, "&nbsp;-&nbsp;", _10)
  6522. }
  6523. _13.append("<nobr>");
  6524. if (_11) _13.append("<br><br>", _11);
  6525. if (_12) _13.append("<br>", _12);
  6526. var _14 = _13.release(false);
  6527. return this.getEventHoverHTML(_1, _2, _3, _14)
  6528. }, isc.A.getEventHoverHTML = function isc_Calendar_getEventHoverHTML(_1, _2, _3, _4) {
  6529. return _4
  6530. }, isc.A.$141i = function isc_Calendar__getZoneHoverHTML(_1, _2, _3) {
  6531. var _4 = this.$141h(_1, _2, _3);
  6532. return this.getZoneHoverHTML(_1, _2, _3, _4)
  6533. }, isc.A.getZoneHoverHTML = function isc_Calendar_getZoneHoverHTML(_1, _2, _3, _4) {
  6534. return _4
  6535. }, isc.A.$141j = function isc_Calendar__getIndicatorHoverHTML(_1, _2, _3) {
  6536. var _4 = this.$141h(_1, _2, _3);
  6537. return this.getIndicatorHoverHTML(_1, _2, _3, _4)
  6538. }, isc.A.getIndicatorHoverHTML = function isc_Calendar_getIndicatorHoverHTML(_1, _2, _3, _4) {
  6539. return _4
  6540. }, isc.A.$140d = function isc_Calendar__getCellHoverHTML(_1, _2, _3, _4) {
  6541. var _5 = _1.getField(_4),
  6542. _6 = null,
  6543. _7 = null;
  6544. if (!_5) return;
  6545. if (_5.isLaneField) {
  6546. if (!_1.shouldShowLaneFieldHovers()) return;
  6547. _7 = _2 && _2[_5[_1.fieldIdProperty]];
  6548. if (_5.hoverHTML) {
  6549. _7 = _5.hoverHTML(_2, _7, _3, _4, _1)
  6550. }
  6551. } else {
  6552. if (!_1.shouldShowCellHovers()) return;
  6553. var _6 = _1.getDateFromPoint();
  6554. if (_6) {
  6555. _7 = "<nobr>" + this.$178v(_6) + "</nobr>"
  6556. }
  6557. }
  6558. return this.getCellHoverHTML(_1, _2, _3, _4, _6, _7)
  6559. }, isc.A.getCellHoverHTML = function isc_Calendar_getCellHoverHTML(_1, _2, _3, _4, _5, _6) {
  6560. return _6
  6561. }, isc.A.$140e = function isc_Calendar__getHeaderHoverHTML(_1, _2, _3, _4, _5) {
  6562. if (!_1.shouldShowHeaderHovers()) return;
  6563. var _6 = _3 && (_3.title || _3.name);
  6564. if (_2.hoverHTML) {
  6565. _6 = _2.hoverHTML(_1, _4, _5, _6)
  6566. }
  6567. return this.getHeaderHoverHTML(_1, _2, _4, _5, _6)
  6568. }, isc.A.getHeaderHoverHTML = function isc_Calendar_getHeaderHoverHTML(_1, _2, _3, _4, _5) {
  6569. return _5
  6570. }, isc.A.setShowViewHovers = function isc_Calendar_setShowViewHovers(_1, _2) {
  6571. this.showViewHovers = _1;
  6572. if (_2) {
  6573. _2.setShowHover(_1)
  6574. } else {
  6575. if (this.dayView) this.dayView.setShowHover(_1);
  6576. if (this.weekView) this.weekView.setShowHover(_1);
  6577. if (this.monthView) this.monthView.setShowHover(_1);
  6578. if (this.timelineView) this.timelineView.setShowHover(_1)
  6579. }
  6580. }, isc.A.$140a = function isc_Calendar__getDragHoverHTML(_1, _2) {
  6581. _2 = _2 || {};
  6582. var _3 = _2.hoverStyleName || this.hoverStyleName || "";
  6583. var _4 = _2[this.startDateField],
  6584. _5 = _2[this.endDateField],
  6585. _6 = "<div style='" + _3 + "'><nobr>" + this.$178v(_4) + "</nobr></div><div style='" + _3 + "'><nobr>" + this.$178v(_5) + "</nobr></div>";
  6586. return this.getDragHoverHTML(_1, _2, _6)
  6587. }, isc.A.$178v = function isc_Calendar___getLocalDatetimeString(_1) {
  6588. var _2 = _1.toShortDate(this.dateFormatter, false) + " " + isc.Time.toTime(_1, this.timeFormatter);
  6589. return _2
  6590. }, isc.A.getDragHoverHTML = function isc_Calendar_getDragHoverHTML(_1, _2, _3) {
  6591. return _3
  6592. }, isc.A.$140c = function isc_Calendar__mouseMoved(_1, _2, _3, _4, _5, _6) {
  6593. if (!_1) return;
  6594. if (isc.DateUtil.compareDates(_3, _4) != 0) {
  6595. if (this.mouseDateChanged) this.mouseDateChanged(_1, _3, _4)
  6596. }
  6597. var _7 = _1.getField(_6),
  6598. _8 = _7 && (_7.isLaneField || _7.isLabelField),
  6599. _9 = _7 && _7.date,
  6600. _10 = _2 && _2.$81f,
  6601. _11;
  6602. if (_8 && !_1.shouldShowLaneFieldHovers()) return;
  6603. if (_9 && !_1.shouldShowCellHovers()) return;
  6604. if (!_10) {
  6605. if (_2 == _1 || _2 == _1.body || _2 == _1.frozenBody) {
  6606. _11 = _1.getHoverHTML();
  6607. if (_11) {
  6608. _1.startHover()
  6609. }
  6610. } else {
  6611. _11 = _2.getHoverHTML();
  6612. if (isc.Hover.lastHoverCanvas != _2) {
  6613. _2.startHover()
  6614. }
  6615. }
  6616. } else if (_2 && _2.getHoverHTML) {
  6617. if (!_1.isMonthView()) {
  6618. if (isc.Hover.lastHoverCanvas != _2) {
  6619. _2.startHover()
  6620. }
  6621. }
  6622. }
  6623. }, isc.A.$53b = function isc_Calendar__shouldRefreshDay(_1, _2) {
  6624. if (!this.dayView || !this.dayView.body) return false;
  6625. var _3 = _1.getTime() < this.chosenDateEnd.getTime(),
  6626. _4 = _2.getTime() > this.chosenDateStart.getTime();
  6627. return (_3 && _4)
  6628. }, isc.A.$53c = function isc_Calendar__shouldRefreshWeek(_1, _2) {
  6629. if (!this.weekView || !this.weekView.body) return false;
  6630. var _3 = _1.getTime() < this.chosenWeekEnd.getTime(),
  6631. _4 = _2.getTime() > this.chosenWeekStart.getTime();
  6632. return (_3 && _4)
  6633. }, isc.A.$53d = function isc_Calendar__shouldRefreshMonth(_1, _2) {
  6634. if (!this.monthView || !this.monthView.body) return false;
  6635. var _3 = new Date(this.year, this.month, -7, 0, 0, 0).getTime(),
  6636. _4 = new Date(this.year, this.month, 37, 23, 59, 59).getTime();
  6637. return (_1.getTime() < _4 && _2.getTime() > _3)
  6638. }, isc.A.$131r = function isc_Calendar__shouldRefreshTimeline(_1, _2) {
  6639. if (!this.timelineView || !this.timelineView.body) return false;
  6640. var _3 = _1.getTime() < this.timelineView.endDate.getTime(),
  6641. _4 = _2.getTime() > this.timelineView.startDate.getTime();
  6642. return (_3 && _4)
  6643. }, isc.A.getEventCanvasConstructor = function isc_Calendar_getEventCanvasConstructor(_1, _2) {
  6644. _2 = _2 || this.getSelectedView();
  6645. return _2.getEventCanvasConstructor(_1) || this.eventCanvasConstructor
  6646. }, isc.A.getEventCanvasStyle = function isc_Calendar_getEventCanvasStyle(_1, _2) {
  6647. _2 = _2 || this.getSelectedView();
  6648. var _3 = this.$131j(_1) || _2.getEventCanvasStyle(_1) || this.eventWindowStyle || this.eventStyleName;
  6649. return _3
  6650. }, isc.A.$1700 = function isc_Calendar__showEventCanvasContextMenu(_1) {
  6651. if (this.showEventCanvasContextMenu == false) return false;
  6652. var _2 = this.getEventCanvasMenuItems(_1);
  6653. if (_2 && _2.length > 0) {
  6654. if (!this.eventCanvasContextMenu) this.addAutoChild("eventCanvasContextMenu");
  6655. this.eventCanvasContextMenu.setData(_2);
  6656. _1.contextMenu = this.eventCanvasContextMenu;
  6657. _1.showContextMenu();
  6658. return false
  6659. }
  6660. return true
  6661. }, isc.A.$1701 = function isc_Calendar__eventCanvasContextClick(_1) {
  6662. return this.$1700(_1)
  6663. }, isc.A.getEventCanvasMenuItems = function isc_Calendar_getEventCanvasMenuItems(_1, _2) {
  6664. return
  6665. }, isc.A.hideEventCanvasControls = function isc_Calendar_hideEventCanvasControls(_1, _2) {
  6666. var _3 = _1[_2];
  6667. if (!_3) return;
  6668. var _4 = ["closeButton", "contextButton"];
  6669. for (var _5 in _3) {
  6670. var _6 = _3[_5];
  6671. _6.hide();
  6672. delete _6.eventCanvas;
  6673. if (!_4.contains(_5)) this.addChild(_6)
  6674. }
  6675. delete _1[_2]
  6676. }, isc.A.$174c = function isc_Calendar__createEventCanvasControls(_1, _2) {
  6677. var _3 = {};
  6678. var _4 = this.createAutoChild("eventCanvasButtonLayout");
  6679. _3.contextButton = this.createAutoChild("eventCanvasContextButton");
  6680. _4.addMember(_3.contextButton);
  6681. if (this.canRemoveEvents != false) {
  6682. _3.closeButton = this.createAutoChild("eventCanvasCloseButton");
  6683. _4.addMember(_3.closeButton)
  6684. }
  6685. _3.buttonLayout = _4;
  6686. if (this.canResizeEvents != false) {
  6687. if (!_1 || _1.vertical) {
  6688. _3.endResizerB = this.getEventCanvasResizer(null, "B", _2)
  6689. }
  6690. if (!_1 || !_1.vertical) {
  6691. _3.startResizerL = this.getEventCanvasResizer(null, "L", _2);
  6692. _3.endResizerR = this.getEventCanvasResizer(null, "R", _2)
  6693. }
  6694. }
  6695. return _3
  6696. }, isc.A.$174d = function isc_Calendar__getRolloverControls() {
  6697. if (!this.$129e) {
  6698. this.$129e = this.$174c()
  6699. }
  6700. return this.$129e
  6701. }, isc.A.$174e = function isc_Calendar__getFocusControls() {
  6702. if (!this.$174f) {
  6703. this.$174f = this.$174c(null, true)
  6704. }
  6705. return this.$174f
  6706. }, isc.A.$174g = function isc_Calendar__focusEventCanvas(_1) {
  6707. if (!_1 || _1.$174h) {
  6708. return
  6709. }
  6710. if (_1.$129e) {
  6711. this.hideEventCanvasControls(_1, "$129e")
  6712. }
  6713. _1.updateRolloverControls()
  6714. }, isc.A.$174i = function isc_Calendar__blurEventCanvas(_1) {
  6715. if (!_1 || _1.$174h) {
  6716. return
  6717. }
  6718. this.hideEventCanvasControls(_1, "$174f");
  6719. _1.updateRolloverControls()
  6720. }, isc.A.getEventCanvasGripper = function isc_Calendar_getEventCanvasGripper(_1, _2, _3) {
  6721. _1 = _1 || {};
  6722. _1.src = this.getEventCanvasGripperIcon(_2, _3);
  6723. var _4 = this.createAutoChild("eventCanvasGripper", _1);
  6724. _3.addChild(_4);
  6725. return _4
  6726. }, isc.A.getEventCanvasGripperIcon = function isc_Calendar_getEventCanvasGripperIcon(_1, _2) {
  6727. return _1.gripperIcon || this.eventCanvasGripperIcon
  6728. }, isc.A.getEventCanvasLabel = function isc_Calendar_getEventCanvasLabel(_1, _2) {
  6729. var _3 = this.createAutoChild("eventCanvasLabel", _1);
  6730. _2.addChild(_3);
  6731. return _3
  6732. }, isc.A.$174b = function isc_Calendar__eventCanvasCloseClick(_1) {
  6733. if (this.eventRemoveClick(_1.event, _1.calendarView.viewName) != false) {
  6734. this.removeEvent(_1.event, false)
  6735. }
  6736. }, isc.A.getEventCanvasCloseButton = function isc_Calendar_getEventCanvasCloseButton(_1) {
  6737. if (this.useEventCanvasRolloverControls) {
  6738. if (!this.eventCanvasCloseButton) {
  6739. this.eventCanvasCloseButton = this.addAutoChild("eventCanvasCloseButton")
  6740. }
  6741. return this.eventCanvasCloseButton
  6742. } else {
  6743. return this.createAutoChild("eventCanvasCloseButton")
  6744. }
  6745. }, isc.A.getEventCanvasContextButton = function isc_Calendar_getEventCanvasContextButton(_1) {
  6746. if (this.useEventCanvasRolloverControls) {
  6747. if (!this.eventCanvasContextButton) {
  6748. this.eventCanvasContextButton = this.addAutoChild("eventCanvasContextButton")
  6749. }
  6750. return this.eventCanvasContextButton
  6751. } else {
  6752. return this.createAutoChild("eventCanvasContextButton")
  6753. }
  6754. }, isc.A.getEventCanvasResizer = function isc_Calendar_getEventCanvasResizer(_1, _2, _3) {
  6755. var _4 = "eventCanvasResizer" + _2,
  6756. _5 = _3 ? null : this[_4];
  6757. if (!this.useEventCanvasRolloverControls || !_5) {
  6758. var _6 = "eventCanvas" + (["T", "B"].contains(_2) ? "V" : "H") + "Resizer",
  6759. _7 = {
  6760. snapTo: _2,
  6761. getEventEdge: function() {
  6762. return this.snapTo
  6763. }
  6764. };
  6765. _5 = this.createAutoChild(_6, _7);
  6766. if (!_3 && this.useEventCanvasRolloverControls) this[_4] = _5
  6767. }
  6768. return _5
  6769. }, isc.A.setShowZones = function isc_Calendar_setShowZones(_1) {
  6770. this.showZones = _1;
  6771. var _2 = this.timelineView;
  6772. if (_2 && _2.isSelectedView()) _2.refreshEvents();
  6773. else if (_2) _2.$123s = true
  6774. }, isc.A.setZones = function isc_Calendar_setZones(_1) {
  6775. if (!_1) {
  6776. return
  6777. }
  6778. this.zones = _1;
  6779. if (this.timelineView) {
  6780. this.timelineView.drawZones()
  6781. }
  6782. }, isc.A.addZone = function isc_Calendar_addZone(_1) {
  6783. if (!_1) return;
  6784. this.zones = this.zones || [];
  6785. this.zones.add(_1);
  6786. this.setZones(this.zones)
  6787. }, isc.A.removeZone = function isc_Calendar_removeZone(_1) {
  6788. if (!_1 || !this.zones) return;
  6789. if (isc.isA.String(_1)) _1 = this.zones.find(this.nameField, _1);
  6790. if (_1) {
  6791. this.zones.remove(_1);
  6792. this.setZones(this.zones)
  6793. }
  6794. }, isc.A.getZoneCanvas = function isc_Calendar_getZoneCanvas(_1, _2) {
  6795. var _3 = {
  6796. calendar: this,
  6797. calendarView: _2,
  6798. event: _1,
  6799. isZoneCanvas: true,
  6800. styleName: this.getZoneCanvasStyle(_1, _2)
  6801. };
  6802. var _4 = this.createAutoChild("zoneCanvas", _3, this.zoneCanvasConstructor);
  6803. if (this.customizeCanvas) this.customizeCanvas(_4, _2);
  6804. return _4
  6805. }, isc.A.$131j = function isc_Calendar__getEventStyleName(_1) {
  6806. return _1[this.eventWindowStyleField] || _1[this.eventStyleNameField]
  6807. }, isc.A.getZoneCanvasStyle = function isc_Calendar_getZoneCanvasStyle(_1, _2) {
  6808. _2 = _2 || this.getSelectedView();
  6809. var _3 = this.$131j(_1) || (_2 && _2.zoneStyleName) || this.zoneStyleName;
  6810. return _3
  6811. }, isc.A.setShowIndicators = function isc_Calendar_setShowIndicators(_1) {
  6812. this.showIndicators = _1;
  6813. var _2 = this.timelineView;
  6814. if (_2 && _2.isSelectedView()) _2.refreshEvents();
  6815. else if (_2) _2.$123s = true
  6816. }, isc.A.getIndicatorCanvas = function isc_Calendar_getIndicatorCanvas(_1, _2) {
  6817. _2 = _2 || this.getSelectedView();
  6818. var _3 = {
  6819. calendar: this,
  6820. calendarView: _2,
  6821. event: _1,
  6822. isIndicatorCanvas: true,
  6823. styleName: this.getIndicatorCanvasStyle(_1, _2),
  6824. dragTarget: _2.eventDragTarget
  6825. },
  6826. _4 = this.createAutoChild("indicatorCanvas", _3, this.indicatorCanvasConstructor);
  6827. if (this.customizeCanvas) this.customizeCanvas(_4, _2);
  6828. return _4
  6829. }, isc.A.getIndicatorCanvasStyle = function isc_Calendar_getIndicatorCanvasStyle(_1, _2) {
  6830. _2 = _2 || this.getSelectedView();
  6831. return this.$131j(_1) || (_2 && _2.indicatorStyleName) || this.indicatorStyleName
  6832. }, isc.A.setIndicators = function isc_Calendar_setIndicators(_1) {
  6833. if (!_1) {
  6834. return
  6835. }
  6836. this.indicators = _1;
  6837. if (this.timelineView) {
  6838. this.timelineView.drawIndicators()
  6839. }
  6840. }, isc.A.addIndicator = function isc_Calendar_addIndicator(_1) {
  6841. if (!_1) return;
  6842. this.indicators = this.indicators || [];
  6843. this.indicators.add(_1);
  6844. this.setIndicators(this.indicators)
  6845. }, isc.A.removeIndicator = function isc_Calendar_removeIndicator(_1) {
  6846. if (!_1 || !this.indicators) return;
  6847. if (isc.isA.String(_1)) _1 = this.indicators.find(this.nameField, _1);
  6848. if (_1) {
  6849. this.indicators.remove(_1);
  6850. this.setIndicators(this.indicators)
  6851. }
  6852. }, isc.A.$129r = function isc_Calendar__getEventCanvas(_1, _2) {
  6853. var _3 = this.canDragEvent(_1),
  6854. _4 = this.canEditEvent(_1),
  6855. _5 = this.canResizeEvent(_1),
  6856. _6 = this.canRemoveEvent(_1),
  6857. _7 = this.getEventCanvasStyle(_1, _2),
  6858. _8 = false;
  6859. var _9 = isc.addProperties({
  6860. autoDraw: false,
  6861. calendar: this,
  6862. calendarView: _2,
  6863. baseStyle: _7,
  6864. canDragReposition: _3,
  6865. canDragResize: _5,
  6866. _redrawWithParent: false,
  6867. showCloseButton: _6,
  6868. descriptionText: _1[this.descriptionField],
  6869. dragTarget: _2.eventDragTarget,
  6870. headerProps: isc.addProperties({}, {
  6871. dragTarget: _2.eventDragTarget
  6872. }),
  6873. footerProperties: {
  6874. dragTarget: _2.eventDragTarget
  6875. }
  6876. }, this.eventWindowDefaults, this.eventWindowProperties);
  6877. var _10 = _2.$128h,
  6878. _11 = _2.getCurrentEventCanvas(_1),
  6879. _12 = (_11 != null);
  6880. if (_12) {
  6881. _2.$128h.remove(_11)
  6882. } else if (_2.useEventCanvasPool) {
  6883. _11 = _2.getPooledEventCanvas(_1);
  6884. if (_11) {
  6885. _8 = true
  6886. }
  6887. }
  6888. if (_11) {
  6889. if (!_11.setEvent) {
  6890. if (!_12) _11.setProperties(_9);
  6891. _11.event = _1;
  6892. _11.setEventStyle(_7)
  6893. }
  6894. } else {
  6895. _9 = {
  6896. calendar: this,
  6897. calendarView: _2
  6898. };
  6899. var _13 = this.getEventCanvasConstructor(_1, _2);
  6900. _11 = this.createAutoChild("eventCanvas", _9, _13)
  6901. }
  6902. if (_2.$129c && !_2.$129c.contains(_11))
  6903. _2.$129c.add(_11);
  6904. if (_2.$128q && !_2.$128q.contains(_1))
  6905. _2.$128q.add(_1);
  6906. _11.$128k = false;
  6907. if (_11.setEvent) _11.setEvent(_1, _7);
  6908. this.setEventCanvasID(_2, _1, _11.ID);
  6909. if (this.customizeCanvas) this.customizeCanvas(_11, _2);
  6910. return _11
  6911. }, isc.A.$53g = function isc_Calendar__getEventsInRange(_1, _2, _3, _4) {
  6912. var _5 = [],
  6913. _6 = this.getWeekendDays(),
  6914. _7 = this.data.getLength(),
  6915. _8 = [],
  6916. _9 = _1.getTime(),
  6917. _10 = _2.getTime();
  6918. _3 = _3 || this.getSelectedView();
  6919. if (_4) {
  6920. var _11 = _3.body.getVisibleColumns();
  6921. if (_11[0] >= 0 && _11[1] >= 0) {
  6922. for (var i = _11[0]; i <= _11[1]; i++) {
  6923. _8.add(_3.body.fields[i][this.laneNameField])
  6924. }
  6925. }
  6926. }
  6927. for (var i = 0; i < _7; i++) {
  6928. var _13 = this.data.get(i),
  6929. _14 = this.getEventStartDate(_13);
  6930. if (_4 && !_8.contains(_13[this.laneNameField])) continue;
  6931. if (!_13 || !_14) return [];
  6932. if (_14.getTime() >= _1.getTime() && _14.getTime() <= _2.getTime() && (this.showWeekends || !_6.contains(_14.getDay()))) {
  6933. if (_3 && _3.isWeekView()) _5.add(_13);
  6934. else if (!this.showDayLanes || _8.contains(_13[this.laneNameField]))
  6935. _5.add(_13)
  6936. }
  6937. }
  6938. return _5
  6939. }, isc.A.getDayEnd = function isc_Calendar_getDayEnd(_1) {
  6940. return isc.DateUtil.getEndOf(_1, "d", null, this.firstDayOfWeek)
  6941. }, isc.A.isTimeline = function isc_Calendar_isTimeline() {
  6942. var _1 = this.getCurrentViewName() == "timeline";
  6943. return _1
  6944. }, isc.A.$129t = function isc_Calendar__storeChosenDateRange(_1) {
  6945. this.chosenDateStart = isc.DateUtil.getStartOf(_1, "d", false);
  6946. this.chosenDateEnd = isc.DateUtil.getEndOf(_1, "d", false);
  6947. var _2 = this.chosenWeekStart = isc.DateUtil.getStartOf(_1, "w", null, this.firstDayOfWeek);
  6948. if (isc.DateUtil.compareDates(this.chosenDate, _2) == 1) {
  6949. this.chosenWeekStart.setDate(this.chosenWeekStart.getDate() - 7)
  6950. }
  6951. this.chosenWeekEnd = isc.DateUtil.getEndOf(this.chosenWeekStart.duplicate(), "w", null, this.firstDayOfWeek);
  6952. if (isc.DateUtil.compareDates(this.chosenDate, this.chosenWeekEnd) == -1) {
  6953. this.chosenWeekStart.setDate(this.chosenWeekStart.getDate() + 7);
  6954. this.chosenWeekEnd.setDate(this.chosenWeekEnd.getDate() + 7)
  6955. }
  6956. }, isc.A.setChosenDate = function isc_Calendar_setChosenDate(_1, _2) {
  6957. var _3 = this.getSelectedView();
  6958. var _4 = isc.Calendar.$1833(_1);
  6959. this.year = _4.getFullYear();
  6960. this.month = _4.getMonth();
  6961. var _5 = isc.Calendar.$1833(this.chosenDate);
  6962. this.chosenDate = _1;
  6963. this.$129t(_1.duplicate());
  6964. if (this.dayView) {
  6965. var _6 = {
  6966. date: isc.DateUtil.createLogicalDate(_1.getFullYear(), _1.getMonth(), _1.getDate()),
  6967. $654: _1.getDay(),
  6968. $658: _1.getDate(),
  6969. $659: _1.getMonth(),
  6970. $66a: _1.getFullYear()
  6971. },
  6972. _7;
  6973. for (var i = 0; i < this.dayView.body.fields.length; i++) {
  6974. _7 = this.dayView.body.getField(i);
  6975. if (_7) isc.addProperties(_7, _6)
  6976. }
  6977. isc.DaySchedule.$129g(this, this.dayView, this.chosenDate)
  6978. }
  6979. if (_5.getFullYear() != this.year || _5.getMonth() != this.month) {
  6980. if (this.monthView) {
  6981. if (this.monthViewSelected()) this.monthView.$1739();
  6982. else this.monthView.$123s = true
  6983. }
  6984. } else if (this.selectChosenDate) {
  6985. if (this.monthView) this.monthView.selectChosenDateCells()
  6986. }
  6987. if (this.weekView) {
  6988. if (_4.getWeek(this.firstDayOfWeek) != this.weekView.startDate.getWeek(this.firstDayOfWeek)) {
  6989. this.$53a();
  6990. if (this.weekViewSelected()) this.weekView.$1739();
  6991. else this.weekView.$123s = true
  6992. }
  6993. }
  6994. var _9 = _4.getTime();
  6995. if (_9 != _5.getTime()) {
  6996. if (this.dayView) {
  6997. this.dayView.markForRedraw();
  6998. if (this.dayViewSelected()) this.dayView.$1739();
  6999. else this.dayView.$123s = true
  7000. }
  7001. }
  7002. if (this.timelineView && !_2) {
  7003. this.timelineView.setTimelineRange(this.chosenDate, null, null, null, null, this.headerLevels, true)
  7004. } else {
  7005. if (this.scrollToWorkday && _3.scrollToWorkdayStart) {
  7006. _3.scrollToWorkdayStart()
  7007. } else {
  7008. _3.redraw()
  7009. }
  7010. }
  7011. if (this.monthButton) this.updateMonthButton();
  7012. this.setDateLabel();
  7013. this.dateChanged()
  7014. }, isc.A.dateIsWorkday = function isc_Calendar_dateIsWorkday(_1, _2) {
  7015. if (!_1 || !this.workdays) return false;
  7016. return this.workdays.contains(_1.getDay())
  7017. }, isc.A.adjustCriteria = function isc_Calendar_adjustCriteria(_1) {
  7018. return _1
  7019. }, isc.A.shouldIncludeRangeCriteria = function isc_Calendar_shouldIncludeRangeCriteria(_1) {
  7020. _1 = _1 || this.getSelectedView();
  7021. if (_1 && _1.includeRangeCriteria != null) return _1.includeRangeCriteria;
  7022. return this.includeRangeCriteria
  7023. }, isc.A.$wo = function isc_Calendar__filter(_1, _2, _3, _4, _5) {
  7024. var _6 = this.getSelectedView();
  7025. if (this.shouldIncludeRangeCriteria(_6)) {
  7026. if (_2) {
  7027. _2 = isc.DS.removeCriteriaForField(_2, this.startDateField);
  7028. _2 = isc.DS.removeCriteriaForField(_2, this.endDateField)
  7029. }
  7030. var _7 = this.getRangeCriteria(_6);
  7031. if (_7) {
  7032. if (!_2 || isc.isA.emptyObject(_2)) _2 = _7;
  7033. else {
  7034. _2 = isc.DS.combineCriteria(_2, _7)
  7035. }
  7036. }
  7037. _2 = isc.DS.compressNestedCriteria(_2)
  7038. }
  7039. return this.Super("$wo", arguments)
  7040. }, isc.A.getRangeCriteria = function isc_Calendar_getRangeCriteria(_1) {
  7041. _1 = _1 || this.getSelectedView();
  7042. if (!_1) return null;
  7043. if (!this.shouldIncludeRangeCriteria(_1)) return null;
  7044. var _2 = null,
  7045. _3 = null,
  7046. _4 = {},
  7047. _5 = _1.rangeCriteriaMode || this.rangeCriteriaMode || "none";
  7048. if (_5 == "auto") {
  7049. var _6 = this.getLargestScrollableRange();
  7050. _2 = _6[0];
  7051. _3 = _6[1]
  7052. } else if (_5 != "none") {
  7053. _2 = this.getVisibleStartDate(_1);
  7054. _3 = this.getVisibleEndDate(_1)
  7055. }
  7056. if (_2 && _3) {
  7057. _4 = {
  7058. _constructor: "AdvancedCriteria",
  7059. operator: "and",
  7060. criteria: [{
  7061. fieldName: this.startDateField,
  7062. operator: "lessThan",
  7063. value: _3
  7064. }, {
  7065. fieldName: this.endDateField,
  7066. operator: "greaterThan",
  7067. value: _2
  7068. }]
  7069. }
  7070. }
  7071. _4 = this.adjustCriteria(_4);
  7072. return _4
  7073. }, isc.A.$53a = function isc_Calendar__setWeekTitles() {
  7074. if (!this.weekView) return;
  7075. var _1 = this.chosenWeekStart.duplicate();
  7076. var _2 = isc.DateUtil.getShortDayNames();
  7077. var _3 = this.getWeekendDays();
  7078. isc.DaySchedule.$129g(this, this.weekView, this.chosenWeekStart);
  7079. for (var i = 1; i < 8; i++) {
  7080. if (this.weekView.getFieldNum("day" + i) >= 0) {
  7081. var _5 = _1.toShortDate(this.dateFormatter, false);
  7082. if (_5.match(this.$81i) != null) _5 = _5.substring(5);
  7083. else if (_5.match(this.$81j)) _5 = _5.substring(0, _5.length - 5);
  7084. var _6 = _2[_1.getDay()] + " " + _5;
  7085. var p = {
  7086. title: _6,
  7087. align: "right",
  7088. $654: _1.getDay(),
  7089. $658: _1.getDate(),
  7090. $659: _1.getMonth(),
  7091. $66a: _1.getFullYear()
  7092. };
  7093. p.date = isc.DateUtil.createLogicalDate(p.$66a, p.$659, p.$658), this.weekView.setFieldProperties("day" + i, p);
  7094. if (this.weekView.header) this.weekView.header.markForRedraw()
  7095. }
  7096. _1.setDate(_1.getDate() + 1)
  7097. }
  7098. this.weekView.startDate = this.chosenWeekStart;
  7099. this.weekView.endDate = this.chosenWeekEnd;
  7100. this.weekView.redraw()
  7101. }, isc.A.next = function isc_Calendar_next() {
  7102. var _1;
  7103. if (this.dayViewSelected()) {
  7104. _1 = isc.DateUtil.createDatetime(this.year, this.month, this.chosenDate.getDate() + 1);
  7105. if (!this.showWeekends) {
  7106. var _2 = this.getWeekendDays();
  7107. for (var i = 0; i < _2.length; i++) {
  7108. if (_2.contains(_1.getDay())) _1.setDate(_1.getDate() + 1)
  7109. }
  7110. }
  7111. } else if (this.weekViewSelected()) {
  7112. _1 = isc.DateUtil.createDatetime(this.year, this.month, this.chosenDate.getDate() + 7)
  7113. } else if (this.monthViewSelected()) {
  7114. _1 = isc.DateUtil.createDatetime(this.year, this.month + 1, 1)
  7115. } else if (this.timelineViewSelected()) {
  7116. _1 = this.chosenDate.duplicate();
  7117. this.timelineView.nextOrPrev(true);
  7118. return
  7119. }
  7120. this.dateChooser.setData(_1);
  7121. this.setChosenDate(_1)
  7122. }, isc.A.previous = function isc_Calendar_previous() {
  7123. var _1;
  7124. if (this.dayViewSelected()) {
  7125. _1 = isc.DateUtil.createDatetime(this.year, this.month, this.chosenDate.getDate() - 1);
  7126. if (!this.showWeekends) {
  7127. var _2 = this.getWeekendDays();
  7128. for (var i = 0; i < _2.length; i++) {
  7129. if (_2.contains(_1.getDay())) _1.setDate(_1.getDate() - 1)
  7130. }
  7131. }
  7132. } else if (this.weekViewSelected()) {
  7133. _1 = isc.DateUtil.dateAdd(isc.DateUtil.getStartOf(this.chosenDate, "w"), "w", 1, -1)
  7134. } else if (this.monthViewSelected()) {
  7135. _1 = isc.DateUtil.createDatetime(this.year, this.month - 1, 1)
  7136. } else if (this.timelineViewSelected()) {
  7137. this.timelineView.nextOrPrev(false);
  7138. return
  7139. }
  7140. this.dateChooser.setData(_1);
  7141. this.setChosenDate(_1)
  7142. }, isc.A.dataArrived = function isc_Calendar_dataArrived() {
  7143. if (this.$1746) this.dataChanged();
  7144. return true
  7145. }, isc.A.draw = function isc_Calendar_draw(_1, _2, _3, _4) {
  7146. this.$1737 = true;
  7147. this.invokeSuper(isc.Calendar, "draw", _1, _2, _3, _4);
  7148. if (isc.ResultSet && isc.isA.ResultSet(this.data) && this.dataSource) {
  7149. if (!this.isObserving(this.data, "dataArrived")) {
  7150. this.observe(this.data, "dataArrived", "observer.dataArrived(arguments[0], arguments[1])")
  7151. }
  7152. }
  7153. if (this.mainView.isA("TabSet")) {
  7154. if (this.showControlsBar != false) {
  7155. this.mainView.addChild(this.controlsBar);
  7156. this.controlsBar.moveAbove(this.mainView.tabBar)
  7157. }
  7158. }
  7159. if (!isc.isA.TabSet(this.mainView)) {
  7160. this.setChosenDate(this.chosenDate)
  7161. } else {
  7162. this.setDateLabel()
  7163. }
  7164. delete this.$1737;
  7165. if (this.$187g) {
  7166. var _5 = this.$187g;
  7167. delete this.$187g;
  7168. this.scrollToTime(_5)
  7169. }
  7170. }, isc.A.$653 = function isc_Calendar__getTabs() {
  7171. var _1 = [],
  7172. _2 = {
  7173. calendar: this,
  7174. baseStyle: this.baseStyle
  7175. },
  7176. _3 = this.lanes ? this.lanes.duplicate() : null;
  7177. if (this.showDayView != false) {
  7178. this.dayView = this.createAutoChild("dayView", isc.addProperties({
  7179. viewName: "day",
  7180. startDate: this.chosenDateStart,
  7181. endDate: this.chosenDateEnd
  7182. }, _2, {
  7183. cellHeight: this.rowHeight,
  7184. enforceVClipping: true
  7185. }));
  7186. _1.add({
  7187. title: this.dayViewTitle,
  7188. pane: this.dayView,
  7189. viewName: "day"
  7190. })
  7191. }
  7192. if (this.showWeekView != false) {
  7193. this.weekView = this.createAutoChild("weekView", isc.addProperties({
  7194. viewName: "week"
  7195. }, _2, {
  7196. cellHeight: this.rowHeight,
  7197. enforceVClipping: true
  7198. }));
  7199. _1.add({
  7200. title: this.weekViewTitle,
  7201. pane: this.weekView,
  7202. viewName: "week"
  7203. })
  7204. }
  7205. if (this.showMonthView != false) {
  7206. this.monthView = this.createAutoChild("monthView", isc.addProperties({
  7207. viewName: "month"
  7208. }, _2, {
  7209. bodyConstructor: "MonthScheduleBody"
  7210. }));
  7211. _1.add({
  7212. title: this.monthViewTitle,
  7213. pane: this.monthView,
  7214. viewName: "month"
  7215. })
  7216. }
  7217. if (this.showTimelineView != false) {
  7218. this.timelineView = this.createAutoChild("timelineView", isc.addProperties({
  7219. viewName: "timeline",
  7220. startDate: this.startDate,
  7221. endDate: this.endDate
  7222. }, _2));
  7223. _1.add({
  7224. title: this.timelineViewTitle,
  7225. pane: this.timelineView,
  7226. viewName: "timeline"
  7227. })
  7228. }
  7229. return _1
  7230. });
  7231. isc.evalBoundary;
  7232. isc.B.push(isc.A.$655 = function isc_Calendar__createTabSet(_1) {
  7233. if (_1.length > 1) {
  7234. this.mainView = this.createAutoChild("mainView", {
  7235. tabs: _1,
  7236. $8c: function(_6) {
  7237. this.Super("$8c", arguments);
  7238. var _2 = this.getTabPane(_6);
  7239. this.creator.$567 = _2.viewName;
  7240. this.creator.setDateLabel();
  7241. var _3 = this.creator.getSelectedView();
  7242. if (_3.isDrawn()) _3.redraw();
  7243. if (_3.$123s) {
  7244. _3.$1739()
  7245. }
  7246. this.creator.currentViewChanged(_2.viewName)
  7247. }
  7248. });
  7249. var _4;
  7250. if (this.currentViewName) {
  7251. _4 = _1.find("viewName", this.currentViewName);
  7252. if (_4) this.mainView.selectTab(_4)
  7253. } else if (this.minimalUI) {
  7254. this.pageOrientationChanged()
  7255. } else {
  7256. var _5 = this.weekView ? "week" : (this.dayView ? "day" : (this.monthView ? "month" : (this.timelineView ? "timeline" : null)));
  7257. if (_5) {
  7258. _4 = _1.find("viewName", _5);
  7259. if (_4) {
  7260. this.mainView.selectTab(_4);
  7261. this.mainView.viewName = _5;
  7262. this.$567 = _5
  7263. }
  7264. }
  7265. }
  7266. } else {
  7267. this.mainView = _1[0].pane
  7268. }
  7269. }, isc.A.getLaneMap = function isc_Calendar_getLaneMap() {
  7270. if (!this.isTimeline() && !this.showDayLanes) return {};
  7271. var _1 = this.showDayLanes ? this.lanes : this.canGroupLanes ? this.timelineView.getOriginalData() : this.timelineView.data,
  7272. _2 = {};
  7273. for (var i = 0; i < _1.length; i++) {
  7274. var _4 = _1[i].name || _1[i][this.laneNameField],
  7275. _5 = _1[i].title || _4;
  7276. _2[_4] = _5
  7277. }
  7278. return _2
  7279. }, isc.A.getSublaneMap = function isc_Calendar_getSublaneMap(_1, _2) {
  7280. _2 = _2 || this.getSelectedView();
  7281. var _3 = {};
  7282. if (isc.isA.String(_1)) _1 = _2.getLane(_1);
  7283. if (_1 && _1.sublanes) {
  7284. for (var i = 0; i < _1.sublanes.length; i++) {
  7285. var _5 = _1.sublanes[i],
  7286. _6 = _5.name || _5[this.laneNameField],
  7287. _7 = _5.title || _6;
  7288. _3[_6] = _7
  7289. }
  7290. }
  7291. return _3
  7292. }, isc.A.getLanePadding = function isc_Calendar_getLanePadding(_1) {
  7293. _1 = _1 || this.getSelectedView();
  7294. if (_1 && _1.useLanePadding()) return this.laneEventPadding;
  7295. return 0
  7296. }, isc.A.getLaneEvents = function isc_Calendar_getLaneEvents(_1, _2) {
  7297. var _3 = isc.isAn.Object(_1) ? _1.name : _1;
  7298. if (!_3 || !isc.isA.String(_3)) return [];
  7299. _2 = _2 || this.getSelectedView();
  7300. var _4 = this.data.findAll(this.laneNameField, _3) || [],
  7301. _5 = [];
  7302. for (var i = 0; i < _4.length; i++) {
  7303. var _7 = _4[i];
  7304. if (!_7) continue;
  7305. if (this.shouldShowEvent(_7, _2)) {
  7306. _5.add(_7)
  7307. }
  7308. }
  7309. return _5
  7310. }, isc.A.getSublaneEvents = function isc_Calendar_getSublaneEvents(_1, _2, _3) {
  7311. var _4 = isc.isAn.Object(_1) ? _1.name : _1,
  7312. _5 = isc.isAn.Object(_2) ? _2.name : _2;
  7313. if ((!_4 || !isc.isA.String(_4)) || (!_5 || !isc.isA.String(_5))) {
  7314. return []
  7315. }
  7316. _3 = _3 || this.getSelectedView();
  7317. var _6 = this.getLaneEvents(_4, _3),
  7318. _7 = _6.findAll(this.sublaneNameField, _5);
  7319. return _7
  7320. }, isc.A.createChildren = function isc_Calendar_createChildren() {
  7321. var _1 = this.$653();
  7322. this.$655(_1);
  7323. var _2 = 20;
  7324. if (this.showControlsBar != false) {
  7325. this.dateLabel = this.createAutoChild("dateLabel");
  7326. this.addEventButton = this.createAutoChild("addEventButton", {
  7327. click: function() {
  7328. var _3 = this.creator;
  7329. var _4 = _3.getSelectedView();
  7330. _3.eventDialog.event = null;
  7331. _3.eventDialog.isNewEvent = true;
  7332. _3.eventDialog.items[0].createFields();
  7333. var _5 = new Date(),
  7334. _6 = null,
  7335. _7 = _3.chosenDate.duplicate();
  7336. if (_4.isDayView()) {
  7337. _5 = _7
  7338. } else if (_4.isWeekView()) {
  7339. if (_3.chosenWeekStart.getTime() > _5.getTime()) {
  7340. _5 = _3.chosenWeekStart.duplicate()
  7341. }
  7342. if (!this.showWeekends) {
  7343. var _8 = _3.getWeekendDays();
  7344. for (var i = 0; i < _8.length; i++) {
  7345. if (_8.contains(_5.getDay())) _5.setDate(_5.getDate() + 1)
  7346. }
  7347. }
  7348. _5.setMinutes(0);
  7349. if (_5.getHours() > 22) {
  7350. _5.setDate(_5.getDate() + 1);
  7351. _5.setHours(0)
  7352. } else _5.setHours(_5.getHours() + 1)
  7353. } else if (_4.isMonthView()) {
  7354. _7.setDate(1);
  7355. if (_7.getTime() > _5.getTime()) _5 = _7
  7356. } else if (_3.isTimeline()) {
  7357. var _10 = _3.timelineView,
  7358. _11 = _10.getVisibleDateRange();
  7359. _5 = _11[0];
  7360. _6 = _5.duplicate();
  7361. _6 = _10.addUnits(_6, 1, _3.timelineGranularity)
  7362. }
  7363. var _12 = {};
  7364. _12[_3.startDateField] = _5;
  7365. _12[_3.endDateField] = _6;
  7366. _3.eventDialog.event = _12;
  7367. _3.eventDialog.setDate(_5, _6);
  7368. _3.eventDialog.setPageLeft(_3.getPageLeft());
  7369. _3.eventDialog.setPageTop(this.getPageTop() + this.getVisibleHeight());
  7370. _3.displayEventDialog()
  7371. }
  7372. });
  7373. this.datePickerButton = this.createAutoChild("datePickerButton", {
  7374. click: function() {
  7375. var _3 = this.creator;
  7376. if (!_3.dateChooser.isDrawn()) _3.dateChooser.draw();
  7377. else _3.dateChooser.redraw();
  7378. _3.dateChooser.placeNear(this.getPageLeft(), this.getPageTop() + this.getHeight());
  7379. _3.dateChooser.show()
  7380. }
  7381. });
  7382. if (this.minimalUI && this.showMonthButton != false && this.showMonthView != false) {
  7383. this.monthButton = this.createAutoChild("monthButton");
  7384. this.updateMonthButton()
  7385. }
  7386. this.previousButton = this.createAutoChild("previousButton", {});
  7387. this.nextButton = this.createAutoChild("nextButton", {})
  7388. }
  7389. var _13 = [];
  7390. if (this.monthButton) _13.add(this.monthButton);
  7391. if (this.showPreviousButton != false) _13.add(this.previousButton);
  7392. if (this.showDateLabel != false) _13.add(this.dateLabel);
  7393. if (this.showDatePickerButton != false) _13.add(this.datePickerButton);
  7394. if (this.canCreateEvents && this.showAddEventButton != false) _13.add(this.addEventButton);
  7395. if (this.showNextButton != false) _13.add(this.nextButton);
  7396. if (this.showControlsBar != false) {
  7397. this.controlsBar = this.createAutoChild("controlsBar", {
  7398. members: _13
  7399. })
  7400. }
  7401. var _3 = this;
  7402. this.dateChooser = this.createAutoChild("dateChooser", {
  7403. disableWeekends: this.disableChooserWeekends != null ? this.disableChooserWeekends : false,
  7404. showWeekends: this.showChooserWeekends != null ? this.showChooserWeekends : true,
  7405. weekendDays: this.getWeekendDays(),
  7406. chosenDate: this.chosenDate,
  7407. month: this.month,
  7408. year: this.year,
  7409. closeOnEscapeKeypress: true,
  7410. autoHide: true,
  7411. autoClose: true,
  7412. dateClick: function(_17, _18, _19) {
  7413. var _14 = this.Super("dateClick", arguments);
  7414. if (_14) this.creator.setChosenDate(_14);
  7415. return _14
  7416. },
  7417. show: function() {
  7418. this.Super("show", arguments);
  7419. this.bringToFront();
  7420. this.focus()
  7421. }
  7422. });
  7423. this.addChild(this.dateChooser);
  7424. if (!this.children) this.children = [];
  7425. var _15 = [];
  7426. var _16 = [];
  7427. _16.add(this.dateChooser);
  7428. if (this.showDateChooser) {
  7429. _15.add(isc.VLayout.create({
  7430. autoDraw: false,
  7431. width: "20%",
  7432. membersMargin: 10,
  7433. layoutTopMargin: 10,
  7434. members: _16
  7435. }))
  7436. }
  7437. if (this.mainView.isA("TabSet")) {
  7438. _15.add(this.mainView)
  7439. } else {
  7440. if (this.showControlsBar != false) {
  7441. this.controlsBarContainer = this.createAutoChild("controlsBarContainer", {
  7442. autoDraw: false,
  7443. height: this.controlsBar.getVisibleHeight(),
  7444. width: "100%"
  7445. }, isc.HLayout);
  7446. this.controlsBarContainer.addMember(isc.LayoutSpacer.create({
  7447. autoDraw: false,
  7448. width: "*"
  7449. }));
  7450. this.controlsBarContainer.addMember(this.controlsBar);
  7451. this.controlsBarContainer.addMember(isc.LayoutSpacer.create({
  7452. autoDraw: false,
  7453. width: "*"
  7454. }));
  7455. this.mainLayout = this.createAutoChild("mainLayout", {
  7456. autoDraw: false,
  7457. members: [this.controlsBarContainer, this.mainView]
  7458. }, isc.VLayout);
  7459. _15.add(this.mainLayout)
  7460. } else {
  7461. _15.add(this.mainView)
  7462. }
  7463. }
  7464. this.children.add(isc.HLayout.create({
  7465. autoDraw: false,
  7466. width: "100%",
  7467. height: "100%",
  7468. members: _15
  7469. }));
  7470. this.setDateLabel()
  7471. }, isc.A.createEditors = function isc_Calendar_createEditors() {
  7472. var _1 = this;
  7473. this.eventDialog = this.createAutoChild("eventDialog", {
  7474. items: [isc.DynamicForm.create({
  7475. autoDraw: false,
  7476. padding: 4,
  7477. calendar: this,
  7478. saveOnEnter: true,
  7479. useAllDataSourceFields: true,
  7480. numCols: 2,
  7481. colWidths: [80, "*"],
  7482. $642: [_1.nameField, _1.laneNameField, _1.sublaneNameField],
  7483. getCustomValues: function() {
  7484. if (!this.calendar.eventDialogFields) return;
  7485. var _2 = this.$642;
  7486. var _3 = this.calendar.eventDialogFields;
  7487. var _4 = {};
  7488. for (var i = 0; i < _3.length; i++) {
  7489. var _6 = _3[i];
  7490. if (_6.name && !_2.contains(_6.name)) {
  7491. _4[_6.name] = this.getValue(_6.name)
  7492. }
  7493. }
  7494. return _4
  7495. },
  7496. setCustomValues: function(_65) {
  7497. if (!this.calendar.eventDialogFields) return;
  7498. var _2 = this.$642;
  7499. var _3 = this.calendar.eventDialogFields;
  7500. for (var i = 0; i < _3.length; i++) {
  7501. var _6 = _3[i];
  7502. if (_6.name && !_2.contains(_6.name)) {
  7503. this.setValue(_6.name, _65[_6.name])
  7504. }
  7505. }
  7506. },
  7507. createFields: function(_65) {
  7508. var _1 = this.calendar,
  7509. _7 = _1.eventDialog.isNewEvent,
  7510. _8 = _1.isTimeline() || (_1.showDayLanes && _1.dayViewSelected()),
  7511. _9 = _8 && _1.useSublanes;
  7512. var _10 = [{
  7513. name: _1.nameField,
  7514. title: _1.eventNameFieldTitle,
  7515. type: "text",
  7516. width: 250,
  7517. wrapTitle: false
  7518. }, {
  7519. name: _1.laneNameField,
  7520. title: _1.eventLaneFieldTitle,
  7521. type: "select",
  7522. width: 150,
  7523. valueMap: _1.getLaneMap(),
  7524. showIf: _8 ? "true" : "false",
  7525. changed: function(_51, _64, _66) {
  7526. var _11 = _1.lanes.find("name", _66);
  7527. if (_66 && _11) {
  7528. var _12 = _51.getItem(_1.sublaneNameField);
  7529. if (_12) _12.setValueMap(_1.getSublaneMap(_11))
  7530. }
  7531. }
  7532. }, {
  7533. name: _1.sublaneNameField,
  7534. title: _1.eventSublaneFieldTitle,
  7535. type: "select",
  7536. width: 150,
  7537. valueMap: [],
  7538. showIf: _9 ? "true" : "false"
  7539. }, {
  7540. name: "save",
  7541. title: _1.saveButtonTitle,
  7542. editorType: "SubmitItem",
  7543. endRow: false
  7544. }, {
  7545. name: "details",
  7546. title: _1.detailsButtonTitle,
  7547. type: "button",
  7548. startRow: false,
  7549. click: function(_51, _64) {
  7550. var _1 = _51.calendar,
  7551. _13 = _1.eventDialog.isNewEvent,
  7552. _14 = _1.eventDialog.event || {},
  7553. _15 = _51.getValue(_1.nameField),
  7554. _16 = _51.getValue(_1.laneNameField),
  7555. _17 = _51.getValue(_1.sublaneNameField);
  7556. if (_13) {
  7557. _14[_1.nameField] = _15;
  7558. if (_16) _14[_1.laneNameField] = _16;
  7559. if (_17) _14[_1.sublaneNameField] = _16
  7560. }
  7561. _1.showEventEditor(_14, _13)
  7562. }
  7563. }];
  7564. var _18 = isc.DataSource.create({
  7565. addGlobalId: false,
  7566. fields: _10
  7567. });
  7568. this.setDataSource(_18);
  7569. this.setFields(isc.shallowClone(this.calendar.eventDialogFields))
  7570. },
  7571. submit: function() {
  7572. var _1 = this.calendar,
  7573. _7 = _1.eventDialog.isNewEvent,
  7574. _19 = _1.eventDialog.event || {},
  7575. _20 = _1.eventDialog.currentStart,
  7576. _21 = _1.eventDialog.currentEnd,
  7577. _22 = this,
  7578. _11 = null,
  7579. _23 = null;
  7580. if (!_22.validate()) return;
  7581. if (_1.isTimeline() || (_1.dayViewSelected() && _1.showDayLanes)) {
  7582. _11 = _22.getValue(_1.laneNameField);
  7583. _23 = _22.getValue(_1.sublaneNameField)
  7584. }
  7585. var _24 = isc.addProperties({}, _22.getCustomValues());
  7586. _1.$1115 = true;
  7587. var _25 = _1.createEventObject(_19, _20, _21, _11, _23, _22.getValue(_1.nameField));
  7588. if (!_7) {
  7589. _1.updateCalendarEvent(_19, _25, _24)
  7590. } else {
  7591. _1.addCalendarEvent(_25, _24)
  7592. }
  7593. _1.hideEventDialog()
  7594. }
  7595. })],
  7596. setDate: function(_65, _63) {
  7597. var _1 = this.creator;
  7598. if (!_63) {
  7599. if (_65.getHours() == 23 && _65.getMinutes() == (60 - _1.getSelectedView().getTimePerCell())) {
  7600. _63 = new Date(_65.getFullYear(), _65.getMonth(), _65.getDate() + 1)
  7601. } else {
  7602. _63 = new Date(_65.getFullYear(), _65.getMonth(), _65.getDate(), _65.getHours() + 1, _65.getMinutes())
  7603. }
  7604. }
  7605. this.setTitle(_1.$53k(_65, _63));
  7606. this.currentStart = _65;
  7607. this.currentEnd = _63;
  7608. this.items[0].setValue(_1.nameField, "")
  7609. },
  7610. setLane: function(_11) {
  7611. var _1 = this.creator;
  7612. if (isc.isA.Number(_11)) _11 = _1.lanes[_11].name;
  7613. this.items[0].getItem(_1.laneNameField).setValue(_11)
  7614. },
  7615. setEvent: function(_14) {
  7616. this.event = _14;
  7617. var _26 = this.items[0],
  7618. _27 = this.items[1],
  7619. _1 = this.creator,
  7620. _28 = _1.getSelectedView(),
  7621. _13 = !!this.isNewEvent,
  7622. _29 = _13 || _1.canEditEventLane(_14, _28);
  7623. _26.getItem(_1.laneNameField).setDisabled(!_29);
  7624. if (_1.eventDialogFields) {
  7625. _26.clearErrors(true);
  7626. _26.setCustomValues(_14)
  7627. }
  7628. this.setDate(_1.getEventStartDate(_14), _1.getEventEndDate(_14));
  7629. if (_1.useSublanes && _14[_1.laneNameField]) {
  7630. var _11 = _28.getLane(_14[_1.laneNameField]);
  7631. if (_11) {
  7632. var _12 = _26.getItem(_1.sublaneNameField);
  7633. _12.setValueMap(_1.getSublaneMap(_11))
  7634. }
  7635. }
  7636. _26.setValues(_14)
  7637. },
  7638. closeClick: function() {
  7639. this.Super('closeClick');
  7640. this.creator.clearViewSelection()
  7641. },
  7642. show: function() {
  7643. if (this.creator.showQuickEventDialog) {
  7644. if (!this.isDrawn()) this.draw();
  7645. this.Super('show');
  7646. this.items[0].getItem(this.creator.nameField).focusInItem()
  7647. } else {
  7648. this.creator.showEventEditor(this.event, this.isNewEvent)
  7649. }
  7650. },
  7651. hide: function() {
  7652. this.Super('hide');
  7653. this.moveTo(0, 0)
  7654. }
  7655. });
  7656. this.eventEditor = this.createAutoChild("eventEditor", {
  7657. useAllDataSourceFields: true,
  7658. titleWidth: 80,
  7659. initWidget: function() {
  7660. this.invokeSuper(isc.DynamicForm, "initWidget", arguments);
  7661. var _1 = this.creator;
  7662. this.timeFormat = _1.timeFormat
  7663. },
  7664. rebuildFieldList: function() {
  7665. var _10 = [],
  7666. _30 = _1.getDateEditingStyle(),
  7667. _31 = [{
  7668. name: "endType",
  7669. type: "text",
  7670. showTitle: false,
  7671. width: "*",
  7672. editorType: "SelectItem",
  7673. textAlign: "right",
  7674. valueMap: [_1.eventDurationFieldTitle, _1.eventEndDateFieldTitle],
  7675. endRow: false,
  7676. changed: function(_51, _64, _65) {
  7677. _30 = _1.getDateEditingStyle();
  7678. if (_65 == _1.eventDurationFieldTitle) {
  7679. _51.getItem(_1.durationField).show();
  7680. _51.getItem(_1.durationUnitField).show();
  7681. if (_30 == "time") {
  7682. _51.getItem("endHours").hide();
  7683. _51.getItem("endMinutes").hide();
  7684. _51.getItem("endAMPM").hide()
  7685. } else {
  7686. _51.getItem(_1.endDateField).hide()
  7687. }
  7688. } else {
  7689. _51.getItem(_1.durationField).hide();
  7690. _51.getItem(_1.durationUnitField).hide();
  7691. if (_30 == "time") {
  7692. _51.getItem("endHours").show();
  7693. _51.getItem("endMinutes").show();
  7694. _51.getItem("endAMPM").show()
  7695. } else {
  7696. _51.getItem(_1.endDateField).show()
  7697. }
  7698. }
  7699. }
  7700. }, {
  7701. name: _1.durationField,
  7702. type: "integer",
  7703. editorType: "SpinnerItem",
  7704. title: _1.eventDurationFieldTitle,
  7705. endRow: false,
  7706. showTitle: false,
  7707. width: "*",
  7708. colSpan: 1,
  7709. defaultValue: 1
  7710. }, {
  7711. name: _1.durationUnitField,
  7712. type: "text",
  7713. showTitle: false,
  7714. endRow: true,
  7715. title: _1.eventDurationUnitFieldTitle,
  7716. width: "*",
  7717. colSpan: 1,
  7718. valueMap: _1.getDurationUnitMap(),
  7719. defaultValue: "minute"
  7720. }];
  7721. this.$642.addList([_1.nameField, _1.descriptionField, _1.startDateField, "endType", _1.durationField, _1.durationUnitField, _1.endDateField]);
  7722. if (_1.timelineView || (_1.dayViewSelected() && _1.showDayLanes)) {
  7723. var _32 = _1.getLaneMap(),
  7724. _33 = {
  7725. name: _1.laneNameField,
  7726. title: _1.eventLaneFieldTitle,
  7727. type: "select",
  7728. valueMap: _32,
  7729. endRow: true,
  7730. width: "*",
  7731. colSpan: 3,
  7732. changed: function(_51, _64, _65) {
  7733. var _11 = _1.lanes.find("name", _65);
  7734. if (_65 && _11) {
  7735. var _12 = _51.getItem(_1.sublaneNameField);
  7736. if (_12) _12.setValueMap(_1.getSublaneMap(_11))
  7737. }
  7738. }
  7739. };
  7740. _10.add(_33);
  7741. if (_1.useSublanes) {
  7742. var _34 = {},
  7743. _35 = {
  7744. name: _1.sublaneNameField,
  7745. title: _1.eventSublaneFieldTitle,
  7746. type: "select",
  7747. valueMap: _34,
  7748. endRow: true,
  7749. width: "*",
  7750. colSpan: 3
  7751. };
  7752. _10.add(_35)
  7753. }
  7754. }
  7755. var _36 = _1.allowDurationEvents;
  7756. if (_30 == "date" || _30 == "datetime") {
  7757. _10.add({
  7758. name: _1.startDateField,
  7759. title: _1.eventStartDateFieldTitle,
  7760. type: _30,
  7761. colSpan: "*",
  7762. endRow: true
  7763. });
  7764. if (_36) _10.addList(_31);
  7765. _10.addList([{
  7766. name: _1.endDateField,
  7767. title: _1.eventEndDateFieldTitle,
  7768. showTitle: !_36,
  7769. type: _30,
  7770. colSpan: "*",
  7771. endRow: true
  7772. }, {
  7773. name: "invalidDate",
  7774. type: "blurb",
  7775. width: "*",
  7776. colSpan: "*",
  7777. visible: false,
  7778. defaultValue: _1.invalidDateMessage,
  7779. cellStyle: this.errorStyle || "formCellError",
  7780. endRow: true
  7781. }])
  7782. } else if (_30 == "time") {
  7783. var _37 = isc.SelectItem.getInstanceProperty("textBoxStyle"),
  7784. _38 = isc.SelectItem.getInstanceProperty("pickerIconWidth") + isc.Element.$tf(_37) + isc.Element.$tg(_37) + isc.Element.$yp(_37) + 4;
  7785. _41 = isc.getValues(this.getTimeValues("hours")).join("<br>");
  7786. var _39 = isc.Canvas.measureContent(_41, _37) + _38;
  7787. _41 = isc.getValues(this.getTimeValues("minutes")).join("<br>");
  7788. var _40 = isc.Canvas.measureContent(_41, _37) + _38;
  7789. var _41 = isc.getValues(this.getTimeValues()).join("<br>");
  7790. var _42 = isc.Canvas.measureContent(_41, _37) + _38;
  7791. this.numCols = 5;
  7792. this.setColWidths([this.titleWidth, _39, _40, _42, "*"]);
  7793. _10.addList([{
  7794. name: "startHours",
  7795. title: _1.eventStartDateFieldTitle,
  7796. type: "integer",
  7797. width: _39,
  7798. editorType: "select",
  7799. valueMap: this.getTimeValues("hours")
  7800. }, {
  7801. name: "startMinutes",
  7802. showTitle: false,
  7803. type: "integer",
  7804. width: _40,
  7805. editorType: "select",
  7806. valueMap: this.getTimeValues("minutes")
  7807. }, {
  7808. name: "startAMPM",
  7809. showTitle: false,
  7810. type: "select",
  7811. width: _42,
  7812. valueMap: this.getTimeValues(),
  7813. endRow: true,
  7814. showIf: function(_64) {
  7815. return _64.form.creator.twentyFourHourTime ? "false" : "true"
  7816. }
  7817. }, {
  7818. name: "invalidDate",
  7819. type: "blurb",
  7820. colSpan: 4,
  7821. visible: false,
  7822. defaultValue: _1.invalidDateMessage,
  7823. cellStyle: this.errorStyle || "formCellError",
  7824. endRow: true
  7825. }]);
  7826. if (_36) _10.addList(_31);
  7827. _10.addList([{
  7828. name: "endHours",
  7829. type: "integer",
  7830. width: "*",
  7831. startRow: true,
  7832. title: _1.eventEndDateFieldTitle,
  7833. showTitle: !_36,
  7834. editorType: "select",
  7835. valueMap: this.getTimeValues("hours")
  7836. }, {
  7837. name: "endMinutes",
  7838. showTitle: false,
  7839. type: "integer",
  7840. width: "*",
  7841. editorType: "select",
  7842. valueMap: this.getTimeValues("minutes")
  7843. }, {
  7844. name: "endAMPM",
  7845. showTitle: false,
  7846. type: "select",
  7847. width: _42,
  7848. valueMap: this.getTimeValues(),
  7849. endRow: true,
  7850. showIf: function(_64) {
  7851. return _64.form.creator.twentyFourHourTime ? "false" : "true"
  7852. }
  7853. }])
  7854. }
  7855. _10.addList([{
  7856. name: _1.nameField,
  7857. title: _1.eventNameFieldTitle,
  7858. type: "text",
  7859. colSpan: "*",
  7860. width: "*",
  7861. startRow: true
  7862. }, {
  7863. name: _1.descriptionField,
  7864. title: _1.eventDescriptionFieldTitle,
  7865. type: "textArea",
  7866. colSpan: "*",
  7867. width: "*",
  7868. height: 50,
  7869. startRow: true
  7870. }]);
  7871. var _43 = isc.DataSource.create({
  7872. addGlobalId: false,
  7873. fields: _10
  7874. });
  7875. this.setDataSource(_43);
  7876. var _44 = isc.shallowClone(_1.eventEditorFields);
  7877. this.setFields(_44);
  7878. this.$172z = true
  7879. },
  7880. getTimeValues: function(_65) {
  7881. var _45 = {},
  7882. _1 = this.creator;
  7883. if (_65 == "hours") {
  7884. var _46 = _1.twentyFourHourTime,
  7885. _47 = _46 ? 24 : 12,
  7886. _48 = _46 ? 0 : 1;
  7887. for (var i = 0; i < _47; i++) {
  7888. var _49 = (i + _48 < 10 ? "0" : "") + (i + _48);
  7889. _45["" + (i + _48)] = _49
  7890. }
  7891. } else if (_65 == "minutes") {
  7892. for (var i = 0; i < 60; i++) {
  7893. var _50 = i < 10 ? "0" + i : "" + i;
  7894. _45[i + ""] = _50
  7895. }
  7896. } else {
  7897. _45["am"] = isc.Time.AMIndicator;
  7898. _45["pm"] = isc.Time.PMIndicator
  7899. }
  7900. return _45
  7901. },
  7902. $642: ["startHours", "startMinutes", "startAMPM", "endHours", "endMinutes", "endAMPM"],
  7903. getCustomValues: function() {
  7904. if (!this.creator.eventEditorFields) return;
  7905. var _1 = this.creator,
  7906. _2 = this.$642;
  7907. var _3 = this.creator.eventEditorFields;
  7908. var _4 = {};
  7909. for (var i = 0; i < _3.length; i++) {
  7910. var _6 = _3[i];
  7911. if (_6.name && !_2.contains(_6.name)) {
  7912. _4[_6.name] = this.getValue(_6.name)
  7913. }
  7914. }
  7915. return _4
  7916. },
  7917. setCustomValues: function(_65) {
  7918. if (!this.creator.eventEditorFields) return;
  7919. var _2 = this.$642;
  7920. var _3 = this.creator.eventEditorFields;
  7921. for (var i = 0; i < _3.length; i++) {
  7922. var _6 = _3[i];
  7923. if (_6.name && !_2.contains(_6.name)) {
  7924. this.setValue(_6.name, _65[_6.name])
  7925. }
  7926. }
  7927. }
  7928. });
  7929. this.eventEditorLayout = this.createAutoChild("eventEditorLayout", isc.addProperties({
  7930. calendar: this,
  7931. setDate: function(_65, _63, _66, _11, _23) {
  7932. if (!_66) _66 = "";
  7933. if (!_63) {
  7934. _63 = isc.DateUtil.dateAdd(_65.duplicate(), "h")
  7935. }
  7936. var _1 = this.creator;
  7937. this.setTitle(_1.$53k(_65, _63));
  7938. this.currentStart = _65;
  7939. this.currentEnd = _63;
  7940. var _30 = _1.getDateEditingStyle(),
  7941. _51 = this.items[0];
  7942. if (_30 == "date" || _30 == "datetime") {
  7943. _51.setValue(_1.startDateField, _65.duplicate());
  7944. _51.setValue(_1.endDateField, _63.duplicate())
  7945. } else if (_30 == "time") {
  7946. var _52 = _1.twentyFourHourTime ? "toShortPadded24HourTime" : _1.timeFormatter,
  7947. _53 = isc.Time.toTime(_65, _52, true),
  7948. _54 = isc.Time.toTime(_63, _52, true);
  7949. _51.setValue("startHours", parseInt(_53.substring(0, _53.indexOf(":"))));
  7950. _51.setValue("endHours", parseInt(_54.substring(0, _54.indexOf(":"))));
  7951. _51.setValue("startMinutes", parseInt(_53.substring(_53.indexOf(":") + 1, _53.indexOf(":") + 3)));
  7952. _51.setValue("endMinutes", parseInt(_54.substring(_54.indexOf(":") + 1, _54.indexOf(":") + 3)));
  7953. if (!_1.twentyFourHourTime) {
  7954. _51.setValue("startAMPM", this.getAMPM(_65.getHours()));
  7955. _51.setValue("endAMPM", this.getAMPM(_63.getHours()))
  7956. }
  7957. }
  7958. },
  7959. getHours: function(_65) {
  7960. if (this.creator.twentyFourHourTime) return _65;
  7961. else return this.creator.$53n(_65)
  7962. },
  7963. getAMPM: function(_65) {
  7964. if (_65 < 12) return "am";
  7965. else return "pm"
  7966. },
  7967. createButtonLayout: function() {
  7968. this.buttonLayout = this.calendar.createAutoChild("eventEditorButtonLayout");
  7969. this.saveButton = this.calendar.createAutoChild("saveButton", {
  7970. title: this.calendar.saveButtonTitle,
  7971. calendar: this.calendar
  7972. });
  7973. this.removeButton = this.calendar.createAutoChild("removeButton", {
  7974. title: this.calendar.removeButtonTitle,
  7975. calendar: this.calendar
  7976. });
  7977. this.cancelButton = this.calendar.createAutoChild("cancelButton", {
  7978. title: this.calendar.cancelButtonTitle,
  7979. calendar: this.calendar
  7980. });
  7981. this.buttonLayout.addMembers([this.saveButton, this.removeButton, this.cancelButton]);
  7982. this.addItem(this.calendar.eventEditor);
  7983. this.addItem(this.buttonLayout)
  7984. },
  7985. setEvent: function(_14) {
  7986. if (!this.buttonLayout) {
  7987. this.createButtonLayout()
  7988. }
  7989. var _51 = this.items[0],
  7990. _1 = this.creator,
  7991. _28 = this.view,
  7992. _55 = _51.getItem(_1.laneNameField),
  7993. _56 = _51.getItem(_1.sublaneNameField),
  7994. _36 = _1.allowDurationEvents,
  7995. _57 = _51.getItem("endType"),
  7996. _58 = _51.getItem(_1.durationField),
  7997. _59 = _51.getItem(_1.durationUnitField);
  7998. if (!_1.twentyFourHourTime) {
  7999. if (_51.getItem("startAMPM")) _51.showItem("startAMPM");
  8000. if (_51.getItem("endAMPM")) _51.showItem("endAMPM")
  8001. } else {
  8002. if (_51.getItem("startAMPM")) _51.hideItem("startAMPM");
  8003. if (_51.getItem("endAMPM")) _51.hideItem("endAMPM")
  8004. }
  8005. this.event = _14;
  8006. if (_1.eventEditorFields) {
  8007. _51.clearErrors(true);
  8008. _51.setCustomValues(_14)
  8009. }
  8010. if (_55) {
  8011. _55.setValueMap(_1.getLaneMap());
  8012. _55.setValue(_14[_1.laneNameField]);
  8013. _55.setDisabled(this.isNewEvent ? false : !_1.canEditEventLane(_14));
  8014. var _60 = _28.isTimelineView() || (_28.isDayView() && _1.showDayLanes);
  8015. if (_60) _55.show();
  8016. else _55.hide()
  8017. }
  8018. if (_56) {
  8019. _56.setValueMap(_1.getSublaneMap(_14[_1.laneNameField]));
  8020. _56.setValue(_14[_1.sublaneNameField]);
  8021. _56.setDisabled(this.isNewEvent ? false : !_1.canEditEventSublane(_14));
  8022. var _60 = _1.useSublanes && (_28.isTimelineView() || (_28.isDayView() && _1.showDayLanes));
  8023. if (_60) _56.show();
  8024. else _56.hide()
  8025. }
  8026. if (_36) {
  8027. var _61 = _14[_1.durationField],
  8028. _62 = _14[_1.durationUnitField] || "minute";
  8029. if (_61 != null) {
  8030. _57.setValue(_1.eventDurationFieldTitle);
  8031. _58.setValue(_61);
  8032. _58.show();
  8033. _59.setValue(_62);
  8034. _59.show();
  8035. if (_1.getDateEditingStyle() == "time") {
  8036. if (_51.getField("endHours")) _51.hideField("endHours");
  8037. if (_51.getField("endMinutes")) _51.hideField("endMinutes");
  8038. if (_51.getField("endAMPM")) _51.hideField("endAMPM")
  8039. } else {
  8040. _51.hideField(_1.endDateField)
  8041. }
  8042. } else {
  8043. _57.setValue(_1.eventEndDateFieldTitle);
  8044. _58.hide();
  8045. _59.hide();
  8046. var _63 = _14[_1.endDateField];
  8047. if (_1.getDateEditingStyle() == "time") {
  8048. _51.showField("endHours");
  8049. _51.setValue("endHours", _63.getHours());
  8050. _51.showField("endMinutes");
  8051. _51.setValue("endMinutes", _63.getMinutes())
  8052. } else {
  8053. _51.showField(_1.endDateField);
  8054. _51.setValue(_1.endDateField, _63)
  8055. }
  8056. }
  8057. }
  8058. this.setDate(_1.getEventStartDate(_14), _1.getEventEndDate(_14));
  8059. if (!_14[_1.nameField]) {
  8060. _14[_1.nameField] = this.getDefaultItemValue(_1.nameField)
  8061. }
  8062. _51.setValue(_1.nameField, _14[_1.nameField]);
  8063. if (!_14[_1.descriptionField]) {
  8064. _14[_1.descriptionField] = this.getDefaultItemValue(_1.descriptionField)
  8065. }
  8066. _51.setValue(_1.descriptionField, _14[_1.descriptionField]);
  8067. this.originalStart = isc.clone(this.currentStart);
  8068. this.originalEnd = isc.clone(this.currentEnd);
  8069. if (!this.isNewEvent && _1.canRemoveEvent(_14)) this.removeButton.show();
  8070. else this.removeButton.hide()
  8071. },
  8072. getDefaultItemValue: function(_65) {
  8073. var _51 = this.items[0],
  8074. _64 = _51.getItem(_65);
  8075. return _64 && _64.defaultValue
  8076. },
  8077. hide: function() {
  8078. this.Super('hide');
  8079. this.creator.clearViewSelection();
  8080. this.creator.eventEditor.hideItem("invalidDate")
  8081. },
  8082. sizeMe: function() {
  8083. this.setWidth(this.creator.mainView.getVisibleWidth());
  8084. this.setHeight(this.creator.mainView.getVisibleHeight());
  8085. this.setLeft(this.creator.mainView.getLeft())
  8086. },
  8087. draw: function() {
  8088. var _51 = this.items && this.items[0];
  8089. if (_51 && !_51.$172z) _51.rebuildFieldList();
  8090. this.Super("draw", arguments)
  8091. }
  8092. }, this.eventEditorLayoutProperties));
  8093. this.eventEditorLayout.addItem(this.eventEditor)
  8094. }, isc.A.measureText = function isc_Calendar_measureText(_1, _2) {
  8095. var _3 = isc.Label.create({
  8096. ID: "$1674",
  8097. autoDraw: true,
  8098. backgroundColor: "red",
  8099. top: -1000,
  8100. height: 20,
  8101. width: 1,
  8102. wrap: false,
  8103. autoFit: true
  8104. });
  8105. _3.setContents("<span style='overflow:visible;white-space:nowrap;'>" + _1 + "</span>")
  8106. _3.redraw();
  8107. _3.show();
  8108. _3.bringToFront();
  8109. var _4 = _3.getVisibleWidth();
  8110. _3.hide();
  8111. _3.destroy();
  8112. _3 = null;
  8113. return _4
  8114. }, isc.A.hideEventDialog = function isc_Calendar_hideEventDialog() {
  8115. this.eventDialog.hide()
  8116. }, isc.A.displayEventDialog = function isc_Calendar_displayEventDialog() {
  8117. this.eventDialog.show()
  8118. }, isc.A.addEventOrUpdateEventFields = function isc_Calendar_addEventOrUpdateEventFields() {
  8119. var _1 = this,
  8120. _2 = _1.eventEditorLayout.isNewEvent,
  8121. _3 = _1.eventEditorLayout.event,
  8122. _4 = _1.eventEditor,
  8123. _5 = _1.getDateEditingStyle(),
  8124. _6 = _4.getValues(),
  8125. _7 = _1.isTimeline() || (_1.dayViewSelected() && _1.showDayLanes) && _1.canEditLane,
  8126. _8 = _7 ? _6[_1.laneNameField] : null,
  8127. _9 = _7 && _1.useSublanes ? _6[_1.sublaneNameField] : null,
  8128. _10 = _6["endType"] == this.eventDurationFieldTitle,
  8129. _11 = _10 ? _6[this.durationField] || 1 : null,
  8130. _12 = _10 ? _6[this.durationUnitField] || (_5 == "time" ? "minute" : "hour") : null;
  8131. var _13 = isc.addProperties({}, _3, {
  8132. eventLength: null
  8133. });
  8134. _13[this.nameField] = _6[this.nameField];
  8135. _13[this.descriptionField] = _6[this.descriptionField];
  8136. if (_8) _13[this.laneNameField] = _8;
  8137. if (_9) _13[this.sublaneNameField] = _9;
  8138. if (_5 == "date" || _5 == "datetime") {
  8139. var _14 = _6[this.startDateField],
  8140. _15 = !_10 ? _6[this.endDateField] : null;
  8141. if (!_10 && _15 < _14) {
  8142. _4.showItem("invalidDate");
  8143. return false
  8144. }
  8145. if (!_4.validate()) return false;
  8146. _13[_1.startDateField] = _14;
  8147. _13.isDuration = _10;
  8148. if (_10) {
  8149. _13[_1.durationField] = _11;
  8150. _13[_1.durationUnitField] = _12;
  8151. delete _13[_1.endDateField]
  8152. } else {
  8153. _13[_1.endDateField] = _15;
  8154. delete _13[_1.durationField];
  8155. delete _13[_1.durationUnitField]
  8156. }
  8157. _1.eventEditorLayout.currentStart = _14;
  8158. _1.eventEditorLayout.currentEnd = _1.getEventEndDate(_13);
  8159. _1.eventEditorLayout.hide();
  8160. _1.$1116 = true
  8161. } else if (_5 == "time") {
  8162. var _16 = _6["startAMPM"],
  8163. _17 = _1.$534(_6["startHours"], _16),
  8164. _18 = _6["startMinutes"];
  8165. var _19 = _1.eventEditorLayout.currentStart.duplicate();
  8166. _19.setHours(_17);
  8167. _19.setMinutes(_18);
  8168. var _20 = _19.getTime(),
  8169. _21 = isc.DateUtil.getEndOf(_19.duplicate(), "d");
  8170. _13[_1.startDateField] = _19;
  8171. if (_10) {
  8172. var _22 = _21.getTime(),
  8173. _23 = isc.DateUtil.convertPeriodUnit(_11, _12, "ms"),
  8174. _24 = Math.min(_20 + _23, _22);
  8175. if (_24 != _20 + _23) {
  8176. _11 = isc.DateUtil.convertPeriodUnit(_24 - _20, "ms", _12);
  8177. _11 = Math.round(_11)
  8178. }
  8179. _13[this.durationField] = _11;
  8180. _13[this.durationUnitField] = _12
  8181. } else {
  8182. var _25 = _6["endHours"],
  8183. _26 = _6["endMinutes"],
  8184. _27;
  8185. if (!_1.twentyFourHourTime) {
  8186. _27 = _6["endAMPM"];
  8187. _25 = _1.$534(_25, _27)
  8188. }
  8189. if ((_25 < _17 && _25 + _26 != 0) || (_25 == _17 && _26 <= _18)) {
  8190. _4.showItem("invalidDate");
  8191. return false
  8192. }
  8193. if (_25 == 0 && _26 == 0) _25 = 24;
  8194. if (!_4.validate()) return false;
  8195. var _28 = _19.duplicate();
  8196. _28.setHours(_25);
  8197. _28.setMinutes(_26);
  8198. if (_28.getTime() > _21.getTime()) {
  8199. _28 = _21.duplicate()
  8200. }
  8201. if (isc.DateUtil.compareDates(_19, _28) == 0) {
  8202. _4.showItem("invalidDate");
  8203. return false
  8204. }
  8205. _13[_1.endDateField] = _28;
  8206. _1.$1116 = true
  8207. }
  8208. }
  8209. var _29 = isc.addProperties({}, _4.getCustomValues());
  8210. _1.eventEditorLayout.hide();
  8211. if (!_2) {
  8212. _1.updateCalendarEvent(_3, _13, _29)
  8213. } else {
  8214. _1.addCalendarEvent(_13, _29, false)
  8215. }
  8216. return true
  8217. }, isc.A.setDateLabel = function isc_Calendar_setDateLabel() {
  8218. if (!this.dateLabel) return;
  8219. var _1 = "",
  8220. _2 = this.chosenDate,
  8221. _3 = null,
  8222. _4 = this.getCurrentViewName();
  8223. if (_4 == "day") {} else if (_4 == "week") {
  8224. var _5 = this.$656();
  8225. _2 = _5[0];
  8226. _3 = _5[1]
  8227. } else if (_4 == "month") {
  8228. _2 = isc.DateUtil.getStartOf(_2, "M");
  8229. _3 = isc.DateUtil.getEndOf(_2, "M")
  8230. } else if (_4 == "timeline") {
  8231. var _6 = this.timelineView;
  8232. _2 = _6.startDate;
  8233. _3 = _6.endDate
  8234. }
  8235. _1 = this.getDateLabelText(_4, _2, _3);
  8236. this.dateLabel.setContents(_1)
  8237. });
  8238. isc.evalBoundary;
  8239. isc.B.push(isc.A.getDateLabelText = function isc_Calendar_getDateLabelText(_1, _2, _3) {
  8240. var _4 = (_1 ? this.getView(_1) : null) || this.getSelectedView();
  8241. if (isc.Time.$854) {
  8242. _2 = isc.DateUtil.$179o(_2);
  8243. _3 = isc.DateUtil.$179o(_3)
  8244. }
  8245. var _5 = _4 && _4.getDateLabelText(_2, _3)
  8246. return _5 || ""
  8247. }, isc.A.$656 = function isc_Calendar__getWeekRange() {
  8248. var _1 = this.chosenWeekStart.duplicate();
  8249. var _2 = this.chosenWeekEnd.duplicate();
  8250. if (!this.showWeekends) {
  8251. var _3 = this.getWeekendDays();
  8252. var _4 = 7 - _3.length;
  8253. while (_3.contains(_1.getDay())) {
  8254. _1.setDate(_1.getDate() + 1)
  8255. }
  8256. var _5 = 0,
  8257. _6 = _1.duplicate();
  8258. for (var i = 0; i < _4; i++) {
  8259. if (_3.contains(_6.getDay())) _5++;
  8260. _6.setDate(_6.getDate() + 1)
  8261. }
  8262. _2 = _1.duplicate();
  8263. _2.setDate(_2.getDate() + (_4 - 1) + _5)
  8264. }
  8265. return [_1, _2]
  8266. }, isc.A.dayViewSelected = function isc_Calendar_dayViewSelected() {
  8267. if (this.mainView && !this.mainView.isA("TabSet")) return this.mainView.viewName == "day";
  8268. else return this.$567 == "day"
  8269. }, isc.A.weekViewSelected = function isc_Calendar_weekViewSelected() {
  8270. if (this.mainView && !this.mainView.isA("TabSet")) return this.mainView.viewName == "week";
  8271. else return this.$567 == "week"
  8272. }, isc.A.monthViewSelected = function isc_Calendar_monthViewSelected() {
  8273. if (this.mainView && !this.mainView.isA("TabSet")) return this.mainView.viewName == "month";
  8274. else return this.$567 == "month"
  8275. }, isc.A.timelineViewSelected = function isc_Calendar_timelineViewSelected() {
  8276. if (this.mainView && !this.mainView.isA("TabSet")) return this.mainView.viewName == "timeline";
  8277. else return this.$567 == "timeline"
  8278. }, isc.A.cancelEditing = function isc_Calendar_cancelEditing() {
  8279. var _1 = this.getSelectedView();
  8280. if (_1 && _1.clearSelection) _1.clearSelection();
  8281. if (this.eventDialog && this.eventDialog.isVisible()) {
  8282. this.eventDialog.hide()
  8283. }
  8284. if (this.eventEditor && this.eventEditor.isVisible()) {
  8285. this.eventEditor.hide()
  8286. }
  8287. }, isc.A.showEventDialog = function isc_Calendar_showEventDialog(_1, _2) {
  8288. if (_2 == null) _2 = (_1 == null);
  8289. this.$53l(_1, _2)
  8290. }, isc.A.showNewEventDialog = function isc_Calendar_showNewEventDialog(_1) {
  8291. _1 = _1 || {};
  8292. this.showEventDialog(_1, true)
  8293. }, isc.A.$53l = function isc_Calendar__showEventDialog(_1, _2) {
  8294. _1 = _1 || {};
  8295. var _3 = this.getEventStartDate(_1) || new Date(),
  8296. _4 = this.getEventEndDate(_1),
  8297. _5 = this.getSelectedView(),
  8298. _6 = _5.isMonthView() ? null : _5.getCurrentEventCanvas(_1),
  8299. _7, _8, _9, _10 = _5.body.getLeft(),
  8300. _11 = _5.body.getTop(),
  8301. _12 = this.eventDialog;
  8302. if (!_6) {
  8303. if (this.eventEditorLayout) {
  8304. this.eventEditorLayout.event = _1;
  8305. this.eventEditorLayout.isNewEvent = _2
  8306. }
  8307. _12.eventWindow = null;
  8308. _12.event = _1;
  8309. _12.isNewEvent = _2;
  8310. _12.items[0].createFields();
  8311. var _13 = _3,
  8312. _14 = _4;
  8313. _1[this.startDateField] = _13;
  8314. if (_5.isMonthView()) {
  8315. var _15 = new Date();
  8316. _15 = _15.getHours();
  8317. if (_15 > 22) _15 -= 1;
  8318. _13.setHours(_15);
  8319. _1[this.startDateField] = _13;
  8320. _7 = _5.getEventRow();
  8321. _8 = _5.getEventColumn();
  8322. _14 = isc.DateUtil.dateAdd(_13.duplicate(), "h", 1)
  8323. } else if (_5.isTimelineView()) {
  8324. var _16 = this.timelineView;
  8325. _7 = _16.getEventLaneIndex(_1);
  8326. _8 = _16.getColFromDate(_13);
  8327. _14 = _4 || this.getDateFromPoint(_16.getDateLeftOffset(_13) + _16.getColumnWidth(_8));
  8328. _12.setLane(_1[this.laneNameField])
  8329. } else {
  8330. _7 = _3.getHours() * this.getRowsPerHour(_5);
  8331. _7 += Math.floor(_3.getMinutes() / _5.getTimePerCell());
  8332. if (this.showDayLanes && _5.isDayView()) {
  8333. _8 = _5.getEventLaneIndex(_1)
  8334. } else {
  8335. _8 = _5.getColFromDate(_3)
  8336. }
  8337. _14 = _4 || this.getCellDate(_7, _8, _5)
  8338. }
  8339. _1[this.endDateField] = _14;
  8340. _12.setEvent(_1)
  8341. } else {
  8342. if (_5.isTimelineView()) {
  8343. _7 = _5.getEventLaneIndex(_1);
  8344. _8 = _5.getColFromDate(_3)
  8345. } else if (_5.isDayView() || _5.isWeekView()) {
  8346. _7 = _3.getHours() * this.getRowsPerHour(_5);
  8347. _7 += Math.floor(_3.getMinutes() / _5.getTimePerCell());
  8348. _8 = _5.getColFromDate(_3, _1[this.laneNameField])
  8349. }
  8350. _12.eventWindow = _6;
  8351. _12.isNewEvent = false;
  8352. _12.items[0].createFields();
  8353. _12.setEvent(_6.event);
  8354. if (this.bringEventsToFront) _6.bringToFront()
  8355. }
  8356. var _17 = _5.body.getCellPageRect(_7, _8);
  8357. var _18 = _17[1];
  8358. if (_12.parentWidget) _12.deparent();
  8359. _12.moveTo(0, -9999);
  8360. _12.draw();
  8361. var _19 = _12.getVisibleHeight();
  8362. var _20 = this.getPageTop() + this.getHeight();
  8363. if (_18 + _19 >= _20) {
  8364. _18 = _20 - (_19 + 2)
  8365. }
  8366. _12.placeNear(_17[0], _18);
  8367. _12.show();
  8368. _12.bringToFront();
  8369. return
  8370. }, isc.A.visibilityChanged = function isc_Calendar_visibilityChanged(_1) {
  8371. if (!_1 && this.eventDialog) this.eventDialog.hide()
  8372. }, isc.A.showEventEditor = function isc_Calendar_showEventEditor(_1, _2) {
  8373. if (_2 == null) _2 = (_1 == null);
  8374. this.$53j(_1, _2)
  8375. }, isc.A.showNewEventEditor = function isc_Calendar_showNewEventEditor(_1) {
  8376. this.showEventEditor(_1, true)
  8377. }, isc.A.$53j = function isc_Calendar__showEventEditor(_1, _2) {
  8378. if (!this.eventEditorLayout.isDrawn()) {
  8379. this.eventEditorLayout.setVisibility(isc.Canvas.INHERIT);
  8380. this.eventEditorLayout.draw()
  8381. }
  8382. this.eventEditorLayout.setWidth(this.mainView.getVisibleWidth());
  8383. this.eventEditorLayout.setHeight(this.mainView.getVisibleHeight());
  8384. this.eventEditorLayout.setPageLeft(this.mainView.getPageLeft());
  8385. this.eventEditorLayout.setPageTop(this.getPageTop());
  8386. this.eventEditorLayout.isNewEvent = _2;
  8387. this.eventEditorLayout.view = this.getSelectedView();
  8388. if (_1) {
  8389. this.eventEditorLayout.setEvent(_1)
  8390. } else {
  8391. this.eventEditor.clearValues();
  8392. this.eventEditorLayout.setTitle(this.newEventEditorWindowTitle);
  8393. if (this.eventDialog && this.eventDialog.isVisible()) {
  8394. if (this.eventEditorFields) {
  8395. this.eventEditorLayout.items[0].setCustomValues(this.eventDialog.items[0].getCustomValues())
  8396. }
  8397. var _3 = this.eventDialog.items[0].getValue(this.nameField);
  8398. var _4 = this.eventDialog.items[0].getItem(this.laneNameField);
  8399. var _5 = _4 ? _4.getValue() : null;
  8400. var _6 = new Date();
  8401. this.eventEditorLayout.setDate(_6, this.eventDialog.currentEnd, _3, _5)
  8402. }
  8403. }
  8404. this.hideEventDialog();
  8405. this.eventEditorLayout.show()
  8406. }, isc.A.$53k = function isc_Calendar__getEventDialogTitle(_1, _2) {
  8407. var _3 = isc.DateUtil.getShortDayNames(),
  8408. _4 = isc.DateUtil.getShortMonthNames(),
  8409. _5 = isc.Time.toTime(_1, this.timeFormatter, false),
  8410. _6 = isc.Time.toTime(_2, this.timeFormatter, false),
  8411. _7;
  8412. if (this.isTimeline()) {
  8413. var _8 = (isc.DateUtil.compareLogicalDates(_1, _2) != 0);
  8414. if (_8) {
  8415. _7 = _3[_1.getDay()] + ", " + _4[_1.getMonth()] + " " + _1.getDate() + ", " + _5 + " - " + _3[_2.getDay()] + ", " + _4[_2.getMonth()] + " " + _2.getDate() + ", " + _6;
  8416. return _7
  8417. }
  8418. }
  8419. var _9 = _5 + " - " + _6;
  8420. return _3[_1.getDay()] + ", " + _4[_1.getMonth()] + " " + _1.getDate() + ", " + _9
  8421. }, isc.A.$53n = function isc_Calendar__to12HrNotation(_1) {
  8422. if (_1 == 0) return 12;
  8423. else if (_1 < 13) return _1;
  8424. else return _1 - 12
  8425. }, isc.A.$534 = function isc_Calendar__to24HourNotation(_1, _2) {
  8426. _1 = parseInt(_1);
  8427. if (_2 == null) return _1;
  8428. else if (_2.toLowerCase() == "am" && _1 == 12) {
  8429. return 0
  8430. } else if (_2.toLowerCase() == "pm" && _1 < 12) {
  8431. return _1 + 12
  8432. } else {
  8433. return _1
  8434. }
  8435. }, isc.A.$116j = function isc_Calendar__getCellCSSText(_1, _2, _3, _4) {
  8436. var _5 = this.getCellDate(_3, _4, _1);
  8437. if (!_5) return null;
  8438. var _6 = this.getDateCSSText ? this.getDateCSSText(_5, _3, _4, _1) : null;
  8439. if (_6) return _6;
  8440. if (this.todayBackgroundColor) {
  8441. var _7 = isc.DateUtil.compareLogicalDates(_5, new Date());
  8442. if ((_7 !== false && _7 == 0)) {
  8443. return "background-color:" + this.todayBackgroundColor + ";"
  8444. }
  8445. }
  8446. return null
  8447. }, isc.A.getDateHeaderTitle = function isc_Calendar_getDateHeaderTitle(_1, _2, _3, _4) {
  8448. return null
  8449. }, isc.A.getCellDate = function isc_Calendar_getCellDate(_1, _2, _3) {
  8450. _3 = _3 || this.getSelectedView();
  8451. var _4;
  8452. if (_1 == null && _2 == null) {
  8453. _1 = _3.getEventRow();
  8454. _2 = _3.getEventCol()
  8455. }
  8456. var _5 = _3.frozenFields ? _3.frozenFields.length : 0;
  8457. if (_3.isDayView() || _3.isWeekView() || _3.isTimelineView()) {
  8458. var _6 = _2 - _5;
  8459. _4 = _6 >= 0 ? _3.getCellDate(_1, _6) : null
  8460. } else if (_3.isMonthView()) {
  8461. if (_2 >= _3.getFields().length)
  8462. _2 = _3.getFields().length - 1;
  8463. var _7 = _3.data.get(_1);
  8464. var _8 = _3.getField(_2).$66b;
  8465. if (_7 && _7["date" + _8] != null) {
  8466. _4 = _7["date" + _8].duplicate();
  8467. _4.setHours(0);
  8468. _4.setMinutes(0);
  8469. _4.setSeconds(0)
  8470. }
  8471. } else {
  8472. return
  8473. }
  8474. return _4
  8475. }, isc.A.getDateFromPoint = function isc_Calendar_getDateFromPoint(_1, _2, _3, _4) {
  8476. _4 = _4 || this.getSelectedView();
  8477. if (_3 == null) _3 = true;
  8478. if (_4.getDateFromPoint) return _4.getDateFromPoint(_1, _2, null, _3);
  8479. if (_1 == null && _2 == null) {
  8480. _1 = _4.body.getOffsetX();
  8481. _2 = _4.body.getOffsetY()
  8482. }
  8483. var _5 = _4.body.getEventColumn(_1),
  8484. _6 = _4.body.getEventRow(_2),
  8485. _7;
  8486. if (_4.isMonthView()) {
  8487. _7 = this.getCellDate(_6, _5, _4)
  8488. } else {
  8489. return
  8490. }
  8491. return _7
  8492. }, isc.A.getLane = function isc_Calendar_getLane(_1, _2) {
  8493. if (!_1) return null;
  8494. _2 = _2 || this.getSelectedView();
  8495. if (_2.getLane) return _2.getLane(_1);
  8496. return null
  8497. }, isc.A.getEventLane = function isc_Calendar_getEventLane(_1, _2) {
  8498. if (!_1) return null;
  8499. return this.getLane(_1[this.laneNameField], _2)
  8500. }, isc.A.getSublane = function isc_Calendar_getSublane(_1, _2, _3) {
  8501. if (!_1) return null;
  8502. _3 = _3 || this.getSelectedView();
  8503. if (_3.getSublane) return _3.getSublane(_1, _2);
  8504. return null
  8505. }, isc.A.getEventSublane = function isc_Calendar_getEventSublane(_1, _2) {
  8506. if (!_1) return null;
  8507. return this.getSublane(_1[this.laneNameField], _1[this.sublaneNameField], _2)
  8508. }, isc.A.getLaneFromPoint = function isc_Calendar_getLaneFromPoint(_1, _2, _3) {
  8509. _3 = _3 || this.getSelectedView();
  8510. if (!_3.hasLanes()) return null;
  8511. if (_3.getLaneFromPoint) return _3.getLaneFromPoint(_1, _2);
  8512. return null
  8513. }, isc.A.getSublaneFromPoint = function isc_Calendar_getSublaneFromPoint(_1, _2, _3) {
  8514. _3 = _3 || this.getSelectedView();
  8515. if (_3.getSublaneFromPoint) return _3.getSublaneFromPoint(_1, _2);
  8516. return null
  8517. }, isc.A.getDateLeftOffset = function isc_Calendar_getDateLeftOffset(_1, _2) {
  8518. if (_2 && _2.getDateLeftOffset) return _2.getDateLeftOffset(_1)
  8519. }, isc.A.currentViewChanged = function isc_Calendar_currentViewChanged(_1) {}, isc.A.getDayBodyHTML = function isc_Calendar_getDayBodyHTML(_1, _2, _3, _4, _5) {
  8520. if (!_1 || !_2 || _2.length == 0) return "";
  8521. var _6 = _3.monthView,
  8522. _7 = _1.getDay(),
  8523. _8 = _6.getRecord(_4),
  8524. _9 = _6.getRowHeight(_8, _4),
  8525. _10 = "",
  8526. _11 = null,
  8527. _12 = "";
  8528. for (var i = 0; i < _2.length; i++) {
  8529. if (i > 0) _10 += "<br>";
  8530. _10 += "<nobr>" + _2[i].name + "</nobr>";
  8531. var _14 = isc.Canvas.measureContent(_10, this.dayBodyBaseStyle, true);
  8532. if (_14 >= _9) {
  8533. _11 = i - 1;
  8534. break
  8535. }
  8536. }
  8537. if (_11 == null) _11 = _2.length;
  8538. for (var i = 0; i < _11; i++) {
  8539. var _15 = isc.Time.toTime(this.getEventStartDate(_2[i]), this.timeFormatter, true) + " ";
  8540. if (!this.isPrinting && this.canEditEvent(_2[i])) {
  8541. var _16 = "<a href='javascript:" + this.ID + ".monthViewEventClick(" + _4 + "," + _5 + "," + i + ");' class='" + this.calMonthEventLinkStyle + "'>";
  8542. _12 += _16 + _15 + _2[i][this.nameField] + "</a><br/>"
  8543. } else {
  8544. _12 += _15 + _2[i][this.nameField] + "<br/>"
  8545. }
  8546. }
  8547. if (_11 != _2.length && !this.isPrinting) {
  8548. var _17 = "<a href='javascript:" + this.ID + ".monthMoreEventsLinkClick(" + _4 + "," + _5 + "," + _11 + ");' class='" + this.calMonthEventLinkStyle + "'>",
  8549. _18 = this.monthMoreEventsLinkTitle,
  8550. _19 = _18.evalDynamicString(this, {
  8551. eventCount: (_2.length - 1 - i)
  8552. });
  8553. _12 += _17 + _19 + "</a><br/>"
  8554. }
  8555. return _12
  8556. }, isc.A.monthViewEventClick = function isc_Calendar_monthViewEventClick(_1, _2, _3) {
  8557. var _4 = this.monthView.getEvents(_1, _2);
  8558. var _5 = _4[_3];
  8559. if (this.eventClick(_5, "month")) this.showEventEditor(_5)
  8560. }, isc.A.$167z = function isc_Calendar__getMonthMoreEventsMenu() {
  8561. if (!this.monthMoreEventsMenu) {
  8562. this.monthMoreEventsMenu = this.createAutoChild("monthMoreEventsMenu")
  8563. }
  8564. return this.monthMoreEventsMenu
  8565. }, isc.A.monthMoreEventsLinkClick = function isc_Calendar_monthMoreEventsLinkClick(_1, _2, _3) {
  8566. var _4 = this,
  8567. _5 = this.monthView,
  8568. _6 = _5 && _5.getEvents(_1, _2) || [],
  8569. _7 = [];
  8570. for (var i = _3; i < _6.length; i++) {
  8571. var _9 = _6[i];
  8572. _7.add({
  8573. title: _9[this.nameField],
  8574. enabled: this.canEditEvent(_9),
  8575. event: _9,
  8576. calendar: _4,
  8577. click: function() {
  8578. if (this.calendar.eventClick(this.event, "month")) {
  8579. this.calendar.showEventEditor(this.event)
  8580. }
  8581. }
  8582. })
  8583. }
  8584. var _10 = this.$167z();
  8585. _10.setItems(_7);
  8586. _10.positionContextMenu();
  8587. _10.show()
  8588. }, isc.A.getMonthViewHoverHTML = function isc_Calendar_getMonthViewHoverHTML(_1, _2) {
  8589. if (_2 != null) {
  8590. var _3 = "";
  8591. var _4 = this.creator || this;
  8592. for (var i = 0; i < _2.length; i++) {
  8593. var _6 = isc.Time.toTime(_4.getEventStartDate(_2[i]), _4.timeFormatter, true);
  8594. _3 += "<nobr>" + _6 + " " + _2[i][_4.nameField] + "<nobr/><br/>"
  8595. }
  8596. return _3
  8597. }
  8598. }, isc.A.getDayHeaderHTML = function isc_Calendar_getDayHeaderHTML(_1, _2, _3, _4, _5) {
  8599. return _1.getDate()
  8600. }, isc.A.dayBodyClick = function isc_Calendar_dayBodyClick(_1, _2, _3, _4, _5) {
  8601. return true
  8602. }, isc.A.dayHeaderClick = function isc_Calendar_dayHeaderClick(_1, _2, _3, _4, _5) {
  8603. return true
  8604. }, isc.A.eventClick = function isc_Calendar_eventClick(_1, _2) {
  8605. return true
  8606. }, isc.A.$129v = function isc_Calendar__eventCanvasClick(_1) {
  8607. var _2 = _1.event,
  8608. _3 = _1.calendarView,
  8609. _4 = _3.isWeekView(),
  8610. _5 = this.eventClick(_2, _3.viewName);
  8611. if (this.bringEventsToFront) _1.bringToFront();
  8612. if (_5) {
  8613. if (!this.canEditEvent(_2)) return;
  8614. this.clearViewSelection();
  8615. if (!_3.isTimelineView()) {
  8616. var _6 = this.getEventStartDate(_2);
  8617. var _7 = (_3.frozenFields ? _3.frozenFields.length : 0);
  8618. var _8 = _4 ? _6.getDay() - this.firstDayOfWeek + _7 : _7;
  8619. if (_4 && this.showWeekends == false) _8--;
  8620. var _9 = _6.getHours() * this.getRowsPerHour(_3)
  8621. }
  8622. this.showEventDialog(_2)
  8623. }
  8624. }, isc.A.eventRemoveClick = function isc_Calendar_eventRemoveClick(_1, _2) {
  8625. return true
  8626. }, isc.A.eventMoved = function isc_Calendar_eventMoved(_1, _2, _3) {
  8627. return true
  8628. }, isc.A.eventResized = function isc_Calendar_eventResized(_1, _2) {
  8629. return true
  8630. }, isc.A.timelineEventMoved = function isc_Calendar_timelineEventMoved(_1, _2, _3, _4) {
  8631. return true
  8632. }, isc.A.timelineEventResized = function isc_Calendar_timelineEventResized(_1, _2, _3) {
  8633. return true
  8634. }, isc.A.getValidSnapDate = function isc_Calendar_getValidSnapDate(_1, _2) {
  8635. if (this.isTimeline()) {} else {
  8636. var _3 = this.getSnapGapPixels();
  8637. var _4 = ((_1.getHours() * 60) + _1.getMinutes()) % _3;
  8638. var _5 = (_2.getHours() * 60) + _2.getMinutes();
  8639. var _6 = Math.round((_5 - _4) / _3);
  8640. var _7 = (_6 * _3) + _4;
  8641. var _8 = Math.floor(_7 / 60),
  8642. _9 = _7 % 60;
  8643. _2.setHours(_8);
  8644. _2.setMinutes(_9)
  8645. }
  8646. return _2
  8647. }, isc.A.selectTab = function isc_Calendar_selectTab(_1) {
  8648. if (this.mainView && this.mainView.isA("TabSet") && this.mainView.tabs.getLength() > _1) {
  8649. this.mainView.selectTab(_1);
  8650. this.refreshSelectedView();
  8651. return true
  8652. } else {
  8653. return false
  8654. }
  8655. }, isc.A.parentResized = function isc_Calendar_parentResized() {
  8656. this.Super('parentResized', arguments);
  8657. if (this.eventEditorLayout.isVisible()) this.eventEditorLayout.sizeMe()
  8658. }, isc.A.dateChanged = function isc_Calendar_dateChanged() {
  8659. return true
  8660. }, isc.A.getActiveDay = function isc_Calendar_getActiveDay() {
  8661. var _1 = this.getActiveTime();
  8662. if (_1) return _1.getDay()
  8663. }, isc.A.getActiveTime = function isc_Calendar_getActiveTime() {
  8664. var _1 = this.ns.EH,
  8665. _2 = this.getSelectedView();
  8666. var _3 = _2.getEventRow();
  8667. var _4 = _2.getEventColumn();
  8668. return this.getCellDate(_3, _4, _2)
  8669. }, isc.A.setTimelineRange = function isc_Calendar_setTimelineRange(_1, _2, _3, _4, _5, _6, _7) {
  8670. if (this.timelineView) this.timelineView.setTimelineRange(_1, _2, _3, _4, _5, _6);
  8671. if (_7) this.fireCallback(_7)
  8672. }, isc.A.setResolution = function isc_Calendar_setResolution(_1, _2, _3, _4, _5) {
  8673. if (this.timelineView) {
  8674. _4 = _4 || 1;
  8675. if (_1 && _1.length > 0) {
  8676. this.timelineGranularity = _1[_1.length - 1].unit
  8677. }
  8678. var _6 = _2;
  8679. var _7 = isc.DateUtil.dateAdd(this.startDate.duplicate(), _6, _3, 1);
  8680. var _8 = Math.round(isc.DateUtil.convertPeriodUnit(_3, _6, this.timelineGranularity));
  8681. this.timelineView.setTimelineRange(this.startDate, _7, this.timelineGranularity, _8, _4, _1);
  8682. this.eventEditor.rebuildFieldList()
  8683. }
  8684. if (_5) this.fireCallback(_5)
  8685. }, isc.A.getEventLength = function isc_Calendar_getEventLength(_1, _2) {
  8686. var _3 = _1.eventLength,
  8687. _4 = isc.DateUtil;
  8688. if (_3 == null) {
  8689. _3 = _4.getPeriodLength(this.getEventStartDate(_1), this.getEventEndDate(_1));
  8690. _1.eventLength = _3
  8691. }
  8692. if (_2) {
  8693. return _4.convertPeriodUnit(_1.eventLength, "ms", _2)
  8694. }
  8695. return _1.eventLength
  8696. }, isc.A.canEditEventLane = function isc_Calendar_canEditEventLane(_1, _2) {
  8697. var _3 = _1[this.canEditLaneField] != null ? _1[this.canEditLaneField] : this.canEditLane != false;
  8698. return _3
  8699. }, isc.A.canEditEventSublane = function isc_Calendar_canEditEventSublane(_1, _2) {
  8700. if (!this.useSublanes) return false;
  8701. var _3 = _1[this.canEditSublaneField];
  8702. if (_3 == null) _3 = (this.canEditSublane != false);
  8703. return _3
  8704. }, isc.A.eventRepositionMove = function isc_Calendar_eventRepositionMove(_1, _2, _3) {
  8705. var _4 = this.getEventStartDate(_2),
  8706. _5 = this.getEventEndDate(_2);
  8707. if (this.shouldDisableDate(_4, _3) || this.shouldDisableDate(_5, _3)) {
  8708. return false
  8709. }
  8710. return true
  8711. }, isc.A.eventRepositionStop = function isc_Calendar_eventRepositionStop(_1, _2, _3, _4) {
  8712. return true
  8713. }, isc.A.eventResizeMove = function isc_Calendar_eventResizeMove(_1, _2, _3, _4) {
  8714. var _5 = this.getEventStartDate(_2),
  8715. _6 = this.getEventEndDate(_2);
  8716. if (_5.getTime() == _6.getTime()) return false;
  8717. _6.setTime(_6.getTime() - 1);
  8718. if (((_4.$1172 || _4.$159n) && this.shouldDisableDate(_5, _3)) || ((_4.$131q || _4.$131g) && this.shouldDisableDate(_6, _3))) {
  8719. return false
  8720. }
  8721. return true
  8722. }, isc.A.eventResizeStop = function isc_Calendar_eventResizeStop(_1, _2, _3, _4) {
  8723. return true
  8724. }, isc.A.checkForOverlap = function isc_Calendar_checkForOverlap(_1, _2, _3, _4, _5, _6) {
  8725. var _7 = {},
  8726. _8 = this.startDateField,
  8727. _9 = this.endDateField;
  8728. _7[_8] = _4.duplicate();
  8729. _7[_9] = _5.duplicate();
  8730. _7[this.laneNameField] = _6;
  8731. var _10 = this.data;
  8732. if (_6) {
  8733. _10 = this.getLaneEvents(_6, _1)
  8734. }
  8735. var _11 = _1.findOverlappingEvents(_3, _7, null, (_6 != null), _10);
  8736. if (_11.length == 0) {
  8737. return false
  8738. } else if (_11.length > 1) {
  8739. return true
  8740. } else {
  8741. var _12 = _11[0];
  8742. if ((this.equalDatesOverlap == false ? _5 > _12[_8] : _5 >= _12[_8]) && _4 < _12[_8]) {
  8743. _5 = _12[_8].duplicate();
  8744. _4 = _5.duplicate();
  8745. _4.setMinutes(_4.getMinutes() - this.getEventLength(_3, "minute"));
  8746. return [_4, _5]
  8747. } else if ((this.equalDatesOverlap == false ? _4 < _12[_9] : _4 <= _12[_9]) && _5 > _12[_9]) {
  8748. _4 = _12[_9].duplicate();
  8749. _5 = _4.duplicate();
  8750. _5.setMinutes(_5.getMinutes() + this.getEventLength(_3, "minute"));
  8751. return [_4, _5]
  8752. } else {
  8753. return true
  8754. }
  8755. }
  8756. });
  8757. isc.B._maxIndex = isc.C + 224;
  8758. isc.A = isc.Calendar;
  8759. isc.B = isc._allFuncs;
  8760. isc.C = isc.B._maxIndex;
  8761. isc.D = isc._funcClasses;
  8762. isc.D[isc.C] = isc.A.Class;
  8763. isc.B.push(isc.A.$1833 = function isc_c_Calendar__getAsDisplayDate(_1) {
  8764. if (!isc.Time.$854) {
  8765. return new Date(_1.getFullYear(), _1.getMonth(), _1.getDate())
  8766. }
  8767. var _2 = _1.$68g(isc.Time.getUTCHoursDisplayOffset(_1), isc.Time.getUTCMinutesDisplayOffset(_1));
  8768. return new Date(_2.getUTCFullYear(), _2.getUTCMonth(), _2.getUTCDate())
  8769. });
  8770. isc.B._maxIndex = isc.C + 1;
  8771. isc.ClassFactory.defineClass("EventWindow", "Window");
  8772. isc.EventWindow.changeDefaults("resizerDefaults", {
  8773. overflow: "hidden",
  8774. height: 6,
  8775. snapTo: "B",
  8776. canDragResize: true
  8777. });
  8778. isc.EventWindow.changeDefaults("headerDefaults", {
  8779. layoutMargin: 0,
  8780. layoutLeftMargin: 3,
  8781. layoutRightMargin: 3
  8782. });
  8783. isc.A = isc.EventWindow.getPrototype();
  8784. isc.B = isc._allFuncs;
  8785. isc.C = isc.B._maxIndex;
  8786. isc.D = isc._funcClasses;
  8787. isc.D[isc.C] = isc.A.Class;
  8788. isc.A.autoDraw = false;
  8789. isc.A.minHeight = 5;
  8790. isc.A.minWidth = 5;
  8791. isc.A.showHover = true;
  8792. isc.A.canHover = true;
  8793. isc.A.hoverWidth = 200;
  8794. isc.A.canDragResize = true;
  8795. isc.A.canDragReposition = true;
  8796. isc.A.resizeFrom = ["B"];
  8797. isc.A.showShadow = false;
  8798. isc.A.showEdges = false;
  8799. isc.A.showHeaderBackground = false;
  8800. isc.A.useBackMask = false;
  8801. isc.A.keepInParentRect = true;
  8802. isc.A.headerProperties = {
  8803. padding: 0,
  8804. margin: 0,
  8805. height: 14
  8806. };
  8807. isc.A.closeButtonProperties = {
  8808. height: 10,
  8809. width: 10
  8810. };
  8811. isc.A.bodyColor = null;
  8812. isc.A.showHeaderIcon = false;
  8813. isc.A.showMinimizeButton = false;
  8814. isc.A.showMaximimumButton = false;
  8815. isc.A.showFooter = true;
  8816. isc.A.baseStyle = "eventWindow";
  8817. isc.A.dragAppearance = "none";
  8818. isc.A.$125c = {
  8819. overflow: "hidden",
  8820. defaultLayoutAlign: "center",
  8821. height: 7
  8822. };
  8823. isc.B.push(isc.A.initWidget = function isc_EventWindow_initWidget() {
  8824. this.addProperties(this.creator.viewProps);
  8825. this.addProperties(this.creator.gridProps);
  8826. this.addProperties(this.creator.timelineViewProperties);
  8827. this.descriptionText = this.event[this.calendar.descriptionField];
  8828. this.showHeader = this.calendar.showEventHeaders;
  8829. this.showBody = this.calendar.showEventDescriptions;
  8830. this.footerProperties = isc.addProperties({
  8831. dragTarget: this.eventDragTarget
  8832. }, this.footerProperties, this.$125c);
  8833. if (this.bodyConstructor == null) this.bodyConstructor = isc.HTMLFlow;
  8834. if (this.calendar.showEventDescriptions != false) {
  8835. this.bodyProperties = isc.addProperties({}, this.bodyProperties, {
  8836. contents: this.descriptionText,
  8837. valign: "top",
  8838. overflow: "hidden"
  8839. })
  8840. }
  8841. if (this.calendar.showEventBody == false) {
  8842. this.showBody = false;
  8843. this.showTitle = false
  8844. }
  8845. this.Super("initWidget", arguments);
  8846. if (this.calendar.showEventDescriptions == false) {
  8847. var _1 = isc.Label.create({
  8848. autoDraw: true,
  8849. border: "0px",
  8850. padding: 3,
  8851. height: 1,
  8852. width: 1,
  8853. backgroundColor: this.event.backgroundColor,
  8854. textColor: this.event.textColor,
  8855. setContents: function(_2) {
  8856. this.$116k = _2;
  8857. this.Super("setContents", arguments)
  8858. },
  8859. canHover: true,
  8860. showHover: true,
  8861. eventCanvas: this,
  8862. getHoverHTML: function() {
  8863. return this.eventCanvas.getHoverHTML()
  8864. },
  8865. redrawWithParent: true
  8866. });
  8867. _1.addMember = function(_2) {
  8868. this.addChild(_2)
  8869. };
  8870. _1.addChild(this.resizer);
  8871. this.addChild(_1);
  8872. this.header = _1;
  8873. this.$128l = _1;
  8874. this.$77n = true
  8875. }
  8876. this.setEventStyle(this.baseStyle)
  8877. }, isc.A.getEvent = function isc_EventWindow_getEvent() {
  8878. return this.event
  8879. }, isc.A.getCalendar = function isc_EventWindow_getCalendar() {
  8880. return this.calendar
  8881. }, isc.A.getCalendarView = function isc_EventWindow_getCalendarView() {
  8882. return this.calendarView
  8883. }, isc.A.setDragProperties = function isc_EventWindow_setDragProperties(_1, _2, _3) {
  8884. this.canDragResize = _2 == null ? true : _2;
  8885. if (_1 == null) _1 = true;
  8886. this.dragTarget = _3;
  8887. this.setCanDragReposition(_1, _3);
  8888. if (this.canDragResize) {
  8889. if (!this.resizer) this.makeFooter();
  8890. else if (!this.resizer.isVisible()) this.resizer.show()
  8891. } else {
  8892. if (this.resizer && this.resizer.isVisible()) this.resizer.hide()
  8893. }
  8894. }, isc.A.setEventStyle = function isc_EventWindow_setEventStyle(_1, _2, _3) {
  8895. _2 = _2 || this.headerStyle || _1 + "Header";
  8896. _3 = _3 || this.bodyStyle || _1 + "Body";
  8897. this.baseStyle = _1;
  8898. this.styleName = _1;
  8899. this.bodyStyle = _3;
  8900. this.headerStyle = _2;
  8901. this.setStyleName(_1);
  8902. if (this.header) this.header.setStyleName(this.headerStyle);
  8903. if (this.headerLabel) {
  8904. this.headerLabel.setStyleName(this.headerStyle)
  8905. } else {
  8906. this.headerLabelProperties = isc.addProperties({}, this.headerLabelProperties, {
  8907. styleName: this.headerStyle
  8908. })
  8909. }
  8910. if (this.body) this.body.setStyleName(this.bodyStyle);
  8911. if (this.$128l) this.$128l.setStyleName(this.bodyStyle)
  8912. }, isc.A.mouseUp = function isc_EventWindow_mouseUp() {
  8913. return isc.EH.STOP_BUBBLING
  8914. }, isc.A.makeFooter = function isc_EventWindow_makeFooter() {
  8915. if (!this.showFooter || this.canDragResize == false) return;
  8916. var _1 = {
  8917. dragTarget: this.dragTarget,
  8918. styleName: this.baseStyle + "Resizer"
  8919. };
  8920. if (this.$77n) _1.snapTo = "B";
  8921. this.resizer = this.createAutoChild("resizer", _1);
  8922. if (this.$77n) {
  8923. this.header.addChild(this.resizer)
  8924. } else {
  8925. this.addChild(this.resizer)
  8926. }
  8927. if (this.resizer) this.resizer.bringToFront()
  8928. }, isc.A.setDescriptionText = function isc_EventWindow_setDescriptionText(_1) {
  8929. _1 = _1 || "";
  8930. if (this.calendar.getDescriptionText) {
  8931. _1 = this.calendar.getDescriptionText(this.event)
  8932. }
  8933. if (this.body) {
  8934. this.descriptionText = _1;
  8935. this.body.setContents(_1)
  8936. } else {
  8937. this.descriptionText = _1;
  8938. if (this.$734) {
  8939. this.$734.setWidth("100%");
  8940. this.$734.setContents(_1)
  8941. } else if (this.calendar.showEventDescriptions == false) {
  8942. this.$128l.setContents(_1);
  8943. this.$128l.redraw()
  8944. }
  8945. }
  8946. }, isc.A.click = function isc_EventWindow_click() {
  8947. if (this.$53u) return;
  8948. if (this.$67e) {
  8949. this.$67e = null;
  8950. return
  8951. }
  8952. var _1 = this.calendar;
  8953. if (_1.bringEventsToFront) this.bringToFront();
  8954. var _2 = _1.eventClick(this.event, this.$53i ? "week" : "day");
  8955. if (_2) {
  8956. if (!_1.canEditEvent(this.event)) return;
  8957. _1.clearViewSelection();
  8958. var _3 = (this.$53i && _1.weekView.isLabelCol(0) ? 1 : 0);
  8959. var _4 = this.$53i ? _1.getEventStartDate(this.event).getDay() -
  8960. _1.firstDayOfWeek + _3 : _3;
  8961. if (this.$53i && _1.showWeekends == false) _4--;
  8962. _1.showEventDialog(this.event)
  8963. }
  8964. }, isc.A.mouseDown = function isc_EventWindow_mouseDown() {
  8965. if (this.dragTarget) this.dragTarget.eventCanvas = this;
  8966. this.calendar.eventDialog.hide();
  8967. return isc.EH.STOP_BUBBLING
  8968. }, isc.A.renderEvent = function isc_EventWindow_renderEvent(_1, _2, _3, _4) {
  8969. var _5 = this.calendar,
  8970. _6 = this.event;
  8971. if (isc.isA.Number(_3) && isc.isA.Number(_4)) {
  8972. this.resizeTo(Math.round(_3), Math.round(_4))
  8973. }
  8974. if (isc.isA.Number(_1) && isc.isA.Number(_2)) {
  8975. this.moveTo(Math.round(_2), Math.round(_1))
  8976. }
  8977. var _7 = _5.getEventHeaderHTML(_6, this.calendarView),
  8978. _8 = _7,
  8979. _9 = "";
  8980. if (_6.headerBackgroundColor) _9 += "backgroundColor: " + _6.headerBackgroundColor + ";";
  8981. if (_6.headerTextColor) _9 += "backgroundColor: " + _6.headerTextColor + ";";
  8982. if (_6.headerBorderColor) _9 += "border-color: " + _6.headerBorderColor + ";";
  8983. if (_9 != "") _8 = "<span style='" + _9 + "'>" + _8 + "<span>";
  8984. this.setTitle(_8);
  8985. this.updateColors(_7);
  8986. if (this.$77n) {
  8987. this.header.resizeTo(Math.round(_3), Math.round(_4));
  8988. this.header.setContents(_8)
  8989. }
  8990. if (!this.isDrawn()) this.draw();
  8991. this.show();
  8992. this.bringToFront()
  8993. }, isc.A.updateColors = function isc_EventWindow_updateColors(_1) {
  8994. var _2 = this.calendar,
  8995. _3 = this.event,
  8996. _4 = this.header,
  8997. _5 = _4 ? _4.getMember ? _4.getMember(0) : _4 : null,
  8998. _6 = _5,
  8999. _7 = _1 || _2.getEventHeaderHTML(_3, this.calendarView);
  9000. if (!_3) return;
  9001. if (_5 && _5.children && _5.children[0]) {
  9002. var _8 = _5.children[0].members;
  9003. if (_8 && _8.length > 0) _6 = _8[0]
  9004. }
  9005. if (_3.backgroundColor) {
  9006. this.setBackgroundColor(_3.backgroundColor);
  9007. if (this.body) this.body.setBackgroundColor(_3.backgroundColor)
  9008. } else {
  9009. this.backgroundColor = null;
  9010. if (this.isDrawn() && this.getStyleHandle()) {
  9011. this.getStyleHandle().backgroundColor = null
  9012. }
  9013. if (this.body) {
  9014. this.body.backgroundColor = null;
  9015. if (this.body.isDrawn() && this.body.getStyleHandle()) {
  9016. this.body.getStyleHandle().backgroundColor = null
  9017. }
  9018. }
  9019. if (_6) {
  9020. _6.backgroundColor = null;
  9021. if (_6.isDrawn() && _6.getStyleHandle()) {
  9022. _6.getStyleHandle().backgroundColor = null
  9023. }
  9024. }
  9025. }
  9026. if (_3.textColor) {
  9027. this.setTextColor(_3.textColor);
  9028. if (this.body) {
  9029. var _9 = "color:" + _3.textColor + ";"
  9030. this.body.setTextColor(_3.textColor);
  9031. this.body.setContents("<span style='" + _9 + "'>" + _3[_2.descriptionField] || "</span>")
  9032. }
  9033. } else {
  9034. if (this.textColor) {
  9035. this.setTextColor(null);
  9036. if (this.isDrawn() && this.getStyleHandle()) {
  9037. this.getStyleHandle().color = null
  9038. }
  9039. if (this.body) {
  9040. this.body.setTextColor(null);
  9041. this.body.setContents(_3[_2.descriptionField])
  9042. }
  9043. if (_6) {
  9044. _6.setTextColor(null);
  9045. _6.setContents(_7)
  9046. }
  9047. if (this.$128l) {
  9048. this.$128l.setTextColor(null);
  9049. this.$128l.setContents(_7)
  9050. }
  9051. }
  9052. }
  9053. if (this.header) {
  9054. var _10, _11;
  9055. if (_2.showEventDescriptions == false) {
  9056. _10 = _3.backgroundColor;
  9057. _11 = _3.textColor
  9058. } else {
  9059. _10 = _3.headerBackgroundColor;
  9060. _11 = _3.headerTextColor
  9061. }
  9062. if (_10) {
  9063. this.header.setBackgroundColor(_10);
  9064. if (_6) _6.setBackgroundColor(_10)
  9065. } else {
  9066. this.header.backgroundColor = null;
  9067. if (this.isDrawn() && this.header.getStyleHandle()) {
  9068. this.header.getStyleHandle().backgroundColor = null
  9069. }
  9070. if (_6) {
  9071. _6.backgroundColor = null;
  9072. if (_6.getStyleHandle()) {
  9073. _6.getStyleHandle().backgroundColor = null
  9074. }
  9075. }
  9076. }
  9077. if (_11) {
  9078. this.header.setTextColor(_11);
  9079. var _9 = "color:" + _11 + ";",
  9080. _12 = _2.showEventDescriptions == false ? this.header.$116k : _7,
  9081. _13 = "<span style='" + _9 + "'>" + _12 + "</span>";
  9082. if (!_6) {
  9083. if (this.header.setContents) this.header.setContents(_13)
  9084. } else {
  9085. _6.setTextColor(_11);
  9086. _6.setContents(_13)
  9087. }
  9088. } else {
  9089. if (this.header.textColor) {
  9090. this.header.setTextColor(null);
  9091. if (this.isDrawn() && this.header.getStyleHandle()) {
  9092. this.header.getStyleHandle().color = null
  9093. }
  9094. if (_6) {
  9095. _6.setTextColor(null);
  9096. if (_6.isDrawn() && _6.getStyleHandle()) {
  9097. _6.getStyleHandle().color = null
  9098. }
  9099. }
  9100. }
  9101. }
  9102. this.markForRedraw()
  9103. }
  9104. }, isc.A.getPrintHTML = function isc_EventWindow_getPrintHTML(_1, _2) {
  9105. var _3 = isc.StringBuffer.create(),
  9106. _4 = this.calendar,
  9107. _5 = _4.isTimeline(),
  9108. _6 = this.parentElement,
  9109. _7 = _6.grid,
  9110. _8 = 40 + _7.getHeaderHeight(),
  9111. _9 = this.getTop(),
  9112. _10 = _6.getPageTop(),
  9113. _11 = (_9) + _8 + 1,
  9114. _12 = _6.$26a,
  9115. _13 = _7.getLeft() + _6.getLeft() + (_7.getEventLeft ? _7.getEventLeft(this.event) : _4.getEventLeft(this.event, _7)),
  9116. _14 = this.getVisibleWidth(),
  9117. _15 = this.getVisibleHeight() - 2,
  9118. i = (_1 && _1.i ? _1.i : 1);
  9119. var _17 = _4.getEventStartCol(this.event, this, this.calendarView),
  9120. _18 = _4.getEventEndCol(this.event, this, this.calendarView);
  9121. if (_5) {
  9122. _13 += (14 + ((_17 - 1) * 2));
  9123. _14 += _18 - _17
  9124. } else {
  9125. _13 += _7.$53i ? 6 : 8
  9126. }
  9127. var _19 = _5 ? this.baseStyle : this.body.styleName;
  9128. _3.append("<div class='", _19, "' ", "style='border: 1px solid grey; vertical-align: ", (_4.showEventDescriptions ? "top" : "middle"), "; ", (_5 ? "overflow:hidden; " : ""), "position: absolute; ", "left:", _13, "; top:", _11, "; width: ", _14, "; height: ", _15, "; ", "z-index:", i + 2, ";'>");
  9129. if (_4.showEventDescriptions) {
  9130. _3.append(this.title, "<br>", this.event[_4.descriptionField])
  9131. } else {
  9132. _3.append(this.title)
  9133. }
  9134. _3.append("</div>");
  9135. var _20 = _3.release(false);
  9136. return _20
  9137. }, isc.A.getHoverHTML = function isc_EventWindow_getHoverHTML() {
  9138. return this.calendar.$141h(this.event, this, this.calendarView)
  9139. }, isc.A.closeClick = function isc_EventWindow_closeClick() {
  9140. var _1 = this.calendar;
  9141. if (_1.eventRemoveClick(this.event) == false) {
  9142. this.$67e = true;
  9143. return
  9144. }
  9145. this.Super("closeClick", arguments);
  9146. this.calendar.removeEvent(this.event, true);
  9147. this.$53u = true
  9148. }, isc.A.parentResized = function isc_EventWindow_parentResized() {
  9149. this.Super('parentResized', arguments);
  9150. if (this.event) this.calendarView.sizeEventCanvas(this)
  9151. }, isc.A.getEventLength = function isc_EventWindow_getEventLength() {
  9152. return this.event.eventLength
  9153. }, isc.A.show = function isc_EventWindow_show() {
  9154. this.Super("show", arguments)
  9155. }, isc.A.resized = function isc_EventWindow_resized() {
  9156. if (this.$77n) {
  9157. this.header.resizeTo(this.getVisibleWidth(), this.getVisibleHeight())
  9158. }
  9159. });
  9160. isc.B._maxIndex = isc.C + 20;
  9161. isc.ClassFactory.defineClass("TimelineWindow", "EventWindow");
  9162. isc.A = isc.TimelineWindow.getPrototype();
  9163. isc.B = isc._allFuncs;
  9164. isc.C = isc.B._maxIndex;
  9165. isc.D = isc._funcClasses;
  9166. isc.D[isc.C] = isc.A.Class;
  9167. isc.A.showFooter = false;
  9168. isc.A.resizeFrom = ["L", "R"];
  9169. isc.A.dragAppearance = "none";
  9170. isc.B.push(isc.A.initWidget = function isc_TimelineWindow_initWidget() {
  9171. if (this.calendar.showEventWindowHeader == false) {
  9172. this.showBody = false;
  9173. this.showTitle = false
  9174. }
  9175. this.Super("initWidget", arguments)
  9176. }, isc.A.draw = function isc_TimelineWindow_draw(_1, _2, _3, _4) {
  9177. this.invokeSuper(isc.TimelineWindow, "draw", _1, _2, _3, _4);
  9178. if (this.calendar.showEventWindowHeader == false) {
  9179. var _5 = isc.Canvas.create({
  9180. autoDraw: false,
  9181. width: "100%",
  9182. height: 0,
  9183. top: 0,
  9184. contents: (this.descriptionText ? this.descriptionText : " "),
  9185. backgroundColor: this.event.backgroundColor,
  9186. textColor: this.event.textColor
  9187. });
  9188. if (this.body) this.body.addMember(_5);
  9189. else this.addMember(_5);
  9190. _5.setHeight("100%");
  9191. this.$734 = _5
  9192. }
  9193. }, isc.A.click = function isc_TimelineWindow_click() {
  9194. var _1 = this.calendar,
  9195. _2 = _1.timelineView,
  9196. _3 = _1.eventClick(this.event, "timeline");
  9197. if (_3) {
  9198. if (!_1.canEditEvent(this.event)) return;
  9199. _1.showEventDialog(this.event)
  9200. } else return isc.EH.STOP_BUBBLING
  9201. }, isc.A.destroyLines = function isc_TimelineWindow_destroyLines() {
  9202. if (this.$645) {
  9203. if (this.$645[0]) this.$645[0].destroy();
  9204. if (this.$645[1]) this.$645[1].destroy();
  9205. if (this.$645[2]) this.$645[2].destroy();
  9206. if (this.$645[3]) this.$645[3].destroy()
  9207. }
  9208. }, isc.A.hideLines = function isc_TimelineWindow_hideLines() {
  9209. if (this.$645) {
  9210. if (this.$645[0]) this.$645[0].hide();
  9211. if (this.$645[1]) this.$645[1].hide();
  9212. if (this.$645[2]) this.$645[2].hide();
  9213. if (this.$645[3]) this.$645[3].hide()
  9214. }
  9215. }, isc.A.showLines = function isc_TimelineWindow_showLines() {
  9216. if (this.$645) {
  9217. if (this.$645[0]) this.$645[0].show();
  9218. if (this.$645[1]) this.$645[1].show();
  9219. if (this.$645[2]) this.$645[2].show();
  9220. if (this.$645[3]) this.$645[3].show()
  9221. }
  9222. });
  9223. isc.B._maxIndex = isc.C + 6;
  9224. isc.Calendar.registerStringMethods({
  9225. getDayBodyHTML: "date,events,calendar,rowNum,colNum",
  9226. getDayHeaderHTML: "date,events,calendar,rowNum,colNum",
  9227. dayBodyClick: "date,events,calendar,rowNum,colNum",
  9228. dayHeaderClick: "date,events,calendar,rowNum,colNum",
  9229. eventClick: "event,viewName",
  9230. eventChanged: "event",
  9231. eventMoved: "newDate,event",
  9232. eventResized: "newDate,event",
  9233. backgroundClick: "startDate,endDate",
  9234. backgroundMouseDown: "startDate",
  9235. backgroundMouseUp: "startDate,endDate"
  9236. });
  9237. isc.defineClass("EventCanvas", "VLayout");
  9238. isc.A = isc.EventCanvas;
  9239. isc.B = isc._allFuncs;
  9240. isc.C = isc.B._maxIndex;
  9241. isc.D = isc._funcClasses;
  9242. isc.D[isc.C] = isc.A.Class;
  9243. isc.A.headerSizer = null;
  9244. isc.B.push(isc.A.getHeaderHeight = function isc_c_EventCanvas_getHeaderHeight(_1, _2, _3, _4, _5) {
  9245. var _6 = isc.EventCanvas;
  9246. if (!_6.headerSizer) {
  9247. _6.headerSizer = isc.Canvas.create({
  9248. ID: "$151s",
  9249. autoDraw: false,
  9250. visibility: "hidden",
  9251. left: 0,
  9252. top: -1000
  9253. })
  9254. }
  9255. _6.headerSizer.setProperties({
  9256. height: _4 ? 1 : _3,
  9257. maxHeight: _4 ? null : _3,
  9258. width: _2,
  9259. maxWidth: _2,
  9260. overflow: _4 ? "visible" : "hidden",
  9261. contents: _1,
  9262. styleName: _5.getHeaderStyle()
  9263. });
  9264. if (!_6.headerSizer.isDrawn()) _6.headerSizer.draw();
  9265. else _6.headerSizer.redraw();
  9266. var _7 = _6.headerSizer.getVisibleHeight();
  9267. _6.headerSizer.hide();
  9268. _6.headerSizer.clear();
  9269. return _7
  9270. });
  9271. isc.B._maxIndex = isc.C + 1;
  9272. isc.A = isc.EventCanvas.getPrototype();
  9273. isc.B = isc._allFuncs;
  9274. isc.C = isc.B._maxIndex;
  9275. isc.D = isc._funcClasses;
  9276. isc.D[isc.C] = isc.A.Class;
  9277. isc.A.visibility = "hidden";
  9278. isc.A.autoDraw = false;
  9279. isc.A.overflow = "hidden";
  9280. isc.A.minHeight = 1;
  9281. isc.A.minWidth = 1;
  9282. isc.A.showHover = true;
  9283. isc.A.canHover = true;
  9284. isc.A.hoverMoveWithMouse = true;
  9285. isc.A.hoverWidth = 200;
  9286. isc.A.snapToGrid = false;
  9287. isc.A.keepInParentRect = true;
  9288. isc.A.dragAppearance = "none";
  9289. isc.A.canDragResize = true;
  9290. isc.A.canDragReposition = true;
  9291. isc.A.$142u = null;
  9292. isc.A.labelOffsetX = 0;
  9293. isc.A.labelOffsetY = 0;
  9294. isc.A.titleOrientation = "top";
  9295. isc.A.maxLabelWidth = 150;
  9296. isc.A.isEventCanvas = true;
  9297. isc.A.padding = null;
  9298. isc.A.bodyHeight = "auto";
  9299. isc.A.divTemplate = ["<div class='", , "' style='", , "'>", , "</div>"];
  9300. isc.A.showContextButton = false;
  9301. isc.A.showRolloverControls = true;
  9302. isc.A.$174j = ["closeButton", "contextButton"];
  9303. isc.B.push(isc.A.getShowHeader = function isc_EventCanvas_getShowHeader() {
  9304. if (this.showHeader != null) return this.showHeader;
  9305. return this.calendar.showEventHeaders
  9306. }, isc.A.getShowBody = function isc_EventCanvas_getShowBody() {
  9307. if (this.showBody != null) return this.showBody;
  9308. return this.calendar.showEventDescriptions
  9309. }, isc.A.initWidget = function isc_EventCanvas_initWidget() {
  9310. if (this.vertical == null) this.vertical = this.calendarView.verticalEvents;
  9311. this.resizeFrom = [];
  9312. this.hoverDelay = this.calendar.hoverDelay + 1;
  9313. if (this.useStaticControls == null) {
  9314. this.useStaticControls = (this.calendar.useEventCanvasRolloverControls == false)
  9315. }
  9316. if (this.canFocus == null) this.canFocus = this.calendar.canSelectEvents;
  9317. this.Super("initWidget", arguments);
  9318. if (this.shouldShowGripper()) this.createGripper();
  9319. if (this.shouldShowLabel()) this.createLabel();
  9320. if (this.$142u == null && !this.calendarView.shouldShowEventHovers()) {}
  9321. this.updateShowHovers()
  9322. }, isc.A.updateShowHovers = function isc_EventCanvas_updateShowHovers() {
  9323. if (this.$142u) this.eventProxy = this.calendarView
  9324. }, isc.A.shouldShowGripper = function isc_EventCanvas_shouldShowGripper() {
  9325. var _1 = this.calendar;
  9326. if (!this.event || !_1.canEditEvent(this.event) || !_1.canDragEvent(this.event)) {
  9327. return false
  9328. }
  9329. if (this.showGripper != null) return this.showGripper;
  9330. if (this.calendar.isZeroLengthEvent(this.event)) return true;
  9331. return false
  9332. }, isc.A.createGripper = function isc_EventCanvas_createGripper() {
  9333. if (this.gripper) return;
  9334. var _1 = {
  9335. canDrag: true,
  9336. dragTarget: this.dragTarget,
  9337. eventProxy: this,
  9338. eventCanvas: this,
  9339. canDragResize: false,
  9340. styleName: this.gripperStyle || this.styleName + "Gripper"
  9341. };
  9342. this.gripper = this.calendar.getEventCanvasGripper(_1, this, this.calendarView)
  9343. }, isc.A.shouldShowLabel = function isc_EventCanvas_shouldShowLabel() {
  9344. if (!this.event) return false;
  9345. if (this.showLabel != null) return this.showLabel;
  9346. if (this.calendar.isZeroLengthEvent(this.event)) return true;
  9347. return false
  9348. }, isc.A.createLabel = function isc_EventCanvas_createLabel() {
  9349. if (this.label) return;
  9350. var _1 = {
  9351. canDrag: false,
  9352. eventCanvas: this,
  9353. canDragResize: false,
  9354. canHover: true,
  9355. showHover: true,
  9356. showOver: false,
  9357. showRollOver: false,
  9358. margin: 3,
  9359. styleName: this.labelStyle || this.styleName + "Gripper",
  9360. contents: this.getHeaderHTML(),
  9361. getHoverHTML: function() {
  9362. return this.eventCanvas.getHoverHTML()
  9363. }
  9364. };
  9365. this.label = this.calendar.getEventCanvasLabel(_1, this.calendarView)
  9366. }, isc.A.parentScrolled = function isc_EventCanvas_parentScrolled() {
  9367. if (this.gripper || this.label) this.repositionPeers()
  9368. }, isc.A.redraw = function isc_EventCanvas_redraw() {
  9369. this.Super("redraw", arguments);
  9370. if (this.gripper || this.label) this.repositionPeers()
  9371. }, isc.A.hide = function isc_EventCanvas_hide() {
  9372. this.Super("hide", arguments);
  9373. if (this.gripper) this.gripper.hide();
  9374. if (this.label) this.label.hide()
  9375. }, isc.A.repositionPeers = function isc_EventCanvas_repositionPeers(_1) {
  9376. if (!this.gripper && !this.label) return;
  9377. var _2 = this.calendarView,
  9378. _3 = _2.body,
  9379. _4 = this.shouldShowLabel(),
  9380. _5 = this.shouldShowGripper();
  9381. var _6 = _3.getLeft(),
  9382. _7 = _3.getScrollLeft(),
  9383. _8 = _3.getVisibleWidth(),
  9384. _9 = this.isDrawn() ? this.getWidth() : _2.$732(this.event),
  9385. _10 = this.getLeft() + Math.floor(_9 / 2);
  9386. if (_10 < _7 || _10 > _7 + _8) {
  9387. if (this.gripper && this.gripper.isVisible()) this.gripper.hide();
  9388. if (this.label && this.label.isVisible()) this.label.hide();
  9389. return
  9390. }
  9391. var _11 = _3.getTop(),
  9392. _12 = _3.getScrollTop(),
  9393. _13 = _3.getViewportHeight(),
  9394. _14 = this.getTop(),
  9395. _15 = this.getHeight(),
  9396. _16 = _14 + _15,
  9397. _17 = false,
  9398. _18 = false;
  9399. if (_14 < _12 || _14 > _12 + _13) _17 = true;
  9400. if (_16 < _12 || _16 > _12 + _13 + 1) _18 = true;
  9401. if (this.gripper) {
  9402. if (_17 || !_5) this.gripper.hide();
  9403. else {
  9404. var _19 = _10 + _6 - _7,
  9405. _20 = _2.header.getHeight() + _14 - _12;
  9406. if (!_1 && this.isDrawn() && !this.gripper.isDrawn()) this.gripper.draw();
  9407. _19 = Math.floor(_19 - Math.floor(this.gripper.getVisibleWidth() / 2));
  9408. _20 = Math.floor(_20 - (this.gripper.getVisibleHeight() / 2));
  9409. this.gripper.moveTo(_19, _20);
  9410. if (!_1 && this.isDrawn() && !this.gripper.isVisible()) {
  9411. this.gripper.show();
  9412. this.gripper.bringToFront()
  9413. }
  9414. }
  9415. }
  9416. if (this.label) {
  9417. if (_18 || !_4) {
  9418. this.label.hide()
  9419. } else {
  9420. var _19 = _10 + _6 - _7,
  9421. _20 = _2.header.getHeight() + _16 - _12,
  9422. _21 = this.getHeaderHTML(),
  9423. _22 = isc.EventCanvas.getHeaderHeight(_21, (this.maxLabelWidth || _9), this.headerHeight, this.getHeaderWrap(), this);
  9424. this.label.setContents(_21);
  9425. if (!_1 && this.isDrawn() && !this.label.isDrawn()) this.label.draw();
  9426. _19 = Math.floor(_19 - Math.floor(this.label.getVisibleWidth() / 2));
  9427. _20 = Math.floor(_20 - (_22 / 2));
  9428. this.label.moveTo(_19, _20);
  9429. if (!_1 && this.isDrawn() && !this.label.isVisible()) {
  9430. this.label.show();
  9431. this.label.bringToFront()
  9432. }
  9433. }
  9434. }
  9435. }, isc.A.setEvent = function isc_EventCanvas_setEvent(_1, _2, _3, _4) {
  9436. var _5 = this.calendar,
  9437. _6 = this.calendarView;
  9438. var _7 = this.$172w(_1, _2, _3, _4);
  9439. this.canDragReposition = _7.canDragMove;
  9440. this.canDragResize = _7.canDragResize;
  9441. this.resizeFrom = [];
  9442. if (_7.canDragResize) {
  9443. if (_7.canDragStartDate) {
  9444. if (!this.vertical) this.resizeFrom.add("L")
  9445. }
  9446. if (_7.canDragEndDate) {
  9447. if (!this.vertical) this.resizeFrom.add("R");
  9448. else this.resizeFrom.add("B")
  9449. }
  9450. }
  9451. if (this.shouldShowGripper()) this.createGripper();
  9452. else if (this.gripper) this.gripper.hide();
  9453. if (this.shouldShowLabel()) this.createLabel();
  9454. else if (this.label) this.label.hide();
  9455. this.setEventStyle(_7.eventStyleName, _3, _4)
  9456. }, isc.A.$172x = function isc_EventCanvas__getCacheValue(_1) {
  9457. return this.$172y && this.$172y[_1]
  9458. }, isc.A.$172w = function isc_EventCanvas__updateValueCache(_1, _2, _3, _4) {
  9459. this.$172y = {};
  9460. this.event = _1;
  9461. if (this.event) {
  9462. var _5 = this.calendar,
  9463. _6 = this.calendarView,
  9464. _7 = this.$172y,
  9465. _8 = _5.canEditEvent(_1),
  9466. _9 = _5.canDragEvent(_1),
  9467. _10 = _5.canResizeEvent(_1),
  9468. _11 = _5.canRemoveEvent(_1);
  9469. _7.eventStartDate = _5.getEventStartDate(_1).getTime();
  9470. _7.eventEndDate = _5.getEventEndDate(_1).getTime();
  9471. _7.eventStyleName = _5.getEventCanvasStyle(_1, _6);
  9472. _7.eventLane = _1[_5.laneNameField];
  9473. var _6 = this.calendarView;
  9474. _7.viewStartDate = _5.getPeriodStartDate(_6).getTime();
  9475. _7.viewEndDate = _5.getPeriodEndDate(_6).getTime();
  9476. _7.canEdit = _8;
  9477. _7.canDrag = _9;
  9478. _7.canDragMove = _9;
  9479. _7.canDragResize = _10;
  9480. _7.canDragStartDate = _7.canDragResize && _7.eventStartDate >= _7.viewStartDate;
  9481. if (_6.verticalEvents) _7.canDragStartDate = false;
  9482. _7.canDragEndDate = _7.canDragResize && _7.eventEndDate && _7.eventEndDate <= _7.viewEndDate;
  9483. _7.showCloseButton = _11
  9484. }
  9485. return this.$172y
  9486. }, isc.A.createRolloverControls = function isc_EventCanvas_createRolloverControls() {
  9487. return this.calendar.$174c(this)
  9488. }, isc.A.updateRolloverControls = function isc_EventCanvas_updateRolloverControls(_1) {
  9489. var _2 = this.calendar,
  9490. c = this.$174h || this.$174f || this.$129e;
  9491. if (!c) {
  9492. if (this.useStaticControls) this.$174h = this.createRolloverControls();
  9493. else if (this.isFocused()) this.$174f = _2.$174e();
  9494. else if (_1) this.$129e = _2.$174d();
  9495. c = this.$174h || this.$174f || this.$129e
  9496. }
  9497. if (!c) return;
  9498. for (var _4 in c) {
  9499. c[_4].eventCanvas = this;
  9500. this[_4] = c[_4]
  9501. }
  9502. if (this.closeButton) this.closeButton.canFocus = false;
  9503. if (this.buttonLayout) {
  9504. this.buttonLayout.canFocus = false;
  9505. this.addChild(this.buttonLayout)
  9506. }
  9507. if (this.vertical) {
  9508. this.startResizer = null;
  9509. this.endResizer = this.endResizerB
  9510. } else {
  9511. this.startResizer = this.startResizerL;
  9512. this.endResizer = this.endResizerR
  9513. }
  9514. if (this.startResizer) {
  9515. this.startResizer.dragTarget = this.dragTarget;
  9516. this.addChild(this.startResizer)
  9517. }
  9518. if (this.endResizer) {
  9519. this.endResizer.dragTarget = this.dragTarget;
  9520. this.addChild(this.endResizer)
  9521. }
  9522. var _5 = this.$172y || {};
  9523. this.buttonLayout.show();
  9524. if (this.closeButton) {
  9525. if (!_5.showCloseButton) this.closeButton.hide();
  9526. else this.closeButton.show()
  9527. }
  9528. if (this.contextButton) {
  9529. if (!this.shouldShowContextButton()) this.contextButton.hide()
  9530. else {
  9531. var _6 = this.calendar.getEventCanvasMenuItems(this, this.calendarView);
  9532. if (_6) this.contextButton.show();
  9533. else this.contextButton.hide()
  9534. }
  9535. }
  9536. if (this.startResizer) {
  9537. if (!_5.canDragStartDate) this.startResizer.hide();
  9538. else this.startResizer.show()
  9539. }
  9540. if (this.endResizer) {
  9541. if (!_5.canDragEndDate) this.endResizer.hide();
  9542. else this.endResizer.show()
  9543. }
  9544. }, isc.A.setDragProperties = function isc_EventCanvas_setDragProperties(_1, _2, _3) {
  9545. this.canDragReposition = _1 == null ? true : _1;
  9546. this.canDragResize = _2 == null ? true : _2;
  9547. this.dragTarget = _3
  9548. }, isc.A.setEventStyle = function isc_EventCanvas_setEventStyle(_1, _2, _3) {
  9549. _2 = _2 || this.headerStyle || (_1 + "Header");
  9550. _3 = _3 || this.bodyStyle || (_1 + "Body");
  9551. this.baseStyle = _1;
  9552. this.styleName = _1;
  9553. this.$129w = _3;
  9554. this.$7m = _2;
  9555. if (this.gripper) {
  9556. this.gripper.setStyleName(this.gripperStyle || _1 + "Gripper")
  9557. }
  9558. if (this.label) this.label.setStyleName(this.labelStyle || _1 + "Label");
  9559. if (this.$172y) delete this.$172y.$184b;
  9560. this.setStyleName(null);
  9561. this.setStyleName(_1)
  9562. }, isc.A.getStartDate = function isc_EventCanvas_getStartDate() {
  9563. return this.$172x("eventStartDate") || this.calendar.getEventStartDate(this.event)
  9564. }, isc.A.getEndDate = function isc_EventCanvas_getEndDate() {
  9565. return this.$172x("eventEndDate") || this.calendar.getEventEndDate(this.event)
  9566. }, isc.A.getDuration = function isc_EventCanvas_getDuration() {
  9567. return this.event[this.calendar.durationField]
  9568. }, isc.A.getEventLength = function isc_EventCanvas_getEventLength(_1) {
  9569. if (this.event.eventLength) return this.event.eventLength;
  9570. return this.calendar.getEventLength(this.event, _1 || "minute")
  9571. }, isc.A.isZeroLengthEvent = function isc_EventCanvas_isZeroLengthEvent() {
  9572. return this.calendar.isZeroLengthEvent(this.event)
  9573. }, isc.A.getHeaderWrap = function isc_EventCanvas_getHeaderWrap() {
  9574. if (this.headerWrap != null) return this.headerWrap;
  9575. return this.calendar.eventHeaderWrap
  9576. }, isc.A.getHeaderHeight = function isc_EventCanvas_getHeaderHeight(_1) {
  9577. var _2 = this.$172x("$963");
  9578. if (!_2) {
  9579. if (_1 || this.getShowBody()) {
  9580. var _3 = this.$151t(),
  9581. _4 = this.isDrawn() || !this.calendarView.isTimelineView() ? this.getWidth() : this.calendarView.$732(this.event),
  9582. _5 = _4 - (this.calendar.getLanePadding() * 2);
  9583. var _6 = isc.EventCanvas.getHeaderHeight(this.getHeaderHTML(), _5, _3, this.getHeaderWrap(), this);
  9584. _2 = _6
  9585. } else {
  9586. _2 = this.getInnerHeight()
  9587. }
  9588. if (this.$172y) this.$172y.$963 = _2
  9589. }
  9590. return _2
  9591. }, isc.A.$151t = function isc_EventCanvas__getDefinedHeaderHeight() {
  9592. return this.headerHeight != null ? this.headerHeight : this.calendar.eventHeaderHeight
  9593. }, isc.A.getHeaderStyle = function isc_EventCanvas_getHeaderStyle() {
  9594. return this.$7m
  9595. }, isc.A.getHeaderHTML = function isc_EventCanvas_getHeaderHTML() {
  9596. if (!this.event) {
  9597. return "No event"
  9598. }
  9599. return this.calendar.getEventHeaderHTML(this.event, this.calendarView)
  9600. }, isc.A.getHeaderCSSText = function isc_EventCanvas_getHeaderCSSText(_1) {
  9601. var _2 = this.event,
  9602. _3 = isc.StringBuffer.create();
  9603. var _1 = _1 || this.getHeaderHeight(),
  9604. _4 = this.getHeaderWrap(),
  9605. _5 = this.padding != null ? this.padding : 0,
  9606. _6 = 0,
  9607. _7 = 0,
  9608. _8 = 0,
  9609. _9 = 0;
  9610. _3.append("vertical-align:", (this.getShowBody() ? "top" : "middle"), "; ");
  9611. if (!this.vertical) _3.append("text-align:", (this.getShowBody() ? "left; " : "center; "));
  9612. if (!_4) _3.append("text-wrap:none; ");
  9613. if (this.getShowBody() == false) {
  9614. _3.append("bottom:0px; top:0px;")
  9615. } else {
  9616. if (this.titleOrientation == "bottom") _3.append("bottom:0px; ");
  9617. else _3.append("top:0px;");
  9618. _3.append("height:", (_1), "px; ")
  9619. }
  9620. if (_2.headerTextColor) _3.append("color:", _2.headerTextColor, ";");
  9621. if (_2.headerBackgroundColor) {
  9622. _3.append("background-color:", _2.headerBackgroundColor, ";")
  9623. }
  9624. if (_2.headerBorderColor) {
  9625. _3.append("border-style:solid;");
  9626. _3.append("border-color:", _2.headerBorderColor, ";")
  9627. }
  9628. return _3.release(false)
  9629. }, isc.A.getBodyStyle = function isc_EventCanvas_getBodyStyle() {
  9630. return this.$129w
  9631. }, isc.A.getBodyHTML = function isc_EventCanvas_getBodyHTML() {
  9632. if (!this.event) {
  9633. return ""
  9634. }
  9635. return this.calendar.getEventBodyHTML(this.event, this.calendarView)
  9636. }, isc.A.getBodyCSSText = function isc_EventCanvas_getBodyCSSText(_1) {
  9637. var _2 = this.event,
  9638. _3 = isc.StringBuffer.create(),
  9639. _4 = this.padding != null ? this.padding : 0,
  9640. _5 = 0,
  9641. _6 = 0,
  9642. _7 = 0,
  9643. _8 = 0;
  9644. if (!this.getShowHeader()) _1 = 0;
  9645. _3.append("bottom:0px; top: ", _1 + 2, "px; ");
  9646. _3.append("vertical-align:top; ");
  9647. if (_2.textColor) _3.append("color:", _2.textColor, ";");
  9648. if (_2.backgroundColor) {
  9649. _3.append("background-color:", _2.backgroundColor, ";")
  9650. }
  9651. return _3.release(false)
  9652. }, isc.A.getInnerHTML = function isc_EventCanvas_getInnerHTML() {
  9653. var _1 = "";
  9654. if (this.event) {
  9655. var _2 = this.getStyleHandle();
  9656. if (_2) {
  9657. var _3 = this.event.backgroundColor;
  9658. if (_3) {
  9659. _2.backgroundColor = _3
  9660. }
  9661. if (this.event.borderColor) {
  9662. _2.borderStyle = "solid";
  9663. _2.borderColor = this.event.borderColor
  9664. }
  9665. }
  9666. var _4 = this.$172x("$184b");
  9667. if (_4) return _4;
  9668. var _5 = "",
  9669. _6 = "",
  9670. _7 = this.getShowHeader(),
  9671. _8 = this.getShowBody(),
  9672. _9 = this.shouldShowLabel();
  9673. var _10 = this.getHeaderHeight();
  9674. if (_7 || _9) {
  9675. var _11 = this.divTemplate.duplicate();
  9676. _11[1] = this.getHeaderStyle();
  9677. _11[3] = this.getHeaderCSSText(_10);
  9678. _11[4] = "' eventPart='headerLabel'>"
  9679. _11[5] = this.getHeaderHTML();
  9680. _5 = _11.join("")
  9681. }
  9682. if (_8) {
  9683. var _12 = this.divTemplate.duplicate();
  9684. _12[1] = this.getBodyStyle();
  9685. _12[3] = this.getBodyCSSText(_10);
  9686. _12[4] = "' eventPart='body'>";
  9687. _12[5] = this.getBodyHTML();
  9688. _6 += _12.join("")
  9689. }
  9690. if (_9) {
  9691. if (this.label) {
  9692. this.label.setContents(_5)
  9693. }
  9694. }
  9695. if (_7 || _8) {
  9696. if (_7 && this.titleOrientation == "top") _1 += _5;
  9697. if (_8) _1 += _6;
  9698. if (_7 && this.titleOrientation == "bottom") _1 += _5
  9699. } else if (!_9) {
  9700. _1 = this.getHeaderHTML()
  9701. }
  9702. }
  9703. if (this.$172y) this.$172y.$184b = _1;
  9704. return _1
  9705. }, isc.A.getHoverHTML = function isc_EventCanvas_getHoverHTML() {
  9706. if (this.calendarView.shouldShowEventHovers()) {
  9707. return this.calendar.$141h(this.event, this, this.calendarView)
  9708. }
  9709. }, isc.A.shouldShowCloseButton = function isc_EventCanvas_shouldShowCloseButton() {
  9710. if (this.showCloseButton != null) return this.showCloseButton != false;
  9711. return this.$172x("showCloseButton")
  9712. }, isc.A.shouldShowContextButton = function isc_EventCanvas_shouldShowContextButton() {
  9713. if (this.showContextButton != null) return this.showContextButton != false;
  9714. return this.$172x("showContextButton")
  9715. }, isc.A.getRolloverControls = function isc_EventCanvas_getRolloverControls() {
  9716. return null
  9717. }, isc.A.renderEvent = function isc_EventCanvas_renderEvent(_1, _2, _3, _4, _5) {
  9718. this.setRect(_2, _1, _3, _4);
  9719. this.checkStyle();
  9720. if (!this.parentElement || !this.parentElement.isDrawn()) return;
  9721. if (this.event.$174a) {
  9722. this.tabIndex = this.event.$174a;
  9723. delete this.event.$174a
  9724. }
  9725. if (!this.isDrawn()) this.draw();
  9726. this.show();
  9727. if (_5) this.sendToBack();
  9728. else this.bringToFront();
  9729. if (this.shouldShowGripper() || this.shouldShowLabel()) {
  9730. this.repositionPeers()
  9731. }
  9732. if (this.useStaticControls && !this.isZoneCanvas && !this.isIndicatorCanvas) {
  9733. this.updateRolloverControls()
  9734. }
  9735. }, isc.A.checkStyle = function isc_EventCanvas_checkStyle() {
  9736. var _1 = this.calendar.getEventCanvasStyle(this.event, this.calendarView);
  9737. if (_1 != this.styleName) this.setEventStyle(_1)
  9738. }, isc.A.click = function isc_EventCanvas_click() {
  9739. if (this.calendar.canSelectEvents) {} else {
  9740. this.calendar.$129v(this)
  9741. }
  9742. }, isc.A.doubleClick = function isc_EventCanvas_doubleClick() {
  9743. if (this.calendar.canSelectEvents) {
  9744. this.calendar.$129v(this)
  9745. }
  9746. }, isc.A.handleShowContextMenu = function isc_EventCanvas_handleShowContextMenu() {
  9747. return this.calendar.$1701(this)
  9748. }, isc.A.mouseUp = function isc_EventCanvas_mouseUp() {
  9749. return isc.EH.STOP_BUBBLING
  9750. }, isc.A.mouseDown = function isc_EventCanvas_mouseDown() {
  9751. if (this.dragTarget) this.dragTarget.eventCanvas = this;
  9752. this.calendar.eventDialog.hide();
  9753. return isc.EH.STOP_BUBBLING
  9754. }, isc.A.focusChanged = function isc_EventCanvas_focusChanged(_1) {
  9755. var _2 = isc.EH.getTarget();
  9756. if (_2 != this && this.contains(_2)) return;
  9757. if (_1 && !this.$174f) {
  9758. this.calendar.$174g(this)
  9759. } else if (this.$174f) {
  9760. this.calendar.$174i(this)
  9761. }
  9762. }, isc.A.keyPress = function isc_EventCanvas_keyPress() {
  9763. var _1 = this.calendar,
  9764. _2 = this.calendarView,
  9765. _3 = this.$172y,
  9766. _4 = isc.EventHandler.getKey();
  9767. if (_4) {
  9768. if (_4 == "Enter") {
  9769. if (_3.canEdit) _1.$129v(this)
  9770. } else if (_4 == "Delete") {
  9771. if (_3.showCloseButton) _1.$174b(this)
  9772. }
  9773. }
  9774. }, isc.A.mouseOver = function isc_EventCanvas_mouseOver() {
  9775. if (this.$174h || this.$174f) return;
  9776. if (this.showRolloverControls == false) return;
  9777. if (this.$129e) {
  9778. var _1 = isc.EH.lastEvent.target;
  9779. if (_1 == this || _1.eventCanvas == this) return
  9780. }
  9781. this.updateRolloverControls(true)
  9782. }, isc.A.mouseOut = function isc_EventCanvas_mouseOut() {
  9783. if (this.$174h || this.$174f) return;
  9784. if (this.showRolloverControls == false || !this.$129e) return;
  9785. var _1 = isc.EH.lastEvent.target;
  9786. if (_1 && (_1.eventCanvas == this || _1 == isc.Hover.hoverCanvas)) return;
  9787. this.calendar.hideEventCanvasControls(this, "$129e")
  9788. }, isc.A.parentResized = function isc_EventCanvas_parentResized() {
  9789. this.Super('parentResized', arguments);
  9790. if (this.shouldShowGripper() || this.shouldShowLabel()) {
  9791. this.repositionPeers()
  9792. }
  9793. }, isc.A.destroy = function isc_EventCanvas_destroy() {
  9794. if (this.$174h) {
  9795. var _1 = ["closeButton", "contextButton"];
  9796. for (var _2 in this.$174h) {
  9797. var _3 = this.$174h[_2];
  9798. _3.hide();
  9799. if (!_1.contains(_2)) this.removeChild(_3);
  9800. _3.destroy();
  9801. delete this[_2];
  9802. _3 = null
  9803. }
  9804. delete this.$174h
  9805. } else {
  9806. if (this.$174f) {
  9807. this.calendar.hideEventCanvasControls(this, "$174f")
  9808. } else if (this.$129e) {
  9809. this.calendar.hideEventCanvasControls(this, "$129e")
  9810. }
  9811. }
  9812. if (this.gripper) {
  9813. this.calendarView.removeChild(this.gripper);
  9814. this.gripper.destroy();
  9815. this.gripper = null
  9816. }
  9817. if (this.label) {
  9818. this.calendarView.removeChild(this.label);
  9819. this.label.destroy();
  9820. this.label = null
  9821. }
  9822. if (this.dragTarget) this.dragTarget = null;
  9823. this.Super("destroy", arguments)
  9824. }, isc.A.getPrintHTML = function isc_EventCanvas_getPrintHTML(_1, _2) {
  9825. if (_2) {
  9826. this.delayCall("asyncGetPrintHTML", [_1, _2]);
  9827. return null
  9828. } else {
  9829. return this.asyncGetPrintHTML(_1, _2)
  9830. }
  9831. }, isc.A.asyncGetPrintHTML = function isc_EventCanvas_asyncGetPrintHTML(_1, _2) {
  9832. var _3 = isc.StringBuffer.create(),
  9833. _4 = this.calendar,
  9834. _5 = this.calendarView,
  9835. _6 = _5.isTimelineView(),
  9836. _7 = _5.body,
  9837. _8 = 0,
  9838. _9 = this.getTop(),
  9839. _10 = _7.getTop(),
  9840. _11 = (_9) + _8 + 1,
  9841. _12 = _7.$26a,
  9842. _13 = this.event,
  9843. _14 = _5.getLeft() + _7.getLeft() + (_5.getEventLeft ? _5.getEventLeft(_13) : _4.getEventLeft(_13, _5)),
  9844. _15 = this.getInnerWidth(),
  9845. _16 = this.getInnerHeight() - 1,
  9846. i = (_1 && _1.i ? _1.i : 1);
  9847. var _18 = _4.getEventStartCol(_13, this, this.calendarView),
  9848. _19 = _4.getEventEndCol(_13, this, this.calendarView);
  9849. var _4 = this.calendar,
  9850. _20 = _4.getTop(),
  9851. _21 = _4.getPageTop(),
  9852. _22 = _5.getTop(),
  9853. _23 = _5.getPageTop(),
  9854. _10 = _5.body.getTop() + _5.header ? _5.header.getHeight() : 0;
  9855. if (_6) {
  9856. _11 = this.getTop() + _10 + 2;
  9857. _14 = this.getLeft() + (_5.frozenBody ? _5.frozenBody.getVisibleWidth() : 0)
  9858. } else {
  9859. _14 = this.getLeft() + (_5.frozenBody ? _5.frozenBody.getVisibleWidth() : 0);
  9860. _11 = _10 + this.getTop() + 1
  9861. }
  9862. var _24 = this.styleName;
  9863. _3.append("<div class='", _24, "' ", "style='vertical-align: ", (_4.showEventDescriptions ? "top" : "middle"), "; ", (_13.backgroundColor ? "background-color: " + _13.backgroundColor + ";" : ""), (_13.textColor ? "color: " + _13.textColor + ";" : ""), "overflow:hidden; ", "position: absolute; ", "left:", _14, "px; top:", _11, "px; width: ", _15, "px; height: ", _16, "px; ", "z-index:", i + 2, ";", "'>");
  9864. _3.append(this.getInnerHTML());
  9865. _3.append("</div>");
  9866. if (this.label) {
  9867. _11 = _11 + _16 - 5;
  9868. _15 = this.label.getVisibleWidth();
  9869. _16 = this.label.getInnerHeight();
  9870. _14 -= Math.floor(_15 / 2);
  9871. _3.append("<div class='", _24 + "Header", "' ", "style='overflow:hidden; ", "position: absolute; ", "padding:2px; ", "z-index:", i + 2, ";", "left:", _14, "px; top:", _11, "px; width: ", _15, "px; height: ", _16, "px; ", "'>");
  9872. _3.append(this.getHeaderHTML());
  9873. _3.append("</div>")
  9874. }
  9875. return _3.release(false)
  9876. });
  9877. isc.B._maxIndex = isc.C + 53;
  9878. isc.defineClass("ZoneCanvas", "EventCanvas");
  9879. isc.A = isc.ZoneCanvas.getPrototype();
  9880. isc.B = isc._allFuncs;
  9881. isc.C = isc.B._maxIndex;
  9882. isc.D = isc._funcClasses;
  9883. isc.D[isc.C] = isc.A.Class;
  9884. isc.A.titleOrientation = null;
  9885. isc.A.showHeader = true;
  9886. isc.A.showBody = true;
  9887. isc.A.canEdit = false;
  9888. isc.A.canDrag = false;
  9889. isc.A.canDragReposition = false;
  9890. isc.A.canDragResize = false;
  9891. isc.A.canRemove = false;
  9892. isc.A.showRolloverControls = false;
  9893. isc.A.maxLabelWidth = null;
  9894. isc.B.push(isc.A.initWidget = function isc_ZoneCanvas_initWidget() {
  9895. this.showCloseButton = false;
  9896. this.canDragReposition = false;
  9897. this.canDragResize = false;
  9898. if (this.titleOrientation == null) this.titleOrientation = this.calendar.zoneTitleOrientation;
  9899. this.$142u = !this.calendarView.shouldShowZoneHovers();
  9900. this.Super("initWidget", arguments)
  9901. }, isc.A.setEvent = function isc_ZoneCanvas_setEvent(_1, _2, _3, _4) {
  9902. this.event = _1;
  9903. this.showCloseButton = false;
  9904. this.canDragReposition = false;
  9905. this.canDragResize = false;
  9906. var _5 = this.calendar;
  9907. _2 = _2 || _5.getZoneCanvasStyle(_1, this.calendarView);
  9908. this.setEventStyle(_2, _3, _4)
  9909. }, isc.A.click = function isc_ZoneCanvas_click() {
  9910. if (this.calendar.zoneClick) this.calendar.zoneClick(this.event, this.calendarView.viewName)
  9911. }, isc.A.getHoverHTML = function isc_ZoneCanvas_getHoverHTML() {
  9912. if (this.calendarView.shouldShowZoneHovers()) {
  9913. var _1 = this.calendar.$141i(this.event, this, this.calendarView);
  9914. return _1
  9915. }
  9916. }, isc.A.checkStyle = function isc_ZoneCanvas_checkStyle() {}, isc.A.updateRolloverControls = function isc_ZoneCanvas_updateRolloverControls() {});
  9917. isc.B._maxIndex = isc.C + 6;
  9918. isc.defineClass("IndicatorCanvas", "EventCanvas");
  9919. isc.A = isc.IndicatorCanvas.getPrototype();
  9920. isc.B = isc._allFuncs;
  9921. isc.C = isc.B._maxIndex;
  9922. isc.D = isc._funcClasses;
  9923. isc.D[isc.C] = isc.A.Class;
  9924. isc.A.showHeader = false;
  9925. isc.A.showBody = false;
  9926. isc.A.headerSnapTo = "B";
  9927. isc.A.showGripper = true;
  9928. isc.A.showLabel = true;
  9929. isc.A.canDrag = true;
  9930. isc.A.canDragReposition = true;
  9931. isc.A.canDragResize = false;
  9932. isc.A.canRemove = false;
  9933. isc.A.showRolloverControls = false;
  9934. isc.B.push(isc.A.initWidget = function isc_IndicatorCanvas_initWidget() {
  9935. this.showCloseButton = false;
  9936. this.canDragResize = false;
  9937. this.Super("initWidget", arguments);
  9938. if (this.event) this.setEvent(this.event)
  9939. }, isc.A.setEvent = function isc_IndicatorCanvas_setEvent(_1, _2, _3, _4) {
  9940. this.event = _1;
  9941. var _5 = this.$172w(_1, _2, _3, _4);
  9942. this.canEdit = _5.canEdit;
  9943. this.canDrag = _5.canDrag
  9944. this.canDragResize = false;
  9945. this.canDragReposition = _5.canDragMove;
  9946. if (this.canDragReposition == false) {
  9947. this.setCursor(isc.Canvas.DEFAULT)
  9948. } else {
  9949. this.setCursor(isc.Canvas.MOVE)
  9950. }
  9951. this.showCloseButton = false;
  9952. var _6 = this.calendar;
  9953. _2 = _2 || _6.getIndicatorCanvasStyle(_1, this.calendarView);
  9954. this.setEventStyle(_2, _3, _4)
  9955. }, isc.A.click = function isc_IndicatorCanvas_click() {
  9956. if (this.calendar.indicatorClick) this.calendar.indicatorClick(this.event, this.calendarView.viewName)
  9957. }, isc.A.getHoverHTML = function isc_IndicatorCanvas_getHoverHTML() {
  9958. return this.calendar.$141j(this.event, this, this.calendarView)
  9959. }, isc.A.checkStyle = function isc_IndicatorCanvas_checkStyle() {}, isc.A.updateRolloverControls = function isc_IndicatorCanvas_updateRolloverControls() {});
  9960. isc.B._maxIndex = isc.C + 6;
  9961. isc.AutoTest.customizeCalendar();
  9962. isc.ClassFactory.defineClass("Timeline", "Calendar");
  9963. isc.A = isc.Timeline.getPrototype();
  9964. isc.A.showTimelineView = true;
  9965. isc.A.showDayView = false;
  9966. isc.A.showWeekView = false;
  9967. isc.A.showMonthView = false;
  9968. isc.A.showControlBar = false;
  9969. isc.A.labelColumnWidth = 75;
  9970. isc.A.sizeEventsToGrid = false;
  9971. isc.A.eventDragGap = 0;
  9972. isc._nonDebugModules = (isc._nonDebugModules != null ? isc._nonDebugModules : []);
  9973. isc._nonDebugModules.push('Calendar');
  9974. isc.checkForDebugAndNonDebugModules();
  9975. isc._moduleEnd = isc._Calendar_end = (isc.timestamp ? isc.timestamp() : new Date().getTime());
  9976. if (isc.Log && isc.Log.logIsInfoEnabled('loadTime')) isc.Log.logInfo('Calendar module init time: ' + (isc._moduleEnd - isc._moduleStart) + 'ms', 'loadTime');
  9977. delete isc.definingFramework;
  9978. if (isc.Page) isc.Page.handleEvent(null, "moduleLoaded", {
  9979. moduleName: 'Calendar',
  9980. loadTime: (isc._moduleEnd - isc._moduleStart)
  9981. });
  9982. } else {
  9983. if (window.isc && isc.Log && isc.Log.logWarn) isc.Log.logWarn("Duplicate load of module 'Calendar'.");
  9984. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement