summaryrefslogtreecommitdiffstats
path: root/sources/ext/dhtmlxscheduler_active_links.js
blob: 68786d8754b537d08c5c11b8df40517eefffa31d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
to use it in non-GPL project. Please contact sales@dhtmlx.com for details
*/
scheduler.config.active_link_view = "day";
scheduler.attachEvent("onTemplatesReady", function() {
	var s_d = scheduler.date.str_to_date(scheduler.config.api_date);
	var d_s = scheduler.date.date_to_str(scheduler.config.api_date);

	var month_x = scheduler.templates.month_day;
	scheduler.templates.month_day = function(date) {
		return "<a jump_to='" + d_s(date) + "' href='#'>" + month_x(date) + "</a>";
	};
	var week_x = scheduler.templates.week_scale_date;
	scheduler.templates.week_scale_date = function(date) {
		return "<a jump_to='" + d_s(date) + "' href='#'>" + week_x(date) + "</a>";
	};
	dhtmlxEvent(this._obj, "click", function(e) {
		var start = e.target || event.srcElement;
		var to = start.getAttribute("jump_to");
		if (to) {
			scheduler.setCurrentView(s_d(to), scheduler.config.active_link_view);
			if (e && e.preventDefault)
				e.preventDefault();
			return false;
		}
	})
});