Monotone-Parent: ed1968caab1223af1ac0a41cf3fd4504a3dfa473

Monotone-Revision: 4d2697a35bcf482dfa9095d58087ffb8469eada5

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-07-18T19:25:26
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2008-07-18 19:25:26 +00:00
parent dcc47678c3
commit b75d761539
29 changed files with 512 additions and 272 deletions

View File

@ -1,3 +1,46 @@
2008-07-18 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/Scheduler/UIxCalWeekView.m ([UIxCalWeekView -startDate]):
same as below.
* UI/Scheduler/UIxCalMonthView.m ([UIxCalMonthView
-weeksToDisplay]): use the user's first day of week to chose the
day to start the series.
([UIxCalMonthView -dayCellClasses]): take the user's first day of
week into account.
([UIxCalMonthView -endDate]): same as above.
* UI/Scheduler/UIxCalMainView.m ([UIxCalMainView
-firstDayOfWeek]): new template accessor.
* UI/Scheduler/UIxCalDayTable.m ([UIxCalDayTable
-currentHourLineClass]): new template accessor.
([UIxCalDayTable -clickableHourCellClass]): add the class
'outOfDay' when the current hour is out of the user's day start
and end hour ranges.
* UI/Scheduler/UIxCalDateSelector.m ([UIxCalDateSelector
-firstDayOfWeek]): new template accessor.
* UI/Scheduler/UIxAttendeesEditor.m ([UIxAttendeesEditor -dayStartHour])
([UIxAttendeesEditor -dayEndHour]): new template accessors.
* UI/Scheduler/UIxTaskEditor.m ([UIxTaskEditor -newStartDate]),
UI/Scheduler/UIxAppointmentEditor.m ([UIxAppointmentEditor
-newStartDate]): take the user-configured day start hour into account.
* UI/PreferencesUI/UIxPreferences.m ([UIxPreferences
-firstWeekList]): no longer list the option that enables the
hiding of week numbers.
* SoObjects/SOGo/SOGoUser.m ([SOGoUser -firstDayOfWeek])
([SOGoUser -firstDayOfWeekForDate:date])
([SOGoUser -dayOfWeekForDate:date], [SOGoUser -dayStartHour])
([SOGoUser -dayEndHour])
([SOGoUser -firstWeekOfYearForDate:date])
([SOGoUser -weekNumberForDate:date]): new methods that help take
the calendar-related user preferences into account.
2008-07-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/Scheduler/UIxCalMonthView.m ([UIxCalMonthView

View File

@ -50,7 +50,6 @@
@class SOGoDateFormatter;
@class SOGoUserFolder;
extern NSString *SOGoWeekStartHideWeekNumbers;
extern NSString *SOGoWeekStartJanuary1;
extern NSString *SOGoWeekStartFirst4DayWeek;
extern NSString *SOGoWeekStartFirstFullWeek;
@ -119,6 +118,16 @@ extern NSString *SOGoWeekStartFirstFullWeek;
- (NSTimeZone *) timeZone;
- (NSTimeZone *) serverTimeZone;
- (unsigned int) firstDayOfWeek;
- (NSCalendarDate *) firstDayOfWeekForDate: (NSCalendarDate *) date;
- (unsigned int) dayOfWeekForDate: (NSCalendarDate *) date;
- (unsigned int) dayStartHour;
- (unsigned int) dayEndHour;
- (NSCalendarDate *) firstWeekOfYearForDate: (NSCalendarDate *) date;
- (unsigned int) weekNumberForDate: (NSCalendarDate *) date;
- (NSArray *) mailAccounts;
- (NSDictionary *) accountWithName: (NSString *) accountName;
- (NSArray *) allIdentities;

View File

@ -20,6 +20,7 @@
*/
#import <Foundation/NSArray.h>
#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSNull.h>
@ -30,6 +31,7 @@
#import <NGObjWeb/WOContext.h>
#import <NGObjWeb/WORequest.h>
#import <NGObjWeb/SoObject.h>
#import <NGExtensions/NSCalendarDate+misc.h>
#import <NGExtensions/NSNull+misc.h>
#import <NGExtensions/NSObject+Logs.h>
@ -50,8 +52,10 @@ static NSString *defaultLanguage = nil;
static NSArray *superUsernames = nil;
static NSURL *AgenorProfileURL = nil;
static BOOL acceptAnyUser = NO;
static int sogoFirstDayOfWeek = -1;
static int defaultDayStartTime = -1;
static int defaultDayEndTime = -1;
NSString *SOGoWeekStartHideWeekNumbers = @"HideWeekNumbers";
NSString *SOGoWeekStartJanuary1 = @"January1";
NSString *SOGoWeekStartFirst4DayWeek = @"First4DayWeek";
NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
@ -73,6 +77,19 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
@implementation SOGoUser
static int
_timeValue (NSString *key)
{
int time;
if (key && [key length] > 1)
time = [[key substringToIndex: 2] intValue];
else
time = -1;
return time;
}
+ (void) initialize
{
NSString *tzName;
@ -88,6 +105,23 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
serverTimeZone = [NSTimeZone timeZoneWithName: tzName];
[serverTimeZone retain];
}
if (sogoFirstDayOfWeek == -1)
sogoFirstDayOfWeek = [ud integerForKey: @"SOGoFirstDayOfWeek"];
if (defaultDayStartTime == -1)
{
defaultDayStartTime
= _timeValue ([ud stringForKey: @"SOGoDayStartTime"]);
if (defaultDayStartTime == -1)
defaultDayStartTime = 8;
}
if (defaultDayEndTime == -1)
{
defaultDayEndTime
= _timeValue ([ud stringForKey: @"SOGoDayEndTime"]);
if (defaultDayEndTime == -1)
defaultDayEndTime = 18;
}
if (!AgenorProfileURL)
{
profileURL = [ud stringForKey: @"AgenorProfileURL"];
@ -105,7 +139,6 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
@" value set to 'localhost'"];
fallbackIMAP4Server = @"localhost";
}
if (!defaultLanguage)
{
ASSIGN (defaultLanguage, [ud stringForKey: @"SOGoDefaultLanguage"]);
@ -451,6 +484,124 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
return serverTimeZone;
}
- (unsigned int) firstDayOfWeek
{
unsigned int firstDayOfWeek;
NSNumber *value;
value = [[self userDefaults] objectForKey: @"WeekStartDay"];
if (value)
firstDayOfWeek = [value unsignedIntValue];
else
firstDayOfWeek = sogoFirstDayOfWeek;
return firstDayOfWeek;
}
- (NSCalendarDate *) firstDayOfWeekForDate: (NSCalendarDate *) date
{
int offset;
NSCalendarDate *firstDay;
offset = ([self firstDayOfWeek] - [date dayOfWeek]);
if (offset > 0)
offset -= 7;
firstDay = [date addTimeInterval: offset * 86400];
return firstDay;
}
- (unsigned int) dayOfWeekForDate: (NSCalendarDate *) date
{
unsigned int offset, baseDayOfWeek, dayOfWeek;
offset = [self firstDayOfWeek];
baseDayOfWeek = [date dayOfWeek];
if (offset > baseDayOfWeek)
baseDayOfWeek += 7;
dayOfWeek = baseDayOfWeek - offset;
return dayOfWeek;
}
- (unsigned int) dayStartHour
{
int limit;
limit = _timeValue ([[self userDefaults] stringForKey: @"DayStartTime"]);
if (limit == -1)
limit = defaultDayStartTime;
return limit;
}
- (unsigned int) dayEndHour
{
int limit;
limit = _timeValue ([[self userDefaults] stringForKey: @"DayEndTime"]);
if (limit == -1)
limit = defaultDayEndTime;
return limit;
}
- (NSCalendarDate *) firstWeekOfYearForDate: (NSCalendarDate *) date
{
NSString *firstWeekRule;
NSCalendarDate *januaryFirst, *firstWeek;
unsigned int dayOfWeek;
firstWeekRule = [userDefaults objectForKey: @"FirstWeek"];
januaryFirst = [NSCalendarDate dateWithYear: [date yearOfCommonEra]
month: 1 day: 1 hour: 0 minute: 0 second: 0
timeZone: [date timeZone]];
if ([firstWeekRule isEqualToString: SOGoWeekStartFirst4DayWeek])
{
dayOfWeek = [self dayOfWeekForDate: januaryFirst];
if (dayOfWeek < 4)
firstWeek = [self firstDayOfWeekForDate: januaryFirst];
else
firstWeek = [self firstDayOfWeekForDate: [januaryFirst
dateByAddingYears: 0
months: 0
days: 7]];
}
else if ([firstWeekRule isEqualToString: SOGoWeekStartFirstFullWeek])
{
dayOfWeek = [self dayOfWeekForDate: januaryFirst];
if (dayOfWeek == 0)
firstWeek = [self firstDayOfWeekForDate: januaryFirst];
else
firstWeek = [self firstDayOfWeekForDate: [januaryFirst
dateByAddingYears: 0
months: 0
days: 7]];
}
else
firstWeek = [self firstDayOfWeekForDate: januaryFirst];
return firstWeek;
}
- (unsigned int) weekNumberForDate: (NSCalendarDate *) date
{
NSCalendarDate *firstWeek;
unsigned int weekNumber;
firstWeek = [self firstWeekOfYearForDate: date];
if ([firstWeek earlierDate: date] == firstWeek)
weekNumber = ([date timeIntervalSinceDate: firstWeek]
/ (86400 * 7) + 1);
else
weekNumber = 0;
return weekNumber;
}
/* mail */
- (void) _prepareDefaultMailAccounts
{

View File

@ -47,7 +47,6 @@
"Play a sound when a reminder comes due" = "Geluidafspelen bij herinnering";
"Default reminder :" = "Standaard herinnering:";
"firstWeekOfYear_HideWeekNumbers" = "Weeknummers verbergen";
"firstWeekOfYear_January1" = "Begint op 1 januari";
"firstWeekOfYear_First4DayWeek" = "Eerste week met 4 dagen";
"firstWeekOfYear_FirstFullWeek" = "Eerste volledige week";
@ -82,6 +81,7 @@
"Default identity:" = "Standaardidentiteit:";
"Manage identities..." = "Identiteiten beheren...";
"Signature" = "Signature";
/* password */
"New password:" = "Nieuw wachtwoord:";

View File

@ -50,7 +50,6 @@
= "Play a sound when a reminder comes due";
"Default reminder :" = "Default reminder :";
"firstWeekOfYear_HideWeekNumbers" = "Do not display week numbers";
"firstWeekOfYear_January1" = "Starts on january 1";
"firstWeekOfYear_First4DayWeek" = "First 4-day week";
"firstWeekOfYear_FirstFullWeek" = "First full week";
@ -85,7 +84,7 @@
"Default identity:" = "Default identity:";
"Manage identities..." = "Manage identities...";
"Signature:" = "Signature:";
"Signature" = "Signature";
/* password */
"New password:" = "New password:";

View File

@ -47,7 +47,6 @@
"Play a sound when a reminder comes due" = "Émettre un signal sonore à l'échéance du rappel";
"Default reminder :" = "Rappel par défaut :";
"firstWeekOfYear_HideWeekNumbers" = "Ne pas afficher le numéro des semaines";
"firstWeekOfYear_January1" = "Commence le 1er janvier";
"firstWeekOfYear_First4DayWeek" = "Première semaine de 4 jours";
"firstWeekOfYear_FirstFullWeek" = "Première semaine entière";
@ -83,7 +82,7 @@
/* Identities */
"Default identity:" = "Identité par défaut :";
"Manage identities..." = "Gérer les identitiés...";
"Signature:" = "Signature :";
"Signature" = "Signature";
/* password */
"New password:" = "Nouveau mot de passe :";

View File

@ -47,7 +47,6 @@
"Play a sound when a reminder comes due" = "Akustisches Signal zur Terminerinnerung";
"Default reminder :" = "Standard Terminerinnerung:";
"firstWeekOfYear_HideWeekNumbers" = "Keine Wochennummern anzeigen";
"firstWeekOfYear_January1" = "Beginnt am 1.Januar";
"firstWeekOfYear_First4DayWeek" = "Erste 4 Tage Woche";
"firstWeekOfYear_FirstFullWeek" = "Erste ganze Woche";
@ -82,7 +81,7 @@
"Default identity:" = "Standard Identität:";
"Manage identities..." = "Identitäten verwalten...";
"Signature:" = "Unterschrift:";
"Signature" = "Unterschrift";
/* password */
"New password:" = "Neues Passwort:";

View File

@ -48,7 +48,6 @@
"Play a sound when a reminder comes due" = "Riproduci un suono quando un promemoria è attivo";
"Default reminder :" = "Promemoria predefinito:";
"firstWeekOfYear_HideWeekNumbers" = "Non visualizzare i numeri della settimana";
"firstWeekOfYear_January1" = "Inizia l'1 gennaio";
"firstWeekOfYear_First4DayWeek" = "Prima settimana di 4 giorni";
"firstWeekOfYear_FirstFullWeek" = "Prima settimana completa";
@ -83,7 +82,7 @@
"Default identity:" = "Identità principale:";
"Manage identities..." = "Gestisci identità...";
"Signature:" = "Firma:";
"Signature" = "Firma";
/* password */
"New password:" = "Nuova password:";

View File

@ -59,7 +59,6 @@
= "Señal acústica para los recordatorios";
"Default reminder :" = "Recordatorio por omisión: ";
"firstWeekOfYear_HideWeekNumbers" = "No mostrar número de semana";
"firstWeekOfYear_January1" = "Empieza el 1 de enero";
"firstWeekOfYear_First4DayWeek" = "Primera semana de 4 días";
"firstWeekOfYear_FirstFullWeek" = "Primera semana completa";
@ -94,11 +93,9 @@
"Default identity:" = "Identidad por defecto:";
"Manage identities..." = "Gestionar identidades...";
"Signature:" = "Firma:";
"Signature" = "Firma";
/* password */
"New password:" = "Contraseña nueva:";
"Confirmation:" = "Confirmar contraseña nueva:"; /* ??? */
"Change" = "Cambiar";
"Signature" = "Firma";

View File

@ -347,10 +347,11 @@ static BOOL shouldDisplayPasswordChange = NO;
- (NSArray *) firstWeekList
{
return [NSArray arrayWithObjects: SOGoWeekStartHideWeekNumbers,
SOGoWeekStartJanuary1,
return [NSArray arrayWithObjects:
SOGoWeekStartJanuary1,
SOGoWeekStartFirst4DayWeek,
SOGoWeekStartFirstFullWeek, nil];
SOGoWeekStartFirstFullWeek,
nil];
}
- (NSString *) itemFirstWeekText

View File

@ -137,7 +137,9 @@
{
NSCalendarDate *newStartDate, *now;
NSTimeZone *timeZone;
SOGoUser *user;
int hour;
unsigned int uStart, uEnd;
newStartDate = [self selectedDate];
if (![[self queryParameterForKey: @"hm"] length])
@ -145,18 +147,22 @@
now = [NSCalendarDate calendarDate];
timeZone = [[context activeUser] timeZone];
[now setTimeZone: timeZone];
user = [context activeUser];
uStart = [user dayStartHour];
if ([now isDateOnSameDay: newStartDate])
{
uEnd = [user dayEndHour];
hour = [now hourOfDay];
if (hour < 8)
newStartDate = [now hour: 8 minute: 0];
else if (hour > 18)
newStartDate = [[now tomorrow] hour: 8 minute: 0];
if (hour < uStart)
newStartDate = [now hour: uStart minute: 0];
else if (hour > uEnd)
newStartDate = [[now tomorrow] hour: uStart minute: 0];
else
newStartDate = now;
}
else
newStartDate = [newStartDate hour: 8 minute: 0];
newStartDate = [newStartDate hour: uStart minute: 0];
}
return newStartDate;

View File

@ -23,6 +23,7 @@
#import <Foundation/NSArray.h>
#import <Foundation/NSString.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <Common/UIxPageFrame.h>
#import "UIxAttendeesEditor.h"
@ -76,4 +77,14 @@
return [self labelForKey: [NSString stringWithFormat: @"zoom_%@", item]];
}
- (unsigned int) dayStartHour
{
return [[context activeUser] dayStartHour];
}
- (unsigned int) dayEndHour
{
return [[context activeUser] dayEndHour];
}
@end

View File

@ -93,6 +93,11 @@
return [[self selectedDate] firstDayOfMonth];
}
- (unsigned int) firstDayOfWeek
{
return [[context activeUser] firstDayOfWeek];
}
/* labels */
- (NSString *) headerMonthValue

View File

@ -28,12 +28,14 @@
@class NSArray;
@class NSCalendarDay;
@class NSDictionary;
@class NSNumber;
@class NSString;
@class SOGoDateFormatter;
@interface UIxCalDayTable : UIxCalView
{
int numberOfDays;
unsigned int numberOfDays;
NSCalendarDate *startDate;
NSCalendarDate *currentTableDay;
NSString *currentTableHour;
@ -43,8 +45,8 @@
SOGoDateFormatter *dateFormatter;
}
- (void) setNumberOfDays: (NSString *) aNumber;
- (NSString *) numberOfDays;
- (void) setNumberOfDays: (NSNumber *) aNumber;
- (NSNumber *) numberOfDays;
- (void) setStartDate: (NSCalendarDate *) aStartDate;
- (NSCalendarDate *) startDate;

View File

@ -26,6 +26,7 @@
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSString.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#import <NGExtensions/NSCalendarDate+misc.h>
#import <EOControl/EOQualifier.h>
@ -67,21 +68,21 @@
[super dealloc];
}
- (void) setNumberOfDays: (NSString *) aNumber
- (void) setNumberOfDays: (NSNumber *) aNumber
{
numberOfDays = [aNumber intValue];
[daysToDisplay release];
daysToDisplay = nil;
}
- (NSString *) numberOfDays
- (NSNumber *) numberOfDays
{
return [NSString stringWithFormat: @"%d", numberOfDays];
return [NSNumber numberWithUnsignedInt: numberOfDays];
}
- (void) setStartDate: (NSCalendarDate *) aStartDate
{
startDate = aStartDate;
startDate = [aStartDate beginOfDay];
[daysToDisplay release];
daysToDisplay = nil;
}
@ -89,9 +90,9 @@
- (NSCalendarDate *) startDate
{
if (!startDate)
startDate = [super startDate];
startDate = [[super startDate] beginOfDay];
return [startDate beginOfDay];
return startDate;
}
- (NSCalendarDate *) endDate
@ -111,23 +112,25 @@
if (!hoursToDisplay)
{
hoursToDisplay = [NSMutableArray new];
currentHour = [self dayStartHour];
lastHour = [self dayEndHour];
hoursToDisplay = [NSMutableArray new];
while (currentHour < lastHour)
{
[hoursToDisplay
addObject: [NSString stringWithFormat: @"%d", currentHour]];
[hoursToDisplay addObject: [NSNumber numberWithInt: currentHour]];
currentHour++;
}
[hoursToDisplay
addObject: [NSString stringWithFormat: @"%d", currentHour]];
[hoursToDisplay addObject: [NSNumber numberWithInt: currentHour]];
}
return hoursToDisplay;
}
- (NSString *) currentHourLineClass
{
return [NSString stringWithFormat: @"hourLine hourLine%d", [currentTableHour intValue]];
}
- (NSArray *) daysToDisplay
{
NSCalendarDate *currentDate;
@ -138,12 +141,11 @@
daysToDisplay = [NSMutableArray new];
currentDate = [[self startDate] hour: [self dayStartHour]
minute: 0];
[daysToDisplay addObject: currentDate];
for (count = 1; count < numberOfDays; count++)
[daysToDisplay addObject: [currentDate dateByAddingYears: 0
months: 0
days: count]];
for (count = 0; count < numberOfDays; count++)
{
[daysToDisplay addObject: currentDate];
currentDate = [currentDate tomorrow];
}
}
return daysToDisplay;
@ -282,15 +284,17 @@
- (NSString *) dayClasses
{
NSMutableString *classes;
int dayOfWeek;
unsigned int currentDayNbr, realDayOfWeek;
currentDayNbr = ([currentTableDay timeIntervalSinceDate: [self startDate]]
/ 86400);
realDayOfWeek = [currentTableDay dayOfWeek];
classes = [NSMutableString new];
[classes autorelease];
[classes appendFormat: @"day day%d", [currentTableDay dayOfWeek]];
classes = [NSMutableString string];
[classes appendFormat: @"day day%d", currentDayNbr];
if (numberOfDays > 1)
{
dayOfWeek = [currentTableDay dayOfWeek];
if (dayOfWeek == 0 || dayOfWeek == 6)
if (realDayOfWeek == 0 || realDayOfWeek == 6)
[classes appendString: @" weekEndDay"];
if ([currentTableDay isToday])
[classes appendString: @" dayOfToday"];
@ -303,7 +307,19 @@
- (NSString *) clickableHourCellClass
{
return [NSString stringWithFormat: @"clickableHourCell clickableHourCell%@", currentTableHour];
NSMutableString *cellClass;
int hour;
SOGoUser *user;
cellClass = [NSMutableString string];
hour = [currentTableHour intValue];
user = [context activeUser];
[cellClass appendFormat: @"clickableHourCell clickableHourCell%d", hour];
if (hour < [user dayStartHour]
|| hour > [user dayEndHour])
[cellClass appendString: @" outOfDay"];
return cellClass;
}
@end

View File

@ -172,4 +172,9 @@ static NSMutableArray *yearMenuItems = nil;
return [self responseWithStatus: 204];
}
- (unsigned int) firstDayOfWeek
{
return [[context activeUser] firstDayOfWeek];
}
@end

View File

@ -29,6 +29,7 @@
#import <SOGoUI/SOGoAptFormatter.h>
#import <SoObjects/SOGo/SOGoDateFormatter.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import "UIxCalMonthView.h"
@ -75,7 +76,8 @@
NSCalendarDate *currentDate;
headerDaysToDisplay = [NSMutableArray arrayWithCapacity: 7];
currentDate = [[self selectedDate] mondayOfWeek];
currentDate
= [[context activeUser] firstDayOfWeekForDate: [self selectedDate]];
for (counter = 0; counter < 7; counter++)
{
[headerDaysToDisplay addObject: currentDate];
@ -95,7 +97,9 @@
if (!weeksToDisplay)
{
selectedDate = [self selectedDate];
firstOfAllDays = [[selectedDate firstDayOfMonth] mondayOfWeek];
firstOfAllDays
= [[context activeUser] firstDayOfWeekForDate:
[selectedDate firstDayOfMonth]];
lastDayOfMonth = [selectedDate lastDayOfMonth];
firstToLast = ([lastDayOfMonth timeIntervalSinceDate: firstOfAllDays]
/ 86400);
@ -127,10 +131,11 @@
- (NSDictionary *) _dateQueryParametersWithOffset: (int) monthsOffset
{
NSCalendarDate *date;
NSCalendarDate *date, *firstDay;
date = [[self selectedDate] dateByAddingYears: 0 months: monthsOffset
days: 0 hours: 0 minutes: 0 seconds: 0];
firstDay = [[self selectedDate] firstDayOfMonth];
date = [firstDay dateByAddingYears: 0 months: monthsOffset
days: 0 hours: 0 minutes: 0 seconds: 0];
return [self queryParametersBySettingSelectedDate: date];
}
@ -233,8 +238,11 @@
- (NSString *) headerDayCellClasses
{
return [NSString stringWithFormat: @"headerDay day%d",
[currentTableDay dayOfWeek]];
unsigned int dayOfWeek;
dayOfWeek = [[context activeUser] dayOfWeekForDate: currentTableDay];
return [NSString stringWithFormat: @"headerDay day%d", dayOfWeek];
}
- (NSString *) dayHeaderNumber
@ -261,18 +269,19 @@
{
NSMutableString *classes;
NSCalendarDate *selectedDate;
int dayOfWeek, numberOfWeeks;
unsigned int realDayOfWeek, dayOfWeek, numberOfWeeks;
classes = [NSMutableString string];
dayOfWeek = [currentTableDay dayOfWeek];
dayOfWeek = [[context activeUser] dayOfWeekForDate: currentTableDay];
realDayOfWeek = [currentTableDay dayOfWeek];
numberOfWeeks = [weeksToDisplay count];
[classes appendFormat: @"day weekOf%d week%dof%d day%d",
numberOfWeeks,
[weeksToDisplay indexOfObject: currentWeek],
numberOfWeeks, dayOfWeek];
if (dayOfWeek == 0 || dayOfWeek == 6)
if (realDayOfWeek == 0 || realDayOfWeek == 6)
[classes appendString: @" weekEndDay"];
selectedDate = [self selectedDate];
if (![[currentTableDay firstDayOfMonth]
@ -292,16 +301,17 @@
firstDayOfMonth = [[self selectedDate] firstDayOfMonth];
return [firstDayOfMonth mondayOfWeek];
return [[context activeUser] firstDayOfWeekForDate: firstDayOfMonth];
}
- (NSCalendarDate *) endDate
{
NSCalendarDate *lastDayOfMonth;
NSCalendarDate *lastDayOfMonth, *firstDay;
lastDayOfMonth = [[self selectedDate] lastDayOfMonth];
firstDay = [[context activeUser] firstDayOfWeekForDate: lastDayOfMonth];
return [[lastDayOfMonth mondayOfWeek] dateByAddingYears: 0 months: 0 days: 6];
return [firstDay dateByAddingYears: 0 months: 0 days: 6];
}
@end

View File

@ -25,9 +25,11 @@
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSString.h>
#import <NGExtensions/NSCalendarDate+misc.h>
#import <EOControl/EOQualifier.h>
#import <NGExtensions/NSCalendarDate+misc.h>
#import <SoObjects/SOGo/SOGoUser.h>
#include "UIxCalWeekView.h"
@ -35,14 +37,18 @@
- (NSCalendarDate *) startDate
{
return [[[super startDate] mondayOfWeek] beginOfDay];
NSCalendarDate *date;
date = [[context activeUser] firstDayOfWeekForDate: [super startDate]];
return [date beginOfDay];
}
- (NSCalendarDate *) endDate
{
unsigned offset;
if([self shouldDisplayWeekend])
if ([self shouldDisplayWeekend])
offset = 7;
else
offset = 5;
@ -83,12 +89,17 @@
{
NSCalendarDate *date;
NSString *format;
unsigned int weekNbr;
SOGoUser *user;
date = [[self startDate] dateByAddingYears: 0 months: 0 days: (offset * 7)
hours:0 minutes: 0 seconds: 0];
user = [context activeUser];
date = [[self startDate] dateByAddingYears: 0 months: 0
days: (offset * 7) + 6
hours: 0 minutes: 0 seconds: 0];
weekNbr = [user weekNumberForDate: date];
format = [self labelForKey: @"Week %d"];
return [NSString stringWithFormat: format, [date weekOfYear]];
return [NSString stringWithFormat: format, weekNbr];
}
- (NSString *) weekBeforeLastWeekName

View File

@ -215,28 +215,33 @@
- (NSCalendarDate *) newStartDate
{
NSCalendarDate *newStartDate, *now;
int hour;
NSTimeZone *timeZone;
timeZone = [[context activeUser] timeZone];
SOGoUser *user;
int hour;
unsigned int uStart, uEnd;
newStartDate = [self selectedDate];
if ([[self queryParameterForKey: @"hm"] length] == 0)
if (![[self queryParameterForKey: @"hm"] length])
{
now = [NSCalendarDate calendarDate];
timeZone = [[context activeUser] timeZone];
[now setTimeZone: timeZone];
user = [context activeUser];
uStart = [user dayStartHour];
if ([now isDateOnSameDay: newStartDate])
{
uEnd = [user dayEndHour];
hour = [now hourOfDay];
if (hour < 8)
newStartDate = [now hour: 8 minute: 0];
else if (hour > 18)
newStartDate = [[now tomorrow] hour: 8 minute: 0];
if (hour < uStart)
newStartDate = [now hour: uStart minute: 0];
else if (hour > uEnd)
newStartDate = [[now tomorrow] hour: uStart minute: 0];
else
newStartDate = now;
}
else
newStartDate = [newStartDate hour: 8 minute: 0];
newStartDate = [newStartDate hour: uStart minute: 0];
}
return newStartDate;

View File

@ -23,7 +23,7 @@
<li target="mailOptionsView"><var:string
label:value="Mail Options"/></li>
<li target="identitiesView"><var:string
label:value="Identities"/></li>
label:value="Signature"/></li>
</var:if>
<var:if condition="shouldDisplayPasswordChange">
<li target="passwordView"><var:string label:value="Password"/></li>
@ -67,18 +67,18 @@
<var:popup list="firstWeekList" item="item"
string="itemFirstWeekText" selection="userFirstWeek"
/></label><br/>
<br/>
<label><input class="checkBox"
type="checkbox" var:selection="reminderEnabled"
var:checked="reminderEnabled"/><var:string
label:value="Enable reminders for Calendar items"/></label><br/>
<label><input class="checkBox"
type="checkbox" var:selection="remindWithASound"
var:checked="remindWithASound"/><var:string
label:value="Play a sound when a reminder comes due"/></label><br/>
<label><var:string label:value="Default reminder :"/>
<var:popup list="reminderTimesList" item="item"
string="itemReminderTimeText" selection="userReminderTime"/></label>
<!-- <br/> -->
<!-- <label><input class="checkBox" -->
<!-- type="checkbox" var:selection="reminderEnabled" -->
<!-- var:checked="reminderEnabled"/><var:string -->
<!-- label:value="Enable reminders for Calendar items"/></label><br/> -->
<!-- <label><input class="checkBox" -->
<!-- type="checkbox" var:selection="remindWithASound" -->
<!-- var:checked="remindWithASound"/><var:string -->
<!-- label:value="Play a sound when a reminder comes due"/></label><br/> -->
<!-- <label><var:string label:value="Default reminder :"/> -->
<!-- <var:popup list="reminderTimesList" item="item" -->
<!-- string="itemReminderTimeText" selection="userReminderTime"/></label> -->
</div>
</var:if>
<var:if condition="userHasMailAccess">
@ -108,7 +108,6 @@
list="identitiesList" displayString="itemIdentityText">
</var:multiselection>
<br/>-->
<var:string label:value="Signature:"/><br/>
<textarea const:id="signature" const:name="signature"
var:value="signature"/>
</div>

View File

@ -14,6 +14,10 @@
<div class="popupMenu" id="attendeesMenu">
<ul></ul>
</div>
<script type="text/javascript">
var dayStartHour = <var:string value="dayStartHour"/>;
var dayEndHour = <var:string value="dayEndHour"/>;
</script>
<div id="attendeesView">
<div id="freeBusyViewButtons">
<var:string label:value="Suggest time slot:"/>

View File

@ -19,6 +19,7 @@
<var:month-overview
const:id="dateSelectorTable"
currentDay="currentDay"
firstDay="firstDayOfWeek"
index="dayIndex"
year="year"
month="month"

View File

@ -48,30 +48,9 @@
</div>
<div class="hourLines">
<div class="hourLine hourLine0"><!-- space --></div
><div class="hourLine hourLine1"><!-- space --></div
><div class="hourLine hourLine2"><!-- space --></div
><div class="hourLine hourLine3"><!-- space --></div
><div class="hourLine hourLine4"><!-- space --></div
><div class="hourLine hourLine5"><!-- space --></div
><div class="hourLine hourLine6"><!-- space --></div
><div class="hourLine hourLine7"><!-- space --></div
><div class="hourLine hourLine8"><!-- space --></div
><div class="hourLine hourLine9"><!-- space --></div
><div class="hourLine hourLine10"><!-- space --></div
><div class="hourLine hourLine11"><!-- space --></div
><div class="hourLine hourLine12"><!-- space --></div
><div class="hourLine hourLine13"><!-- space --></div
><div class="hourLine hourLine14"><!-- space --></div
><div class="hourLine hourLine15"><!-- space --></div
><div class="hourLine hourLine16"><!-- space --></div
><div class="hourLine hourLine17"><!-- space --></div
><div class="hourLine hourLine18"><!-- space --></div
><div class="hourLine hourLine19"><!-- space --></div
><div class="hourLine hourLine20"><!-- space --></div
><div class="hourLine hourLine21"><!-- space --></div
><div class="hourLine hourLine22"><!-- space --></div
><div class="hourLine hourLine23"><!-- space --></div>
<var:foreach list="hoursToDisplay" item="currentTableHour"
><div var:class="currentHourLineClass"><!-- space --></div
></var:foreach>
</div>
</div>
</container>

View File

@ -8,6 +8,9 @@
xmlns:label="OGo:label"
className="UIxPageFrame"
title="title">
<script type="text/javascript">
var firstDayOfWeek = <var:string value="firstDayOfWeek"/>;
</script>
<style type="text/css">
<var:if condition="horizontalDragHandleStyle">
DIV#verticalDragHandle, DIV#rightPanel

View File

@ -50,8 +50,8 @@
><var:foreach list="weeksToDisplay" item="currentWeek"
><var:foreach list="currentWeek" item="currentTableDay"
><div var:class="dayCellClasses"
var:day="currentTableDay.shortDateString">
<div class="dayHeader"><var:string value="dayHeaderNumber"/></div
var:day="currentTableDay.shortDateString"
><div class="dayHeader"><var:string value="dayHeaderNumber"/></div
></div>
</var:foreach>
</var:foreach>

View File

@ -1,6 +1,6 @@
String.prototype.trim = function() {
return this.replace(/(^\s+|\s+$)/g, '');
}
};
String.prototype.formatted = function() {
var newString = this;
@ -9,31 +9,31 @@ String.prototype.formatted = function() {
newString = newString.replace("%{" + i + "}", arguments[i], "g");
return newString;
}
};
String.prototype.repeat = function(count) {
var newString = "";
for (var i = 0; i < count; i++) {
newString += this;
}
var newString = "";
for (var i = 0; i < count; i++) {
newString += this;
}
return newString;
}
return newString;
};
String.prototype.capitalize = function() {
return this.replace(/\w+/g,
function(a) {
return ( a.charAt(0).toUpperCase()
+ a.substr(1).toLowerCase() );
});
}
function(a) {
return ( a.charAt(0).toUpperCase()
+ a.substr(1).toLowerCase() );
});
};
String.prototype.decodeEntities = function() {
return this.replace(/&#(\d+);/g,
function(wholematch, parenmatch1) {
return String.fromCharCode(+parenmatch1);
});
}
function(wholematch, parenmatch1) {
return String.fromCharCode(+parenmatch1);
});
};
String.prototype.asDate = function () {
var newDate;
@ -43,18 +43,18 @@ String.prototype.asDate = function () {
else {
date = this.split("-");
if (date.length == 3)
newDate = new Date(date[0], date[1] - 1, date[2]);
newDate = new Date(date[0], date[1] - 1, date[2]);
else {
if (this.length == 8) {
newDate = new Date(this.substring(0, 4),
this.substring(4, 6) - 1,
this.substring(6, 8));
}
if (this.length == 8) {
newDate = new Date(this.substring(0, 4),
this.substring(4, 6) - 1,
this.substring(6, 8));
}
}
}
return newDate;
}
};
Date.prototype.sogoDayName = function() {
var dayName = "";
@ -77,7 +77,7 @@ Date.prototype.sogoDayName = function() {
}
return dayName;
}
};
Date.prototype.daysUpTo = function(otherDate) {
var days = new Array();
@ -89,14 +89,14 @@ Date.prototype.daysUpTo = function(otherDate) {
day1 = day2;
day2 = tmp;
}
// var day1Date = new Date();
// day1Date.setTime(this.getTime());
// day1Date.setHours(0, 0, 0, 0);
// var day2Date = new Date();
// day2Date.setTime(otherDate.getTime());
// day2Date.setHours(23, 59, 59, 999);
// var day1 = day1Date.getTime();
// var day2 = day2Date.getTime();
// var day1Date = new Date();
// day1Date.setTime(this.getTime());
// day1Date.setHours(0, 0, 0, 0);
// var day2Date = new Date();
// day2Date.setTime(otherDate.getTime());
// day2Date.setHours(23, 59, 59, 999);
// var day1 = day1Date.getTime();
// var day2 = day2Date.getTime();
var nbrDays = Math.floor((day2 - day1) / 86400000) + 1;
for (var i = 0; i < nbrDays; i++) {
@ -106,42 +106,42 @@ Date.prototype.daysUpTo = function(otherDate) {
}
return days;
}
};
Date.prototype.getDayString = function() {
var newString = this.getYear();
if (newString < 1000) newString += 1900;
var month = '' + (this.getMonth() + 1);
if (month.length == 1)
month = '0' + month;
newString += month;
var day = '' + this.getDate();
if (day.length == 1)
day = '0' + day;
newString += day;
var newString = this.getYear();
if (newString < 1000) newString += 1900;
var month = '' + (this.getMonth() + 1);
if (month.length == 1)
month = '0' + month;
newString += month;
var day = '' + this.getDate();
if (day.length == 1)
day = '0' + day;
newString += day;
return newString;
}
return newString;
};
Date.prototype.getHourString = function() {
var newString = this.getHours() + '00';
if (newString.length == 3)
newString = '0' + newString;
var newString = this.getHours() + '00';
if (newString.length == 3)
newString = '0' + newString;
return newString;
}
return newString;
};
Date.prototype.getDisplayHoursString = function() {
var hoursString = "" + this.getUTCHours();
if (hoursString.length == 1)
hoursString = '0' + hoursString;
var hoursString = "" + this.getUTCHours();
if (hoursString.length == 1)
hoursString = '0' + hoursString;
var minutesString = "" + this.getUTCMinutes();
if (minutesString.length == 1)
minutesString = '0' + minutesString;
var minutesString = "" + this.getUTCMinutes();
if (minutesString.length == 1)
minutesString = '0' + minutesString;
return hoursString + ":" + minutesString;
}
return hoursString + ":" + minutesString;
};
Date.prototype.stringWithSeparator = function(separator) {
var month = '' + (this.getMonth() + 1);
@ -160,81 +160,64 @@ Date.prototype.stringWithSeparator = function(separator) {
str = day + '/' + month + '/' + year;
return str;
}
};
Date.prototype.sogoFreeBusyStringWithSeparator = function(separator) {
return this.sogoDayName() + ", " + this.stringWithSeparator(separator);
}
};
Date.prototype.addDays = function(nbrDays) {
var milliSeconds = this.getTime();
milliSeconds += 86400000 * nbrDays;
this.setTime(milliSeconds);
}
var milliSeconds = this.getTime();
milliSeconds += 86400000 * nbrDays;
this.setTime(milliSeconds);
};
Date.prototype.earlierDate = function(otherDate) {
var workDate = new Date();
workDate.setTime(otherDate.getTime());
workDate.setHours(0);
return ((this.getTime() < workDate.getTime())
? this : otherDate);
}
var workDate = new Date();
workDate.setTime(otherDate.getTime());
workDate.setHours(0);
return ((this.getTime() < workDate.getTime())
? this : otherDate);
};
Date.prototype.laterDate = function(otherDate) {
var workDate = new Date();
workDate.setTime(otherDate.getTime());
workDate.setHours(23);
workDate.setMinutes(59);
workDate.setSeconds(59);
workDate.setMilliseconds(999);
return ((this.getTime() < workDate.getTime())
? otherDate : this);
}
var workDate = new Date();
workDate.setTime(otherDate.getTime());
workDate.setHours(23);
workDate.setMinutes(59);
workDate.setSeconds(59);
workDate.setMilliseconds(999);
return ((this.getTime() < workDate.getTime())
? otherDate : this);
};
Date.prototype.beginOfWeek = function() {
var beginNumber;
var dayNumber = this.getDay();
if (weekStartIsMonday) {
beginNumber = 1;
if (dayNumber == 0)
dayNumber = 7;
}
else
beginNumber = 0;
var offset = firstDayOfWeek - this.getDay();
if (offset > 0)
offset -= 7;
var beginOfWeek = new Date();
beginOfWeek.setTime(this.getTime());
beginOfWeek.addDays(beginNumber - dayNumber);
beginOfWeek.setHours(0);
beginOfWeek.setMinutes(0);
beginOfWeek.setSeconds(0);
beginOfWeek.setMilliseconds(0);
return beginOfWeek;
}
var beginOfWeek = new Date();
beginOfWeek.setTime(this.getTime());
beginOfWeek.addDays(offset);
beginOfWeek.setHours(0);
beginOfWeek.setMinutes(0);
beginOfWeek.setSeconds(0);
beginOfWeek.setMilliseconds(0);
return beginOfWeek;
};
Date.prototype.endOfWeek = function() {
var beginNumber;
var dayNumber = this.getDay();
if (weekStartIsMonday) {
beginNumber = 1;
if (dayNumber == 0)
dayNumber = 7;
}
else
beginNumber = 0;
var endOfWeek = this.beginOfWeek();
endOfWeek.addDays(6);
var endOfWeek = new Date();
endOfWeek.setTime(this.getTime());
endOfWeek.addDays(6 + beginNumber - dayNumber);
endOfWeek.setHours(23);
endOfWeek.setMinutes(59);
endOfWeek.setSeconds(59);
endOfWeek.setMilliseconds(999);
return endOfWeek;
}
endOfWeek.setHours(23);
endOfWeek.setMinutes(59);
endOfWeek.setSeconds(59);
endOfWeek.setMilliseconds(999);
return endOfWeek;
};
String.prototype._base64_keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
String.prototype.base64encode = function () {
@ -357,7 +340,7 @@ String.prototype.cssSafeString = function() {
newString = newString.replace("@", "_", "g");
return newString;
}
};
window.width = function() {
if (window.innerWidth)
@ -366,7 +349,7 @@ window.width = function() {
return document.body.offsetWidth;
else
return 0;
}
};
window.height = function() {
if (window.innerHeight)
@ -375,4 +358,4 @@ window.height = function() {
return document.body.offsetHeight;
else
return 0;
}
};

View File

@ -521,8 +521,12 @@ DIV.monthView > DIV.headerDay
DIV.dayOfToday
{ background-color: #deebf7; }
DIV.weekEndDay
{ background-color: #fffbe7; }
DIV.dayOfToday DIV.outOfDay
{ background-color: #d6dfe9; }
DIV.outOfDay, DIV.weekEndDay,
DIV.weekEndDay DIV.outOfDay
{ background-color: #f4f4f4; }
DIV.dayOfAnotherMonth
{ background-color: #e7efef; }
@ -530,6 +534,10 @@ DIV.dayOfAnotherMonth
DIV.selectedDay
{ background-color: #ffe79c; }
DIV.selectedDay.weekEndDay,
DIV.selectedDay DIV.outOfDay
{ background-color: #f5dd92; }
DIV.monthView DIV.dayHeader
{ margin-left: 1em;
cursor: pointer;
@ -651,35 +659,35 @@ DIV.monthView DIV.day,
DIV.daysViewFor7Days DIV.day
{ width: 14.2857%; }
DIV.monthView DIV.day0,
DIV.daysViewFor7Days DIV.day0
{ left: 0px; }
DIV.monthView DIV.day1,
DIV.daysViewFor7Days DIV.day1
{ left: 0px; }
{ left: 14.2857%; }
DIV.monthView DIV.day2,
DIV.daysViewFor7Days DIV.day2
{ left: 14.2857%; }
{ left: 28.5714%; }
DIV.monthView DIV.day3,
DIV.daysViewFor7Days DIV.day3
{ left: 28.5714%; }
{ left: 42.8571%; }
DIV.monthView DIV.day4,
DIV.daysViewFor7Days DIV.day4
{ left: 42.8571%; }
{ left: 57.1428%; }
DIV.monthView DIV.day5,
DIV.daysViewFor7Days DIV.day5
{ left: 57.1428%; }
DIV.monthView DIV.day6,
DIV.daysViewFor7Days DIV.day6
{ left: 71.4285%; }
DIV.monthView DIV.day0
DIV.monthView DIV.day6
{ left: 85.7142%;
border-right: 2px solid #397d94; }
DIV.daysViewFor7Days DIV.day0
DIV.daysViewFor7Days DIV.day6
{ left: 85.7142%;
border-right: 1px solid #397d94; }

View File

@ -3,9 +3,6 @@ var address;
var awaitingFreeBusyRequests = new Array();
var additionalDays = 2;
var dayStartHour = 8;
var dayEndHour = 18;
var attendeesEditor = {
delay: 500,
delayedSearch: false,
@ -221,20 +218,20 @@ function redisplayFreeBusyZone() {
var stMinute = parseInt($("startTime_time_minute").value) / 15;
var etHour = parseInt($("endTime_time_hour").value);
var etMinute = parseInt($("endTime_time_minute").value) / 15;
if (stHour < 8) {
stHour = 8;
if (stHour < dayStartHour) {
stHour = dayStartHour;
stMinute = 0;
}
if (stHour > 19) {
stHour = 19
if (stHour > dayEndHour + 1) {
stHour = dayEndHour + 1;
stMinute = 0;
}
if (etHour < 8) {
etHour = 8;
if (etHour < dayStartHour) {
etHour = dayStartHour;
etMinute = 0;
}
if (etHour > 19) {
etHour = 19;
if (etHour > dayEndHour + 1) {
etHour = dayEndHour;
etMinute = 0;
}
if (stHour > etHour) {
@ -252,9 +249,9 @@ function redisplayFreeBusyZone() {
}
}
var deltaCells = (etHour - stHour) + (11 * addDays);
var deltaCells = (etHour - stHour) + ((dayEndHour - dayStartHour + 1) * addDays);
var deltaSpans = (deltaCells * 4 ) + (etMinute - stMinute);
var currentCellNbr = stHour - 7 - 1;
var currentCellNbr = stHour - dayStartHour;
var currentCell = row.cells[currentCellNbr];
var currentSpanNbr = stMinute;
var spans = $(currentCell).childNodesWithTag("span");
@ -389,8 +386,8 @@ function setSlot(tds, nbr, status) {
days = Math.floor(tdnbr / 24);
tdnbr -= (days * 24);
}
if (tdnbr > 7 && tdnbr < 19) {
var i = (days * 11 + tdnbr - 7);
if (tdnbr > (dayStartHour - 1) && tdnbr < (dayEndHour + 1)) {
var i = (days * (dayEndHour - dayStartHour + 1) + tdnbr - (dayStartHour - 1));
var td = tds[i - 1];
var spans = $(td).childNodesWithTag("span");
if (status == '2')

View File

@ -33,8 +33,6 @@ var sorting = {};
var lastClickedRow = -1;
var weekStartIsMonday = true;
// logArea = null;
var allDocumentElements = null;