зеркало из https://github.com/mozilla/pjs.git
Adding support for attendees and setting of recurrence
This commit is contained in:
Родитель
f9f235b109
Коммит
eec2cbd2a8
|
@ -691,11 +691,21 @@ function createToDo()
|
|||
return Components.classes["@mozilla.org/calendar/todo;1"].createInstance(Components.interfaces.calITodo);
|
||||
}
|
||||
|
||||
function createRecurrenceInfo()
|
||||
{
|
||||
return Components.classes["@mozilla.org/calendar/recurrence-info;1"].createInstance(Components.interfaces.calIRecurrenceInfo);
|
||||
}
|
||||
|
||||
function createDateTime()
|
||||
{
|
||||
return Components.classes["@mozilla.org/calendar/datetime;1"].createInstance(Components.interfaces.calIDateTime);
|
||||
}
|
||||
|
||||
function createAttendee()
|
||||
{
|
||||
return Components.classes["@mozilla.org/calendar/attendee;1"].createInstance(Components.interfaces.calIAttendee);
|
||||
}
|
||||
|
||||
function createCalendar()
|
||||
{
|
||||
var prefobj = prefService.getBranch("calendar.");
|
||||
|
|
|
@ -235,6 +235,13 @@ function loadCalendarEventDialog()
|
|||
setFieldValue("invite-checkbox", false, "checked");
|
||||
}
|
||||
|
||||
// handle attendees
|
||||
attendeeList = event.getAttendees({});
|
||||
for (var i = 0; i < attendeeList.length; i++) {
|
||||
attendee = attendeeList[i];
|
||||
addAttendee(attendee.id);
|
||||
}
|
||||
|
||||
/* XXX
|
||||
setFieldValue("repeat-checkbox", gEvent.recur, "checked");
|
||||
if( gEvent.recurInterval < 1 )
|
||||
|
@ -380,7 +387,7 @@ function onOKCommand()
|
|||
if (event.hasAlarm) {
|
||||
alarmLength = getFieldValue( "alarm-length-field" );
|
||||
alarmUnits = getFieldValue( "alarm-length-units", "value" );
|
||||
//event.alarmTime = ...
|
||||
//event.alarmTime = ...
|
||||
}
|
||||
|
||||
event.recurrenceInfo = null;
|
||||
|
@ -388,14 +395,34 @@ function onOKCommand()
|
|||
if (getFieldValue("repeat-checkbox", "checked")) {
|
||||
recurrenceInfo = createRecurrenceInfo();
|
||||
recurUnits = getFieldValue("repeat-length-units", "value");
|
||||
recurForever = getFieldValue("repeat-forever-radio", "selected");
|
||||
recurInterval = getFieldValue("repeat-length-field");
|
||||
recurCount = (getFieldValue("repeat-numberoftimes-radio", "selected")
|
||||
? Math.max(1, getFieldValue("repeat-numberoftimes-textbox"))
|
||||
: 0); // 0 means not selected.
|
||||
recurInterval = getFieldValue("repeat-length-field");
|
||||
|
||||
//recurrenceInfo.recurType = ...
|
||||
//recurrenceInfo.recurEnd = ...
|
||||
if (getFieldValue("repeat-forever-radio", "selected")) {
|
||||
recurrenceInfo.recurCount = -1;
|
||||
}
|
||||
else if (getFieldValue("repeat-numberoftimes-radio", "selected")) {
|
||||
recurrenceInfo.recurCount = Math.max(1, getFieldValue("repeat-numberoftimes-textbox"))
|
||||
}
|
||||
else if (getFieldValue("repeat-until-radio", "selected")) {
|
||||
var recurEndDate = document.getElementById("repeat-end-date-picker").value;
|
||||
recurrenceInfo.recurEnd.jsDate = recurEndDate;
|
||||
}
|
||||
|
||||
|
||||
// Exceptions
|
||||
var listbox = document.getElementById("exception-dates-listbox");
|
||||
|
||||
var exceptionArray = new Array();
|
||||
for (var i = 0; i < listbox.childNodes.length; i++) {
|
||||
var dateObj = new Date(listbox.childNodes[i].value);
|
||||
exceptionArray.push(jsDateToDateTime(dateObj));
|
||||
}
|
||||
if (exceptionArray.length > 0)
|
||||
event.recurrenceInfo.setException(exceptionArray.length, exceptionArray);
|
||||
|
||||
|
||||
// Finally, set the recurrenceInfo
|
||||
event.recurrenceInfo = recurrenceInfo;
|
||||
}
|
||||
|
||||
|
||||
|
@ -425,24 +452,6 @@ function onOKCommand()
|
|||
event.deleteProperty('inviteEmailAddress');
|
||||
|
||||
|
||||
/* EXCEPTIONS */
|
||||
|
||||
/*
|
||||
gEvent.removeAllExceptions();
|
||||
|
||||
var listbox = document.getElementById( "exception-dates-listbox" );
|
||||
|
||||
var i;
|
||||
for( i = 0; i < listbox.childNodes.length; i++ )
|
||||
{
|
||||
var dateObj = new Date( );
|
||||
|
||||
dateObj.setTime( listbox.childNodes[i].value );
|
||||
|
||||
gEvent.addException( dateObj );
|
||||
}
|
||||
*/
|
||||
|
||||
/* File attachments */
|
||||
//loop over the items in the listbox
|
||||
//event.attachments.clear();
|
||||
|
@ -474,6 +483,17 @@ function onOKCommand()
|
|||
}
|
||||
}
|
||||
|
||||
/* wire up attendees */
|
||||
//evenet.clearAttendees();
|
||||
attendeeList = document.getElementById("bucketBody").getElementsByTagName("treecell");
|
||||
for (var i = 0; i < attendeeList.length; i++) {
|
||||
label = attendeeList[i].getAttribute("label");
|
||||
attendee = createAttendee();
|
||||
attendee.id = label;
|
||||
event.addAttendee(attendee);
|
||||
}
|
||||
|
||||
|
||||
var Server = getFieldValue( "server-field" );
|
||||
|
||||
// :TODO: REALLY only do this if the alarm or start settings change.?
|
||||
|
@ -1553,3 +1573,21 @@ function processComponentType()
|
|||
else
|
||||
dump("processComponentType: no componentMenu.selectedItem!\n");
|
||||
}
|
||||
|
||||
|
||||
function onIniviteAdd()
|
||||
{
|
||||
textBox = document.getElementById("invite-email-field");
|
||||
addAttendee(textBox.email);
|
||||
}
|
||||
|
||||
function addAttendee(email)
|
||||
{
|
||||
treeItem = document.createElement("treeitem");
|
||||
treeRow = document.createElement("treerow");
|
||||
treeCell = document.createElement("treecell");
|
||||
treeCell.setAttribute("label", email);
|
||||
treeItem.appendChild(treeRow);
|
||||
treeRow.appendChild(treeCell);
|
||||
document.getElementById("bucketBody").appendChild(treeItem);
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@
|
|||
|
||||
<!-- Javascript includes -->
|
||||
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/calendar.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/strres.js"/>
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/dateUtils.js"/>
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/eventDialog.js"/>
|
||||
|
@ -581,7 +582,7 @@
|
|||
<!-- Contacts panel -->
|
||||
<tabpanel orient="vertical">
|
||||
<!-- Invite -->
|
||||
<vbox collapsed="true">
|
||||
<vbox collapsed="false">
|
||||
<hbox id="invite-box" align="center">
|
||||
<checkbox id="invite-checkbox"
|
||||
label="&newevent.invite.label;"
|
||||
|
@ -590,6 +591,7 @@
|
|||
<textbox id="invite-email-field"
|
||||
size="39"
|
||||
disabled="true"/>
|
||||
<button label="Add" id="invite-email-button" onclick="onIniviteAdd();"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
||||
|
@ -672,7 +674,7 @@
|
|||
<tree id="addressBucket"
|
||||
flex="1"
|
||||
hidecolumnpicker="true"
|
||||
onclick="selectEventRecipient( this );">
|
||||
onclick="selectEventRecipient(this);">
|
||||
<treecols>
|
||||
<treecol id="addressCol"
|
||||
flex="1"
|
||||
|
|
|
@ -353,12 +353,13 @@ WeekView.prototype.createEventBox = function ( calItem )
|
|||
|
||||
// figure out what column we need to put this on
|
||||
var dayIndex = new Date(gHeaderDateItemArray[1].getAttribute("date"));
|
||||
var index = calEvent.startDate.day - dayIndex.getDate() - 1;
|
||||
// XXX need to fix this for wrapping months
|
||||
var index = calEvent.startDate.jsDate.getDay() - dayIndex.getDay();
|
||||
dump("index is:" + index + "(" + calEvent.startDate.jsDate.getDay() + " - " + dayIndex.getDay() + ")\n");
|
||||
|
||||
var boxLeft = document.getElementById("week-tree-day-"+index+"-item-"+startHour).boxObject.x -
|
||||
document.getElementById( "week-view-content-box" ).boxObject.x +
|
||||
( /*calendarEventDisplay.startDrawSlot*/1 * eventSlotWidth );
|
||||
dump(boxLeft + "\n");
|
||||
eventBox.setAttribute("left", boxLeft);
|
||||
|
||||
// set the event box to be of class week-view-event-class and the appropriate calendar-color class
|
||||
|
|
Загрузка…
Ссылка в новой задаче