scheduler.form_blocks["recurring"]={ render:function(sns){ return scheduler.__recurring_template; }, set_value:function(node,value,ev){ var ds = {start:ev.start_date, end:ev._end_date}; var str_date=scheduler.date.str_to_date(scheduler.config.repeat_date); var date_str=scheduler.date.date_to_str(scheduler.config.repeat_date); var top = node.getElementsByTagName("FORM")[0]; var els = []; function register_els(inps){ for (var i=0; icday) return sd.setDate(sd.getDate()+list[i]*1-cday-(size?cor:cor2)); } this.transpose_day_week(sd,list,cor+size,null,cor); }; scheduler.transpose_type = function(type){ var f = "transpose_"+type; if (!this.date[f]) { var str = type.split("_"); var day = 60*60*24*1000; var gf = "add_"+type; var step = this.transponse_size[str[0]]*str[1]; if (str[0]=="day" || str[0]=="week"){ var days = null; if (str[4]){ days=str[4].split(","); if (scheduler.config.start_on_monday){ for (var i=0; i < days.length; i++) days[i]=(days[i]*1)||7; days.sort(); } } this.date[f] = function(nd,td){ var delta = Math.floor((td.valueOf()-nd.valueOf())/(day*step)); if (delta>0) nd.setDate(nd.getDate()+delta*step); if (days) scheduler.transpose_day_week(nd,days,1,step); }; this.date[gf] = function(sd,inc){ var nd = new Date(sd.valueOf()); if (days){ for (var count=0; count < inc; count++) scheduler.transpose_day_week(nd,days,0,step); } else nd.setDate(nd.getDate()+inc*step); return nd; }; } else if (str[0]=="month" || str[0]=="year"){ this.date[f] = function(nd,td){ var delta = Math.ceil(((td.getFullYear()*12+td.getMonth()*1)-(nd.getFullYear()*12+nd.getMonth()*1))/(step)); if (delta>=0) nd.setMonth(nd.getMonth()+delta*step); if (str[3]) scheduler.date.day_week(nd,str[2],str[3]); }; this.date[gf] = function(sd,inc){ var nd = new Date(sd.valueOf()); nd.setMonth(nd.getMonth()+inc*step); if (str[3]) scheduler.date.day_week(nd,str[2],str[3]); return nd; }; } } }; scheduler.repeat_date=function(ev,stack,non_render,from,to){ from = from||this._min_date; to = to||this._max_date; var td = new Date(ev.start_date.valueOf()); if (!ev.rec_pattern && ev.rec_type) ev.rec_pattern = ev.rec_type.split("#")[0]; this.transpose_type(ev.rec_pattern); scheduler.date["transpose_"+ev.rec_pattern](td, from); while (td0) copy.end_date = new Date(td.valueOf()+ev.event_length*1000-shift*60*1000); else { copy.end_date = new Date(copy.end_date.valueOf() + shift*60*1000); } } copy._timed=this.is_one_day_event(copy); if (!copy._timed && !this._table_view && !this.config.multi_day) return; stack.push(copy); if(!non_render){ this._events[copy.id] = copy; this._rec_temp.push(copy); } } else if (non_render) stack.push(ch); td = this.date.add(td,1,ev.rec_pattern); } }; scheduler.getRecDates = function(id, max){ var ev = typeof id == "object" ? id : scheduler.getEvent(id); var count = 0; var result = []; max = max || 1000; var td = new Date(ev.start_date.valueOf()); var from = new Date(td.valueOf()); if(!ev.rec_type) { return [ { start_date: ev.start_date, end_date: ev.end_date } ]; } this.transpose_type(ev.rec_pattern); scheduler.date["transpose_"+ev.rec_pattern](td, from); while (tdfrom){ if (ev.rec_pattern){ if (ev.rec_pattern=="none") continue; var sev = []; this.repeat_date(ev,sev,true,from,to); for (var i=0; i < sev.length; i++) if (!sev[i].rec_pattern && sev[i].start_datefrom) result.push(sev[i]); } else if (!ev.event_pid || ev.event_pid==0){ result.push(ev); } } } return result; }; scheduler.config.repeat_date="%m.%d.%Y"; scheduler.config.lightbox.sections=[ {name:"description", height:130, map_to:"text", type:"textarea" , focus:true}, {name:"recurring", height:115, type:"recurring", map_to:"rec_type", button:"recurring"}, {name:"time", height:72, type:"time", map_to:"auto"} ]; //drop secondary attributes scheduler._copy_dummy=function(ev){ this.start_date=new Date(this.start_date); this.end_date=new Date(this.end_date); this.event_length=this.event_pid=this.rec_pattern=this.rec_type=this._timed=null; };