XML loading and readonly & bugs in readonly mode

Hi,
I’m loading events dynamically from XML and some of events are for user “readonly”. So I defined action…

dp.defineAction("readonly", readonly_event); <action type="readonly" sid="..." tid="..."></action>

and functions…

		// readonly události
		function readonly_event(node){
			var id = node.getAttribute("sid");
			scheduler.getEvent(id).readonly = true;
			return true;
		}
		function block_readonly(id){
			if(id) return !this.getEvent(id).readonly;
		}
		scheduler.attachEvent("onBeforeDrag", block_readonly);
		scheduler.attachEvent("onClick", block_readonly);
		scheduler.attachEvent('onXLE', block_readonly);

the problem is that calendar ignores readonly when is loaded, but when I insert, change or delete event than are readonly events really readonly…

Thanks for help
David

scheduler.attachEvent('onXLE', block_readonly);

onXLE event is called only once and per xml loading, not for each item, so it can be used for such task . Instead of it you can use onEventLoading

scheduler.attachEvent('onEventLoading',function(ev){ ev.readonly = true; //mark all incoming events as readonly return true; });

Ok, for all events it’s working, but I want to mark only events which are defined in XML response / feed by

The action response is generated and processed only after saving|updating|deleting, but you are saying that

Do you need to apply readonly after saving data or during loading?
During loading it can be done by above mentioned event, or just providing
<event readonly=“1”
in XML

Yes, that’s it! Thanks a lot!

But another problem … I think I found a bug … readonly is okay in month view but in others not.

Day view - I can change description by double click. I can’t show details of event.
Week view - Same as day view
Year view - I can’t show details of event.

What am I doing wrong?

Double-click processing for readonly event can be changed by using

scheduler.attachEvent("onDblClick", block_readonly);

Yes, that’s right but than I can’t show details of event.

Version 2.1 has optional readonly-view extension, instead of onDblClick event handling, you can just activate it ( include related js file )

docs.dhtmlx.com/doku.php?id=dhtm … donly_view

Even if I actived readonly mode for every event in calendar (scheduler.config.readonly_form = true;) still I can change a description in week or day view.

One more time - everything is okay in month view (I can’t change readonly event, but I can show details of this event).
In daily and weekly view is a problem (bugs) = I can’t show details of event but I can change description (via doubleclick).
In a yearly view I just can’t show details.

ufff

You can use
scheduler.config.details_on_dblclick = true;
scheduler.config.details_on_create = true;

This will force usage of details form instead of inline editor, and details form will be affected by readonly-view extension.