mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 22:55:23 +00:00
getting the edit dialog up
This commit is contained in:
parent
8b7826b74e
commit
0613c4802a
@ -457,22 +457,22 @@ 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 );
|
||||
//do this check, otherwise on double click you get into an infinite loop
|
||||
if (event.detail == 1) {
|
||||
var calEvent = eventBox.calEvent;
|
||||
|
||||
gCalendarWindow.EventSelection.replaceSelection(calEvent);
|
||||
|
||||
var newDate = new Date( eventBox.calendarEventDisplay.displayDate );
|
||||
var newDate = new Date(calEvent.startDate.jsDate);
|
||||
|
||||
gCalendarWindow.setSelectedDate( newDate, false );
|
||||
}
|
||||
gCalendarWindow.setSelectedDate(newDate, false);
|
||||
}
|
||||
|
||||
if ( event )
|
||||
{
|
||||
event.stopPropagation();
|
||||
}
|
||||
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);
|
||||
|
||||
|
@ -330,8 +330,11 @@ 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;
|
||||
var Height = eventDuration * hourHeight + 1;
|
||||
@ -359,42 +362,41 @@ WeekView.prototype.createEventBox = function ( calItem )
|
||||
- 2;
|
||||
eventBox.setAttribute("left", boxLeft);
|
||||
|
||||
// set the event box to be of class week-view-event-class and the appropriate calendar-color class
|
||||
//this.setEventboxClass(eventBox, calItem, "week-view");
|
||||
// set the event box to be of class week-view-event-class and the appropriate calendar-color class
|
||||
//this.setEventboxClass(eventBox, calItem, "week-view");
|
||||
|
||||
eventBox.setAttribute("eventbox", "weekview");
|
||||
eventBox.setAttribute("dayindex", index + 1);
|
||||
eventBox.setAttribute("onclick", "weekEventItemClick(this, event)" );
|
||||
eventBox.setAttribute("ondblclick", "weekEventItemDoubleClick(this, event)");
|
||||
eventBox.setAttribute("ondraggesture", "nsDragAndDrop.startDrag(event,calendarViewDNDObserver);");
|
||||
eventBox.setAttribute("ondragover", "nsDragAndDrop.dragOver(event,calendarViewDNDObserver)");
|
||||
eventBox.setAttribute("ondragdrop", "nsDragAndDrop.drop(event,calendarViewDNDObserver)");
|
||||
eventBox.setAttribute("id", "week-view-event-box-" + calItem.id);
|
||||
eventBox.setAttribute("name", "week-view-event-box-" + calItem.id);
|
||||
eventBox.setAttribute("onmouseover", "gCalendarWindow.changeMouseOverInfo( null, calItem )");
|
||||
eventBox.setAttribute("tooltip", "eventTooltip");
|
||||
eventBox.setAttribute("eventbox", "weekview");
|
||||
eventBox.setAttribute("dayindex", index + 1);
|
||||
eventBox.setAttribute("onclick", "weekEventItemClick(this, event)" );
|
||||
eventBox.setAttribute("ondblclick", "weekEventItemDoubleClick(this, event)");
|
||||
eventBox.setAttribute("ondraggesture", "nsDragAndDrop.startDrag(event,calendarViewDNDObserver);");
|
||||
eventBox.setAttribute("ondragover", "nsDragAndDrop.dragOver(event,calendarViewDNDObserver)");
|
||||
eventBox.setAttribute("ondragdrop", "nsDragAndDrop.drop(event,calendarViewDNDObserver)");
|
||||
eventBox.setAttribute("id", "week-view-event-box-" + calItem.id);
|
||||
eventBox.setAttribute("name", "week-view-event-box-" + calItem.id);
|
||||
eventBox.setAttribute("onmouseover", "gCalendarWindow.changeMouseOverInfo( null, calItem )");
|
||||
eventBox.setAttribute("tooltip", "eventTooltip");
|
||||
|
||||
// The event description. This doesn't go multi line, but does crop properly.
|
||||
var eventDescriptionElement = document.createElement( "label" );
|
||||
//eventDescriptionElement.calendarEventDisplay = calendarEventDisplay;
|
||||
eventDescriptionElement.setAttribute("class", "week-view-event-label-class" );
|
||||
eventDescriptionElement.setAttribute("value", eventText );
|
||||
eventDescriptionElement.setAttribute("flex", "1" );
|
||||
// The event description. This doesn't go multi line, but does crop properly.
|
||||
var eventDescriptionElement = document.createElement("label");
|
||||
|
||||
var DescriptionText = document.createTextNode(" ");
|
||||
eventDescriptionElement.appendChild(DescriptionText);
|
||||
//eventDescriptionElement.calendarEventDisplay = calendarEventDisplay;
|
||||
eventDescriptionElement.setAttribute("class", "week-view-event-label-class" );
|
||||
eventDescriptionElement.setAttribute("value", eventText );
|
||||
eventDescriptionElement.setAttribute("flex", "1" );
|
||||
|
||||
eventDescriptionElement.setAttribute("height", Height);
|
||||
eventDescriptionElement.setAttribute("crop", "end");
|
||||
eventDescriptionElement.setAttribute("ondraggesture", "nsDragAndDrop.startDrag(event,calendarViewDNDObserver);");
|
||||
eventDescriptionElement.setAttribute("ondragover", "nsDragAndDrop.dragOver(event,calendarViewDNDObserver)");
|
||||
eventDescriptionElement.setAttribute("ondragdrop", "nsDragAndDrop.drop(event,calendarViewDNDObserver)");
|
||||
|
||||
eventBox.appendChild(eventDescriptionElement);
|
||||
|
||||
// this.kungFooDeathGripOnEventBoxes.push( eventBox );
|
||||
|
||||
return( eventBox );
|
||||
var DescriptionText = document.createTextNode(" ");
|
||||
eventDescriptionElement.appendChild(DescriptionText);
|
||||
|
||||
eventDescriptionElement.setAttribute("height", Height);
|
||||
eventDescriptionElement.setAttribute("crop", "end");
|
||||
eventDescriptionElement.setAttribute("ondraggesture", "nsDragAndDrop.startDrag(event,calendarViewDNDObserver);");
|
||||
eventDescriptionElement.setAttribute("ondragover", "nsDragAndDrop.dragOver(event,calendarViewDNDObserver)");
|
||||
eventDescriptionElement.setAttribute("ondragdrop", "nsDragAndDrop.drop(event,calendarViewDNDObserver)");
|
||||
|
||||
eventBox.appendChild(eventDescriptionElement);
|
||||
|
||||
return eventBox;
|
||||
}
|
||||
|
||||
/** PUBLIC
|
||||
|
Loading…
Reference in New Issue
Block a user