Merge pull request #237 from zentyal/jgarcia/contacts-all-2
Fix contact listing properly
This commit is contained in:
commit
aac9cd7c07
|
@ -353,26 +353,15 @@
|
|||
NSArray *records, *result;
|
||||
EOSortOrdering *ordering;
|
||||
|
||||
result = nil;
|
||||
|
||||
if (([filter length] > 0 && [criteria isEqualToString: @"name_or_address"])
|
||||
|| ![source listRequiresDot])
|
||||
{
|
||||
records = [source fetchContactsMatching: filter
|
||||
inDomain: domain];
|
||||
[childRecords setObjects: records
|
||||
forKeys: [records objectsForKey: @"c_name"
|
||||
notFoundMarker: nil]];
|
||||
records = [self _flattenedRecords: records];
|
||||
ordering
|
||||
= [EOSortOrdering sortOrderingWithKey: sortKey
|
||||
selector: ((sortOrdering == NSOrderedDescending)
|
||||
? EOCompareCaseInsensitiveDescending
|
||||
: EOCompareCaseInsensitiveAscending)];
|
||||
result
|
||||
= [records sortedArrayUsingKeyOrderArray:
|
||||
[NSArray arrayWithObject: ordering]];
|
||||
}
|
||||
records = [source fetchContactsMatching: filter inDomain: domain];
|
||||
[childRecords setObjects: records forKeys: [records objectsForKey: @"c_name"
|
||||
notFoundMarker: nil]];
|
||||
records = [self _flattenedRecords: records];
|
||||
ordering = [EOSortOrdering sortOrderingWithKey: sortKey
|
||||
selector: ((sortOrdering == NSOrderedDescending)
|
||||
? EOCompareCaseInsensitiveDescending
|
||||
: EOCompareCaseInsensitiveAscending)];
|
||||
result = [records sortedArrayUsingKeyOrderArray: [NSArray arrayWithObject: ordering]];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -65,8 +65,6 @@
|
|||
NSString *SieveHostField;
|
||||
NSArray *bindFields;
|
||||
|
||||
BOOL listRequiresDot;
|
||||
|
||||
NSString *domain;
|
||||
NSString *contactInfoAttribute;
|
||||
|
||||
|
|
|
@ -110,7 +110,6 @@ static Class NSStringK;
|
|||
_scope = @"sub";
|
||||
_filter = nil;
|
||||
_userPasswordAlgorithm = nil;
|
||||
listRequiresDot = YES;
|
||||
|
||||
searchAttributes = nil;
|
||||
passwordPolicy = NO;
|
||||
|
@ -201,9 +200,6 @@ static Class NSStringK;
|
|||
kindField: [udSource objectForKey: @"KindFieldName"]
|
||||
andMultipleBookingsField: [udSource objectForKey: @"MultipleBookingsFieldName"]];
|
||||
|
||||
dotValue = [udSource objectForKey: @"listRequiresDot"];
|
||||
if (dotValue)
|
||||
[self setListRequiresDot: [dotValue boolValue]];
|
||||
[self setContactMapping: [udSource objectForKey: @"mapping"]
|
||||
andObjectClasses: [udSource objectForKey: @"objectClasses"]];
|
||||
|
||||
|
@ -371,16 +367,6 @@ groupObjectClasses: (NSArray *) newGroupObjectClasses
|
|||
ASSIGN(multipleBookingsField, [newMultipleBookingsField lowercaseString]);
|
||||
}
|
||||
|
||||
- (void) setListRequiresDot: (BOOL) aBool
|
||||
{
|
||||
listRequiresDot = aBool;
|
||||
}
|
||||
|
||||
- (BOOL) listRequiresDot
|
||||
{
|
||||
return listRequiresDot;
|
||||
}
|
||||
|
||||
- (void) setContactMapping: (NSDictionary *) newMapping
|
||||
andObjectClasses: (NSArray *) newObjectClasses
|
||||
{
|
||||
|
@ -790,15 +776,13 @@ groupObjectClasses: (NSArray *) newGroupObjectClasses
|
|||
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat: qs];
|
||||
}
|
||||
else if (!listRequiresDot)
|
||||
else
|
||||
{
|
||||
qs = [NSMutableString stringWithFormat: @"(%@='*')", CNField];
|
||||
if ([_filter length])
|
||||
[qs appendFormat: @" AND %@", _filter];
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat: qs];
|
||||
}
|
||||
else
|
||||
qualifier = nil;
|
||||
|
||||
return qualifier;
|
||||
}
|
||||
|
@ -1189,29 +1173,25 @@ groupObjectClasses: (NSArray *) newGroupObjectClasses
|
|||
|
||||
contacts = [NSMutableArray array];
|
||||
|
||||
if ([match length] > 0 || !listRequiresDot)
|
||||
{
|
||||
ldapConnection = [self _ldapConnection];
|
||||
qualifier = [self _qualifierForFilter: match];
|
||||
// attributes = [self _searchAttributes];
|
||||
attributes = [NSArray arrayWithObject: @"*"];
|
||||
ldapConnection = [self _ldapConnection];
|
||||
qualifier = [self _qualifierForFilter: match];
|
||||
// attributes = [self _searchAttributes];
|
||||
attributes = [NSArray arrayWithObject: @"*"];
|
||||
|
||||
if ([_scope caseInsensitiveCompare: @"BASE"] == NSOrderedSame)
|
||||
entries = [ldapConnection baseSearchAtBaseDN: baseDN
|
||||
qualifier: qualifier
|
||||
attributes: attributes];
|
||||
else if ([_scope caseInsensitiveCompare: @"ONE"] == NSOrderedSame)
|
||||
entries = [ldapConnection flatSearchAtBaseDN: baseDN
|
||||
qualifier: qualifier
|
||||
attributes: attributes];
|
||||
else /* we do it like before */
|
||||
entries = [ldapConnection deepSearchAtBaseDN: baseDN
|
||||
qualifier: qualifier
|
||||
attributes: attributes];
|
||||
while ((currentEntry = [entries nextObject]))
|
||||
[contacts addObject:
|
||||
[self _convertLDAPEntryToContact: currentEntry]];
|
||||
}
|
||||
if ([_scope caseInsensitiveCompare: @"BASE"] == NSOrderedSame)
|
||||
entries = [ldapConnection baseSearchAtBaseDN: baseDN
|
||||
qualifier: qualifier
|
||||
attributes: attributes];
|
||||
else if ([_scope caseInsensitiveCompare: @"ONE"] == NSOrderedSame)
|
||||
entries = [ldapConnection flatSearchAtBaseDN: baseDN
|
||||
qualifier: qualifier
|
||||
attributes: attributes];
|
||||
else /* we do it like before */
|
||||
entries = [ldapConnection deepSearchAtBaseDN: baseDN
|
||||
qualifier: qualifier
|
||||
attributes: attributes];
|
||||
while ((currentEntry = [entries nextObject]))
|
||||
[contacts addObject: [self _convertLDAPEntryToContact: currentEntry]];
|
||||
|
||||
return contacts;
|
||||
}
|
||||
|
@ -1721,7 +1701,6 @@ _makeLDAPChanges (NGLdapConnection *ldapConnection,
|
|||
bindFields: nil
|
||||
kindField: nil
|
||||
andMultipleBookingsField: nil];
|
||||
[ab setListRequiresDot: NO];
|
||||
[ab setModifiers: modifier];
|
||||
[sources addObject: ab];
|
||||
[ab release];
|
||||
|
|
|
@ -41,10 +41,6 @@
|
|||
|
||||
- (NSString *) domain;
|
||||
|
||||
/* requires a "." to obtain the full list of contacts */
|
||||
- (void) setListRequiresDot: (BOOL) aBool;
|
||||
- (BOOL) listRequiresDot;
|
||||
|
||||
- (BOOL) checkLogin: (NSString *) _login
|
||||
password: (NSString *) _pwd
|
||||
perr: (SOGoPasswordPolicyError *) _perr
|
||||
|
|
|
@ -851,17 +851,6 @@
|
|||
return _sourceID;
|
||||
}
|
||||
|
||||
- (void) setListRequiresDot: (BOOL) newListRequiresDot
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL) listRequiresDot
|
||||
{
|
||||
/* This method is not implemented for SQLSource. It must enable a mechanism
|
||||
where using "." is not required to list the content of addressbooks. */
|
||||
return YES;
|
||||
}
|
||||
|
||||
/* card editing */
|
||||
- (void) setModifiers: (NSArray *) newModifiers
|
||||
{
|
||||
|
|
|
@ -24,8 +24,6 @@ function openContactsFolder(contactsFolder, reload, idx) {
|
|||
if (searchValue && searchValue.length > 0)
|
||||
url += ("&search=" + search["contacts"]["criteria"]
|
||||
+ "&value=" + escape(searchValue.utf8encode()));
|
||||
else
|
||||
url += "&search=name_or_address&value=.";
|
||||
var sortAttribute = sorting["attribute"];
|
||||
if (sortAttribute && sortAttribute.length > 0)
|
||||
url += ("&sort=" + sorting["attribute"]
|
||||
|
|
Loading…
Reference in a new issue