From 4b4a31796bb91a6abb59ed0ab948ecfe533c8e88 Mon Sep 17 00:00:00 2001 From: C Robert Date: Thu, 20 Aug 2009 13:02:51 +0000 Subject: [PATCH] Mantis 2040: Calendar - Creation d'un calendrier avec un nom existant Monotone-Parent: 92b5fc52a3736b8120b0011dacbf4f2aa73c71f9 Monotone-Revision: 7f0d410fd526f1879ea158593030d6d7b46be292 Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-08-20T13:02:51 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 7 +++++ SoObjects/SOGo/SOGoParentFolder.m | 21 ++++++++++++++ .../Localizable.strings | 3 +- UI/Common/Czech.lproj/Localizable.strings | 3 +- UI/Common/Dutch.lproj/Localizable.strings | 3 +- UI/Common/English.lproj/Localizable.strings | 3 +- UI/Common/French.lproj/Localizable.strings | 3 +- UI/Common/German.lproj/Localizable.strings | 3 +- UI/Common/Hungarian.lproj/Localizable.strings | 3 +- UI/Common/Italian.lproj/Localizable.strings | 3 +- UI/Common/Russian.lproj/Localizable.strings | 3 +- UI/Common/Spanish.lproj/Localizable.strings | 3 +- UI/Common/UIxParentFolderActions.m | 28 +++++++++++-------- UI/Common/Welsh.lproj/Localizable.strings | 3 +- UI/WebServerResources/generic.js | 3 ++ 15 files changed, 70 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index b53392105..f87a4233e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-08-20 Cyril Robert + + * UI/Common/UIxParentFolderActions.m (createFolderAction): Mantis 2040: + return a 409 code when a folder with the same name exists. + * SoObjects/SOGo/SOGoParentFolder.m (hasLocalSubFolderNamed): Added for + Mantis 2040. + 2009-08-19 Cyril Robert * UI/MainUI/SOGoUserHomePage.m (defaultAction): Added support for SOGoUIxDefaultModule diff --git a/SoObjects/SOGo/SOGoParentFolder.m b/SoObjects/SOGo/SOGoParentFolder.m index a0e715a52..4ec82951b 100644 --- a/SoObjects/SOGo/SOGoParentFolder.m +++ b/SoObjects/SOGo/SOGoParentFolder.m @@ -448,6 +448,27 @@ static SoSecurityManager *sm = nil; return [ma sortedArrayUsingSelector: @selector (compare:)]; } +- (BOOL) hasLocalSubFolderNamed: (NSString *) name +{ + NSArray *subs; + NSException *error; + int i, count; + BOOL rc = NO; + + error = [self initSubFolders]; + if (error) + [error raise]; + + subs = [subFolders allValues]; + count = [subs count]; + + for (i = 0; i < count; i++) + if ([name isEqualToString: [[subs objectAtIndex: i] displayName]]) + rc = YES; + + return rc; +} + - (NSArray *) toManyRelationshipKeys { NSEnumerator *sortedSubFolders; diff --git a/UI/Common/BrazilianPortuguese.lproj/Localizable.strings b/UI/Common/BrazilianPortuguese.lproj/Localizable.strings index 71fbd7614..25bbfaa3c 100644 --- a/UI/Common/BrazilianPortuguese.lproj/Localizable.strings +++ b/UI/Common/BrazilianPortuguese.lproj/Localizable.strings @@ -43,6 +43,7 @@ = "Você já se inscreveu nesta pasta!"; "The user rights cannot be edited for this object!" = "Os direitos do usuário não podem ser editados para este objeto!"; +"A folder by that name already exists." = "A folder by that name already exists."; "You are not allowed to access this module or this system. Please contact your system administrator." = "Você não está liberado para acessar este módulo ou este sistema. Por favor, contate seu administrador de sistemas."; @@ -53,4 +54,4 @@ "Reminder:" = "Lembrete:"; "Start:" = "Inicio:"; "Due Date:" = "Data:"; -"Location:" = "Localização:"; \ No newline at end of file +"Location:" = "Localização:"; diff --git a/UI/Common/Czech.lproj/Localizable.strings b/UI/Common/Czech.lproj/Localizable.strings index 89053c9c9..2f79662e1 100644 --- a/UI/Common/Czech.lproj/Localizable.strings +++ b/UI/Common/Czech.lproj/Localizable.strings @@ -43,6 +43,7 @@ = "Již jste přihlášeni k odběru této složky!"; "The user rights cannot be edited for this object!" = "Uživatelská práva pro tento objekt nemohou být upravena!"; +"A folder by that name already exists." = "A folder by that name already exists."; "You are not allowed to access this module or this system. Please contact your system administrator." = "Nemáte oprávnění pro přístup k tomuto modulu nebo systému. Kontaktujte prosím svého systémového administrátora."; @@ -53,4 +54,4 @@ "Reminder:" = "Upomínka:"; "Start:" = "Začátek:"; "Due Date:" = "Do dne:"; -"Location:" = "Místo:"; \ No newline at end of file +"Location:" = "Místo:"; diff --git a/UI/Common/Dutch.lproj/Localizable.strings b/UI/Common/Dutch.lproj/Localizable.strings index 2d8b947aa..822b15c1d 100644 --- a/UI/Common/Dutch.lproj/Localizable.strings +++ b/UI/Common/Dutch.lproj/Localizable.strings @@ -43,6 +43,7 @@ = "U bent al op deze map geabonneerd!"; "The user rights cannot be edited for this object!" = "De machtigingen kunnen niet worden aangepast voor dit object!"; +"A folder by that name already exists." = "A folder by that name already exists."; "You are not allowed to access this module or this system. Please contact your system administrator." = "U hebt geen toegang tot deze module of dit systeem. Neem contact op met uw systeem beheerder."; @@ -53,4 +54,4 @@ "Reminder:" = "Alarm:"; "Start:" = "Begin:"; "Due Date:" = "Verloopdatum:"; -"Location:" = "Plaats:"; \ No newline at end of file +"Location:" = "Plaats:"; diff --git a/UI/Common/English.lproj/Localizable.strings b/UI/Common/English.lproj/Localizable.strings index cfe7bff1d..603fa45ad 100644 --- a/UI/Common/English.lproj/Localizable.strings +++ b/UI/Common/English.lproj/Localizable.strings @@ -43,6 +43,7 @@ = "You have already subscribed to that folder!"; "The user rights cannot be edited for this object!" = "The user rights cannot be edited for this object!"; +"A folder by that name already exists." = "A folder by that name already exists."; "You are not allowed to access this module or this system. Please contact your system administrator." = "You are not allowed to access this module or this system. Please contact your system administrator."; @@ -53,4 +54,4 @@ "Reminder:" = "Reminder:"; "Start:" = "Start:"; "Due Date:" = "Due Date:"; -"Location:" = "Location:"; \ No newline at end of file +"Location:" = "Location:"; diff --git a/UI/Common/French.lproj/Localizable.strings b/UI/Common/French.lproj/Localizable.strings index 87f02c5dc..e2694874d 100644 --- a/UI/Common/French.lproj/Localizable.strings +++ b/UI/Common/French.lproj/Localizable.strings @@ -43,6 +43,7 @@ = "Vous êtes déja abonné à ce dossier."; "The user rights cannot be edited for this object!" = "Les droits sur cet objet ne peuvent pas être édités."; +"A folder by that name already exists." = "Un dossier du même nom existe déjà."; "You are not allowed to access this module or this system. Please contact your system administrator." = "Vous n'êtes pas autorisé à accéder à ce module ou ce système. Veuillez contacter votre administrateur système."; @@ -53,4 +54,4 @@ "Reminder:" = "Rappel :"; "Start:" = "Début :"; "Due Date:" = "Échéance :"; -"Location:" = "Lieu :"; \ No newline at end of file +"Location:" = "Lieu :"; diff --git a/UI/Common/German.lproj/Localizable.strings b/UI/Common/German.lproj/Localizable.strings index 200ac8597..44b8af61f 100644 --- a/UI/Common/German.lproj/Localizable.strings +++ b/UI/Common/German.lproj/Localizable.strings @@ -43,6 +43,7 @@ = "Sie haben diesen Ordner bereits abonniert!"; "The user rights cannot be edited for this object!" = "Die Benutzerrechte können für dieses Objekt nicht verändert werden!"; +"A folder by that name already exists." = "A folder by that name already exists."; "You are not allowed to access this module or this system. Please contact your system administrator." = "You are not allowed to access this module or this system. Please contact your system administrator."; @@ -53,4 +54,4 @@ "Reminder:" = "Alarm:"; "Start:" = "Beginn:"; "Due Date:" = "Fällig:"; -"Location:" = "Ort:"; \ No newline at end of file +"Location:" = "Ort:"; diff --git a/UI/Common/Hungarian.lproj/Localizable.strings b/UI/Common/Hungarian.lproj/Localizable.strings index f444b01cc..9647d0645 100644 --- a/UI/Common/Hungarian.lproj/Localizable.strings +++ b/UI/Common/Hungarian.lproj/Localizable.strings @@ -43,6 +43,7 @@ = "Erre a mappára már feliratkozott!"; "The user rights cannot be edited for this object!" = "Ezen az objektumon nem szerkeszthetőek a felhasználói jogosultságok!"; +"A folder by that name already exists." = "A folder by that name already exists."; "You are not allowed to access this module or this system. Please contact your system administrator." = "Önnek nem engedélyezett a hozzáférés ehhez a modulhoz vagy rendszerhez. Kérem lépjen kapcsolatba a rendszergazdával."; @@ -53,4 +54,4 @@ "Reminder:" = "Emlékeztető:"; "Start:" = "Kezdés:"; "Due Date:" = "Lejárat dátuma:"; -"Location:" = "Hely:"; \ No newline at end of file +"Location:" = "Hely:"; diff --git a/UI/Common/Italian.lproj/Localizable.strings b/UI/Common/Italian.lproj/Localizable.strings index 0f7d28c3c..d4ab080c1 100644 --- a/UI/Common/Italian.lproj/Localizable.strings +++ b/UI/Common/Italian.lproj/Localizable.strings @@ -43,6 +43,7 @@ = "Hai già sottoscritto la cartella!"; "The user rights cannot be edited for this object!" = "I permessi di questo oggetto non possono essere modificati!"; +"A folder by that name already exists." = "A folder by that name already exists."; "You are not allowed to access this module or this system. Please contact your system administrator." = "Non sei abilitato ad accedere a questo modulo. Contatta il tuo amministratore di sistema."; @@ -53,4 +54,4 @@ "Reminder:" = "Promemoria:"; "Start:" = "Inizio:"; "Due Date:" = "Scadenza:"; -"Location:" = "Luogo:"; \ No newline at end of file +"Location:" = "Luogo:"; diff --git a/UI/Common/Russian.lproj/Localizable.strings b/UI/Common/Russian.lproj/Localizable.strings index d58db5d6c..e8d4b1b56 100644 --- a/UI/Common/Russian.lproj/Localizable.strings +++ b/UI/Common/Russian.lproj/Localizable.strings @@ -43,6 +43,7 @@ = "Вы уже подписались на эту папку!"; "The user rights cannot be edited for this object!" = "Извините, для данного объекта невозможно настроить права доступа!"; +"A folder by that name already exists." = "A folder by that name already exists."; "You are not allowed to access this module or this system. Please contact your system administrator." = "Вам не предоставлено право доступа к этому модулю/системе. Пожалуйста, свяжитесь с администратором."; @@ -53,4 +54,4 @@ "Reminder:" = "Напоминание:"; "Start:" = "Начало:"; "Due Date:" = "Дата начала:"; -"Location:" = "Место:"; \ No newline at end of file +"Location:" = "Место:"; diff --git a/UI/Common/Spanish.lproj/Localizable.strings b/UI/Common/Spanish.lproj/Localizable.strings index 05f879915..33678e1ac 100644 --- a/UI/Common/Spanish.lproj/Localizable.strings +++ b/UI/Common/Spanish.lproj/Localizable.strings @@ -43,6 +43,7 @@ = "Ya se ha suscrito a esta carpeta."; "The user rights cannot be edited for this object!" = "No es posible modificar los permisos de acceso a este objeto."; +"A folder by that name already exists." = "A folder by that name already exists."; "You are not allowed to access this module or this system. Please contact your system administrator." = "You are not allowed to access this module or this system. Please contact your system administrator."; @@ -53,4 +54,4 @@ "Reminder:" = "Recordatorio:"; "Start:" = "Desde:"; "Due Date:" = "Vencimiento:"; -"Location:" = "Lugar:"; \ No newline at end of file +"Location:" = "Lugar:"; diff --git a/UI/Common/UIxParentFolderActions.m b/UI/Common/UIxParentFolderActions.m index b02f18a25..98cc81480 100644 --- a/UI/Common/UIxParentFolderActions.m +++ b/UI/Common/UIxParentFolderActions.m @@ -42,20 +42,26 @@ name = [[context request] formValueForKey: @"name"]; if ([name length] > 0) { - response = (WOResponse *) [[self clientObject] newFolderWithName: name - nameInContainer: &nameInContainer]; - if (!response) - { - response = [self responseWithStatus: 201]; - [response setHeader: @"text/plain; charset=us-ascii" - forKey: @"content-type"]; - [response appendContentString: nameInContainer]; - } + if (![[self clientObject] hasLocalSubFolderNamed: name]) + { + response = (WOResponse *) [[self clientObject] newFolderWithName: name + nameInContainer: &nameInContainer]; + if (!response) + { + response = [self responseWithStatus: 201]; + [response setHeader: @"text/plain; charset=us-ascii" + forKey: @"content-type"]; + [response appendContentString: nameInContainer]; + } + } + else + response = [NSException exceptionWithHTTPStatus: 409 + reason: @"That name already exists"]; } else response = [NSException exceptionWithHTTPStatus: 400 - reason: @"The name is missing"]; - + reason: @"The name is missing"]; + return response; } diff --git a/UI/Common/Welsh.lproj/Localizable.strings b/UI/Common/Welsh.lproj/Localizable.strings index 2f2d9d089..5255b0858 100644 --- a/UI/Common/Welsh.lproj/Localizable.strings +++ b/UI/Common/Welsh.lproj/Localizable.strings @@ -43,6 +43,7 @@ = "Yr ydych wedi tanysgrifio eisoes i'r ffolder yna!"; "The user rights cannot be edited for this object!" = "Ni all hawliau'r defnyddiwr cael eu golygu ar gyfer y gwrthrych hwn!"; +"A folder by that name already exists." = "A folder by that name already exists."; "You are not allowed to access this module or this system. Please contact your system administrator." = "Nid oes gennych caniatad mynediad i'r modiwl hwn na'r system hwn. Cysylltwch a'r Gweinyddwr Systemau os gwelwch yn dda."; @@ -53,4 +54,4 @@ "Reminder:" = "Atgoffa:"; "Start:" = "Dechrau:"; "Due Date:" = "Dyddiad dyledus:"; -"Location:" = "Lleoliad:"; \ No newline at end of file +"Location:" = "Lleoliad:"; diff --git a/UI/WebServerResources/generic.js b/UI/WebServerResources/generic.js index 8b6aed4ed..5508ea8d4 100644 --- a/UI/WebServerResources/generic.js +++ b/UI/WebServerResources/generic.js @@ -1636,6 +1636,9 @@ function createFolderCallback(http) { if (data.okCB) data.okCB(data.name, "/" + http.responseText, UserLogin); } + else if (http.status == 409) { + alert (clabels["A folder by that name already exists."]); + } else { if (data.notOkCB) data.notOkCB(name);