From 6799fe378ac4c1aff5b3aaa7f076cfadc0c4090e Mon Sep 17 00:00:00 2001 From: "mostafah%oeone.com" Date: Mon, 2 Aug 2004 20:54:10 +0000 Subject: [PATCH] Checked in patches for bug 250307 --- calendar/resources/content/dateUtils.js | 49 +++++++++++++++---- calendar/resources/content/unifinder.js | 39 +++------------ calendar/resources/content/unifinderToDo.js | 14 ++++-- .../locale/cs-CZ/calendar.properties | 5 +- .../locale/cy-GB/calendar.properties | 5 +- .../locale/de-AT/calendar.properties | 5 +- .../locale/en-US/calendar.properties | 5 +- .../locale/es-ES/calendar.properties | 5 +- .../locale/fr-FR/calendar.properties | 5 +- .../locale/hu-HU/calendar.properties | 5 +- .../locale/ja-JP/calendar.properties | 5 +- .../locale/lt-LT/calendar.properties | 5 +- .../locale/nl-NL/calendar.properties | 5 +- .../locale/pl-PL/calendar.properties | 5 +- .../locale/pt-BR/calendar.properties | 5 +- .../locale/sk-SK/calendar.properties | 5 +- .../locale/sl-SI/calendar.properties | 5 +- .../locale/sv-SE/calendar.properties | 5 +- .../locale/wen-DE/calendar.properties | 5 +- 19 files changed, 75 insertions(+), 107 deletions(-) diff --git a/calendar/resources/content/dateUtils.js b/calendar/resources/content/dateUtils.js index 39e38873b10..943a8016009 100644 --- a/calendar/resources/content/dateUtils.js +++ b/calendar/resources/content/dateUtils.js @@ -489,17 +489,14 @@ DateFormater.prototype.formatInterval = function( startDateTime, endDateTime, is : (sameDay ? (sameTime // just one date time - ? (this.getFormatedDate(startDateTime) + - " "+ this.getFormatedTime(startDateTime)) + ? this.formatDateTime(startDateTime) // range of times on same day - : (this.getFormatedDate(startDateTime)+ - " " + this.makeRange(this.getFormatedTime(startDateTime), - this.getFormatedTime(endDateTime)))) + : this.formatDateTime(startDateTime, false, + this.makeRange(this.getFormatedTime(startDateTime), + this.getFormatedTime(endDateTime)))) // range across different days - : this.makeRange(this.getFormatedDate(startDateTime) + - " "+ this.getFormatedTime(startDateTime), - this.getFormatedDate(endDateTime) + - " "+ this.getFormatedTime(endDateTime)))); + : this.makeRange(this.formatDateTime(startDateTime) + + this.formatDateTime(endDateTime)))); } /** PRIVATE makeRange takes two strings and concatenates them with @@ -518,3 +515,37 @@ DateFormater.prototype.makeRange = function makeRange(fromString, toString) { else return fromString + " -- "+ toString; } + +/** PUBLIC formatDateTime formats both date and time from datetime in pref order. + If timeString is not null (such as "All Day"), it is used instead of time. + if omitDateIfToday is true, date is omitted if date is today. + If date is not today, date is more relevant than time, so default is + formatted DATE TIME so date is visible in columns too narrow to show both, + Override by setting preference calendar.date.formatTimeBeforeDate=true. + + "DDD, DD MMM YYYY" "HH:mm" + Tue, 31 Dec 1999 21:00 + Tue, 31 Dec 1999 All Day (called with "All Day" timeString) + Tue, 31 Dec 1999 21:00--22:00 (called by formatInterval with "21:00--22:00" timeString) + 21:00 (called with datetime 21:00 today, with omitDateIfToday true, and no timeString) + All Day (called with datetime 0:00 today, with omitDateIfToday true, with timeString "All Day") + **/ +DateFormater.prototype.formatDateTime = function formatDateTime(datetime, omitDateIfToday, timeString) { + var formattedTime = (timeString || this.getFormatedTime( datetime )); + if (omitDateIfToday) { + var today = new Date(); + if (datetime.getFullYear() == today.getFullYear() && + datetime.getMonth() == today.getMonth() && + datetime.getDate() == today.getDate()) { + // if today, just show time (or "All day") + return formattedTime; + } + } + var formattedDate = this.getFormatedDate( datetime ); + if ( getBoolPref(gCalendarWindow.calendarPreferences.calendarPref, "date.formatTimeBeforeDate", false )) { + return formattedTime+" "+formattedDate; + } else { // default + return formattedDate+" "+formattedTime; + } +} + diff --git a/calendar/resources/content/unifinder.js b/calendar/resources/content/unifinder.js index d1f6424c1cb..8fdb05881ab 100644 --- a/calendar/resources/content/unifinder.js +++ b/calendar/resources/content/unifinder.js @@ -219,25 +219,18 @@ function finishCalendarUnifinder( ) gICalLib.removeObserver( unifinderEventDataSourceObserver ); } - /** -* Helper function to display event dates in the unifinder +* Helper function to display event datetimes in the unifinder */ -function formatUnifinderEventDate( date ) +function formatUnifinderEventDateTime( datetime, isAllDay ) { - return( gCalendarWindow.dateFormater.getFormatedDate( date ) ); + var allDayString = (isAllDay && gCalendarBundle.getString("AllDay")); + return gCalendarWindow.dateFormater.formatDateTime( datetime, true, allDayString ); } -/** -* Helper function to display event times in the unifinder -*/ -function formatUnifinderEventTime( time ) -{ - return( gCalendarWindow.dateFormater.getFormatedTime( time ) ); -} /** * This is attached to the ondblclik attribute of the events shown in the unifinder @@ -537,34 +530,18 @@ var treeView = case "unifinder-search-results-tree-col-startdate": var eventStartDate = getNextOrPreviousRecurrence( calendarEvent ); - var startTime = formatUnifinderEventTime( eventStartDate ); - var startDate = formatUnifinderEventDate( eventStartDate ); - if( calendarEvent.allDay ) - { - return(gCalendarBundle.getFormattedString("unifinderAlldayEventDate", [startDate])); - } - else - { - return(gCalendarBundle.getFormattedString("unifinderNormalEventDate", [startDate, startTime])); - } + return formatUnifinderEventDateTime(eventStartDate, calendarEvent.allDay); case "unifinder-search-results-tree-col-enddate": var eventEndDate = getNextOrPreviousRecurrence( calendarEvent ); var eventLength = calendarEvent.end.getTime() - calendarEvent.start.getTime(); var actualEndDate = eventEndDate.getTime() + eventLength; - var endDate, endTime; eventEndDate = new Date( actualEndDate ); - if( calendarEvent.allDay ) { + if (calendarEvent.allDay) // display enddate is ical enddate - 1 //user-enddate is ical-enddate - 1 eventEndDate.setDate( eventEndDate.getDate() - 1 ); - endDate = formatUnifinderEventDate( eventEndDate ); - return(gCalendarBundle.getFormattedString("unifinderAlldayEventDate", [endDate])); - } else { - endTime = formatUnifinderEventTime( eventEndDate ); - endDate = formatUnifinderEventDate( eventEndDate ); - return(gCalendarBundle.getFormattedString("unifinderNormalEventDate", [endDate, endTime])); - } - + return formatUnifinderEventDateTime(eventEndDate, calendarEvent.allDay); + case "unifinder-search-results-tree-col-categories": return( calendarEvent.categories ); diff --git a/calendar/resources/content/unifinderToDo.js b/calendar/resources/content/unifinderToDo.js index 0581999f2f4..a4732b0524c 100644 --- a/calendar/resources/content/unifinderToDo.js +++ b/calendar/resources/content/unifinderToDo.js @@ -121,6 +121,14 @@ function finishCalendarToDoUnifinder( ) gICalLib.removeTodoObserver( unifinderToDoDataSourceObserver ); } +/** +* Helper function to display todo datetimes in the unifinder +*/ + +function formatUnifinderToDoDateTime( datetime ) +{ + return gCalendarWindow.dateFormater.formatDateTime( datetime, true ); +} /** * Called by event observers to update the display @@ -403,11 +411,11 @@ var toDoTreeView = titleText = calendarToDo.title; return( titleText ); case "unifinder-todo-tree-col-startdate": - return( formatUnifinderEventDate( new Date( calendarToDo.start.getTime() ) ) ); + return( formatUnifinderToDoDateTime( new Date( calendarToDo.start.getTime() ) ) ); case "unifinder-todo-tree-col-duedate": - return( formatUnifinderEventDate( new Date( calendarToDo.due.getTime() ) ) ); + return( formatUnifinderToDoDateTime( new Date( calendarToDo.due.getTime() ) ) ); case "unifinder-todo-tree-col-completeddate": - return( formatUnifinderEventDate( new Date( calendarToDo.completed.getTime() ) ) ); + return( formatUnifinderToDoDateTime( new Date( calendarToDo.completed.getTime() ) ) ); case "unifinder-todo-tree-col-percentcomplete": return( calendarToDo.percent+"%" ); case "unifinder-todo-tree-col-categories": diff --git a/calendar/resources/locale/cs-CZ/calendar.properties b/calendar/resources/locale/cs-CZ/calendar.properties index 2ef48aa442c..b3aaddaa1a1 100644 --- a/calendar/resources/locale/cs-CZ/calendar.properties +++ b/calendar/resources/locale/cs-CZ/calendar.properties @@ -115,10 +115,7 @@ TooManyAlarmsMessage=M\u00E1te celkem %1$S upozorn\u011Bn\u00ED. Zobrazeno jich 1001=Upozorn\u011Bn\u00ED. UID nebyl nalezen! P\u0159i\u0159a\u010Fte nov\u00FD. # List of events or todos (unifinder) -## %1$S is the date -unifinderAlldayEventDate=Cel\u00FD den %1$S -## %1$S is the date, %2$S is the time -unifinderNormalEventDate=%1$S %2$S +AllDay=Cel\u00FD den eventUntitled=Nepojmenovan\u00FD # Tooltips of events or todos diff --git a/calendar/resources/locale/cy-GB/calendar.properties b/calendar/resources/locale/cy-GB/calendar.properties index d4a9405b65e..7d04e7bb55a 100644 --- a/calendar/resources/locale/cy-GB/calendar.properties +++ b/calendar/resources/locale/cy-GB/calendar.properties @@ -115,10 +115,7 @@ TooManyAlarmsMessage=Os oes gennych gyfanswm o %1$S larymau. Rydym wedi dangos y 1001=Rhybudd hegb ganfod UID\! Neulltuwch un newydd. # List of events or todos (unifinder) -## %1$S is the date -unifinderAlldayEventDate=Drwy'r Dydd %1$S -## %1$S is the date, %2$S is the time -unifinderNormalEventDate=%1$S %2$S +AllDay=Drwy'r Dydd eventUntitled=Dideitl # Tooltips of events or todos diff --git a/calendar/resources/locale/de-AT/calendar.properties b/calendar/resources/locale/de-AT/calendar.properties index 607427d65a0..78d32b505b7 100644 --- a/calendar/resources/locale/de-AT/calendar.properties +++ b/calendar/resources/locale/de-AT/calendar.properties @@ -115,10 +115,7 @@ TooManyAlarmsMessage=Sie haben gesamt %1$S Alarme. Die letzten 6 wurden Ihnen an 1001=Warnung\! UID nicht gefunden\! Setze eine neue. # List of events or todos (unifinder) -## %1$S is the date -unifinderAlldayEventDate=Ganzt\u00E4gig %1$S -## %1$S is the date, %2$S is the time -unifinderNormalEventDate=%1$S %2$S +AllDay=Ganzt\u00E4gig eventUntitled=Ohne Titel # Tooltips of events or todos diff --git a/calendar/resources/locale/en-US/calendar.properties b/calendar/resources/locale/en-US/calendar.properties index e5d8801254c..db47c4df60e 100644 --- a/calendar/resources/locale/en-US/calendar.properties +++ b/calendar/resources/locale/en-US/calendar.properties @@ -115,10 +115,7 @@ TooManyAlarmsMessage=You have %1$S total alarms. We've shown you the last 6. Cli 1001=Warning UID not found! Assigning new one. # List of events or todos (unifinder) -## %1$S is the date -unifinderAlldayEventDate=All day %1$S -## %1$S is the date, %2$S is the time -unifinderNormalEventDate=%1$S %2$S +AllDay=All Day eventUntitled=Untitled # Tooltips of events or todos diff --git a/calendar/resources/locale/es-ES/calendar.properties b/calendar/resources/locale/es-ES/calendar.properties index d6ba6e48048..ac49c9ac736 100644 --- a/calendar/resources/locale/es-ES/calendar.properties +++ b/calendar/resources/locale/es-ES/calendar.properties @@ -114,10 +114,7 @@ TooManyAlarmsMessage=Tiene %1$S alarmas en total, de las cuales le mostramos las 1001=Aviso\: No se encontr\u00F3 el UID. Se asignar\u00E1 uno nuevo. # List of events or todos (unifinder) -## %1$S is the date -unifinderAlldayEventDate=Todo el d\u00EDa %1$S -## %1$S is the date, %2$S is the time -unifinderNormalEventDate=%1$S %2$S +AllDay=Todo el d\u00EDa eventUntitled=Sin t\u00EDtulo # Tooltips of events or todos diff --git a/calendar/resources/locale/fr-FR/calendar.properties b/calendar/resources/locale/fr-FR/calendar.properties index bdf5bda13cf..9b3c7e88295 100644 --- a/calendar/resources/locale/fr-FR/calendar.properties +++ b/calendar/resources/locale/fr-FR/calendar.properties @@ -115,10 +115,7 @@ TooManyAlarmsMessage=You have %1$S total alarms. We've shown you the last 6. Cli 1001=Avertissement UID non trouv\u00e9\u00a0! Un nouveau va \u00eatre assign\u00e9. # List of events or todos (unifinder) -## %1$S is the date -unifinderAlldayEventDate=All day %1$S -## %1$S is the date, %2$S is the time -unifinderNormalEventDate=%1$S %2$S +AllDay=Toute la journée eventUntitled=Untitled # Tooltips of events or todos diff --git a/calendar/resources/locale/hu-HU/calendar.properties b/calendar/resources/locale/hu-HU/calendar.properties index 74dbfd2eb2b..dc948b206e0 100644 --- a/calendar/resources/locale/hu-HU/calendar.properties +++ b/calendar/resources/locale/hu-HU/calendar.properties @@ -117,10 +117,7 @@ TooManyAlarmsMessage=\u00d6sszesen %1$S \u00e9rtes\u00edt\u00e9se van, amib\u015 1001=Figyelmeztet\u00e9s: az UID nem tal\u00e1lhat\u00f3! \u00daj ker\u00fclt hozz\u00e1rendel\u00e9sre. # List of events or todos (unifinder) -## %1$S is the date -unifinderAlldayEventDate=Eg\u00e9sz napos %1$S -## %1$S is the date, %2$S is the time -unifinderNormalEventDate=%1$S %2$S +Allday=Eg\u00e9sz napos eventUntitled=N\u00e9vtelen # Tooltips of events or todos diff --git a/calendar/resources/locale/ja-JP/calendar.properties b/calendar/resources/locale/ja-JP/calendar.properties index d16724a5955..1d3fe34f1c8 100644 --- a/calendar/resources/locale/ja-JP/calendar.properties +++ b/calendar/resources/locale/ja-JP/calendar.properties @@ -118,10 +118,7 @@ TooManyAlarmsMessage=\u5408\u8a08 %1$S \u306e\u30a2\u30e9\u30fc\u30e0\u304c\u304 1001=\u4e0d\u660e UID \u8b66\u544a! \u65b0\u3057\u3044 UID \u3092\u5272\u308a\u5f53\u3066\u3066\u304f\u3060\u3055\u3044\u3002 # List of events or todos (unifinder) -## %1$S is the date -unifinderAlldayEventDate=%1$S -## %1$S is the date, %2$S is the time -unifinderNormalEventDate=%1$S %2$S +AllDay=\u7d42\u65e5 eventUntitled=\u30bf\u30a4\u30c8\u30eb\u306a\u3057 # Tooltips of events or todos diff --git a/calendar/resources/locale/lt-LT/calendar.properties b/calendar/resources/locale/lt-LT/calendar.properties index 0a5d05d6672..819c813c27d 100644 --- a/calendar/resources/locale/lt-LT/calendar.properties +++ b/calendar/resources/locale/lt-LT/calendar.properties @@ -115,10 +115,7 @@ TooManyAlarmsMessage=I\u0161 viso turite %1$S signalus(-\u0173). Buvo parodyti t 1001=D\u0117mesio! UID nerastas. Priskirtas naujas. # List of events or todos (unifinder) -## %1$S is the date -unifinderAlldayEventDate=%1$S -## %1$S is the date, %2$S is the time -unifinderNormalEventDate=%1$S %2$S +AllDay=All Day eventUntitled=Ne\u012fvardytas # Tooltips of events or todos diff --git a/calendar/resources/locale/nl-NL/calendar.properties b/calendar/resources/locale/nl-NL/calendar.properties index 0df80b25970..2ab21d3e64a 100644 --- a/calendar/resources/locale/nl-NL/calendar.properties +++ b/calendar/resources/locale/nl-NL/calendar.properties @@ -115,10 +115,7 @@ TooManyAlarmsMessage=U heeft in totaal %1$S waarschuwingen. We hebben u de laats 1001=Waarschuwing UID niet gevonden! Bezig nieuwe toe te kennen. # List of events or todos (unifinder) -## %1$S is the date -unifinderAlldayEventDate=All day %1$S -## %1$S is the date, %2$S is the time -unifinderNormalEventDate=%1$S %2$S +AllDay=All Day eventUntitled=Untitled # Tooltips of events or todos diff --git a/calendar/resources/locale/pl-PL/calendar.properties b/calendar/resources/locale/pl-PL/calendar.properties index c9024a237dc..7520a69c1e1 100644 --- a/calendar/resources/locale/pl-PL/calendar.properties +++ b/calendar/resources/locale/pl-PL/calendar.properties @@ -114,10 +114,7 @@ TooManyAlarmsMessage=You have %1$S total alarms. We've shown you the last 6. Cli 1001=Uwaga nie znaleziono Identyfikatora Użytkownika! Przydziel nowy. # List of events or todos (unifinder) -## %1$S is the date -unifinderAlldayEventDate=All day %1$S -## %1$S is the date, %2$S is the time -unifinderNormalEventDate=%1$S %2$S +AllDay=All day eventUntitled=Niezatytułowane # Tooltips of events or todos diff --git a/calendar/resources/locale/pt-BR/calendar.properties b/calendar/resources/locale/pt-BR/calendar.properties index c4356db1660..793565935cc 100644 --- a/calendar/resources/locale/pt-BR/calendar.properties +++ b/calendar/resources/locale/pt-BR/calendar.properties @@ -116,10 +116,7 @@ TooManyAlarmsMessage=Voce tem %1$S alarme(s) no total. Nos mostramos a voce os u 1001=Aviso, UID nao encontrado! Criando novo. # List of events or todos (unifinder) -## %1$S is the date -unifinderAlldayEventDate=Dia Inteiro %1$S -## %1$S is the date, %2$S is the time -unifinderNormalEventDate=%1$S %2$S +AllDay=Dia Inteiro eventUntitled=Sem Titulo # Tooltips of events or todos diff --git a/calendar/resources/locale/sk-SK/calendar.properties b/calendar/resources/locale/sk-SK/calendar.properties index 9e59e212f7e..af8484b1751 100644 --- a/calendar/resources/locale/sk-SK/calendar.properties +++ b/calendar/resources/locale/sk-SK/calendar.properties @@ -115,10 +115,7 @@ TooManyAlarmsMessage=M\u00E1te celkom %1$S upozornen\u00ED. Zobrazen\u00E9 m\u00 1001=Upozornenie. UID nebol n\u00E1jden\u00FD! Prira\u010Fte nov\u00FD. # List of events or todos (unifinder) -## %1$S is the date -unifinderAlldayEventDate=Celodenn\u00E1 %1$S -## %1$S is the date, %2$S is the time -unifinderNormalEventDate=%1$S %2$S +AllDay=Celodenn\u00E1 eventUntitled=Nepomenovan\u00FD # Tooltips of events or todos diff --git a/calendar/resources/locale/sl-SI/calendar.properties b/calendar/resources/locale/sl-SI/calendar.properties index 217034373cc..07749c86f15 100644 --- a/calendar/resources/locale/sl-SI/calendar.properties +++ b/calendar/resources/locale/sl-SI/calendar.properties @@ -115,10 +115,7 @@ TooManyAlarmsMessage=Imate skupaj %1$S alarmov. Prikazanih je zadnjih \u0161est. 1001=Opozorilo\: ne najdem UID\! Dolo\u010Aam novega. # Seznam dogodkov ali opravkov (unifinder) -## %1$S je dan -unifinderAlldayEventDate=Cel dan %1$S -## %1$S je dan, %2$S je \u010Das -unifinderNormalEventDate=%1$S %2$S +AllDay=Cel dan eventUntitled=Neimenovan # Tooltips of events or todos diff --git a/calendar/resources/locale/sv-SE/calendar.properties b/calendar/resources/locale/sv-SE/calendar.properties index cb95d6b8f2a..f2cf4715328 100644 --- a/calendar/resources/locale/sv-SE/calendar.properties +++ b/calendar/resources/locale/sv-SE/calendar.properties @@ -116,10 +116,7 @@ TooManyAlarmsMessage=Du har %1$S alarm totalt. Du har visats de 6 senaste. Välj 1001=Warning UID not found! Assigning new one. # List of events or todos (unifinder) -## %1$S is the date -unifinderAlldayEventDate=Hela Dagen %1$S -## %1$S is the date, %2$S is the time -unifinderNormalEventDate=%1$S %2$S +AllDay=Hela Dagen eventUntitled=Namnlös # Tooltips of events or todos diff --git a/calendar/resources/locale/wen-DE/calendar.properties b/calendar/resources/locale/wen-DE/calendar.properties index 4b66e271b5a..47d83f8ee60 100644 --- a/calendar/resources/locale/wen-DE/calendar.properties +++ b/calendar/resources/locale/wen-DE/calendar.properties @@ -115,10 +115,7 @@ TooManyAlarmsMessage=Ma\u0107e %1$S alarmow w cy\u0142ku. Smy wam poslednje 6 po 1001=Warnowanje! UID njenamakane! P\u0159ipokazuju nowe. # List of events or todos (unifinder) -## %1$S is the date -unifinderAlldayEventDate=Cy\u0142y d\u017ae\u0144 %1$S -## %1$S is the date, %2$S is the time -unifinderNormalEventDate=%1$S %2$S +AllDay=Cy\u0142y d\u017ae\u0144 eventUntitled=Bjez titla # Tooltips of events or todos