From 9a57f9d2380af6ba316195b70aa15b0b14220042 Mon Sep 17 00:00:00 2001 From: helge Date: Fri, 27 Aug 2004 03:51:08 +0000 Subject: [PATCH] added sorting to addressbook git-svn-id: http://svn.opengroupware.org/SOGo/trunk@281 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/Common/ChangeLog | 2 ++ SOGo/UI/Common/GNUmakefile | 7 +++- SOGo/UI/Common/UIxAppNavView.m | 4 +++ SOGo/UI/Common/UIxSortButton.m | 33 +++++++++++++++++ SOGo/UI/Common/UIxSortButton.wox | 11 ++++++ SOGo/UI/Common/images/downward_sorted.gif | Bin 0 -> 118 bytes SOGo/UI/Common/images/non_sorted.gif | Bin 0 -> 120 bytes SOGo/UI/Common/images/upward_sorted.gif | Bin 0 -> 117 bytes SOGo/UI/Common/product.plist | 5 ++- SOGo/UI/Contacts/ChangeLog | 2 ++ SOGo/UI/Contacts/UIxContactsListView.m | 32 +++++++++++++++++ SOGo/UI/Contacts/UIxContactsListView.wox | 41 ++++++++++++++++++---- SOGo/UI/Contacts/Version | 2 +- 13 files changed, 129 insertions(+), 10 deletions(-) create mode 100644 SOGo/UI/Common/UIxSortButton.m create mode 100644 SOGo/UI/Common/UIxSortButton.wox create mode 100644 SOGo/UI/Common/images/downward_sorted.gif create mode 100644 SOGo/UI/Common/images/non_sorted.gif create mode 100644 SOGo/UI/Common/images/upward_sorted.gif diff --git a/SOGo/UI/Common/ChangeLog b/SOGo/UI/Common/ChangeLog index be46224a..329b4053 100644 --- a/SOGo/UI/Common/ChangeLog +++ b/SOGo/UI/Common/ChangeLog @@ -1,5 +1,7 @@ 2004-08-27 Helge Hess + * started UIxSortButton (v0.9.20) + * v0.9.19 * UIxPageFrame.wox: navigation below the line, app selection above diff --git a/SOGo/UI/Common/GNUmakefile b/SOGo/UI/Common/GNUmakefile index 9155d634..72fd5e40 100644 --- a/SOGo/UI/Common/GNUmakefile +++ b/SOGo/UI/Common/GNUmakefile @@ -13,6 +13,7 @@ CommonUI_OBJC_FILES += \ UIxPageFrame.m \ UIxPrintPageFrame.m \ UIxWinClose.m \ + UIxSortButton.m \ UIxAppNavView.m \ \ UIxElemBuilder.m \ @@ -26,6 +27,7 @@ CommonUI_RESOURCE_FILES += \ UIxPageFrame.wox \ UIxPrintPageFrame.wox \ UIxWinClose.wox \ + UIxSortButton.wox \ UIxAppNavView.wox \ \ uix.css \ @@ -47,7 +49,10 @@ CommonUI_RESOURCE_FILES += \ images/tab_selected.gif \ images/tab_.gif \ images/corner_right.gif \ - images/closewindow.gif + images/closewindow.gif \ + images/upward_sorted.gif\ + images/downward_sorted.gif \ + images/non_sorted.gif \ # make diff --git a/SOGo/UI/Common/UIxAppNavView.m b/SOGo/UI/Common/UIxAppNavView.m index 7aa13d65..8c14e154 100644 --- a/SOGo/UI/Common/UIxAppNavView.m +++ b/SOGo/UI/Common/UIxAppNavView.m @@ -43,6 +43,8 @@ [super dealloc]; } +/* accessors */ + - (void)setElement:(id)_element { ASSIGN(self->element, _element); } @@ -57,6 +59,8 @@ return self->lastElement; } +/* navigation */ + - (NSArray *)navPathElements { NSArray *traversalObjects; NSMutableArray *navPathComponents; diff --git a/SOGo/UI/Common/UIxSortButton.m b/SOGo/UI/Common/UIxSortButton.m new file mode 100644 index 00000000..931c4e55 --- /dev/null +++ b/SOGo/UI/Common/UIxSortButton.m @@ -0,0 +1,33 @@ +/* + Copyright (C) 2004 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ +// $Id: UIxSortButton.m 59 2004-06-22 13:40:19Z znek $ + +#include + +@interface UIxSortButton : WOComponent +{ +} + +@end + + +@implementation UIxSortButton +@end diff --git a/SOGo/UI/Common/UIxSortButton.wox b/SOGo/UI/Common/UIxSortButton.wox new file mode 100644 index 00000000..c4c1339a --- /dev/null +++ b/SOGo/UI/Common/UIxSortButton.wox @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/SOGo/UI/Common/images/downward_sorted.gif b/SOGo/UI/Common/images/downward_sorted.gif new file mode 100644 index 0000000000000000000000000000000000000000..bbaeab635b22ce9e9843b4593d6ef0e1a28851df GIT binary patch literal 118 zcmZ?wbhEHbjvdWYz>Xwni1ryrnBW!&=wQVNY|(y>G$triOpcN}+;FzgiM> WPi3dPi0C=|pvYlu)an)%25SKL3@qaS literal 0 HcmV?d00001 diff --git a/SOGo/UI/Common/images/upward_sorted.gif b/SOGo/UI/Common/images/upward_sorted.gif new file mode 100644 index 0000000000000000000000000000000000000000..db69529a51842cd97ebf46e859ead60af229e414 GIT binary patch literal 117 zcmZ?wbhEHbT P)v{bzVPfUMz+epk#;_+z literal 0 HcmV?d00001 diff --git a/SOGo/UI/Common/product.plist b/SOGo/UI/Common/product.plist index 845fc192..bef3edcb 100644 --- a/SOGo/UI/Common/product.plist +++ b/SOGo/UI/Common/product.plist @@ -20,7 +20,10 @@ tab_.gif, corner_right.gif, closewindow.gif, - OGoLogo.gif + OGoLogo.gif, + upward_sorted.gif, + downward_sorted.gif, + non_sorted.gif ); factories = { diff --git a/SOGo/UI/Contacts/ChangeLog b/SOGo/UI/Contacts/ChangeLog index 97f46b64..0ac3348c 100644 --- a/SOGo/UI/Contacts/ChangeLog +++ b/SOGo/UI/Contacts/ChangeLog @@ -1,5 +1,7 @@ 2004-08-27 Helge Hess + * UIxContactsListView: added simple sorting (v0.9.5) + * first working version of contacts UI (v0.9.4) * removed GET from product.plist, the SoObject directly implements GET diff --git a/SOGo/UI/Contacts/UIxContactsListView.m b/SOGo/UI/Contacts/UIxContactsListView.m index 0b6f09b7..44f5b49e 100644 --- a/SOGo/UI/Contacts/UIxContactsListView.m +++ b/SOGo/UI/Contacts/UIxContactsListView.m @@ -30,6 +30,7 @@ @end +#include #include "common.h" @implementation UIxContactsListView @@ -48,6 +49,37 @@ return self->contact; } +- (NSString *)defaultSortKey { + return @"sn"; +} +- (NSString *)sortKey { + NSString *s; + + s = [[[self context] request] formValueForKey:@"sort"]; + return [s length] > 0 ? s : [self defaultSortKey]; +} + +static int sortDicts(id left, id right, void *ctx) { + id v1, v2; + + v1 = [left valueForKey:ctx]; + v2 = [right valueForKey:ctx]; + return [v1 caseInsensitiveCompare:v2]; +} + +- (NSArray *)contactInfos { + NSString *sort; + NSArray *records; + + // TODO: should be done in the backend, but for Agenor AB its OK here + sort = [self sortKey]; + + records = [[self clientObject] fetchCoreInfos]; + if ([sort length] > 0) + records = [records sortedArrayUsingFunction:sortDicts context:sort]; + return records; +} + /* notifications */ - (void)sleep { diff --git a/SOGo/UI/Contacts/UIxContactsListView.wox b/SOGo/UI/Contacts/UIxContactsListView.wox index fa03ffbe..77a533af 100644 --- a/SOGo/UI/Contacts/UIxContactsListView.wox +++ b/SOGo/UI/Contacts/UIxContactsListView.wox @@ -71,14 +71,41 @@ - - - - - + + + + + - +
LastnameFirstnameEmailPhoneLocation + + Lastname + + + Lastname + + + + Firstname + + + Firstname + + + + EMail + + + Email + + + Phone + + Location +