diff --git a/mozilla/calendar/resources/content/calendarClipboard.js b/mozilla/calendar/resources/content/calendarClipboard.js deleted file mode 100644 index 888bc66166e..00000000000 --- a/mozilla/calendar/resources/content/calendarClipboard.js +++ /dev/null @@ -1,292 +0,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 Mozilla Calendar code. - * - * The Initial Developer of the Original Code is - * ArentJan Banck . - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): ArentJan Banck - * - * 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 ***** */ - -/***** calendarClipboard -* -* NOTES -* TODO items -* - Add a clipboard listener, to enable/disable menu-items depending if -* valid clipboard data is available. -* -******/ - - -function getClipboard() -{ - const kClipboardContractID = "@mozilla.org/widget/clipboard;1"; - const kClipboardIID = Components.interfaces.nsIClipboard; - return Components.classes[kClipboardContractID].getService(kClipboardIID); -} - - -function createTransferable() -{ - const kTransferableContractID = "@mozilla.org/widget/transferable;1"; - const kTransferableIID = Components.interfaces.nsITransferable - return Components.classes[kTransferableContractID].createInstance(kTransferableIID); -} - - -function createSupportsArray() -{ - const kSuppArrayContractID = "@mozilla.org/supports-array;1"; - const kSuppArrayIID = Components.interfaces.nsISupportsArray; - return Components.classes[kSuppArrayContractID].createInstance(kSuppArrayIID); -} - - -// Should we use (wide)String only, or no (wide)Strings for compatibility? -function createSupportsCString() -{ - const kSuppStringContractID = "@mozilla.org/supports-cstring;1"; - const kSuppStringIID = Components.interfaces.nsISupportsCString; - return Components.classes[kSuppStringContractID].createInstance(kSuppStringIID); -} - - -function createSupportsString() -{ - const kSuppStringContractID = "@mozilla.org/supports-string;1"; - const kSuppStringIID = Components.interfaces.nsISupportsString; - return Components.classes[kSuppStringContractID].createInstance(kSuppStringIID); -} - - -function createSupportsWString() -{ - const kSuppStringContractID = "@mozilla.org/supports-wstring;1"; - const kSuppStringIID = Components.interfaces.nsISupportsWString; - return Components.classes[kSuppStringContractID].createInstance(kSuppStringIID); -} - - -/** -* Test if the clipboard has items that can be pasted into Calendar. -* This must be of type "text/calendar" or "text/unicode" -*/ - -function canPaste() -{ - const kClipboardIID = Components.interfaces.nsIClipboard; - - var clipboard = getClipboard(); - var flavourArray = createSupportsArray(); - var flavours = ["text/calendar", "text/unicode"]; - - for (var i = 0; i < flavours.length; ++i) - { - const kSuppString = createSupportsCString(); - kSuppString.data = flavours[i]; - flavourArray.AppendElement(kSuppString); - } - - return clipboard.hasDataMatchingFlavors(flavourArray, kClipboardIID.kGlobalClipboard); -} - - -/** -* Copy iCalendar data to the Clipboard, and delete the selected events. -* Does not use eventarray parameter, because DeletCcommand delete selected events. -*/ - -function cutToClipboard( /* calendarEventArray */) -{ - // if( !calendarEventArray) - var calendarEventArray = gCalendarWindow.EventSelection.selectedEvents; - - if( copyToClipboard( calendarEventArray ) ) - { - deleteEventCommand( true ); // deletes all selected events without prompting. - } -} - - -/** -* Copy iCalendar data to the Clipboard. The data is copied to three types: -* 1) text/calendar. Found that name somewhere in mail code. not used outside -* Calendar as far as I know, so this can be customized for internal use. -* 2) text/unicode. Plaintext iCalendar data, tested on Windows for Outlook 2000 -* and Lotus Organizer. -* 3) text/html. Not for parsing, only pretty looking calendar data. -* -**/ - -function copyToClipboard( calendarEventArray ) -{ - if( !calendarEventArray) - { - var calendarEventArray = new Array( 0 ); - calendarEventArray = gCalendarWindow.EventSelection.selectedEvents; - } - - if(calendarEventArray.length == 0) - alert("No events selected"); - - var calendarEvent; - var sTextiCalendar = eventArrayToICalString( calendarEventArray ); - var sTextiCalendarExport = eventArrayToICalString( calendarEventArray, true ); - var sTextHTML = eventArrayToHTML( calendarEventArray ); - - // 1. get the clipboard service - var clipboard = getClipboard(); - - // 2. create the transferable - var trans = createTransferable(); - - if ( trans && clipboard) { - - // 3. register the data flavors - trans.addDataFlavor("text/calendar"); - trans.addDataFlavor("text/unicode"); - trans.addDataFlavor("text/html"); - - // 4. create the data objects - var icalWrapper = createSupportsString(); - var textWrapper = createSupportsString(); - var htmlWrapper = createSupportsString(); - - if ( icalWrapper && textWrapper && htmlWrapper ) { - // get the data - icalWrapper.data = sTextiCalendar; // plainTextRepresentation; - textWrapper.data = sTextiCalendarExport; // plainTextRepresentation; - htmlWrapper.data = sTextHTML; // htmlRepresentation; - - // 5. add data objects to transferable - // Both Outlook 2000 client and Lotus Organizer use text/unicode when pasting iCalendar data - trans.setTransferData ( "text/calendar", icalWrapper, icalWrapper.data.length*2 ); // double byte data - trans.setTransferData ( "text/unicode", textWrapper, textWrapper.data.length*2 ); - trans.setTransferData ( "text/html", htmlWrapper, htmlWrapper.data.length*2 ); - - clipboard.setData( trans, null, Components.interfaces.nsIClipboard.kGlobalClipboard ); - - return true; - } - } - return true; -} - - -/** -* Paste iCalendar events from the clipboard, -* or paste clipboard text into description of new event -*/ - -function pasteFromClipboard() -{ - const kClipboardIID = Components.interfaces.nsIClipboard; - - if( canPaste() ) { - // 1. get the clipboard service - var clipboard = getClipboard(); - - // 2. create the transferable - var trans = createTransferable(); - - if ( trans && clipboard) { - - // 3. register the data flavors you want, highest fidelity first! - trans.addDataFlavor("text/calendar"); - trans.addDataFlavor("text/unicode"); - - // 4. get transferable from clipboard - clipboard.getData ( trans, kClipboardIID.kGlobalClipboard); - - // 5. ask transferable for the best flavor. Need to create new JS - // objects for the out params. - var flavour = { }; - var data = { }; - var length = { }; - trans.getAnyTransferData(flavour, data, length); - data = data.value.QueryInterface(Components.interfaces.nsISupportsString).data; - //DEBUG alert("clipboard type: " + flavour.value); - var calendarEventArray; - var startDate; - var endDateTime; - var MinutesToAddOn; - - switch (flavour.value) { - case "text/calendar": - - calendarEventArray = parseIcalData( data ); - - //change the date of all the events to now - startDate = gCalendarWindow.currentView.getNewEventDate(); - MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", 60 ); - - endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); - - for( var i = 0; i < calendarEventArray.length; i++ ) - { - calendarEventArray[i].start.setTime( startDate ); - calendarEventArray[i].end.setTime( endDateTime ); - } - addEventsToCalendar( calendarEventArray ); - break; - case "text/unicode": - if ( data.indexOf("BEGIN:VEVENT") == -1 ) - { - // no iCalendar data, paste clipboard text into description of new event - calendarEvent = createEvent(); - initCalendarEvent( calendarEvent ); - calendarEvent.description = data; - editNewEvent( calendarEvent ); - } - else - { - calendarEventArray = parseIcalData( data ); - //change the date of all the events to now - startDate = gCalendarWindow.currentView.getNewEventDate(); - MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", 60 ); - - endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); - - for( i = 0; i < calendarEventArray.length; i++ ) - { - calendarEventArray[i].start.setTime( startDate ); - calendarEventArray[i].end.setTime( endDateTime ); - } - - addEventsToCalendar( calendarEventArray ); - } - break; - default: - alert("Unknown clipboard type: " + flavour.value); - } - } - } - else - alert( "No iCalendar or text on the clipboard." ); -} diff --git a/mozilla/calendar/resources/content/calendarDayView.js b/mozilla/calendar/resources/content/calendarDayView.js deleted file mode 100644 index 85d4037a9bb..00000000000 --- a/mozilla/calendar/resources/content/calendarDayView.js +++ /dev/null @@ -1,607 +0,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 OEone Calendar Code, released October 31st, 2001. - * - * The Initial Developer of the Original Code is - * OEone Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): Garth Smedley - * Mike Potter - * Colin Phillips - * Karl Guertin - * - * 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 ***** */ - -/*----------------------------------------------------------------- -* DayView Class subclass of CalendarView -* -* Calendar day view class -* -* PROPERTIES -* -* NOTES -* -* -*/ - -// Make DayView inherit from CalendarView - -DayView.prototype = new CalendarView(); -DayView.prototype.constructor = DayView; - -/** -* DayView Constructor. -* -* PARAMETERS -* calendarWindow - the owning instance of CalendarWindow. -* -*/ - - -function DayView( calendarWindow ) -{ - // call super - - this.superConstructor( calendarWindow ); - - //set the time on the left hand side labels - //need to do this in JavaScript to preserve formatting - for( var i = 0; i < 24; i++ ) - { - /* - ** FOR SOME REASON, THIS IS NOT WORKING FOR MIDNIGHT - */ - var TimeToFormat = new Date(); - - TimeToFormat.setHours( i ); - - TimeToFormat.setMinutes( "0" ); - - var FormattedTime = calendarWindow.dateFormater.getFormatedTime( TimeToFormat ); - - var Label = document.getElementById( "day-view-hour-"+i ); - - Label.setAttribute( "value", FormattedTime ); - } - - var dayViewEventSelectionObserver = - { - onSelectionChanged : function dv_EventSelectionObserver_OnSelectionChanged( EventSelectionArray ) - { - for( i = 0; i < EventSelectionArray.length; i++ ) - { - gCalendarWindow.dayView.selectBoxForEvent( EventSelectionArray[i] ); - } - } - } - - calendarWindow.EventSelection.addObserver( dayViewEventSelectionObserver ); -} - - -/** PUBLIC -* -* Redraw the events for the current month -* -*/ - -DayView.prototype.refreshEvents = function dayview_refreshEvents( ) -{ - this.kungFooDeathGripOnEventBoxes = new Array(); - - // remove old event boxes - - var eventBoxList = document.getElementsByAttribute( "eventbox", "dayview" ); - - for( var eventBoxIndex = 0; eventBoxIndex < eventBoxList.length; ++eventBoxIndex ) - { - var eventBox = eventBoxList[ eventBoxIndex ]; - - eventBox.parentNode.removeChild( eventBox ); - } - - //get the all day box. - - var AllDayBox = document.getElementById( "all-day-content-box" ); - AllDayBox.setAttribute( "collapsed", "true" ); - - //remove all the text from the all day content box. - - while( AllDayBox.hasChildNodes() ) - { - AllDayBox.removeChild( AllDayBox.firstChild ); - } - - //shrink the day's content box. - - document.getElementById( "day-view-content-box" ).removeAttribute( "allday" ); - - //make the text node that will contain the text for the all day box. - var calendarStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties"); - - var HtmlNode = document.createElement( "description" ); - HtmlNode.setAttribute( "class", "all-day-content-box-text-title" ); - var TextNode = document.createTextNode( calendarStringBundle.GetStringFromName( "AllDayEvents" ) ); - HtmlNode.appendChild( TextNode ); - document.getElementById( "all-day-content-box" ).appendChild( HtmlNode ); - - // get the events for the day and loop through them - - var dayEventList = this.calendarWindow.eventSource.getEventsForDay( this.calendarWindow.getSelectedDate() ); - - //refresh the array and the current spot. - var LowestStartHour = getIntPref( this.calendarWindow.calendarPreferences.calendarPref, "event.defaultstarthour", 8 ); - var HighestEndHour = getIntPref( this.calendarWindow.calendarPreferences.calendarPref, "event.defaultendhour", 17 );; - for ( var i = 0; i < dayEventList.length; i++ ) - { - dayEventList[i].OtherSpotArray = new Array('0'); - dayEventList[i].CurrentSpot = 0; - dayEventList[i].NumberOfSameTimeEvents = 0; - if( dayEventList[i].event.allDay != true ) - { - var ThisLowestStartHour = new Date( dayEventList[0].displayDate.getTime() ); - if( ThisLowestStartHour.getHours() < LowestStartHour ) - LowestStartHour = ThisLowestStartHour.getHours(); - - var EndDate = new Date( dayEventList[i].event.end.getTime() ); - if( EndDate.getHours() > HighestEndHour ) - HighestEndHour = EndDate; - } - } - - for( i = 0; i < 24; i++ ) - { - document.getElementById( "day-tree-item-"+i ).removeAttribute( "collapsed" ); - } - - //alert( "LowestStartHour is "+LowestStartHour ); - for( i = 0; i < LowestStartHour; i++ ) - { - document.getElementById( "day-tree-item-"+i ).setAttribute( "collapsed", "true" ); - } - - for( i = ( HighestEndHour + 1 ); i < 24; i++ ) - { - document.getElementById( "day-tree-item-"+i ).setAttribute( "collapsed", "true" ); - } - - for ( i = 0; i < dayEventList.length; i++ ) - { - var calendarEventDisplay = dayEventList[i]; - - //check to make sure that the event is not an all day event... - if ( calendarEventDisplay.event.allDay != true ) - { - //see if there's another event at the same start time. - - for ( j = 0; j < dayEventList.length; j++ ) - { - thisCalendarEventDisplay = dayEventList[j]; - - //if this event overlaps with another event... - if ( ( ( thisCalendarEventDisplay.displayDate >= calendarEventDisplay.displayDate && - thisCalendarEventDisplay.displayDate.getTime() < calendarEventDisplay.event.end.getTime() ) || - ( calendarEventDisplay.displayDate >= thisCalendarEventDisplay.displayDate && - calendarEventDisplay.displayDate.getTime() < thisCalendarEventDisplay.event.end.getTime() ) ) && - calendarEventDisplay.event.id != thisCalendarEventDisplay.event.id && - thisCalendarEventDisplay.event.allDay != true ) - { - //get the spot that this event will go in. - var ThisSpot = thisCalendarEventDisplay.CurrentSpot; - - calendarEventDisplay.OtherSpotArray.push( ThisSpot ); - ThisSpot++; - - if ( ThisSpot > calendarEventDisplay.CurrentSpot ) - { - calendarEventDisplay.CurrentSpot = ThisSpot; - } - } - } - SortedOtherSpotArray = new Array(); - SortedOtherSpotArray = calendarEventDisplay.OtherSpotArray.sort( this.calendarWindow.compareNumbers ); - LowestNumber = this.calendarWindow.getLowestElementNotInArray( SortedOtherSpotArray ); - - //this is the actual spot (0 -> n) that the event will go in on the day view. - calendarEventDisplay.CurrentSpot = LowestNumber; - calendarEventDisplay.NumberOfSameTimeEvents = SortedOtherSpotArray.length; - } - } - - for ( var eventIndex = 0; eventIndex < dayEventList.length; ++eventIndex ) - { - calendarEventDisplay = dayEventList[ eventIndex ]; - - //if its an all day event, don't show it in the hours stack. - if ( calendarEventDisplay.event.allDay == true ) - { - // build up the text to show for this event - - var eventText = calendarEventDisplay.event.title; - - if( calendarEventDisplay.event.location ) - { - eventText += " " + calendarEventDisplay.event.location; - } - - if( calendarEventDisplay.event.description ) - { - eventText += " " + calendarEventDisplay.event.description; - } - - //show the all day box - AllDayBox.removeAttribute( "collapsed" ); - - //shrink the day's content box. - document.getElementById( "day-view-content-box" ).setAttribute( "allday", "true" ); - - //note the use of the AllDayText Attribute. - //This is used to remove the text when the day is changed. - - newTextNode = document.createElement( "label" ); - newTextNode.setAttribute( "value", eventText ); - newTextNode.calendarEventDisplay = calendarEventDisplay; - newTextNode.setAttribute( "onmouseover", "gCalendarWindow.changeMouseOverInfo( calendarEventDisplay, event )" ); - newTextNode.setAttribute( "onclick", "dayEventItemClick( this, event )" ); - newTextNode.setAttribute( "ondblclick", "dayEventItemDoubleClick( this, event )" ); - newTextNode.setAttribute( "tooltip", "eventTooltip" ); - newTextNode.setAttribute( "AllDayText", "true" ); - - newImage = document.createElement("image"); - newImage.setAttribute( "class", "all-day-event-class" ); - newImage.calendarEventDisplay = calendarEventDisplay; - newImage.setAttribute( "onmouseover", "gCalendarWindow.changeMouseOverInfo( calendarEventDisplay, event )" ); - newImage.setAttribute( "onclick", "dayEventItemClick( this, event )" ); - newImage.setAttribute( "ondblclick", "dayEventItemDoubleClick( this, event )" ); - newImage.setAttribute( "tooltip", "eventTooltip" ); - //newImage.setAttribute( "AllDayText", "true" ); - - AllDayBox.appendChild( newImage ); - AllDayBox.appendChild( newTextNode ); - } - else - { - eventBox = this.createEventBox( calendarEventDisplay ); - - //add the box to the stack. - document.getElementById( "day-view-content-board" ).appendChild( eventBox ); - } - - // select the hour of the selected item, if there is an item whose date matches - - // mark the box as selected, if the event is - - if( this.calendarWindow.EventSelection.isSelectedEvent( calendarEventDisplay.event ) ) - { - this.selectBoxForEvent( calendarEventDisplay.event ); - } - } -} - -/** PRIVATE -* -* This creates an event box for the day view -*/ -DayView.prototype.createEventBox = function dayview_createEventBox( calendarEventDisplay ) -{ - var eventStartDate = calendarEventDisplay.displayDate; - var eventEndDate = calendarEventDisplay.displayEndDate; - var startHour = eventStartDate.getHours(); - var startMinutes = eventStartDate.getMinutes(); - - var eventEndDateTime = new Date( 2000, 1, 1, eventEndDate.getHours(), eventEndDate.getMinutes(), 0 ); - var eventStartDateTime = new Date( 2000, 1, 1, eventStartDate.getHours(), eventStartDate.getMinutes(), 0 ); - - var eventDuration = new Date( eventEndDateTime - eventStartDateTime ); - - var hourDuration = eventDuration / (3600000); - - var eventBox = document.createElement( "vbox" ); - - var boxHeight = document.getElementById( "day-tree-item-"+startHour ).boxObject.height; - var topHeight = document.getElementById( "day-tree-item-"+startHour ).boxObject.y - document.getElementById( "day-tree-item-"+startHour ).parentNode.boxObject.y; - var boxWidth = document.getElementById( "day-tree-item-"+startHour ).boxObject.width; - - topHeight = eval( topHeight + ( ( startMinutes/60 ) * boxHeight ) ); - topHeight = Math.round( topHeight ) - 2; - eventBox.setAttribute( "top", topHeight ); - - eventBox.setAttribute( "height", Math.round( ( hourDuration*boxHeight ) + 1 ) ); - - var width = Math.round( ( boxWidth-kDayViewHourLeftStart ) / calendarEventDisplay.NumberOfSameTimeEvents ); - eventBox.setAttribute( "width", width ); - - var left = eval( ( ( calendarEventDisplay.CurrentSpot - 1 ) * width ) + kDayViewHourLeftStart ); - left = left - ( calendarEventDisplay.CurrentSpot - 1 ); - eventBox.setAttribute( "left", Math.round( left ) ); - - //if you change this class, you have to change calendarViewDNDObserver in calendarDragDrop.js - eventBox.setAttribute( "class", "day-view-event-class" ); - eventBox.setAttribute( "flex", "1" ); - eventBox.setAttribute( "eventbox", "dayview" ); - eventBox.setAttribute( "onclick", "dayEventItemClick( this, event )" ); - eventBox.setAttribute( "ondblclick", "dayEventItemDoubleClick( this, event )" ); - // dragdrop events - eventBox.setAttribute( "ondraggesture", "nsDragAndDrop.startDrag(event,calendarViewDNDObserver);" ); - eventBox.setAttribute( "ondragover", "nsDragAndDrop.dragOver(event,calendarViewDNDObserver)" ); - eventBox.setAttribute( "ondragdrop", "nsDragAndDrop.drop(event,calendarViewDNDObserver)" ); - - eventBox.setAttribute( "onmouseover", "gCalendarWindow.changeMouseOverInfo( calendarEventDisplay, event )" ); - eventBox.setAttribute( "tooltip", "eventTooltip" ); - eventBox.setAttribute( "name", "day-view-event-box-"+calendarEventDisplay.event.id ); - if( calendarEventDisplay.event.categories && calendarEventDisplay.event.categories != "" ) - { - eventBox.setAttribute( calendarEventDisplay.event.categories, "true" ); - } - - var eventHTMLElement = document.createElement( "label" ); - eventHTMLElement.setAttribute( "value", calendarEventDisplay.event.title ); - eventHTMLElement.setAttribute( "flex", "1" ); - eventHTMLElement.setAttribute( "crop", "end" ); - eventBox.appendChild( eventHTMLElement ); - - /* - if( calendarEventDisplay.event.description != "" ) - { - var eventHTMLElement2 = document.createElement( "description" ); - eventHTMLElement2.setAttribute( "value", calendarEventDisplay.event.description ); - eventHTMLElement2.setAttribute( "flex", "1" ); - eventHTMLElement2.setAttribute( "crop", "end" ); - eventBox.appendChild( eventHTMLElement2 ); - } - */ - // add a property to the event box that holds the calendarEvent that the - // box represents - - eventBox.calendarEventDisplay = calendarEventDisplay; - - this.kungFooDeathGripOnEventBoxes.push( eventBox ); - - return( eventBox ); - -} - - -/** PUBLIC -* -* Called when the user switches from a different view -*/ - -DayView.prototype.switchFrom = function dayview_switchFrom( ) -{ -} - - -/** PUBLIC -* -* Called when the user switches to the day view -*/ - -DayView.prototype.switchTo = function dayview_switchTo( ) -{ - // disable/enable view switching buttons - - var weekViewButton = document.getElementById( "week_view_command" ); - var monthViewButton = document.getElementById( "month_view_command" ); - var dayViewButton = document.getElementById( "day_view_command" ); - - monthViewButton.removeAttribute( "disabled" ); - weekViewButton.removeAttribute( "disabled" ); - dayViewButton.setAttribute( "disabled", "true" ); - - // switch views in the deck - - var calendarDeckItem = document.getElementById( "calendar-deck" ); - calendarDeckItem.selectedIndex = 2; -} - - -/** PUBLIC -* -* Redraw the display, but not the events -*/ - -DayView.prototype.refreshDisplay = function dayview_refreshDisplay( ) -{ - // update the title - var dayNamePrev1; - var dayNamePrev2; - - var dayName = this.calendarWindow.dateFormater.getDayName( this.calendarWindow.getSelectedDate().getDay() ); - if (this.calendarWindow.getSelectedDate().getDay() < 2) - { - if (this.calendarWindow.getSelectedDate().getDay() == 0) - { - dayNamePrev1 = this.calendarWindow.dateFormater.getDayName( this.calendarWindow.getSelectedDate().getDay() + 6 ); - dayNamePrev2 = this.calendarWindow.dateFormater.getDayName( this.calendarWindow.getSelectedDate().getDay() + 5 ); - } - else - { - dayNamePrev1 = this.calendarWindow.dateFormater.getDayName( this.calendarWindow.getSelectedDate().getDay() - 1 ); - dayNamePrev2 = this.calendarWindow.dateFormater.getDayName( this.calendarWindow.getSelectedDate().getDay() + 5 ); - } - } - else - { - dayNamePrev1 = this.calendarWindow.dateFormater.getDayName( this.calendarWindow.getSelectedDate().getDay() - 1 ); - dayNamePrev2 = this.calendarWindow.dateFormater.getDayName( this.calendarWindow.getSelectedDate().getDay() - 2 ); - } - - var dayNameNext1; - var dayNameNext2; - - if (this.calendarWindow.getSelectedDate().getDay() > 4) - { - if (this.calendarWindow.getSelectedDate().getDay() == 6) - { - dayNameNext1 = this.calendarWindow.dateFormater.getDayName( this.calendarWindow.getSelectedDate().getDay() - 6); - dayNameNext2 = this.calendarWindow.dateFormater.getDayName( this.calendarWindow.getSelectedDate().getDay() - 5); - } - else - { - dayNameNext1 = this.calendarWindow.dateFormater.getDayName( this.calendarWindow.getSelectedDate().getDay() + 1); - dayNameNext2 = this.calendarWindow.dateFormater.getDayName( this.calendarWindow.getSelectedDate().getDay() - 5); - } - } - else - { - dayNameNext1 = this.calendarWindow.dateFormater.getDayName( this.calendarWindow.getSelectedDate().getDay() + 1); - dayNameNext2 = this.calendarWindow.dateFormater.getDayName( this.calendarWindow.getSelectedDate().getDay() + 2); - } - var monthName = this.calendarWindow.dateFormater.getMonthName( this.calendarWindow.getSelectedDate().getMonth() ); - - var dateString = monthName + " " + this.calendarWindow.getSelectedDate().getDate() + " " + this.calendarWindow.getSelectedDate().getFullYear(); - - var dayTextItemPrev2 = document.getElementById( "-2-day-title" ); - var dayTextItemPrev1 = document.getElementById( "-1-day-title" ); - var dayTextItem = document.getElementById( "0-day-title" ); - var dayTextItemNext1 = document.getElementById( "1-day-title" ); - var dayTextItemNext2 = document.getElementById( "2-day-title" ); - var daySpecificTextItem = document.getElementById( "0-day-specific-title" ); - dayTextItemPrev2.setAttribute( "value" , dayNamePrev2 ); - dayTextItemPrev1.setAttribute( "value" , dayNamePrev1 ); - dayTextItem.setAttribute( "value" , dayName ); - dayTextItemNext1.setAttribute( "value" , dayNameNext1 ); - dayTextItemNext2.setAttribute( "value" , dayNameNext2 ); - daySpecificTextItem.setAttribute( "value" , dateString ); -} - - -/** PUBLIC -* -* This is called when we are about the make a new event -* and we want to know what the default start date should be for the event. -*/ - -DayView.prototype.getNewEventDate = function dayview_getNewEventDate( ) -{ - var start = new Date( this.calendarWindow.getSelectedDate() ); - - start.setHours( start.getHours() ); - start.setMinutes( Math.ceil( start.getMinutes() / 5 ) * 5 ); - start.setSeconds( 0 ); - - return start; -} - - -/** PUBLIC -* -* Go to the next day. -*/ - -DayView.prototype.goToNext = function dayview_goToNext(goDays) -{ - var nextDay; - - if (goDays) - { - nextDay = new Date( this.calendarWindow.selectedDate.getFullYear(), this.calendarWindow.selectedDate.getMonth(), this.calendarWindow.selectedDate.getDate() + goDays ); - this.goToDay( nextDay ); - } - else - { - nextDay = new Date( this.calendarWindow.selectedDate.getFullYear(), this.calendarWindow.selectedDate.getMonth(), this.calendarWindow.selectedDate.getDate() + 1 ); - this.goToDay( nextDay ); - } -} - - -/** PUBLIC -* -* Go to the previous day. -*/ - -DayView.prototype.goToPrevious = function dayview_goToPrevious( goDays ) -{ - var prevDay; - - if (goDays) - { - prevDay = new Date( this.calendarWindow.selectedDate.getFullYear(), this.calendarWindow.selectedDate.getMonth(), this.calendarWindow.selectedDate.getDate() - goDays ); - this.goToDay( prevDay ); - } - else - { - prevDay = new Date( this.calendarWindow.selectedDate.getFullYear(), this.calendarWindow.selectedDate.getMonth(), this.calendarWindow.selectedDate.getDate() - 1 ); - this.goToDay( prevDay ); - } -} - - -DayView.prototype.selectBoxForEvent = function dayview_selectBoxForEvent( calendarEvent ) -{ - var EventBoxes = document.getElementsByAttribute( "name", "day-view-event-box-"+calendarEvent.id ); - - for ( j = 0; j < EventBoxes.length; j++ ) - { - EventBoxes[j].setAttribute( "eventselected", "true" ); - } -} - -/** PUBLIC -* -* clear the selected event by taking off the selected attribute. -*/ -DayView.prototype.clearSelectedEvent = function dayview_clearSelectedEvent( ) -{ - var ArrayOfBoxes = document.getElementsByAttribute( "eventselected", "true" ); - - for( i = 0; i < ArrayOfBoxes.length; i++ ) - { - ArrayOfBoxes[i].removeAttribute( "eventselected" ); - } -} - - -DayView.prototype.clearSelectedDate = function dayview_clearSelectedDate( ) -{ - return; -} - - -DayView.prototype.getVisibleEvent = function dayview_getVisibleEvent( calendarEvent ) -{ - eventBox = document.getElementById( "day-view-event-box-"+calendarEvent.id ); - if ( eventBox ) - { - return eventBox; - } - else - return false; - -} - -/* -** This function is needed because it may be called after the end of each day. -*/ - -DayView.prototype.hiliteTodaysDate = function dayview_hiliteTodaysDate( ) -{ - return; -} diff --git a/mozilla/calendar/resources/content/calendarDayView.xul b/mozilla/calendar/resources/content/calendarDayView.xul deleted file mode 100644 index c2942f30302..00000000000 --- a/mozilla/calendar/resources/content/calendarDayView.xul +++ /dev/null @@ -1,269 +0,0 @@ - - - - - - - - %dtd1; - %dtd2; -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/resources/content/calendarPublish.js b/mozilla/calendar/resources/content/calendarPublish.js deleted file mode 100644 index 10cd10d3454..00000000000 --- a/mozilla/calendar/resources/content/calendarPublish.js +++ /dev/null @@ -1,287 +0,0 @@ -/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape 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/NPL/ - * - * 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.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001-2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): ArentJan Banck - * - * 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 NPL, 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 NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -// Original code: -// http://lxr.mozilla.org/mozilla/source/editor/ui/composer/content/publish.js -// TODO Implement uploadfile with: -//void setUploadFile(in nsIFile file, in string contentType, in long contentLength); - -var gPublishHandler = null; - - -/* Create an instance of the given ContractID, with given interface */ -function createInstance(contractId, intf) { - return Components.classes[contractId].createInstance(Components.interfaces[intf]); -} - - -var gPublishIOService; -function GetIOService() -{ - if (gPublishIOService) - return gPublishIOService; - - gPublishIOService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); - if (!gPublishIOService) - dump("failed to get io service\n"); - - return gPublishIOService; -} - - -function calendarPublish(aDataString, newLocation, fileName, login, password, contentType) -{ - try - { - var protocolChannel = get_destination_channel(newLocation, fileName, login, password); - if (!protocolChannel) - { - dump("failed to get a destination channel\n"); - return; - } - - output_string_to_channel(protocolChannel, aDataString, contentType); - protocolChannel.asyncOpen(gPublishingListener, null); - dump("done\n"); - } - catch (e) - { - alert("an error occurred: " + e + "\n"); - } -} - -// XXX WARNING: I DIDN'T TEST THIS!!!!! -function calendarUploadFile(aSourceFilename, newLocation, fileName, login, password, contentType) -{ - try - { - var protocolChannel = get_destination_channel(newLocation, fileName, login, password); - - if (!protocolChannel) - { - dump("failed to get a destination channel\n"); - return; - } - - //void setUploadFile(in nsIFile file, in string contentType, in long contentLength); - - output_file_to_channel(protocolChannel, aSourceFilename, contentType); - protocolChannel.asyncOpen(gPublishingListener, null); - dump("done\n"); - } - catch (e) - { - alert("an error occurred: " + e + "\n"); - } -} - - -function output_string_to_channel( aChannel, aDataString, contentType ) -{ - var uploadChannel = aChannel.QueryInterface(Components.interfaces.nsIUploadChannel); - var postStream = createInstance('@mozilla.org/io/string-input-stream;1', 'nsIStringInputStream'); - - postStream.setData(aDataString, aDataString.length); - uploadChannel.setUploadStream(postStream, contentType, -1); -} - - -function output_file_to_channel( aChannel, aFilePath, contentType ) -{ - var uploadChannel = aChannel.QueryInterface(Components.interfaces.nsIUploadChannel); - var file = createInstance('@mozilla.org/file/local;1', 'nsILocalFile'); - - file.initWithPath( aFilePath ); - uploadChannel.setUploadFile(file, contentType, -1); -} - - -// this function takes a login and password and adds them to the destination url -function get_destination_channel(destinationDirectoryLocation, fileName, login, password) -{ - try - { - var ioService = GetIOService(); - if (!ioService) - { - return null; - } - - // create a channel for the destination location - var fullurl = destinationDirectoryLocation + fileName; - destChannel = create_channel_from_url(ioService, fullurl, login, password); - if (!destChannel) - { - dump("can't create dest channel\n"); - return null; - } - try { - dump("about to set callbacks\n"); - destChannel.notificationCallbacks = window.docshell; // docshell - dump("notification callbacks set\n"); - } - catch(e) {dump(e+"\n");} - - try { - var httpChannel = destChannel.QueryInterface(Components.interfaces.nsIHttpChannel); - } - catch( e ) - { - //alert( e ); - } - - if (httpChannel) - { - dump("http channel found\n"); - return httpChannel; - } - var ftpChannel = destChannel.QueryInterface(Components.interfaces.nsIFTPChannel); - if (ftpChannel) dump("ftp channel found\n"); - if (ftpChannel) - return ftpChannel; - - var httpsChannel = destChannel.QueryInterface(Components.interfaces.nsIHttpsChannel); - if (httpsChannel) dump("https channel found\n"); - if (httpsChannel) - return httpsChannel; - else - return null; - } - catch (e) - { - return null; - } -} - - -// this function takes a full url, creates an nsIURI, and then creates a channel from that nsIURI -function create_channel_from_url(ioService, aURL, aLogin, aPassword) -{ - try - { - var nsiuri = Components.classes["@mozilla.org/network/standard-url;1"].createInstance(Components.interfaces.nsIURI); - if (!nsiuri) - return null; - nsiuri.spec = aURL; - if (aLogin) - { - nsiuri.username = aLogin; - if (aPassword) - nsiuri.password = aPassword; - } - return ioService.newChannelFromURI(nsiuri); - } - catch (e) - { - alert(e+"\n"); - return null; - } -} - -/* -function PublishCopyFile(srcDirectoryLocation, destinationDirectoryLocation, fileName, aLogin, aPassword) -{ - // append '/' if it's not there; inputs should be directories so should end in '/' - if ( srcDirectoryLocation.charAt(srcDirectoryLocation.length-1) != '/' ) - srcDirectoryLocation = srcDirectoryLocation + '/'; - if ( destinationDirectoryLocation.charAt(destinationDirectoryLocation.length-1) != '/' ) - destinationDirectoryLocation = destinationDirectoryLocation + '/'; - - try - { - // grab an io service - var ioService = GetIOService(); - if (!ioService) - return; - - // create a channel for the source location - srcChannel = create_channel_from_url(ioService, srcDirectoryLocation + fileName, null, null); - if (!srcChannel) - { - dump("can't create src channel\n"); - return; - } - - // create a channel for the destination location - var ftpChannel = get_destination_channel(destinationDirectoryLocation, fileName, aLogin, aPassword); - if (!ftpChannel) - { - dump("failed to get ftp channel\n"); - return; - } - - ftpChannel.open(); - protocolChannel.uploadStream = srcChannel.open(); - protocolChannel.asyncOpen(null, null); - dump("done\n"); - } - catch (e) - { - dump("an error occurred: " + e + "\n"); - } -} -*/ - -var gPublishingListener = -{ - QueryInterface: function(aIId, instance) - { - if (aIId.equals(Components.interfaces.nsIStreamListener)) - return this; - if (aIId.equals(Components.interfaces.nsISupports)) - return this; - - dump("QueryInterface " + aIId + "\n"); - throw Components.results.NS_NOINTERFACE; - }, - - onStartRequest: function(request, ctxt) - { - dump("onStartRequest status = " + request.status + "\n"); - }, - - onStopRequest: function(request, ctxt, status, errorMsg) - { - dump("onStopRequest status = " + request.status + " " + errorMsg + "\n"); - }, - - onDataAvailable: function(request, ctxt, inStream, sourceOffset, count) - { - dump("onDataAvailable status = " + request.status + " " + count + "\n"); - } -} - diff --git a/mozilla/calendar/resources/content/calendarPublishDialog.js b/mozilla/calendar/resources/content/calendarPublishDialog.js deleted file mode 100644 index 037c75e350c..00000000000 --- a/mozilla/calendar/resources/content/calendarPublishDialog.js +++ /dev/null @@ -1,132 +0,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 OEone Calendar Code, released October 31st, 2001. - * - * The Initial Developer of the Original Code is - * OEone Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): Garth Smedley - * Mike Potter - * Colin Phillips - * Chris Charabaruk - * ArentJan Banck - * - * 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/calendarEventDialog.js -* AUTHOR -* Garth Smedley -* REQUIRED INCLUDES -* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/resources/content/calendarWizard.js b/mozilla/calendar/resources/content/calendarWizard.js deleted file mode 100644 index 4fbd6b91ea8..00000000000 --- a/mozilla/calendar/resources/content/calendarWizard.js +++ /dev/null @@ -1,272 +0,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 OEone Calendar Code, released October 31st, 2001. - * - * The Initial Developer of the Original Code is - * OEone Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): Mike Potter - * - * 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 gWizardType; - -function checkInitialPage() -{ - gWizardType = document.getElementById( "initial-radiogroup" ).selectedItem.value; - - document.getElementsByAttribute( "pageid", "initialPage" )[0].setAttribute( "next", gWizardType ); -} - - -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() ); - - document.getElementById( ListBoxId ).builder.rebuild(); -} - -function doWizardFinish( ) -{ - window.setCursor( "wait" ); - - switch( gWizardType ) - { - case "import": - return true; - break; - - case "export": - return doWizardExport(); - break; - - case "subscribe": - return doWizardSubscribe(); - break; - - case "publish": - return doWizardPublish(); - break; - } -} - - -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 ) - calendarEventArray = parseXCSData( aDataStream ); - - if( document.getElementById( "import-2-radiogroup" ).selectedItem.value == "silent" ) - { - var ServerName = document.getElementById( "import-calendar-radiogroup" ).selectedItem.value; - - doAddEventsToCalendar( calendarEventArray, true, ServerName ); - } - else - { - doAddEventsToCalendar( calendarEventArray, true, null ); - } -} - -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() -{ - const UTF8 = "UTF-8"; - var aDataStream; - var extension; - var charset; - - var fileName = document.getElementById( "export-path-textbox" ).value; - - if( fileName.indexOf( ".ics" ) == -1 ) - { - aDataStream = eventArrayToICalString( calendarEventArray, true ); - extension = extensionCalendar; - charset = "UTF-8"; - } - else if( fileName.indexOf( ".rtf" ) == -1 ) - { - aDataStream = eventArrayToRTF( calendarEventArray ); - extension = extensionRtf; - } - else if( fileName.indexOf( ".htm" ) == -1 ) - { - aDataStream = eventArrayToHTML( calendarEventArray ); - extension = ".htm"; - charset = "UTF-8"; - } - else if( fileName.indexOf( ".csv" ) == -1 ) - { - aDataStream = eventArrayToCsv( calendarEventArray ); - extension = extensionCsv; - charset = "UTF-8"; - } - else if( fileName.indexOf( ".xml" ) == -1 ) - { - aDataStream = eventArrayToXCS( calendarEventArray ); - extension = extensionXcs; - charset = "UTF-8"; - } - else if( fileName.indexOf( ".rdf" ) == -1 ) - { - aDataStream = eventArrayToRdf( calendarEventArray ); - extension = extensionRdf; - charset = "UTF-8"; - } - - saveDataToFile( filePath, aDataStream, charset ); -} - -function launchFilePicker( Mode, ElementToGiveValueTo ) -{ - // No show the 'Save As' dialog and ask for a filename to save to - const nsIFilePicker = Components.interfaces.nsIFilePicker; - - var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker); - - // caller can force disable of sand box, even if ON globally - switch( Mode ) - { - case "open": - fp.defaultExtension = "ics"; - - fp.appendFilter( filterCalendar, "*" + extensionCalendar ); - fp.appendFilter( filterXcs, "*" + extensionXcs ); - - fp.init(window, "Open", nsIFilePicker.modeOpen); - break; - - case "save": - fp.init(window, "Save", nsIFilePicker.modeSave); - //if(calendarEventArray.length == 1 && calendarEventArray[0].title) - // fp.defaultString = calendarEventArray[0].title; - //else - fp.defaultString = "Mozilla Calendar events"; - - fp.defaultExtension = "ics"; - - fp.appendFilter( filterCalendar, "*" + extensionCalendar ); - fp.appendFilter( filterRtf, "*" + extensionRtf ); - fp.appendFilters(nsIFilePicker.filterHTML); - fp.appendFilter( filterCsv, "*" + extensionCsv ); - fp.appendFilter( filterXcs, "*" + extensionXcs ); - fp.appendFilter( filterRdf, "*" + extensionRdf ); - - break; - } - - fp.show(); - - if (fp.file && fp.file.path.length > 0) - { - /*if(filePath.indexOf(".") == -1 ) - 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 deleted file mode 100644 index e071e212f6b..00000000000 --- a/mozilla/calendar/resources/content/calendarWizard.xul +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - - - - - - - - - - - %dtd1; - %dtd2; -]> - - - - - - -