Add basic calendar management.
bug 285014, r=shaver git-svn-id: svn://10.0.0.236/trunk@172750 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -187,10 +187,13 @@ function calendarInit()
|
||||
prepareCalendarToDoUnifinder();
|
||||
|
||||
update_date();
|
||||
|
||||
|
||||
checkForMailNews();
|
||||
|
||||
updateColors();
|
||||
initCalendarManager();
|
||||
|
||||
//XXX Reimplement this function so that eventboxes will be colored
|
||||
//updateColors();
|
||||
}
|
||||
|
||||
function updateColors()
|
||||
@@ -655,40 +658,17 @@ function newToDoCommand()
|
||||
newToDo( null, null ); // new task button defaults to undated todo
|
||||
}
|
||||
|
||||
function getCalendar()
|
||||
{
|
||||
var calendarList = document.getElementById("list-calendars-listbox");
|
||||
try {
|
||||
var selectedCalendar = calendarList.selectedItem.calendar;
|
||||
return selectedCalendar;
|
||||
} catch(e) {
|
||||
newCalendarDialog();
|
||||
selectedCalendar = calendarList.selectedItem.calendar;
|
||||
return selectedCalendar;
|
||||
}
|
||||
}
|
||||
|
||||
function newCalendarDialog()
|
||||
{
|
||||
openCalendarWizard(afterCreateWizardFinish);
|
||||
openCalendarWizard();
|
||||
}
|
||||
|
||||
var gDisplayComposite;
|
||||
|
||||
function getDisplayComposite()
|
||||
function editCalendarDialog(event)
|
||||
{
|
||||
if (!gDisplayComposite) {
|
||||
gDisplayComposite = Components.classes["@mozilla.org/calendar/calendar;1?type=composite"]
|
||||
.createInstance(Components.interfaces.calICompositeCalendar);
|
||||
var calMgr = getCalendarManager();
|
||||
var calList = calMgr.getCalendars({});
|
||||
for (i in calList) {
|
||||
gDisplayComposite.addCalendar(calList[i]);
|
||||
}
|
||||
}
|
||||
return gDisplayComposite;
|
||||
openCalendarProperties(document.popupNode.calendar, null);
|
||||
}
|
||||
|
||||
|
||||
function appendCalendars(to, froms, listener)
|
||||
{
|
||||
var getListener = {
|
||||
@@ -1201,7 +1181,7 @@ function publishEntireCalendarDialogResponse( CalendarPublishObject )
|
||||
{
|
||||
var icsURL = makeURL(CalendarPublishObject.remotePath);
|
||||
|
||||
var oldCalendar = getCalendar(); // get the currently selected calendar
|
||||
var oldCalendar = getDefaultCalendar(); // get the currently selected calendar
|
||||
|
||||
// create an ICS calendar, but don't register it
|
||||
var calManager = getCalendarManager();
|
||||
@@ -1209,7 +1189,7 @@ function publishEntireCalendarDialogResponse( CalendarPublishObject )
|
||||
var newCalendar = calManager.createCalendar(oldCalendar.name, "ics", icsURL);
|
||||
} catch (ex) {
|
||||
dump(ex);
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
var getListener = {
|
||||
@@ -1436,26 +1416,6 @@ function CalendarToolboxCustomizeDone(aToolboxChanged)
|
||||
window.focus();
|
||||
}
|
||||
|
||||
/* Called from doCreateWizardFinished after the calendar is created. */
|
||||
function afterCreateWizardFinish(newCalendar)
|
||||
{
|
||||
addCalendarToUI(window.opener.document, newCalendar);
|
||||
}
|
||||
|
||||
function addCalendarToUI(doc, calendar)
|
||||
{
|
||||
var listItem = doc.createElement("listitem");
|
||||
var listCell = doc.createElement("listcell");
|
||||
listCell.setAttribute("label", calendar.name);
|
||||
listItem.appendChild(listCell);
|
||||
listItem.calendar = calendar;
|
||||
var calendarList = doc.getElementById("list-calendars-listbox");
|
||||
calendarList.appendChild(listItem);
|
||||
if (calendarList.selectedIndex == -1)
|
||||
calendarList.selectedIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pick whichever of "black" or "white" will look better when used as a text
|
||||
* color against a background of bgColor.
|
||||
|
||||
@@ -101,13 +101,9 @@
|
||||
<command id="modify_todo_command" oncommand="modifyToDoCommand( event )"/>
|
||||
<command id="delete_todo_command" oncommand="deleteToDoCommand()" disabled="true"/>
|
||||
|
||||
<command id="new_local_calendar_command" oncommand="newCalendarDialog()"/>
|
||||
<command id="open_local_calendar_command" oncommand="gCalendarWindow.calendarManager.launchOpenCalendarFileDialog()"/>
|
||||
<command id="edit_local_calendar_command" oncommand="gCalendarWindow.calendarManager.launchEditCalendarDialog()"/>
|
||||
<command id="new_server_command" oncommand="gCalendarWindow.calendarManager.launchAddRemoteCalendarDialog()"/>
|
||||
<command id="edit_server_command" oncommand="gCalendarWindow.calendarManager.launchEditRemoteCalendarDialog()"/>
|
||||
<command id="delete_server_command" oncommand="deleteCalendar()"/>
|
||||
<command id="find_new_calendar_command" oncommand="goFindNewCalendars()"/>
|
||||
<command id="new_calendar_command" oncommand="newCalendarDialog()"/>
|
||||
<command id="edit_calendar_command" oncommand="editCalendarDialog(event)"/>
|
||||
<command id="delete_calendar_command" oncommand="deleteCalendar()"/>
|
||||
|
||||
<command id="next_command" oncommand="gCalendarWindow.currentView.goToNext()"/>
|
||||
<command id="previous_command" oncommand="gCalendarWindow.currentView.goToPrevious()"/>
|
||||
@@ -212,7 +208,7 @@
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/dragDrop.js"/>
|
||||
|
||||
<!-- NEEDED FOR MULTIPLE CALENDAR SUPPORT -->
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/calendarManager.js"/>
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/calendarManagement.js"/>
|
||||
|
||||
<!-- NEEDED FOR CLIPBOARD SUPPORT -->
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/clipboard.js"/>
|
||||
@@ -408,13 +404,13 @@
|
||||
<popup id="calendarlist-context-menu">
|
||||
<menuitem label="&calendar.context.newserver.label;"
|
||||
accesskey="&calendar.context.newserver.accesskey;"
|
||||
observes="new_local_calendar_command"/>
|
||||
observes="new_calendar_command"/>
|
||||
<menuitem label="&calendar.context.editserver.label;"
|
||||
accesskey="&calendar.context.editserver.accesskey;"
|
||||
observes="edit_local_calendar_command"/>
|
||||
observes="edit_calendar_command"/>
|
||||
<menuitem label="&calendar.context.deleteserver.label;"
|
||||
accesskey="&calendar.context.deleteserver.accesskey;"
|
||||
observes="delete_server_command"/>
|
||||
observes="delete_calendar_command"/>
|
||||
<menuitem label="&calendar.context.reloadserver.label;"
|
||||
accesskey="&calendar.context.reloadserver.accesskey;"
|
||||
observes="reload_remote_calendars"/>
|
||||
@@ -530,13 +526,10 @@
|
||||
<!--<vbox id="left-hand-above-splitter" flex="1">-->
|
||||
<listbox id="list-calendars-listbox" class="unifinder-tree-class" flex="1"
|
||||
contextmenu="calendarlist-context-menu">
|
||||
<listhead>
|
||||
<listheader flex="1" crop="end" label="&calendar.calendarlistbox.label;"/>
|
||||
<listheader/>
|
||||
</listhead>
|
||||
<listcols>
|
||||
<listcol flex="1"/>
|
||||
<listcol/>
|
||||
<listcol/>
|
||||
<listcol flex="1"/>
|
||||
</listcols>
|
||||
</listbox>
|
||||
<!--</vbox>-->
|
||||
|
||||
@@ -91,9 +91,5 @@ function doCreateCalendar()
|
||||
|
||||
calManager.setCalendarPref(newCalendar, 'color', cal_color);
|
||||
|
||||
// XXX This requires the caller to have calendar.js to be included.
|
||||
// It should use observers to the calendar manager.
|
||||
addCalendarToUI(window.opener.document, newCalendar);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
209
mozilla/calendar/resources/content/calendarManagement.js
Normal file
209
mozilla/calendar/resources/content/calendarManagement.js
Normal file
@@ -0,0 +1,209 @@
|
||||
/* -*- 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 mozilla calendar code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Michiel van Leeuwen <mvl@exedo.nl>
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* 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 getListItem(aCalendar) {
|
||||
var calendarList = document.getElementById("list-calendars-listbox");
|
||||
for (item = calendarList.firstChild;
|
||||
item;
|
||||
item = item.nextSibling) {
|
||||
if (item.calendar == aCalendar ) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// For observing changes to the list of calendars
|
||||
var calCalendarManagerObserver = {
|
||||
QueryInterface: function(aIID) {
|
||||
if (!aIID.equals(Components.interfaces.calICalendarManagerObserver) &&
|
||||
!aIID.equals(Components.interfaces.nsISupports)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
onCalendarRegistered: function(aCalendar) {
|
||||
setCalendarManagerUI();
|
||||
},
|
||||
|
||||
onCalendarUnregistering: function(aCalendar) {
|
||||
setCalendarManagerUI();
|
||||
},
|
||||
|
||||
onCalendarDeleting: function(aCalendar) {
|
||||
setCalendarManagerUI();
|
||||
},
|
||||
|
||||
onCalendarPrefSet: function(aCalendar, aName, aValue) {
|
||||
if (aName == 'color') {
|
||||
var item = getListItem(aCalendar);
|
||||
if (item) {
|
||||
var colorCell = item.childNodes[1];
|
||||
colorCell.style.background = aValue;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onCalendarPrefDeleting: function(aCalendar, aName) {
|
||||
setCalendarManagerUI();
|
||||
}
|
||||
};
|
||||
|
||||
// For observing changes to the list of _active_ calendars
|
||||
var calCompositeCalendarObserver = {
|
||||
QueryInterface: function(aIID) {
|
||||
if (!aIID.equals(Components.interfaces.calIObserver) &&
|
||||
!aIID.equals(Components.interfaces.calICompositeObserver) &&
|
||||
!aIID.equals(Components.interfaces.nsISupports)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
// calICompositeObserver
|
||||
onCalendarAdded: function (aCalendar) {
|
||||
var item = getListItem(aCalendar);
|
||||
if (item) {
|
||||
var checkCell = item.firstChild;
|
||||
checkCell.setAttribute('checked', true);
|
||||
}
|
||||
},
|
||||
|
||||
onCalendarRemoved: function (aCalendar) {
|
||||
var item = getListItem(aCalendar);
|
||||
if (item) {
|
||||
var checkCell = item.firstChild;
|
||||
checkCell.setAttribute('checked', false);
|
||||
}
|
||||
},
|
||||
|
||||
onDefaultCalendarChanged: function (aNewDefaultCalendar) {
|
||||
// make the calendar bold in the tree
|
||||
},
|
||||
|
||||
// calIObserver
|
||||
onStartBatch: function() { },
|
||||
onEndBatch: function() { },
|
||||
onLoad: function() { },
|
||||
onAddItem: function(aItem) { },
|
||||
onModifyItem: function(aNewItem, aOldItem) { },
|
||||
onDeleteItem: function(aDeletedItem) { },
|
||||
onAlarm: function(aAlarmItem) { },
|
||||
onError: function(aErrNo, aMessage) { }
|
||||
};
|
||||
|
||||
function onCalendarCheckboxClick(event) {
|
||||
// This is a HACK.
|
||||
// It seems to be impossible to add onClick to a listCell.
|
||||
// Workaround that by checking the coordinates of the click.
|
||||
var checkElem = event.target.firstChild;
|
||||
if ((event.clientX < checkElem.boxObject.x + checkElem.boxObject.width) &&
|
||||
(event.clientX > checkElem.boxObject.x)) {
|
||||
|
||||
// clicked the checkbox cell
|
||||
|
||||
var cal = event.target.calendar;
|
||||
if (checkElem.getAttribute('checked') == "true") {
|
||||
getDisplayComposite().removeCalendar(cal.uri);
|
||||
} else {
|
||||
getDisplayComposite().addCalendar(cal);
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
function setCalendarManagerUI()
|
||||
{
|
||||
var calendarList = document.getElementById("list-calendars-listbox");
|
||||
var child;
|
||||
while ((child = calendarList.lastChild) && (child.tagName == "listitem")) {
|
||||
calendarList.removeChild(child);
|
||||
}
|
||||
|
||||
var calmgr = getCalendarManager();
|
||||
var calendars = calmgr.getCalendars({});
|
||||
for each (var calendar in calendars) {
|
||||
var listItem = document.createElement("listitem");
|
||||
|
||||
var checkCell = document.createElement("listcell");
|
||||
checkCell.setAttribute("type", "checkbox");
|
||||
checkCell.setAttribute("checked", true);
|
||||
listItem.appendChild(checkCell);
|
||||
listItem.addEventListener("click", onCalendarCheckboxClick, true);
|
||||
|
||||
var colorCell = document.createElement("listcell");
|
||||
try {
|
||||
var calColor = calmgr.getCalendarPref(calendar, 'color');
|
||||
colorCell.style.background = calColor;
|
||||
} catch(e) {}
|
||||
listItem.appendChild(colorCell);
|
||||
|
||||
var nameCell = document.createElement("listcell");
|
||||
nameCell.setAttribute("label", calendar.name);
|
||||
listItem.appendChild(nameCell);
|
||||
listItem.calendar = calendar;
|
||||
calendarList.appendChild(listItem);
|
||||
|
||||
if (calendarList.selectedIndex == -1)
|
||||
calendarList.selectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function initCalendarManager()
|
||||
{
|
||||
getCalendarManager().addObserver(calCalendarManagerObserver);
|
||||
getDisplayComposite().addObserver(calCompositeCalendarObserver, 0);
|
||||
setCalendarManagerUI();
|
||||
}
|
||||
|
||||
function getDefaultCalendar()
|
||||
{
|
||||
var calendarList = document.getElementById("list-calendars-listbox");
|
||||
try {
|
||||
var selectedCalendar = calendarList.selectedItem.calendar;
|
||||
return selectedCalendar;
|
||||
} catch(e) {
|
||||
newCalendarDialog();
|
||||
selectedCalendar = calendarList.selectedItem.calendar;
|
||||
return selectedCalendar;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
79
mozilla/calendar/resources/content/calendarProperties.js
Normal file
79
mozilla/calendar/resources/content/calendarProperties.js
Normal file
@@ -0,0 +1,79 @@
|
||||
/* -*- 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 Calendar Code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Michiel van Leeuwen <mvl@exedo.nl>.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
/**
|
||||
* To open the window, use an object as argument.
|
||||
* This object needs two properties: calendar and onOk.
|
||||
* (where onOk can be null)
|
||||
*/
|
||||
|
||||
var gCalendar;
|
||||
|
||||
function loadCalendarPropertiesDialog()
|
||||
{
|
||||
var args = window.arguments[0];
|
||||
|
||||
gCalendar = args.calendar;
|
||||
|
||||
var calManager = getCalendarManager();
|
||||
|
||||
document.getElementById("calendar-name").value = gCalendar.name;
|
||||
document.getElementById("calendar-color").color =
|
||||
calManager.getCalendarPref(gCalendar, 'color');
|
||||
document.getElementById("calendar-uri").value = gCalendar.uri.spec;
|
||||
|
||||
// start focus on title
|
||||
document.getElementById("calendar-name").focus();
|
||||
|
||||
sizeToContent();
|
||||
}
|
||||
|
||||
function onOKCommand()
|
||||
{
|
||||
gCalendar.name = document.getElementById("calendar-name").value;
|
||||
|
||||
var newUri = makeURL(document.getElementById("calendar-uri").value);
|
||||
if (!newUri.equals(gCalendar.uri))
|
||||
gCalendar.uri = newUri;
|
||||
|
||||
var calManager = getCalendarManager();
|
||||
calManager.setCalendarPref(gCalendar, 'color',
|
||||
document.getElementById("calendar-color").color);
|
||||
|
||||
// tell standard dialog stuff to close the dialog
|
||||
return true;
|
||||
}
|
||||
95
mozilla/calendar/resources/content/calendarProperties.xul
Normal file
95
mozilla/calendar/resources/content/calendarProperties.xul
Normal file
@@ -0,0 +1,95 @@
|
||||
<?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 Calendar Code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Michiel van Leeuwen <mvl@exedo.nl>
|
||||
- Portions created by the Initial Developer are Copyright (C) 2005
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
-
|
||||
- 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 ***** -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog
|
||||
[
|
||||
<!ENTITY % dtd1 SYSTEM "chrome://calendar/locale/global.dtd" > %dtd1;
|
||||
<!ENTITY % dtd2 SYSTEM "chrome://calendar/locale/calendar.dtd" > %dtd2;
|
||||
]>
|
||||
|
||||
|
||||
<dialog
|
||||
id="calendar-properties-dialog"
|
||||
title="&calendar.server.dialog.title.edit;"
|
||||
buttons="accept,cancel"
|
||||
ondialogaccept="return onOKCommand();"
|
||||
ondialogcancel="return true;"
|
||||
onload="loadCalendarPropertiesDialog()"
|
||||
persist="screenX screenY"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="500"
|
||||
xmlns:nc="http://home.netscape.com/NC-rdf#">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/calendarProperties.js"/>
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/calendarUtils.js"/>
|
||||
|
||||
<!-- STRING BUNDLE for calendar properties -->
|
||||
<stringbundleset id="stringbundleset">
|
||||
<stringbundle id="bundle_calendar" src="chrome://calendar/locale/calendar.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
<column flex="1"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row align="center">
|
||||
<label value="&calendar.server.dialog.name.label;"/>
|
||||
<textbox flex="1" id="calendar-name"/>
|
||||
</row>
|
||||
|
||||
<row align="center">
|
||||
<label value="&calendar.server.dialog.color.label;"/>
|
||||
<hbox align="center">
|
||||
<colorpicker id="calendar-color"
|
||||
class="small-margin"
|
||||
type="button"
|
||||
palettename="standard"/>
|
||||
</hbox>
|
||||
</row>
|
||||
|
||||
<row align="center">
|
||||
<label value="Location:"/>
|
||||
<textbox id="calendar-uri"/>
|
||||
</row>
|
||||
|
||||
</rows>
|
||||
</grid>
|
||||
</dialog>
|
||||
@@ -39,10 +39,27 @@
|
||||
* Utility functions used by all calendar hosts (Sunbird, Lightning, etc.).
|
||||
* Functions in this file must _not_ depend on functions in any other files.
|
||||
*/
|
||||
|
||||
|
||||
function getCalendarManager()
|
||||
{
|
||||
return Components.classes["@mozilla.org/calendar/manager;1"].getService(Components.interfaces.calICalendarManager);
|
||||
var calendarManager = Components.classes["@mozilla.org/calendar/manager;1"]
|
||||
.getService(Components.interfaces.calICalendarManager);
|
||||
return calendarManager;
|
||||
}
|
||||
|
||||
var gDisplayComposite = null;
|
||||
function getDisplayComposite()
|
||||
{
|
||||
if (!gDisplayComposite) {
|
||||
gDisplayComposite = Components.classes["@mozilla.org/calendar/calendar;1?type=composite"]
|
||||
.createInstance(Components.interfaces.calICompositeCalendar);
|
||||
var calMgr = getCalendarManager();
|
||||
var calList = calMgr.getCalendars({});
|
||||
for (i in calList) {
|
||||
gDisplayComposite.addCalendar(calList[i]);
|
||||
}
|
||||
}
|
||||
return gDisplayComposite;
|
||||
}
|
||||
|
||||
function openCalendarWizard(callback)
|
||||
@@ -50,6 +67,13 @@ function openCalendarWizard(callback)
|
||||
openDialog("chrome://calendar/content/calendarCreation.xul", "caEditServer", "chrome,titlebar,modal", callback);
|
||||
}
|
||||
|
||||
function openCalendarProperties(aCalendar, callback)
|
||||
{
|
||||
openDialog("chrome://calendar/content/calendarProperties.xul",
|
||||
"caEditServer", "chrome,titlebar,modal",
|
||||
{calendar: aCalendar, onOk: callback});
|
||||
}
|
||||
|
||||
function makeURL(uriString)
|
||||
{
|
||||
var ioservice = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
|
||||
|
||||
@@ -138,14 +138,6 @@ function CalendarWindow( )
|
||||
|
||||
var calendarWindow = this;
|
||||
|
||||
// fill in the calendars list
|
||||
dump("\n\n\nlooking for calendars!!\n\n\n");
|
||||
var calendars = getCalendarManager().getCalendars({});
|
||||
for (var i = 0; i < calendars.length; i++) {
|
||||
dump(calendars[i]);
|
||||
addCalendarToUI(document, calendars[i]);
|
||||
}
|
||||
|
||||
var savedThis = this;
|
||||
var calendarObserver = {
|
||||
mInBatch: false,
|
||||
@@ -176,92 +168,8 @@ function CalendarWindow( )
|
||||
onAlarm: function(aAlarmItem) {},
|
||||
onError: function(aMessage) {}
|
||||
}
|
||||
var calendar = getCalendar();
|
||||
calendar.addObserver(calendarObserver, calendar.ITEM_FILTER_TYPE_ALL);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
this.calendarEventDataSourceObserver =
|
||||
{
|
||||
|
||||
onLoad : function()
|
||||
{
|
||||
//this is basically useless, since the calendar window is not yet made yet.
|
||||
},
|
||||
onStartBatch : function()
|
||||
{
|
||||
},
|
||||
onEndBatch : function()
|
||||
{
|
||||
calendarWindow.currentView.refreshEvents( );
|
||||
},
|
||||
|
||||
onAddItem : function( calendarEvent )
|
||||
{
|
||||
if( !gICalLib.batchMode )
|
||||
{
|
||||
if( calendarEvent )
|
||||
{
|
||||
calendarWindow.setSelectedEvent( calendarEvent );
|
||||
|
||||
calendarWindow.currentView.refreshEvents( );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onModifyItem : function( calendarEvent, originalEvent )
|
||||
{
|
||||
if( !gICalLib.batchMode )
|
||||
{
|
||||
calendarWindow.currentView.refreshEvents( );
|
||||
}
|
||||
},
|
||||
|
||||
onDeleteItem : function( calendarEvent, nextEvent )
|
||||
{
|
||||
//if you put this outside of the batch mode, deleting all events
|
||||
//puts the calendar into an infinite loop.
|
||||
|
||||
if( !gICalLib.batchMode )
|
||||
{
|
||||
calendarWindow.currentView.refreshEvents( );
|
||||
|
||||
if ( nextEvent )
|
||||
{
|
||||
calendarWindow.setSelectedEvent( nextEvent );
|
||||
}
|
||||
else
|
||||
{
|
||||
//get the tree, see if there are items to highlight.
|
||||
|
||||
var today = new Date( );
|
||||
|
||||
//calendarWindow.setSelectedDate( getNextOrPreviousRecurrence( calendarEvent ) );
|
||||
calendarWindow.setSelectedDate( today );
|
||||
|
||||
if( "hiliteSelectedDate" in calendarWindow.currentView )
|
||||
calendarWindow.currentView.hiliteSelectedDate( );
|
||||
}
|
||||
}
|
||||
},
|
||||
onAlarm : function( calendarEvent )
|
||||
{
|
||||
|
||||
},
|
||||
onError : function()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// add the observer to the event source
|
||||
|
||||
//gICalLib.addObserver( this.calendarEventDataSourceObserver );
|
||||
*/
|
||||
var ccalendar = getDisplayComposite();
|
||||
ccalendar.addObserver(calendarObserver);
|
||||
}
|
||||
|
||||
/** PUBLIC
|
||||
|
||||
@@ -258,7 +258,7 @@ var calendarViewDNDObserver = {
|
||||
}
|
||||
}
|
||||
}
|
||||
getCalendar().getItem(dropEvent.id, operationListener);
|
||||
getDisplayComposite().getItem(dropEvent.id, operationListener);
|
||||
} else {
|
||||
dump("failed\n");
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ function loadEventsFromFile()
|
||||
};
|
||||
|
||||
|
||||
appendCalendars(getCalendar(), [tmpCalendar], listener);
|
||||
appendCalendars(getDefaultCalendar(), [tmpCalendar], listener);
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
@@ -118,16 +118,7 @@
|
||||
key="new_calendar_key"
|
||||
label="&calendar.new.server.label;"
|
||||
accesskey="&calendar.new.server.accesskey;"
|
||||
observes="new_local_calendar_command"/>
|
||||
<menuitem id="calendar-open-calendar-menu"
|
||||
key="open_calendar_key"
|
||||
label="&calendar.open.file.label;"
|
||||
accesskey="&calendar.open.file.accesskey;"
|
||||
observes="open_local_calendar_command"/>
|
||||
<menuitem id="calendar-addserver-menu"
|
||||
label="&calendar.subscribe.label;"
|
||||
accesskey="&calendar.subscribe.accesskey;"
|
||||
observes="new_server_command"/>
|
||||
observes="new_calendar_command"/>
|
||||
<menuitem id="calendar-reloadserver-menu"
|
||||
key="reload_server_key"
|
||||
label="&calendar.reloadserver.label;"
|
||||
|
||||
@@ -138,7 +138,6 @@ var unifinderObserver = {
|
||||
|
||||
QueryInterface: function (aIID) {
|
||||
if (!aIID.equals(Components.interfaces.nsISupports) &&
|
||||
!aIID.equals(Components.interfaces.calICompositeObserver) &&
|
||||
!aIID.equals(Components.interfaces.calIObserver))
|
||||
{
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
@@ -14,6 +14,7 @@ calendar.jar:
|
||||
content/calendar/calExtOverlay.xul (content/calExtOverlay.xul)
|
||||
content/calendar/calendarMail.js (content/calendarMail.js)
|
||||
content/calendar/calendarManager.js (content/calendarManager.js)
|
||||
content/calendar/calendarManagement.js (content/calendarManagement.js)
|
||||
content/calendar/calendarOverlay.js (content/calendarOverlay.js)
|
||||
content/calendar/calendarOverlay.xul (content/calendarOverlay.xul)
|
||||
content/calendar/calendarSelection.js (content/calendarSelection.js)
|
||||
@@ -23,6 +24,8 @@ calendar.jar:
|
||||
content/calendar/calPrintEngine.css (content/calPrintEngine.css)
|
||||
content/calendar/calendarCreation.xul (content/calendarCreation.xul)
|
||||
content/calendar/calendarCreation.js (content/calendarCreation.js)
|
||||
content/calendar/calendarProperties.xul (content/calendarProperties.xul)
|
||||
content/calendar/calendarProperties.js (content/calendarProperties.js)
|
||||
content/calendar/clipboard.js (content/clipboard.js)
|
||||
* content/calendar/contents.rdf (content/contents.rdf)
|
||||
content/calendar/dateUtils.js (content/dateUtils.js)
|
||||
@@ -36,8 +39,6 @@ calendar.jar:
|
||||
content/calendar/outlookImportDialog.xul (content/outlookImportDialog.xul)
|
||||
content/calendar/outlookImportDialog.js (content/outlookImportDialog.js)
|
||||
content/calendar/importExport.js (content/importExport.js)
|
||||
content/calendar/localCalDialog.js (content/localCalDialog.js)
|
||||
content/calendar/localCalDialog.xul (content/localCalDialog.xul)
|
||||
content/calendar/menuOverlay.xul (content/menuOverlay.xul)
|
||||
content/calendar/monthView.js (content/monthView.js)
|
||||
content/calendar/monthView.xul (content/monthView.xul)
|
||||
@@ -49,8 +50,6 @@ calendar.jar:
|
||||
content/calendar/publishDialog.js (content/publishDialog.js)
|
||||
content/calendar/publishDialog.xul (content/publishDialog.xul)
|
||||
content/calendar/selectAddressesDialog.js (content/selectAddressesDialog.js)
|
||||
content/calendar/serverDialog.js (content/serverDialog.js)
|
||||
content/calendar/serverDialog.xul (content/serverDialog.xul)
|
||||
content/calendar/sound.wav (content/sound.wav)
|
||||
content/calendar/unifinder.js (content/unifinder.js)
|
||||
content/calendar/unifinderToDo.js (content/unifinderToDo.js)
|
||||
|
||||
Reference in New Issue
Block a user