This commit is contained in:
michael.buettner%sun.com 2007-01-25 12:35:43 +00:00
Родитель 9618c54699
Коммит 1a240a4cb2
3 изменённых файлов: 89 добавлений и 116 удалений

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

@ -96,11 +96,9 @@
<field name="mIsOffline">0</field>
<field name="mLDAPSession">null</field>
<field name="mSessionAdded">0</field>
<field name="mOwnerID">null</field>
<field name="mUserID">null</field>
<field name="mOrganizerID">null</field>
<field name="mIsReadOnly">false</field>
<field name="mIsOrganizer">false</field>
<field name="mIsInvitation">false</field>
<field name="mPopupOpen">false</field>
<constructor>
@ -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 @@
<handler event="keydown">
<![CDATA[
if(this.mIsReadOnly || !this.mIsOrganizer)
if(this.mIsReadOnly || this.mIsInvitation)
return;
if(event.originalTarget.localName == "input") {
switch(event.keyCode) {
@ -1393,7 +1395,7 @@
// appropriately and stop the event propagation.
if(this.mPopupOpen)
return;
if(this.mIsReadOnly || !this.mIsOrganizer)
if(this.mIsReadOnly || this.mIsInvitation)
return;
if(event.originalTarget.localName == "input") {
switch(event.keyCode) {
@ -1998,11 +2000,8 @@
<field name="mStartHourDefault">8</field>
<field name="mEndHourDefault">19</field>
<field name="mOwnerID">null</field>
<field name="mUserID">null</field>
<field name="mOrganizerID">null</field>
<field name="mIsReadOnly">false</field>
<field name="mIsOrganizer">false</field>
<field name="mIsInvitation">false</field>
<field name="mIgnoreUpdate">false</field>
<field name="mDisplayTimezone">true</field>
@ -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');
}

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

@ -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 @@
<field name="mMaxFreeBusy">0</field>
<field name="mCalendar">null</field>
<field name="mConsoleService">null</field>
<field name="mFreeBusySequence">0</field>
<field name="mFreeBusy">null</field>
<field name="mPendingRequests">null</field>
<field name="mStartDate">null</field>
<field name="mEndDate">null</field>
<field name="mScrollOffset">0</field>
@ -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 @@
<![CDATA[
this.mStartDate = val.clone();
this.mStartDate.makeImmutable();
for (i=1; i <= this.mMaxFreeBusy; i++) {
for (var i=1; i <= this.mMaxFreeBusy; i++) {
this.getFreeBusyElement(i).startDate = val;
}
return val;
@ -1305,7 +1304,7 @@
<![CDATA[
this.mEndDate = val.clone();
this.mEndDate.makeImmutable();
for (i=1; i <= this.mMaxFreeBusy; i++) {
for (var i=1; i <= this.mMaxFreeBusy; i++) {
this.getFreeBusyElement(i).endDate = val;
}
return val;
@ -1329,6 +1328,20 @@
</body>
</method>
<method name="onUnload">
<body>
<![CDATA[
// cancel pending free/busy requests
for each(var request in this.mPendingRequests) {
request.cancel(null);
}
this.mFreeBusy = [];
this.mPendingRequests = [];
]]>
</body>
</method>
<method name="onInitialize">
<body>
<![CDATA[
@ -1506,10 +1519,9 @@
"### " + (msg ? msg : ""));
this.mConsoleService.logStringMessage(str);
this.mFreeBusy.push(i);
this.mFreeBusySequence = this.mFreeBusy.length-1;
this.mCalendar.session.getFreeBusyTimes(calid,start,end,true,this.mFreeBusyListener,true,this.mFreeBusySequence);
var request = this.mCalendar.session.getFreeBusyTimes(calid,start,end,true,this.mFreeBusyListener);
this.mFreeBusy[request.id] = i;
this.mPendingRequests.push(request);
}
}
catch (ex) {
@ -1523,26 +1535,32 @@
<!-- onFreeBusy(), called with the result set from getFreeBusyTimes() -->
<method name="onFreeBusy">
<parameter name="sequenceId"/>
<parameter name="calId"/>
<parameter name="count"/>
<parameter name="request"/>
<parameter name="entries"/>
<body>
<![CDATA[
var row = this.mFreeBusy[sequenceId];
// find request in list of pending requests and remove from queue
var queue = this.mPendingRequests;
for(var i=0; i<queue.length; i++) {
if(queue[i] == request) {
queue.splice(i,1);
break;
}
}
var msg = "response for <"+calId+"> 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<row-id,request-id> 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 = [];
]]>
</body>
</method>

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

@ -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();