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
maint-2.0.2
C Robert 2009-07-16 15:57:31 +00:00
parent dced0f231d
commit 5cf62a74a9
17 changed files with 364 additions and 5 deletions

View File

@ -1,9 +1,21 @@
2009-07-16 Cyril Robert <crobert@inverse.ca>
* 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 <wsourdeau@inverse.ca>
* 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 <crobert@inverse.ca>
* UI/Scheduler/UIxComponentEditor.m: Added a default title for
vevents and vtodos
2009-07-14 Francis Lachapelle <flachapelle@inverse.ca>
* UI/SOGoUI/UIxComponent.m ([UIxComponent -buildDate]): moved

View File

@ -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";

View File

@ -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á";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -24,6 +24,7 @@
#import <Foundation/NSString.h>
#import <Foundation/NSTimeZone.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSPropertyList.h>
#import <NGObjWeb/WOContext.h>
#import <NGObjWeb/WORequest.h>
@ -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

View File

@ -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";

View File

@ -615,7 +615,7 @@ iRANGE(2);
- (NSString *) title
{
SOGoObject <SOGoComponentOccurence> *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])

View File

@ -80,6 +80,36 @@
const:id="firstWeek"
string="itemFirstWeekText" selection="userFirstWeek"
/></label><br/>
<label><var:string label:value="Categories"/></label><br/>
<div style="overflow:auto; height:230px; padding:2px;"
><table id="categoriesList" cellspacing="0" width="100%">
<thead>
<tr class="tableview"
><td const:class="tbtv_headercell" const:id="nameTableHeader"
><var:string var:value="nameLabel" /></td
><td const:class="tbtv_headercell" const:width="20%" const:id="colorTableHeader"
><var:string var:value="colorLabel" /></td
></tr
></thead>
<tbody>
<var:foreach list="categories" item="category">
<tr const:class="categoryListRow"
><td const:class="categoryListCell"
><var:string var:value="category.name"/></td
><td const:class="categoryListCell"
><div const:class="colorBox"><var:string var:value="category.color"
/></div></td
></tr>
</var:foreach>
</tbody>
</table></div>
<input type="hidden" const:id="categoriesValue"
const:name="categoriesValue" var:value="categoriesValue"/>
<br/>
<label><input type="button" class="button"
id="categoryAdd" label:value="Add"/></label>
<label><input type="button" class="button"
id="categoryDelete" label:value="Delete"/></label>
<!-- <br/> -->
<!-- <label><input class="checkBox" -->
<!-- type="checkbox" var:selection="reminderEnabled" -->

View File

@ -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; }

View File

@ -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<r.length; i++)
r[i].identify ();
table.multiselect = true;
TableKit.Resizable.init(table,
{'trueResize' : true, 'keepWidth' : true});
resetTableActions ();
$("categoryAdd").observe ("click", onCategoryAdd);
$("categoryDelete").observe ("click", onCategoryDelete);
}
function resetTableActions () {
var r = $$("TABLE#categoriesList tbody tr");
for (var i = 0; i < r.length; i++) {
var row = $(r[i]);
row.observe("mousedown", onRowClick);
row.observe("selectstart", listRowMouseDownHandler);
var tds = row.childElements ();
tds[0].observe("mousedown", endAllEditables);
tds[1].observe("mousedown", endAllEditables);
tds[0].observe ("dblclick", onNameEdit);
tds[1].childElements ()[0].observe ("dblclick", onColorEdit);
}
}
function makeEditable (element) {
element.addClassName ("editing");
var tmp = element.innerHTML;
element.innerHTML = "";
var textField = new Element ("input", {"type": "text",
"width": "100%"});
textField.value = tmp;
textField.observe ("keydown", interceptEnter);
element.appendChild (textField);
textField.focus ();
textField.select ();
}
function interceptEnter (e) {
if (e.keyCode == Event.KEY_RETURN) {
endAllEditables (null);
preventDefault (e);
return false;
}
}
function endEditable (element) {
var tmp = element.childElements ().first ().value;
element.innerHTML = tmp;
element.removeClassName ("editing");
}
function endAllEditables (e) {
var r = $$("TABLE#categoriesList tbody tr td");
for (var i=0; i<r.length; i++) {
if (r[i] != this && r[i].hasClassName ("editing"))
endEditable ($(r[i]));
}
}
function onNameEdit (e) {
endAllEditables ();
if (!this.hasClassName ("editing")) {
makeEditable (this);
}
}
function onColorEdit (e) {
var r = $$("TABLE#categoriesList tbody tr td div.colorEditing");
for (var i=0; i<r.length; i++)
r[i].removeClassName ("colorEditing");
this.addClassName ("colorEditing");
var cPicker = window.open(ApplicationBaseURL + "../" + UserLogin
+ "/Calendar/colorPicker", "colorPicker",
"width=250,height=200,resizable=0,scrollbars=0"
+ "toolbar=0,location=0,directories=0,status=0,"
+ "menubar=0,copyhistory=0", "test"
);
cPicker.focus();
preventDefault(event);
}
function onColorPickerChoice (newColor) {
var div = $$("TABLE#categoriesList tbody tr td div.colorEditing").first ();
// div.removeClassName ("colorEditing");
div.showColor = newColor;
div.style.background = newColor;
}
function onCategoryAdd (e) {
var row = new Element ("tr");
var nametd = new Element ("td").update ("");
var colortd = new Element ("td");
var colordiv = new Element ("div", {"class": "colorBox"});
row.identify ();
row.addClassName ("categoryListRow");
nametd.addClassName ("categoryListCell");
colortd.addClassName ("categoryListCell");
colordiv.innerHTML = "&nbsp;";
colordiv.showColor = "#F0F0F0";
colordiv.style.background = colordiv.showColor;
colortd.appendChild (colordiv);
row.appendChild (nametd);
row.appendChild (colortd);
$("categoriesList").tBodies[0].appendChild (row);
makeEditable (nametd);
resetTableActions ();
}
function onCategoryDelete (e) {
var list = $('categoriesList').down("TBODY");;
var rows = list.getSelectedNodes();
var count = rows.length;
for (var i=0; i < count; i++) {
rows[i].remove ();
}
}
function serializeCategories (e) {
var r = $$("TABLE#categoriesList tbody tr");
var names = "(";
var colors = "(";
for (var i = 0; i < r.length; i++) {
var tds = r[i].childElements ();
var name = $(tds.first ()).innerHTML;
var color = $(tds.last ().childElements ().first ()).showColor;
names += "\"" + name + "\", ";
colors += "\"" + color + "\", ";
}
names = names.substr (0, names.length - 1) + ")";
colors = colors.substr (0, colors.length - 1) + ")";
$("categoriesValue").value = "(" + names + ", " + colors + ")";
}
function resetCategoriesColors (e) {
var divs = $$("DIV.colorBox");
for (var i = 0; i < divs.length; i++) {
var d = $(divs[i]);
var color = d.innerHTML;
d.showColor = color;
d.style.background = color;
d.innerHTML = "&nbsp;";
}
}
function onReplyPlacementListChange() {
@ -62,6 +225,7 @@ function onComposeMessagesTypeChange () {
// Textmode
if ($("composeMessagesType").value == 0) {
textArea.style.height = "340px";
if (editor) {
CKEDITOR.instances.signature.removeListener ()
CKEDITOR.instances.signature.destroy (false);
@ -73,7 +237,7 @@ function onComposeMessagesTypeChange () {
CKEDITOR.replace('signature',
{
skin: "v2",
height: "90px",
height: "280px",
toolbar :
[['Bold', 'Italic', '-', 'Link',
'Font','FontSize','-','TextColor',

View File

@ -1591,7 +1591,7 @@ function onLinkBannerClick() {
function onPreferencesClick(event) {
var urlstr = UserFolderURL + "preferences";
var w = window.open(urlstr, "_blank",
"width=440,height=250,resizable=0,scrollbars=0,location=0");
"width=440,height=450,resizable=0,scrollbars=0,location=0");
w.opener = window;
w.focus();