scheduler._props = {};
scheduler.createUnitsView=function(name,property,list,size,step){
if (typeof name == "object"){
list = name.list;
property = name.property;
size = name.size||0;
step = name.step||1;
name = name.name;
}
scheduler.date[name+"_start"]= scheduler.date.day_start;
scheduler.templates[name+"_date"] = function(date){
return scheduler.templates.day_date(date);
}
scheduler.templates[name+"_scale_date"] = function(date){
if (!list.length) return "";
var index = (scheduler._props[name].position||0)+Math.floor((scheduler._correct_shift(date.valueOf(),1)-scheduler._min_date.valueOf())/(60*60*24*1000));
if (list[index].css)
return ""+list[index].label+"";
else
return list[index].label;
}
scheduler.date["add_"+name]=function(date,inc){ return scheduler.date.add(date,inc,"day"); }
scheduler.date["get_"+name+"_end"]=function(date){ return scheduler.date.add(date,size||list.length,"day"); }
scheduler._props[name]={map_to:property, options:list, size:size, step:step, position:0 };
scheduler.attachEvent("onOptionsLoad",function(){
var order = scheduler._props[name].order = {};
for(var i=0; i= pr.size+pr.position )
return false;
}
}
return res;
}
scheduler._reset_scale = function(){
var pr = scheduler._props[this._mode];
var ret = t.apply(this,arguments);
if (pr){
this._max_date=this.date.add(this._min_date,1,"day");
var d = this._els["dhx_cal_data"][0].childNodes;
for (var i=0; i < d.length; i++)
d[i].className = d[i].className.replace("_now",""); //clear now class
if (pr.size && pr.size < pr.options.length){
var h = this._els["dhx_cal_header"][0];
var arrow = document.createElement("DIV");
if (pr.position){
arrow.className = "dhx_cal_prev_button";
arrow.style.cssText="left:1px;top:2px;position:absolute;"
arrow.innerHTML = " "
h.firstChild.appendChild(arrow);
arrow.onclick=function(){
scheduler.scrollUnit(pr.step*-1);
}
}
if (pr.position+pr.sizepr.order[b[pr.map_to]]?1:-1;
});
} else
o.apply(this,arguments);
}
scheduler.attachEvent("onEventAdded",function(id,ev){
if (this._loading) return true;
for (var a in scheduler._props){
var pr = scheduler._props[a];
if (typeof ev[pr.map_to] == "undefined")
ev[pr.map_to] = pr.options[0].key;
}
return true;
})
scheduler.attachEvent("onEventCreated",function(id,n_ev){
var pr = scheduler._props[this._mode];
if (pr){
var ev = this.getEvent(id);
this._mouse_coords(n_ev);
fix_und(pr,ev);
this.event_updated(ev);
}
return true;
})
})();