From: helge Date: Fri, 27 Aug 2004 03:51:08 +0000 (+0000) Subject: added sorting to addressbook X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a57f9d2380af6ba316195b70aa15b0b14220042;p=scalable-opengroupware.org added sorting to addressbook git-svn-id: http://svn.opengroupware.org/SOGo/trunk@281 d1b88da0-ebda-0310-925b-ed51d893ca5b --- 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 00000000..bbaeab63 Binary files /dev/null and b/SOGo/UI/Common/images/downward_sorted.gif differ diff --git a/SOGo/UI/Common/images/non_sorted.gif b/SOGo/UI/Common/images/non_sorted.gif new file mode 100644 index 00000000..d3da7661 Binary files /dev/null and b/SOGo/UI/Common/images/non_sorted.gif differ diff --git a/SOGo/UI/Common/images/upward_sorted.gif b/SOGo/UI/Common/images/upward_sorted.gif new file mode 100644 index 00000000..db69529a Binary files /dev/null and b/SOGo/UI/Common/images/upward_sorted.gif differ 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 +