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

Function year_view

codebase/sources/dhtmlxscheduler.es.js:21212–21465  ·  view source on GitHub ↗
(scheduler2)

Source from the content-addressed store, hash-verified

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

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