diff --git a/ChangeLog b/ChangeLog index fb292169d..0d780f91c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,6 +46,20 @@ * UI/Scheduler/UIxAppointmentActions.[hm]: new module implementing a WODirectAction class for ajax calls for appointments. +2010-02-08 Francis Lachapelle + + * UI/Contacts/UIxContactFoldersView.m (-verticalDragHandleStyle): + new method (was missing), borrowed from UIxCalMainView.m. + (-horizontalDragHandleStyle): idem. + (contactsListContentStyle): idem. + + * UI/WebServerResources/ContactsUI.js (-onAddressBookRemove): + avoid selecting the personal addressbook prior to obtaining the + user's answer. + + * UI/MailerUI/UIxMailListView.m (-messageSize): improved + formatting of message size. + 2010-02-03 Wolfgang Sourdeau * UI/MainUI/SOGoRootPage.m (-_standardDefaultAction): add an diff --git a/NEWS b/NEWS index 6a4039747..e0d6a4069 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ 1.2-2010XXXX (1.2.X) -------------------- - added CAS authentication support +- improved display of message size in webmail 1.2-20100125 (1.2.0) -------------------- diff --git a/UI/Contacts/UIxContactFoldersView.h b/UI/Contacts/UIxContactFoldersView.h index 945300d7b..d385c1adf 100644 --- a/UI/Contacts/UIxContactFoldersView.h +++ b/UI/Contacts/UIxContactFoldersView.h @@ -32,6 +32,7 @@ NSString *selectorComponentClass; NSMutableDictionary *moduleSettings; id currentFolder; + BOOL contextIsSetup; } - (NSArray *) contactFolders; diff --git a/UI/Contacts/UIxContactFoldersView.m b/UI/Contacts/UIxContactFoldersView.m index 2939b431a..8696e96b4 100644 --- a/UI/Contacts/UIxContactFoldersView.m +++ b/UI/Contacts/UIxContactFoldersView.m @@ -53,22 +53,34 @@ @implementation UIxContactFoldersView +- (id) init +{ + if ((self = [super init])) + contextIsSetup = NO; + + return self; +} + - (void) _setupContext { SOGoUser *activeUser; NSString *module; SOGoContactFolders *clientObject; - activeUser = [context activeUser]; - clientObject = [self clientObject]; - - module = [clientObject nameInContainer]; - - us = [activeUser userSettings]; - moduleSettings = [us objectForKey: module]; - if (!moduleSettings) - moduleSettings = [NSMutableDictionary dictionary]; - [us setObject: moduleSettings forKey: module]; + if (!contextIsSetup) + { + activeUser = [context activeUser]; + clientObject = [self clientObject]; + + module = [clientObject nameInContainer]; + + us = [activeUser userSettings]; + moduleSettings = [us objectForKey: module]; + if (!moduleSettings) + moduleSettings = [NSMutableDictionary dictionary]; + [us setObject: moduleSettings forKey: module]; + contextIsSetup = YES; + } } - (id ) mailerContactsAction @@ -411,6 +423,36 @@ return ([currentFolder isKindOfClass: [SOGoContactSourceFolder class]]? @"remote" : @"local"); } +- (NSString *) verticalDragHandleStyle +{ + NSString *vertical; + + [self _setupContext]; + vertical = [moduleSettings objectForKey: @"DragHandleVertical"]; + + return ((vertical && [vertical intValue] > 0) ? (id)[vertical stringByAppendingFormat: @"px"] : nil); +} + +- (NSString *) horizontalDragHandleStyle +{ + NSString *horizontal; + + [self _setupContext]; + horizontal = [moduleSettings objectForKey: @"DragHandleHorizontal"]; + + return ((horizontal && [horizontal intValue] > 0) ? (id)[horizontal stringByAppendingFormat: @"px"] : nil); +} + +- (NSString *) contactsListContentStyle +{ + NSString *height; + + [self _setupContext]; + height = [moduleSettings objectForKey: @"DragHandleVertical"]; + + return ((height && [height intValue] > 0) ? [NSString stringWithFormat: @"%ipx", ([height intValue] - 27)] : nil); +} + - (WOResponse *) saveDragHandleStateAction { WORequest *request; diff --git a/UI/MailerUI/UIxMailListView.m b/UI/MailerUI/UIxMailListView.m index 5358165c1..404b25cc7 100644 --- a/UI/MailerUI/UIxMailListView.m +++ b/UI/MailerUI/UIxMailListView.m @@ -119,9 +119,13 @@ int size; size = [[message valueForKey: @"size"] intValue]; - - rc = [NSString stringWithFormat: @"%dK", size/1024]; - + if (size > 1024*1024) + rc = [NSString stringWithFormat: @"%.1f MB", (float) size/1024/1024]; + else if (size > 1024*100) + rc = [NSString stringWithFormat: @"%d KB", size/1024]; + else + rc = [NSString stringWithFormat: @"%.1f KB", (float) size/1024]; + return rc; } diff --git a/UI/WebServerResources/ContactsUI.js b/UI/WebServerResources/ContactsUI.js index 9518d774c..d880d78f4 100644 --- a/UI/WebServerResources/ContactsUI.js +++ b/UI/WebServerResources/ContactsUI.js @@ -680,7 +680,9 @@ function onAddressBookAdd(event) { function onFolderUnsubscribeCB(folderId) { var node = $(folderId); + node.deselect(); node.parentNode.removeChild(node); + var personal = $("/personal"); personal.selectElement(); onFolderSelectionChange(); @@ -740,7 +742,6 @@ function onAddressBookRemove(event) { var nodes = selector.getSelectedNodes(); if (nodes.length > 0) { var node = $(nodes[0]); - node.deselect(); var owner = node.getAttribute("owner"); if (owner == "nobody") { var label = getLabel("You cannot remove nor unsubscribe from a public addressbook."); @@ -750,9 +751,6 @@ function onAddressBookRemove(event) { var folderIdElements = node.getAttribute("id").split(":"); var abId = folderIdElements[0].substr(1); deletePersonalAddressBook(abId); - var personal = $("/personal"); - personal.selectElement(); - onFolderSelectionChange(); } else { var folderId = node.getAttribute("id"); @@ -796,12 +794,16 @@ function deletePersonalAddressBookCallback(http) { while (!done && i < children.length) { var currentFolderId = children[i].getAttribute("id").substr(1); if (currentFolderId == http.callbackData) { + children[i].deselect(); ul.removeChild(children[i]); done = true; } else i++; } + var personal = $("/personal"); + personal.selectElement(); + onFolderSelectionChange(); } document.deletePersonalABAjaxRequest = null; }