getting the edit dialog up

This commit is contained in:
pavlov%pavlov.net 2004-12-10 10:58:59 +00:00
parent 8b7826b74e
commit 0613c4802a
2 changed files with 64 additions and 51 deletions

View File

@ -457,20 +457,20 @@ function dayViewHourDoubleClick( event )
* event - the click event, Not used yet
*/
function weekEventItemClick( eventBox, event )
function weekEventItemClick(eventBox, event)
{
//do this check, otherwise on double click you get into an infinite loop
if( event.detail == 1 )
{
gCalendarWindow.EventSelection.replaceSelection( eventBox.calendarEventDisplay.event );
if (event.detail == 1) {
var calEvent = eventBox.calEvent;
var newDate = new Date( eventBox.calendarEventDisplay.displayDate );
gCalendarWindow.EventSelection.replaceSelection(calEvent);
gCalendarWindow.setSelectedDate( newDate, false );
var newDate = new Date(calEvent.startDate.jsDate);
gCalendarWindow.setSelectedDate(newDate, false);
}
if ( event )
{
if (event) {
event.stopPropagation();
}
}
@ -490,7 +490,7 @@ function weekEventItemDoubleClick( eventBox, event )
// we only care about button 0 (left click) events
if (event.button != 0) return;
editEvent( eventBox.calendarEventDisplay.event );
editEvent( eventBox.calEvent );
if ( event )
{
@ -720,13 +720,25 @@ function createCalendar()
var calendar = Components.classes["@mozilla.org/calendar/calendar;1?type=" + caltype].getService(Components.interfaces.calICalendar);
if (calendar.uri || caltype == "memory")
return calendar;
var uri = getCharPref(prefobj, "default-calendar.uri", null);
var ioservice = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
var uri = null;
if (caltype == "caldav") {
var uriString = getCharPref(prefobj, "default-calendar.uri", null);
uri = ioservice.newURI(uriString, null, null);
} else if (caltype == "storage") {
var pathString = getCharPref(prefobj, "default-calendar.path", null);
var dbFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
dbFile.initWithPath(pathString);
uri = ioservice.newFileURI(dbFile);
}
if (!uri) {
throw "Calendar type " + caltype +
" requires that default-calendar.uri pref be set!";
}
ioservice = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
calendar.uri = ioservice.newURI(uri, null, null);
calendar.uri = uri;
return calendar;
}
@ -1023,7 +1035,6 @@ function editEventCommand()
//used to check if there were external changes for shared calendar
function saveItem( calendarEvent, Server, functionToRun, originalEvent )
{
if (functionToRun == 'addEvent')
gCalendar.addItem(calendarEvent, null);

View File

@ -330,7 +330,10 @@ WeekView.prototype.createEventBox = function ( calItem )
var eventBox = document.createElement( "vbox" );
var eventBox = document.createElement("vbox");
// XXX Consider changing this to only store the ID
eventBox.calEvent = calEvent;
var ElementOfRef = document.getElementById("week-tree-day-" + gRefColumnIndex + "-item-" + startHour) ;
var hourHeight = ElementOfRef.boxObject.height;
@ -375,7 +378,8 @@ WeekView.prototype.createEventBox = function ( calItem )
eventBox.setAttribute("tooltip", "eventTooltip");
// The event description. This doesn't go multi line, but does crop properly.
var eventDescriptionElement = document.createElement( "label" );
var eventDescriptionElement = document.createElement("label");
//eventDescriptionElement.calendarEventDisplay = calendarEventDisplay;
eventDescriptionElement.setAttribute("class", "week-view-event-label-class" );
eventDescriptionElement.setAttribute("value", eventText );
@ -392,9 +396,7 @@ WeekView.prototype.createEventBox = function ( calItem )
eventBox.appendChild(eventDescriptionElement);
// this.kungFooDeathGripOnEventBoxes.push( eventBox );
return( eventBox );
return eventBox;
}
/** PUBLIC