Merge pull request #39 from alexcloutier/fix/publicFolder_ConfigNaming

Added new SOGo configurable variable
This commit is contained in:
extrafu
2014-05-26 13:24:50 -04:00
6 changed files with 40 additions and 20 deletions
+2
View File
@@ -85,4 +85,6 @@
$label4 = ("To Do", "#3333FF");
$label5 = ("Later", "#993399");
};
SOGoSubscriptionFolderFormat = "%{FolderName} (%{UserName} <%{Email}>)";
}
+1
View File
@@ -67,6 +67,7 @@
- (NSArray *) calendarDefaultRoles;
- (NSArray *) contactsDefaultRoles;
- (NSArray *) mailPollingIntervals;
- (NSString *) subscriptionFolderFormat;
- (NSString *) calendarDefaultCategoryColor;
+6 -1
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.
+1
View File
@@ -53,6 +53,7 @@
NSString *ocsPath;
GCSFolder *ocsFolder;
NSMutableDictionary *childRecords;
NSMutableDictionary *folderSubscriptionValues;
BOOL userCanAccessAllObjects; /* i.e. user obtains 'Access Object' on
subobjects */
}
+29 -18
View File
@@ -196,6 +196,7 @@ static NSArray *childRecordFields = nil;
ocsPath = nil;
ocsFolder = nil;
childRecords = [NSMutableDictionary new];
folderSubscriptionValues = nil;
userCanAccessAllObjects = NO;
}
@@ -207,6 +208,7 @@ static NSArray *childRecordFields = nil;
[ocsFolder release];
[ocsPath release];
[childRecords release];
[folderSubscriptionValues release];
[super dealloc];
}
@@ -275,29 +277,38 @@ 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];
}
}
}
/* This method fetches the display name defined by the owner, but is also the
@@ -238,7 +238,7 @@ function onConfirmFolderSelection(event) {
var email = (user.innerHTML
.replace("&lt;", "<", "g")
.replace("&gt;", ">", "g"));
folderName = resource.innerHTML + ' (' + email + ')';
folderName = resource.innerHTML;
folderName = folderName.replace(/>,.*(\))?$/, ">)$1", "g");
}