+2007-06-29 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * SoObjects/SOGo/AgenorUserDefaults.m ([AgenorUserDefaults
+ -generateSQLForInsert]): initialize error to nil before the
+ serialization. Otherwise the method can get confused if it ever is
+ initialized to something else.
+
+ * SoObjects/SOGo/SOGoUserFolder.m ([SOGoUserFolder
+ -folderIsMandatory]): returns NO unconditionnally.
+
+ * SoObjects/Contacts/SOGoContactFolders.m ([SOGoContactFolders
+ -appendPersonalSources]): add the "personal" folder to the list of
+ user folders even if it doesn't exist, so that it is created when
+ the user accesses it.
+
+ * SoObjects/Contacts/SOGoContactGCSFolder.m ([SOGoContactGCSFolder
+ -folderIsMandatory]): returns YES if nameInContainer is set to
+ "personal", which is the default address book.
+
+ * SoObjects/Appointments/SOGoAppointmentFolder.m
+ ([SOGoAppointmentFolder -folderIsMandatory]): returns YES since
+ users must have one Calendar folder (one and only one).
+ ([SOGoAppointmentFolder -_privacySqlString]): unescape the
+ escaping '\' so make the carriage return a real one. This way,
+ PgSQL 8 won't complain about escaping the string.
+
+ * SoObjects/SOGo/SOGoFolder.m ([SOGoFolder -ocsFolder]): new
+ method that create the folder if considered mandatory.
+ ([SOGoFolder -folderIsMandatory]): new method that determines
+ whether the folder should be created automatically or not. To be
+ overriden by subclasses.
+
+ * Main/SOGo.m ([SOGo -run]): override method and create the
+ missing system tables if needed.
+
2007-06-28 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+ * UI/MailerUI/WOContext+UIxMailer.m ([WOContext
+ -mailDateFormatter]): returns the user's date formatter.
+
+ * SoObjects/Mailer/SOGoMailObject.m ([SOGoMailObject -date]):
+ applies the user timezone to the date object before returning it.
+
* UI/Common/UIxSortButton.m: removed useless class module.
* UI/Common/UIxSortableTableHeader.m: removed useless class
ADDITIONAL_INCLUDE_DIRS += \
-I../SoObjects/ \
- -I../..
+ -I..
ADDITIONAL_LIB_DIRS += \
-L../SoObjects/SOGo/$(GNUSTEP_OBJ_DIR)/ \
02111-1307, USA.
*/
-#include <NGObjWeb/SoApplication.h>
+#import <Foundation/NSDebug.h>
+#import <Foundation/NSData.h>
+#import <Foundation/NSProcessInfo.h>
+#import <Foundation/NSRunLoop.h>
+#import <Foundation/NSURL.h>
+#import <Foundation/NSUserDefaults.h>
+
+#import <GDLAccess/EOAdaptorChannel.h>
+#import <GDLContentStore/GCSChannelManager.h>
+
+#import <NGObjWeb/SoApplication.h>
+#import <NGObjWeb/SoClassSecurityInfo.h>
+#import <NGObjWeb/WOContext.h>
+#import <NGObjWeb/WORequest.h>
+
+#import <NGExtensions/NGBundleManager.h>
+#import <NGExtensions/NSNull+misc.h>
+#import <NGExtensions/NSObject+Logs.h>
+#import <NGExtensions/NSProcessInfo+misc.h>
+
+#import <WEExtensions/WEResourceManager.h>
+
+#import <SoObjects/SOGo/SOGoAuthenticator.h>
+#import <SoObjects/SOGo/SOGoUserFolder.h>
+#import <SoObjects/SOGo/SOGoPermissions.h>
+
+#import "SOGoProductLoader.h"
@interface SOGo : SoApplication
{
- NSMutableDictionary *localeLUT;
+ NSMutableDictionary *localeLUT;
}
- (NSDictionary *) currentLocaleConsideringLanguages:(NSArray *)_langs;
@end
-#include "SOGoProductLoader.h"
-#include <WEExtensions/WEResourceManager.h>
-#include <SOGo/SOGoAuthenticator.h>
-#include <SOGo/SOGoUserFolder.h>
-#include <SOGo/SOGoPermissions.h>
-#include "common.h"
-
@implementation SOGo
static unsigned int vMemSizeLimit = 0;
static BOOL doCrashOnSessionCreate = NO;
+static BOOL hasCheckedTables = NO;
#ifdef GNUSTEP_BASE_LIBRARY
static BOOL debugObjectAllocation = NO;
[super dealloc];
}
+- (void) _checkTableWithCM: (GCSChannelManager *) cm
+ tableURL: (NSString *) url
+ andType: (NSString *) tableType
+{
+ NSString *tableName, *descFile;
+ EOAdaptorChannel *tc;
+ NGBundleManager *bm;
+ NSBundle *bundle;
+ unsigned int length;
+
+ bm = [NGBundleManager defaultBundleManager];
+
+ tc = [cm acquireOpenChannelForURL: [NSURL URLWithString: url]];
+
+ tableName = [url lastPathComponent];
+ if ([tc evaluateExpressionX:
+ [NSString stringWithFormat: @"SELECT count(*) FROM %@", tableName]])
+ {
+ bundle = [bm bundleWithName: @"MainUI" type: @"SOGo"];
+ length = [tableType length] - 3;
+ descFile = [bundle pathForResource: [tableType substringToIndex: length]
+ ofType: @"sql"];
+ if (![tc evaluateExpressionX:
+ [NSString stringWithContentsOfFile: descFile]])
+ [self logWithFormat: @"table '%@' successfully created!", tableName];
+ }
+ else
+ NSLog (@"YES");
+
+ [cm releaseChannel: tc];
+
+// [self terminate];
+// NSLog (@"not yet");
+}
+
+- (BOOL) _checkMandatoryTables
+{
+ GCSChannelManager *cm;
+ NSString *urlStrings[] = {@"AgenorProfileURL", @"OCSFolderInfoURL", nil};
+ NSString **urlString;
+ NSString *value;
+ NSUserDefaults *ud;
+ BOOL ok;
+
+ ud = [NSUserDefaults standardUserDefaults];
+ ok = YES;
+ cm = [GCSChannelManager defaultChannelManager];
+
+ urlString = urlStrings;
+ while (ok && *urlString)
+ {
+ value = [ud stringForKey: *urlString];
+ if (value)
+ {
+ [self _checkTableWithCM: cm tableURL: value andType: *urlString];
+ urlString++;
+ }
+ else
+ {
+ NSLog (@"No value specified for '%@'", *urlString);
+ ok = NO;
+ }
+ }
+
+ return ok;
+}
+
+- (void) run
+{
+ if (!hasCheckedTables)
+ {
+ hasCheckedTables = YES;
+ [self _checkMandatoryTables];
+ }
+ [super run];
+}
+
/* authenticator */
- (id) authenticatorInContext: (id) _ctx
}
- (id)lookupUser:(NSString *)_key inContext:(id)_ctx {
- return [[[$(@"SOGoUserFolder") alloc]
- initWithName:_key inContainer:self] autorelease];
+ return [$(@"SOGoUserFolder") objectWithName:_key
+ inContainer: self];
}
- (void) _setupLocaleInContext: (WOContext *) _ctx
+++ /dev/null
-/*
- Copyright (C) 2002-2004 SKYRIX Software AG
-
- This file is part of OpenGroupware.org.
-
- OGo is free software; you can redistribute it and/or modify it under
- the terms of the GNU Lesser General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any
- later version.
-
- OGo 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 Lesser General Public
- License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with OGo; see the file COPYING. If not, write to the
- Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA.
-*/
-
-#import <Foundation/Foundation.h>
-
-#if NeXT_Foundation_LIBRARY || COCOA_Foundation_LIBRARY
-# include <NGExtensions/NGObjectMacros.h>
-# include <NGExtensions/NSString+Ext.h>
-#endif
-
-#include <NGExtensions/NGExtensions.h>
-#include <NGObjWeb/NGObjWeb.h>
-#include <NGObjWeb/SoObjects.h>
-
-#include <GDLAccess/GDLAccess.h>
#import <unistd.h>
-#import <Foundation/NSUserDefaults.h>
+#import <Foundation/NSAutoreleasePool.h>
+#import <Foundation/NSString.h>
#import <Foundation/NSTimeZone.h>
+#import <Foundation/NSUserDefaults.h>
-#import <NGObjWeb/NGObjWeb.h>
-#import "common.h"
+#import <NGObjWeb/SoApplication.h>
int
main (int argc, char **argv, char **env)
pool = [NSAutoreleasePool new];
+ rc = -1;
+
if (getuid() > 0)
{
- rc = 0;
#if LIB_FOUNDATION_LIBRARY
[NSProcessInfo initializeWithArguments: argv count: argc environment: env];
#endif
- [NGBundleManager defaultBundleManager];
-
ud = [NSUserDefaults standardUserDefaults];
+ rc = 0;
tzName = [ud stringForKey: @"SOGoServerTimeZone"];
if (!tzName)
- tzName = @"Canada/Eastern";
- [NSTimeZone setDefaultTimeZone: [NSTimeZone timeZoneWithName: tzName]];
-
+ tzName = @"UTC";
+ [NSTimeZone setDefaultTimeZone:
+ [NSTimeZone timeZoneWithName: tzName]];
WOWatchDogApplicationMain (@"SOGo", argc, (void *) argv);
}
else
- {
- NSLog (@"Don't run SOGo as root!");
- rc = -1;
- }
+ NSLog (@"Don't run SOGo as root!");
[pool release];
+++ /dev/null
-#!/bin/bash
-#
-# Usage: generate-folderinfo-sql-for-users user1 [user2] [user3] [...]
-#
-
-DB_USER="sogo"
-DB_PASS="sogo"
-DB_HOST="192.168.0.4"
-DB_PORT="5432"
-DB_NAME="sogo"
-TIMEZONE="Canada/Eastern"
-
-
-while [ "$1" != "" ]; do
-USER_ID=$1
-USER_TABLE=`echo $USER_ID | tr -s [:punct:] _`
-cat << EOF
---
--- (C) 2004 SKYRIX Software AG
---
--- TODO:
--- add a unique constraints on path
-
-DELETE FROM SOGo_folder_info WHERE c_path2 = '${USER_ID}';
-
-INSERT INTO SOGo_folder_info
- ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername,
- c_location, c_quick_location, c_acl_location, c_folder_type )
-VALUES
- ( '/Users/${USER_ID}',
- 'Users',
- '${USER_ID}',
- NULL,
- NULL,
- '${USER_ID}',
- 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_folder',
- 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_quick',
- 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_acl',
- 'Container' );
-
-INSERT INTO SOGo_folder_info
- ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername,
- c_location, c_quick_location, c_acl_location, c_folder_type )
-VALUES
- ( '/Users/${USER_ID}/Calendar',
- 'Users',
- '${USER_ID}',
- 'Calendar',
- NULL,
- 'Calendar',
- 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_privcal',
- 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_privcal_quick',
- 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_privcal_acl',
- 'Appointment' );
-
-INSERT INTO SOGo_folder_info
- ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername,
- c_location, c_quick_location, c_acl_location, c_folder_type )
-VALUES
- ( '/Users/${USER_ID}/Contacts/personal',
- 'Users',
- '${USER_ID}',
- 'Contacts',
- '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',
- 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_contacts_acl',
- 'Contact' );
-
-DROP TABLE SOGo_${USER_TABLE}_privcal_quick;
-DROP TABLE SOGo_${USER_TABLE}_privcal;
-
-CREATE TABLE SOGo_${USER_TABLE}_privcal_quick (
- c_name VARCHAR(256) NOT NULL PRIMARY KEY, -- the filename
- uid VARCHAR(256) NOT NULL,
- startdate INT NULL,
- enddate INT NULL,
- cycleenddate INT NULL, -- enddate for cyclic events
- title VARCHAR(1000) NOT NULL,
- cycleinfo VARCHAR(1000) NULL, -- property list with cycle infos
- participants VARCHAR(100000) NULL, -- the CNs of the participants
- isallday INT NULL,
- iscycle INT NULL, -- client needs to fetch to resolve
- classification INT NOT NULL,
- status INT NOT NULL,
- priority INT NOT NULL, -- for marking high prio apts
- isopaque INT NULL,
- location VARCHAR(256) NULL,
- orgmail VARCHAR(256) NULL,
- partmails VARCHAR(100000) NULL, -- the emails of the participants
- partstates VARCHAR(256) NOT NULL, -- the status of each participant
- sequence INT NULL, -- the iCal sequence
- component VARCHAR(10) NOT NULL -- the type of component (vevent/vtodo) in the vcalendar
-);
-
-CREATE TABLE SOGo_${USER_TABLE}_privcal (
- c_name VARCHAR(256) NOT NULL PRIMARY KEY, -- the filename
- c_content VARCHAR(100000) NOT NULL, -- the BLOB
- c_creationdate INT NOT NULL, -- creation date
- c_lastmodified INT NOT NULL, -- last modification (UPDATE)
- c_version INT NOT NULL -- version counter
-);
-
-DROP TABLE SOGo_${USER_TABLE}_contacts_quick;
-DROP TABLE SOGo_${USER_TABLE}_contacts;
-
-CREATE TABLE SOGo_${USER_TABLE}_contacts_quick (
- c_name VARCHAR(256) NOT NULL PRIMARY KEY, -- the filename
- givenname VARCHAR(256),
- cn VARCHAR(256),
- sn VARCHAR(256),
- screenname VARCHAR(256),
- l VARCHAR(256),
- mail VARCHAR(256),
- o VARCHAR(256),
- ou VARCHAR(256),
- telephonenumber VARCHAR(256)
-);
-
-CREATE TABLE SOGo_${USER_TABLE}_contacts (
- c_name VARCHAR(256) NOT NULL PRIMARY KEY, -- the filename
- c_content VARCHAR(100000) NOT NULL, -- the BLOB
- c_creationdate INT NOT NULL, -- creation date
- c_lastmodified INT NOT NULL, -- last modification (UPDATE)
- c_version INT NOT NULL -- version counter
-);
-
-DROP TABLE SOGo_${USER_TABLE}_acl;
-DROP TABLE SOGo_${USER_TABLE}_privcal_acl;
-DROP TABLE SOGo_${USER_TABLE}_contacts_acl;
-
-CREATE TABLE SOGo_${USER_TABLE}_acl (
- c_uid VARCHAR(256) NOT NULL,
- c_object VARCHAR(256) NOT NULL,
- c_role VARCHAR(80) NOT NULL
-);
-
-CREATE TABLE SOGo_${USER_TABLE}_privcal_acl (
- c_uid VARCHAR(256) NOT NULL,
- c_object VARCHAR(256) NOT NULL,
- c_role VARCHAR(80) NOT NULL
-);
-
-CREATE TABLE SOGo_${USER_TABLE}_contacts_acl (
- c_uid VARCHAR(256) NOT NULL,
- c_object VARCHAR(256) NOT NULL,
- c_role VARCHAR(80) NOT NULL
-);
-
-DELETE FROM SOGo_user_profile WHERE uid = '${USER_ID}';
-
-INSERT INTO SOGo_user_profile (
- uid,
- defaults,
- settings
-)
-VALUES (
- '${USER_ID}', '{}', '{}'
-);
-
-EOF
-shift
-done
return logger;
}
+- (BOOL) folderIsMandatory
+{
+ return YES;
+}
+
/* selection */
- (NSArray *) calendarUIDs
privacySqlString
= [NSString stringWithFormat:
@"(%@(orgmail = '%@')"
- @" or ((partmails caseInsensitiveLike '%@%%'"
- @" or partmails caseInsensitiveLike '%%\\n%@%%')))",
+ @" or ((partmails caseInsensitiveLike '%@%%'"
+ @" or partmails caseInsensitiveLike '%%\n%@%%')))",
[self _privacyClassificationStringsForUID: login],
email, email, email];
}
-
+
return privacySqlString;
}
[super dealloc];
}
-- (void) appendPersonalSources
+- (void) _fetchPersonalFolders: (NSString *) sql
+ withChannel: (EOAdaptorChannel *) fc
{
+ NSArray *attrs;
+ NSDictionary *row;
SOGoContactGCSFolder *ab;
+ BOOL hasPersonal;
+ NSString *key, *path;
+
+ hasPersonal = NO;
+ [fc evaluateExpressionX: sql];
+ attrs = [fc describeResults: NO];
+ row = [fc fetchAttributes: attrs withZone: NULL];
+ while (row)
+ {
+ ab = [SOGoContactGCSFolder
+ contactFolderWithName: [row objectForKey: @"c_path4"]
+ andDisplayName: [row objectForKey: @"c_foldername"]
+ inContainer: self];
+ key = [row objectForKey: @"c_path4"];
+ hasPersonal = (hasPersonal || [key isEqualToString: @"personal"]);
+ [ab setOCSPath: [NSString stringWithFormat: @"%@/%@",
+ OCSPath, key]];
+ [contactFolders setObject: ab forKey: key];
+ row = [fc fetchAttributes: attrs withZone: NULL];
+ }
+
+ if (!hasPersonal)
+ {
+ ab = [SOGoContactGCSFolder contactFolderWithName: @"personal"
+ andDisplayName: @"Contacts"
+ inContainer: self];
+ path = [NSString stringWithFormat:
+ @"/Users/%@/Contacts/personal",
+ [self ownerInContext: context]];
+ [ab setOCSPath: path];
+ [contactFolders setObject: ab forKey: @"personal"];
+ }
+}
+
+- (void) appendPersonalSources
+{
GCSChannelManager *cm;
EOAdaptorChannel *fc;
NSURL *folderLocation;
NSString *sql;
- NSArray *attrs;
- NSDictionary *row;
cm = [GCSChannelManager defaultChannelManager];
folderLocation
@" WHERE c_path2 = '%@'"
@" AND c_folder_type = 'Contact'"),
[folderLocation gcsTableName], [self ownerInContext: context]];
- [fc evaluateExpressionX: sql];
- attrs = [fc describeResults: NO];
- row = [fc fetchAttributes: attrs withZone: NULL];
- while (row)
- {
- ab = [SOGoContactGCSFolder contactFolderWithName: [row objectForKey: @"c_path4"]
- andDisplayName: [row objectForKey: @"c_foldername"]
- inContainer: self];
- [ab setOCSPath: [NSString stringWithFormat: @"%@/%@",
- OCSPath, [row objectForKey: @"c_path4"]]];
- [contactFolders setObject: ab forKey: [row objectForKey: @"c_path4"]];
- row = [fc fetchAttributes: attrs withZone: NULL];
- }
-
+ [self _fetchPersonalFolders: sql withChannel: fc];
[cm releaseChannel: fc];
// sql = [sql stringByAppendingFormat:@" WHERE %@ = '%@'",
// uidColumnName, [self uid]];
return self;
}
+- (BOOL) folderIsMandatory
+{
+ return [nameInContainer isEqualToString: @"personal"];
+}
+
- (NSString *) displayName
{
return displayName;
*/
#import <Foundation/NSArray.h>
+#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSString.h>
- (NGImap4Envelope *)envelope {
return [[self fetchCoreInfos] valueForKey:@"envelope"];
}
-- (NSString *)subject {
+
+- (NSString *) subject
+{
return [[self envelope] subject];
}
-- (NSCalendarDate *)date {
- return [[self envelope] date];
+
+- (NSCalendarDate *) date
+{
+ NSTimeZone *userTZ;
+ NSCalendarDate *date;
+
+ userTZ = [[context activeUser] timeZone];
+ date = [[self envelope] date];
+ [date setTimeZone: userTZ];
+
+ return date;
}
+
- (NSArray *)fromEnvelopeAddresses {
return [[self envelope] from];
}
@" VALUES ('%@', '%@')"),
[[self tableURL] gcsTableName], uidColumnName, fieldName,
[self uid],
- [serializedDefaults stringByReplacingString:@"'" withString:@"''"]];
+ [serializedDefaults stringByReplacingString: @"'"
+ withString:@"''"]];
#else
NSData *serializedDefaultsData;
NSString *error;
+ error = nil;
serializedDefaultsData
= [NSPropertyListSerialization dataFromPropertyList: values
format: NSPropertyListOpenStepFormat
errorDescription: &error];
if (error)
- sql = nil;
+ {
+ sql = nil;
+ [error release];
+ }
else
{
serializedDefaults = [[NSString alloc] initWithData: serializedDefaultsData
NSData *serializedDefaultsData;
NSString *error;
+ error = nil;
serializedDefaultsData
= [NSPropertyListSerialization dataFromPropertyList: values
format: NSPropertyListOpenStepFormat
errorDescription: &error];
- error = nil;
if (error)
{
sql = nil;
@" WHERE %@ = '%@'"),
[[self tableURL] gcsTableName],
fieldName,
- [serializedDefaults stringByReplacingString:@"'" withString:@"''"],
+ [serializedDefaults stringByReplacingString: @"'"
+ withString: @"''"],
uidColumnName, [self uid]];
[serializedDefaults release];
}
/* ensure fetched data (more or less guaranteed by modified!=0) */
if (![self fetchProfile])
return NO;
-
+
/* store */
if (![self primaryStoreProfile])
{
- (NSString *) outlookFolderClass;
+- (BOOL) folderIsMandatory;
+
- (BOOL) create;
- (NSException *) delete;
if (!folderManager)
{
folderManager = [GCSFolderManager defaultFolderManager];
- [folderManager setFolderNamePrefix: @"SOGo_"];
+ [folderManager setFolderNamePrefix: @"SOGo"];
}
return folderManager;
- (GCSFolder *) ocsFolderForPath: (NSString *) _path
{
- return [[self folderManager] folderAtPath:_path];
+ return [[self folderManager] folderAtPath: _path];
+}
+
+- (BOOL) folderIsMandatory
+{
+ [self subclassResponsibility: _cmd];
+
+ return NO;
}
- (GCSFolder *) ocsFolder
GCSFolder *folder;
if (!ocsFolder)
- ocsFolder = [[self ocsFolderForPath:[self ocsPath]] retain];
+ {
+ ocsFolder = [self ocsFolderForPath: [self ocsPath]];
+ if (!ocsFolder
+ && [self folderIsMandatory]
+ && [self create])
+ ocsFolder = [self ocsFolderForPath: [self ocsPath]];
+ [ocsFolder retain];
+ }
if ([ocsFolder isNotNull])
folder = ocsFolder;
return [[self folderManager] deleteFolderAtPath: ocsPath];
}
-- (NSArray *)fetchContentObjectNames {
+- (NSArray *) fetchContentObjectNames
+{
NSArray *fields, *records;
- fields = [NSArray arrayWithObject:@"c_name"];
+ fields = [NSArray arrayWithObject: @"c_name"];
records = [[self ocsFolder] fetchFields:fields matchingQualifier:nil];
- if (![records isNotNull]) {
- [self errorWithFormat:@"(%s): fetch failed!", __PRETTY_FUNCTION__];
- return nil;
- }
- if ([records isKindOfClass:[NSException class]])
+ if (![records isNotNull])
+ {
+ [self errorWithFormat: @"(%s): fetch failed!", __PRETTY_FUNCTION__];
+ return nil;
+ }
+ if ([records isKindOfClass: [NSException class]])
return records;
- return [records valueForKey:@"c_name"];
+ return [records valueForKey: @"c_name"];
}
- (BOOL) nameExistsInFolder: (NSString *) objectName
&& [records count] > 0);
}
-- (NSDictionary *)fetchContentStringsAndNamesOfAllObjects {
+- (NSDictionary *) fetchContentStringsAndNamesOfAllObjects
+{
NSDictionary *files;
files = [[self ocsFolder] fetchContentsOfAllFiles];
- if (![files isNotNull]) {
- [self errorWithFormat:@"(%s): fetch failed!", __PRETTY_FUNCTION__];
- return nil;
- }
+ if (![files isNotNull])
+ {
+ [self errorWithFormat:@"(%s): fetch failed!", __PRETTY_FUNCTION__];
+ return nil;
+ }
if ([files isKindOfClass:[NSException class]])
return files;
return files;
/* reflection */
-- (NSString *)defaultFilenameExtension {
+- (NSString *) defaultFilenameExtension
+{
/*
Override to add an extension to a filename
return @"httpd/unix-directory";
}
-- (NSArray *) toOneRelationshipKeys {
+- (NSArray *) toOneRelationshipKeys
+{
/* toOneRelationshipKeys are the 'files' contained in a folder */
NSMutableArray *ma;
NSArray *names;
- (NSString *) ocsPath
{
- return [@"/Users/" stringByAppendingString: [self login]];
+ return [NSString stringWithFormat: @"/Users/%@", nameInContainer];
}
- (NSString *) ocsUserPath
return [self ocsPath];
}
+- (BOOL) folderIsMandatory
+{
+ return NO;
+}
+
- (NSString *) ocsPrivateCalendarPath
{
return [[self ocsUserPath] stringByAppendingString:@"/Calendar"];
obj = [super lookupName: _key inContext: _ctx acquire: NO];
if (!obj)
{
- if ([_key hasPrefix: @"Calendar"])
- {
- obj = [self privateCalendar: @"Calendar" inContext: _ctx];
- if (![_key isEqualToString: @"Calendar"])
- obj = [obj lookupName: [_key pathExtension]
- inContext: _ctx acquire: NO];
- }
+ if ([_key isEqualToString: @"Calendar"])
+ obj = [self privateCalendar: @"Calendar" inContext: _ctx];
+// if (![_key isEqualToString: @"Calendar"])
+// obj = [obj lookupName: [_key pathExtension]
+// inContext: _ctx acquire: NO];
else if ([_key isEqualToString: @"Contacts"])
obj = [self privateContacts: _key inContext: _ctx];
// else if ([_key isEqualToString: @"Groups"])
02111-1307, USA.
*/
-#include "WOContext+UIxMailer.h"
-#include "UIxMailFormatter.h"
-#include "common.h"
-#include <SoObjects/SOGo/SOGoUser.h>
+#import <SoObjects/SOGo/SOGoDateFormatter.h>
+#import <SoObjects/SOGo/SOGoUser.h>
+
+#import "UIxMailFormatter.h"
+#import "common.h"
+
+#import "WOContext+UIxMailer.h"
@implementation WOContext(UIxMailer)
// TODO: make configurable
// TODO: cache!
-- (NSFormatter *)mailSubjectFormatter {
+- (NSFormatter *) mailSubjectFormatter
+{
return [[[UIxSubjectFormatter alloc] init] autorelease];
}
-- (NSFormatter *)mailDateFormatter
+- (NSFormatter *) mailDateFormatter
{
- NSTimeZone *userTZ;
- NSString *userTZString;
- id userPrefs;
- static id dateFormatter = nil;
-
- if (!dateFormatter)
- {
- dateFormatter = [UIxMailDateFormatter new];
- userPrefs = [[self activeUser] userDefaults];
- userTZString = [userPrefs stringForKey: @"timezonename"];
- if ([userTZString length] > 0)
- {
- userTZ = [NSTimeZone timeZoneWithName: userTZString];
- [dateFormatter setTimeZone: userTZ];
- }
- }
-
- return dateFormatter;
+ return [[self activeUser] dateFormatterInContext: self];
}
-- (NSFormatter *)mailEnvelopeAddressFormatter {
+- (NSFormatter *) mailEnvelopeAddressFormatter
+{
return [[[UIxEnvelopeAddressFormatter alloc] init] autorelease];
}
-- (NSFormatter *)mailEnvelopeFullAddressFormatter {
+
+- (NSFormatter *) mailEnvelopeFullAddressFormatter
+{
return [[[UIxEnvelopeAddressFormatter alloc]
initWithMaxLength:256 generateFullEMail:YES] autorelease];
}
--
--- (C) 2005 SKYRIX Software AG
+-- (C) 2004-2005 SKYRIX Software AG
+-- (C) 2006-2007 Inverse groupe conseil
--
CREATE TABLE SOGo_user_profile (
MainUI_RESOURCE_FILES += \
Version \
- product.plist
+ product.plist \
+ OCSFolderInfo.sql \
+ AgenorProfile.sql
MainUI_LOCALIZED_RESOURCE_FILES += \
Locale Localizable.strings
--
-- (C) 2004-2005 SKYRIX Software AG
+-- (C) 2006-2007 Inverse groupe conseil
--
--- TODO:
--- add a unique constraints on path
-
-DROP SEQUENCE SOGo_folder_info_seq;
-
-CREATE SEQUENCE SOGo_folder_info_seq;
-
-DROP TABLE SOGo_folder_info;
CREATE TABLE SOGo_folder_info (
- c_folder_id INTEGER
- DEFAULT nextval('SOGo_folder_info_seq')
- NOT NULL
- PRIMARY KEY, -- the primary key
+ c_folder_id SERIAL,
c_path VARCHAR(255) NOT NULL, -- the full path to the folder
c_path1 VARCHAR(255) NOT NULL, -- parts (for fast queries)
c_path2 VARCHAR(255) NULL, -- parts (for fast queries)
c_foldername VARCHAR(255) NOT NULL, -- last path component
c_location VARCHAR(2048) NOT NULL, -- URL to folder
c_quick_location VARCHAR(2048) NULL, -- URL to quicktable of folder
- c_acl_location VARCHAR(2048) NULL, -- URL to quicktable of folder
+ c_acl_location VARCHAR(2048) NULL, -- URL to quicktable of folder
c_folder_type VARCHAR(255) NOT NULL -- the folder type ...
);
"Search appointments" = "Recherche de rendez-vous";
"Search in Anais" = "Recherche par Anaïs";
-"All day Event" = "Événement sur la journéee";
+"All day Event" = "Événement sur la journée";
"check for conflicts" = "Vérifier les conflits";
"Browse URL" = "Visiter l'URL";
</td>
</tr>
<tr class="mailer_fieldrow">
- <td class="mailer_fieldname" ><var:string label:value="Date"/>:</td>
+ <td class="mailer_fieldname"><var:string label:value="Date"/>:</td>
<td class="mailer_fieldvalue">
<var:string value="clientObject.date"
formatter="context.mailDateFormatter"/>
var showCompletedTasks = 0;
var currentDay = '';
-var currentView = "dayview";
+var currentView = "weekview";
var cachedDateSelectors = new Array();