mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 22:55:23 +00:00
bug #357397 support WCAP server invitations
This commit is contained in:
parent
5be8e17fe9
commit
5708050f9d
@ -0,0 +1,49 @@
|
||||
<!-- ***** 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
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is Sun Microsystems code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is Sun Microsystems.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2006
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s): Thomas Benisch <thomas.benisch@sun.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
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK *****
|
||||
-->
|
||||
|
||||
<!-- Calendar Invitations Dialog -->
|
||||
<!ENTITY calendar.invitations.dialog.invitations.text "Invitations">
|
||||
<!ENTITY calendar.invitations.dialog.statusmessage.updating.text "Updating list of invitations.">
|
||||
<!ENTITY calendar.invitations.dialog.statusmessage.noinvitations.text "No unconfirmed invitations found.">
|
||||
|
||||
<!-- Calendar Invitations List -->
|
||||
<!ENTITY calendar.invitations.list.accept.button.label "Accept">
|
||||
<!ENTITY calendar.invitations.list.decline.button.label "Decline">
|
||||
<!ENTITY calendar.invitations.list.recurrentevent.text "Repeating event">
|
||||
<!ENTITY calendar.invitations.list.alldayevent.text "All day event">
|
||||
<!ENTITY calendar.invitations.list.location.text "Location: ">
|
||||
<!ENTITY calendar.invitations.list.organizer.text "Organizer: ">
|
||||
<!ENTITY calendar.invitations.list.none.text "None">
|
38
calendar/locales/en-US/chrome/prototypes/sun-lightning.dtd
Normal file
38
calendar/locales/en-US/chrome/prototypes/sun-lightning.dtd
Normal file
@ -0,0 +1,38 @@
|
||||
<!-- ***** 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
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is Sun Microsystems code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is Sun Microsystems.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2006
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s): Thomas Benisch <thomas.benisch@sun.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
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK *****
|
||||
-->
|
||||
|
||||
<!-- Messenger Sidebar -->
|
||||
<!ENTITY lightning.sidebar.invitations.label "Invitations">
|
Binary file not shown.
After Width: | Height: | Size: 828 B |
BIN
calendar/prototypes/themes/pinstripe/calendar-invitations-dialog-list-images.png
Executable file
BIN
calendar/prototypes/themes/pinstripe/calendar-invitations-dialog-list-images.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
@ -0,0 +1,104 @@
|
||||
/* ***** 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
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Sun Microsystems code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Thomas Benisch <thomas.benisch@sun.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#calendar-invitations-dialog {
|
||||
min-width: 500px;
|
||||
min-height: 273px;
|
||||
}
|
||||
|
||||
.calendar-invitations-updating-icon {
|
||||
list-style-image: url("chrome://global/skin/throbber/Throbber-small.gif");
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
calendar-invitations-richlistbox {
|
||||
background-color: white;
|
||||
border: 1px solid #7F9DB9;
|
||||
}
|
||||
|
||||
calendar-invitations-richlistitem {
|
||||
padding-top: 6px;
|
||||
padding-bottom: 6px;
|
||||
-moz-padding-start: 7px;
|
||||
-moz-padding-end: 7px;
|
||||
min-height: 25px;
|
||||
border-bottom: 1px dotted #C0C0C0;
|
||||
}
|
||||
|
||||
calendar-invitations-richlistitem[selected="true"] {
|
||||
background-image: url("chrome://mozapps/skin/downloads/downloadSelected.png") !important;
|
||||
border-bottom: 1px dotted #7F9DB9;
|
||||
}
|
||||
|
||||
.calendar-invitations-richlistitem-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.calendar-invitations-richlistitem-icon[status="NEEDS-ACTION"] {
|
||||
list-style-image: url("chrome://calendar/skin/calendar-invitations-dialog-list-images.png");
|
||||
-moz-image-region: rect(0px 32px 32px 0px);
|
||||
}
|
||||
|
||||
.calendar-invitations-richlistitem-icon[status="ACCEPTED"] {
|
||||
list-style-image: url("chrome://calendar/skin/calendar-invitations-dialog-list-images.png");
|
||||
-moz-image-region: rect(0px 64px 32px 32px);
|
||||
}
|
||||
|
||||
.calendar-invitations-richlistitem-icon[status="DECLINED"] {
|
||||
list-style-image: url("chrome://calendar/skin/calendar-invitations-dialog-list-images.png");
|
||||
-moz-image-region: rect(0px 96px 32px 64px);
|
||||
}
|
||||
|
||||
.calendar-invitations-richlistitem-button {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.calendar-invitations-richlistitem-button .button-icon {
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
-moz-margin-start: 0px;
|
||||
-moz-margin-end: 5px;
|
||||
}
|
||||
|
||||
.calendar-invitations-richlistitem-accept-button {
|
||||
list-style-image: url("chrome://calendar/skin/calendar-invitations-dialog-button-images.png");
|
||||
-moz-image-region: rect(0px 16px 16px 0px);
|
||||
}
|
||||
|
||||
.calendar-invitations-richlistitem-decline-button {
|
||||
list-style-image: url("chrome://calendar/skin/calendar-invitations-dialog-button-images.png");
|
||||
-moz-image-region: rect(0px 32px 16px 16px);
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/* ***** 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
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Sun Microsystems code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Thomas Benisch <thomas.benisch@sun.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
.calendar-invitations-sidebar-label {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 828 B |
BIN
calendar/prototypes/themes/winstripe/calendar-invitations-dialog-list-images.png
Executable file
BIN
calendar/prototypes/themes/winstripe/calendar-invitations-dialog-list-images.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
@ -0,0 +1,104 @@
|
||||
/* ***** 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
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Sun Microsystems code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Thomas Benisch <thomas.benisch@sun.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#calendar-invitations-dialog {
|
||||
min-width: 500px;
|
||||
min-height: 273px;
|
||||
}
|
||||
|
||||
.calendar-invitations-updating-icon {
|
||||
list-style-image: url("chrome://global/skin/throbber/Throbber-small.gif");
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
calendar-invitations-richlistbox {
|
||||
background-color: white;
|
||||
border: 1px solid #7F9DB9;
|
||||
}
|
||||
|
||||
calendar-invitations-richlistitem {
|
||||
padding-top: 6px;
|
||||
padding-bottom: 6px;
|
||||
-moz-padding-start: 7px;
|
||||
-moz-padding-end: 7px;
|
||||
min-height: 25px;
|
||||
border-bottom: 1px dotted #C0C0C0;
|
||||
}
|
||||
|
||||
calendar-invitations-richlistitem[selected="true"] {
|
||||
background-image: url("chrome://mozapps/skin/downloads/downloadSelected.png") !important;
|
||||
border-bottom: 1px dotted #7F9DB9;
|
||||
}
|
||||
|
||||
.calendar-invitations-richlistitem-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.calendar-invitations-richlistitem-icon[status="NEEDS-ACTION"] {
|
||||
list-style-image: url("chrome://calendar/skin/calendar-invitations-dialog-list-images.png");
|
||||
-moz-image-region: rect(0px 32px 32px 0px);
|
||||
}
|
||||
|
||||
.calendar-invitations-richlistitem-icon[status="ACCEPTED"] {
|
||||
list-style-image: url("chrome://calendar/skin/calendar-invitations-dialog-list-images.png");
|
||||
-moz-image-region: rect(0px 64px 32px 32px);
|
||||
}
|
||||
|
||||
.calendar-invitations-richlistitem-icon[status="DECLINED"] {
|
||||
list-style-image: url("chrome://calendar/skin/calendar-invitations-dialog-list-images.png");
|
||||
-moz-image-region: rect(0px 96px 32px 64px);
|
||||
}
|
||||
|
||||
.calendar-invitations-richlistitem-button {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.calendar-invitations-richlistitem-button .button-icon {
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
-moz-margin-start: 0px;
|
||||
-moz-margin-end: 5px;
|
||||
}
|
||||
|
||||
.calendar-invitations-richlistitem-accept-button {
|
||||
list-style-image: url("chrome://calendar/skin/calendar-invitations-dialog-button-images.png");
|
||||
-moz-image-region: rect(0px 16px 16px 0px);
|
||||
}
|
||||
|
||||
.calendar-invitations-richlistitem-decline-button {
|
||||
list-style-image: url("chrome://calendar/skin/calendar-invitations-dialog-button-images.png");
|
||||
-moz-image-region: rect(0px 32px 16px 16px);
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/* ***** 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
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Sun Microsystems code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Thomas Benisch <thomas.benisch@sun.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
.calendar-invitations-sidebar-label {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px;
|
||||
}
|
49
calendar/prototypes/wcap/calendar-invitations-dialog.css
Normal file
49
calendar/prototypes/wcap/calendar-invitations-dialog.css
Normal file
@ -0,0 +1,49 @@
|
||||
/* ***** 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
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Sun Microsystems code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Thomas Benisch <thomas.benisch@sun.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
calendar-invitations-richlistbox {
|
||||
-moz-binding: url("chrome://calendar/content/calendar-invitations-list.xml#calendar-invitations-richlistbox");
|
||||
-moz-user-focus: normal;
|
||||
}
|
||||
|
||||
calendar-invitations-richlistitem {
|
||||
-moz-binding: url("chrome://calendar/content/calendar-invitations-list.xml#calendar-invitations-richlistitem");
|
||||
-moz-user-focus: none;
|
||||
}
|
||||
|
||||
calendar-invitations-richlistitem[selected="true"] {
|
||||
-moz-user-focus: normal;
|
||||
}
|
120
calendar/prototypes/wcap/calendar-invitations-dialog.js
vendored
Normal file
120
calendar/prototypes/wcap/calendar-invitations-dialog.js
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
/* -*- 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
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Sun Microsystems code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Thomas Benisch <thomas.benisch@sun.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function onLoad() {
|
||||
var operationListener = {
|
||||
onOperationComplete:
|
||||
function(aCalendar, aStatus, aOperationType, aId, aDetail) {
|
||||
var updatingBox = document.getElementById("updating-box");
|
||||
updatingBox.setAttribute("hidden", "true");
|
||||
var richListBox = document.getElementById("invitations-listbox");
|
||||
if (richListBox.getRowCount() > 0) {
|
||||
richListBox.selectedIndex = 0;
|
||||
} else {
|
||||
var noInvitationsBox =
|
||||
document.getElementById("noinvitations-box");
|
||||
noInvitationsBox.removeAttribute("hidden");
|
||||
}
|
||||
},
|
||||
onGetResult:
|
||||
function(aCalendar, aStatus, aItemType, aDetail, aCount, aItems) {
|
||||
if (!Components.isSuccessCode(aStatus))
|
||||
return;
|
||||
document.title = invitationsText + " (" + aCount + ")";
|
||||
var updatingBox = document.getElementById("updating-box");
|
||||
updatingBox.setAttribute("hidden", "true");
|
||||
var richListBox = document.getElementById("invitations-listbox");
|
||||
for each (var item in aItems) {
|
||||
richListBox.addCalendarItem(item);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var updatingBox = document.getElementById("updating-box");
|
||||
updatingBox.removeAttribute("hidden");
|
||||
|
||||
var args = window.arguments[0];
|
||||
args.operationListenerWrapper.operationListener = operationListener;
|
||||
args.invitationsManager.getInvitations(
|
||||
args.operationListenerWrapper,
|
||||
args.onLoadOperationListener);
|
||||
|
||||
opener.setCursor("auto");
|
||||
}
|
||||
|
||||
function onUnload() {
|
||||
var args = window.arguments[0];
|
||||
args.operationListenerWrapper.operationListener = null;
|
||||
}
|
||||
|
||||
function onAccept() {
|
||||
var args = window.arguments[0];
|
||||
fillJobQueue(args.queue);
|
||||
args.invitationsManager.processJobQueue(args.queue, args.finishedCallBack);
|
||||
return true;
|
||||
}
|
||||
|
||||
function onCancel() {
|
||||
var args = window.arguments[0];
|
||||
if (args.finishedCallBack) {
|
||||
args.finishedCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
function fillJobQueue(queue) {
|
||||
var richListBox = document.getElementById("invitations-listbox");
|
||||
var rowCount = richListBox.getRowCount();
|
||||
for (var i = 0; i < rowCount; i++) {
|
||||
var richListItem = richListBox.getItemAtIndex(i);
|
||||
var newStatus = richListItem.participationStatus;
|
||||
var oldStatus = richListItem.initialParticipationStatus;
|
||||
if (newStatus != oldStatus) {
|
||||
var actionString = "modify";
|
||||
var oldCalendarItem = richListItem.calendarItem;
|
||||
var newCalendarItem = (oldCalendarItem.isMutable)
|
||||
? oldCalendarItem : oldCalendarItem.clone();
|
||||
richListItem.setCalendarItemParticipationStatus(newCalendarItem,
|
||||
newStatus);
|
||||
var job = {
|
||||
action: actionString,
|
||||
oldItem: oldCalendarItem,
|
||||
newItem: newCalendarItem
|
||||
};
|
||||
queue.push(job);
|
||||
}
|
||||
}
|
||||
}
|
83
calendar/prototypes/wcap/calendar-invitations-dialog.xul
Normal file
83
calendar/prototypes/wcap/calendar-invitations-dialog.xul
Normal file
@ -0,0 +1,83 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- -*- Mode: xml; indent-tabs-mode: nil; -*- -->
|
||||
<!--
|
||||
- ***** 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
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is Sun Microsystems code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is Sun Microsystems.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2006
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Thomas Benisch <thomas.benisch@sun.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
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK *****
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://calendar/content/calendar-invitations-dialog.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://calendar/skin/calendar-invitations-dialog.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog
|
||||
[
|
||||
<!ENTITY % dtd1 SYSTEM "chrome://calendar/locale/calendar-invitations-dialog.dtd" > %dtd1;
|
||||
]>
|
||||
|
||||
<dialog
|
||||
id="calendar-invitations-dialog"
|
||||
title="&calendar.invitations.dialog.invitations.text;"
|
||||
buttons="accept,cancel"
|
||||
ondialogaccept="return onAccept();"
|
||||
ondialogcancel="return onCancel();"
|
||||
onload="return onLoad();"
|
||||
onunload="return onUnload();"
|
||||
persist="screenX screenY width height"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- Javascript includes -->
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/calendar-invitations-dialog.js"/>
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/calendarUtils.js"/>
|
||||
|
||||
<script type="application/x-javascript" >
|
||||
var invitationsText = "&calendar.invitations.dialog.invitations.text;";
|
||||
</script>
|
||||
|
||||
<vbox id="dialog-box" flex="1">
|
||||
<stack flex="1">
|
||||
<calendar-invitations-richlistbox id="invitations-listbox" flex="1"/>
|
||||
<hbox id="updating-box" align="center" pack="center" hidden="true">
|
||||
<label value="&calendar.invitations.dialog.statusmessage.updating.text;"
|
||||
crop="end"/>
|
||||
<image class="calendar-invitations-updating-icon"/>
|
||||
</hbox>
|
||||
<hbox id="noinvitations-box" align="center" pack="center" hidden="true">
|
||||
<label value="&calendar.invitations.dialog.statusmessage.noinvitations.text;"
|
||||
crop="end"/>
|
||||
</hbox>
|
||||
</stack>
|
||||
</vbox>
|
||||
</dialog>
|
301
calendar/prototypes/wcap/calendar-invitations-list.xml
Normal file
301
calendar/prototypes/wcap/calendar-invitations-list.xml
Normal file
@ -0,0 +1,301 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- ***** 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
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is Sun Microsystems code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is Sun Microsystems.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2006
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s): Thomas Benisch <thomas.benisch@sun.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
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK *****
|
||||
-->
|
||||
|
||||
<!DOCTYPE dialog
|
||||
[
|
||||
<!ENTITY % dtd1 SYSTEM "chrome://calendar/locale/calendar-invitations-dialog.dtd" > %dtd1;
|
||||
]>
|
||||
|
||||
<bindings id="calendar-invitations-list-bindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="calendar-invitations-richlistbox"
|
||||
extends="chrome://global/content/bindings/richlistbox.xml#richlistbox"
|
||||
xbl:inherits="flex">
|
||||
|
||||
<implementation>
|
||||
|
||||
<!-- methods -->
|
||||
|
||||
<method name="addCalendarItem">
|
||||
<parameter name="aItem"/>
|
||||
<body><![CDATA[
|
||||
function createXULElement(el) {
|
||||
return document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", el);
|
||||
}
|
||||
var newNode = createXULElement("calendar-invitations-richlistitem");
|
||||
this.appendChild(newNode);
|
||||
newNode.setAttribute("anonid", "invitations-listitem");
|
||||
newNode.calendarItem = aItem;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="calendar-invitations-richlistitem"
|
||||
extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
|
||||
<content>
|
||||
<xul:hbox align="start" flex="1">
|
||||
<xul:image anonid="icon" class="calendar-invitations-richlistitem-icon"/>
|
||||
<xul:vbox flex="1">
|
||||
<xul:label anonid="title" class="calendar-invitations-richlistitem-title"
|
||||
crop="end"/>
|
||||
<xul:label anonid="date" crop="end"/>
|
||||
<xul:label anonid="recurrence" crop="end"/>
|
||||
<xul:label anonid="location" crop="end"/>
|
||||
<xul:label anonid="organizer" crop="end"/>
|
||||
<xul:label anonid="spacer" value="" hidden="true"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox>
|
||||
<xul:button anonid="accept"
|
||||
class="calendar-invitations-richlistitem-accept-button
|
||||
calendar-invitations-richlistitem-button"
|
||||
label="&calendar.invitations.list.accept.button.label;"
|
||||
hidden="true" oncommand="accept();"/>
|
||||
<xul:button anonid="decline"
|
||||
class="calendar-invitations-richlistitem-decline-button
|
||||
calendar-invitations-richlistitem-button"
|
||||
label="&calendar.invitations.list.decline.button.label;"
|
||||
hidden="true" oncommand="decline();"/>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
|
||||
<!-- fields -->
|
||||
|
||||
<field name="mDateFormatter">null</field>
|
||||
<field name="mCalendarItem">null</field>
|
||||
<field name="mInitialParticipationStatus">null</field>
|
||||
<field name="mParticipationStatus">null</field>
|
||||
|
||||
<!-- properties -->
|
||||
|
||||
<property name="calendarItem">
|
||||
<getter><![CDATA[
|
||||
return this.mCalendarItem;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.setCalendarItem(val);
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="initialParticipationStatus">
|
||||
<getter><![CDATA[
|
||||
return this.mInitialParticipationStatus;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.mInitialParticipationStatus = val;
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="participationStatus">
|
||||
<getter><![CDATA[
|
||||
return this.mParticipationStatus;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.mParticipationStatus = val;
|
||||
var icon = document.getAnonymousElementByAttribute(
|
||||
this, "anonid", "icon");
|
||||
icon.setAttribute("status", val);
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<!-- constructor -->
|
||||
|
||||
<constructor><![CDATA[
|
||||
this.mDateFormatter =
|
||||
Components.classes["@mozilla.org/calendar/datetime-formatter;1"]
|
||||
.getService(Components.interfaces.calIDateTimeFormatter);
|
||||
]]></constructor>
|
||||
|
||||
<!-- methods -->
|
||||
|
||||
<method name="setCalendarItem">
|
||||
<parameter name="aItem"/>
|
||||
<body>
|
||||
var alldayEventText = "&calendar.invitations.list.alldayevent.text;";
|
||||
var recurrentEventText = "&calendar.invitations.list.recurrentevent.text;";
|
||||
var locationText = "&calendar.invitations.list.location.text;";
|
||||
var organizerText = "&calendar.invitations.list.organizer.text;";
|
||||
var noneText = "&calendar.invitations.list.none.text;";
|
||||
<![CDATA[
|
||||
this.mCalendarItem = aItem;
|
||||
this.mInitialParticipationStatus =
|
||||
this.getCalendarItemParticipationStatus(aItem);
|
||||
this.participationStatus = this.mInitialParticipationStatus;
|
||||
|
||||
var titleLabel = document.getAnonymousElementByAttribute(
|
||||
this, "anonid", "title");
|
||||
titleLabel.setAttribute("value", aItem.title);
|
||||
|
||||
var dateLabel = document.getAnonymousElementByAttribute(
|
||||
this, "anonid", "date");
|
||||
var kDefaultTimezone = calendarDefaultTimezone();
|
||||
var startDate = aItem.startDate.getInTimezone(kDefaultTimezone);
|
||||
var endDate = aItem.endDate.getInTimezone(kDefaultTimezone);
|
||||
var startString = new Object();
|
||||
var endString = new Object();
|
||||
this.mDateFormatter.formatInterval(
|
||||
startDate, endDate, startString, endString);
|
||||
var dateString = startString.value;
|
||||
if (endString.value != null && endString.value.length > 0) {
|
||||
dateString += " - " + endString.value;
|
||||
}
|
||||
if (startDate.isDate) {
|
||||
dateString += ", " + alldayEventText;
|
||||
}
|
||||
dateLabel.setAttribute("value", dateString);
|
||||
|
||||
var recurrenceLabel = document.getAnonymousElementByAttribute(
|
||||
this, "anonid", "recurrence");
|
||||
if (aItem.recurrenceInfo) {
|
||||
recurrenceLabel.setAttribute("value", recurrentEventText);
|
||||
} else {
|
||||
recurrenceLabel.setAttribute("hidden", "true");
|
||||
var spacer = document.getAnonymousElementByAttribute(
|
||||
this, "anonid", "spacer");
|
||||
spacer.removeAttribute("hidden");
|
||||
}
|
||||
|
||||
var locationLabel = document.getAnonymousElementByAttribute(
|
||||
this, "anonid", "location");
|
||||
var locationString = locationText;
|
||||
var locationProperty = aItem.getProperty("LOCATION");
|
||||
if (locationProperty && locationProperty.length > 0) {
|
||||
locationString += locationProperty;
|
||||
} else {
|
||||
locationString += noneText;
|
||||
}
|
||||
locationLabel.setAttribute("value", locationString);
|
||||
|
||||
var organizerLabel = document.getAnonymousElementByAttribute(
|
||||
this, "anonid", "organizer");
|
||||
var organizerString = organizerText;
|
||||
var commonName = aItem.organizer.commonName;
|
||||
if (commonName && commonName.length > 0) {
|
||||
organizerString += commonName;
|
||||
}
|
||||
organizerLabel.setAttribute("value", organizerString);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="getCalendarItemParticipationStatus">
|
||||
<parameter name="aItem"/>
|
||||
<body><![CDATA[
|
||||
try {
|
||||
var wcapCalendar = aItem.calendar.QueryInterface(
|
||||
Components.interfaces.calIWcapCalendar);
|
||||
var attendees = aItem.getAttendees({});
|
||||
for each(var attendee in attendees) {
|
||||
if (attendee.id == wcapCalendar.ownerId) {
|
||||
return attendee.participationStatus;
|
||||
}
|
||||
}
|
||||
} catch(e) {}
|
||||
return null;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="setCalendarItemParticipationStatus">
|
||||
<parameter name="aItem"/>
|
||||
<parameter name="aStatus"/>
|
||||
<body><![CDATA[
|
||||
try {
|
||||
var wcapCalendar = aItem.calendar.QueryInterface(
|
||||
Components.interfaces.calIWcapCalendar);
|
||||
var attendees = aItem.getAttendees({});
|
||||
for each(var attendee in attendees) {
|
||||
if (attendee.id == wcapCalendar.ownerId) {
|
||||
attendee.participationStatus = aStatus;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch(e) {}
|
||||
return false;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="accept">
|
||||
<body><![CDATA[
|
||||
this.participationStatus = "ACCEPTED";
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="decline">
|
||||
<body><![CDATA[
|
||||
this.participationStatus = "DECLINED";
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="DOMAttrModified"><![CDATA[
|
||||
if (event.attrName != "selected" ||
|
||||
event.originalTarget.getAttribute("anonid") !=
|
||||
"invitations-listitem") {
|
||||
return;
|
||||
}
|
||||
var acceptButton = document.getAnonymousElementByAttribute(
|
||||
this, "anonid", "accept");
|
||||
var declineButton = document.getAnonymousElementByAttribute(
|
||||
this, "anonid", "decline");
|
||||
if (event.newValue == "true") {
|
||||
acceptButton.removeAttribute("hidden");
|
||||
declineButton.removeAttribute("hidden");
|
||||
} else if (event.newValue == "false") {
|
||||
acceptButton.setAttribute("hidden", "true");
|
||||
declineButton.setAttribute("hidden", "true");
|
||||
}
|
||||
]]></handler>
|
||||
</handlers>
|
||||
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
||||
<!-- -*- Mode: xml; indent-tabs-mode: nil; -*- -->
|
495
calendar/prototypes/wcap/calendar-invitations-manager.js
vendored
Normal file
495
calendar/prototypes/wcap/calendar-invitations-manager.js
vendored
Normal file
@ -0,0 +1,495 @@
|
||||
/* -*- 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
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Sun Microsystems code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Thomas Benisch <thomas.benisch@sun.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var gInvitationsManager = null;
|
||||
|
||||
function getInvitationsManager() {
|
||||
if (!gInvitationsManager) {
|
||||
gInvitationsManager = new InvitationsManager();
|
||||
}
|
||||
return gInvitationsManager;
|
||||
}
|
||||
|
||||
function InvitationsManager() {
|
||||
this.mItemList = new Array();
|
||||
this.mRequestStatusList = new Array();
|
||||
this.mRequestsPending = 0;
|
||||
this.mOperationListeners = new Array();
|
||||
this.mStartDate = null;
|
||||
this.mJobsPending = 0;
|
||||
this.mTimer = null;
|
||||
this.mUnregisteredCalendars = new Array();
|
||||
var calendarManagerObserver = {
|
||||
mInvitationsManager: this,
|
||||
onCalendarRegistered: function(aCalendar) {
|
||||
},
|
||||
onCalendarUnregistering: function(aCalendar) {
|
||||
this.mInvitationsManager.unregisterCalendar(aCalendar);
|
||||
},
|
||||
onCalendarDeleting: function(aCalendar) {
|
||||
},
|
||||
onCalendarPrefSet: function(aCalendar, aName, aValue) {
|
||||
},
|
||||
onCalendarPrefDeleting: function(aCalendar, aName) {
|
||||
}
|
||||
};
|
||||
getCalendarManager().addObserver(calendarManagerObserver);
|
||||
}
|
||||
|
||||
InvitationsManager.prototype = {
|
||||
|
||||
mItemList: null,
|
||||
mRequestStatusList: null,
|
||||
mRequestsPending: 0,
|
||||
mOperationListeners: null,
|
||||
mStartDate: null,
|
||||
mJobsPending: 0,
|
||||
mTimer: null,
|
||||
mUnregisteredCalendars: null,
|
||||
|
||||
scheduleInvitationsUpdate:
|
||||
function(firstDelay, repeatDelay, operationListener) {
|
||||
if (this.mTimer) {
|
||||
this.mTimer.cancel();
|
||||
} else {
|
||||
this.mTimer =
|
||||
Components.classes["@mozilla.org/timer;1"]
|
||||
.createInstance(Components.interfaces.nsITimer);
|
||||
}
|
||||
var callback = {
|
||||
mInvitationsManager: this,
|
||||
mRepeatDelay: repeatDelay,
|
||||
mOperationListener: operationListener,
|
||||
notify: function(timer) {
|
||||
if (timer.delay != this.mRepeatDelay) {
|
||||
timer.delay = this.mRepeatDelay;
|
||||
}
|
||||
this.mInvitationsManager.getInvitations(
|
||||
this.mOperationListener);
|
||||
}
|
||||
};
|
||||
this.mTimer.initWithCallback(callback, firstDelay,
|
||||
this.mTimer.TYPE_REPEATING_SLACK);
|
||||
},
|
||||
|
||||
cancelInvitationsUpdate: function() {
|
||||
if (this.mTimer) {
|
||||
this.mTimer.cancel();
|
||||
}
|
||||
},
|
||||
|
||||
getInvitations: function(operationListener1, operationListener2) {
|
||||
if (operationListener1) {
|
||||
this.addOperationListener(operationListener1);
|
||||
}
|
||||
if (operationListener2) {
|
||||
this.addOperationListener(operationListener2);
|
||||
}
|
||||
this.updateStartDate();
|
||||
var calendars = getCalendarManager().getCalendars({});
|
||||
for each (var calendar in calendars) {
|
||||
try {
|
||||
var wcapCalendar = calendar.QueryInterface(
|
||||
Components.interfaces.calIWcapCalendar);
|
||||
wcapCalendar = wcapCalendar.session.getCalendarByCalId(
|
||||
wcapCalendar.session.wrappedJSObject.defaultCalId);
|
||||
var listener = {
|
||||
mInvitationsManager: this,
|
||||
QueryInterface: function(aIID) {
|
||||
if (!aIID.equals(Components.interfaces.nsISupports) &&
|
||||
!aIID.equals(Components.interfaces.calIOperationListener) &&
|
||||
!aIID.equals(Components.interfaces.calIObserver)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
// calIOperationListener
|
||||
onOperationComplete:
|
||||
function(aCalendar, aStatus, aOperationType, aId, aDetail) {
|
||||
if (aOperationType != Components.interfaces.calIOperationListener.GET &&
|
||||
aOperationType != Components.interfaces.calIWcapCalendar.SYNC) {
|
||||
return;
|
||||
}
|
||||
var requestStatus =
|
||||
this.mInvitationsManager.getRequestStatus(aCalendar);
|
||||
if (Components.isSuccessCode(aStatus)) {
|
||||
if (requestStatus.firstRequest) {
|
||||
requestStatus.firstRequest = false;
|
||||
requestStatus.lastUpdate = requestStatus.firstRequestStarted;
|
||||
} else {
|
||||
requestStatus.lastUpdate = aDetail;
|
||||
}
|
||||
}
|
||||
requestStatus.requestPending = false;
|
||||
this.mInvitationsManager.mRequestsPending--;
|
||||
if (this.mInvitationsManager.mRequestsPending == 0) {
|
||||
this.mInvitationsManager.deleteUnregisteredCalendarItems();
|
||||
this.mInvitationsManager.mItemList.sort(
|
||||
function (a, b) {
|
||||
var dateA = a.startDate.getInTimezone(calendarDefaultTimezone());
|
||||
var dateB = b.startDate.getInTimezone(calendarDefaultTimezone());
|
||||
return dateA.compare(dateB);
|
||||
});
|
||||
var listener;
|
||||
while ((listener = this.mInvitationsManager.mOperationListeners.shift())) {
|
||||
listener.onGetResult(
|
||||
null,
|
||||
Components.results.NS_OK,
|
||||
Components.interfaces.calIItemBase,
|
||||
null,
|
||||
this.mInvitationsManager.mItemList.length,
|
||||
this.mInvitationsManager.mItemList);
|
||||
listener.onOperationComplete(
|
||||
null,
|
||||
Components.results.NS_OK,
|
||||
Components.interfaces.calIOperationListener.GET,
|
||||
null,
|
||||
null );
|
||||
}
|
||||
}
|
||||
},
|
||||
onGetResult:
|
||||
function(aCalendar, aStatus, aItemType, aDetail, aCount, aItems) {
|
||||
if (!Components.isSuccessCode(aStatus)) {
|
||||
return;
|
||||
}
|
||||
for each (item in aItems) {
|
||||
this.mInvitationsManager.addItem(item);
|
||||
}
|
||||
},
|
||||
// calIObserver
|
||||
onStartBatch: function() {
|
||||
},
|
||||
onEndBatch: function() {
|
||||
},
|
||||
onLoad: function() {
|
||||
},
|
||||
onAddItem: function(aItem) {
|
||||
this.mInvitationsManager.addItem(aItem);
|
||||
},
|
||||
onModifyItem: function(aNewItem, aOldItem) {
|
||||
this.mInvitationsManager.deleteItem(aNewItem);
|
||||
this.mInvitationsManager.addItem(aNewItem);
|
||||
},
|
||||
onDeleteItem: function(aDeletedItem) {
|
||||
this.mInvitationsManager.deleteItem(aDeletedItem);
|
||||
},
|
||||
onError: function(aErrNo, aMessage) {
|
||||
}
|
||||
};
|
||||
var requestStatus = this.getRequestStatus(wcapCalendar);
|
||||
if (!requestStatus) {
|
||||
requestStatus = {
|
||||
calendar: wcapCalendar,
|
||||
firstRequest: true,
|
||||
firstRequestStarted: null,
|
||||
requestPending: false,
|
||||
lastUpdate: null
|
||||
};
|
||||
this.addRequestStatus(requestStatus);
|
||||
}
|
||||
if (!requestStatus.requestPending) {
|
||||
requestStatus.requestPending = true;
|
||||
this.mRequestsPending++;
|
||||
if (requestStatus.firstRequest) {
|
||||
requestStatus.firstRequestStarted = this.getDate();
|
||||
wcapCalendar.getItems(
|
||||
wcapCalendar.ITEM_FILTER_REQUEST_NEEDS_ACTION, 0,
|
||||
this.mStartDate, null, listener);
|
||||
} else {
|
||||
wcapCalendar.syncChangesTo(null,
|
||||
wcapCalendar.ITEM_FILTER_TYPE_EVENT,
|
||||
requestStatus.lastUpdate, listener);
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
}
|
||||
}
|
||||
if (this.mRequestsPending == 0) {
|
||||
this.deleteUnregisteredCalendarItems();
|
||||
var listener;
|
||||
while ((listener = this.mOperationListeners.shift())) {
|
||||
listener.onOperationComplete(
|
||||
null,
|
||||
Components.results.NS_ERROR_FAILURE,
|
||||
Components.interfaces.calIOperationListener.GET,
|
||||
null,
|
||||
null );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
openInvitationsDialog: function(onLoadOperationListener, finishedCallBack) {
|
||||
var args = new Object();
|
||||
args.onLoadOperationListener = onLoadOperationListener;
|
||||
args.queue = new Array();
|
||||
args.finishedCallBack = finishedCallBack;
|
||||
args.operationListenerWrapper = {
|
||||
operationListener: null,
|
||||
onOperationComplete:
|
||||
function(aCalendar, aStatus, aOperationType, aId, aDetail) {
|
||||
if(this.operationListener) {
|
||||
this.operationListener.onOperationComplete(
|
||||
aCalendar, aStatus, aOperationType, aId, aDetail);
|
||||
}
|
||||
},
|
||||
onGetResult:
|
||||
function(aCalendar, aStatus, aItemType, aDetail, aCount, aItems) {
|
||||
if(this.operationListener) {
|
||||
this.operationListener.onGetResult(
|
||||
aCalendar, aStatus, aItemType, aDetail, aCount, aItems);
|
||||
}
|
||||
}
|
||||
};
|
||||
args.invitationsManager = this;
|
||||
// the dialog will reset this to auto when it is done loading
|
||||
window.setCursor("wait");
|
||||
// open the dialog modally
|
||||
window.openDialog(
|
||||
"chrome://calendar/content/calendar-invitations-dialog.xul",
|
||||
"_blank",
|
||||
"chrome,titlebar,modal,resizable",
|
||||
args);
|
||||
},
|
||||
|
||||
processJobQueue: function(queue, jobQueueFinishedCallBack) {
|
||||
// TODO: undo/redo
|
||||
var operationListener = {
|
||||
mInvitationsManager: this,
|
||||
mJobQueueFinishedCallBack: jobQueueFinishedCallBack,
|
||||
onOperationComplete:
|
||||
function(aCalendar, aStatus, aOperationType, aId, aDetail) {
|
||||
if (Components.isSuccessCode(aStatus) &&
|
||||
aOperationType == Components.interfaces.calIOperationListener.MODIFY) {
|
||||
this.mInvitationsManager.deleteItem(aDetail);
|
||||
this.mInvitationsManager.addItem(aDetail);
|
||||
}
|
||||
this.mInvitationsManager.mJobsPending--;
|
||||
if (this.mInvitationsManager.mJobsPending == 0 &&
|
||||
this.mJobQueueFinishedCallBack) {
|
||||
this.mJobQueueFinishedCallBack();
|
||||
}
|
||||
},
|
||||
onGetResult:
|
||||
function(aCalendar, aStatus, aItemType, aDetail, aCount, aItems) {
|
||||
}
|
||||
};
|
||||
this.mJobsPending = 0;
|
||||
for (var i = 0; i < queue.length; i++) {
|
||||
var job = queue[i];
|
||||
var oldItem = job.oldItem;
|
||||
var newItem = job.newItem;
|
||||
switch (job.action) {
|
||||
case 'modify':
|
||||
this.mJobsPending++;
|
||||
newItem.calendar.modifyItem(
|
||||
newItem, oldItem, operationListener);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (this.mJobsPending == 0 && jobQueueFinishedCallBack) {
|
||||
jobQueueFinishedCallBack();
|
||||
}
|
||||
},
|
||||
|
||||
hasItem: function(item) {
|
||||
for (var i = 0; i < this.mItemList.length; ++i) {
|
||||
if (this.mItemList[i].hasSameIds(item)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
addItem: function(item) {
|
||||
var recInfo = item.recurrenceInfo;
|
||||
if (recInfo && this.getParticipationStatus(item) != "NEEDS-ACTION") {
|
||||
var ids = recInfo.getExceptionIds({});
|
||||
for each (var id in ids) {
|
||||
var ex = recInfo.getExceptionFor(id, false);
|
||||
if (ex && this.validateItem(ex) && !this.hasItem(ex)) {
|
||||
this.mItemList.push(ex);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.validateItem(item) && !this.hasItem(item)) {
|
||||
this.mItemList.push(item);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
deleteItem: function(item) {
|
||||
var i = 0;
|
||||
while (i < this.mItemList.length) {
|
||||
// delete all items with the same id from the list;
|
||||
// if item is a recurrent event, also all exceptions are deleted
|
||||
if (this.mItemList[i].id == item.id) {
|
||||
this.mItemList.splice(i, 1);
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getRequestStatus: function(calendar) {
|
||||
var requestStatus = null;
|
||||
for each (var entry in this.mRequestStatusList) {
|
||||
if (entry.calendar.uri.equals(calendar.uri)) {
|
||||
requestStatus = entry;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return requestStatus;
|
||||
},
|
||||
|
||||
addRequestStatus: function(requestStatus) {
|
||||
this.mRequestStatusList.push(requestStatus);
|
||||
},
|
||||
|
||||
deleteRequestStatus: function(calendar) {
|
||||
for (var i = 0; i < this.mRequestStatusList.length; ++i) {
|
||||
if (this.mRequestStatusList[i].calendar == calendar) {
|
||||
this.mRequestStatusList.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
addOperationListener: function(operationListener) {
|
||||
for each (var listener in this.mOperationListeners) {
|
||||
if (listener == operationListener) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
this.mOperationListeners.push(operationListener);
|
||||
return true;
|
||||
},
|
||||
|
||||
getDate: function() {
|
||||
var date = Components.classes["@mozilla.org/calendar/datetime;1"]
|
||||
.createInstance(Components.interfaces.calIDateTime);
|
||||
date.jsDate = new Date();
|
||||
return date;
|
||||
},
|
||||
|
||||
getStartDate: function() {
|
||||
var date = Components.classes["@mozilla.org/calendar/datetime;1"]
|
||||
.createInstance(Components.interfaces.calIDateTime);
|
||||
date.jsDate = new Date();
|
||||
date = date.getInTimezone(calendarDefaultTimezone());
|
||||
date.hour = 0;
|
||||
date.minute = 0;
|
||||
date.second = 0;
|
||||
return date;
|
||||
},
|
||||
|
||||
updateStartDate: function() {
|
||||
if (!this.mStartDate) {
|
||||
this.mStartDate = this.getStartDate();
|
||||
} else {
|
||||
var startDate = this.getStartDate();
|
||||
if (startDate.compare(this.mStartDate) > 0) {
|
||||
this.mStartDate = startDate;
|
||||
var i = 0;
|
||||
while (i < this.mItemList.length) {
|
||||
if (!this.validateItem(this.mItemList[i])) {
|
||||
this.mItemList.splice(i, 1);
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
validateItem: function(item) {
|
||||
var participationStatus = this.getParticipationStatus(item);
|
||||
if (participationStatus != "NEEDS-ACTION") {
|
||||
return false;
|
||||
}
|
||||
if (item.recurrenceInfo) {
|
||||
return true;
|
||||
} else {
|
||||
var startDate = item.startDate.getInTimezone(calendarDefaultTimezone());
|
||||
if (startDate.compare(this.mStartDate) >= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
getParticipationStatus: function(item) {
|
||||
try {
|
||||
var wcapCalendar = item.calendar.QueryInterface(
|
||||
Components.interfaces.calIWcapCalendar);
|
||||
var attendees = item.getAttendees({});
|
||||
for each(var attendee in attendees) {
|
||||
if (attendee.id == wcapCalendar.ownerId) {
|
||||
return attendee.participationStatus;
|
||||
}
|
||||
}
|
||||
} catch(e) {}
|
||||
return null;
|
||||
},
|
||||
|
||||
unregisterCalendar: function(calendar) {
|
||||
try {
|
||||
var wcapCalendar = calendar.QueryInterface(
|
||||
Components.interfaces.calIWcapCalendar);
|
||||
this.mUnregisteredCalendars.push(wcapCalendar);
|
||||
} catch(e) {}
|
||||
},
|
||||
|
||||
deleteUnregisteredCalendarItems: function() {
|
||||
var calendar;
|
||||
while ((calendar = this.mUnregisteredCalendars.shift())) {
|
||||
// delete all unregistered calendar items
|
||||
var i = 0;
|
||||
while (i < this.mItemList.length) {
|
||||
if (this.mItemList[i].calendar.uri.equals(calendar.uri)) {
|
||||
this.mItemList.splice(i, 1);
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
// delete unregistered calendar request status entry
|
||||
this.deleteRequestStatus(calendar);
|
||||
}
|
||||
}
|
||||
};
|
105
calendar/prototypes/wcap/sun-messenger-overlay-sidebar.js
vendored
Normal file
105
calendar/prototypes/wcap/sun-messenger-overlay-sidebar.js
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
/* -*- 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
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Sun Microsystems code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Thomas Benisch <thomas.benisch@sun.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const FIRST_DELAY_STARTUP = 100;
|
||||
const FIRST_DELAY_RESCHEDULE = 100;
|
||||
const FIRST_DELAY_REGISTER = 10000;
|
||||
const FIRST_DELAY_UNREGISTER = 0;
|
||||
const REPEAT_DELAY = 180000;
|
||||
|
||||
var sideBarOperationListener = {
|
||||
onOperationComplete: function(aCalendar, aStatus, aOperationType, aId, aDetail) {
|
||||
if (!Components.isSuccessCode(aStatus)) {
|
||||
var invitationsBox = document.getElementById("invitations");
|
||||
invitationsBox.setAttribute("hidden", "true");
|
||||
}
|
||||
},
|
||||
onGetResult: function(aCalendar, aStatus, aItemType, aDetail, aCount, aItems) {
|
||||
if (!Components.isSuccessCode(aStatus)) {
|
||||
return;
|
||||
}
|
||||
var invitationsBox = document.getElementById("invitations");
|
||||
var value = invitationsLabel + " (" + aCount + ")";
|
||||
invitationsBox.setAttribute("value", value);
|
||||
invitationsBox.removeAttribute("hidden");
|
||||
}
|
||||
};
|
||||
|
||||
var calendarManagerObserver = {
|
||||
mSideBar: this,
|
||||
onCalendarRegistered: function(aCalendar) {
|
||||
this.mSideBar.rescheduleInvitationsUpdate(FIRST_DELAY_REGISTER, REPEAT_DELAY);
|
||||
},
|
||||
onCalendarUnregistering: function(aCalendar) {
|
||||
this.mSideBar.rescheduleInvitationsUpdate(FIRST_DELAY_UNREGISTER, REPEAT_DELAY);
|
||||
},
|
||||
onCalendarDeleting: function(aCalendar) {
|
||||
},
|
||||
onCalendarPrefSet: function(aCalendar, aName, aValue) {
|
||||
},
|
||||
onCalendarPrefDeleting: function(aCalendar, aName) {
|
||||
}
|
||||
};
|
||||
|
||||
function onLoad() {
|
||||
scheduleInvitationsUpdate(FIRST_DELAY_STARTUP, REPEAT_DELAY);
|
||||
getCalendarManager().addObserver(calendarManagerObserver);
|
||||
document.addEventListener("unload", onUnload, true);
|
||||
}
|
||||
|
||||
function onUnload() {
|
||||
document.removeEventListener("unload", onUnload, true);
|
||||
getCalendarManager().removeObserver(calendarManagerObserver);
|
||||
}
|
||||
|
||||
function scheduleInvitationsUpdate(firstDelay, repeatDelay) {
|
||||
getInvitationsManager().scheduleInvitationsUpdate(firstDelay, repeatDelay, sideBarOperationListener);
|
||||
}
|
||||
|
||||
function rescheduleInvitationsUpdate(firstDelay, repeatDelay) {
|
||||
getInvitationsManager().cancelInvitationsUpdate();
|
||||
scheduleInvitationsUpdate(firstDelay, repeatDelay);
|
||||
}
|
||||
|
||||
function openInvitationsDialog() {
|
||||
getInvitationsManager().cancelInvitationsUpdate();
|
||||
getInvitationsManager().openInvitationsDialog(
|
||||
sideBarOperationListener,
|
||||
function() { scheduleInvitationsUpdate(FIRST_DELAY_RESCHEDULE, REPEAT_DELAY); });
|
||||
}
|
||||
|
||||
onLoad();
|
Loading…
Reference in New Issue
Block a user