Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
4.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>The source code</title>
  5. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  6. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  7. </head>
  8. <body onload="prettyPrint();">
  9. <pre class="prettyprint lang-js">/*!
  10. * Ext JS Library 3.3.1
  11. * Copyright(c) 2006-2010 Sencha Inc.
  12. * licensing@sencha.com
  13. * http://www.sencha.com/license
  14. */
  15. /*
  16. * This is the view used internally by the panel that displays overflow events in the
  17. * month view. Anytime a day cell cannot display all of its events, it automatically displays
  18. * a link at the bottom to view all events for that day. When clicked, a panel pops up that
  19. * uses this view to display the events for that day.
  20. */
  21. Ext.calendar.MonthDayDetailView = Ext.extend(Ext.BoxComponent, {
  22. initComponent: function() {
  23. Ext.calendar.CalendarView.superclass.initComponent.call(this);
  24. this.addEvents({
  25. eventsrendered: true
  26. });
  27. if (!this.el) {
  28. this.el = document.createElement('div');
  29. }
  30. },
  31. afterRender: function() {
  32. this.tpl = this.getTemplate();
  33. Ext.calendar.MonthDayDetailView.superclass.afterRender.call(this);
  34. this.el.on({
  35. 'click': this.view.onClick,
  36. 'mouseover': this.view.onMouseOver,
  37. 'mouseout': this.view.onMouseOut,
  38. scope: this.view
  39. });
  40. },
  41. getTemplate: function() {
  42. if (!this.tpl) {
  43. this.tpl = new Ext.XTemplate(
  44. '<div class="ext-cal-mdv x-unselectable">',
  45. '<table class="ext-cal-mvd-tbl" cellpadding="0" cellspacing="0">',
  46. '<tbody>',
  47. '<tpl for=".">',
  48. '<tr><td class="ext-cal-ev">{markup}</td></tr>',
  49. '</tpl>',
  50. '</tbody>',
  51. '</table>',
  52. '</div>'
  53. );
  54. }
  55. this.tpl.compile();
  56. return this.tpl;
  57. },
  58. update: function(dt) {
  59. this.date = dt;
  60. this.refresh();
  61. },
  62. refresh: function() {
  63. if (!this.rendered) {
  64. return;
  65. }
  66. var eventTpl = this.view.getEventTemplate(),
  67. templateData = [];
  68. evts = this.store.queryBy(function(rec) {
  69. var thisDt = this.date.clearTime(true).getTime(),
  70. recStart = rec.data[Ext.calendar.EventMappings.StartDate.name].clearTime(true).getTime(),
  71. startsOnDate = (thisDt == recStart),
  72. spansDate = false;
  73. if (!startsOnDate) {
  74. var recEnd = rec.data[Ext.calendar.EventMappings.EndDate.name].clearTime(true).getTime();
  75. spansDate = recStart < thisDt && recEnd >= thisDt;
  76. }
  77. return startsOnDate || spansDate;
  78. },
  79. this);
  80. evts.each(function(evt) {
  81. var item = evt.data,
  82. M = Ext.calendar.EventMappings;
  83. item._renderAsAllDay = item[M.IsAllDay.name] || Ext.calendar.Date.diffDays(item[M.StartDate.name], item[M.EndDate.name]) > 0;
  84. item.spanLeft = Ext.calendar.Date.diffDays(item[M.StartDate.name], this.date) > 0;
  85. item.spanRight = Ext.calendar.Date.diffDays(this.date, item[M.EndDate.name]) > 0;
  86. item.spanCls = (item.spanLeft ? (item.spanRight ? 'ext-cal-ev-spanboth':
  87. 'ext-cal-ev-spanleft') : (item.spanRight ? 'ext-cal-ev-spanright': ''));
  88. templateData.push({
  89. markup: eventTpl.apply(this.getTemplateEventData(item))
  90. });
  91. },
  92. this);
  93. this.tpl.overwrite(this.el, templateData);
  94. this.fireEvent('eventsrendered', this, this.date, evts.getCount());
  95. },
  96. getTemplateEventData: function(evt) {
  97. var data = this.view.getTemplateEventData(evt);
  98. data._elId = 'dtl-' + data._elId;
  99. return data;
  100. }
  101. });
  102. Ext.reg('monthdaydetailview', Ext.calendar.MonthDayDetailView);
  103. </pre>
  104. </body>
  105. </html>