From 5cf62a74a9b6045dc5770a5ef97d30608a2dbc29 Mon Sep 17 00:00:00 2001 From: C Robert Date: Thu, 16 Jul 2009 15:57:31 +0000 Subject: [PATCH] Mantis #5 completed, needs testing Monotone-Parent: bb2d11200e5d8cbdc9a740b2a9e019efed65432b Monotone-Revision: 00f021939a59d6bcc0871dadde8fbc81c2d0b614 Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-07-16T15:57:31 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 12 ++ .../Localizable.strings | 5 + .../Czech.lproj/Localizable.strings | 5 + .../Dutch.lproj/Localizable.strings | 5 + .../English.lproj/Localizable.strings | 5 + .../French.lproj/Localizable.strings | 5 + .../German.lproj/Localizable.strings | 5 + .../Italian.lproj/Localizable.strings | 4 + .../Russian.lproj/Localizable.strings | 4 + .../Spanish.lproj/Localizable.strings | 4 + UI/PreferencesUI/UIxPreferences.m | 85 +++++++++ .../Welsh.lproj/Localizable.strings | 5 + UI/Scheduler/UIxComponentEditor.m | 10 +- UI/Templates/PreferencesUI/UIxPreferences.wox | 30 ++++ UI/WebServerResources/UIxPreferences.css | 17 ++ UI/WebServerResources/UIxPreferences.js | 166 +++++++++++++++++- UI/WebServerResources/generic.js | 2 +- 17 files changed, 364 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 60282fbd7..252b946c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,21 @@ +2009-07-16 Cyril Robert + + * UI/PreferencesUI/UIxPreferences.m: Added categories, categoriesValue, + setCategoriesValue to allow editing of calendar categories. + * UI/Scheduler/UIxComponentEditor.m: Made modifications to fetch categories + from user defaults, if they exist. + 2009-07-15 Wolfgang Sourdeau * UI/Scheduler/UIxComponentEditor.m (-categoryList): insert the category of the current component in the list, don't convert it to upper case and sort the resulting list alphabetically. +2009-07-14 Cyril Robert + + * UI/Scheduler/UIxComponentEditor.m: Added a default title for + vevents and vtodos + 2009-07-14 Francis Lachapelle * UI/SOGoUI/UIxComponent.m ([UIxComponent -buildDate]): moved diff --git a/UI/PreferencesUI/BrazilianPortuguese.lproj/Localizable.strings b/UI/PreferencesUI/BrazilianPortuguese.lproj/Localizable.strings index 7caf9c910..a6bdefef9 100755 --- a/UI/PreferencesUI/BrazilianPortuguese.lproj/Localizable.strings +++ b/UI/PreferencesUI/BrazilianPortuguese.lproj/Localizable.strings @@ -8,6 +8,7 @@ "Mail Options" = "Correio"; "Identities" = "Identidade"; "Password" = "Senha"; +"Categories" = "Categories"; /* ooo */ "I'm currently in the office" = "Eu estou no escritório"; @@ -99,3 +100,7 @@ "New password:" = "Nova senha:"; "Confirmation:" = "Confirmação:"; "Change" = "Alterar"; + +"category_none" = "Nenhum"; +"category_labels" = "Aniversário,Negócios,Ligações,Concorrência,Cliente,Favoritos,Acompanhamento,Presentes,Feriados,Idéias,Problemas,Miscelânea,Pessoal,Projetos,Feriado público,Posição,Fornecedores,Viagem,Férias"; + diff --git a/UI/PreferencesUI/Czech.lproj/Localizable.strings b/UI/PreferencesUI/Czech.lproj/Localizable.strings index 549924130..a77706b0f 100755 --- a/UI/PreferencesUI/Czech.lproj/Localizable.strings +++ b/UI/PreferencesUI/Czech.lproj/Localizable.strings @@ -8,6 +8,7 @@ "Mail Options" = "Možnosti e-mailu"; "Identities" = "Identity"; "Password" = "Heslo"; +"Categories" = "Categories"; /* ooo */ "I'm currently in the office" = "Momentálně jsem v kanceláři"; @@ -99,3 +100,7 @@ "New password:" = "Nové heslo:"; "Confirmation:" = "Potvrzení:"; "Change" = "Změnit"; + +"category_none" = "Žádný"; +"category_labels" = "Výročí,Narozeniny,Obchod,Hovory,Klienti,Soutěže,Zákazník,Oblíbené,Sledování,Dárky,Volno,Nápady,Problémy,Různé,Osobní,Projekty,Veřejné prázdniny,Stav,Dodavatelé,Cesta,Dovolená"; + diff --git a/UI/PreferencesUI/Dutch.lproj/Localizable.strings b/UI/PreferencesUI/Dutch.lproj/Localizable.strings index b811358da..cc7ef5f82 100644 --- a/UI/PreferencesUI/Dutch.lproj/Localizable.strings +++ b/UI/PreferencesUI/Dutch.lproj/Localizable.strings @@ -8,6 +8,7 @@ "Mail Options" = "E-mail"; "Identities" = "Identiteit"; "Password" = "Wachtwoord"; +"Categories" = "Categories"; /* ooo */ "I'm currently in the office" = "Ik ben op kantoor"; @@ -99,3 +100,7 @@ "New password:" = "Nieuw wachtwoord:"; "Confirmation:" = "Bevestig wachtwoord:"; "Change" = "Veranderen"; + +"category_none" = "Geen categorie"; +"category_labels" = "Cliënten,Concurrentie,Diversen,Favorieten,Giften,Ideeën,Klant,Kwesties,Leveranciers,Nationale feestdag,Persoonlijk,Projecten,Reizen,Status,Telefoongesprekken,Trouwdag,Vakantie,Verjaardag,Vervolggesprek,Vrije dagen,Zaken"; + diff --git a/UI/PreferencesUI/English.lproj/Localizable.strings b/UI/PreferencesUI/English.lproj/Localizable.strings index 99dc856ad..cec6ae29e 100644 --- a/UI/PreferencesUI/English.lproj/Localizable.strings +++ b/UI/PreferencesUI/English.lproj/Localizable.strings @@ -8,6 +8,7 @@ "Mail Options" = "Mail Options"; "Identities" = "Identities"; "Password" = "Password"; +"Categories" = "Categories"; /* ooo */ "I'm currently in the office" = "I'm currently in the office"; @@ -102,3 +103,7 @@ "New password:" = "New password:"; "Confirmation:" = "Confirmation:"; "Change" = "Change"; + +"category_none" = "None"; +"category_labels" = "Anniversary,Birthday,Business,Calls,Clients,Competition,Customer,Favorites,Follow up,Gifts,Holidays,Ideas,Issues,Miscellaneous,Personal,Projects,Public Holiday,Status,Suppliers,Travel,Vacation"; + diff --git a/UI/PreferencesUI/French.lproj/Localizable.strings b/UI/PreferencesUI/French.lproj/Localizable.strings index 21cc576c5..89a91d7c6 100644 --- a/UI/PreferencesUI/French.lproj/Localizable.strings +++ b/UI/PreferencesUI/French.lproj/Localizable.strings @@ -8,6 +8,7 @@ "Mail Options" = "Courrier"; "Identities" = "Identités"; "Password" = "Mot de passe"; +"Categories" = "Catégories"; /* ooo */ "I'm currently in the office" = "Je suis présent"; @@ -100,3 +101,7 @@ "New password:" = "Nouveau mot de passe :"; "Confirmation:" = "Confirmation :"; "Change" = "Changer"; + +"category_none" = "Aucune"; +"category_labels" = "Anniversaire,Affaire,Appels,Clients,Compétitions,Congrès,Consommation,Préférés,Suivis,Cadeaux,Congés,Idées,Problèmes,Divers,Personnel,Projets,Jour férié,Réunion,Fournisseurs,Voyages,Professionnel"; + diff --git a/UI/PreferencesUI/German.lproj/Localizable.strings b/UI/PreferencesUI/German.lproj/Localizable.strings index 84bcf1098..4d39bb4ce 100644 --- a/UI/PreferencesUI/German.lproj/Localizable.strings +++ b/UI/PreferencesUI/German.lproj/Localizable.strings @@ -8,6 +8,7 @@ "Mail Options" = "E-Mail"; "Identities" = "Identität"; "Password" = "Passwort"; +"Categories" = "Categories"; /* ooo */ "I'm currently in the office" = "Ich bin zurzeit im Hause"; @@ -100,3 +101,7 @@ "New password:" = "Neues Passwort:"; "Confirmation:" = "Bestätigung:"; "Change" = "Ändern"; + +"category_none" = "Keine"; +"category_labels" = "Jubiläum,Geburtstag,Geschäft,Anrufe,Klienten,Konkurrenz,Kunde,Favoriten,Nachgehen,Geschenke,Ferien,Ideen,Fragen,Verschiedenes,Persönlich,Projekte,Feiertag,Status,Lieferanten,Reise,Urlaub"; + diff --git a/UI/PreferencesUI/Italian.lproj/Localizable.strings b/UI/PreferencesUI/Italian.lproj/Localizable.strings index a5524c205..df965074b 100644 --- a/UI/PreferencesUI/Italian.lproj/Localizable.strings +++ b/UI/PreferencesUI/Italian.lproj/Localizable.strings @@ -8,6 +8,7 @@ "Mail Options" = "Opzioni di posta"; "Identities" = "Identità"; "Password" = "Password"; +"Categories" = "Categories"; /* ooo */ "I'm currently in the office" = "Sono in ufficio"; @@ -100,3 +101,6 @@ "New password:" = "Nuova password:"; "Confirmation:" = "Ripeti nuova password:"; "Change" = "Cambia Password"; + +"category_none" = "Nessuna"; +"category_labels" = "Anniversari,Compleanni,Lavoro,Chiamate,Clienti,Competizioni,Compratori,Preferiti,Incontri,Regali,Vacanze,Idee,Problemi,Varie,Personale,Progetti,Giorno festivo,Stato,Fornitori,Viaggio,Chiusura"; diff --git a/UI/PreferencesUI/Russian.lproj/Localizable.strings b/UI/PreferencesUI/Russian.lproj/Localizable.strings index fc66214b3..7d8f6dc6d 100644 --- a/UI/PreferencesUI/Russian.lproj/Localizable.strings +++ b/UI/PreferencesUI/Russian.lproj/Localizable.strings @@ -8,6 +8,7 @@ "Mail Options" = "Почта"; "Identities" = "Identities"; "Password" = "Пароль"; +"Categories" = "Categories"; /* ooo */ "I'm currently in the office" = "Я на рабочем месте"; @@ -107,3 +108,6 @@ "New password:" = "Новый пароль:"; "Confirmation:" = "Повтор нового пароля:"; "Change" = "Изменить"; + +"category_none" = "None"; +"category_labels" = "Anniversary,Birthday,Business,Calls,Clients,Competition,Customer,Favorites,Follow up,Gifts,Holidays,Ideas,Issues,Miscellaneous,Personal,Projects,Public Holiday,Status,Suppliers,Travel,Vacation"; diff --git a/UI/PreferencesUI/Spanish.lproj/Localizable.strings b/UI/PreferencesUI/Spanish.lproj/Localizable.strings index 626f0c2b3..3e10b52c5 100644 --- a/UI/PreferencesUI/Spanish.lproj/Localizable.strings +++ b/UI/PreferencesUI/Spanish.lproj/Localizable.strings @@ -13,6 +13,7 @@ "Mail Options" = "Opciones de correo"; "Identities" = "Identidades"; "Password" = "Contraseña"; +"Categories" = "Categories"; /* ooo */ "I'm currently in the office" = "Ahora estoy disponible"; @@ -111,3 +112,6 @@ "New password:" = "Contraseña nueva:"; "Confirmation:" = "Confirmar contraseña nueva:"; /* ??? */ "Change" = "Cambiar"; + +"category_none" = "Ninguna"; +"category_labels" = "Aniversario,Cumpleaños,Negocios,Llamadas,Clientes,Competición,Trabajo,Favoritos,Seguimiento,Regalos,Fiestas,Ideas,Asuntos,Varios,Personal,Proyectos,Vacaciones públicas,Estado,Proveedores,Viajes,Vacaciones"; diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 0108237d0..ceb65ddba 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -24,6 +24,7 @@ #import #import #import +#import #import #import @@ -658,4 +659,88 @@ static BOOL defaultShowSubscribedFoldersOnly = NO; return shouldDisplayPasswordChange; } +- (NSString *) nameLabel +{ + return [self labelForKey: @"Name"]; +} + +- (NSString *) colorLabel +{ + return [self labelForKey: @"Color"]; +} + +- (NSArray *) categories +{ + NSDictionary *element; + NSArray *k, *v, *names; + NSMutableArray *rc, *colors; + int i, count; + + names = [userDefaults arrayForKey: @"CalendarCategories"]; + if (names) + colors = [NSMutableArray arrayWithArray: + [userDefaults arrayForKey: @"CalendarCategoriesColors"]]; + else + { + names = [[self labelForKey: @"category_labels"] + componentsSeparatedByString: @","]; + + count = [names count]; + colors = [NSMutableArray arrayWithCapacity: count]; + for (i = 0; i < count; i++) + [colors addObject: @"#F0F0F0"]; + } + + rc = [NSMutableArray array]; + k = [NSArray arrayWithObjects: @"name", @"color", nil]; + + count = [names count]; + for (i = 0; i < count; i++) + { + v = [NSArray arrayWithObjects: [names objectAtIndex: i], + [colors objectAtIndex: i], nil]; + + element = [NSDictionary dictionaryWithObjects: v + forKeys: k]; + [rc addObject: element]; + } + + return rc; +} + + +- (NSString *) categoriesValue +{ + return @""; +} + +- (void) setCategoriesValue: (NSString *) value +{ + NSData *data; + NSString *error; + NSPropertyListFormat format; + NSDictionary *plist; + + data = [value dataUsingEncoding: NSUTF8StringEncoding]; + plist = [NSPropertyListSerialization propertyListFromData: data + mutabilityOption: NSPropertyListImmutable + format: &format + errorDescription: &error]; + + if(!plist) + { + NSLog(error); + [error release]; + } + else + { + [userDefaults setObject: [plist objectAtIndex: 0] + forKey: @"CalendarCategories"]; + [userDefaults setObject: [plist objectAtIndex: 1] + forKey: @"CalendarCategoriesColors"]; + NSLog ([plist description]); + } + +} + @end diff --git a/UI/PreferencesUI/Welsh.lproj/Localizable.strings b/UI/PreferencesUI/Welsh.lproj/Localizable.strings index 4d9ad57dd..57b6b035e 100644 --- a/UI/PreferencesUI/Welsh.lproj/Localizable.strings +++ b/UI/PreferencesUI/Welsh.lproj/Localizable.strings @@ -8,6 +8,7 @@ "Mail Options" = "Opsiynau Ebost"; "Identities" = "hunaniaethau"; "Password" = "Cyfrinair"; +"Categories" = "Categories"; /* ooo */ "I'm currently in the office" = "Yr wyf yn y swyddfa ar hyn o bryd"; @@ -102,3 +103,7 @@ "New password:" = "New password:"; "Confirmation:" = "Confirmation:"; "Change" = "Change"; + +"category_none" = "Dim"; +"category_labels" = "Amrywiol,Anrhegion,Busnes,Canlyniadau,Clientau,Cwsmer,Cyflenwyr,Cystadleuaeth,Dilyn lan,Ffefrynnau,Galwadau,Gwyliau,Gwyliau Cyhoeddus,Penblwydd,Personol,Projectau,Statws,Syniadau,Teithio"; + diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 3cd13a8f1..291b597c3 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -615,7 +615,7 @@ iRANGE(2); - (NSString *) title { - SOGoObject *co; + SOGoCalendarComponent *co; NSString *tag; co = [self clientObject]; @@ -806,9 +806,13 @@ iRANGE(2); { NSMutableArray *categoryList; NSArray *categoryLabels; + NSUserDefaults *defaults; - categoryLabels = [[self labelForKey: @"category_labels"] - componentsSeparatedByString: @","]; + defaults = [[context activeUser] userDefaults]; + categoryLabels = [defaults arrayForKey: @"CalendarCategories"]; + if (!categoryLabels) + categoryLabels = [[self labelForKey: @"category_labels"] + componentsSeparatedByString: @","]; categoryList = [NSMutableArray arrayWithCapacity: [categoryLabels count] + 1]; if ([category length] && ![categoryLabels containsObject: category]) diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox index 09e922561..d6614d346 100644 --- a/UI/Templates/PreferencesUI/UIxPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -80,6 +80,36 @@ const:id="firstWeek" string="itemFirstWeekText" selection="userFirstWeek" />
+
+
+ + + + + + + +
+ +
+ + diff --git a/UI/WebServerResources/UIxPreferences.css b/UI/WebServerResources/UIxPreferences.css index 32bd3faa7..35be9a07a 100644 --- a/UI/WebServerResources/UIxPreferences.css +++ b/UI/WebServerResources/UIxPreferences.css @@ -32,3 +32,20 @@ DIV#identitiesView width: 390px; max-width: 390px; height: 145px; } + +TABLE#messageList +{ width: 100%; } + +div.colorBox +{ border: 1px solid #333333; + font-size: 80%; + font-weight: normal; + height: 0.75em; + margin: 0 3px 0 0; + width: 1em; } + +tr.categoryListRow +{ background: #FFFFFF; } +tr._selected +{ background: #333333; } + diff --git a/UI/WebServerResources/UIxPreferences.js b/UI/WebServerResources/UIxPreferences.js index 6c6cee417..92fefd9c4 100644 --- a/UI/WebServerResources/UIxPreferences.js +++ b/UI/WebServerResources/UIxPreferences.js @@ -5,6 +5,7 @@ function savePreferences(sender) { if (sigList) sigList.disabled=false; + serializeCategories (null); $("mainForm").submit(); return false; @@ -26,6 +27,7 @@ function _setupEvents(enable) { $("replyPlacementList").observe ("change", onReplyPlacementListChange); $("composeMessagesType").observe ("change", onComposeMessagesTypeChange); + $("categoriesValue").value = "prout"; } function onChoiceChanged(event) { @@ -43,6 +45,167 @@ function initPreferences() { if ($("signature")) { onComposeMessagesTypeChange (); } + + resetCategoriesColors (null); + var table = $("categoriesList"); + var r = $$("TABLE#categoriesList tbody tr"); + for (var i=0; i