Added new SOGo configurable variable for which you can change the default display when adding a shared calendar or a shared addressBook

pull/39/head
Alexandre Cloutier 2014-05-20 17:05:13 -04:00
parent c426afd7f2
commit 064565e1a9
5 changed files with 41 additions and 19 deletions

View File

@ -85,4 +85,6 @@
$label4 = ("To Do", "#3333FF");
$label5 = ("Later", "#993399");
};
SOGoSubscriptionFolderFormat = "%{FolderName} (%{UserName} <%{Email}>)";
}

View File

@ -67,6 +67,7 @@
- (NSArray *) calendarDefaultRoles;
- (NSArray *) contactsDefaultRoles;
- (NSArray *) mailPollingIntervals;
- (NSString *) subscriptionFolderFormat;
- (NSString *) calendarDefaultCategoryColor;

View File

@ -1,6 +1,6 @@
/* SOGoDomainDefaults.m - this file is part of SOGo
*
* Copyright (C) 2009-2012 Inverse inc.
* Copyright (C) 2009-2014 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
@ -176,6 +176,11 @@
return [self stringArrayForKey: @"SOGoContactsDefaultRoles"];
}
- (NSString *) subscriptionFolderFormat
{
return [self stringForKey: @"SOGoSubscriptionFolderFormat"];
}
//
// In v2.0.4, SOGoForceIMAPLoginWithEmail was renamed to SOGoForceExternalLoginWithEmail
// but we keep backward compatbility for now with previous versions.

View File

@ -53,6 +53,7 @@
NSString *ocsPath;
GCSFolder *ocsFolder;
NSMutableDictionary *childRecords;
NSMutableDictionary *folderSubscriptionValues;
BOOL userCanAccessAllObjects; /* i.e. user obtains 'Access Object' on
subobjects */
}

View File

@ -207,6 +207,7 @@ static NSArray *childRecordFields = nil;
[ocsFolder release];
[ocsPath release];
[childRecords release];
[folderSubscriptionValues release];
[super dealloc];
}
@ -275,29 +276,41 @@ static NSArray *childRecordFields = nil;
{
NSString *primaryDN;
NSDictionary *ownerIdentity;
NSString *subjectFormat;
SOGoDomainDefaults *dd;
primaryDN = [row objectForKey: @"c_foldername"];
if ([primaryDN length])
{
displayName = [NSMutableString new];
if ([primaryDN isEqualToString: [container defaultFolderName]])
[displayName appendString: [self labelForKey: primaryDN
inContext: context]];
else
[displayName appendString: primaryDN];
if (!activeUserIsOwner)
{
displayName = [NSMutableString new];
if ([primaryDN isEqualToString: [container defaultFolderName]])
[displayName appendString: [self labelForKey: primaryDN
inContext: context]];
else
[displayName appendString: primaryDN];
// We MUST NOT use SOGoUser instances here (by calling -primaryIdentity)
// as it'll load user defaults and user settings which is _very costly_
// since it involves JSON parsing and database requests
ownerIdentity = [[SOGoUserManager sharedUserManager]
contactInfosForUserWithUIDorEmail: owner];
if (!activeUserIsOwner)
{
// We MUST NOT use SOGoUser instances here (by calling -primaryIdentity)
// as it'll load user defaults and user settings which is _very costly_
// since it involves JSON parsing and database requests
ownerIdentity = [[SOGoUserManager sharedUserManager]
contactInfosForUserWithUIDorEmail: owner];
[displayName appendFormat: @" (%@ <%@>)", [ownerIdentity objectForKey: @"cn"],
[ownerIdentity objectForKey: @"c_email"]];
}
folderSubscriptionValues = [[NSMutableDictionary alloc] initWithObjectsAndKeys: displayName, @"FolderName",
[ownerIdentity objectForKey: @"cn"], @"UserName",
[ownerIdentity objectForKey: @"c_email"], @"Email", nil];
dd = [[context activeUser] domainDefaults];
subjectFormat = [dd subscriptionFolderFormat];
displayName = [folderSubscriptionValues keysWithFormat: subjectFormat];
[displayName retain];
/*[displayName appendFormat: @" (%@ <%@>)", [ownerIdentity objectForKey: @"cn"],
[ownerIdentity objectForKey: @"c_email"]];*/
}
}
}
/* This method fetches the display name defined by the owner, but is also the