dhtmlxScheduler permissions on Unit view and classes on Agen

So I’ve mostly got permissions working ok with all the calendar views. I switched my day view to use the Unit view. It works fine when I attach a function to onClick, onDblClick and onBeforeDrag to restrict an action. However if I drag an event that I do have permission to edit to a column in the Unit view which I don’t have permission to, it moves (and updates) the event.

I tried hooking into the onBeforeDataSending event on the data processor which gets fired, but even when I return false it doesn’t roll back the change and the event stays in the column it isn’t allowed to be in.

Any advice to restrict the column an event can get dragged into?

The other two issues are minor. Is it possible to add a css class to the Agenda and Year Tooltip’s for each calendar event like the Day/Week/Month view?



It is possible to deny event moving in the units view at all:

scheduler.attachEvent(“onBeforeDrag”, function (event_id, mode, native_event_object){
return !(mode==“move” && this._mode==“unit”);

The css class for agenda event is dhx_agenda_area, for tooltip - dhx_tooltip_line

There is no css-class template for mentioned elements, but you can use
to define how the even’t text will look. Code produced by template can have any custom html|styling

I return false it doesn’t roll back the change and the event stays in the column it isn’t allowed to be in
There is no simple approach, you can try the next

a) save exesting unit value in onBeforeDrag event
b) in onEventChanged event check is the current view allowed, and restore previously saved one if it is not
c) call updateEvent(id) to correct visual position of event

Thanks for the Unit tips, what you suggested should work, I’ll try it now.

As for the css on Agenda and Year tooltip, I was hoping to be able to customize those based on the “unit” they belong too.  Ie, blue text in the agenda for calendar 1, red text in the agenda in calendar 2. Ie:

        scheduler.templates.event_class=function(start,end,event) {
            return color_lookup(event.calendar_id);


Could the next version include calls to scheduler.templates.event_class() when it generates the div’s for the agenda and year tool tip so those views are consistent with unit/day/week/month?  Below is the code that will do it:

Agenda extension:
G += “

” + scheduler.templates.agenda_time(H[F].start_date, H[F].end_date, H[F]) + “

Year extension:
K += “


Oh, that is on the minified version of the file, sorry.  It should be clear what is getting added for the non-minified version.