зеркало из https://github.com/mozilla/pjs.git
switching items from one calendar to another now correctly propagated to all interested parties including necessary status update
This commit is contained in:
Родитель
ab1eec7d03
Коммит
4de28769ed
|
@ -1476,41 +1476,7 @@
|
||||||
var item = args.calendarEvent;
|
var item = args.calendarEvent;
|
||||||
var calendar = item.calendar;
|
var calendar = item.calendar;
|
||||||
|
|
||||||
// set 'mIsReadOnly' if the calendar is read-only
|
this.onChangeCalendar(calendar);
|
||||||
if (calendar && calendar.readOnly)
|
|
||||||
this.mIsReadOnly = true;
|
|
||||||
|
|
||||||
// assume we're the organizer [in case that the calendar
|
|
||||||
// does not support the concept of identities].
|
|
||||||
this.mIsOrganizer = true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
this.mUserID = "";
|
|
||||||
this.mCalID = "";
|
|
||||||
this.mOrganizerID = "";
|
|
||||||
|
|
||||||
var provider = item.calendar.QueryInterface(Components.interfaces.calIWcapCalendar);
|
|
||||||
this.mCalID = provider.calId;
|
|
||||||
this.mUserID = provider.session.userId;
|
|
||||||
this.mOrganizerID = ((item.organizer == null || item.organizer.id == null)
|
|
||||||
? this.mCalID // sensible default
|
|
||||||
: item.organizer.id);
|
|
||||||
|
|
||||||
// set 'mIsOrganizer' if the current calid originally scheduled this event.
|
|
||||||
this.mIsOrganizer = false;
|
|
||||||
if(this.mCalID == this.mOrganizerID)
|
|
||||||
this.mIsOrganizer = true;
|
|
||||||
|
|
||||||
// display the organizer [try to get the common name from the calid]
|
|
||||||
var organizerRow = document.getAnonymousElementByAttribute(this, "anonid", "event-organizer-row");
|
|
||||||
organizerRow.removeAttribute("collapsed");
|
|
||||||
var organizer = document.getAnonymousElementByAttribute(this, "anonid", "event-organizer");
|
|
||||||
organizer.value = this.mOrganizerID;
|
|
||||||
var props = provider.getCalendarProperties("X-S1CS-CALPROPS-COMMON-NAME",{});
|
|
||||||
if(props.length > 0)
|
|
||||||
organizer.value = props[0];
|
|
||||||
}
|
|
||||||
catch(e) {}
|
|
||||||
|
|
||||||
// we need to enfore several layout constraints which can't be modelled
|
// we need to enfore several layout constraints which can't be modelled
|
||||||
// with plain xul and css, at least as far as i know.
|
// with plain xul and css, at least as far as i know.
|
||||||
|
@ -1535,11 +1501,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.mIsReadOnly || !this.mIsOrganizer) {
|
|
||||||
document.getAnonymousElementByAttribute(this, "anonid", "next-slot").setAttribute('disabled', 'true');
|
|
||||||
document.getAnonymousElementByAttribute(this, "anonid", "previous-slot").setAttribute('disabled', 'true');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setTimeRange(item.startDate,item.endDate);
|
this.setTimeRange(item.startDate,item.endDate);
|
||||||
]]>
|
]]>
|
||||||
</body>
|
</body>
|
||||||
|
@ -1558,6 +1519,62 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<method name="onChangeCalendar">
|
||||||
|
<parameter name="calendar"/>
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
var args = window.arguments[0];
|
||||||
|
var item = args.calendarEvent;
|
||||||
|
|
||||||
|
// set 'mIsReadOnly' if the calendar is read-only
|
||||||
|
if (calendar && calendar.readOnly)
|
||||||
|
this.mIsReadOnly = true;
|
||||||
|
|
||||||
|
// assume we're the organizer [in case that the calendar
|
||||||
|
// does not support the concept of identities].
|
||||||
|
this.mIsOrganizer = true;
|
||||||
|
|
||||||
|
var organizerRow = document.getAnonymousElementByAttribute(this, "anonid", "event-organizer-row");
|
||||||
|
organizerRow.setAttribute("collapsed","true");
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.mUserID = "";
|
||||||
|
this.mCalID = "";
|
||||||
|
this.mOrganizerID = "";
|
||||||
|
|
||||||
|
var provider = calendar.QueryInterface(Components.interfaces.calIWcapCalendar);
|
||||||
|
this.mCalID = provider.calId;
|
||||||
|
this.mUserID = provider.session.userId;
|
||||||
|
this.mOrganizerID = ((item.organizer == null || item.organizer.id == null)
|
||||||
|
? this.mCalID // sensible default
|
||||||
|
: item.organizer.id);
|
||||||
|
|
||||||
|
// set 'mIsOrganizer' if the current calid originally scheduled this event.
|
||||||
|
this.mIsOrganizer = false;
|
||||||
|
if(this.mCalID == this.mOrganizerID)
|
||||||
|
this.mIsOrganizer = true;
|
||||||
|
|
||||||
|
// display the organizer [try to get the common name from the calid]
|
||||||
|
organizerRow.removeAttribute("collapsed");
|
||||||
|
var organizer = document.getAnonymousElementByAttribute(this, "anonid", "event-organizer");
|
||||||
|
organizer.value = this.mOrganizerID;
|
||||||
|
var props = provider.getCalendarProperties("X-S1CS-CALPROPS-COMMON-NAME",{});
|
||||||
|
if(props.length > 0)
|
||||||
|
organizer.value = props[0];
|
||||||
|
}
|
||||||
|
catch(e) {}
|
||||||
|
|
||||||
|
if(this.mIsReadOnly || !this.mIsOrganizer) {
|
||||||
|
document.getAnonymousElementByAttribute(this, "anonid", "next-slot").setAttribute('disabled', 'true');
|
||||||
|
document.getAnonymousElementByAttribute(this, "anonid", "previous-slot").setAttribute('disabled', 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
var freebusy = document.getAnonymousElementByAttribute(this, "anonid", "freebusy-grid");
|
||||||
|
freebusy.onChangeCalendar(calendar);
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
<method name="onNextSlot">
|
<method name="onNextSlot">
|
||||||
<body>
|
<body>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
|
|
@ -1027,6 +1027,29 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<method name="onChangeCalendar">
|
||||||
|
<parameter name="calendar"/>
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
// query for the wcap interface, the appropriate functionality of this interface
|
||||||
|
// should be migrated to some other generic one instead of relying on the wcap provider.
|
||||||
|
this.mCalendar = null;
|
||||||
|
try {
|
||||||
|
this.mCalendar = calendar.QueryInterface(Components.interfaces.calIWcapCalendar);
|
||||||
|
}
|
||||||
|
catch (ex) {}
|
||||||
|
|
||||||
|
if (this.mMaxFreeBusy != 0) {
|
||||||
|
for (var i=1; i<=this.mMaxFreeBusy; i++) {
|
||||||
|
var freebusy = this.getFreeBusyElement(i);
|
||||||
|
freebusy.setAttribute("dirty","true");
|
||||||
|
}
|
||||||
|
this.updateFreeBusy();
|
||||||
|
}
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
<!-- appends a new empty row -->
|
<!-- appends a new empty row -->
|
||||||
<method name="appendNewRow">
|
<method name="appendNewRow">
|
||||||
<parameter name="aParentNode"/>
|
<parameter name="aParentNode"/>
|
||||||
|
@ -1137,6 +1160,9 @@
|
||||||
var end = start.clone();
|
var end = start.clone();
|
||||||
end.day += this.mRange;
|
end.day += this.mRange;
|
||||||
|
|
||||||
|
// update with 'no data available' until response will be received
|
||||||
|
freebusy.onFreeBusy(null);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(this.mCalendar) {
|
if(this.mCalendar) {
|
||||||
|
|
||||||
|
@ -1145,9 +1171,6 @@
|
||||||
"### " + (msg ? msg : ""));
|
"### " + (msg ? msg : ""));
|
||||||
this.mConsoleService.logStringMessage(str);
|
this.mConsoleService.logStringMessage(str);
|
||||||
|
|
||||||
// update with 'no data available' until response will be received
|
|
||||||
freebusy.onFreeBusy(null);
|
|
||||||
|
|
||||||
this.mFreeBusy.push(i);
|
this.mFreeBusy.push(i);
|
||||||
this.mFreeBusySequence = this.mFreeBusy.length-1;
|
this.mFreeBusySequence = this.mFreeBusy.length-1;
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
<!-- Calendar -->
|
<!-- Calendar -->
|
||||||
<xul:row align="center">
|
<xul:row align="center">
|
||||||
<xul:label value="&newevent.server.label;" disable-on-readonly="true"/>
|
<xul:label value="&newevent.server.label;" disable-on-readonly="true"/>
|
||||||
<xul:menulist id="item-calendar" flex="1" disable-on-readonly="true"/>
|
<xul:menulist id="item-calendar" oncommand="onChangeCalendar();" flex="1" disable-on-readonly="true"/>
|
||||||
</xul:row>
|
</xul:row>
|
||||||
|
|
||||||
<!-- Category -->
|
<!-- Category -->
|
||||||
|
@ -326,8 +326,13 @@
|
||||||
var calendars = getCalendarManager().getCalendars({});
|
var calendars = getCalendarManager().getCalendars({});
|
||||||
for (i in calendars) {
|
for (i in calendars) {
|
||||||
var calendar = calendars[i];
|
var calendar = calendars[i];
|
||||||
|
if (calendar == item.calendar || calendar == window.arguments[0].calendar) {
|
||||||
var menuitem = calendarList.appendItem(calendar.name, i);
|
var menuitem = calendarList.appendItem(calendar.name, i);
|
||||||
menuitem.calendar = calendar;
|
menuitem.calendar = calendar;
|
||||||
|
} else if (calendar && !calendar.readOnly) {
|
||||||
|
var menuitem = calendarList.appendItem(calendar.name, i);
|
||||||
|
menuitem.calendar = calendar;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// item default calendar
|
// item default calendar
|
||||||
|
@ -504,46 +509,7 @@
|
||||||
// update datetime pickers
|
// update datetime pickers
|
||||||
this.updateAllDay();
|
this.updateAllDay();
|
||||||
|
|
||||||
// set 'mIsReadOnly' if the calendar is read-only
|
this.onChangeCalendar();
|
||||||
if (calendar && calendar.readOnly)
|
|
||||||
this.mIsReadOnly = true;
|
|
||||||
|
|
||||||
// assume we're the organizer [in case that the calendar
|
|
||||||
// does not support the concept of identities].
|
|
||||||
this.mIsOrganizer = true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
this.mUserID = "";
|
|
||||||
this.mCalID = "";
|
|
||||||
this.mOrganizerID = "";
|
|
||||||
|
|
||||||
var provider = item.calendar.QueryInterface(Components.interfaces.calIWcapCalendar);
|
|
||||||
this.mCalID = provider.calId;
|
|
||||||
this.mUserID = provider.session.userId;
|
|
||||||
this.mOrganizerID = ((item.organizer == null || item.organizer.id == null)
|
|
||||||
? this.mCalID // sensible default
|
|
||||||
: item.organizer.id);
|
|
||||||
|
|
||||||
// set 'mIsOrganizer' if the current calid originally scheduled this event.
|
|
||||||
this.mIsOrganizer = false;
|
|
||||||
if(this.mCalID == this.mOrganizerID)
|
|
||||||
this.mIsOrganizer = true;
|
|
||||||
}
|
|
||||||
catch(e) {}
|
|
||||||
|
|
||||||
if (!this.mIsReadOnly)
|
|
||||||
this.mIsReadOnly = !this.mIsOrganizer;
|
|
||||||
|
|
||||||
// update the accept button
|
|
||||||
this.updateAccept();
|
|
||||||
|
|
||||||
if(this.mIsReadOnly) {
|
|
||||||
var list = document.getAnonymousNodes(this)[0];
|
|
||||||
var disableElements = list.getElementsByAttribute("disable-on-readonly", "true");
|
|
||||||
for (i=0;i<disableElements.length;i++) {
|
|
||||||
disableElements[i].setAttribute('disabled', 'true');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementById("item-title").focus();
|
document.getElementById("item-title").focus();
|
||||||
]]>
|
]]>
|
||||||
|
@ -668,6 +634,66 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<method name="onChangeCalendar">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
var calendar = document.getElementById("item-calendar").selectedItem.calendar;
|
||||||
|
|
||||||
|
// set 'mIsReadOnly' if the calendar is read-only
|
||||||
|
this.mIsReadOnly = false;
|
||||||
|
if (calendar && calendar.readOnly)
|
||||||
|
this.mIsReadOnly = true;
|
||||||
|
|
||||||
|
// assume we're the organizer [in case that the calendar
|
||||||
|
// does not support the concept of identities].
|
||||||
|
this.mIsOrganizer = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.mUserID = "";
|
||||||
|
this.mCalID = "";
|
||||||
|
this.mOrganizerID = "";
|
||||||
|
|
||||||
|
var provider = calendar.QueryInterface(Components.interfaces.calIWcapCalendar);
|
||||||
|
this.mCalID = provider.calId;
|
||||||
|
this.mUserID = provider.session.userId;
|
||||||
|
this.mOrganizerID = ((item.organizer == null || item.organizer.id == null)
|
||||||
|
? this.mCalID // sensible default
|
||||||
|
: item.organizer.id);
|
||||||
|
|
||||||
|
// set 'mIsOrganizer' if the current calid originally scheduled this event.
|
||||||
|
this.mIsOrganizer = false;
|
||||||
|
if(this.mCalID == this.mOrganizerID)
|
||||||
|
this.mIsOrganizer = true;
|
||||||
|
}
|
||||||
|
catch(e) {}
|
||||||
|
|
||||||
|
if (!this.mIsReadOnly)
|
||||||
|
this.mIsReadOnly = !this.mIsOrganizer;
|
||||||
|
|
||||||
|
// update the accept button
|
||||||
|
this.updateAccept();
|
||||||
|
|
||||||
|
var list = document.getAnonymousNodes(this)[0];
|
||||||
|
if(this.mIsReadOnly) {
|
||||||
|
var disableElements = list.getElementsByAttribute("disable-on-readonly", "true");
|
||||||
|
for (i=0;i<disableElements.length;i++) {
|
||||||
|
disableElements[i].setAttribute('disabled', 'true');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var enableElements = list.getElementsByAttribute("disable-on-readonly", "true");
|
||||||
|
for (i=0;i<enableElements.length;i++) {
|
||||||
|
enableElements[i].removeAttribute('disabled');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var event = document.createEvent('Events');
|
||||||
|
event.initEvent('calendar', true, false);
|
||||||
|
event.details = calendar;
|
||||||
|
this.dispatchEvent(event);
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
<method name="onStartTimeChange">
|
<method name="onStartTimeChange">
|
||||||
<body>
|
<body>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
|
|
@ -299,45 +299,12 @@
|
||||||
var calendar = item.calendar;
|
var calendar = item.calendar;
|
||||||
var recinfo = item.recurrenceInfo;
|
var recinfo = item.recurrenceInfo;
|
||||||
|
|
||||||
// set 'mIsReadOnly' if the calendar is read-only
|
this.onChangeCalendar(calendar);
|
||||||
if (calendar && calendar.readOnly)
|
|
||||||
this.mIsReadOnly = true;
|
|
||||||
|
|
||||||
// assume we're the organizer [in case that the calendar
|
|
||||||
// does not support the concept of identities].
|
|
||||||
this.mIsOrganizer = true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
this.mUserID = "";
|
|
||||||
this.mCalID = "";
|
|
||||||
this.mOrganizerID = "";
|
|
||||||
|
|
||||||
var provider = item.calendar.QueryInterface(Components.interfaces.calIWcapCalendar);
|
|
||||||
this.mCalID = provider.calId;
|
|
||||||
this.mUserID = provider.session.userId;
|
|
||||||
this.mOrganizerID = ((item.organizer == null || item.organizer.id == null)
|
|
||||||
? this.mCalID // sensible default
|
|
||||||
: item.organizer.id);
|
|
||||||
|
|
||||||
// set 'mIsOrganizer' if the current calid originally scheduled this event.
|
|
||||||
this.mIsOrganizer = false;
|
|
||||||
if(this.mCalID == this.mOrganizerID)
|
|
||||||
this.mIsOrganizer = true;
|
|
||||||
}
|
|
||||||
catch(e) {}
|
|
||||||
|
|
||||||
|
|
||||||
// set starting value for 'repeat until' rule.
|
// set starting value for 'repeat until' rule.
|
||||||
this.mStartDate = item.startDate || item.entryDate || item.dueDate;
|
this.mStartDate = item.startDate || item.entryDate || item.dueDate;
|
||||||
setElementValue("repeat-until-date", this.mStartDate);
|
setElementValue("repeat-until-date", this.mStartDate);
|
||||||
|
|
||||||
// disable or enable controls based on a set or rules
|
|
||||||
// - whether this item is a stand-alone item or an occurrence
|
|
||||||
// - whether or not this item is read-only
|
|
||||||
// - whether or not the state of the item allows recurrence rules
|
|
||||||
// - tasks without an entrydate are invalid
|
|
||||||
this.disableOrEnable(item);
|
|
||||||
|
|
||||||
if(item.parentItem != item) {
|
if(item.parentItem != item) {
|
||||||
item = item.parentItem;
|
item = item.parentItem;
|
||||||
}
|
}
|
||||||
|
@ -587,6 +554,53 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<method name="onChangeCalendar">
|
||||||
|
<parameter name="calendar"/>
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
var args = window.arguments[0];
|
||||||
|
var item = args.calendarEvent;
|
||||||
|
|
||||||
|
// set 'mIsReadOnly' if the calendar is read-only
|
||||||
|
this.mIsReadOnly = false;
|
||||||
|
if (calendar && calendar.readOnly)
|
||||||
|
this.mIsReadOnly = true;
|
||||||
|
|
||||||
|
// assume we're the organizer [in case that the calendar
|
||||||
|
// does not support the concept of identities].
|
||||||
|
this.mIsOrganizer = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.mUserID = "";
|
||||||
|
this.mCalID = "";
|
||||||
|
this.mOrganizerID = "";
|
||||||
|
|
||||||
|
var provider = calendar.QueryInterface(Components.interfaces.calIWcapCalendar);
|
||||||
|
this.mCalID = provider.calId;
|
||||||
|
this.mUserID = provider.session.userId;
|
||||||
|
this.mOrganizerID = ((item.organizer == null || item.organizer.id == null)
|
||||||
|
? this.mCalID // sensible default
|
||||||
|
: item.organizer.id);
|
||||||
|
|
||||||
|
// set 'mIsOrganizer' if the current calid originally scheduled this event.
|
||||||
|
this.mIsOrganizer = false;
|
||||||
|
if(this.mCalID == this.mOrganizerID)
|
||||||
|
this.mIsOrganizer = true;
|
||||||
|
}
|
||||||
|
catch(e) {}
|
||||||
|
|
||||||
|
// disable or enable controls based on a set or rules
|
||||||
|
// - whether this item is a stand-alone item or an occurrence
|
||||||
|
// - whether or not this item is read-only
|
||||||
|
// - whether or not the state of the item allows recurrence rules
|
||||||
|
// - tasks without an entrydate are invalid
|
||||||
|
this.disableOrEnable(item);
|
||||||
|
|
||||||
|
this.updateRecurrenceControls();
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
<method name="disableRecurrenceFields">
|
<method name="disableRecurrenceFields">
|
||||||
<parameter name="aAttributeName"/>
|
<parameter name="aAttributeName"/>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -91,6 +91,14 @@ function onLoad()
|
||||||
};
|
};
|
||||||
window.addEventListener('warning', warning, true);
|
window.addEventListener('warning', warning, true);
|
||||||
|
|
||||||
|
var calendar = function calendarHandler(event) {
|
||||||
|
var recurrencepage = document.getElementById("recurrence-page");
|
||||||
|
recurrencepage.onChangeCalendar(event.details);
|
||||||
|
var attendeespage = document.getElementById("attendees-page");
|
||||||
|
attendeespage.onChangeCalendar(event.details);
|
||||||
|
};
|
||||||
|
window.addEventListener('calendar', calendar, true);
|
||||||
|
|
||||||
// figure out what the title of the dialog should be and set it
|
// figure out what the title of the dialog should be and set it
|
||||||
updateTitle();
|
updateTitle();
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче