updating eventDialog to use the new calendar APIs

revamp of the event dialog by mattwillis@gmail.com
bug 272732 r=shaver
This commit is contained in:
pavlov%pavlov.net 2004-12-02 17:41:13 +00:00
parent edf0052253
commit 84dee1b4db
7 changed files with 1188 additions and 1010 deletions

View File

@ -165,6 +165,7 @@ interface calIItemBase : nsISupports
readonly attribute nsISimpleEnumerator propertyEnumerator;
nsIVariant getProperty(in AString name);
void setProperty(in AString name, in nsIVariant value);
// will not throw an error if you delete a property that doesn't exist
void deleteProperty(in AString name);
// The array returned here is not live; it will not reflect calls to

View File

@ -148,7 +148,11 @@ calItemBase.prototype = {
get propertyEnumerator() { return this.mProperties.enumerator; },
getProperty: function (aName) {
return this.mProperties.getProperty(aName);
try {
return this.mProperties.getProperty(aName);
} catch (e) {
return null;
}
},
setProperty: function (aName, aValue) {
if (this.mImmutable)
@ -158,7 +162,10 @@ calItemBase.prototype = {
deleteProperty: function (aName) {
if (this.mImmutable)
throw Components.results.NS_ERROR_FAILURE;
this.mProperties.deleteProperty(aName);
try {
this.mProperties.deleteProperty(aName);
} catch (e) {
}
},
getAttendees: function (countObj) {

View File

@ -102,3 +102,65 @@ function launchBrowser( UrlToGoTo )
//window.open(UrlToGoTo, "_blank", "chrome,menubar,toolbar,resizable,dialog=no");
//window.open( UrlToGoTo, "calendar-opened-window" );
}
function goToggleToolbar( id, elementID )
{
var toolbar = document.getElementById(id);
var element = document.getElementById(elementID);
if (toolbar) {
var isHidden = toolbar.hidden;
toolbar.hidden = !isHidden;
document.persist(id, 'hidden');
if (element) {
element.setAttribute("checked", isHidden ? "true" : "false");
document.persist(elementID, 'checked');
}
}
}
function openExtensions(aOpenMode)
{
const EMTYPE = "Extension:Manager";
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var needToOpen = true;
var windowType = EMTYPE + "-" + aOpenMode;
var windows = wm.getEnumerator(windowType);
while (windows.hasMoreElements()) {
var theEM = windows.getNext().QueryInterface(Components.interfaces.nsIDOMWindowInternal);
if (theEM.document.documentElement.getAttribute("windowtype") == windowType) {
theEM.focus();
needToOpen = false;
break;
}
}
if (needToOpen) {
const EMURL = "chrome://mozapps/content/extensions/extensions.xul?type=" + aOpenMode;
const EMFEATURES = "chrome,dialog=no,resizable";
window.openDialog(EMURL, "", EMFEATURES);
}
}
function showElement( elementId )
{
try {
dump("showElement: showing "+elementId+"\n");
document.getElementById( elementId ).removeAttribute( "hidden" );
}
catch (e) {
dump("showElement: Couldn't remove hidden attribute from "+elementId+"\n");
}
}
function hideElement( elementId )
{
try {
dump("hideElement: hiding "+elementId+"\n");
document.getElementById( elementId ).setAttribute( "hidden", "true" );
}
catch (e) {
dump("hideElement: Couldn't set hidden attribute on "+elementId+"\n");
}
}

View File

@ -1,4 +1,5 @@
/* ***** BEGIN LICENSE BLOCK *****
/* -*- Mode: javascript; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
@ -69,6 +70,8 @@
* G L O B A L V A R I A B L E S
*/
var gCalendar = null;
//the next line needs XX-DATE-XY but last X instead of Y
var gDateMade = "2002052213-cal"
@ -168,14 +171,10 @@ var categoryPrefObserver =
function calendarInit()
{
// get the calendar event data source
gEventSource = new CalendarEventDataSource();
// XXX remove this eventually
gICalLib = new Object();
// get the Ical Library
gICalLib = gEventSource.getICalLib();
// this suspends feedbacks to observers until all is settled
gICalLib.batchMode = true;
gCalendar = createCalendar();
// set up the CalendarWindow instance
@ -196,8 +195,13 @@ function calendarInit()
update_date();
checkForMailNews();
checkForMailNews();
//updateColors();
}
function updateColors()
{
// Change made by CofC for Calendar Coloring
// initialize calendar color style rules in the calendar's styleSheet
@ -657,6 +661,13 @@ function multiweekToDoBoxDoubleClickEvent( todoBox, event )
}
function jsDateToDateTime(date)
{
newDate = createDateTime();
newDate.nativeTime = date;
return newDate;
}
/**
* Called when the new event button is clicked
*/
@ -664,6 +675,7 @@ var gNewDateVariable = null;
function newEventCommand( event )
{
/*
var startDate;
if( gNewDateVariable != null )
@ -675,13 +687,11 @@ function newEventCommand( event )
var Minutes = Math.ceil( startDate.getMinutes() / 5 ) * 5 ;
startDate = new Date( startDate.getFullYear(),
startDate.getMonth(),
startDate.getDate(),
startDate.getHours(),
Minutes,
0);
newEvent( startDate );
date = jsDateToDateTime(startDate);
date.minute = Minutes;
*/
date = null;
newEvent( date );
}
@ -697,29 +707,34 @@ function newToDoCommand()
function createEvent ()
{
var iCalEventComponent = Components.classes["@mozilla.org/icalevent;1"].createInstance();
var iCalEvent = iCalEventComponent.QueryInterface(Components.interfaces.oeIICalEvent);
return iCalEvent;
return Components.classes["@mozilla.org/calendar/event;1"].createInstance(Components.interfaces.calIEvent);
}
function createToDo ()
{
var iCalToDoComponent = Components.classes["@mozilla.org/icaltodo;1"].createInstance();
var iCalToDo = iCalToDoComponent.QueryInterface(Components.interfaces.oeIICalTodo);
return iCalToDo;
return Components.classes["@mozilla.org/calendar/todo;1"].createInstance(Components.interfaces.calITodo);
}
function createDateTime()
{
return Components.classes["@mozilla.org/calendar/datetime;1"].createInstance(Components.interfaces.calIDateTime);
}
function createCalendar()
{
return Components.classes["@mozilla.org/calendar/calendar;1?type=memory"].getService(Components.interfaces.calICalendar);
}
function isEvent ( aObject )
{
return (aObject instanceof Components.interfaces.oeIICalEvent) && !(aObject instanceof Components.interfaces.oeIICalTodo);
return aObject instanceof Components.interfaces.calIEvent;
}
function isToDo ( aObject )
{
return aObject instanceof Components.interfaces.oeIICalTodo;
return aObject instanceof Components.interfaces.calITodo;
}
@ -770,26 +785,28 @@ function newEvent( startDate, endDate, allDay )
// create a new event to be edited and added
var calendarEvent = createEvent();
if( !startDate )
startDate = gCalendarWindow.currentView.getNewEventDate();
calendarEvent.start.setTime( startDate );
if( !endDate )
{
var MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", gCalendarBundle.getString("defaultEventLength" ) );
var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn );
calendarEvent.end.setTime( endDateTime );
}
else
{
calendarEvent.end.setTime( endDate.getTime() );
/*
if (!startDate) {
startDate = gCalendarWindow.currentView.getNewEventDate();
}
if( allDay )
calendarEvent.allDay = true;
calendarEvent.startDate.jsDate = startDate;
if (!endDate)
{
var MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", gCalendarBundle.getString("defaultEventLength" ) );
var endDateTime = startDate.clone();
endDateTime.minute += MinutesToAddOn; // XXX this could overflow
endDateTime.normalize();
}
calendarEvent.endDate.jsDate = endDate
*/
if (allDay)
calendarEvent.isAllDay = true;
var server = getSelectedCalendarPathOrNull();
@ -806,15 +823,11 @@ function newToDo ( startDate, dueDate )
var calendarToDo = createToDo();
// created todo has no start or due date unless user wants one
if (! startDate )
calendarToDo.start.clear();
else
calendarToDo.start.setTime( startDate );
if (startDate)
calendarToDo.start.jsDate = startDate;
if (! dueDate )
calendarToDo.due.clear();
else
calendarToDo.due.setTime( dueDate );
if (dueDate)
calendarToDo.dueDate.jsDate = dueDate;
var server = getSelectedCalendarPathOrNull();
@ -879,7 +892,7 @@ function addEventDialogResponse( calendarEvent, Server )
function addToDoDialogResponse( calendarToDo, Server )
{
saveItem( calendarToDo, Server, "addTodo" );
addEventDialogResponse(calendarToDo, Server);
}
@ -931,7 +944,7 @@ function modifyEventDialogResponse( calendarEvent, Server, originalEvent )
function modifyToDoDialogResponse( calendarToDo, Server, originalToDo )
{
saveItem( calendarToDo, Server, "modifyTodo", originalToDo );
modifyEventDialogResponse(calendarToDo, Server, originalToDo);
}
@ -999,6 +1012,18 @@ function editEventCommand()
//used to check if there were external changes for shared calendar
function saveItem( calendarEvent, Server, functionToRun, originalEvent )
{
if (functionToRun == 'addEvent')
gCalendar.addItem(calendarEvent, null);
else if (functionToRun == 'modifyEvent')
gCalendar.modifyItem(calendarEvent, null);
/*
var calendarServer = gCalendarWindow.calendarManager.getCalendarByName( Server );
var path = calendarServer.getAttribute("http://home.netscape.com/NC-rdf#path");
var shared = (calendarServer.getAttribute("http://home.netscape.com/NC-rdf#shared" ) == "true");
@ -1059,6 +1084,8 @@ function saveItem( calendarEvent, Server, functionToRun, originalEvent )
eval( "gICalLib."+functionToRun+"( calendarEvent, Server )" );
gCalendarWindow.clearSelectedEvent( calendarEvent );
}
*/
}
@ -1278,7 +1305,7 @@ function launchWizard()
function reloadApplication()
{
gEventSource.calendarManager.refreshAllRemoteCalendars();
gEventSource.calendarManager.refreshAllRemoteCalendars();
}

View File

@ -47,7 +47,6 @@
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<?xml-stylesheet href="chrome://calendar/skin/calendar.css" type="text/css"?>
<?xml-stylesheet href="chrome://calendar/content/datetimepickers/minimonth.css" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/skin/communicator.css" type="text/css"?>
<!-- Overlays -->
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
@ -199,7 +198,6 @@
<!-- Javascript includes -->
<script type="application/x-javascript" src="chrome://calendar/content/jslib/jslib.js"/>
<script type="application/x-javascript" src="chrome://communicator/content/utilityOverlay.js"/>
<!-- NEEDED FOR DRAG AND DROP SUPPORT -->
<script type="application/x-javascript" src="chrome://calendar/content/dragDrop.js"/>

View File

@ -1,4 +1,5 @@
/* ***** BEGIN LICENSE BLOCK *****
/* -*- Mode: javascript; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
@ -47,7 +48,7 @@
* Garth Smedley
* REQUIRED INCLUDES
* <script type="application/x-javascript" src="chrome://calendar/content/dateUtils.js"/>
*
* <script type="application/x-javascript" src="chrome://calendar/content/applicationUtil.js"/>
* NOTES
* Code for the calendar's new/edit event dialog.
*
@ -79,11 +80,10 @@
* W I N D O W V A R I A B L E S
*/
var debugenabled=false;
var debugenabled=true;
var gEvent; // event being edited
var gOnOkFunction; // function to be called when user clicks OK
var gOriginalEvent; //Event before edits
var gDuration = -1; // used to preserve duration when changing event start.
@ -113,223 +113,228 @@ var gEndDate = new Date( );
function loadCalendarEventDialog()
{
// Get arguments, see description at top of file
// Get arguments, see description at top of file
var args = window.arguments[0];
var args = window.arguments[0];
gOnOkFunction = args.onOk;
// XXX I want to get rid of the use of gEvent
gEvent = args.calendarEvent;
gOnOkFunction = args.onOk;
gEvent = args.calendarEvent;
// mode is "new or "edit" - show proper header
var titleDataItem = null;
event = args.calendarEvent;
if( "new" == args.mode )
{
titleDataItem = document.getElementById( "data-event-title-new" );
}
else
{
titleDataItem = document.getElementById( "data-event-title-edit" );
gOriginalEvent = gEvent.clone();
}
// mode is "new or "edit" - show proper header
var titleDataItem = null;
var titleString = titleDataItem.getAttribute( "value" );
document.getElementById("calendar-new-eventwindow").setAttribute("title", titleString);
if ("new" == args.mode)
title = document.getElementById("data-event-title-new").getAttribute("value");
else {
title = document.getElementById("data-event-title-edit").getAttribute("value");
}
// fill in fields from the event
gStartDate.setTime( gEvent.start.getTime() );
document.getElementById( "start-datetime" ).value = gStartDate;
document.getElementById("calendar-new-component-window").setAttribute("title", title);
gEndDate.setTime( gEvent.end.getTime() );
var displayEndDate = new Date(gEndDate);
if( gEvent.allDay ) {
//displayEndDate == icalEndDate - 1, in the case of allday events
displayEndDate.setDate( displayEndDate.getDate() - 1 );
}
document.getElementById( "end-datetime" ).value = displayEndDate;
gDuration = gEndDate.getTime() - gStartDate.getTime(); //in ms
// fill in fields from the event
gStartDate = event.startDate.jsDate;
document.getElementById("start-datetime").value = gStartDate;
if ( gEvent.recurForever )
{
gEvent.recurEnd.setTime( gEndDate );
}
gEndDate = event.endDate.jsDate;
var displayEndDate = new Date(gEndDate);
if (event.isAllDay) {
//displayEndDate == icalEndDate - 1, in the case of allday events
displayEndDate.setDate(displayEndDate.getDate() - 1);
}
document.getElementById("end-datetime").value = displayEndDate;
//do the stuff for exceptions
var ArrayOfExceptions = gEvent.getExceptions();
gDuration = gEndDate.getTime() - gStartDate.getTime(); //in ms
while( ArrayOfExceptions.hasMoreElements() )
{
var ExceptionTime = ArrayOfExceptions.getNext().QueryInterface(Components.interfaces.nsISupportsPRTime).data;
/*
if (event.recurForever) {
event.recurEnd.setTime(gEndDate);
}
var ExceptionDate = new Date( ExceptionTime );
//do the stuff for exceptions
var ArrayOfExceptions = event.getExceptions();
addException( ExceptionDate );
}
while( ArrayOfExceptions.hasMoreElements() ) {
var ExceptionTime = ArrayOfExceptions.getNext().QueryInterface(Components.interfaces.nsISupportsPRTime).data;
//file attachments;
for( var i = 0; i < gEvent.attachmentsArray.Count(); i++ )
{
var thisAttachment = gEvent.attachmentsArray.QueryElementAt( i, Components.interfaces.nsIMsgAttachment );
var ExceptionDate = new Date( ExceptionTime );
addAttachment( thisAttachment );
}
addException( ExceptionDate );
}
document.getElementById( "exceptions-date-picker" ).value = gStartDate;
//file attachments;
for( var i = 0; i < event.attachmentsArray.Count(); i++ ) {
var thisAttachment = event.attachmentsArray.QueryElementAt( i, Components.interfaces.nsIMsgAttachment );
setFieldValue( "title-field", gEvent.title );
setFieldValue( "description-field", gEvent.description );
setFieldValue( "location-field", gEvent.location );
setFieldValue( "uri-field", gEvent.url );
addAttachment( thisAttachment );
}
*/
switch( gEvent.status )
{
case gEvent.ICAL_STATUS_TENTATIVE:
setFieldValue( "status-field", "ICAL_STATUS_TENTATIVE" );
break;
case gEvent.ICAL_STATUS_CONFIRMED:
setFieldValue( "status-field", "ICAL_STATUS_CONFIRMED" );
break;
case gEvent.ICAL_STATUS_CANCELLED:
setFieldValue( "status-field", "ICAL_STATUS_CANCELLED" );
break;
}
setFieldValue( "all-day-event-checkbox", gEvent.allDay, "checked" );
document.getElementById("exceptions-date-picker").value = gStartDate;
setFieldValue( "private-checkbox", gEvent.privateEvent, "checked" );
dump("event: "+event+"\n");
setFieldValue("title-field", event.title );
setFieldValue("description-field", event.getProperty("description"));
setFieldValue("location-field", event.getProperty("location"));
setFieldValue("uri-field", event.getProperty("url"));
setFieldValue( "alarm-checkbox", gEvent.alarm, "checked" );
setFieldValue( "alarm-length-field", gEvent.alarmLength );
setFieldValue( "alarm-length-units", gEvent.alarmUnits );
setFieldValue( "alarm-trigger-relation", gEvent.getParameter( "ICAL_RELATED_PARAMETER" ) );
switch(event.status) {
case event.CAL_ITEM_STATUS_TENTATIVE:
setFieldValue("event-status-field", "ICAL_STATUS_TENTATIVE");
break;
case event.CAL_ITEM_STATUS_CONFIRMED:
setFieldValue("event-status-field", "ICAL_STATUS_CONFIRMED");
break;
case event.CAL_ITEM_STATUS_CANCELLED:
setFieldValue("event-status-field", "ICAL_STATUS_CANCELLED");
break;
}
if ( gEvent.alarmEmailAddress && gEvent.alarmEmailAddress != "" )
{
setFieldValue( "alarm-email-checkbox", true, "checked" );
setFieldValue( "alarm-email-field", gEvent.alarmEmailAddress );
}
else
{
setFieldValue( "alarm-email-checkbox", false, "checked" );
setFieldValue( "alarm-email-field", true, "disabled" );
}
setFieldValue("all-day-event-checkbox", event.isAllDay, "checked");
setFieldValue("private-checkbox", event.isPrivate, "checked");
if ( gEvent.inviteEmailAddress != undefined && gEvent.inviteEmailAddress != "" )
{
setFieldValue( "invite-checkbox", true, "checked" );
setFieldValue( "invite-email-field", gEvent.inviteEmailAddress );
}
else
{
setFieldValue( "invite-checkbox", false, "checked" );
}
if (!event.hasAlarm) {
// If the event has no alarm
setFieldValue("alarm-type", "none");
}
else {
setFieldValue("alarm-length-field", event.getProperty("alarmLength"));
setFieldValue("alarm-length-units", event.getProperty("alarmUnits"));
setFieldValue("alarm-trigger-relation", event.getProperty("ICAL_RELATED_PARAMETER"));
// If the event has an alarm email address, assume email alarm type
var alarmEmailAddress = event.getProperty("alarmEmailAddress");
if (alarmEmailAddress && alarmEmailAddress != "") {
setFieldValue("alarm-type", "email");
setFieldValue("alarm-email-field", alarmEmailAddress);
}
else {
setFieldValue("alarm-type", "popup");
/* XXX lilmatt: finish this by selection between popup and
popupAndSound by checking pref "calendar.alarms.playsound" */
}
}
setFieldValue( "repeat-checkbox", gEvent.recur, "checked");
if( gEvent.recurInterval < 1 )
gEvent.recurInterval = 1;
var inviteEmailAddress = event.getProperty("inviteEmailAddress");
if (inviteEmailAddress != undefined && inviteEmailAddress != "") {
setFieldValue("invite-checkbox", true, "checked");
setFieldValue("invite-email-field", inviteEmailAddress);
}
else {
setFieldValue("invite-checkbox", false, "checked");
}
setFieldValue( "repeat-length-field", gEvent.recurInterval );
if( gEvent.recurUnits )
setFieldValue( "repeat-length-units", gEvent.recurUnits ); //don't put the extra "value" element here, or it won't work.
else
setFieldValue( "repeat-length-units", "weeks" );
/* XXX
setFieldValue("repeat-checkbox", gEvent.recur, "checked");
if( gEvent.recurInterval < 1 )
gEvent.recurInterval = 1;
if ( gEvent.recurEnd && gEvent.recurEnd.isSet )
setFieldValue( "repeat-end-date-picker", new Date( gEvent.recurEnd.getTime() ) );
else
setFieldValue( "repeat-end-date-picker", new Date() ); // now
setFieldValue( "repeat-length-field", gEvent.recurInterval );
if( gEvent.recurUnits )
setFieldValue( "repeat-length-units", gEvent.recurUnits ); //don't put the extra "value" element here, or it won't work.
else
setFieldValue( "repeat-length-units", "weeks" );
setFieldValue( "repeat-forever-radio", (gEvent.recurForever != undefined && gEvent.recurForever != false), "selected" );
if ( gEvent.recurEnd && gEvent.recurEnd.isSet )
setFieldValue( "repeat-end-date-picker", new Date( gEvent.recurEnd.getTime() ) );
else
setFieldValue( "repeat-end-date-picker", new Date() ); // now
setFieldValue( "repeat-until-radio", ( (gEvent.recurForever == undefined || gEvent.recurForever == false ) && gEvent.recurCount == 0), "selected" );
setFieldValue( "repeat-forever-radio", (gEvent.recurForever != undefined && gEvent.recurForever != false), "selected" );
setFieldValue( "repeat-numberoftimes-radio", (gEvent.recurCount != 0), "selected" );
setFieldValue( "repeat-numberoftimes-textbox", Math.max(gEvent.recurCount, 1));
setFieldValue( "repeat-until-radio", ( (gEvent.recurForever == undefined || gEvent.recurForever == false ) && gEvent.recurCount == 0), "selected" );
/* Categories stuff */
// Load categories
var categoriesString = opener.GetUnicharPref(opener.gCalendarWindow.calendarPreferences.calendarPref, "categories.names", getDefaultCategories() );
setFieldValue( "repeat-numberoftimes-radio", (gEvent.recurCount != 0), "selected" );
setFieldValue( "repeat-numberoftimes-textbox", Math.max(gEvent.recurCount, 1));
*/
var categoriesList = categoriesString.split( "," );
// insert the category already in the task so it doesn't get lost
if( gEvent.categories )
{
if( categoriesString.indexOf( gEvent.categories ) == -1 )
categoriesList[categoriesList.length] = gEvent.categories;
}
/* Categories stuff */
categoriesList.sort();
// Load categories
/*
var categoriesString = opener.GetUnicharPref(opener.gCalendarWindow.calendarPreferences.calendarPref, "categories.names", getDefaultCategories());
var oldMenulist = document.getElementById( "categories-menulist-menupopup" );
while( oldMenulist.hasChildNodes() )
oldMenulist.removeChild( oldMenulist.lastChild );
var categoriesList = categoriesString.split( "," );
for (i = 0; i < categoriesList.length ; i++)
{
document.getElementById( "categories-field" ).appendItem(categoriesList[i], categoriesList[i]);
}
// insert the category already in the task so it doesn't get lost
var categories = event.getProperty("categories");
if (categories) {
if (categoriesString.indexOf(categories) == -1)
categoriesList[categoriesList.length] = categories;
}
document.getElementById( "categories-field" ).selectedIndex = -1;
setFieldValue( "categories-field", gEvent.categories );
categoriesList.sort();
/* Server stuff */
document.getElementById( "server-menulist-menupopup" ).database.AddDataSource( opener.gCalendarWindow.calendarManager.rdf.getDatasource() );
document.getElementById( "server-menulist-menupopup" ).builder.rebuild();
var oldMenulist = document.getElementById( "categories-menulist-menupopup" );
while( oldMenulist.hasChildNodes() )
oldMenulist.removeChild( oldMenulist.lastChild );
if( args.mode == "new" )
{
if( "server" in args )
{
setFieldValue( "server-field", args.server );
}
else
{
document.getElementById( "server-field" ).selectedIndex = 1;
}
}
else
{
if( gEvent.parent )
setFieldValue( "server-field", gEvent.parent.server );
else
{
document.getElementById( "server-field" ).selectedIndex = 1;
}
for (i = 0; i < categoriesList.length ; i++)
{
document.getElementById( "categories-field" ).appendItem(categoriesList[i], categoriesList[i]);
}
//for now you can't edit which file the event is in.
setFieldValue( "server-field", "true", "disabled" );
document.getElementById( "categories-field" ).selectedIndex = -1;
setFieldValue( "categories-field", gEvent.categories );
setFieldValue( "server-field-label", "true", "disabled" );
}
// update enabling and disabling
updateRepeatItemEnabled();
updateStartEndItemEnabled();
updateAlarmItemEnabled();
updateInviteItemEnabled();
// Server stuff
document.getElementById( "server-menulist-menupopup" ).database.AddDataSource( opener.gCalendarWindow.calendarManager.rdf.getDatasource() );
document.getElementById( "server-menulist-menupopup" ).builder.rebuild();
updateAddExceptionButton();
if (args.mode == "new") {
if ("server" in args) {
setFieldValue( "server-field", args.server );
}
else {
document.getElementById( "server-field" ).selectedIndex = 1;
}
} else {
if (gEvent.parent)
setFieldValue( "server-field", gEvent.parent.server );
else
document.getElementById( "server-field" ).selectedIndex = 1;
//updateAlarmEmailItemEnabled();
//for now you can't edit which file the event is in.
setFieldValue( "server-field", "true", "disabled" );
setFieldValue( "server-field-label", "true", "disabled" );
}
*/
/*
** set the advanced weekly repeating stuff
*/
setAdvancedWeekRepeat();
setFieldValue( "advanced-repeat-dayofmonth", ( gEvent.recurWeekNumber == 0 || gEvent.recurWeekNumber == undefined ), "selected" );
setFieldValue( "advanced-repeat-dayofweek", ( gEvent.recurWeekNumber > 0 && gEvent.recurWeekNumber != 5 ), "selected" );
setFieldValue( "advanced-repeat-dayofweek-last", ( gEvent.recurWeekNumber == 5 ), "selected" );
// update enabling and disabling
updateRepeatItemEnabled();
updateStartEndItemEnabled();
updateInviteItemEnabled();
// start focus on title
var firstFocus = document.getElementById( "title-field" );
firstFocus.focus();
updateAddExceptionButton();
// revert cursor from "wait" set in calendar.js editEvent, editNewEvent
opener.setCursor( "auto" );
//set the advanced weekly repeating stuff
setAdvancedWeekRepeat();
self.focus();
/*
setFieldValue("advanced-repeat-dayofmonth", (gEvent.recurWeekNumber == 0 || gEvent.recurWeekNumber == undefined), "selected");
setFieldValue("advanced-repeat-dayofweek", (gEvent.recurWeekNumber > 0 && gEvent.recurWeekNumber != 5), "selected");
setFieldValue("advanced-repeat-dayofweek-last", (gEvent.recurWeekNumber == 5), "selected");
*/
// hide/show fields and widgets for item type
processComponentType();
// hide/show fields and widgets for alarm type
processAlarmType();
// start focus on title
var firstFocus = document.getElementById("title-field");
firstFocus.focus();
// revert cursor from "wait" set in calendar.js editEvent, editNewEvent
opener.setCursor( "auto" );
self.focus();
}
@ -340,100 +345,76 @@ function loadCalendarEventDialog()
function onOKCommand()
{
// get values from the form and put them into the event
event = gEvent;
gEvent.title = getFieldValue( "title-field" );
gEvent.description = getFieldValue( "description-field" );
gEvent.location = getFieldValue( "location-field" );
gEvent.start.setTime( gStartDate.getTime() );
gEvent.end.setTime( gEndDate.getTime() );
// if this event isn't mutable, we need to clone it like a sheep
var originalEvent = event;
if (!event.isMutable)
event = originalEvent.clone();
if( getFieldValue( "status-field" ) != "" )
gEvent.status = eval( "gEvent."+getFieldValue( "status-field" ) );
// get values from the form and put them into the event
// calIEvent properties
//event.startDate.jsDate = gStartDate;
//event.endDate.jsDate = gEndDate;
event.isAllDay = getFieldValue( "all-day-event-checkbox", "checked" );
gEvent.allDay = getFieldValue( "all-day-event-checkbox", "checked" );
gEvent.url = getFieldValue( "uri-field" );
gEvent.privateEvent = getFieldValue( "private-checkbox", "checked" );
// calIItemBase properties
event.title = getFieldValue( "title-field" );
event.isPrivate = getFieldValue( "private-checkbox", "checked" );
if (getFieldValue( "alarm-type" ) != "" && getFieldValue( "alarm-type" ) != "none")
event.hasAlarm == 1
if (event.hasAlarm) {
alarmLength = getFieldValue( "alarm-length-field" );
alarmUnits = getFieldValue( "alarm-length-units", "value" );
//event.alarmTime = ...
}
if( getFieldValue( "invite-checkbox", "checked" ) )
{
gEvent.inviteEmailAddress = getFieldValue( "invite-email-field", "value" );
}
else
{
gEvent.inviteEmailAddress = "";
}
gEvent.alarm = getFieldValue( "alarm-checkbox", "checked" );
gEvent.alarmLength = getFieldValue( "alarm-length-field" );
gEvent.alarmUnits = getFieldValue( "alarm-length-units", "value" );
gEvent.setParameter( "ICAL_RELATED_PARAMETER", getFieldValue( "alarm-trigger-relation", "value" ) );
event.recurrenceInfo = null;
if ( getFieldValue( "alarm-email-checkbox", "checked" ) )
{
gEvent.alarmEmailAddress = getFieldValue( "alarm-email-field", "value" );
}
else
{
gEvent.alarmEmailAddress = "";
}
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.
gEvent.categories = getFieldValue( "categories-field", "value" );
//recurrenceInfo.recurType = ...
//recurrenceInfo.recurEnd = ...
}
gEvent.recur = getFieldValue( "repeat-checkbox", "checked" );
gEvent.recurUnits = getFieldValue( "repeat-length-units", "value" );
gEvent.recurForever = getFieldValue( "repeat-forever-radio", "selected" );
gEvent.recurInterval = getFieldValue( "repeat-length-field" );
gEvent.recurCount = (getFieldValue("repeat-numberoftimes-radio", "selected")
? Math.max(1, getFieldValue( "repeat-numberoftimes-textbox"))
: 0); // 0 means not selected.
if( gEvent.recurInterval == 0 )
gEvent.recur = false;
if ( gEvent.recur && getFieldValue( "repeat-until-radio", "selected" ))
{
var recurEndDate = document.getElementById( "repeat-end-date-picker" ).value;
// other properties
event.setProperty('categories', getFieldValue("categories-field", "value"));
event.setProperty('description', getFieldValue("description-field"));
event.setProperty('location', getFieldValue("location-field"));
event.setProperty('url', getFieldValue("uri-field"));
gEvent.recurEnd.setTime( recurEndDate );
gEvent.recurEnd.hour = gEvent.start.hour;
gEvent.recurEnd.minute = gEvent.start.minute;
}
else
{
gEvent.recurEnd.clear();
}
event.setProperty("ICAL_RELATED_PARAMETER", getFieldValue("alarm-trigger-relation", "value"));
if( gEvent.recur == true )
{
if( gEvent.recurUnits == "weeks" )
{
/*
** advanced weekly repeating, choosing the days to repeat
*/
gEvent.recurWeekdays = getAdvancedWeekRepeat();
}
else if( gEvent.recurUnits == "months" )
{
/*
** advanced month repeating, either every day or every date
*/
if( getFieldValue( "advanced-repeat-dayofweek", "selected" ) == true )
{
gEvent.recurWeekNumber = getWeekNumberOfMonth();
}
else if( getFieldValue( "advanced-repeat-dayofweek-last", "selected" ) == true )
{
gEvent.recurWeekNumber = 5;
}
else
gEvent.recurWeekNumber = 0;
if (getFieldValue("alarm-type") == "email" )
event.setProperty('alarmEmailAddress', getFieldValue("alarm-email-field", "value"));
else
event.deleteProperty('alarmEmailAddress');
/*
if( getFieldValue( "status-field" ) != "" )
gEvent.status = eval( "gEvent."+getFieldValue( "status-field" ) );
*/
if (getFieldValue("invite-checkbox", "checked"))
event.setProperty('inviteEmailAddress', getFieldValue("invite-email-field", "value"));
else
event.deleteProperty('inviteEmailAddress');
}
}
/* EXCEPTIONS */
/*
gEvent.removeAllExceptions();
var listbox = document.getElementById( "exception-dates-listbox" );
@ -447,41 +428,36 @@ function onOKCommand()
gEvent.addException( dateObj );
}
*/
/* File attachments */
//loop over the items in the listbox
gEvent.removeAttachments();
/* File attachments */
//loop over the items in the listbox
//event.attachments.clear();
var attachmentListbox = document.getElementById( "attachmentBucket" );
var attachmentListbox = document.getElementById( "attachmentBucket" );
for( i = 0; i < attachmentListbox.childNodes.length; i++ )
{
Attachment = Components.classes["@mozilla.org/messengercompose/attachment;1"].createInstance( Components.interfaces.nsIMsgAttachment );
Attachment.url = attachmentListbox.childNodes[i].getAttribute( "label" );
gEvent.addAttachment( Attachment );
}
for (i = 0; i < attachmentListbox.childNodes.length; i++) {
attachment = Components.classes["@mozilla.org/messengercompose/attachment;1"].createInstance(Components.interfaces.nsIMsgAttachment);
attachment.url = attachmentListbox.childNodes[i].getAttribute("label");
// XXX
//event.attachments.appendElement(attachment);
}
// Attach any specified contacts to the event
if( gEventCardArray )
{
try{
if (gEventCardArray) {
try {
// Remove any existing contacts
gEvent.removeContacts();
//event.contacts.clear();
// Add specified contacts
for( var cardId in gEventCardArray )
{
if( gEventCardArray[ cardId ] )
{
gEvent.addContact( gEventCardArray[ cardId ] );
for (var cardId in gEventCardArray)
if (gEventCardArray[cardId]) {
// XXX
//event.contacts.appendElement(gEventCardArray[cardId]);
}
}
}
catch( e )
catch (e)
{
}
}
@ -490,7 +466,8 @@ function onOKCommand()
// :TODO: REALLY only do this if the alarm or start settings change.?
//if the end time is later than the start time... alert the user using text from the dtd.
// call caller's on OK function
gOnOkFunction( gEvent, Server, gOriginalEvent );
gOnOkFunction(event, Server, originalEvent);
// tell standard dialog stuff to close the dialog
return true;
@ -577,25 +554,25 @@ function checkSetRecur()
function setRecurError(state)
{
document.getElementById("repeat-time-warning" ).setAttribute( "collapsed", !state);
document.getElementById("repeat-time-warning" ).setAttribute( "hidden", !state);
}
function setDateError(state)
{
document.getElementById( "end-date-warning" ).setAttribute( "collapsed", !state );
document.getElementById( "end-date-warning" ).setAttribute( "hidden", !state );
}
function setTimeError(state)
{
document.getElementById( "end-time-warning" ).setAttribute( "collapsed", !state );
document.getElementById( "end-time-warning" ).setAttribute( "hidden", !state );
}
function setOkButton(state)
{
if (state == false)
document.getElementById( "calendar-new-eventwindow" ).getButton( "accept" ).setAttribute( "disabled", true );
document.getElementById( "calendar-new-component-window" ).getButton( "accept" ).setAttribute( "disabled", true );
else
document.getElementById( "calendar-new-eventwindow" ).getButton( "accept" ).removeAttribute( "disabled" );
document.getElementById( "calendar-new-component-window" ).getButton( "accept" ).removeAttribute( "disabled" );
}
function updateOKButton()
@ -698,89 +675,9 @@ function commandAllDay()
updateOKButton();
}
/**
* Called when the alarm checkbox is clicked.
*/
function commandAlarm()
{
updateAlarmItemEnabled();
}
/**
* Enable/Disable Alarm items
*/
function updateAlarmItemEnabled()
{
var alarmCheckBox = "alarm-checkbox";
var alarmField = "alarm-length-field";
var alarmMenu = "alarm-length-units";
var alarmTrigger = "alarm-trigger-relation";
var alarmEmailCheckbox = "alarm-email-checkbox";
var alarmEmailField = "alarm-email-field";
// if( getFieldValue(alarmCheckBox, "checked" ) || getFieldValue( alarmEmailCheckbox, "checked" ) )
if( getFieldValue(alarmCheckBox, "checked" ) )
{
// call remove attribute beacuse some widget code checks for the presense of a
// disabled attribute, not the value.
setFieldValue( alarmField, false, "disabled" );
setFieldValue( alarmMenu, false, "disabled" );
setFieldValue( alarmTrigger, false, "disabled" );
setFieldValue( alarmEmailField, false, "disabled" );
setFieldValue( alarmEmailCheckbox, false, "disabled" );
}
else
{
setFieldValue( alarmField, true, "disabled" );
setFieldValue( alarmMenu, true, "disabled" );
setFieldValue( alarmTrigger, true, "disabled" );
setFieldValue( alarmEmailField, true, "disabled" );
setFieldValue( alarmEmailCheckbox, true, "disabled" );
}
}
/**
* Called when the alarm checkbox is clicked.
*/
function commandAlarmEmail()
{
updateAlarmEmailItemEnabled();
}
/**
* Enable/Disable Alarm items
*/
function updateAlarmEmailItemEnabled()
{
var alarmCheckBox = "alarm-email-checkbox";
var alarmEmailField = "alarm-email-field";
if( getFieldValue( alarmCheckBox, "checked" ) )
{
// call remove attribute beacuse some widget code checks for the presense of a
// disabled attribute, not the value.
setFieldValue( alarmEmailField, false, "disabled" );
}
else
{
setFieldValue( alarmEmailField, true, "disabled" );
}
}
/**
* Called when the alarm checkbox is clicked.
* Called when the invite checkbox is clicked.
*/
function commandInvite()
@ -883,7 +780,8 @@ function updateMenuPlural( lengthFieldId, menuId )
var newLabelNumber;
if( Number( length ) > 1 )
// XXX This assumes that "0 days, minutes, etc." is plural in other languages.
if( ( Number( length ) == 0 ) || ( Number( length ) > 1 ) )
{
newLabelNumber = "labelplural"
}
@ -997,7 +895,6 @@ function updateRepeatUnitExtensions( )
}
/**
* Enable/Disable Start/End items
*/
@ -1015,8 +912,6 @@ function updateStartEndItemEnabled()
}
/**
* Handle key down in repeat field
*/
@ -1414,22 +1309,29 @@ function setFieldValue( elementId, newValue, propertyName )
{
var undefined;
if( newValue !== undefined )
{
if( newValue !== undefined ) {
var field = document.getElementById( elementId );
if( newValue === false )
{
field.removeAttribute( propertyName );
}
else
{
if( propertyName )
{
field.setAttribute( propertyName, newValue );
if( newValue === false ) {
try {
field.removeAttribute( propertyName );
}
else
{
catch (e) {
dump("setFieldValue: field.removeAttribute couldn't remove "+propertyName+
" from "+elementId+" e: "+e+"\n");
}
}
else {
if( propertyName ) {
try {
field.setAttribute( propertyName, newValue );
}
catch (e) {
dump("setFieldValue: field.setAttribute couldn't set "+propertyName+
" from "+elementId+" to "+newValue+" e: "+e+"\n");
}
}
else {
field.value = newValue;
}
}
@ -1518,7 +1420,6 @@ function setDateFieldValue( elementId, newDate )
function setTimeFieldValue( elementId, newDate )
{
// set the value to a formatted time string
var field = document.getElementById( elementId );
field.value = formatTime( newDate );
@ -1557,3 +1458,85 @@ function debug( text )
if( debugenabled )
dump( "\n"+ text + "\n");
}
// XXX lilmatt's new crap for the new XUL
function processAlarmType()
{
var alarmMenu = document.getElementById("alarm-type");
if( alarmMenu.selectedItem ) {
dump("processAlarmType: "+alarmMenu.selectedItem.value+"\n");
switch( alarmMenu.selectedItem.value )
{
case "none":
hideElement("alarm-length-field");
hideElement("alarm-length-units");
hideElement("alarm-box-email");
break;
case "popup":
showElement("alarm-length-field");
showElement("alarm-length-units");
hideElement("alarm-box-email");
break;
case "popupAndSound":
showElement("alarm-length-field");
showElement("alarm-length-units");
hideElement("alarm-box-email");
break;
case "email":
showElement("alarm-length-field");
showElement("alarm-length-units");
showElement("alarm-box-email");
break;
}
// Make the window big enough for all the fields and widgets
window.sizeToContent();
}
else
dump("processAlarmType: no alarmMenu.selectedItem!\n");
}
function processComponentType()
{
var componentMenu = document.getElementById("component-type");
if( componentMenu.selectedItem) {
dump("processComponentType: "+componentMenu.selectedItem.value+"\n");
var args = window.arguments[0];
switch( componentMenu.selectedItem.value )
{
case "ICAL_COMPONENT_EVENT":
// Hide and show the appropriate fields and widgets
hideElement("task-status-label");
hideElement("cancelled-checkbox");
showElement("event-status-label");
showElement("event-status-field");
showElement("all-day-event-checkbox");
// Set menubar title correctly - New vs. Edit
if( "new" == args.mode )
titleDataItem = document.getElementById( "data-event-title-new" );
else
titleDataItem = document.getElementById( "data-event-title-edit" );
document.getElementById("calendar-new-component-window").setAttribute("title", titleDataItem.getAttribute( "value" ));
break;
case "ICAL_COMPONENT_TODO":
// Hide and show the appropriate fields and widgets
hideElement("event-status-label");
hideElement("event-status-field");
hideElement("all-day-event-checkbox");
showElement("task-status-label");
showElement("cancelled-checkbox");
// Set menubar title correctly - New vs. Edit
if( "new" == args.mode )
titleDataItem = document.getElementById( "data-event-title-new" );
else
titleDataItem = document.getElementById( "data-event-title-edit" );
document.getElementById("calendar-new-component-window").setAttribute("title", titleDataItem.getAttribute( "value" ));
break;
//case "ICAL_COMPONENT_JOURNAL":
}
// Make the window big enough for all the fields and widgets
window.sizeToContent();
}
else
dump("processComponentType: no componentMenu.selectedItem!\n");
}

View File

@ -25,6 +25,7 @@
- Chris Charabaruk <ccharabaruk@meldstar.com>
- ArentJan Banck <ajbanck@planet.nl>
- Mostafa Hosseini <mostafah@oeone.com>
- Matthew Willis <mattwillis@gmail.com>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
@ -60,13 +61,14 @@
<dialog
id="calendar-new-eventwindow"
title="Calendar Event"
id="calendar-new-component-window"
title="Calendar Component"
onload="loadCalendarEventDialog()"
buttons="accept,cancel"
ondialogaccept="return onOKCommand();"
ondialogcancel="return true;"
persist="screenX screenY"
minwidth="490"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:nc="http://home.netscape.com/NC-rdf#">
@ -74,9 +76,6 @@
<stringbundle id="bundle_calendar" src="chrome://calendar/locale/calendar.properties"/>
</stringbundleset>
<!-- Javascript DTD To Variable -->
<script type="application/x-javascript" src="chrome://communicator/content/utilityOverlay.js"/>
<script type="application/x-javascript">
var DTD_noEmailMessage = "&ab-selectAddressesDialogNoEmailMessage.label;";
var DTD_toPrefix = "&ab-selectAddressesDialogPrefixTo.label;";
@ -108,6 +107,8 @@
<dataset>
<data id="data-event-title-new" value="&event.title.new;" />
<data id="data-event-title-edit" value="&event.title.edit;" />
<data id="data-event-title-new" value="&todo.title.new;" />
<data id="data-event-title-edit" value="&todo.title.edit;" />
<data id="onthe-text" value="&onthe-text;" />
<data id="last-text" value="&last-text;" />
<data id="ofthemonth-text" value="&ofthemonth-text;" />
@ -116,423 +117,469 @@
<!-- Dialog content -->
<tabbox>
<tabs>
<tab label="&newevent.newevent.tab.label;"/>
<tab label="&newevent.recurrence.tab.label;"/>
<tab label="&newevent.contacts.tab.label;" hidden="true"/>
<tab label="&newevent.files.tab.label;" hidden="true"/>
</tabs>
<tabpanels>
<tabpanel>
<grid>
<columns>
<column />
<column flex="1"/>
</columns>
<rows>
<!-- Title -->
<row align="center">
<hbox class="field-label-box-class" pack="end">
<label for="title-field" value="&newevent.title.label;"/>
</hbox>
<textbox id="title-field"/>
</row>
<!-- Location -->
<row align="center">
<hbox class="field-label-box-class" pack="end">
<label for="location-field" value="&newevent.location.label;"/>
</hbox>
<textbox id="location-field"/>
</row>
<!-- Start Date -->
<row align="center">
<hbox class="field-label-box-class" pack="end">
<label value="&newevent.startdate.label;"/>
</hbox>
<datetimepicker id="start-datetime" value=""
onchange="onDateTimePick( this );"/>
</row>
<!-- End Date -->
<row align="center">
<hbox class="field-label-box-class" pack="end">
<label value="&newevent.enddate.label;"/>
</hbox>
<datetimepicker id="end-datetime" value=""
onchange="onDateTimePick( this );"/>
</row>
<!-- End Time Warning -->
<row align="center">
<spacer />
<label id="end-time-warning"
class="warning-text-class"
value="&newevent.endtime.warning;"
collapsed="true"/>
</row>
<!-- End Date Warning -->
<row align="center">
<spacer />
<label id="end-date-warning"
class="warning-text-class"
value="&newevent.enddate.warning;"
collapsed="true"/>
</row>
<!-- All Day -->
<row align="center">
<spacer />
<checkbox id="all-day-event-checkbox"
label="&newevent.alldayevent.label;"
oncommand="commandAllDay()"
persist="checked"/>
</row>
<!-- Description -->
<row flex="1" align="start">
<hbox class="field-label-box-class" pack="end">
<label for="description-field" value="&newevent.description.label;"/>
</hbox>
<textbox id="description-field"
multiline="true"
rows="3"
cols="30" />
</row>
<!-- URI/URL -->
<row align="center">
<hbox class="field-label-box-class" pack="end">
<label for="uri-field" value="&newevent.uri.label;"/>
</hbox>
<hbox>
<textbox id="uri-field"
#ifndef MOZ_SUNBIRD
type="autocomplete"
searchSessions="history"
#endif
flex="1"/>
<button label="&newevent.uri.visit.label;"
oncommand="loadURL()"/>
</hbox>
</row>
<!-- Private -->
<row align="center">
<spacer />
<checkbox id="private-checkbox"
checked="false"
label="&newevent.private.label;"/>
</row>
<!-- Alarm -->
<row align="center">
<spacer />
<vbox>
<hbox id="alarm-box" align="center">
<checkbox id="alarm-checkbox"
class="proper-align"
label="&newevent.alarm.label;"
checked="false"
oncommand="commandAlarm()"/>
<textbox id="alarm-length-field" oninput="alarmLengthKeyDown( this )"/>
<menulist id="alarm-length-units" crop="none" labelnumber="labelplural">
<menupopup>
<menuitem label="&alarm.units.minutes;"
labelplural="&alarm.units.minutes;"
labelsingular="&alarm.units.minutes.singular;"
value="minutes"/>
<menuitem label="&alarm.units.hours;"
labelplural="&alarm.units.hours;"
labelsingular="&alarm.units.hours.singular;"
value="hours" />
<menuitem label="&alarm.units.days;"
labelplural="&alarm.units.days;"
labelsingular="&alarm.units.days.singular;"
value="days"/>
</menupopup>
</menulist>
<menulist id="alarm-trigger-relation" crop="none">
<menupopup>
<menuitem label="&newevent.beforealarm.label;"
value="ICAL_RELATED_START"/>
<menuitem label="&newevent.beforealarmends.label;"
value="ICAL_RELATED_END"/>
</menupopup>
</menulist>
</hbox>
<hbox id="alarm-box-email" align="center">
<spacer width="15"/>
<checkbox id="alarm-email-checkbox"
label="&newevent.email.label;"
checked="false"
oncommand="commandAlarmEmail()"/>
<textbox id="alarm-email-field"
#ifndef MOZ_SUNBIRD
type="autocomplete"
searchSessions="addrbook"
#endif
size="39"
value="" />
</hbox>
</vbox>
</row>
<!-- Status -->
<row align="center">
<hbox class="field-label-box-class" pack="end">
<label value="&newevent.status.longlabel;"/>
</hbox>
<menulist id="status-field" label="&newevent.status.label;">
<menupopup id="status-menulist-menupopup">
<menuitem label="&newevent.status.tentative.label;"
value="ICAL_STATUS_TENTATIVE"/>
<menuitem label="&newevent.status.confirmed.label;"
value="ICAL_STATUS_CONFIRMED"/>
<menuitem label="&newevent.status.cancelled.label;"
value="ICAL_STATUS_CANCELLED"/>
</menupopup>
</menulist>
</row>
<!-- Categories -->
<row align="center">
<hbox class="field-label-box-class" pack="end">
<label value="&newtodo.categories.label;"/>
</hbox>
<menulist id="categories-field" label="&newevent.category.label;">
<menupopup id="categories-menulist-menupopup">
<menuitem label="&priority.level.none;" value="0"/>
</menupopup>
</menulist>
</row>
<!-- Calendar Server -->
<row align="center">
<hbox class="field-label-box-class" pack="end">
<label id="server-field-label" value="&newevent.server.label;"/>
</hbox>
<menulist id="server-field">
<menupopup id="server-menulist-menupopup"
datasources="rdf:null"
ref="urn:calendarcontainer">
<template>
<rule>
<menuitem uri="rdf:*"
value="rdf:http://home.netscape.com/NC-rdf#path"
label="rdf:http://home.netscape.com/NC-rdf#name"/>
</rule>
</template>
</menupopup>
</menulist>
</row>
</rows>
</grid>
</tabpanel>
<!-- Repeat -->
<tabpanel>
<vbox>
<hbox id="repeat-box" align="center">
<checkbox id="repeat-checkbox"
class="proper-align"
label="&newevent.repeat.label;"
checked="false"
oncommand="commandRepeat();commandUntil()"/>
<textbox id="repeat-length-field"
class="cursor-pointer"
disable-controller="repeat"
value=""
oninput="repeatLengthKeyDown( this )"/>
<menulist crop="none"
oncommand="repeatUnitCommand( this )"
labelnumber="labelplural"
id="repeat-length-units"
disable-controller="repeat">
<menupopup>
<menuitem label="&repeat.units.days;"
labelplural="&repeat.units.days;"
labelsingular="&repeat.units.days.singular;"
id="repeat-length-days"
value="days" />
<menuitem label="&repeat.units.weeks;"
labelplural="&repeat.units.weeks;"
labelsingular="&repeat.units.weeks.singular;"
id="repeat-length-weeks"
value="weeks"/>
<menuitem label="&repeat.units.months;"
labelplural="&repeat.units.months;"
labelsingular="&repeat.units.months.singular;"
id="repeat-length-months"
value="months"/>
<menuitem label="&repeat.units.years;"
labelplural="&repeat.units.years;"
labelsingular="&repeat.units.years.singular;"
id="repeat-length-years"
value="years" />
</menupopup>
</menulist>
<tabbox>
<tabs>
<!-- XXX label="&newevent.newevent.tab.label;" -->
<tab label="General"/>
<tab label="&newevent.recurrence.tab.label;"/>
<!-- XXX label="&newevent.contacts.tab.label;" -->
<tab label="Attendees"/>
<!-- XXX label="&newevent.files.tab.label;" -->
<tab label="Attachments"/>
<tab label="Advanced"/>
</tabs>
<tabpanels>
<tabpanel>
<vbox flex="1">
<hbox flex="1">
<groupbox flex="1">
<caption label="General Settings"/>
<grid>
<columns>
<column />
<column flex="1"/>
</columns>
<rows>
<row align="center">
<!-- Item Type -->
<hbox pack="end">
<label for="component-type" value="Item Type"/>
</hbox>
<hbox id="repeat-extenstions-week"
disabled="true"
disable-controller="repeat"
collapsed="false"
align="center">
<checkbox disable-controller="repeat"
class="repeat-day-class"
label="&day.1.Ddd;"
id="advanced-repeat-week-0"
value="0"
checked="false" />
<checkbox disable-controller="repeat"
class="repeat-day-class"
label="&day.2.Ddd;"
id="advanced-repeat-week-1"
value="1"
checked="false" />
<checkbox disable-controller="repeat"
class="repeat-day-class"
label="&day.3.Ddd;"
id="advanced-repeat-week-2"
value="2"
checked="false" />
<checkbox disable-controller="repeat"
class="repeat-day-class"
label="&day.4.Ddd;"
id="advanced-repeat-week-3"
value="3"
checked="false" />
<checkbox disable-controller="repeat"
class="repeat-day-class"
label="&day.5.Ddd;"
id="advanced-repeat-week-4"
value="4"
checked="false" />
<checkbox disable-controller="repeat"
class="repeat-day-class"
label="&day.6.Ddd;"
id="advanced-repeat-week-5"
value="5"
checked="false" />
<checkbox disable-controller="repeat"
class="repeat-day-class"
label="&day.7.Ddd;"
id="advanced-repeat-week-6"
value="6"
checked="false" />
</hbox>
<hbox id="repeat-extenstions-month"
disabled="true"
collapsed="true"
align="center">
<vbox align="center">
<radiogroup id="advanced-repeat-month"
disable-controller="repeat">
<radio disable-controller="repeat"
id="advanced-repeat-dayofmonth"
label="&newevent.advanced.repeat.dayofmonth.label;"
selected="true"/>
<radio disable-controller="repeat"
id="advanced-repeat-dayofweek"
label="&newevent.advanced.repeat.dayofweek.label;"/>
<radio disable-controller="repeat"
id="advanced-repeat-dayofweek-last"
label="&newevent.advanced.repeat.lastdayofweek.label;"
<hbox>
<menulist id="component-type" crop="none" oncommand="processComponentType()">
<menupopup id="component-menulist-menupopup">
<menuitem label="Event" value="ICAL_COMPONENT_EVENT"/>
<menuitem label="Task" value="ICAL_COMPONENT_TODO"/>
<menuitem label="Journal" value="ICAL_COMPONENT_JOURNAL"
disabled="true"/>
</radiogroup>
</vbox>
</menupopup>
</menulist>
<spacer width="10px"/>
<!-- Calendar Server &newevent.server.label; -->
<hbox align="center" flex="1">
<label id="server-field-label" value="Calendar"/>
<menulist id="server-field">
<menupopup id="server-menulist-menupopup" datasources="rdf:null"
ref="urn:calendarcontainer">
<template>
<rule>
<menuitem uri="rdf:*"
value="rdf:http://home.netscape.com/NC-rdf#path"
label="rdf:http://home.netscape.com/NC-rdf#name"/>
</rule>
</template>
</menupopup>
</menulist>
</hbox>
</hbox>
<spacer height="10" />
<hbox align="center">
<spacer class="repeat-left-spacer" />
<radiogroup id="repeat-until-group"
disable-controller="repeat">
<radio id="repeat-forever-radio"
disable-controller="repeat"
label="&newevent.forever.label;"
oncommand="commandUntil()"/>
<hbox>
<radio id="repeat-numberoftimes-radio"
disable-controller="repeat"
label="&newevent.numberoftimes.label;"
oncommand="commandUntil()"/>
<textbox id="repeat-numberoftimes-textbox"
disable-controller="repeat"/>
</hbox>
<hbox>
<radio id="repeat-until-radio"
disable-controller="repeat"
label="&newevent.until.label;"
oncommand="commandUntil()"/>
<spacer id="until-spacer"/>
<datepicker id="repeat-end-date-picker"
disable-controller="repeat"
value=""
onchange="commandUntil()"/>
</hbox>
<label id="repeat-time-warning"
class="warning-text-class"
value="&newevent.recurend.warning;"
collapsed="true"/>
</radiogroup>
</row>
<!-- Title -->
<row align="center">
<hbox pack="end">
<label for="title-field" value="&newevent.title.label;"/>
</hbox>
<hbox align="center">
<spacer class="repeat-left-spacer" />
<groupbox>
<caption label="&newevent.exceptions.caption;"/>
<grid>
<columns>
<column flex="1"/>
<column/>
</columns>
<rows>
<row>
<hbox align="center">
<datepicker id="exceptions-date-picker"
disable-controller="repeat"
onchange="updateAddExceptionButton();"
value=""/>
</hbox>
<button id="exception-add-button"
label="&newevent.addexceptions.label;"
disable-controller="repeat"
oncommand="addException()"/>
</row>
<row>
<listbox id="exception-dates-listbox"
disable-controller="repeat"
rows="4"/>
<vbox>
<button label="&newevent.deleteexceptions.label;"
disable-controller="repeat"
oncommand="removeSelectedExceptionDate()"/>
</vbox>
</row>
</rows>
</grid>
</groupbox>
<textbox id="title-field"/>
</row>
<!-- Location -->
<row align="center">
<hbox pack="end">
<label for="location-field" value="&newevent.location.label;"/>
</hbox>
</vbox>
</tabpanel><!-- /Repeat -->
<textbox id="location-field"/>
</row>
<row align="center">
<!-- Status -->
<hbox pack="end">
<label id="event-status-label" for="event-status-menulist-menupopup"
value="&newevent.status.label;" hidden="true"/>
<label id="task-status-label" for="cancelled-checkbox"
value="&newtodo.status.label;" hidden="true"/>
</hbox>
<hbox>
<menulist id="event-status-field" label="&newevent.status.label;"
hidden="true">
<menupopup id="event-status-menulist-menupopup">
<menuitem label="None"/>
<menuitem label="&newevent.status.tentative.label;"
value="ICAL_STATUS_TENTATIVE"/>
<menuitem label="&newevent.status.confirmed.label;"
value="ICAL_STATUS_CONFIRMED"/>
<menuitem label="&newevent.status.cancelled.label;"
value="ICAL_STATUS_CANCELLED"/>
</menupopup>
</menulist>
<checkbox id="cancelled-checkbox" label="&newtodo.cancelled.label;"
checked="false" hidden="true"/>
<spacer width="10px"/>
<!-- Categories -->
<hbox align="center">
<label for="categories-menulist-menupopup" value="&newtodo.categories.label;"/>
<menulist id="categories-field" label="&newevent.category.label;">
<menupopup id="categories-menulist-menupopup">
<menuitem label="&priority.level.none;" value="0"/>
</menupopup>
</menulist>
</hbox>
</hbox>
</row>
</rows>
</grid>
<hbox>
<separator class="thin"/>
</hbox>
</groupbox>
</hbox>
<hbox flex="1">
<!-- Schedule -->
<groupbox flex="1">
<caption label="Schedule"/>
<hbox>
<checkbox id="all-day-event-checkbox" label="&newevent.alldayevent.label;"
oncommand="commandAllDay()" persist="checked" hidden="true"/>
</hbox>
<separator class="thin"/>
<hbox>
<grid>
<columns>
<column/>
<column/>
</columns>
<rows>
<row>
<hbox pack="end" align="center">
<label class="field-label-box-class" value="From"/>
</hbox>
<hbox flex="1">
<datetimepicker id="start-datetime" value="" onchange="onDateTimePick( this );"/>
<spacer flex="1"/>
</hbox>
</row>
<row>
<hbox pack="end" align="center">
<label value="To"/>
</hbox>
<hbox flex="1">
<datetimepicker id="end-datetime" value="" onchange="onDateTimePick( this );"/>
<spacer flex="1"/>
</hbox>
</row>
<!-- Invalid end date/time warnings -->
<row align="center">
<spacer />
<label id="end-time-warning" class="warning-text-class"
value="&newevent.endtime.warning;" hidden="true"/>
</row>
<row align="center">
<spacer />
<label id="end-date-warning" class="warning-text-class"
value="&newevent.enddate.warning;" hidden="true"/>
</row>
<!-- Invalid due date/time warnings -->
<row align="center">
<spacer />
<label id="due-time-warning" class="warning-text-class"
value="&newtodo.duetime.warning;" hidden="true"/>
</row>
<row align="center">
<spacer />
<label id="due-date-warning" class="warning-text-class"
value="&newtodo.duedate.warning;" hidden="true"/>
</row>
</rows>
</grid>
</hbox>
<hbox>
<separator class="thin"/>
</hbox>
</groupbox>
</hbox>
<!-- Alarm -->
<hbox flex="1">
<groupbox flex="1">
<caption label="Alarm"/>
<hbox>
<vbox>
<menulist id="alarm-type" crop="none" oncommand="processAlarmType()">
<menupopup>
<menuitem label="None" value="none"/>
<menuitem label="Popup" value="popup"/>
<menuitem label="Popup &amp; Play Sound" value="popupAndSound"
disabled="true"/>
<menuitem label="Send Email" value="email"/>
</menupopup>
</menulist>
</vbox>
<vbox>
<textbox id="alarm-length-field" size="5" maxlength="3" oninput="alarmLengthKeyDown( this )"/>
</vbox>
<vbox>
<menulist id="alarm-length-units" crop="none" labelnumber="labelplural">
<menupopup>
<menuitem label="minutes before this begins"
labelplural="minutes before this begins"
labelsingular="minute before this begins"
value="minutes"/>
<menuitem label="hours before this begins"
labelplural="hours before this begins"
labelsingular="hour before this begins"
value="hours" />
<menuitem label="days before this begins"
labelplural="days before this begins"
labelsingular="day before this begins"
value="days"/>
<menuitem label="minutes before this ends"
labelplural="minutes before this ends"
labelsingular="minute before this ends"
value="minutes"/>
<menuitem label="hours before this ends"
labelplural="hours before this ends"
labelsingular="hour before this ends"
value="hours" />
<menuitem label="days before this ends"
labelplural="days before this ends"
labelsingular="day before this ends"
value="days"/>
<!-- XXX original code for fixing localization
<menuitem label="&alarm.units.minutes;"
labelplural="&alarm.units.minutes;"
labelsingular="&alarm.units.minutes.singular;"
value="minutes"/>
<menuitem label="&alarm.units.hours;"
labelplural="&alarm.units.hours;"
labelsingular="&alarm.units.hours.singular;"
value="hours" />
<menuitem label="&alarm.units.days;"
labelplural="&alarm.units.days;"
labelsingular="&alarm.units.days.singular;"
value="days"/>
<menuitem label="&newevent.beforealarm.label;"
value="ICAL_RELATED_START"/>
<menuitem label="&newevent.beforealarmends.label;"
value="ICAL_RELATED_END"/>
-->
</menupopup>
</menulist>
</vbox>
</hbox>
<hbox id="alarm-box-email" align="center">
<!-- XXX &newevent.email.label; -->
<label class="field-label-box-class" for="alarm-email-field" value="Send email to:"/>
<!-- XXX oncommand="commandAlarmEmail()"/> -->
<textbox id="alarm-email-field"
#ifndef MOZ_SUNBIRD
type="autocomplete"
searchSessions="addrbook"
#endif
size="40"
value=""
hidden="false"/>
</hbox>
<hbox>
<textbox id="alarm-trigger-relation" hidden="true"/>
</hbox>
<hbox>
<separator class="thin"/>
</hbox>
</groupbox>
</hbox>
<hbox flex="10"/> <!-- Creates white space at bottom of dialog -->
</vbox>
</tabpanel>
<!-- Repeat -->
<tabpanel>
<vbox flex="1">
<hbox flex="1">
<groupbox flex="1">
<caption label="Recurrence"/>
<hbox id="repeat-box" align="center">
<checkbox id="repeat-checkbox"
class="proper-align"
label="&newevent.repeat.label;"
checked="false"
oncommand="commandRepeat();commandUntil()"/>
<textbox id="repeat-length-field"
class="cursor-pointer"
disable-controller="repeat"
value=""
oninput="repeatLengthKeyDown( this )"/>
<menulist crop="none"
oncommand="repeatUnitCommand( this )"
labelnumber="labelplural"
id="repeat-length-units"
disable-controller="repeat">
<menupopup>
<menuitem label="&repeat.units.days;"
labelplural="&repeat.units.days;"
labelsingular="&repeat.units.days.singular;"
id="repeat-length-days"
value="days" />
<menuitem label="&repeat.units.weeks;"
labelplural="&repeat.units.weeks;"
labelsingular="&repeat.units.weeks.singular;"
id="repeat-length-weeks"
value="weeks"/>
<menuitem label="&repeat.units.months;"
labelplural="&repeat.units.months;"
labelsingular="&repeat.units.months.singular;"
id="repeat-length-months"
value="months"/>
<menuitem label="&repeat.units.years;"
labelplural="&repeat.units.years;"
labelsingular="&repeat.units.years.singular;"
id="repeat-length-years"
value="years" />
</menupopup>
</menulist>
</hbox>
<hbox id="repeat-extenstions-week"
disabled="true"
disable-controller="repeat"
collapsed="false"
align="center">
<checkbox disable-controller="repeat"
class="repeat-day-class"
label="&day.1.Ddd;"
id="advanced-repeat-week-0"
value="0"
checked="false" />
<checkbox disable-controller="repeat"
class="repeat-day-class"
label="&day.2.Ddd;"
id="advanced-repeat-week-1"
value="1"
checked="false" />
<checkbox disable-controller="repeat"
class="repeat-day-class"
label="&day.3.Ddd;"
id="advanced-repeat-week-2"
value="2"
checked="false" />
<checkbox disable-controller="repeat"
class="repeat-day-class"
label="&day.4.Ddd;"
id="advanced-repeat-week-3"
value="3"
checked="false" />
<checkbox disable-controller="repeat"
class="repeat-day-class"
label="&day.5.Ddd;"
id="advanced-repeat-week-4"
value="4"
checked="false" />
<checkbox disable-controller="repeat"
class="repeat-day-class"
label="&day.6.Ddd;"
id="advanced-repeat-week-5"
value="5"
checked="false" />
<checkbox disable-controller="repeat"
class="repeat-day-class"
label="&day.7.Ddd;"
id="advanced-repeat-week-6"
value="6"
checked="false" />
</hbox>
<hbox id="repeat-extenstions-month"
disabled="true"
collapsed="true"
align="center">
<vbox align="center">
<radiogroup id="advanced-repeat-month"
disable-controller="repeat">
<radio disable-controller="repeat"
id="advanced-repeat-dayofmonth"
label="&newevent.advanced.repeat.dayofmonth.label;"
selected="true"/>
<radio disable-controller="repeat"
id="advanced-repeat-dayofweek"
label="&newevent.advanced.repeat.dayofweek.label;"/>
<radio disable-controller="repeat"
id="advanced-repeat-dayofweek-last"
label="&newevent.advanced.repeat.lastdayofweek.label;"
disabled="true"/>
</radiogroup>
</vbox>
</hbox>
<spacer height="10" />
<hbox align="center">
<spacer class="repeat-left-spacer" />
<radiogroup id="repeat-until-group"
disable-controller="repeat">
<radio id="repeat-forever-radio"
disable-controller="repeat"
label="&newevent.forever.label;"
oncommand="commandUntil()"/>
<hbox>
<radio id="repeat-numberoftimes-radio"
disable-controller="repeat"
label="&newevent.numberoftimes.label;"
oncommand="commandUntil()"/>
<textbox id="repeat-numberoftimes-textbox"
disable-controller="repeat"/>
</hbox>
<hbox>
<radio id="repeat-until-radio"
disable-controller="repeat"
label="&newevent.until.label;"
oncommand="commandUntil()"/>
<spacer id="until-spacer"/>
<datepicker id="repeat-end-date-picker"
disable-controller="repeat"
value=""
onchange="commandUntil()"/>
</hbox>
<label id="repeat-time-warning"
class="warning-text-class"
value="&newevent.recurend.warning;"
hidden="true"/>
</radiogroup>
</hbox>
</groupbox>
</hbox>
<hbox flex="1">
<spacer class="repeat-left-spacer" />
<groupbox flex="1">
<caption label="&newevent.exceptions.caption;"/>
<grid>
<columns>
<column flex="1"/>
<column/>
</columns>
<rows>
<row>
<hbox align="center">
<datepicker id="exceptions-date-picker"
disable-controller="repeat"
onchange="updateAddExceptionButton();"
value=""/>
</hbox>
<button id="exception-add-button"
label="&newevent.addexceptions.label;"
disable-controller="repeat"
oncommand="addException()"/>
</row>
<row>
<listbox id="exception-dates-listbox"
disable-controller="repeat"
rows="4"/>
<vbox>
<button label="&newevent.deleteexceptions.label;"
disable-controller="repeat"
oncommand="removeSelectedExceptionDate()"/>
</vbox>
</row>
</rows>
</grid>
</groupbox>
</hbox>
</vbox>
</tabpanel><!-- /Repeat -->
<!-- Contacts panel -->
<tabpanel orient="vertical" hidden="true">
<tabpanel orient="vertical">
<!-- Invite -->
<vbox collapsed="true">
<hbox id="invite-box" align="center">
@ -551,7 +598,7 @@
<label value="&ab-selectAddressesDialogLookIn.label;" />
<!-- Address book chooser -->
<menulist id="addressBookList" oncommand="onChooseAddressBookEventDialog( this );">
<!-- <menulist id="addressBookList" oncommand="onChooseAddressBookEventDialog( this );">
<menupopup id="addressBookList-menupopup"
ref="moz-abdirectory://"
datasources="rdf:addressdirectory">
@ -563,7 +610,7 @@
</rule>
</template>
</menupopup>
</menulist>
</menulist>-->
</hbox>
<hbox flex="1">
@ -655,6 +702,59 @@
<spacer flex="1"/>
</vbox>
</tabpanel>
<!-- "Advanced" tab -->
<tabpanel>
<grid>
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<!-- URI/URL -->
<row align="center" flex="1">
<hbox class="field-label-box-class" pack="end">
<label for="uri-field" value="&newevent.uri.label;"/>
</hbox>
<hbox>
<textbox id="uri-field"
#ifndef MOZ_SUNBIRD
type="autocomplete"
searchSessions="history"
#endif
flex="1"/>
<button label="&newevent.uri.visit.label;"
oncommand="loadURL()"/>
</hbox>
</row>
<!-- Private -->
<row align="center" flex="1">
<spacer />
<checkbox id="private-checkbox"
checked="false"
label="&newevent.private.label;"/>
</row>
<!-- Description -->
<row flex="1" align="start">
<hbox class="field-label-box-class" pack="end">
<label for="description-field" value="&newevent.description.label;"/>
</hbox>
<textbox id="description-field"
multiline="true"
rows="3"
cols="30"
flex="1" />
</row>
</rows>
</grid>
</tabpanel>
</tabpanels>
</tabbox>
</dialog>