1 | scheduler._dp_init=function(dp){
|
---|
2 | dp._methods=["setEventTextStyle","","changeEventId","deleteEvent"];
|
---|
3 |
|
---|
4 | this.attachEvent("onEventAdded",function(id){
|
---|
5 | if (!this._loading && this.validId(id))
|
---|
6 | dp.setUpdated(id,true,"inserted");
|
---|
7 | });
|
---|
8 | this.attachEvent("onBeforeEventDelete",function(id){
|
---|
9 | if (!this.validId(id)) return;
|
---|
10 | var z=dp.getState(id);
|
---|
11 |
|
---|
12 | if (z=="inserted" || this._new_event) { dp.setUpdated(id,false); return true; }
|
---|
13 | if (z=="deleted") return false;
|
---|
14 | if (z=="true_deleted") return true;
|
---|
15 |
|
---|
16 | dp.setUpdated(id,true,"deleted");
|
---|
17 | return false;
|
---|
18 | });
|
---|
19 | this.attachEvent("onEventChanged",function(id){
|
---|
20 | if (!this._loading && this.validId(id))
|
---|
21 | dp.setUpdated(id,true,"updated");
|
---|
22 | });
|
---|
23 |
|
---|
24 | dp._getRowData=function(id,pref){
|
---|
25 | var ev=this.obj.getEvent(id);
|
---|
26 | var data = {};
|
---|
27 |
|
---|
28 | for (var a in ev){
|
---|
29 | if (a.indexOf("_")==0) continue;
|
---|
30 | if (ev[a] && ev[a].getUTCFullYear) //not very good, but will work
|
---|
31 | data[a] = this.obj.templates.xml_format(ev[a]);
|
---|
32 | else
|
---|
33 | data[a] = ev[a];
|
---|
34 | }
|
---|
35 |
|
---|
36 | return data;
|
---|
37 | };
|
---|
38 | dp._clearUpdateFlag=function(){};
|
---|
39 |
|
---|
40 | dp.attachEvent("insertCallback", scheduler._update_callback);
|
---|
41 | dp.attachEvent("updateCallback", scheduler._update_callback);
|
---|
42 | dp.attachEvent("deleteCallback", function(upd, id) {
|
---|
43 | this.obj.setUserData(id, this.action_param, "true_deleted");
|
---|
44 | this.obj.deleteEvent(id);
|
---|
45 | });
|
---|
46 |
|
---|
47 | };
|
---|
48 |
|
---|
49 |
|
---|
50 | scheduler.setUserData=function(id,name,value){
|
---|
51 | if (id)
|
---|
52 | this.getEvent(id)[name]=value;
|
---|
53 | else
|
---|
54 | this._userdata[name]=value;
|
---|
55 | };
|
---|
56 | scheduler.getUserData=function(id,name){
|
---|
57 | return id?this.getEvent(id)[name]:this._userdata[name];
|
---|
58 | };
|
---|
59 | scheduler.setEventTextStyle=function(id,style){
|
---|
60 | this.for_rendered(id,function(r){
|
---|
61 | r.style.cssText+=";"+style;
|
---|
62 | });
|
---|
63 | var ev = this.getEvent(id);
|
---|
64 | ev["_text_style"]=style;
|
---|
65 | this.event_updated(ev);
|
---|
66 | };
|
---|
67 | scheduler.validId=function(id){
|
---|
68 | return true;
|
---|
69 | };
|
---|
70 |
|
---|
71 | scheduler._update_callback = function(upd,id){
|
---|
72 | var data = scheduler.xmlNodeToJSON(upd.firstChild);
|
---|
73 | data.text = data.text||data._tagvalue;
|
---|
74 | data.start_date = scheduler.templates.xml_date(data.start_date);
|
---|
75 | data.end_date = scheduler.templates.xml_date(data.end_date);
|
---|
76 |
|
---|
77 | scheduler.addEvent(data);
|
---|
78 | }; |
---|