recurring events and shared events together

Hi,
First of all thanx for sharing this amazing schedular…you guyz are rock

i am using this scheduler for my project …using recurring feature too.All is working fine some questions are
1.) i want to implement events sharing feature …for this i refered your example of shared events but i am unable to implement it .i am using events_rec file in which i have my all processing code expect sharing events can you guys plz help me where and how i can implement this functionality…

2.) i want that events colors are based on event’s calendar color;

  1. how to pass current logged in user id in to database when creating events (with some hidden field or another way?)

  2. How to implement readonly events…

Plz help me here is my code:—

function init() {
//alert(document.getElementById(‘StartTime1’).value);
var startime=document.getElementById(‘StartTime1’).value;
var endime=document.getElementById(‘EndTime1’).value;
var startweek=document.getElementById(‘StartWeek1’).value;
var format=document.getElementById(‘timeformat1’).value;
//alert(startime);
scheduler.config.show_loading=true;
scheduler.config.multi_day = true;
scheduler.config.xml_date="%Y-%m-%d %H:%i";
scheduler.config.details_on_dblclick = true;
scheduler.config.details_on_create = true;
if(startime!="")
{
scheduler.config.first_hour=startime;
} else {
scheduler.config.first_hour=0;
}
scheduler.config.last_hour=23;

   if(startweek!="Sunday")
	{
	scheduler.config.start_on_monday=true;
	}
	else {		
	scheduler.config.start_on_monday=false;
	}
	scheduler.config.full_day = true; // enable parameter to get full day event option on the lightbox form
	
        if(format!='')
	{
			scheduler.config.hour_date=format;
	}else {		
	scheduler.config.hour_date="%h:%A";
	}

scheduler.config.agenda_end = scheduler.date.add(new Date(),3,“month”);
//scheduler.load(“common/events.xml”);
scheduler.locale.labels.workweek_tab = “W-Week”

	scheduler.locale.labels.decade_tab = "Next 4 Days"
scheduler.attachEvent("onTemplatesReady",function(){

	//alert("week");

		//work week

		scheduler.date.workweek_start = scheduler.date.week_start;

		scheduler.templates.workweek_date = scheduler.templates.week_date;

		scheduler.templates.workweek_scale_date = scheduler.templates.week_scale_date;

		scheduler.date.add_workweek=function(date,inc){ return scheduler.date.add(date,inc*7,"day"); }

		scheduler.date.get_workweek_end=function(date){ return scheduler.date.add(date,5,"day"); }

	//alert("weekend");//Next 4 days

	scheduler.date.decade_start = function(date)

	{

	//alert("date");

			var ndate = new Date();

			//ndate.setDate(Math.floor(date.getDate()/10)*10+1);

			return this.date_part(ndate);

		}

		scheduler.templates.decade_date = scheduler.templates.week_date;

		scheduler.templates.decade_scale_date = scheduler.templates.week_scale_date;

		scheduler.date.add_decade=function(date,inc){ return scheduler.date.add(date,inc*4,"day"); }

	});

scheduler.attachEvent(“onEventSave”,function(id,data){
if (!data.text) {
alert(“Text must not be empty”);
return false;
}
if (data.text.length<20) {
alert(“Text too small”);
return false;
}
return true;
})

	scheduler.init('scheduler_here',new Date(),"week");

//alert(document.cookie.match(/PHPSESSID=[^;]+/)); //current session ID
scheduler.load(“php/events_rec.php”);

	var dp = new dataProcessor("php/events_rec.php");
			

dp.init(scheduler);

	//coloring for different users
	
	scheduler.templates.event_class=function(start,end,event){
	  return "c"+event.color; 
	}
	//allow edit operations only for own events
	function allow_own(id){
		var ev = this.getEvent(id);
		return ev.userId == 6;
	}
	scheduler.attachEvent("onClick",allow_own);
	scheduler.attachEvent("onDblClick",allow_own);

	
	scheduler.locale.labels.section_snack = "For :"; 
					
		var snacks = [
		];
		var department = [
		];						
		
		       scheduler.locale.labels.section_department = "Select Group";
   scheduler.locale.labels.section_status = "Status";
   scheduler.locale.labels.section_checkme = "Publish";
   scheduler.locale.labels.section_checkme2 = "Lock";
	scheduler.locale.labels.section_users = "Assigned Users";
	scheduler.locale.labels.section_location = "Description";

		scheduler.config.lightbox.sections=[	
			{ name:"description", height:20, map_to:"text", type:"textarea", focus:true },
			{ name:"time", height:72, type:"time", map_to:"auto"},	
			{name:"department", height:21, map_to:"department", type:"select", options: department,script_path: "php/data.php"},
			{ name:"snack", options: snacks, map_to:"calendar_id", type:"combo", filtering: true, script_path: "php/complete.php", cache: false },
		{name:"status", height:21, map_to:"status", type:"select", options:[
			{key:"Not-Started", label:"Not-Started"},
			{key:"In-Progress", label:"In-Progress"},
			{key:"Completed", label:"Completed"}
		]},
				{ name:"users", height:20,type:"textarea",map_to:"assigned_user"},
		{ name:"location", height:43, type:"textarea", map_to:"description" },

						{ name:"checkme", map_to:"is_publish", type:"checkbox", checked_value: 1, unchecked_value: 0 },
			{ name:"checkme2", map_to:"is_lock", type:"checkbox", checked_value: 1, unchecked_value: 0 },
{name:"recurring", height:115, type:"recurring", map_to:"rec_type", button:"recurring"},
//{name:"recurring", height:115, type:"recurring", map_to:"rec_type", button:"recurring"},

];

}

function show_minical(){
if (scheduler.isCalendarVisible())
scheduler.destroyCalendar();
else
scheduler.renderCalendar({
position:“dhx_minical_icon”,
date:scheduler._date,
navigation:true,
handler:function(date,calendar)
{
scheduler.setCurrentView(date);

				scheduler.destroyCalendar()
			}
		});

}
function openNewEvent() {
var id = scheduler.uid();
scheduler.addEvent({
id:id,
text:“new event”,
start_date: new Date(),
end_date:new Date()
});
scheduler.showLightbox(id);
}

hi …
back again …2 days but no reply
i am still waiting for reply

2.) i want that events colors are based on event’s calendar color;
Check
viewtopic.php?f=6&t=22738
Similar solution can be used with any custom property of event. If you have calendar_id - you can use similar logic to assign different css classes to the events from the different calendars.

  1. how to pass current logged in user id in to database when creating events (with some hidden field or another way?)
    Best solution would be to store it in server side session and use beforeProcessing event of connector to add new value during data saving
  1. How to implement readonly events…
    docs.dhtmlx.com/doku.php?id=dhtm … donly_view

hi Stanislav,
First of all …thanx for your reply.

in above example for events colors…css is defined for each event type but what i need is color from database like in my calendar table there are calendar_id, calendar_name, and calendar_color field these table field automatically when new user register and generate a random color for that user which is his profile /calendar color . i want to retrieve that color for events assigned to him.

if someone assign some task to me than event color is my calendar color which is saved in calendar table

and yes i am saving calender_id of user.

hi Stanislav,

i am still waiting for your suggestion

There are two possible strategies with event coloring\

a) generate a set of css classes and assign specific class to the event based on its properties ( owner, calendar, etc )

b) you can have event.color property with color value - in such case each event may have its own color ( here the logic which defines color for events can be moved to server side, as part of data feed generation )

hi stanislav,

please give me the solution of my first issue

which is

1.) i want to implement events sharing feature …for this i refered your example of shared events but i am unable to implement it .i am using events_rec file in which i have my all processing code expect sharing events can you guys plz help me where and how i can implement this functionality…

in short …is it possible to use recurrence and shared functionality both together
if yes then how please tell me

HI stanislav

i am stil waiting for your reply. Please reply me as soon as possible

thankyou

in short …is it possible to use recurrence and shared functionality both together
Yes, it is possible there is no technical limitations

you can use events_rec, just add userid ( or similar field ) in render command - so all events will have info about their owner on client side.

You can add rules to color events of different users and allow|deny edit - same as in the case of non-recurring events.

ok thnx for suggestion i will try this part hope it works

can u tell me one more thing… how can we add combobox with checkboxes, in lightbox?

waithing for reply

hi stanislav,

still wating for ur suggestion

hi stanislav,

m still waiting for ur suggestion

There is a samle of combo in lightbox
docs.dhtmlx.com/doku.php?id=dhtm … uler:combo

Be default it dosn’t provide checkbox functionality, so you will need to modify source code.

Also, there is support for checkbox groups
docs.dhtmlx.com/doku.php?id=dhtm … ultiselect
which may be a better solution for your scenario.

ok stanislav, thanx for ur help