All pastes #219673 Raw Edit

Something

public text v1 · immutable
#219673 ·published 2006-10-24 20:23 UTC
rendered paste body
function CalendarDay(d, key)
{
	this.date = new Date(d);
	this.key = key;
	this.ldate = d;
	this.event_list = [];
	this.addEvent = CalendarDay_AddEvent;
	this.removeEvent = CalendarDay_RemoveEvent;
	this.createEvent = CalendarDay_CreateEvent;
}

function CalendarDay_AddEvent(id, title, desc, start_time, duration)
{
	//id_event, id_title, event_text, start_time, end_time
	this.event_list.push( new CalendarEvent(this.key, id, title, desc, start_time, duration) );
}

function CalendarDay_RemoveEvent(id)
{
	var tmp = [], i, len = this.event_list.length;
	
	for (i = 0; i < len; i++)
		if (this.event_list[i].id != id)
			tmp.push( this.event_list[i] );
	
	this.event_list = tmp;
}

function CalendarDay_CreateEvent(id)
{
	// ajax stuff here to insert event into db and then
	// call the addEvent method to add it to the events array
}