зеркало из https://github.com/mozilla/pjs.git
Show list of calendars in the event dialog, and store in the right calendar
bug 286146, r=stuart
This commit is contained in:
Родитель
5aac138348
Коммит
cb107e6220
|
@ -964,85 +964,21 @@ function editEventCommand()
|
|||
|
||||
//originalEvent is the item before edits were committed,
|
||||
//used to check if there were external changes for shared calendar
|
||||
function saveItem( calendarEvent, Server, functionToRun, originalEvent )
|
||||
function saveItem( calendarEvent, calendar, functionToRun, originalEvent )
|
||||
{
|
||||
dump(functionToRun + " " + calendarEvent.title + "\n");
|
||||
|
||||
var calendar = getCalendar();
|
||||
|
||||
if (functionToRun == 'addEvent')
|
||||
calendar.addItem(calendarEvent, null);
|
||||
|
||||
else if (functionToRun == 'modifyEvent')
|
||||
calendar.modifyItem(calendarEvent, null);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
var calendarServer = gCalendarWindow.calendarManager.getCalendarByName( Server );
|
||||
var path = calendarServer.getAttribute("http://home.netscape.com/NC-rdf#path");
|
||||
var shared = (calendarServer.getAttribute("http://home.netscape.com/NC-rdf#shared" ) == "true");
|
||||
var publishAutomatically = (calendarServer.getAttribute( "http://home.netscape.com/NC-rdf#publishAutomatically" ) == "true");
|
||||
if( calendarServer ) {
|
||||
|
||||
if( publishAutomatically ) {
|
||||
var onResponseExtra = function( ) {
|
||||
//add the event
|
||||
eval( "gICalLib."+functionToRun+"( calendarEvent, Server )" );
|
||||
gCalendarWindow.clearSelectedEvent( calendarEvent );
|
||||
//publish the changes back to the server
|
||||
gCalendarWindow.calendarManager.publishCalendar( calendarServer );
|
||||
}
|
||||
//refresh the calendar file.
|
||||
gCalendarWindow.calendarManager.retrieveAndSaveRemoteCalendar( calendarServer, onResponseExtra );
|
||||
|
||||
} else if ( shared ) {
|
||||
|
||||
if ( !gCalendarWindow.calendarManager.startLocalLock(calendarServer)) {
|
||||
alert(gCalendarBundle.getString( "unableToWrite" ) + path + ".lock");
|
||||
return;
|
||||
}
|
||||
|
||||
//Do not override external changes to other events, reload all calendar and merge only modified event...
|
||||
//check if the same event was edited externally before edits were committed since the last reload.
|
||||
if (gCalendarWindow.calendarManager.reloadCalendar(calendarServer, true)) {
|
||||
//calendar edited externally
|
||||
var uneditedEvent = fetchItem(calendarEvent);
|
||||
if (uneditedEvent != null) {
|
||||
//not a new event
|
||||
if (!compareItems( uneditedEvent, originalEvent )) {
|
||||
//event edited externally
|
||||
alert(gCalendarBundle.getString("concurrentEdit"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Merge single edited event and save
|
||||
eval( "gICalLib." + functionToRun + "(calendarEvent, path)" );
|
||||
gCalendarWindow.calendarManager.removeLocalLock(calendarServer);
|
||||
|
||||
//Check if the edited event is actually in the calendar file in case the lock failed
|
||||
gCalendarWindow.calendarManager.reloadCalendar( calendarServer );
|
||||
if ( !compareItems( fetchItem( calendarEvent ), calendarEvent ) ){
|
||||
alert(gCalendarBundle.getString( "unableToWrite" ) + path );
|
||||
}
|
||||
gCalendarWindow.clearSelectedEvent( calendarEvent );
|
||||
|
||||
} else {
|
||||
//Normal local calendar
|
||||
eval("gICalLib."+functionToRun+"(calendarEvent, path)");
|
||||
gCalendarWindow.clearSelectedEvent( calendarEvent );
|
||||
}
|
||||
|
||||
} else {
|
||||
eval( "gICalLib."+functionToRun+"( calendarEvent, Server )" );
|
||||
gCalendarWindow.clearSelectedEvent( calendarEvent );
|
||||
}
|
||||
|
||||
*/
|
||||
else if (functionToRun == 'modifyEvent') {
|
||||
if (!originalEvent.parent || (originalEvent.parent == calendar))
|
||||
calendar.modifyItem(calendarEvent, null);
|
||||
else {
|
||||
originalEvent.parent.removeItem(calendarEvent, null);
|
||||
calendar.addItem(calendarEvent, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -413,28 +413,16 @@ function loadCalendarEventDialog()
|
|||
else
|
||||
document.getElementById("categories-field").selectedIndex = -1;
|
||||
|
||||
|
||||
/* XXX
|
||||
// Server stuff
|
||||
document.getElementById( "server-menulist-menupopup" ).database.AddDataSource( opener.gCalendarWindow.calendarManager.rdf.getDatasource() );
|
||||
document.getElementById( "server-menulist-menupopup" ).builder.rebuild();
|
||||
|
||||
if (args.mode == "new") {
|
||||
if ("server" in args)
|
||||
setElementValue( "server-field", args.server );
|
||||
else
|
||||
document.getElementById( "server-field" ).selectedIndex = 1;
|
||||
} else {
|
||||
if (gEvent.parent)
|
||||
setElementValue( "server-field", gEvent.parent.server );
|
||||
else
|
||||
document.getElementById( "server-field" ).selectedIndex = 1;
|
||||
|
||||
//for now you can't edit which file the event is in.
|
||||
setElementValue( "server-field", "true", "disabled" );
|
||||
setElementValue( "server-field-label", "true", "disabled" );
|
||||
}
|
||||
*/
|
||||
var calendar = event.calendar;
|
||||
var calendars = getCalendarManager().getCalendars({});
|
||||
for (var i = 0; i < calendars.length; i++) {
|
||||
var menuitem = document.getElementById('server-field')
|
||||
.appendItem(calendars[i].name, calendars[i].uri);
|
||||
menuitem.calendar = calendars[i];
|
||||
if (event.parent == calendar)
|
||||
document.getElementById('server-field').selectedIndex = i;
|
||||
}
|
||||
|
||||
// update enabling and disabling
|
||||
updateRepeatItemEnabled();
|
||||
|
@ -664,16 +652,16 @@ function onOKCommand()
|
|||
*/
|
||||
|
||||
|
||||
var Server = getElementValue("server-field");
|
||||
var calendar = document.getElementById("server-field").selectedItem.calendar;
|
||||
|
||||
// :TODO: REALLY only do this if the alarm or start settings change.
|
||||
// if the end time is later than the start time... alert the user using text from the dtd.
|
||||
// call caller's on OK function
|
||||
// :TODO: REALLY only do this if the alarm or start settings change.
|
||||
// if the end time is later than the start time... alert the user using text from the dtd.
|
||||
// call caller's on OK function
|
||||
|
||||
gOnOkFunction(event, Server, originalEvent);
|
||||
gOnOkFunction(event, calendar, originalEvent);
|
||||
|
||||
// tell standard dialog stuff to close the dialog
|
||||
return true;
|
||||
// tell standard dialog stuff to close the dialog
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -177,18 +177,7 @@
|
|||
<!-- Server -->
|
||||
<hbox align="center" flex="1">
|
||||
<label id="server-field-label" value="&newevent.server.label;"/>
|
||||
<menulist id="server-field">
|
||||
<menupopup id="server-menulist-menupopup" datasources="rdf:null"
|
||||
ref="urn:calendarcontainer">
|
||||
<template>
|
||||
<rule>
|
||||
<menuitem uri="rdf:*"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#path"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#name"/>
|
||||
</rule>
|
||||
</template>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<menulist id="server-field"/>
|
||||
</hbox>
|
||||
</hbox>
|
||||
</row>
|
||||
|
|
Загрузка…
Ссылка в новой задаче