diff --git a/calendar/prototypes/wcap/sun-calendar-event-dialog-attendees.xml b/calendar/prototypes/wcap/sun-calendar-event-dialog-attendees.xml
index 740edb063b33..ea4534cd6820 100644
--- a/calendar/prototypes/wcap/sun-calendar-event-dialog-attendees.xml
+++ b/calendar/prototypes/wcap/sun-calendar-event-dialog-attendees.xml
@@ -96,11 +96,9 @@
0
null
0
- null
- null
null
false
- false
+ false
false
@@ -191,24 +189,15 @@
// assume we're the organizer [in case that the calendar
// does not support the concept of identities].
- this.mIsOrganizer = true;
-
- try {
- this.mUserID = "";
- this.mOwnerID = "";
- this.mOrganizerID = "";
-
- var provider = calendar.QueryInterface(Components.interfaces.calIWcapCalendar);
- this.mOwnerID = provider.ownerId;
- this.mUserID = provider.session.userId;
- this.mOrganizerID = ((organizer == null || organizer.id == null)
- ? this.mOwnerID // sensible default
- : organizer.id);
+ this.mIsInvitation = false;
- // set 'mIsOrganizer' if the current calid originally scheduled this event.
- this.mIsOrganizer = false;
- if(this.mOwnerID == this.mOrganizerID)
- this.mIsOrganizer = true;
+ this.mOrganizerID = "";
+ try {
+ var provider = calendar.QueryInterface(Components.interfaces.calIWcapCalendar);
+ this.mIsInvitation = provider.isInvitation(args.item);
+ this.mOrganizerID = ((organizer == null || organizer.id == null)
+ ? provider.ownerId // sensible default
+ : organizer.id);
}
catch(e) {}
@@ -216,9 +205,23 @@
var template = document.getAnonymousElementByAttribute(this, "anonid", "item");
template.focus();
- if(this.mIsReadOnly || !this.mIsOrganizer)
+ if(this.mIsReadOnly || this.mIsInvitation)
listbox.setAttribute("disabled","true");
+ // TODO: use calIWcapCalendar::owner
+ // TODO: use calIWcapCalendar::owner
+ // TODO: use calIWcapCalendar::owner
+ // TODO: use calIWcapCalendar::owner
+ // TODO: use calIWcapCalendar::owner
+ // TODO: use calIWcapCalendar::owner
+ // TODO: use calIWcapCalendar::owner
+ // TODO: use calIWcapCalendar::owner
+ // TODO: use calIWcapCalendar::owner
+ // TODO: use calIWcapCalendar::owner
+ // TODO: use calIWcapCalendar::owner
+ // TODO: use calIWcapCalendar::owner
+ // TODO: use calIWcapCalendar::owner
+
// TODO: the organizer should show up in the attendee list, but this information
// should be based on the organizer contained in the appropriate field of calIItemBase.
// This is currently not supported, since we're still missing calendar identities.
@@ -238,8 +241,7 @@
}
try {
var provider = calendar.QueryInterface(Components.interfaces.calIWcapCalendar);
- var organizerCalendar = provider.session.getCalendarByCalId(this.mOrganizerID);
- var props = organizerCalendar.getCalendarProperties("X-S1CS-CALPROPS-COMMON-NAME",{});
+ var props = provider.getCalendarProperties("X-S1CS-CALPROPS-COMMON-NAME",{});
if(props.length > 0)
organizer.commonName = props[0];
}
@@ -314,7 +316,7 @@
input.removeAttribute("disabled");
icon.removeAttribute("disabled");
- if(this.mIsReadOnly || !this.mIsOrganizer) {
+ if(this.mIsReadOnly || this.mIsInvitation) {
input.setAttribute("disabled","true");
icon.setAttribute("disabled","true");
}
@@ -412,7 +414,7 @@
input.removeAttribute("disabled");
icon.removeAttribute("disabled");
- if(this.mIsReadOnly || !this.mIsOrganizer) {
+ if(this.mIsReadOnly || this.mIsInvitation) {
input.setAttribute("disabled","true");
icon.setAttribute("disabled","true");
}
@@ -1335,7 +1337,7 @@
return;
}
- if(this.mIsReadOnly || !this.mIsOrganizer)
+ if(this.mIsReadOnly || this.mIsInvitation)
return;
if (event.originalTarget == null ||
@@ -1364,7 +1366,7 @@
8
19
- null
- null
- null
false
- false
+ false
false
true
@@ -2754,40 +2753,17 @@
// assume we're the organizer [in case that the calendar
// does not support the concept of identities].
- this.mIsOrganizer = true;
+ this.mIsInvitation = false;
//var organizerRow = document.getAnonymousElementByAttribute(this, "anonid", "event-organizer-row");
//organizerRow.setAttribute("collapsed","true");
try {
- this.mUserID = "";
- this.mOwnerID = "";
- this.mOrganizerID = "";
-
- var provider = calendar.QueryInterface(Components.interfaces.calIWcapCalendar);
- this.mOwnerID = provider.ownerId;
- this.mUserID = provider.session.userId;
- this.mOrganizerID = ((organizer == null || organizer.id == null)
- ? this.mOwnerID // sensible default
- : organizer.id);
-
- // set 'mIsOrganizer' if the current calid originally scheduled this event.
- this.mIsOrganizer = false;
- if(this.mOwnerID == this.mOrganizerID)
- this.mIsOrganizer = true;
-
- // display the organizer [try to get the common name from the calid]
- //TODO: either remove this row or enable this again -> organizerRow.removeAttribute("collapsed");
- var organizer = document.getAnonymousElementByAttribute(this, "anonid", "event-organizer");
- organizer.value = this.mOrganizerID;
- var organizerCalendar = provider.session.getCalendarByCalId(this.mOrganizerID);
- var props = organizerCalendar.getCalendarProperties("X-S1CS-CALPROPS-COMMON-NAME",{});
- if(props.length > 0)
- organizer.value = props[0];
+ this.mIsInvitation = provider.isInvitation(args.item);
}
catch(e) {}
- if(this.mIsReadOnly || !this.mIsOrganizer) {
+ if(this.mIsReadOnly || this.mIsInvitation) {
document.getAnonymousElementByAttribute(this, "anonid", "next-slot").setAttribute('disabled', 'true');
document.getAnonymousElementByAttribute(this, "anonid", "previous-slot").setAttribute('disabled', 'true');
}
diff --git a/calendar/prototypes/wcap/sun-calendar-event-dialog-freebusy.xml b/calendar/prototypes/wcap/sun-calendar-event-dialog-freebusy.xml
index 6a55e50128cf..5940a7f28a4e 100644
--- a/calendar/prototypes/wcap/sun-calendar-event-dialog-freebusy.xml
+++ b/calendar/prototypes/wcap/sun-calendar-event-dialog-freebusy.xml
@@ -896,10 +896,10 @@
// first of all make sure that the given intervall is
// within the intervall we're currently displaying.
- if(entry.isBusyEntry) {
+ if(true) {
- var rangeStart = entry.dtRangeStart.getInTimezone(kDefaultTimezone);
- var rangeEnd = entry.dtRangeEnd.getInTimezone(kDefaultTimezone);
+ var rangeStart = entry.start.getInTimezone(kDefaultTimezone);
+ var rangeEnd = entry.end.getInTimezone(kDefaultTimezone);
rangeStart.normalize();
rangeEnd.normalize();
@@ -1038,10 +1038,10 @@
// first of all make sure that the given intervall is
// within the intervall we're currently displaying.
- if(entry.isBusyEntry) {
+ if(true) {
- var rangeStart = entry.dtRangeStart.getInTimezone(kDefaultTimezone);
- var rangeEnd = entry.dtRangeEnd.getInTimezone(kDefaultTimezone);
+ var rangeStart = entry.start.getInTimezone(kDefaultTimezone);
+ var rangeEnd = entry.end.getInTimezone(kDefaultTimezone);
rangeStart.normalize();
rangeEnd.normalize();
@@ -1147,8 +1147,8 @@
0
null
null
- 0
null
+ null
null
null
0
@@ -1245,13 +1245,10 @@
return this;
},
- onGetFreeBusyTimes: function(rc,requestId,calId,count,entries) {
+ onRequestResult: function(request,entries) {
- if (rc == Components.results.NS_OK) {
-
- // delegate to the binding
- this.binding.onFreeBusy(requestId,calId,count,entries);
- }
+ // delegate to the binding
+ this.binding.onFreeBusy(request,entries);
}
})
]]>
@@ -1266,12 +1263,14 @@
this.mRange = Number(this.getAttribute("range"));
this.mMaxFreeBusy = 0;
- this.mFreeBusySequence = 0;
this.mFreeBusy = [];
+ this.mPendingRequests = [];
var self = this;
var load = function loadHandler() { self.onLoad(); };
window.addEventListener("load", load, true);
+ var unload = function unloadHandler() { self.onUnload(); };
+ window.addEventListener("unload", unload, true);
this.mConsoleService = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
]]>
@@ -1287,7 +1286,7 @@
+
+
+
+
+
+
-
-
-
+
on row <"+row+"> - sequence <"+sequenceId+">";
- var str = ("\n### freebusy log " + new Date() +
- "### " + (msg ? msg : ""));
- this.mConsoleService.logStringMessage(str);
-
- if(row) {
- var freebusy = this.getFreeBusyElement(row);
- var fieldValue = freebusy.getAttribute("calid");
- if (fieldValue.indexOf(calId) == 0) {
+ if (request.status == Components.results.NS_OK) {
+ var row = this.mFreeBusy[request.id];
+ if(row) {
+ var freebusy = this.getFreeBusyElement(row);
freebusy.onFreeBusy(entries);
}
}
+
+ // reset map if currently no further
+ // requests are pending. this basically shrinks the array
+ // in order to get rid of all previously remembered relationships.
+ if(!queue.length)
+ this.mFreeBusy = [];
]]>
diff --git a/calendar/prototypes/wcap/sun-calendar-event-dialog.js b/calendar/prototypes/wcap/sun-calendar-event-dialog.js
index 611565ce305a..ba3a89acba2d 100644
--- a/calendar/prototypes/wcap/sun-calendar-event-dialog.js
+++ b/calendar/prototypes/wcap/sun-calendar-event-dialog.js
@@ -50,7 +50,6 @@ var gItemDuration = null;
var gStartTimezone = null;
var gEndTimezone = null;
var gIsReadOnly = false;
-var gOwnerID = null;
var gUserID = null;
var gOrganizerID = null;
var gPrivacy = null;
@@ -1551,6 +1550,7 @@ function editAttendees()
args.attendees = window.attendees;
args.organizer = window.organizer;
args.calendar = calendar;
+ args.item = window.calendarItem;
args.onOk = callback;
args.fbWrapper = window.fbWrapper;
@@ -1775,30 +1775,9 @@ function updateCalendar()
var item = window.calendarItem;
var calendar = document.getElementById("item-calendar").selectedItem.calendar;
- // set 'gIsReadOnly' if the calendar is read-only
- gIsReadOnly = false;
- if (calendar && calendar.readOnly) {
- gIsReadOnly = true;
- } else {
-
- try {
- var userID = "";
- var ownerID = "";
- var organizerID = "";
-
- var organizer = window.organizer;
- var provider = calendar.QueryInterface(Components.interfaces.calIWcapCalendar);
- ownerID = provider.ownerId;
- userID = provider.session.userId;
- organizerID = ((organizer == null || organizer.id == null)
- ? ownerID // sensible default
- : organizer.id);
-
- if(ownerID != organizerID)
- gIsReadOnly = true;
- }
- catch(e) {}
- }
+ gIsReadOnly = true;
+ if(calendar)
+ gIsReadOnly = calendar.readOnly;
// update the accept button
updateAccept();