From 613da1e5f2fbe20b07f27ce89a529ef04054b1e4 Mon Sep 17 00:00:00 2001 From: "mikep%oeone.com" Date: Fri, 16 Nov 2001 18:50:06 +0000 Subject: [PATCH] XUL changes and alerts working for calendar events --- calendar/resources/content/alertDialog.js | 34 ++++++----- calendar/resources/content/alertDialog.xul | 4 +- .../content/calendarEventAlertDialog.js | 34 ++++++----- .../content/calendarEventAlertDialog.xul | 4 +- .../resources/content/calendarEventDialog.js | 27 +++++++++ .../resources/content/calendarEventDialog.xul | 13 ++--- calendar/resources/content/eventDialog.js | 27 +++++++++ calendar/resources/content/eventDialog.xul | 13 ++--- .../content/penglobal/calendarEvent.js | 57 +++++-------------- calendar/resources/content/unifinder.js | 5 +- 10 files changed, 125 insertions(+), 93 deletions(-) diff --git a/calendar/resources/content/alertDialog.js b/calendar/resources/content/alertDialog.js index 6ab87e52385f..136db8f30e41 100644 --- a/calendar/resources/content/alertDialog.js +++ b/calendar/resources/content/alertDialog.js @@ -41,14 +41,17 @@ var gCalendarEvent = null; function onLoad() { gCalendarEvent = window.arguments[0]; + createAlarmText( gCalendarEvent ); - setupOkCancelButtons( onOkButton, 0 ); + + doSetOKCancel( onOkButton, 0 ); + window.resizeTo( 455, 150 ); } function createAlarmText( ) { - var Text = opener.penapplication.username+" has an event titled "+gCalendarEvent.title; + var Text = "You have an event titled "+gCalendarEvent.title; var TextBox = document.getElementById( "event-message-box" ); var HtmlInBox = document.createElement( "description" ); var TextInBox = document.createTextNode( Text ); @@ -65,17 +68,17 @@ function createAlarmText( ) function onOkButton( ) { - var RemindCheckbox = document.getElementById( "remind-again-checkbox" ); + //var RemindCheckbox = document.getElementById( "remind-again-checkbox" ); - if ( RemindCheckbox.getAttribute( "checked" ) == "true" ) - { - snoozeAlarm(); - } - else - { - acknowledgeAlarm(); - } - return( true ); + //if ( RemindCheckbox.getAttribute( "checked" ) == "true" ) + //{ + // snoozeAlarm(); + //} + //else + //{ + return( acknowledgeAlarm() ); + //} + } function acknowledgeAlarm( ) @@ -86,11 +89,13 @@ function acknowledgeAlarm( ) //opener.gEventSource.modifyEvent( gCalendarEvent ); - pendialog.getRoot().Root.gCalendarEventDataSource.respondAcknowledgeAlarm( gCalendarEvent ); + //pendialog.getRoot().Root.gCalendarEventDataSource.respondAcknowledgeAlarm( gCalendarEvent ); return( true ); } +/* Currently not supported. */ +/* function snoozeAlarm( ) { gCalendarEvent.alarmWentOff = true; @@ -103,8 +108,6 @@ function snoozeAlarm( ) snoozeTime = parseInt( snoozeTime ); - //alert( snoozeTime ); - gCalendarEvent.snoozeTime = snoozeTime; gCalendarEvent.setUpAlarmTimer( this ); @@ -115,3 +118,4 @@ function snoozeAlarm( ) return( true ); } +*/ diff --git a/calendar/resources/content/alertDialog.xul b/calendar/resources/content/alertDialog.xul index 3af27494fa0f..2a868566d458 100644 --- a/calendar/resources/content/alertDialog.xul +++ b/calendar/resources/content/alertDialog.xul @@ -37,7 +37,7 @@ - ***** END LICENSE BLOCK ***** --> - + @@ -88,7 +88,7 @@ - + &event.tip.alert; diff --git a/calendar/resources/content/calendarEventAlertDialog.js b/calendar/resources/content/calendarEventAlertDialog.js index 6ab87e52385f..136db8f30e41 100644 --- a/calendar/resources/content/calendarEventAlertDialog.js +++ b/calendar/resources/content/calendarEventAlertDialog.js @@ -41,14 +41,17 @@ var gCalendarEvent = null; function onLoad() { gCalendarEvent = window.arguments[0]; + createAlarmText( gCalendarEvent ); - setupOkCancelButtons( onOkButton, 0 ); + + doSetOKCancel( onOkButton, 0 ); + window.resizeTo( 455, 150 ); } function createAlarmText( ) { - var Text = opener.penapplication.username+" has an event titled "+gCalendarEvent.title; + var Text = "You have an event titled "+gCalendarEvent.title; var TextBox = document.getElementById( "event-message-box" ); var HtmlInBox = document.createElement( "description" ); var TextInBox = document.createTextNode( Text ); @@ -65,17 +68,17 @@ function createAlarmText( ) function onOkButton( ) { - var RemindCheckbox = document.getElementById( "remind-again-checkbox" ); + //var RemindCheckbox = document.getElementById( "remind-again-checkbox" ); - if ( RemindCheckbox.getAttribute( "checked" ) == "true" ) - { - snoozeAlarm(); - } - else - { - acknowledgeAlarm(); - } - return( true ); + //if ( RemindCheckbox.getAttribute( "checked" ) == "true" ) + //{ + // snoozeAlarm(); + //} + //else + //{ + return( acknowledgeAlarm() ); + //} + } function acknowledgeAlarm( ) @@ -86,11 +89,13 @@ function acknowledgeAlarm( ) //opener.gEventSource.modifyEvent( gCalendarEvent ); - pendialog.getRoot().Root.gCalendarEventDataSource.respondAcknowledgeAlarm( gCalendarEvent ); + //pendialog.getRoot().Root.gCalendarEventDataSource.respondAcknowledgeAlarm( gCalendarEvent ); return( true ); } +/* Currently not supported. */ +/* function snoozeAlarm( ) { gCalendarEvent.alarmWentOff = true; @@ -103,8 +108,6 @@ function snoozeAlarm( ) snoozeTime = parseInt( snoozeTime ); - //alert( snoozeTime ); - gCalendarEvent.snoozeTime = snoozeTime; gCalendarEvent.setUpAlarmTimer( this ); @@ -115,3 +118,4 @@ function snoozeAlarm( ) return( true ); } +*/ diff --git a/calendar/resources/content/calendarEventAlertDialog.xul b/calendar/resources/content/calendarEventAlertDialog.xul index 3af27494fa0f..2a868566d458 100644 --- a/calendar/resources/content/calendarEventAlertDialog.xul +++ b/calendar/resources/content/calendarEventAlertDialog.xul @@ -37,7 +37,7 @@ - ***** END LICENSE BLOCK ***** --> - + @@ -88,7 +88,7 @@ - + &event.tip.alert; diff --git a/calendar/resources/content/calendarEventDialog.js b/calendar/resources/content/calendarEventDialog.js index 42a6f3acbae7..715f96be256d 100644 --- a/calendar/resources/content/calendarEventDialog.js +++ b/calendar/resources/content/calendarEventDialog.js @@ -655,6 +655,33 @@ function updateUntilItemEnabled() } +/* +** Just a silly idea I had to update the repeat menu items so they always show the right word +*/ +/* +function updateRepeatLength() +{ + RepeatLengthTextBox = document.getElementById( "repeat-length-field" ); + + if( RepeatLengthTextBox.value == "1" ) + { + document.getElementById( "repeat-days-menu-item" ).setAttribute( "label", "Day" ); + document.getElementById( "repeat-weeks-menu-item" ).setAttribute( "label", "Week" ); + document.getElementById( "repeat-months-menu-item" ).setAttribute( "label", "Month" ); + document.getElementById( "repeat-years-menu-item" ).setAttribute( "label", "Year" ); + } + else + { + document.getElementById( "repeat-days-menu-item" ).setAttribute( "label", "Days" ); + document.getElementById( "repeat-weeks-menu-item" ).setAttribute( "label", "Weeks" ); + document.getElementById( "repeat-months-menu-item" ).setAttribute( "label", "Months" ); + document.getElementById( "repeat-years-menu-item" ).setAttribute( "label", "Years" ); + + } +} +*/ + + /** * Enable/Disable Start/End items */ diff --git a/calendar/resources/content/calendarEventDialog.xul b/calendar/resources/content/calendarEventDialog.xul index 3bc6e8696a91..86ddcc72c4bd 100644 --- a/calendar/resources/content/calendarEventDialog.xul +++ b/calendar/resources/content/calendarEventDialog.xul @@ -258,20 +258,19 @@ - - + - + - - - - + + + + diff --git a/calendar/resources/content/eventDialog.js b/calendar/resources/content/eventDialog.js index 42a6f3acbae7..715f96be256d 100644 --- a/calendar/resources/content/eventDialog.js +++ b/calendar/resources/content/eventDialog.js @@ -655,6 +655,33 @@ function updateUntilItemEnabled() } +/* +** Just a silly idea I had to update the repeat menu items so they always show the right word +*/ +/* +function updateRepeatLength() +{ + RepeatLengthTextBox = document.getElementById( "repeat-length-field" ); + + if( RepeatLengthTextBox.value == "1" ) + { + document.getElementById( "repeat-days-menu-item" ).setAttribute( "label", "Day" ); + document.getElementById( "repeat-weeks-menu-item" ).setAttribute( "label", "Week" ); + document.getElementById( "repeat-months-menu-item" ).setAttribute( "label", "Month" ); + document.getElementById( "repeat-years-menu-item" ).setAttribute( "label", "Year" ); + } + else + { + document.getElementById( "repeat-days-menu-item" ).setAttribute( "label", "Days" ); + document.getElementById( "repeat-weeks-menu-item" ).setAttribute( "label", "Weeks" ); + document.getElementById( "repeat-months-menu-item" ).setAttribute( "label", "Months" ); + document.getElementById( "repeat-years-menu-item" ).setAttribute( "label", "Years" ); + + } +} +*/ + + /** * Enable/Disable Start/End items */ diff --git a/calendar/resources/content/eventDialog.xul b/calendar/resources/content/eventDialog.xul index 3bc6e8696a91..86ddcc72c4bd 100644 --- a/calendar/resources/content/eventDialog.xul +++ b/calendar/resources/content/eventDialog.xul @@ -258,20 +258,19 @@ - - + - + - - - - + + + + diff --git a/calendar/resources/content/penglobal/calendarEvent.js b/calendar/resources/content/penglobal/calendarEvent.js index 4b52970498e9..15c36e810b19 100644 --- a/calendar/resources/content/penglobal/calendarEvent.js +++ b/calendar/resources/content/penglobal/calendarEvent.js @@ -1189,7 +1189,7 @@ CalendarEventDataSource.prototype.setUpAlarmTimers = function( ) var TimeToAlarmInMS = AlarmTimeInMS - Now.getTime(); - this.timers[ this.timers.length ] = setTimeout( "CalendarEventDataSource.respondAlarmTimeout( "+this.alarmTable[i].id+" )", TimeToAlarmInMS ); + this.timers[ this.timers.length ] = setTimeout( "gCalendarEventDataSource.respondAlarmTimeout( "+this.alarmTable[i].id+" )", TimeToAlarmInMS ); } @@ -1198,7 +1198,7 @@ CalendarEventDataSource.prototype.setUpAlarmTimers = function( ) clearTimeout( this.checkAlarmIn24HoursTimeout ); - this.checkAlarmIn24HoursTimeout = setTimeout( "CalendarEventDataSource.setUpAlarmTimers()", 1000 * 60 * 60 * 24 ); + this.checkAlarmIn24HoursTimeout = setTimeout( "gCalendarEventDataSource.setUpAlarmTimers()", 1000 * 60 * 60 * 24 ); } @@ -1228,50 +1228,25 @@ CalendarEventDataSource.prototype.respondAcknowledgeAlarm = function( calendarEv */ -CalendarEventDataSource.respondAlarmTimeout = function( calendarEventID ) -//function respondAlarmTimeout( calendarEventID ) +CalendarEventDataSource.prototype.respondAlarmTimeout = function( calendarEventID ) { var calendarEvent = gCalendarEventDataSource.getCalendarEventById( calendarEventID ); - //if( calendarEvent && calendarEvent.checkAlarm() ) - //{ - debug( "in CalendarEventDataSource.prototype.respondAlarmEvent\n+++++++++ALARM WENT OFF \n" + - calendarEvent.toSource() + - "\n at " + - calendarEvent.start - + "\n+++++++++\n" ); - - // :TODO: The email sending stuff should be part of the CalendarEvent class - - if ( calendarEvent.alarmEmailAddress ) - { - - //debug( "about to send an email to "+ calendarEvent.alarmEmailAddress + "with subject "+ calendarEvent.title ); - - //calendar.sendEmail( "Calendar Event", - // "Title: "+ calendarEvent.title + " @ "+ calendarEvent.start + "\nThis message sent from OECalendar.", - // calendarEvent.alarmEmailAddress ); - } - + var args = new Object; - for( var index in gCalendarEventDataSource.observerList ) - { - var observer = gCalendarEventDataSource.observerList[ index ]; + args = calendarEvent; + + openDialog( "chrome://calendar/content/calendarEventAlertDialog.xul", "caEventAlarm", "chrome,modal", args ); + + for( var index in gCalendarEventDataSource.observerList ) + { + var observer = gCalendarEventDataSource.observerList[ index ]; - if( observer.onAlarm ) - { - observer.onAlarm( calendarEvent ); - } + if( observer.onAlarm ) + { + observer.onAlarm( calendarEvent ); } - - //} - //else - //{ - // reset the timer if required - - // if( calendarEvent ) - // calendarEvent.setUpAlarmTimer( this ); - //} + } } @@ -1834,8 +1809,6 @@ CalendarEvent.prototype.setUpAlarmTimer = function( dataSource ) debug( "\n Setting alarm for MS:" + timeTillAlarm ); this.timerID = window.setTimeout( "CalendarEventDataSource.respondAlarmTimeout(" + this.id + ")", timeTillAlarm ); - - } else if( nowMS < this.start.getTime() && !this.snoozeTime ) { diff --git a/calendar/resources/content/unifinder.js b/calendar/resources/content/unifinder.js index c3d0974d3720..668e1d10d2b0 100644 --- a/calendar/resources/content/unifinder.js +++ b/calendar/resources/content/unifinder.js @@ -497,10 +497,9 @@ function refreshEventTree( eventArray, childrenName ) ** There is a mysterious child of the HBox, with a flex of one, so set the flex on the HBox really high to hide the child. */ treeCellHBox.setAttribute( "flex" , "1000" ); - treeCellHBox.setAttribute( "id", "unifinder-treecell-box" ); + treeCellHBox.setAttribute( "class", "unifinder-treecell-box-class" ); treeCellHBox.setAttribute( "crop", "right" ); - - + var treeCellVBox = document.createElement( "vbox" ); treeCellVBox.setAttribute( "crop", "right" ); treeCellVBox.setAttribute( "flex", "1" );