From 1f21b1830188b2cb2e455bc67ab3e052d8a7fe54 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Fri, 7 Dec 2007 22:42:55 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1295 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 14 +++++ Main/SOGo.m | 60 +++++++++++++------ UI/Contacts/English.lproj/Localizable.strings | 2 +- UI/Contacts/French.lproj/Localizable.strings | 4 +- UI/MailPartViewers/UIxMailRenderingContext.m | 2 +- UI/MainUI/AgenorProfile-oracle.sql | 2 +- UI/MainUI/AgenorProfile.sql | 2 +- UI/MainUI/OCSFolderInfo-oracle.sql | 10 ++-- UI/MainUI/OCSFolderInfo.sql | 2 +- UI/Scheduler/UIxComponentEditor.m | 30 ++++++---- 10 files changed, 88 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7094a392..9d9c6ca6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2007-12-07 Wolfgang Sourdeau + + * Main/SOGo.m ([SOGo -run]): the table creation script now have a + @{tableName} substitution variable to be substitued with the real + table name obtained from the configuration variables. + +2007-12-07 Ludovic Marcotte + + * UI/MailPartViewers/UIxMailRenderingContext.m + We treat multipart/appledouble like multipart/mixed + for now. That allows the user to save both parts. + + * Corrected typos in Localizable.string files. + 2007-12-06 Wolfgang Sourdeau * UI/Common/UIxAclEditor.m ([-currentUserIsOwner]): replaced diff --git a/Main/SOGo.m b/Main/SOGo.m index 6bdb86e3..ac530d56 100644 --- a/Main/SOGo.m +++ b/Main/SOGo.m @@ -151,38 +151,62 @@ static BOOL debugObjectAllocation = NO; [super dealloc]; } -- (void) _checkTableWithCM: (GCSChannelManager *) cm - tableURL: (NSString *) url - andType: (NSString *) tableType +- (NSString *) _sqlScriptFromTableFile: (NSString *) fileName + withTableName: (NSString *) tableName { - NSString *tableName, *descFile, *tableFile, *fileSuffix; - EOAdaptorChannel *tc; + NSString *script; + + + return script; +} + +- (NSString *) _sqlScriptForTable: (NSString *) tableName + withType: (NSString *) tableType + andFileSuffix: (NSString *) fileSuffix +{ + NSString *tableFile, *descFile; NGBundleManager *bm; NSBundle *bundle; unsigned int length; - NSURL *channelURL; bm = [NGBundleManager defaultBundleManager]; + bundle = [bm bundleWithName: @"MainUI" type: @"SOGo"]; + length = [tableType length] - 3; + tableFile = [tableType substringToIndex: length]; + descFile + = [bundle pathForResource: [NSString stringWithFormat: @"%@-%@", + tableFile, fileSuffix] + ofType: @"sql"]; + if (!descFile) + descFile = [bundle pathForResource: tableFile ofType: @"sql"]; + + return [[NSString stringWithContentsOfFile: descFile] + stringByReplacingString: @"@{tableName}" + withString: tableName]; +} + +- (void) _checkTableWithCM: (GCSChannelManager *) cm + tableURL: (NSString *) url + andType: (NSString *) tableType +{ + NSString *tableName, *fileSuffix, *tableScript; + EOAdaptorChannel *tc; + NSURL *channelURL; + channelURL = [NSURL URLWithString: url]; fileSuffix = [channelURL scheme]; tc = [cm acquireOpenChannelForURL: channelURL]; tableName = [url lastPathComponent]; if ([tc evaluateExpressionX: - [NSString stringWithFormat: @"SELECT count(*) FROM %@", tableName]]) + [NSString stringWithFormat: @"SELECT count(*) FROM %@", + tableName]]) { - bundle = [bm bundleWithName: @"MainUI" type: @"SOGo"]; - length = [tableType length] - 3; - tableFile = [tableType substringToIndex: length]; - descFile - = [bundle pathForResource: [NSString stringWithFormat: @"%@-%@", - tableFile, fileSuffix] - ofType: @"sql"]; - if (!descFile) - descFile = [bundle pathForResource: tableFile ofType: @"sql"]; - if (![tc evaluateExpressionX: - [NSString stringWithContentsOfFile: descFile]]) + tableScript = [self _sqlScriptForTable: tableName + withType: tableType + andFileSuffix: fileSuffix]; + if (![tc evaluateExpressionX: tableScript]) [self logWithFormat: @"table '%@' successfully created!", tableName]; } else diff --git a/UI/Contacts/English.lproj/Localizable.strings b/UI/Contacts/English.lproj/Localizable.strings index 9d17ab3e..6762a87f 100644 --- a/UI/Contacts/English.lproj/Localizable.strings +++ b/UI/Contacts/English.lproj/Localizable.strings @@ -29,7 +29,7 @@ "Unit" = "Unit"; "delete" = "delete"; "edit" = "edit"; -"invalidemailwarn" = "invalidemailwarn"; +"invalidemailwarn" = "The specified email is invalid"; "new" = "new"; "Preferred Phone" = "Preferred Phone"; diff --git a/UI/Contacts/French.lproj/Localizable.strings b/UI/Contacts/French.lproj/Localizable.strings index 4854e485..973321b4 100644 --- a/UI/Contacts/French.lproj/Localizable.strings +++ b/UI/Contacts/French.lproj/Localizable.strings @@ -1,4 +1,4 @@ -/* this file is in UTF-8 format! */ +e/* this file is in UTF-8 format! */ "Contact" = "Contact"; "Address" = "Adresses"; @@ -36,7 +36,7 @@ "Unit" = "Département"; "delete" = "Effacer"; "edit" = "Éditer"; -"invalidemailwarn" = "Champ de l'email invalide, continuer quand même ?"; +"invalidemailwarn" = "Le champ de l'adresse électronique est invalide"; "new" = "Nouveau"; "Preferred Phone" = "Numéro préféré"; diff --git a/UI/MailPartViewers/UIxMailRenderingContext.m b/UI/MailPartViewers/UIxMailRenderingContext.m index a82097f6..0ed6f0bb 100644 --- a/UI/MailPartViewers/UIxMailRenderingContext.m +++ b/UI/MailPartViewers/UIxMailRenderingContext.m @@ -258,7 +258,7 @@ static BOOL showNamedTextAttachmentsInline = NO; if ([mt isEqualToString:@"multipart"]) { - if ([st isEqualToString:@"mixed"] || [st isEqualToString:@"related"]) + if ([st isEqualToString:@"mixed"] || [st isEqualToString:@"related"] || [st isEqualToString: @"appledouble"]) return [self mixedViewer]; else if ([st isEqualToString:@"signed"]) return [self signedViewer]; diff --git a/UI/MainUI/AgenorProfile-oracle.sql b/UI/MainUI/AgenorProfile-oracle.sql index 240af39e..c3371e55 100644 --- a/UI/MainUI/AgenorProfile-oracle.sql +++ b/UI/MainUI/AgenorProfile-oracle.sql @@ -2,7 +2,7 @@ -- (C) 2007 Inverse groupe conseil -- -CREATE TABLE SOGo_user_profile ( +CREATE TABLE @{tableName} ( c_uid VARCHAR(255) NOT NULL PRIMARY KEY, c_defaults CLOB, c_settings CLOB diff --git a/UI/MainUI/AgenorProfile.sql b/UI/MainUI/AgenorProfile.sql index 1849425b..f8f0adc8 100644 --- a/UI/MainUI/AgenorProfile.sql +++ b/UI/MainUI/AgenorProfile.sql @@ -3,7 +3,7 @@ -- (C) 2006-2007 Inverse groupe conseil -- -CREATE TABLE SOGo_user_profile ( +CREATE TABLE @{tableName} ( c_uid VARCHAR(255) NOT NULL PRIMARY KEY, c_defaults TEXT, c_settings TEXT diff --git a/UI/MainUI/OCSFolderInfo-oracle.sql b/UI/MainUI/OCSFolderInfo-oracle.sql index c019e486..3167282b 100644 --- a/UI/MainUI/OCSFolderInfo-oracle.sql +++ b/UI/MainUI/OCSFolderInfo-oracle.sql @@ -2,7 +2,7 @@ -- (C) 2007 Inverse groupe conseil -- -CREATE TABLE SOGo_folder_info ( +CREATE TABLE @{tableName} ( c_folder_id INTEGER PRIMARY KEY, c_path VARCHAR(255) NOT NULL, -- the full path to the folder c_path1 VARCHAR(255) NOT NULL, -- parts (for fast queries) @@ -16,12 +16,12 @@ CREATE TABLE SOGo_folder_info ( c_folder_type VARCHAR(255) NOT NULL -- the folder type ... ); -CREATE SEQUENCE SOGo_folder_info_seq; -CREATE OR REPLACE TRIGGER SOGo_folder_info_autonumber -BEFORE INSERT ON SOGo_folder_info FOR EACH ROW +CREATE SEQUENCE @{tableName}_seq; +CREATE OR REPLACE TRIGGER @{tableName}_autonumber +BEFORE INSERT ON @{tableName} FOR EACH ROW BEGIN IF :new.c_folder_id IS NULL THEN - SELECT SOGO_folder_info_seq.nextval INTO :new.c_folder_id FROM DUAL; + SELECT @{tableName}_seq.nextval INTO :new.c_folder_id FROM DUAL; END IF; END; / diff --git a/UI/MainUI/OCSFolderInfo.sql b/UI/MainUI/OCSFolderInfo.sql index f9fcde20..548b71a1 100644 --- a/UI/MainUI/OCSFolderInfo.sql +++ b/UI/MainUI/OCSFolderInfo.sql @@ -3,7 +3,7 @@ -- (C) 2006-2007 Inverse groupe conseil -- -CREATE TABLE SOGo_folder_info ( +CREATE TABLE @{tableName} ( 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) diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 6af7d172..7384965f 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -264,6 +264,7 @@ SOGoCalendarComponent *co; SOGoUser *currentUser; BOOL hasOrganizer; + SoSecurityManager *sm; co = [self clientObject]; owner = [co ownerInContext: context]; @@ -271,8 +272,13 @@ hasOrganizer = ([[organizer value: 0] length] > 0); + sm = [SoSecurityManager sharedSecurityManager]; + return ([co isNew] - || ([owner isEqualToString: [currentUser login]] + || (([owner isEqualToString: [currentUser login]] + || ![sm validatePermission: SOGoCalendarPerm_ModifyComponent + onObject: co + inContext: context]) && (!hasOrganizer || [component userIsOrganizer: currentUser]))); } @@ -934,26 +940,30 @@ { NSString *organizerEmail; NSString *owner, *login; + BOOL isOwner, hasOrganizer, hasAttendees; + owner = [[self clientObject] ownerInContext: context]; + login = [[context activeUser] login]; + isOwner = [owner isEqualToString: login]; + hasAttendees = ([[component attendees] count] > 0); organizerEmail = [[component organizer] email]; - if ([organizerEmail length] == 0) + hasOrganizer = ([organizerEmail length] > 0); + + if (hasOrganizer) { - owner = [[self clientObject] ownerInContext: context]; - login = [[context activeUser] login]; - if (![owner isEqualToString: login] - || [[component attendees] count] > 0) + if (isOwner && !hasAttendees) { ASSIGN (organizer, [iCalPerson elementWithTag: @"organizer"]); - [organizer setCn: [organizerIdentity objectForKey: @"fullName"]]; - [organizer setEmail: [organizerIdentity objectForKey: @"email"]]; [component setOrganizer: organizer]; } } else { - if ([[component attendees] count] == 0) + if (!isOwner || hasAttendees) { ASSIGN (organizer, [iCalPerson elementWithTag: @"organizer"]); + [organizer setCn: [organizerIdentity objectForKey: @"fullName"]]; + [organizer setEmail: [organizerIdentity objectForKey: @"email"]]; [component setOrganizer: organizer]; } } @@ -1039,7 +1049,7 @@ if ([component userIsOrganizer: currentUser]) toolbarFilename = @"SOGoComponentClose.toolbar"; else - { + { if ([component userIsOrganizer: ownerUser] && ![sm validatePermission: SOGoCalendarPerm_ModifyComponent onObject: clientObject -- 2.39.5