MCPcopy Create free account
hub / github.com/DHTMLX/scheduler / year_view

Function year_view

codebase/sources/dhtmlxscheduler.js:21216–21469  ·  view source on GitHub ↗
(scheduler2)

Source from the content-addressed store, hash-verified

21214 };
21215 }
21216 function year_view(scheduler2) {
21217 scheduler2.templates.year_date = function(date) {
21218 return scheduler2.date.date_to_str(scheduler2.locale.labels.year_tab + " %Y")(date);
21219 };
21220 scheduler2.templates.year_month = scheduler2.date.date_to_str("%F");
21221 scheduler2.templates.year_scale_date = scheduler2.date.date_to_str("%D");
21222 scheduler2.templates.year_tooltip = function(s, e, ev) {
21223 return ev.text;
21224 };
21225 const isYearMode = function() {
21226 return scheduler2._mode == "year";
21227 };
21228 const getCellDate = function(node) {
21229 var day = scheduler2.$domHelpers.closest(node, "[data-cell-date]");
21230 if (!day || !day.hasAttribute("data-cell-date"))
21231 return null;
21232 return scheduler2.templates.parse_date(day.getAttribute("data-cell-date"));
21233 };
21234 scheduler2.dblclick_dhx_year_grid = function(e) {
21235 if (isYearMode()) {
21236 const target = e.target;
21237 if (scheduler2.$domHelpers.closest(target, ".dhx_before") || scheduler2.$domHelpers.closest(target, ".dhx_after")) {
21238 return false;
21239 }
21240 const date = getCellDate(target);
21241 if (date) {
21242 const start = date;
21243 const end = this.date.add(start, 1, "day");
21244 if (!this.config.readonly && this.config.dblclick_create) {
21245 this.addEventNow(start.valueOf(), end.valueOf(), e);
21246 }
21247 }
21248 }
21249 };
21250 scheduler2.attachEvent("onEventIdChange", function() {
21251 if (isYearMode())
21252 this.year_view(true);
21253 });
21254 var old = scheduler2.render_data;
21255 scheduler2.render_data = function(evs) {
21256 if (!isYearMode())
21257 return old.apply(this, arguments);
21258 for (var i = 0; i < evs.length; i++)
21259 this._year_render_event(evs[i]);
21260 };
21261 var clear = scheduler2.clear_view;
21262 scheduler2.clear_view = function() {
21263 if (!isYearMode())
21264 return clear.apply(this, arguments);
21265 var dates = scheduler2._year_marked_cells, div = null;
21266 for (var date in dates) {
21267 if (dates.hasOwnProperty(date)) {
21268 div = dates[date];
21269 div.classList.remove("dhx_year_event", "dhx_cal_datepicker_event");
21270 }
21271 }
21272 scheduler2._year_marked_cells = {};
21273 };

Callers

nothing calls this directly

Calls 15

isYearModeFunction · 0.70
getCellDateFunction · 0.70
date_to_strMethod · 0.65
addMethod · 0.65
addEventNowMethod · 0.65
attachEventMethod · 0.65
showLightboxMethod · 0.65
getEventsMethod · 0.65
event_dateMethod · 0.65
year_tooltipMethod · 0.65
parse_dateMethod · 0.65
eventMethod · 0.65

Tested by

no test coverage detected