MCPcopy Create free account
hub / github.com/DHTMLX/scheduler / extend$c

Function extend$c

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

Source from the content-addressed store, hash-verified

4875 };
4876}
4877function extend$c(scheduler2) {
4878 scheduler2._events = {};
4879 scheduler2.clearAll = function() {
4880 this._events = {};
4881 this._loaded = {};
4882 this._edit_id = null;
4883 this._select_id = null;
4884 this._drag_id = null;
4885 this._drag_mode = null;
4886 this._drag_pos = null;
4887 this._new_event = null;
4888 this.clear_view();
4889 this.callEvent("onClearAll", []);
4890 };
4891 scheduler2.addEvent = function(start_date, end_date, text, id, extra_data) {
4892 if (!arguments.length)
4893 return this.addEventNow();
4894 var ev = start_date;
4895 if (arguments.length != 1) {
4896 ev = extra_data || {};
4897 ev.start_date = start_date;
4898 ev.end_date = end_date;
4899 ev.text = text;
4900 ev.id = id;
4901 }
4902 ev.id = ev.id || scheduler2.uid();
4903 ev.text = ev.text || "";
4904 if (typeof ev.start_date == "string")
4905 ev.start_date = this.templates.api_date(ev.start_date);
4906 if (typeof ev.end_date == "string")
4907 ev.end_date = this.templates.api_date(ev.end_date);
4908 var d = (this.config.event_duration || this.config.time_step) * 6e4;
4909 if (new Date(ev.end_date).valueOf() - new Date(ev.start_date).valueOf() <= d)
4910 ev.end_date.setTime(ev.start_date.valueOf() + d);
4911 ev.start_date.setMilliseconds(0);
4912 ev.end_date.setMilliseconds(0);
4913 ev._timed = this.isOneDayEvent(ev);
4914 var is_new = !this._events[ev.id];
4915 this._events[ev.id] = ev;
4916 this.event_updated(ev);
4917 if (!this._loading)
4918 this.callEvent(is_new ? "onEventAdded" : "onEventChanged", [ev.id, ev]);
4919 return ev.id;
4920 };
4921 scheduler2.deleteEvent = function(id, silent) {
4922 var ev = this._events[id];
4923 if (!silent && (!this.callEvent("onBeforeEventDelete", [id, ev]) || !this.callEvent("onConfirmedBeforeEventDelete", [id, ev])))
4924 return;
4925 if (ev) {
4926 if (scheduler2.getState().select_id == id) {
4927 scheduler2.unselect();
4928 }
4929 delete this._events[id];
4930 this.event_updated(ev);
4931 if (this._drag_id == ev.id) {
4932 this._drag_id = null;
4933 this._drag_mode = null;
4934 this._drag_pos = null;

Callers 1

factoryMethodFunction · 0.70

Calls 15

create_getterFunction · 0.70
create_setterFunction · 0.70
restoreOriginalColorsFunction · 0.70
callEventMethod · 0.65
addEventNowMethod · 0.65
uidMethod · 0.65
api_dateMethod · 0.65
isOneDayEventMethod · 0.65
getStateMethod · 0.65
unselectMethod · 0.65
getActionDataMethod · 0.65
setCurrentViewMethod · 0.65

Tested by

no test coverage detected