]> err.no Git - scalable-opengroupware.org/commitdiff
added sorting to addressbook
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 27 Aug 2004 03:51:08 +0000 (03:51 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 27 Aug 2004 03:51:08 +0000 (03:51 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@281 d1b88da0-ebda-0310-925b-ed51d893ca5b

13 files changed:
SOGo/UI/Common/ChangeLog
SOGo/UI/Common/GNUmakefile
SOGo/UI/Common/UIxAppNavView.m
SOGo/UI/Common/UIxSortButton.m [new file with mode: 0644]
SOGo/UI/Common/UIxSortButton.wox [new file with mode: 0644]
SOGo/UI/Common/images/downward_sorted.gif [new file with mode: 0644]
SOGo/UI/Common/images/non_sorted.gif [new file with mode: 0644]
SOGo/UI/Common/images/upward_sorted.gif [new file with mode: 0644]
SOGo/UI/Common/product.plist
SOGo/UI/Contacts/ChangeLog
SOGo/UI/Contacts/UIxContactsListView.m
SOGo/UI/Contacts/UIxContactsListView.wox
SOGo/UI/Contacts/Version

index be46224a1c07005888da60a8c1ad5970d173c216..329b4053d7cc5bf6a9c2e94635bdfe04befc7721 100644 (file)
@@ -1,5 +1,7 @@
 2004-08-27  Helge Hess  <helge.hess@skyrix.com>
 
+       * started UIxSortButton (v0.9.20)
+
        * v0.9.19
 
        * UIxPageFrame.wox: navigation below the line, app selection above
index 9155d634b071e918098bae047501855da36ad095..72fd5e4086936d4a90caeb9ba20a59af00b66ac7 100644 (file)
@@ -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
 
index 7aa13d650a077574d0f02e46fc915b8eed766405..8c14e154f6ebecea8bdd762feceb91066cc23546 100644 (file)
@@ -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 (file)
index 0000000..931c4e5
--- /dev/null
@@ -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 <NGObjWeb/NGObjWeb.h>
+
+@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 (file)
index 0000000..c4c1339
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version='1.0' standalone='yes'?>
+<span xmlns="http://www.w3.org/1999/xhtml"
+   xmlns:var="http://www.skyrix.com/od/binding"
+   xmlns:const="http://www.skyrix.com/od/constant"
+   xmlns:rsrc="OGo:url"
+>
+  <!--
+    The resource cannot be found, for unknown reasons ...
+  -->
+  <img filename="non_sorted.gif" border="0" />
+</span>
\ 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 (file)
index 0000000..bbaeab6
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 (file)
index 0000000..d3da766
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 (file)
index 0000000..db69529
Binary files /dev/null and b/SOGo/UI/Common/images/upward_sorted.gif differ
index 845fc192ef00119315641ebfe218c0d2159dda3d..bef3edcbb0b44c0a61cc7d2c6e19d5bd03056d33 100644 (file)
     tab_.gif,
     corner_right.gif,
     closewindow.gif,
-    OGoLogo.gif
+    OGoLogo.gif,
+    upward_sorted.gif,
+    downward_sorted.gif,
+    non_sorted.gif
   );
   
   factories = {
index 97f46b645373339d122d02da2cef52df5691c854..0ac3348c6b7e503db7eaba589f7da15a81f92516 100644 (file)
@@ -1,5 +1,7 @@
 2004-08-27  Helge Hess  <helge.hess@skyrix.com>
 
+       * 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
index 0b6f09b772bb00b4f17a7f7501cc9afd7d05bfef..44f5b49e10c77370a763e35a27a09d61e3c5aee2 100644 (file)
@@ -30,6 +30,7 @@
 
 @end
 
+#include <Contacts/SOGoContactFolder.h>
 #include "common.h"
 
 @implementation UIxContactsListView
   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 {
index fa03ffbebf45c15da9d2d289ff2c66b4aa26b8aa..77a533af7fec2139d198c4ff2efd9ed36a4512ad 100644 (file)
                 <table border="0" width="100%" class="contacttableview">
                   <tr>
                     <!-- localize -->
-                    <th>Lastname</th>
-                    <th>Firstname</th>
-                    <th>Email</th>
-                    <th>Phone</th>
-                    <th>Location</th>
+                    <th>
+                      <var:if condition="sortKey" const:value="sn"
+                              const:negate="YES">
+                       <a href="?sort=sn">Lastname</a>
+                      </var:if>
+                      <var:if condition="sortKey" const:value="sn">
+                        <i>Lastname</i>
+                      </var:if>
+                    </th>
+                    <th>
+                      <var:if condition="sortKey" const:value="givenname"
+                              const:negate="YES">
+                       <a href="?sort=givenname">Firstname</a>
+                      </var:if>
+                      <var:if condition="sortKey" const:value="givenname">
+                        <i>Firstname</i>
+                      </var:if>
+                    </th>
+                    <th>
+                      <var:if condition="sortKey" const:value="mail"
+                              const:negate="YES">
+                       <a href="?sort=mail">EMail</a>
+                      </var:if>
+                      <var:if condition="sortKey" const:value="mail">
+                        <i>Email</i>
+                      </var:if>
+                    </th>
+                    <th>
+                     Phone
+                    </th>
+                    <th>
+                     Location
+                    </th>
                   </tr>
-                  <var:foreach list="clientObject.fetchCoreInfos" 
-                               item="contact">
+                  <var:foreach list="contactInfos" item="contact">
                     <tr>
                       <td>
                         <a var:href="contact.cName"
index 749d66dc7109fb3f49932aae8e0c044ad7d4e6c0..6b227f7e3b266ef9cc7a5dc1fd384537da8702c7 100644 (file)
@@ -1,3 +1,3 @@
 # $Id$
 
-SUBMINOR_VERSION:=4
+SUBMINOR_VERSION:=5