зеркало из https://github.com/mozilla/pjs.git
Fixing bug 163028, adding in ability to launch edit event dialog from alarms.
This commit is contained in:
Родитель
6c08fea8b3
Коммит
672bc5ca90
|
@ -78,7 +78,7 @@ h1 {
|
|||
|
||||
<td id="mozver">
|
||||
<h1>
|
||||
<a id="mozlink" href="http://www.mozilla.org/projects/calendar/" target="_new">Mozilla Calendar 2002081513-cal</a>
|
||||
<a id="mozlink" href="http://www.mozilla.org/projects/calendar/" target="_new">Mozilla Calendar 2002081610-cal</a>
|
||||
</h1>
|
||||
<script type="application/x-javascript">
|
||||
// using try..catch to handle empty useragents and other cases where the regex fails to apply
|
||||
|
|
|
@ -67,35 +67,39 @@ function buildEventBoxes()
|
|||
{
|
||||
//remove all the old event boxes.
|
||||
var EventContainer = document.getElementById( "event-container-rows" );
|
||||
var NumberOfChildElements = EventContainer.childNodes.length;
|
||||
for( i = 0; i < NumberOfChildElements; i++ )
|
||||
if( EventContainer )
|
||||
{
|
||||
EventContainer.removeChild( EventContainer.lastChild );
|
||||
}
|
||||
var NumberOfChildElements = EventContainer.childNodes.length;
|
||||
for( i = 0; i < NumberOfChildElements; i++ )
|
||||
{
|
||||
EventContainer.removeChild( EventContainer.lastChild );
|
||||
}
|
||||
|
||||
//start at length - 10 or 0 if that is < 0
|
||||
|
||||
//start at length - 10 or 0 if that is < 0
|
||||
|
||||
var Start = gAllEvents.length - 10;
|
||||
if( Start < 0 )
|
||||
Start = 0;
|
||||
|
||||
//build all event boxes again.
|
||||
for( var i = Start; i < gAllEvents.length; i++ )
|
||||
{
|
||||
createAlarmBox( gAllEvents[i] );
|
||||
}
|
||||
var Start = gAllEvents.length - 10;
|
||||
if( Start < 0 )
|
||||
Start = 0;
|
||||
|
||||
//reset the text
|
||||
if( gAllEvents.length > 10 )
|
||||
{
|
||||
var TooManyDesc = document.getElementById( "too-many-alarms-description" );
|
||||
TooManyDesc.removeAttribute( "collapsed" );
|
||||
TooManyDesc.setAttribute( "value", "You have "+ (gAllEvents.length )+" total alarms. We've shown you the last 10. Click Acknowledge All to clear them all." );
|
||||
}
|
||||
else
|
||||
{
|
||||
var TooManyDesc = document.getElementById( "too-many-alarms-description" );
|
||||
TooManyDesc.setAttribute( "collapsed", "true" );
|
||||
//build all event boxes again.
|
||||
for( var i = Start; i < gAllEvents.length; i++ )
|
||||
{
|
||||
createAlarmBox( gAllEvents[i] );
|
||||
}
|
||||
|
||||
//reset the text
|
||||
if( gAllEvents.length > 10 )
|
||||
{
|
||||
var TooManyDesc = document.getElementById( "too-many-alarms-description" );
|
||||
TooManyDesc.removeAttribute( "collapsed" );
|
||||
TooManyDesc.setAttribute( "value", "You have "+ (gAllEvents.length )+" total alarms. We've shown you the last 10. Click Acknowledge All to clear them all." );
|
||||
}
|
||||
else
|
||||
{
|
||||
var TooManyDesc = document.getElementById( "too-many-alarms-description" );
|
||||
TooManyDesc.setAttribute( "collapsed", "true" );
|
||||
}
|
||||
|
||||
}
|
||||
sizeToContent();
|
||||
}
|
||||
|
@ -127,6 +131,10 @@ function createAlarmBox( Event )
|
|||
|
||||
OuterBox.getElementsByAttribute( "name", "AcknowledgeButton" )[0].setAttribute( "onclick", "acknowledgeAlarm( this.event );removeAlarmBox( this.event );" );
|
||||
|
||||
OuterBox.getElementsByAttribute( "name", "EditEvent" )[0].event = Event;
|
||||
|
||||
OuterBox.getElementsByAttribute( "name", "EditEvent" )[0].setAttribute( "onclick", "launchEditEvent( this.event );" );
|
||||
|
||||
kungFooDeathGripOnEventBoxes.push( OuterBox.getElementsByAttribute( "name", "AcknowledgeButton" )[0] );
|
||||
|
||||
OuterBox.getElementsByAttribute( "name", "SnoozeButton" )[0].event = Event;
|
||||
|
@ -247,6 +255,25 @@ function acknowledgeAlarm( Event )
|
|||
buildEventBoxes();
|
||||
}
|
||||
|
||||
function launchEditEvent( Event )
|
||||
{
|
||||
// set up a bunch of args to pass to the dialog
|
||||
|
||||
var args = new Object();
|
||||
args.mode = "edit";
|
||||
args.onOk = modifyEventDialogResponse;
|
||||
args.calendarEvent = Event;
|
||||
|
||||
// open the dialog modally
|
||||
opener.openDialog("chrome://calendar/content/calendarEventDialog.xul", "caEditEvent", "chrome,modal", args );
|
||||
}
|
||||
|
||||
function modifyEventDialogResponse( calendarEvent )
|
||||
{
|
||||
gICalLib.modifyEvent( calendarEvent );
|
||||
}
|
||||
|
||||
|
||||
function snoozeAlarm( Event )
|
||||
{
|
||||
var OuterBox = document.getElementById( Event.id );
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<script type="application/x-javascript" src="chrome://global/content/strres.js"/>
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/dateUtils.js"/>
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/calendarEventAlertDialog.js"/>
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/calendar.js"/>
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/calendarEvent.js"/>
|
||||
|
||||
<!-- Picker popups -->
|
||||
|
@ -93,10 +94,12 @@
|
|||
</columns>
|
||||
<rows id="event-container-rows"/>
|
||||
<row class="ca-event-alert-row" name="sample-row" collapsed="true">
|
||||
<!-- NOTE: ALL ITEMS USE name INSTEAD OF id BECAUSE THE BOX IS DUPLICATED FOR EACH EVENT -->
|
||||
<vbox align="start" pack="center">
|
||||
<button name="AcknowledgeButton" label="Acknowledge" wrap="none" class="alarm-acknowledge-button-class"/>
|
||||
<button name="AcknowledgeButton" label="&calendar.alarm.acknowledge.label;" wrap="none" class="alarm-acknowledge-button-class"/>
|
||||
<button name="EditEvent" label="&calendar.alarm.editevent.label;" wrap="none" class="alarm-acknowledge-button-class"/>
|
||||
<box>
|
||||
<button name="SnoozeButton" label="Snooze" wrap="none" class="alarm-acknowledge-button-class"/>
|
||||
<button name="SnoozeButton" label="&calendar.alarm.snooze.label;" wrap="none" class="alarm-acknowledge-button-class"/>
|
||||
<textbox name="alarm-length-field" class="alarm-length-field-class"/>
|
||||
|
||||
<menulist name="alarm-length-units" flex="1" labelnumber="labelplural" wrap="none">
|
||||
|
@ -126,7 +129,7 @@
|
|||
<label id="too-many-alarms-description" value="" collapsed="true"/>
|
||||
<box>
|
||||
<spacer flex="1"/>
|
||||
<button id="dialog-btn-yes" label="Acknowledge All Alarms" default="true" oncommand="doOKButton();"/>
|
||||
<button id="dialog-btn-yes" label="&calendar.alarm.acknowledgeall.label;" default="true" oncommand="doOKButton();"/>
|
||||
</box>
|
||||
</vbox>
|
||||
|
||||
|
|
|
@ -67,35 +67,39 @@ function buildEventBoxes()
|
|||
{
|
||||
//remove all the old event boxes.
|
||||
var EventContainer = document.getElementById( "event-container-rows" );
|
||||
var NumberOfChildElements = EventContainer.childNodes.length;
|
||||
for( i = 0; i < NumberOfChildElements; i++ )
|
||||
if( EventContainer )
|
||||
{
|
||||
EventContainer.removeChild( EventContainer.lastChild );
|
||||
}
|
||||
var NumberOfChildElements = EventContainer.childNodes.length;
|
||||
for( i = 0; i < NumberOfChildElements; i++ )
|
||||
{
|
||||
EventContainer.removeChild( EventContainer.lastChild );
|
||||
}
|
||||
|
||||
//start at length - 10 or 0 if that is < 0
|
||||
|
||||
//start at length - 10 or 0 if that is < 0
|
||||
|
||||
var Start = gAllEvents.length - 10;
|
||||
if( Start < 0 )
|
||||
Start = 0;
|
||||
|
||||
//build all event boxes again.
|
||||
for( var i = Start; i < gAllEvents.length; i++ )
|
||||
{
|
||||
createAlarmBox( gAllEvents[i] );
|
||||
}
|
||||
var Start = gAllEvents.length - 10;
|
||||
if( Start < 0 )
|
||||
Start = 0;
|
||||
|
||||
//reset the text
|
||||
if( gAllEvents.length > 10 )
|
||||
{
|
||||
var TooManyDesc = document.getElementById( "too-many-alarms-description" );
|
||||
TooManyDesc.removeAttribute( "collapsed" );
|
||||
TooManyDesc.setAttribute( "value", "You have "+ (gAllEvents.length )+" total alarms. We've shown you the last 10. Click Acknowledge All to clear them all." );
|
||||
}
|
||||
else
|
||||
{
|
||||
var TooManyDesc = document.getElementById( "too-many-alarms-description" );
|
||||
TooManyDesc.setAttribute( "collapsed", "true" );
|
||||
//build all event boxes again.
|
||||
for( var i = Start; i < gAllEvents.length; i++ )
|
||||
{
|
||||
createAlarmBox( gAllEvents[i] );
|
||||
}
|
||||
|
||||
//reset the text
|
||||
if( gAllEvents.length > 10 )
|
||||
{
|
||||
var TooManyDesc = document.getElementById( "too-many-alarms-description" );
|
||||
TooManyDesc.removeAttribute( "collapsed" );
|
||||
TooManyDesc.setAttribute( "value", "You have "+ (gAllEvents.length )+" total alarms. We've shown you the last 10. Click Acknowledge All to clear them all." );
|
||||
}
|
||||
else
|
||||
{
|
||||
var TooManyDesc = document.getElementById( "too-many-alarms-description" );
|
||||
TooManyDesc.setAttribute( "collapsed", "true" );
|
||||
}
|
||||
|
||||
}
|
||||
sizeToContent();
|
||||
}
|
||||
|
@ -127,6 +131,10 @@ function createAlarmBox( Event )
|
|||
|
||||
OuterBox.getElementsByAttribute( "name", "AcknowledgeButton" )[0].setAttribute( "onclick", "acknowledgeAlarm( this.event );removeAlarmBox( this.event );" );
|
||||
|
||||
OuterBox.getElementsByAttribute( "name", "EditEvent" )[0].event = Event;
|
||||
|
||||
OuterBox.getElementsByAttribute( "name", "EditEvent" )[0].setAttribute( "onclick", "launchEditEvent( this.event );" );
|
||||
|
||||
kungFooDeathGripOnEventBoxes.push( OuterBox.getElementsByAttribute( "name", "AcknowledgeButton" )[0] );
|
||||
|
||||
OuterBox.getElementsByAttribute( "name", "SnoozeButton" )[0].event = Event;
|
||||
|
@ -247,6 +255,25 @@ function acknowledgeAlarm( Event )
|
|||
buildEventBoxes();
|
||||
}
|
||||
|
||||
function launchEditEvent( Event )
|
||||
{
|
||||
// set up a bunch of args to pass to the dialog
|
||||
|
||||
var args = new Object();
|
||||
args.mode = "edit";
|
||||
args.onOk = modifyEventDialogResponse;
|
||||
args.calendarEvent = Event;
|
||||
|
||||
// open the dialog modally
|
||||
opener.openDialog("chrome://calendar/content/calendarEventDialog.xul", "caEditEvent", "chrome,modal", args );
|
||||
}
|
||||
|
||||
function modifyEventDialogResponse( calendarEvent )
|
||||
{
|
||||
gICalLib.modifyEvent( calendarEvent );
|
||||
}
|
||||
|
||||
|
||||
function snoozeAlarm( Event )
|
||||
{
|
||||
var OuterBox = document.getElementById( Event.id );
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<script type="application/x-javascript" src="chrome://global/content/strres.js"/>
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/dateUtils.js"/>
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/calendarEventAlertDialog.js"/>
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/calendar.js"/>
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/calendarEvent.js"/>
|
||||
|
||||
<!-- Picker popups -->
|
||||
|
@ -93,10 +94,12 @@
|
|||
</columns>
|
||||
<rows id="event-container-rows"/>
|
||||
<row class="ca-event-alert-row" name="sample-row" collapsed="true">
|
||||
<!-- NOTE: ALL ITEMS USE name INSTEAD OF id BECAUSE THE BOX IS DUPLICATED FOR EACH EVENT -->
|
||||
<vbox align="start" pack="center">
|
||||
<button name="AcknowledgeButton" label="Acknowledge" wrap="none" class="alarm-acknowledge-button-class"/>
|
||||
<button name="AcknowledgeButton" label="&calendar.alarm.acknowledge.label;" wrap="none" class="alarm-acknowledge-button-class"/>
|
||||
<button name="EditEvent" label="&calendar.alarm.editevent.label;" wrap="none" class="alarm-acknowledge-button-class"/>
|
||||
<box>
|
||||
<button name="SnoozeButton" label="Snooze" wrap="none" class="alarm-acknowledge-button-class"/>
|
||||
<button name="SnoozeButton" label="&calendar.alarm.snooze.label;" wrap="none" class="alarm-acknowledge-button-class"/>
|
||||
<textbox name="alarm-length-field" class="alarm-length-field-class"/>
|
||||
|
||||
<menulist name="alarm-length-units" flex="1" labelnumber="labelplural" wrap="none">
|
||||
|
@ -126,7 +129,7 @@
|
|||
<label id="too-many-alarms-description" value="" collapsed="true"/>
|
||||
<box>
|
||||
<spacer flex="1"/>
|
||||
<button id="dialog-btn-yes" label="Acknowledge All Alarms" default="true" oncommand="doOKButton();"/>
|
||||
<button id="dialog-btn-yes" label="&calendar.alarm.acknowledgeall.label;" default="true" oncommand="doOKButton();"/>
|
||||
</box>
|
||||
</vbox>
|
||||
|
||||
|
|
|
@ -248,3 +248,11 @@
|
|||
<!ENTITY menuBar.tooltip "Menu bar">
|
||||
<!ENTITY navigationToolbar.tooltip "Navigation Toolbar">
|
||||
|
||||
|
||||
<!-- Calendar Alarm Dialog -->
|
||||
|
||||
<!ENTITY calendar.alarm.acknowledge.label "Acknowledge" >
|
||||
<!ENTITY calendar.alarm.editevent.label "Edit Event" >
|
||||
<!ENTITY calendar.alarm.acknowledgeall.label "Acknowledge All Alarms" >
|
||||
<!ENTITY calendar.alarm.snooze.label "Snooze" >
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче