mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-28 09:53:23 +00:00
Monotone-Parent: ed1968caab1223af1ac0a41cf3fd4504a3dfa473
Monotone-Revision: 4d2697a35bcf482dfa9095d58087ffb8469eada5 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-07-18T19:25:26 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -93,6 +93,11 @@
|
||||
return [[self selectedDate] firstDayOfMonth];
|
||||
}
|
||||
|
||||
- (unsigned int) firstDayOfWeek
|
||||
{
|
||||
return [[context activeUser] firstDayOfWeek];
|
||||
}
|
||||
|
||||
/* labels */
|
||||
|
||||
- (NSString *) headerMonthValue
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -172,4 +172,9 @@ static NSMutableArray *yearMenuItems = nil;
|
||||
return [self responseWithStatus: 204];
|
||||
}
|
||||
|
||||
- (unsigned int) firstDayOfWeek
|
||||
{
|
||||
return [[context activeUser] firstDayOfWeek];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user