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.

207 lines
7.6 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. <div id="cls-Ext.calendar.DayView"></div>/**
  16. * @class Ext.calendar.DayView
  17. * @extends Ext.Container
  18. * <p>Unlike other calendar views, is not actually a subclass of {@link Ext.calendar.CalendarView CalendarView}.
  19. * Instead it is a {@link Ext.Container Container} subclass that internally creates and manages the layouts of
  20. * a {@link Ext.calendar.DayHeaderView DayHeaderView} and a {@link Ext.calendar.DayBodyView DayBodyView}. As such
  21. * DayView accepts any config values that are valid for DayHeaderView and DayBodyView and passes those through
  22. * to the contained views. It also supports the interface required of any calendar view and in turn calls methods
  23. * on the contained views as necessary.</p>
  24. * @constructor
  25. * @param {Object} config The config object
  26. */
  27. Ext.calendar.DayView = Ext.extend(Ext.Container, {
  28. <div id="cfg-Ext.calendar.DayView-showTime"></div>/**
  29. * @cfg {Boolean} showTime
  30. * True to display the current time in today's box in the calendar, false to not display it (defautls to true)
  31. */
  32. showTime: true,
  33. <div id="cfg-Ext.calendar.DayView-showTodayText"></div>/**
  34. * @cfg {Boolean} showTodayText
  35. * True to display the {@link #todayText} string in today's box in the calendar, false to not display it (defautls to true)
  36. */
  37. showTodayText: true,
  38. <div id="cfg-Ext.calendar.DayView-todayText"></div>/**
  39. * @cfg {String} todayText
  40. * The text to display in the current day's box in the calendar when {@link #showTodayText} is true (defaults to 'Today')
  41. */
  42. todayText: 'Today',
  43. <div id="cfg-Ext.calendar.DayView-ddCreateEventText"></div>/**
  44. * @cfg {String} ddCreateEventText
  45. * The text to display inside the drag proxy while dragging over the calendar to create a new event (defaults to
  46. * 'Create event for {0}' where {0} is a date range supplied by the view)
  47. */
  48. ddCreateEventText: 'Create event for {0}',
  49. <div id="cfg-Ext.calendar.DayView-ddMoveEventText"></div>/**
  50. * @cfg {String} ddMoveEventText
  51. * The text to display inside the drag proxy while dragging an event to reposition it (defaults to
  52. * 'Move event to {0}' where {0} is the updated event start date/time supplied by the view)
  53. */
  54. ddMoveEventText: 'Move event to {0}',
  55. <div id="cfg-Ext.calendar.DayView-dayCount"></div>/**
  56. * @cfg {Number} dayCount
  57. * The number of days to display in the view (defaults to 1)
  58. */
  59. dayCount: 1,
  60. // private
  61. initComponent : function(){
  62. // rendering more than 7 days per view is not supported
  63. this.dayCount = this.dayCount > 7 ? 7 : this.dayCount;
  64. var cfg = Ext.apply({}, this.initialConfig);
  65. cfg.showTime = this.showTime;
  66. cfg.showTodatText = this.showTodayText;
  67. cfg.todayText = this.todayText;
  68. cfg.dayCount = this.dayCount;
  69. cfg.wekkCount = 1;
  70. var header = Ext.applyIf({
  71. xtype: 'dayheaderview',
  72. id: this.id+'-hd'
  73. }, cfg);
  74. var body = Ext.applyIf({
  75. xtype: 'daybodyview',
  76. id: this.id+'-bd'
  77. }, cfg);
  78. this.items = [header, body];
  79. this.addClass('ext-cal-dayview ext-cal-ct');
  80. Ext.calendar.DayView.superclass.initComponent.call(this);
  81. },
  82. // private
  83. afterRender : function(){
  84. Ext.calendar.DayView.superclass.afterRender.call(this);
  85. this.header = Ext.getCmp(this.id+'-hd');
  86. this.body = Ext.getCmp(this.id+'-bd');
  87. this.body.on('eventsrendered', this.forceSize, this);
  88. },
  89. // private
  90. refresh : function(){
  91. this.header.refresh();
  92. this.body.refresh();
  93. },
  94. // private
  95. forceSize: function(){
  96. // The defer call is mainly for good ol' IE, but it doesn't hurt in
  97. // general to make sure that the window resize is good and done first
  98. // so that we can properly calculate sizes.
  99. (function(){
  100. var ct = this.el.up('.x-panel-body'),
  101. hd = this.el.child('.ext-cal-day-header'),
  102. h = ct.getHeight() - hd.getHeight();
  103. this.el.child('.ext-cal-body-ct').setHeight(h);
  104. }).defer(10, this);
  105. },
  106. // private
  107. onResize : function(){
  108. this.forceSize();
  109. },
  110. // private
  111. getViewBounds : function(){
  112. return this.header.getViewBounds();
  113. },
  114. <div id="method-Ext.calendar.DayView-getStartDate"></div>/**
  115. * Returns the start date of the view, as set by {@link #setStartDate}. Note that this may not
  116. * be the first date displayed in the rendered calendar -- to get the start and end dates displayed
  117. * to the user use {@link #getViewBounds}.
  118. * @return {Date} The start date
  119. */
  120. getStartDate : function(){
  121. return this.header.getStartDate();
  122. },
  123. <div id="method-Ext.calendar.DayView-setStartDate"></div>/**
  124. * Sets the start date used to calculate the view boundaries to display. The displayed view will be the
  125. * earliest and latest dates that match the view requirements and contain the date passed to this function.
  126. * @param {Date} dt The date used to calculate the new view boundaries
  127. */
  128. setStartDate: function(dt){
  129. this.header.setStartDate(dt, true);
  130. this.body.setStartDate(dt, true);
  131. },
  132. // private
  133. renderItems: function(){
  134. this.header.renderItems();
  135. this.body.renderItems();
  136. },
  137. <div id="method-Ext.calendar.DayView-isToday"></div>/**
  138. * Returns true if the view is currently displaying today's date, else false.
  139. * @return {Boolean} True or false
  140. */
  141. isToday : function(){
  142. return this.header.isToday();
  143. },
  144. <div id="method-Ext.calendar.DayView-moveTo"></div>/**
  145. * Updates the view to contain the passed date
  146. * @param {Date} dt The date to display
  147. */
  148. moveTo : function(dt, noRefresh){
  149. this.header.moveTo(dt, noRefresh);
  150. this.body.moveTo(dt, noRefresh);
  151. },
  152. <div id="method-Ext.calendar.DayView-moveNext"></div>/**
  153. * Updates the view to the next consecutive date(s)
  154. */
  155. moveNext : function(noRefresh){
  156. this.header.moveNext(noRefresh);
  157. this.body.moveNext(noRefresh);
  158. },
  159. <div id="method-Ext.calendar.DayView-movePrev"></div>/**
  160. * Updates the view to the previous consecutive date(s)
  161. */
  162. movePrev : function(noRefresh){
  163. this.header.movePrev(noRefresh);
  164. this.body.movePrev(noRefresh);
  165. },
  166. <div id="method-Ext.calendar.DayView-moveDays"></div>/**
  167. * Shifts the view by the passed number of days relative to the currently set date
  168. * @param {Number} value The number of days (positive or negative) by which to shift the view
  169. */
  170. moveDays : function(value, noRefresh){
  171. this.header.moveDays(value, noRefresh);
  172. this.body.moveDays(value, noRefresh);
  173. },
  174. <div id="method-Ext.calendar.DayView-moveToday"></div>/**
  175. * Updates the view to show today
  176. */
  177. moveToday : function(noRefresh){
  178. this.header.moveToday(noRefresh);
  179. this.body.moveToday(noRefresh);
  180. }
  181. });
  182. Ext.reg('dayview', Ext.calendar.DayView);
  183. </pre>
  184. </body>
  185. </html>