diff --git a/mozilla/calendar/resources/content/calendar.js b/mozilla/calendar/resources/content/calendar.js
index 68f85f25065..e6a60ef58aa 100644
--- a/mozilla/calendar/resources/content/calendar.js
+++ b/mozilla/calendar/resources/content/calendar.js
@@ -160,8 +160,8 @@ function calendarInit()
}
//a bit of a hack since the menulist doesn't remember the selected value
-
- document.getElementById( 'event-filter-menulist' ).setAttribute( "label", document.getElementById( 'event-filter-menulist' ).selectedItem.getAttribute( 'label' ) );
+ var value = document.getElementById( 'event-filter-menulist' ).value;
+ document.getElementById( 'event-filter-menulist' ).selectedItem = document.getElementById( 'event-filter-'+value );
}
// Set the date and time on the clock and set up a timeout to refresh the clock when the
diff --git a/mozilla/calendar/resources/content/calendarImportExport.js b/mozilla/calendar/resources/content/calendarImportExport.js
index 289a2a3d6dc..1315101ab8f 100644
--- a/mozilla/calendar/resources/content/calendarImportExport.js
+++ b/mozilla/calendar/resources/content/calendarImportExport.js
@@ -174,7 +174,7 @@ function createUniqueID()
* Takes an array of events and adds the evens one by one to the calendar
*/
-function addEventsToCalendar( calendarEventArray, silent )
+function addEventsToCalendar( calendarEventArray, silent, ServerName )
{
gICalLib.batchMode = true;
@@ -194,8 +194,10 @@ function addEventsToCalendar( calendarEventArray, silent )
// open the event dialog with the event to add
if( silent )
{
- var DefaultServer = gCalendarWindow.calendarManager.getDefaultServer();
- gICalLib.addEvent( calendarEvent, DefaultServer );
+ if( ServerName == null || ServerName == "" || ServerName == false )
+ var ServerName = gCalendarWindow.calendarManager.getDefaultServer();
+
+ gICalLib.addEvent( calendarEvent, ServerName );
}
else
editNewEvent( calendarEvent );
diff --git a/mozilla/calendar/resources/content/calendarWizard.js b/mozilla/calendar/resources/content/calendarWizard.js
index 5e4f0c5d742..4fbd6b91ea8 100644
--- a/mozilla/calendar/resources/content/calendarWizard.js
+++ b/mozilla/calendar/resources/content/calendarWizard.js
@@ -44,6 +44,37 @@ function checkInitialPage()
}
+function onPageShow( PageId )
+{
+ switch( PageId )
+ {
+ case "import":
+ if( document.getElementById( "import-path-textbox" ).value.length == 0 )
+ {
+ document.getElementById( "calendar-wizard" ).canAdvance = false;
+ }
+ else
+ {
+ document.getElementById( "calendar-wizard" ).canAdvance = true;
+ }
+ break;
+
+ case "import-2":
+ buildCalendarsListbox( 'import-calendar-radiogroup' );
+
+ if( document.getElementById( "import-calendar-radiogroup" ).selectedItem == null )
+ {
+ document.getElementById( "calendar-wizard" ).canAdvance = false;
+ }
+ else
+ {
+ document.getElementById( "calendar-wizard" ).canAdvance = true;
+ }
+ document.getElementById( "import-calendar-radiogroup" ).childNodes[0].setAttribute( "selected", "true" );
+ break;
+ }
+}
+
function buildCalendarsListbox( ListBoxId )
{
document.getElementById( ListBoxId ).database.AddDataSource( opener.gCalendarWindow.calendarManager.rdf.getDatasource() );
@@ -53,10 +84,12 @@ function buildCalendarsListbox( ListBoxId )
function doWizardFinish( )
{
+ window.setCursor( "wait" );
+
switch( gWizardType )
{
case "import":
- return doWizardImport();
+ return true;
break;
case "export":
@@ -76,34 +109,68 @@ function doWizardFinish( )
function doWizardImport()
{
+ window.setCursor( "wait" );
+
var calendarEventArray;
var fileName = document.getElementById( "import-path-textbox" ).value;
var aDataStream = readDataFromFile( fileName, "UTF-8" );
- if( fileName.indexOf( ".ics" ) == -1 )
- {
- calendarEventArray = parseIcalData( aDataStream );
- }
- else if( fileName.indexOf( ".xcs" ) == -1 )
- {
+ if( fileName.indexOf( ".ics" ) != -1 )
+ calendarEventArray = parseIcalData( aDataStream );
+ else if( fileName.indexOf( ".xcs" ) != -1 )
calendarEventArray = parseXCSData( aDataStream );
- }
-
+
if( document.getElementById( "import-2-radiogroup" ).selectedItem.value == "silent" )
{
- addEventsToCalendar( calendarEventArray, true );
+ var ServerName = document.getElementById( "import-calendar-radiogroup" ).selectedItem.value;
+
+ doAddEventsToCalendar( calendarEventArray, true, ServerName );
}
else
{
- addEventsToCalendar( calendarEventArray, true );
+ doAddEventsToCalendar( calendarEventArray, true, null );
}
-
-
- return( false ); //true will close the window
}
+function doAddEventsToCalendar( calendarEventArray, silent, ServerName )
+{
+ gICalLib.batchMode = true;
+
+ for(var i = 0; i < calendarEventArray.length; i++)
+ {
+ calendarEvent = calendarEventArray[i];
+
+ // Check if event with same ID already in Calendar. If so, import event with new ID.
+ if( gICalLib.fetchEvent( calendarEvent.id ) != null ) {
+ calendarEvent.id = createUniqueID( );
+ }
+
+ // the start time is in zulu time, need to convert to current time
+ if(calendarEvent.allDay != true)
+ convertZuluToLocal( calendarEvent );
+
+ // open the event dialog with the event to add
+ if( silent )
+ {
+ if( ServerName == null || ServerName == "" || ServerName == false )
+ var ServerName = gCalendarWindow.calendarManager.getDefaultServer();
+
+ gICalLib.addEvent( calendarEvent, ServerName );
+
+ document.getElementById( "import-progress-meter" ).setAttribute( "value", ( (i/calendarEventArray.length)*100 )+"%" );
+ }
+ else
+ editNewEvent( calendarEvent );
+ }
+
+ gICalLib.batchMode = false;
+ window.setCursor( "default" );
+
+ document.getElementById( "importing-box" ).setAttribute( "collapsed", "true" );
+ document.getElementById( "done-importing-box" ).removeAttribute( "collapsed" );
+}
function doWizardExport()
{
@@ -199,5 +266,7 @@ function launchFilePicker( Mode, ElementToGiveValueTo )
filePath += extension;
*/
document.getElementById( ElementToGiveValueTo ).value = fp.file.path;
+
+ document.getElementById( "calendar-wizard" ).canAdvance = true;
}
}
diff --git a/mozilla/calendar/resources/content/calendarWizard.xul b/mozilla/calendar/resources/content/calendarWizard.xul
index a3e1e1f6a4f..b5e209ed654 100644
--- a/mozilla/calendar/resources/content/calendarWizard.xul
+++ b/mozilla/calendar/resources/content/calendarWizard.xul
@@ -61,8 +61,10 @@
title="Mozilla Calendar Wizard"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onwizardfinish="return doWizardFinish();"
+ persist="screenX screenY"
>
+
@@ -75,7 +77,7 @@
-
+
@@ -85,17 +87,17 @@
-
+
-
+
-
+
Should I open each event before importing it?
@@ -103,6 +105,16 @@
+
+
+ Importing...
+
+
+
+ All your events have been imported. Click finish to close the wizard.
+
+
+
diff --git a/mozilla/calendar/resources/content/datepicker/calendar.css b/mozilla/calendar/resources/content/datepicker/calendar.css
index 35cb73e297b..6a2cc70affd 100644
--- a/mozilla/calendar/resources/content/datepicker/calendar.css
+++ b/mozilla/calendar/resources/content/datepicker/calendar.css
@@ -102,6 +102,11 @@ calendar {
color: #ffffff;
}
+.cal-day[busy="true"]
+{
+ font-weight : bold;
+}
+
.cal-day:hover {
color: #ff0000;
border: 1px solid #d2d2d2;
diff --git a/mozilla/calendar/resources/content/importExport.js b/mozilla/calendar/resources/content/importExport.js
index 289a2a3d6dc..1315101ab8f 100644
--- a/mozilla/calendar/resources/content/importExport.js
+++ b/mozilla/calendar/resources/content/importExport.js
@@ -174,7 +174,7 @@ function createUniqueID()
* Takes an array of events and adds the evens one by one to the calendar
*/
-function addEventsToCalendar( calendarEventArray, silent )
+function addEventsToCalendar( calendarEventArray, silent, ServerName )
{
gICalLib.batchMode = true;
@@ -194,8 +194,10 @@ function addEventsToCalendar( calendarEventArray, silent )
// open the event dialog with the event to add
if( silent )
{
- var DefaultServer = gCalendarWindow.calendarManager.getDefaultServer();
- gICalLib.addEvent( calendarEvent, DefaultServer );
+ if( ServerName == null || ServerName == "" || ServerName == false )
+ var ServerName = gCalendarWindow.calendarManager.getDefaultServer();
+
+ gICalLib.addEvent( calendarEvent, ServerName );
}
else
editNewEvent( calendarEvent );
diff --git a/mozilla/calendar/resources/content/unifinder.js b/mozilla/calendar/resources/content/unifinder.js
index a79edeb3381..a3d12c6e965 100644
--- a/mozilla/calendar/resources/content/unifinder.js
+++ b/mozilla/calendar/resources/content/unifinder.js
@@ -475,6 +475,7 @@ var treeView =
getImageSrc : function(){return false;},
cycleHeader : function( ColId, element )
{
+ //dump( "\nin cycle header" );
var sortActive;
var treeCols;
@@ -507,7 +508,9 @@ var treeView =
}
element.setAttribute("sortActive", sortActive);
element.setAttribute("sortDirection", this.sortDirection);
+ //dump( "\nabout to sort events "+gEventArray.length );
gEventArray.sort( sortEvents );
+ //dump( "\nSORTED!");
document.getElementById( UnifinderTreeName ).view = this;
},
setTree : function( tree ){this.tree = tree;},
@@ -527,11 +530,7 @@ var treeView =
switch( column )
{
case "unifinder-search-results-tree-col-title":
- if( calendarEvent.title == "" )
- var titleText = "Untitled";
- else
- var titleText = calendarEvent.title;
- return( titleText );
+ return( calendarEvent.title );
case "unifinder-search-results-tree-col-startdate":
var eventStartDate = getNextOrPreviousRecurrence( calendarEvent );
@@ -588,11 +587,14 @@ function sortEvents( EventA, EventB )
{
modifier = -1;
}
-
+ //dump( "\nswitch on treeview.SelectedColumn which is "+treeView.selectedColumn );
switch(treeView.selectedColumn)
{
case "unifinder-search-results-tree-col-title":
+ {
+ //dump( "\nreturning "+EventA.title +" > "+EventB.title );
return( ((EventA.title > EventB.title) ? 1 : -1) * modifier );
+ }
case "unifinder-search-results-tree-col-startdate":
return( ((EventA.start.getTime() > EventB.start.getTime()) ? 1 : -1) * modifier );
diff --git a/mozilla/calendar/resources/content/unifinderToDo.js b/mozilla/calendar/resources/content/unifinderToDo.js
index 4dfd0e0e9c9..fcaacbc985c 100644
--- a/mozilla/calendar/resources/content/unifinderToDo.js
+++ b/mozilla/calendar/resources/content/unifinderToDo.js
@@ -394,7 +394,7 @@ var toDoTreeView =
}
element.setAttribute("sortActive", sortActive);
element.setAttribute("sortDirection", this.sortDirection);
- gTaskArray.sort( sortEvents );
+ gTaskArray.sort( sortTasks );
document.getElementById( ToDoUnifinderTreeName ).view = this;
},
setTree : function( tree ){this.tree = tree;},
@@ -406,7 +406,7 @@ var toDoTreeView =
{
this.selectedColumn = column;
this.sortDirection = columnElement.getAttribute("sortDirection");
- gTaskArray.sort(sortEvents);
+ gTaskArray.sort(sortTasks);
}
calendarToDo = gTaskArray[row];
@@ -441,7 +441,7 @@ var toDoTreeView =
}
}
-function sortEvents( TaskA, TaskB )
+function sortTasks( TaskA, TaskB )
{
var modifier = 1;
if (toDoTreeView.sortDirection == "descending")
diff --git a/mozilla/calendar/resources/content/wizard.js b/mozilla/calendar/resources/content/wizard.js
index 5e4f0c5d742..4fbd6b91ea8 100644
--- a/mozilla/calendar/resources/content/wizard.js
+++ b/mozilla/calendar/resources/content/wizard.js
@@ -44,6 +44,37 @@ function checkInitialPage()
}
+function onPageShow( PageId )
+{
+ switch( PageId )
+ {
+ case "import":
+ if( document.getElementById( "import-path-textbox" ).value.length == 0 )
+ {
+ document.getElementById( "calendar-wizard" ).canAdvance = false;
+ }
+ else
+ {
+ document.getElementById( "calendar-wizard" ).canAdvance = true;
+ }
+ break;
+
+ case "import-2":
+ buildCalendarsListbox( 'import-calendar-radiogroup' );
+
+ if( document.getElementById( "import-calendar-radiogroup" ).selectedItem == null )
+ {
+ document.getElementById( "calendar-wizard" ).canAdvance = false;
+ }
+ else
+ {
+ document.getElementById( "calendar-wizard" ).canAdvance = true;
+ }
+ document.getElementById( "import-calendar-radiogroup" ).childNodes[0].setAttribute( "selected", "true" );
+ break;
+ }
+}
+
function buildCalendarsListbox( ListBoxId )
{
document.getElementById( ListBoxId ).database.AddDataSource( opener.gCalendarWindow.calendarManager.rdf.getDatasource() );
@@ -53,10 +84,12 @@ function buildCalendarsListbox( ListBoxId )
function doWizardFinish( )
{
+ window.setCursor( "wait" );
+
switch( gWizardType )
{
case "import":
- return doWizardImport();
+ return true;
break;
case "export":
@@ -76,34 +109,68 @@ function doWizardFinish( )
function doWizardImport()
{
+ window.setCursor( "wait" );
+
var calendarEventArray;
var fileName = document.getElementById( "import-path-textbox" ).value;
var aDataStream = readDataFromFile( fileName, "UTF-8" );
- if( fileName.indexOf( ".ics" ) == -1 )
- {
- calendarEventArray = parseIcalData( aDataStream );
- }
- else if( fileName.indexOf( ".xcs" ) == -1 )
- {
+ if( fileName.indexOf( ".ics" ) != -1 )
+ calendarEventArray = parseIcalData( aDataStream );
+ else if( fileName.indexOf( ".xcs" ) != -1 )
calendarEventArray = parseXCSData( aDataStream );
- }
-
+
if( document.getElementById( "import-2-radiogroup" ).selectedItem.value == "silent" )
{
- addEventsToCalendar( calendarEventArray, true );
+ var ServerName = document.getElementById( "import-calendar-radiogroup" ).selectedItem.value;
+
+ doAddEventsToCalendar( calendarEventArray, true, ServerName );
}
else
{
- addEventsToCalendar( calendarEventArray, true );
+ doAddEventsToCalendar( calendarEventArray, true, null );
}
-
-
- return( false ); //true will close the window
}
+function doAddEventsToCalendar( calendarEventArray, silent, ServerName )
+{
+ gICalLib.batchMode = true;
+
+ for(var i = 0; i < calendarEventArray.length; i++)
+ {
+ calendarEvent = calendarEventArray[i];
+
+ // Check if event with same ID already in Calendar. If so, import event with new ID.
+ if( gICalLib.fetchEvent( calendarEvent.id ) != null ) {
+ calendarEvent.id = createUniqueID( );
+ }
+
+ // the start time is in zulu time, need to convert to current time
+ if(calendarEvent.allDay != true)
+ convertZuluToLocal( calendarEvent );
+
+ // open the event dialog with the event to add
+ if( silent )
+ {
+ if( ServerName == null || ServerName == "" || ServerName == false )
+ var ServerName = gCalendarWindow.calendarManager.getDefaultServer();
+
+ gICalLib.addEvent( calendarEvent, ServerName );
+
+ document.getElementById( "import-progress-meter" ).setAttribute( "value", ( (i/calendarEventArray.length)*100 )+"%" );
+ }
+ else
+ editNewEvent( calendarEvent );
+ }
+
+ gICalLib.batchMode = false;
+ window.setCursor( "default" );
+
+ document.getElementById( "importing-box" ).setAttribute( "collapsed", "true" );
+ document.getElementById( "done-importing-box" ).removeAttribute( "collapsed" );
+}
function doWizardExport()
{
@@ -199,5 +266,7 @@ function launchFilePicker( Mode, ElementToGiveValueTo )
filePath += extension;
*/
document.getElementById( ElementToGiveValueTo ).value = fp.file.path;
+
+ document.getElementById( "calendar-wizard" ).canAdvance = true;
}
}
diff --git a/mozilla/calendar/resources/content/wizard.xul b/mozilla/calendar/resources/content/wizard.xul
index a3e1e1f6a4f..b5e209ed654 100644
--- a/mozilla/calendar/resources/content/wizard.xul
+++ b/mozilla/calendar/resources/content/wizard.xul
@@ -61,8 +61,10 @@
title="Mozilla Calendar Wizard"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onwizardfinish="return doWizardFinish();"
+ persist="screenX screenY"
>
+
@@ -75,7 +77,7 @@
-
+
@@ -85,17 +87,17 @@
-
+
-
+
-
+
Should I open each event before importing it?
@@ -103,6 +105,16 @@
+
+
+ Importing...
+
+
+
+ All your events have been imported. Click finish to close the wizard.
+
+
+