2006-08-24 20:56:24 +02:00
|
|
|
/* UIxCalDayTable.m - this file is part of SOGo
|
|
|
|
*
|
2009-03-03 20:08:02 +01:00
|
|
|
* Copyright (C) 2006-2009 Inverse inc.
|
2006-08-24 20:56:24 +02:00
|
|
|
*
|
|
|
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
|
|
|
*
|
|
|
|
* This file is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This file is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import <Foundation/NSArray.h>
|
|
|
|
#import <Foundation/NSCalendarDate.h>
|
2006-11-15 01:06:21 +01:00
|
|
|
#import <Foundation/NSDictionary.h>
|
2006-08-24 20:56:24 +02:00
|
|
|
#import <Foundation/NSKeyValueCoding.h>
|
|
|
|
#import <Foundation/NSString.h>
|
2009-11-29 05:19:32 +01:00
|
|
|
#import <Foundation/NSUserDefaults.h> /* for locale string constants */
|
2008-07-18 21:25:26 +02:00
|
|
|
#import <Foundation/NSValue.h>
|
2006-08-24 20:56:24 +02:00
|
|
|
|
2007-06-19 20:08:16 +02:00
|
|
|
#import <NGExtensions/NSCalendarDate+misc.h>
|
2006-08-24 20:56:24 +02:00
|
|
|
#import <EOControl/EOQualifier.h>
|
|
|
|
|
2010-02-13 00:24:24 +01:00
|
|
|
#import <SOGo/NSCalendarDate+SOGo.h>
|
2009-11-29 05:19:32 +01:00
|
|
|
#import <SOGo/SOGoDateFormatter.h>
|
|
|
|
#import <SOGo/SOGoUser.h>
|
|
|
|
#import <SOGo/SOGoUserDefaults.h>
|
2011-02-03 17:12:22 +01:00
|
|
|
#import <SOGo/WOResourceManager+SOGo.h>
|
2009-04-01 15:49:24 +02:00
|
|
|
|
2015-09-18 22:11:31 +02:00
|
|
|
#import <SoObjects/Appointments/SOGoAppointmentFolder.h>
|
|
|
|
#import <SoObjects/Appointments/SOGoAppointmentFolders.h>
|
|
|
|
|
2006-08-24 20:56:24 +02:00
|
|
|
#import "UIxCalDayTable.h"
|
|
|
|
|
|
|
|
@class SOGoAppointment;
|
|
|
|
|
|
|
|
@implementation UIxCalDayTable
|
|
|
|
|
|
|
|
- (id) init
|
|
|
|
{
|
2009-11-29 05:19:32 +01:00
|
|
|
SOGoUser *user;
|
|
|
|
SOGoUserDefaults *ud;
|
|
|
|
|
2006-08-24 20:56:24 +02:00
|
|
|
if ((self = [super init]))
|
|
|
|
{
|
2009-11-29 05:19:32 +01:00
|
|
|
user = [context activeUser];
|
|
|
|
ud = [user userDefaults];
|
|
|
|
ASSIGN (timeFormat, [ud timeFormat]);
|
2008-12-23 01:12:14 +01:00
|
|
|
|
2006-08-24 20:56:24 +02:00
|
|
|
daysToDisplay = nil;
|
2014-06-20 19:16:55 +02:00
|
|
|
calendarsToDisplay = nil;
|
2006-08-24 20:56:24 +02:00
|
|
|
hoursToDisplay = nil;
|
|
|
|
numberOfDays = 1;
|
|
|
|
startDate = nil;
|
2014-06-20 19:16:55 +02:00
|
|
|
currentView = nil;
|
|
|
|
currentCalendar = nil;
|
2006-08-24 20:56:24 +02:00
|
|
|
currentTableDay = nil;
|
|
|
|
currentTableHour = nil;
|
2008-12-23 01:12:14 +01:00
|
|
|
weekDays = [locale objectForKey: NSShortWeekDayNameArray];
|
2007-06-19 20:08:16 +02:00
|
|
|
[weekDays retain];
|
2009-11-29 05:19:32 +01:00
|
|
|
dateFormatter = [user dateFormatterInContext: context];
|
2009-03-03 20:08:02 +01:00
|
|
|
[dateFormatter retain];
|
2006-08-24 20:56:24 +02:00
|
|
|
}
|
2009-11-29 05:19:32 +01:00
|
|
|
|
2006-08-24 20:56:24 +02:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) dealloc
|
|
|
|
{
|
2007-06-11 23:27:14 +02:00
|
|
|
// if (allAppointments)
|
|
|
|
// [allAppointments release];
|
2007-06-19 20:08:16 +02:00
|
|
|
[weekDays release];
|
2007-06-11 23:27:14 +02:00
|
|
|
[daysToDisplay release];
|
2014-06-20 19:16:55 +02:00
|
|
|
[calendarsToDisplay release];
|
2014-06-27 23:21:18 +02:00
|
|
|
[currentView release];
|
2007-06-11 23:27:14 +02:00
|
|
|
[hoursToDisplay release];
|
2009-03-03 20:08:02 +01:00
|
|
|
[dateFormatter release];
|
2009-11-29 05:19:32 +01:00
|
|
|
[timeFormat release];
|
2006-08-24 20:56:24 +02:00
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
2008-07-18 21:25:26 +02:00
|
|
|
- (void) setNumberOfDays: (NSNumber *) aNumber
|
2006-08-24 20:56:24 +02:00
|
|
|
{
|
|
|
|
numberOfDays = [aNumber intValue];
|
2007-06-11 23:27:14 +02:00
|
|
|
[daysToDisplay release];
|
|
|
|
daysToDisplay = nil;
|
2006-11-15 01:06:21 +01:00
|
|
|
}
|
|
|
|
|
2008-07-18 21:25:26 +02:00
|
|
|
- (NSNumber *) numberOfDays
|
2006-11-15 01:06:21 +01:00
|
|
|
{
|
2008-07-18 21:25:26 +02:00
|
|
|
return [NSNumber numberWithUnsignedInt: numberOfDays];
|
2006-08-24 20:56:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setStartDate: (NSCalendarDate *) aStartDate
|
|
|
|
{
|
2008-07-18 21:25:26 +02:00
|
|
|
startDate = [aStartDate beginOfDay];
|
2007-06-11 23:27:14 +02:00
|
|
|
[daysToDisplay release];
|
|
|
|
daysToDisplay = nil;
|
2006-08-24 20:56:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSCalendarDate *) startDate
|
|
|
|
{
|
|
|
|
if (!startDate)
|
2008-07-18 21:25:26 +02:00
|
|
|
startDate = [[super startDate] beginOfDay];
|
2006-08-24 20:56:24 +02:00
|
|
|
|
2008-07-18 21:25:26 +02:00
|
|
|
return startDate;
|
2006-08-24 20:56:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSCalendarDate *) endDate
|
|
|
|
{
|
|
|
|
NSCalendarDate *endDate;
|
|
|
|
|
|
|
|
endDate = [[self startDate] dateByAddingYears: 0
|
|
|
|
months: 0
|
|
|
|
days: numberOfDays - 1];
|
|
|
|
|
|
|
|
return [endDate endOfDay];
|
|
|
|
}
|
|
|
|
|
2014-06-20 19:16:55 +02:00
|
|
|
- (void) setCurrentView: (NSString *) aView
|
|
|
|
{
|
2014-06-27 23:21:18 +02:00
|
|
|
ASSIGN(currentView, aView);
|
2014-06-20 19:16:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) currentView
|
|
|
|
{
|
|
|
|
return currentView;
|
|
|
|
}
|
|
|
|
|
2006-08-24 20:56:24 +02:00
|
|
|
- (NSArray *) hoursToDisplay
|
|
|
|
{
|
|
|
|
unsigned int currentHour, lastHour;
|
2009-08-25 17:05:01 +02:00
|
|
|
|
2006-08-24 20:56:24 +02:00
|
|
|
if (!hoursToDisplay)
|
|
|
|
{
|
2008-07-18 21:25:26 +02:00
|
|
|
hoursToDisplay = [NSMutableArray new];
|
2006-08-24 20:56:24 +02:00
|
|
|
currentHour = [self dayStartHour];
|
|
|
|
lastHour = [self dayEndHour];
|
|
|
|
while (currentHour < lastHour)
|
|
|
|
{
|
2008-07-18 21:25:26 +02:00
|
|
|
[hoursToDisplay addObject: [NSNumber numberWithInt: currentHour]];
|
2006-08-24 20:56:24 +02:00
|
|
|
currentHour++;
|
|
|
|
}
|
2008-07-18 21:25:26 +02:00
|
|
|
[hoursToDisplay addObject: [NSNumber numberWithInt: currentHour]];
|
2006-08-24 20:56:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return hoursToDisplay;
|
|
|
|
}
|
|
|
|
|
2010-02-13 00:24:24 +01:00
|
|
|
- (NSString *) currentHourId
|
2008-07-18 21:25:26 +02:00
|
|
|
{
|
2010-02-13 00:24:24 +01:00
|
|
|
return [NSString stringWithFormat: @"hour%d", [currentTableHour intValue]];
|
2008-07-18 21:25:26 +02:00
|
|
|
}
|
|
|
|
|
2006-08-24 20:56:24 +02:00
|
|
|
- (NSArray *) daysToDisplay
|
|
|
|
{
|
|
|
|
NSCalendarDate *currentDate;
|
|
|
|
int count;
|
2014-06-20 19:16:55 +02:00
|
|
|
|
2006-11-15 01:06:21 +01:00
|
|
|
if (!daysToDisplay)
|
2014-06-20 19:16:55 +02:00
|
|
|
{
|
|
|
|
daysToDisplay = [NSMutableArray new];
|
|
|
|
currentDate = [[self startDate] hour: [self dayStartHour]
|
|
|
|
minute: 0];
|
|
|
|
|
|
|
|
for (count = 0; count < numberOfDays; count++)
|
2006-08-24 20:56:24 +02:00
|
|
|
{
|
2014-06-20 19:16:55 +02:00
|
|
|
[daysToDisplay addObject: currentDate];
|
|
|
|
currentDate = [currentDate tomorrow];
|
2006-08-24 20:56:24 +02:00
|
|
|
}
|
2014-06-20 19:16:55 +02:00
|
|
|
}
|
|
|
|
|
2006-11-15 01:06:21 +01:00
|
|
|
return daysToDisplay;
|
2006-08-24 20:56:24 +02:00
|
|
|
}
|
|
|
|
|
2014-06-20 19:16:55 +02:00
|
|
|
- (NSArray *) calendarsToDisplay
|
|
|
|
{
|
2014-06-27 23:21:18 +02:00
|
|
|
if (!calendarsToDisplay)
|
|
|
|
{
|
2014-06-20 19:16:55 +02:00
|
|
|
int max=0, i;
|
|
|
|
NSArray *folders;
|
|
|
|
SOGoAppointmentFolders *co;
|
|
|
|
SOGoAppointmentFolder *folder;
|
|
|
|
NSMutableDictionary *calendar;
|
|
|
|
unsigned int count, foldersCount;
|
|
|
|
NSString *folderName, *fDisplayName;
|
2014-06-20 19:16:55 +02:00
|
|
|
NSNumber *isActive;
|
|
|
|
|
2014-06-20 19:16:55 +02:00
|
|
|
co = [self clientObject];
|
|
|
|
folders = [co subFolders];
|
|
|
|
foldersCount = [folders count];
|
|
|
|
calendarsToDisplay = [[NSMutableArray alloc] initWithCapacity: foldersCount];
|
|
|
|
for (count = 0; count < foldersCount; count++)
|
|
|
|
{
|
|
|
|
folder = [folders objectAtIndex: count];
|
|
|
|
isActive = [NSNumber numberWithBool: [folder isActive]];
|
|
|
|
if ([isActive intValue] != 0) {
|
|
|
|
calendar = [NSMutableDictionary dictionary];
|
|
|
|
folderName = [folder nameInContainer];
|
|
|
|
fDisplayName = [folder displayName];
|
|
|
|
if (fDisplayName == nil)
|
|
|
|
fDisplayName = @"";
|
|
|
|
if ([fDisplayName isEqualToString: [co defaultFolderName]])
|
|
|
|
fDisplayName = [self labelForKey: fDisplayName];
|
|
|
|
[calendar setObject: [NSString stringWithFormat: @"/%@", folderName]
|
|
|
|
forKey: @"id"];
|
|
|
|
[calendar setObject: fDisplayName forKey: @"displayName"];
|
|
|
|
[calendar setObject: folderName forKey: @"folder"];
|
|
|
|
[calendar setObject: [folder calendarColor] forKey: @"color"];
|
|
|
|
[calendar setObject: isActive forKey: @"active"];
|
|
|
|
[calendar setObject: [folder ownerInContext: context]
|
|
|
|
forKey: @"owner"];
|
|
|
|
[calendarsToDisplay addObject: calendar];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return calendarsToDisplay;
|
|
|
|
}
|
|
|
|
|
2006-08-24 20:56:24 +02:00
|
|
|
- (void) setCurrentTableDay: (NSCalendarDate *) aTableDay
|
|
|
|
{
|
|
|
|
currentTableDay = aTableDay;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSCalendarDate *) currentTableDay
|
|
|
|
{
|
|
|
|
return currentTableDay;
|
|
|
|
}
|
|
|
|
|
2014-06-20 19:16:55 +02:00
|
|
|
- (void) setCurrentCalendar: (NSMutableArray *) aCalendar
|
|
|
|
{
|
2014-06-27 23:21:18 +02:00
|
|
|
ASSIGN(currentCalendar, aCalendar);
|
2014-06-20 19:16:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSMutableArray *) currentCalendar
|
|
|
|
{
|
|
|
|
return currentCalendar;
|
|
|
|
}
|
|
|
|
|
2006-08-24 20:56:24 +02:00
|
|
|
- (void) setCurrentTableHour: (NSString *) aTableHour
|
|
|
|
{
|
|
|
|
currentTableHour = aTableHour;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) currentTableHour
|
|
|
|
{
|
2009-08-25 17:05:01 +02:00
|
|
|
int hour;
|
|
|
|
NSCalendarDate *tmp;
|
|
|
|
NSString *formatted = currentTableHour, *parse;
|
|
|
|
|
|
|
|
hour = [currentTableHour intValue];
|
|
|
|
parse = [NSString stringWithFormat: @"2000-01-01 %02d:00", hour];
|
|
|
|
|
|
|
|
tmp = [NSCalendarDate dateWithString: parse
|
|
|
|
calendarFormat: @"%Y-%m-%d %H:%M"];
|
|
|
|
if (tmp)
|
|
|
|
formatted = [tmp descriptionWithCalendarFormat: timeFormat];
|
|
|
|
|
|
|
|
return formatted;
|
2006-08-24 20:56:24 +02:00
|
|
|
}
|
|
|
|
|
2010-02-13 00:24:24 +01:00
|
|
|
- (NSString *) currentAllDayId
|
|
|
|
{
|
|
|
|
return [NSString stringWithFormat: @"allDay%@", [currentTableDay shortDateString]];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) currentDayId
|
|
|
|
{
|
|
|
|
return [NSString stringWithFormat: @"day%@", [currentTableDay shortDateString]];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) currentDayNumber
|
|
|
|
{
|
|
|
|
return [daysToDisplay indexOfObject: currentTableDay];
|
|
|
|
}
|
|
|
|
|
2006-08-31 00:59:03 +02:00
|
|
|
- (NSString *) currentAppointmentHour
|
|
|
|
{
|
|
|
|
return [NSString stringWithFormat: @"%.2d00", [currentTableHour intValue]];
|
|
|
|
}
|
|
|
|
|
2006-08-24 20:56:24 +02:00
|
|
|
- (NSString *) labelForDay
|
|
|
|
{
|
2007-06-19 20:08:16 +02:00
|
|
|
return [weekDays objectAtIndex: [currentTableDay dayOfWeek]];
|
2006-08-24 20:56:24 +02:00
|
|
|
}
|
|
|
|
|
2015-09-18 22:11:31 +02:00
|
|
|
- (NSString *) labelForMonth
|
|
|
|
{
|
|
|
|
NSCalendarDate *nextDay;
|
|
|
|
BOOL isLastOrFirstDay;
|
|
|
|
|
|
|
|
isLastOrFirstDay = NO;
|
|
|
|
if ([currentTableDay dayOfMonth] == 1)
|
|
|
|
{
|
|
|
|
isLastOrFirstDay = YES;
|
|
|
|
}
|
|
|
|
else if ([currentTableDay dayOfMonth] > 27)
|
|
|
|
{
|
|
|
|
nextDay = [currentTableDay dateByAddingYears: 0
|
|
|
|
months: 0
|
|
|
|
days: 1];
|
|
|
|
if ([nextDay dayOfMonth] == 1)
|
|
|
|
isLastOrFirstDay = YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
return isLastOrFirstDay? [currentTableDay descriptionWithCalendarFormat: @"%b" locale: locale] : nil;
|
|
|
|
}
|
|
|
|
|
2007-06-11 23:27:14 +02:00
|
|
|
- (NSString *) labelForDate
|
2006-11-15 01:06:21 +01:00
|
|
|
{
|
2007-06-19 20:08:16 +02:00
|
|
|
return [dateFormatter shortFormattedDate: currentTableDay];
|
2006-11-15 01:06:21 +01:00
|
|
|
}
|
|
|
|
|
2014-06-20 19:16:55 +02:00
|
|
|
- (NSString *) labelForCalendar
|
|
|
|
{
|
2014-06-27 23:21:18 +02:00
|
|
|
return [currentCalendar objectForKey: @"displayName"];
|
2014-06-20 19:16:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) colorForCalendar
|
|
|
|
{
|
2014-06-27 23:21:18 +02:00
|
|
|
return [currentCalendar objectForKey:@"color"];
|
2014-06-20 19:16:55 +02:00
|
|
|
}
|
|
|
|
|
2007-06-11 23:27:14 +02:00
|
|
|
// - (NSDictionary *) _adjustedAppointment: (NSDictionary *) anAppointment
|
|
|
|
// forStart: (NSCalendarDate *) start
|
|
|
|
// andEnd: (NSCalendarDate *) end
|
|
|
|
// {
|
|
|
|
// NSMutableDictionary *newMutableAppointment;
|
|
|
|
// NSDictionary *newAppointment;
|
|
|
|
// BOOL startIsEarlier, endIsLater;
|
|
|
|
|
|
|
|
// startIsEarlier
|
|
|
|
// = ([[anAppointment objectForKey: @"startDate"] laterDate: start] == start);
|
|
|
|
// endIsLater
|
|
|
|
// = ([[anAppointment objectForKey: @"endDate"] earlierDate: end] == end);
|
|
|
|
|
|
|
|
// if (startIsEarlier || endIsLater)
|
|
|
|
// {
|
|
|
|
// newMutableAppointment
|
|
|
|
// = [NSMutableDictionary dictionaryWithDictionary: anAppointment];
|
|
|
|
|
|
|
|
// if (startIsEarlier)
|
|
|
|
// [newMutableAppointment setObject: start
|
|
|
|
// forKey: @"startDate"];
|
|
|
|
// if (endIsLater)
|
|
|
|
// [newMutableAppointment setObject: end
|
|
|
|
// forKey: @"endDate"];
|
|
|
|
|
|
|
|
// newAppointment = newMutableAppointment;
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// newAppointment = anAppointment;
|
|
|
|
|
|
|
|
// return newAppointment;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// - (NSArray *) appointmentsForCurrentDay
|
|
|
|
// {
|
|
|
|
// NSMutableArray *filteredAppointments;
|
|
|
|
// NSEnumerator *aptsEnumerator;
|
|
|
|
// NSDictionary *currentDayAppointment;
|
|
|
|
// NSCalendarDate *start, *end;
|
|
|
|
// int endHour;
|
|
|
|
|
|
|
|
// if (!allAppointments)
|
|
|
|
// {
|
|
|
|
// allAppointments = [self fetchCoreAppointmentsInfos];
|
|
|
|
// [allAppointments retain];
|
|
|
|
// }
|
|
|
|
|
|
|
|
// filteredAppointments = [NSMutableArray new];
|
|
|
|
// [filteredAppointments autorelease];
|
|
|
|
|
|
|
|
// start = [currentTableDay hour: [self dayStartHour] minute: 0];
|
|
|
|
// endHour = [self dayEndHour];
|
|
|
|
// if (endHour < 24)
|
|
|
|
// end = [currentTableDay hour: [self dayEndHour] minute: 59];
|
|
|
|
// else
|
|
|
|
// end = [[currentTableDay tomorrow] hour: 0 minute: 0];
|
|
|
|
|
|
|
|
// aptsEnumerator = [allAppointments objectEnumerator];
|
|
|
|
// currentDayAppointment = [aptsEnumerator nextObject];
|
|
|
|
// while (currentDayAppointment)
|
|
|
|
// {
|
|
|
|
// if (([end laterDate: [currentDayAppointment
|
|
|
|
// valueForKey: @"startDate"]] == end)
|
|
|
|
// && ([start earlierDate: [currentDayAppointment
|
|
|
|
// valueForKey: @"endDate"]] == start))
|
|
|
|
// [filteredAppointments
|
|
|
|
// addObject: [self _adjustedAppointment: currentDayAppointment
|
|
|
|
// forStart: start andEnd: end]];
|
|
|
|
// currentDayAppointment = [aptsEnumerator nextObject];
|
|
|
|
// }
|
|
|
|
|
|
|
|
// return filteredAppointments;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// - (void) setCurrentAppointment: (NSDictionary *) newCurrentAppointment
|
|
|
|
// {
|
|
|
|
// currentAppointment = newCurrentAppointment;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// - (NSDictionary *) currentAppointment
|
|
|
|
// {
|
|
|
|
// return currentAppointment;
|
|
|
|
// }
|
2006-11-15 01:06:21 +01:00
|
|
|
|
2007-02-13 23:01:52 +01:00
|
|
|
- (NSString *) appointmentsClasses
|
2006-11-15 01:06:21 +01:00
|
|
|
{
|
|
|
|
return [NSString stringWithFormat: @"appointments appointmentsFor%dDays",
|
|
|
|
numberOfDays];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) daysViewClasses
|
|
|
|
{
|
2014-06-20 19:16:55 +02:00
|
|
|
NSString *daysView;
|
|
|
|
|
|
|
|
if ([currentView isEqualToString:@"multicolumndayview"])
|
|
|
|
daysView = @"daysView daysViewForMultipleDays";
|
|
|
|
|
|
|
|
else
|
|
|
|
daysView = [NSString stringWithFormat: @"daysView daysViewFor%dDays", numberOfDays];
|
|
|
|
|
|
|
|
return daysView;
|
2006-11-15 01:06:21 +01:00
|
|
|
}
|
2006-08-24 20:56:24 +02:00
|
|
|
|
2015-09-18 22:11:31 +02:00
|
|
|
- (NSString *) daysViewHeaderClasses
|
|
|
|
{
|
|
|
|
return [NSString stringWithFormat: @"%@ daysHeader", [self daysViewClasses]];
|
|
|
|
}
|
|
|
|
|
2006-11-15 01:06:21 +01:00
|
|
|
- (NSString *) dayClasses
|
|
|
|
{
|
|
|
|
NSMutableString *classes;
|
2008-07-18 21:25:26 +02:00
|
|
|
unsigned int currentDayNbr, realDayOfWeek;
|
|
|
|
|
|
|
|
classes = [NSMutableString string];
|
2014-06-20 19:16:55 +02:00
|
|
|
if ([currentView isEqualToString:@"multicolumndayview"])
|
|
|
|
[classes appendFormat:@"day dayColumn"];
|
|
|
|
else {
|
|
|
|
currentDayNbr = [daysToDisplay indexOfObject: currentTableDay];
|
|
|
|
realDayOfWeek = [currentTableDay dayOfWeek];
|
|
|
|
|
|
|
|
[classes appendFormat: @"day day%d", currentDayNbr];
|
|
|
|
|
|
|
|
if (numberOfDays > 1)
|
2006-08-24 20:56:24 +02:00
|
|
|
{
|
2008-07-18 21:25:26 +02:00
|
|
|
if (realDayOfWeek == 0 || realDayOfWeek == 6)
|
2006-11-15 01:06:21 +01:00
|
|
|
[classes appendString: @" weekEndDay"];
|
|
|
|
if ([currentTableDay isToday])
|
|
|
|
[classes appendString: @" dayOfToday"];
|
2006-08-24 20:56:24 +02:00
|
|
|
}
|
2014-06-20 19:16:55 +02:00
|
|
|
}
|
|
|
|
|
2006-11-15 01:06:21 +01:00
|
|
|
return classes;
|
2006-08-24 20:56:24 +02:00
|
|
|
}
|
|
|
|
|
2006-11-15 01:53:59 +01:00
|
|
|
- (NSString *) clickableHourCellClass
|
|
|
|
{
|
2008-07-18 21:25:26 +02:00
|
|
|
NSMutableString *cellClass;
|
|
|
|
int hour;
|
2009-11-29 05:19:32 +01:00
|
|
|
SOGoUserDefaults *ud;
|
2008-07-18 21:25:26 +02:00
|
|
|
|
|
|
|
cellClass = [NSMutableString string];
|
|
|
|
hour = [currentTableHour intValue];
|
2009-11-29 05:19:32 +01:00
|
|
|
ud = [[context activeUser] userDefaults];
|
2008-07-18 21:25:26 +02:00
|
|
|
[cellClass appendFormat: @"clickableHourCell clickableHourCell%d", hour];
|
2009-11-29 05:19:32 +01:00
|
|
|
if (hour < [ud dayStartHour] || hour > [ud dayEndHour] - 1)
|
2008-07-18 21:25:26 +02:00
|
|
|
[cellClass appendString: @" outOfDay"];
|
|
|
|
|
|
|
|
return cellClass;
|
2006-11-15 01:53:59 +01:00
|
|
|
}
|
|
|
|
|
2014-06-20 19:16:55 +02:00
|
|
|
- (BOOL) isMultiColumnView
|
|
|
|
{
|
|
|
|
if ([currentView isEqualToString:@"multicolumndayview"])
|
2014-06-27 23:21:18 +02:00
|
|
|
return YES;
|
2014-06-20 19:16:55 +02:00
|
|
|
|
2014-06-27 23:21:18 +02:00
|
|
|
return NO;
|
2014-06-20 19:16:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) isNotMultiColumnView
|
|
|
|
{
|
|
|
|
if ([currentView isEqualToString:@"dayview"] || [currentView isEqualToString:@"weekview"])
|
2014-06-27 23:21:18 +02:00
|
|
|
return YES;
|
2014-06-20 19:16:55 +02:00
|
|
|
|
2014-06-27 23:21:18 +02:00
|
|
|
return NO;
|
2014-06-20 19:16:55 +02:00
|
|
|
}
|
|
|
|
|
2015-09-18 22:11:31 +02:00
|
|
|
- (BOOL) isWeekView
|
|
|
|
{
|
|
|
|
return [currentView isEqualToString:@"weekview"];
|
|
|
|
}
|
|
|
|
|
2006-08-24 20:56:24 +02:00
|
|
|
@end
|