From ad4fba45dcfb2fd735b4cf85248c42d50d3badd5 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 31 Oct 2006 18:38:53 +0000 Subject: [PATCH] OGoContentStore/sql/generate-folderinfo-sql-for-users.sh Monotone-Parent: b7b94acee3398cb1537097806f5a80f257f2a43a Monotone-Revision: 2d120d90819b42e21a50956a14c0c5d130cfdf09 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-10-31T18:38:53 Monotone-Branch: ca.inverse.sogo --- Main/SOGo.m | 1 - .../sql/generate-folderinfo-sql-for-users.sh | 4 +- SoObjects/Appointments/GNUmakefile | 1 + .../Appointments/SOGoAppointmentObject.m | 32 ++++ SoObjects/SOGo/SOGoAuthenticator.m | 1 + UI/Scheduler/UIxCalMonthView.h | 32 ++++ UI/Scheduler/UIxCalMonthView.m | 177 ++++++++++++++++-- UI/Templates/SchedulerUI/UIxCalMonthView.wox | 115 +++++------- 8 files changed, 275 insertions(+), 88 deletions(-) diff --git a/Main/SOGo.m b/Main/SOGo.m index 1e361bc7d..c4adbc410 100644 --- a/Main/SOGo.m +++ b/Main/SOGo.m @@ -124,7 +124,6 @@ static BOOL doCrashOnSessionCreate = NO; } - (id)lookupUser:(NSString *)_key inContext:(id)_ctx { - NSLog (@"lookupUser: %@", _key); return [[[NSClassFromString(@"SOGoUserFolder") alloc] initWithName:_key inContainer:self] autorelease]; diff --git a/OGoContentStore/sql/generate-folderinfo-sql-for-users.sh b/OGoContentStore/sql/generate-folderinfo-sql-for-users.sh index ff659da4c..e059ff06e 100755 --- a/OGoContentStore/sql/generate-folderinfo-sql-for-users.sh +++ b/OGoContentStore/sql/generate-folderinfo-sql-for-users.sh @@ -54,11 +54,11 @@ INSERT INTO SOGo_folder_info ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, c_location, c_quick_location, c_folder_type ) VALUES - ( '/Users/${USER_ID}/Contacts', + ( '/Users/${USER_ID}/Contacts/personal', 'Users', '${USER_ID}', 'Contacts', - NULL, + 'personal', 'Contacts', 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_contacts', 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_contacts_quick', diff --git a/SoObjects/Appointments/GNUmakefile b/SoObjects/Appointments/GNUmakefile index a4b3ccaa7..c69e92686 100644 --- a/SoObjects/Appointments/GNUmakefile +++ b/SoObjects/Appointments/GNUmakefile @@ -11,6 +11,7 @@ Appointments_PRINCIPAL_CLASS = SOGoAppointmentsProduct Appointments_OBJC_FILES = \ Product.m \ NSArray+Appointments.m \ + iCalEntityObject+Agenor.m \ \ SOGoAppointmentObject.m \ SOGoTaskObject.m \ diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index b94239206..4de627a55 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -29,7 +29,10 @@ #import #import #import + #import "SOGoAptMailNotification.h" +#import "iCalEntityObject+Agenor.h" + #import "common.h" #import "NSArray+Appointments.h" @@ -507,6 +510,7 @@ static NSString *mailTemplateDefaultLanguage = nil; - (NSException *)saveContentString:(NSString *)_iCalString { return [self saveContentString:_iCalString baseSequence:0]; } + - (NSException *)delete { return [self deleteWithBaseSequence:0]; } @@ -610,6 +614,34 @@ static NSString *mailTemplateDefaultLanguage = nil; return [self serverTimeZone]; } +- (NSException *) saveContentString: (NSString *) contentString + baseVersion: (unsigned int) baseVersion +{ + NSString *newContentString, *oldContentString; + iCalCalendar *eventCalendar; + iCalEvent *event; + NSArray *organizers; + + oldContentString = [self iCalString]; + if (oldContentString) + newContentString = contentString; + else + { + eventCalendar = [iCalCalendar parseSingleFromSource: contentString]; + event = [self firstEventFromCalendar: eventCalendar]; + organizers = [event childrenWithTag: @"organizer"]; + if ([organizers count]) + newContentString = contentString; + else + { + [event setOrganizerWithUid: [self ownerInContext: nil]]; + newContentString = [eventCalendar versitString]; + } + } + + return [super saveContentString: newContentString + baseVersion: baseVersion]; +} - (void)sendEMailUsingTemplateNamed:(NSString *)_pageName forOldAppointment:(iCalEvent *)_oldApt diff --git a/SoObjects/SOGo/SOGoAuthenticator.m b/SoObjects/SOGo/SOGoAuthenticator.m index 1c2d9073d..984da8e47 100644 --- a/SoObjects/SOGo/SOGoAuthenticator.m +++ b/SoObjects/SOGo/SOGoAuthenticator.m @@ -73,6 +73,7 @@ static SOGoAuthenticator *auth = nil; { BOOL result; + return YES; if ([authMethod isEqualToString: @"LDAP"]) result = [self LDAPCheckLogin: _login password: _pwd]; else diff --git a/UI/Scheduler/UIxCalMonthView.h b/UI/Scheduler/UIxCalMonthView.h index 079f33274..992f89079 100644 --- a/UI/Scheduler/UIxCalMonthView.h +++ b/UI/Scheduler/UIxCalMonthView.h @@ -13,6 +13,10 @@ @interface UIxCalMonthView : UIxCalView { + int dayIndex; + int dayOfWeek; + int weekOfYear; + NSCalendarDate *currentWeekStart; } - (NSCalendarDate *)startOfMonth; @@ -20,6 +24,34 @@ - (NSDictionary *)prevMonthQueryParameters; - (NSDictionary *)nextMonthQueryParameters; +- (void)setDayIndex:(int)_idx; +- (int)dayIndex; +- (void)setDayOfWeek:(int)_day; +- (int)dayOfWeek; + +- (void)setCurrentWeekStartDate:(NSCalendarDate *)_date; +- (NSCalendarDate *)currentWeekStartDate; +- (void)setWeekOfYear:(int)_week; +- (int)weekOfYear; +- (int)year; +- (int)month; +- (NSString *)localizedDayOfWeekName; +- (NSDictionary *)currentWeekQueryParameters; + + +/* style sheet */ + + +- (NSString *)weekStyle; + +- (NSString *)contentStyle; + + +/* appointments */ + + +- (NSArray *)appointments; + @end #endif /* __SOGo_UIxCalMonthView_H__ */ diff --git a/UI/Scheduler/UIxCalMonthView.m b/UI/Scheduler/UIxCalMonthView.m index e89d48fc7..316710362 100644 --- a/UI/Scheduler/UIxCalMonthView.m +++ b/UI/Scheduler/UIxCalMonthView.m @@ -1,13 +1,28 @@ // $Id: UIxCalMonthView.m 191 2004-08-12 16:28:32Z helge $ -#include "UIxCalMonthView.h" -#include "NSCalendarDate+UIx.h" -#include "common.h" +#import +#import +#import +#import + +#import +#import + +#import + +#import + +#import "UIxCalMonthView.h" @implementation UIxCalMonthView +- (void)dealloc { + [self->currentWeekStart release]; + [super dealloc]; +} + - (NSCalendarDate *)startOfMonth { - return [[[super startDate] firstDayOfMonth] beginOfDay]; + return [[[self selectedDate] firstDayOfMonth] beginOfDay]; } - (NSCalendarDate *)startDate { @@ -26,20 +41,158 @@ /* URLs */ -- (NSDictionary *)prevMonthQueryParameters { +- (NSDictionary *) _monthQueryParametersWithOffset: (int) monthsOffset +{ NSCalendarDate *date; - - date = [[self startOfMonth] dateByAddingYears:0 months:-1 days:0 - hours:0 minutes:0 seconds:0]; + + date = [[self startOfMonth] dateByAddingYears: 0 months: monthsOffset days: 0 + hours:0 minutes:0 seconds:0]; return [self queryParametersBySettingSelectedDate:date]; } -- (NSDictionary *)nextMonthQueryParameters { +- (NSDictionary *) monthBeforePrevMonthQueryParameters +{ + return [self _monthQueryParametersWithOffset: -14]; +} + +- (NSDictionary *) prevMonthQueryParameters +{ + return [self _monthQueryParametersWithOffset: -7]; +} + +- (NSDictionary *) nextMonthQueryParameters +{ + return [self _monthQueryParametersWithOffset: 7]; +} + +- (NSDictionary *) monthAfterNextMonthQueryParameters +{ + return [self _monthQueryParametersWithOffset: 14]; +} + +- (NSString *) _monthNameWithOffsetFromThisMonth: (int) offset +{ NSCalendarDate *date; + + date = [[self startOfMonth] dateByAddingYears: 0 months: offset days: 0 + hours:0 minutes:0 seconds:0]; + + return [self localizedNameForMonthOfYear: [date monthOfYear]]; +} + +- (NSString *) monthBeforeLastMonthName +{ + return [self _monthNameWithOffsetFromThisMonth: -2]; +} + +- (NSString *) lastMonthName +{ + return [self _monthNameWithOffsetFromThisMonth: -1]; +} + +- (NSString *) currentMonthName +{ + return [self _monthNameWithOffsetFromThisMonth: 0]; +} + +- (NSString *) nextMonthName +{ + return [self _monthNameWithOffsetFromThisMonth: 1]; +} + +- (NSString *) monthAfterNextMonthName +{ + return [self _monthNameWithOffsetFromThisMonth: 2]; +} + +- (void)configureFormatters { + [super configureFormatters]; + + [self->aptFormatter setShortTitleOnly]; + [self->privateAptFormatter setPrivateTitleOnly]; +} + +- (void)setDayIndex:(int)_idx { + self->dayIndex = _idx; +} + +- (int)dayIndex { + return self->dayIndex; +} + +- (void)setDayOfWeek:(int)_day { + self->dayOfWeek = _day; +} + +- (int)dayOfWeek { + return self->dayOfWeek; +} + +- (void)setCurrentWeekStartDate:(NSCalendarDate *)_date { + ASSIGN(self->currentWeekStart, _date); +} + +- (NSCalendarDate *)currentWeekStartDate { + return self->currentWeekStart; +} + +- (void)setWeekOfYear:(int)_week { + NSCalendarDate *date; - date = [[self startOfMonth] dateByAddingYears:0 months:1 days:0 - hours:0 minutes:0 seconds:0]; - return [self queryParametersBySettingSelectedDate:date]; + self->weekOfYear = _week; + if(_week == 52 || _week == 53) + date = [[self startOfMonth] mondayOfWeek]; + else + date = [self startOfMonth]; + date = [date mondayOfWeek:_week]; + [self setCurrentWeekStartDate:date]; +} + +- (int)weekOfYear { + return self->weekOfYear; +} + +- (int)year { + return [[self startOfMonth] yearOfCommonEra]; +} + +- (int)month { + return [[self startOfMonth] monthOfYear]; +} + +- (NSString *)localizedDayOfWeekName { + return [self localizedNameForDayOfWeek:self->dayOfWeek]; +} + +- (NSDictionary *)currentWeekQueryParameters { + return [self queryParametersBySettingSelectedDate:self->currentWeekStart]; +} + + +/* style sheet */ + + +- (NSString *)weekStyle { + if([self->currentWeekStart isDateInSameWeek:[NSCalendarDate date]]) + return @"monthoverview_week_hilite"; + return @"monthoverview_week"; +} + +- (NSString *)contentStyle { + if([self->currentDay isToday]) + return @"monthoverview_content_hilite"; + else if([self->currentDay monthOfYear] != [[self startOfMonth] monthOfYear]) + return @"monthoverview_content_dimmed"; + return @"monthoverview_content"; +} + + +/* appointments */ + + +- (NSArray *)appointments { + return [self fetchCoreAppointmentsInfos]; } @end /* UIxCalMonthView */ + diff --git a/UI/Templates/SchedulerUI/UIxCalMonthView.wox b/UI/Templates/SchedulerUI/UIxCalMonthView.wox index b23a6f9ca..a32c3f5b0 100644 --- a/UI/Templates/SchedulerUI/UIxCalMonthView.wox +++ b/UI/Templates/SchedulerUI/UIxCalMonthView.wox @@ -1,80 +1,49 @@ - - - - - - - - -
-
-
- - - - - - - - - - - - - - -
-
-
+ + + + + + +
+ +