]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1117 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 23 Jul 2007 13:56:28 +0000 (13:56 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 23 Jul 2007 13:56:28 +0000 (13:56 +0000)
14 files changed:
Apache/SOGo.conf
ChangeLog
NEWS
SOGo.conf [deleted file]
SoObjects/Appointments/NSArray+Appointments.m
SoObjects/Appointments/SOGoAppointmentFolder.m
SoObjects/Contacts/SOGoContactGCSFolder.m
SoObjects/SOGo/NSString+Utilities.h
SoObjects/SOGo/NSString+Utilities.m
SoObjects/SOGo/SOGoFolder.h
SoObjects/SOGo/SOGoFolder.m
UI/MainUI/SOGoUserHomePage.m
UI/PreferencesUI/UIxPreferences.m
UI/Templates/PreferencesUI/UIxPreferences.wox

index 11066ef7276b2ab63839951b902e8aa66bcb06e5..5e835ecc099f33e6056d1fd30f12c4d68b3a2773 100644 (file)
@@ -4,6 +4,27 @@ Alias /SOGo.woa/WebServerResources/ \
       /usr/GNUstep/System/Library/SOGo-0.9/WebServerResources/
 Alias /SOGO.woa/WebServerResources/ \
       /usr/GNUstep/System/Library/SOGo-0.9/WebServerResources/
+
+<LocationMatch "^/SOGo/so/ControlPanel/Products/.*UI/Resources/.*jpg">
+  SetHandler default-handler
+</LocationMatch>
+
+<LocationMatch "^/SOGo/so/ControlPanel/Products/.*UI/Resources/.*png">
+  SetHandler default-handler
+</LocationMatch>
+
+<LocationMatch "^/SOGo/so/ControlPanel/Products/.*UI/Resources/.*gif">
+  SetHandler default-handler
+</LocationMatch>
+
+<LocationMatch "^/SOGo/so/ControlPanel/Products/.*UI/Resources/.*css">
+  SetHandler default-handler
+</LocationMatch>
+
+<LocationMatch "^/SOGo/so/ControlPanel/Products/.*UI/Resources/.*js">
+  SetHandler default-handler
+</LocationMatch>
+
 AliasMatch /SOGo/so/ControlPanel/Products/(.*)/Resources/(.*) \
            /usr/GNUstep/System/Library/SOGo-0.9/$1.SOGo/Resources/$2
 
index b0c5f04e1e81978db009c0ea2a260cb8d02a9ce9..8c87a9450b4db452e680498f5faf84d348d83a6e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,41 @@
+2007-07-22  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
+
+       * SoObjects/Contacts/SOGoContactGCSFolder.m ([SOGoContactGCSFolder -davNamespaces]): added new overriden
+       method that declares the DAV namespace related to CardDAV.
+       ([SOGoContactGCSFolder -davComplianceClassesInContext:]): new
+       method that declares the "access-control" and "addressbook-access"
+       classes to the list.
+
+       * SoObjects/Appointments/SOGoAppointmentFolder.m
+       ([-lookupActionForCalDAVMethod:]): removed method.
+       ([SOGoAppointmentFolder -davNamespaces]): added new overriden
+       method that declares the DAV namespace related to CalDAV.
+
+       * SoObjects/SOGo/SOGoFolder.m ([SOGoFolder -davNamespaces]): new
+       optional method for subclasses which handle specific extensions to
+       the DAV protocol: CardDAV or CalDAV.
+       ([SOGoFolder
+       -lookupName:lookupNameinContext:localContextacquire:acquire]):
+       new overriden method that handles dav invocations for extensions
+       to DAV by returning an appropriate SoSelectorInvocation.
+
+       * SoObjects/SOGo/NSString+Utilities.m ([NSString
+       -asDavInvocation]): new method returning a dictionary with a "ns"
+       key representing the dav namespace and a "method" key representing
+       the dav method name of the request.
+
+       * UI/PreferencesUI/UIxPreferences.m ([UIxPreferences
+       +initialize]): scan the value of SOGoUIxUserCanChangePassword.
+       Default is "no".
+       ([UIxPreferences -shouldDisplayPasswordChange]): new template
+       method that returns the value of SOGoUIxUserCanChangePassword.
+
+       * UI/MainUI/SOGoUserHomePage.m ([SOGoUserHomePage +initialize]):
+       scan the value of SOGoUIxDefaultModule. If not set, the default
+       module defaults to "Calendar".
+       ([SOGoUserHomePage -defaultAction]): redirect the user to the
+       value of "SOGoUIxDefaultModule".
+
 2007-07-20  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
 
        * UI/Contacts/UIxContactsListView.m ([UIxContactsListView
diff --git a/NEWS b/NEWS
index 2bb7b299acb5fef8a6bf96bdc906cf3b5b6a8696..d26220fc3cc507733b0e0d59f538cc2ca106720f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,11 @@
 0.9.0-20070xxx
 --------------
+- added the ability to choose the default module from the
+  application settings: "Calendars", "Contacts" or "Mail";
+- added the ability to show or hide the password change dialog from the
+  application settings;
 - put a work-around in the LDAP directory code to avoid fetching all the
-  entries whenever a specific one is being requested.
+  entries whenever a specific one is being requested;
 
 0.9.0-20070713
 --------------
diff --git a/SOGo.conf b/SOGo.conf
deleted file mode 100644 (file)
index 3c63ad1..0000000
--- a/SOGo.conf
+++ /dev/null
@@ -1,26 +0,0 @@
-# SOGo config
-
-AliasMatch /SOGo/so/ControlPanel/Products/(.*)/Resources/(.*) \
-       /Users/helge/GNUstep/Library/SOGo/$1.SOGo/Contents/Resources/$2
-
-<LocationMatch "^/SOGo*">
-SetHandler ngobjweb-adaptor
-SetAppPort 25000
-</LocationMatch>
-
-<LocationMatch "^/SOGo/so/ControlPanel/Products/.*UI/Resources/.*png">
-SetHandler default-handler
-</LocationMatch>
-
-<LocationMatch "^/SOGo/so/ControlPanel/Products/.*UI/Resources/.*gif">
-SetHandler default-handler
-</LocationMatch>
-
-<LocationMatch "^/SOGo/so/ControlPanel/Products/.*UI/Resources/.*css">
-SetHandler default-handler
-</LocationMatch>
-
-<LocationMatch "^/SOGo/so/ControlPanel/Products/.*UI/Resources/.*js">
-SetHandler default-handler
-</LocationMatch>
-
index 7f0f911457489b29a18891a01a5c6e5d60b97d77..f3915a014702a6638da7aee1a12a8ffafc278e91 100644 (file)
 
 @implementation NSMutableArray (iCalPersonConvenience)
 
-- (void)removePerson: (iCalPerson *)_person {
+- (void) removePerson: (iCalPerson *) _person
+{
   int i;
-  
-  for (i = [self count] - 1; i >= 0; i--) {
-    iCalPerson *p;
+  iCalPerson *p;
     
-    p = [self objectAtIndex:i];
-    if ([p hasSameEmailAddress:_person])
-      [self removeObjectAtIndex:i];
-  }
+  for (i = [self count] - 1; i >= 0; i--)
+    {
+      p = [self objectAtIndex: i];
+      if ([p hasSameEmailAddress: _person])
+       [self removeObjectAtIndex: i];
+    }
 }
 
 @end
index 4e7257c302a450ee68d4efddf144a46bc794aa5d..8cc9c45d2e570853b6c1b3be70a6f30f1391d7ad 100644 (file)
@@ -21,7 +21,6 @@
 
 #import <GDLContentStore/GCSFolder.h>
 #import <NGCards/NGCards.h>
-#import <NGObjWeb/SoObject+SoDAV.h>
 #import <NGObjWeb/WOContext.h>
 #import <NGObjWeb/WOMessage.h>
 #import <NGExtensions/NGCalendarDateRange.h>
@@ -32,7 +31,6 @@
 #import <SOGo/SOGoCustomGroupFolder.h>
 #import <SOGo/LDAPUserManager.h>
 #import <SOGo/SOGoPermissions.h>
-#import <SOGo/NSString+Utilities.h>
 #import <SOGo/SOGoUser.h>
 
 #import "common.h"
@@ -135,21 +133,6 @@ static NSNumber   *sharedYes = nil;
   return ([_key length] != 0);
 }
 
-- (id) lookupActionForCalDAVMethod: (NSString *)_key
-{
-  SoSelectorInvocation *invocation;
-  NSString *name;
-
-  name = [NSString stringWithFormat: @"%@:", [_key davMethodToObjC]];
-
-  invocation = [[SoSelectorInvocation alloc]
-                 initWithSelectorNamed: name
-                 addContextParameter: YES];
-  [invocation autorelease];
-
-  return invocation;
-}
-
 - (void) appendObject: (NSDictionary *) object
           withBaseURL: (NSString *) baseURL
      toREPORTResponse: (WOResponse *) r
@@ -280,6 +263,11 @@ static NSNumber   *sharedYes = nil;
     }
 }
 
+- (NSArray *) davNamespaces
+{
+  return [NSArray arrayWithObject: @"urn:ietf:params:xml:ns:caldav"];
+}
+
 - (id) davCalendarQuery: (id) queryContext
 {
   WOResponse *r;
@@ -376,10 +364,7 @@ static NSNumber   *sharedYes = nil;
       obj = [super lookupName:_key inContext:_ctx acquire:NO];
       if (!obj)
         {
-          if ([_key hasPrefix: @"{urn:ietf:params:xml:ns:caldav}"])
-            obj
-              = [self lookupActionForCalDAVMethod: [_key substringFromIndex: 31]];
-          else if ([self isValidAppointmentName:_key])
+         if ([self isValidAppointmentName:_key])
             {
               url = [[[_ctx request] uri] urlWithoutParameters];
               if ([url hasSuffix: @"AsTask"])
index 04263df9ebc7eb24804ea08146f3ab64ecc3a06c..df3f08341a660759f73104ff962d88568d6f95ab 100644 (file)
   02111-1307, USA.
 */
 
+#import <Foundation/NSArray.h>
+#import <Foundation/NSString.h>
+#import <NGObjWeb/NSException+HTTP.h>
+#import <NGObjWeb/SoObject+SoDAV.h>
+#import <NGObjWeb/WOContext.h>
+#import <NGObjWeb/WORequest.h>
+#import <NGExtensions/NSObject+Logs.h>
+#import <EOControl/EOQualifier.h>
+#import <EOControl/EOSortOrdering.h>
 #import <GDLContentStore/GCSFolder.h>
 
-#import "common.h"
-
 #import "SOGoContactGCSEntry.h"
 #import "SOGoContactGCSFolder.h"
 
   return records;
 }
 
+- (NSArray *) davNamespaces
+{
+  return [NSArray arrayWithObject: @"urn:ietf:params:xml:ns:carddav"];
+}
+
+- (NSArray *) davComplianceClassesInContext: (id)_ctx
+{
+  NSMutableArray *classes;
+  NSArray *primaryClasses;
+
+  classes = [NSMutableArray new];
+  [classes autorelease];
+
+  primaryClasses = [super davComplianceClassesInContext: _ctx];
+  if (primaryClasses)
+    [classes addObjectsFromArray: primaryClasses];
+  [classes addObject: @"access-control"];
+  [classes addObject: @"addressbook-access"];
+
+  return classes;
+}
+
 - (NSString *) groupDavResourceType
 {
   return @"vcard-collection";
index 29679f53218ebb224ce3534c56ebb0605d9fa506..31c913ef608ff556bb80fb50843172b4c2f95edb 100644 (file)
@@ -37,6 +37,7 @@
 - (NSString *) urlWithoutParameters;
 
 - (NSString *) davMethodToObjC;
+- (NSDictionary *) asDavInvocation;
 
 - (NSString *) stringByDetectingURLs;
 
index 6a93540dc6ae9f8a7141edb185b7a095316992ea..2f1d617c0b1b43c915d81c84e8b8470fca075413 100644 (file)
@@ -108,6 +108,35 @@ static NSMutableCharacterSet *urlAfterEndingChars = nil;
   return newName;
 }
 
+- (NSDictionary *) asDavInvocation
+{
+  NSMutableDictionary *davInvocation;
+  NSRange nsEnclosing, methodEnclosing;
+  unsigned int length;
+
+  davInvocation = nil;
+  if ([self hasPrefix: @"{"])
+    {
+      nsEnclosing = [self rangeOfString: @"}"];
+      length = [self length];
+      if (nsEnclosing.length > 0
+         && nsEnclosing.location < (length - 1))
+       {
+         methodEnclosing = NSMakeRange(nsEnclosing.location + 1,
+                                       length - nsEnclosing.location - 1);
+         nsEnclosing.length = nsEnclosing.location - 1;
+         nsEnclosing.location = 1;
+         davInvocation = [NSMutableDictionary dictionaryWithCapacity: 2];
+         [davInvocation setObject: [self substringWithRange: nsEnclosing]
+                        forKey: @"ns"];
+         [davInvocation setObject: [self substringWithRange: methodEnclosing]
+                        forKey: @"method"];
+       }
+    }
+
+  return davInvocation;
+}
+
 - (NSRange) _rangeOfURLInRange: (NSRange) refRange
 {
   int start, length;
index f4263b69b5e71aaba4240dba946dcf8bc96b0338..5358299d37c72669875585ca8016daac126e360c 100644 (file)
@@ -73,6 +73,9 @@
 - (BOOL) create;
 - (NSException *) delete;
 
+/* dav */
+- (NSArray *) davNamespaces;
+
 /* acls as a container */
 - (NSArray *) aclUsersForObjectAtPath: (NSArray *) objectPathArray;
 - (NSArray *) aclsForUser: (NSString *) uid
index 530a0e0efb1462e18efc7c40649927f2dd5c5c36..5b6f5d2c28ab377a048e305a8c5b5ff83fa13f82 100644 (file)
@@ -28,6 +28,8 @@
 #import <Foundation/NSURL.h>
 
 #import <NGObjWeb/SoObject.h>
+#import <NGObjWeb/SoObject+SoDAV.h>
+#import <NGObjWeb/SoSelectorInvocation.h>
 #import <NGObjWeb/WOContext+SoObjects.h>
 #import <NGExtensions/NSNull+misc.h>
 #import <NGExtensions/NSObject+Logs.h>
@@ -38,6 +40,8 @@
 #import <GDLContentStore/GCSFolderType.h>
 #import <SaxObjC/XMLNamespaces.h>
 
+#import "NSString+Utilities.h"
+
 #import "SOGoPermissions.h"
 #import "SOGoUser.h"
 
@@ -523,8 +527,48 @@ static NSString *defaultUserID = @"<default>";
   return [[self davURL] absoluteString];
 }
 
+- (id) lookupName: (NSString *) lookupName
+        inContext: (id) localContext
+          acquire: (BOOL) acquire
+{
+  id obj;
+  NSArray *davNamespaces;
+  NSDictionary *davInvocation;
+  NSString *objcMethod;
+
+  obj = [super lookupName: lookupName inContext: localContext
+              acquire: acquire];
+  if (!obj)
+    {
+      davNamespaces = [self davNamespaces];
+      if ([davNamespaces count] > 0)
+       {
+         davInvocation = [lookupName asDavInvocation];
+         if (davInvocation
+             && [davNamespaces
+                  containsObject: [davInvocation objectForKey: @"ns"]])
+           {
+             objcMethod = [[davInvocation objectForKey: @"method"]
+                            davMethodToObjC];
+             obj = [[SoSelectorInvocation alloc]
+                     initWithSelectorNamed:
+                       [NSString stringWithFormat: @"%@:", objcMethod]
+                     addContextParameter: YES];
+             [obj autorelease];
+           }
+       }
+    }
+
+  return obj;
+}
+
 /* WebDAV */
 
+- (NSArray *) davNamespaces
+{
+  return nil;
+}
+
 - (BOOL) davIsCollection
 {
   return [self isFolderish];
index 3b54ade19a60315619c039f9093ff7fd89985dfe..678698256621a4e41db91a4ac09205a63e2fd942 100644 (file)
 #import <Foundation/NSArray.h>
 #import <Foundation/NSCalendarDate.h>
 #import <Foundation/NSDictionary.h>
+#import <Foundation/NSURL.h>
+#import <Foundation/NSUserDefaults.h>
 #import <Foundation/NSValue.h>
 #import <NGObjWeb/WORequest.h>
 #import <NGObjWeb/WOResponse.h>
 #import <NGExtensions/NSCalendarDate+misc.h>
+#import <NGExtensions/NSObject+Logs.h>
 
 #import <Appointments/SOGoFreeBusyObject.h>
 #import <SOGo/SOGoUser.h>
 #import <SOGo/NSCalendarDate+SOGo.h>
 #import <SOGoUI/UIxComponent.h>
 
+static NSString *defaultModule;
+
 @interface SOGoUserHomePage : UIxComponent
 
 @end
 
 @implementation SOGoUserHomePage
 
++ (void) initialize
+{
+  NSUserDefaults *ud;
+
+  ud = [NSUserDefaults standardUserDefaults];
+  defaultModule = [ud stringForKey: @"SOGoUIxDefaultModule"];
+  if (defaultModule)
+    {
+      if (defaultModule)
+       {
+         if (!([defaultModule isEqualToString: @"Calendar"]
+               || [defaultModule isEqualToString: @"Contacts"]
+               || [defaultModule isEqualToString: @"Mail"]))
+           {
+             [self logWithFormat: @"default module '%@' not accepted (must be"
+                   @"'Calendar', 'Contacts' or Mail)", defaultModule];
+             defaultModule = @"Calendar";
+           }
+       }
+      else
+       defaultModule = @"Calendar";
+
+      [self logWithFormat: @"default module set to '%@'", defaultModule];
+      [defaultModule retain];
+    }
+}
+
 - (id <WOActionResults>) defaultAction
 {
-  NSString *baseURL, *url;
+  SOGoUserFolder *co;
+  NSURL *moduleURL;
 
-  baseURL = [[context request] uri];
-  url = [baseURL stringByAppendingString:@"/../Calendar"];
+  co = [self clientObject];
+  moduleURL = [NSURL URLWithString: defaultModule
+                    relativeToURL: [co soURL]];
 
-  return [self redirectToLocation: url];
+  return [self redirectToLocation: [moduleURL absoluteString]];
 }
 
 - (void) _fillFreeBusyItems: (NSMutableArray *) items
index 2c8c486b8744f596a31720d056eaf6447e6bca99..5799e82dcdfec4e4b845b0f132ea3e39052a0d9a 100644 (file)
    workweek = from -> to
    identities */
 
+static BOOL shouldDisplayPasswordChange = NO;
+
 @implementation UIxPreferences
 
++ (void) initialize
+{
+  NSUserDefaults *ud;
+
+  ud = [NSUserDefaults standardUserDefaults];
+  shouldDisplayPasswordChange
+    = [ud boolForKey: @"SOGoUIxUserCanChangePassword"];
+}
+
 - (id) init
 {
   NSDictionary *locale;
   return [[request method] isEqualToString: @"POST"];
 }
 
+- (BOOL) shouldDisplayPasswordChange
+{
+  return shouldDisplayPasswordChange;
+}
+
 @end
index 223c86b7f400a8adc1cfb80f9b5da1f6dd4d64f4..6d97ce4a35a6bb83bf3878d3672cf470778b85e6 100644 (file)
@@ -19,7 +19,9 @@
            label:value="Date and Time"/></li>
        <li target="calendarOptionsView"><var:string
            label:value="Calendar Options"/></li>
-       <li target="passwordView"><var:string label:value="Password"/></li>
+       <var:if condition="shouldDisplayPasswordChange">
+         <li target="passwordView"><var:string label:value="Password"/></li>
+       </var:if>
       </ul>
       <div id="outOfOfficeView" class="tab">
        <label><input
          <var:popup list="reminderTimesList" item="item"
            string="itemReminderTimeText" selection="userReminderTime"/></label>
       </div>
-      <div id="passwordView" class="tab">
-       <label><var:string label:value="New password:"
-           /><input type="text" class="textField"
-           const:enabled="disabled"
-           var:value="newPassword"/></label><br/>
-       <label><var:string label:value="Confirmation:"
-           /><input type="text" class="textField"
-           const:enabled="disabled"
-           var:value="newPasswordConfirmation"/></label><br/>
-       <input type="button" class="button"
-         id="changePasswordBtn" label:value="Change"/>
-      </div>
+      <var:if condition="shouldDisplayPasswordChange">
+       <div id="passwordView" class="tab">
+         <label><var:string label:value="New password:"
+             /><input type="text" class="textField"
+             const:enabled="disabled"
+             var:value="newPassword"/></label><br/>
+         <label><var:string label:value="Confirmation:"
+             /><input type="text" class="textField"
+             const:enabled="disabled"
+             var:value="newPasswordConfirmation"/></label><br/>
+         <input type="button" class="button"
+           id="changePasswordBtn" label:value="Change"/>
+       </div>
+      </var:if>
     </div>
   </form>
 </var:component>