Remember the location URI that is returned by the server in REPORT and use it when modifying an event, rather than trying to construct a new URI from the event's UUID. Not part of the build.

This commit is contained in:
dmose%mozilla.org 2005-01-05 21:45:05 +00:00
Родитель b34890198e
Коммит 9770669bc3
1 изменённых файлов: 20 добавлений и 9 удалений

Просмотреть файл

@ -150,9 +150,9 @@ calDavCalendar.prototype = {
}
// XXX how are we REALLY supposed to figure this out?
var eventUri = this.mUri.clone();
eventUri.spec = eventUri.spec + "calendar/" + aItem.id + ".ics";
var eventResource = new WebDavResource(eventUri);
var itemUri = this.mUri.clone();
itemUri.spec = itemUri.spec + "calendar/" + aItem.id + ".ics";
var eventResource = new WebDavResource(itemUri);
var listener = new WebDavListener();
var savedthis = this;
@ -165,6 +165,8 @@ calDavCalendar.prototype = {
dump("Item added successfully.\n");
var retVal = Components.results.NS_OK;
// XXX deal with Location header
// notify observers
// XXX should be called after listener?
savedthis.observeAddItem(newItem);
@ -186,12 +188,12 @@ calDavCalendar.prototype = {
}
dump("aItem.icalString = " + aItem.icalString + "\n");
var newItem = aItem.clone();
newItem.parent = this;
newItem.generation = 1;
newItem.makeImmutable();
// XXX deal with Location header
newItem.setProperty("locationURI", itemUri.spec);
dump("icalString = " + newItem.icalString + "\n");
// XXX use if not exists
@ -219,11 +221,15 @@ calDavCalendar.prototype = {
return;
}
// XXX use if-exists stuff here
// XXX how are we REALLY supposed to figure this out?
var eventUri = this.mUri.clone();
eventUri.spec = eventUri.spec + "calendar/" + aItem.id + ".ics";
try {
eventUri.spec = aItem.getProperty("locationURI");
dump("using locationURI: " + eventUri.spec + "\n");
} catch (ex) {
// XXX how are we REALLY supposed to figure this out?
eventUri.spec = eventUri.spec + "calendar/" + aItem.id + ".ics";
}
var eventResource = new WebDavResource(eventUri);
var listener = new WebDavListener();
@ -265,6 +271,7 @@ calDavCalendar.prototype = {
return;
}
// XXX use if-exists stuff here
// XXX use etag as generation
// do WebDAV put
var webSvc = Components.classes['@mozilla.org/webdav/service;1']
@ -416,6 +423,7 @@ calDavCalendar.prototype = {
var C = new Namespace("urn:ietf:params:xml:ns:caldav");
// create a local event item
// XXX not just events
var item = calEventClass.createInstance(calIEvent);
// cause returned data to be parsed into the event item
@ -423,6 +431,9 @@ calDavCalendar.prototype = {
item.icalString =
responseElement..C::["calendar-query-result"];
// save the location name in case we need to modify
item.setProperty("locationURI", aResource.spec);
// figure out what type of item to return
var iid;
if(aOccurrences) {