зеркало из https://github.com/mozilla/gecko-dev.git
XUL changes and alerts working for calendar events
This commit is contained in:
Родитель
8c0ec513ae
Коммит
613da1e5f2
|
@ -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 );
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
|
||||
<?xul-overlay href="chrome://penglobal/content/dialogOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://penglobal/content/datepicker-overlay.xul"?>
|
||||
<?xul-overlay href="chrome://penglobal/content/timepicker-overlay.xul"?>
|
||||
|
||||
|
@ -88,7 +88,7 @@
|
|||
<spacer flex="1"/>
|
||||
</box>
|
||||
|
||||
<!-- standard-dialog-tips: from dialogOverlay.xul Proper tip is shown in on load code-->
|
||||
<!-- standard-dialog-tips: from dialogOverlay.xul-->
|
||||
|
||||
<box id="standard-dialog-tips">
|
||||
<description id="tip-new">&event.tip.alert;</description>
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
|
||||
<?xul-overlay href="chrome://penglobal/content/dialogOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://penglobal/content/datepicker-overlay.xul"?>
|
||||
<?xul-overlay href="chrome://penglobal/content/timepicker-overlay.xul"?>
|
||||
|
||||
|
@ -88,7 +88,7 @@
|
|||
<spacer flex="1"/>
|
||||
</box>
|
||||
|
||||
<!-- standard-dialog-tips: from dialogOverlay.xul Proper tip is shown in on load code-->
|
||||
<!-- standard-dialog-tips: from dialogOverlay.xul-->
|
||||
|
||||
<box id="standard-dialog-tips">
|
||||
<description id="tip-new">&event.tip.alert;</description>
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -258,20 +258,19 @@
|
|||
</row>
|
||||
|
||||
<!-- Repeat -->
|
||||
<!-- STARTING TO BE IMPLEMENTED -->
|
||||
<row collapsed="false">
|
||||
<row collapsed="false">
|
||||
<spacer />
|
||||
<vbox>
|
||||
<hbox id="repeat-box">
|
||||
<checkbox id="repeat-checkbox" label="&newevent.repeat.label;" checked="false" oncommand="commandRepeat()"/>
|
||||
<textbox id="repeat-length-field" value="1" />
|
||||
<textbox id="repeat-length-field" onmousedownX="updateRepeatLength()" value="1" />
|
||||
|
||||
<menulist id="repeat-length-units" label="&repeat.units.days;" value="days" >
|
||||
<menupopup>
|
||||
<menuitem label="&repeat.units.days;" value="days" />
|
||||
<menuitem label="&repeat.units.weeks;" value="weeks" />
|
||||
<menuitem label="&repeat.units.months;" value="months" />
|
||||
<menuitem label="&repeat.units.years;" value="years" />
|
||||
<menuitem id="repeat-days-menu-item" label="&repeat.units.day;" value="days" />
|
||||
<menuitem id="repeat-weeks-menu-item" label="&repeat.units.week;" value="weeks" />
|
||||
<menuitem id="repeat-months-menu-item" label="&repeat.units.month;" value="months" />
|
||||
<menuitem id="repeat-years-menu-item" label="&repeat.units.year;" value="years" />
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</hbox>
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -258,20 +258,19 @@
|
|||
</row>
|
||||
|
||||
<!-- Repeat -->
|
||||
<!-- STARTING TO BE IMPLEMENTED -->
|
||||
<row collapsed="false">
|
||||
<row collapsed="false">
|
||||
<spacer />
|
||||
<vbox>
|
||||
<hbox id="repeat-box">
|
||||
<checkbox id="repeat-checkbox" label="&newevent.repeat.label;" checked="false" oncommand="commandRepeat()"/>
|
||||
<textbox id="repeat-length-field" value="1" />
|
||||
<textbox id="repeat-length-field" onmousedownX="updateRepeatLength()" value="1" />
|
||||
|
||||
<menulist id="repeat-length-units" label="&repeat.units.days;" value="days" >
|
||||
<menupopup>
|
||||
<menuitem label="&repeat.units.days;" value="days" />
|
||||
<menuitem label="&repeat.units.weeks;" value="weeks" />
|
||||
<menuitem label="&repeat.units.months;" value="months" />
|
||||
<menuitem label="&repeat.units.years;" value="years" />
|
||||
<menuitem id="repeat-days-menu-item" label="&repeat.units.day;" value="days" />
|
||||
<menuitem id="repeat-weeks-menu-item" label="&repeat.units.week;" value="weeks" />
|
||||
<menuitem id="repeat-months-menu-item" label="&repeat.units.month;" value="months" />
|
||||
<menuitem id="repeat-years-menu-item" label="&repeat.units.year;" value="years" />
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</hbox>
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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" );
|
||||
|
|
Загрузка…
Ссылка в новой задаче