mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-04 21:08:51 +00:00
Desktop list editor, mobile contact editor
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSCalendarDate.h>
|
||||
|
||||
#import <NGObjWeb/NSException+HTTP.h>
|
||||
#import <NGObjWeb/SoPermissions.h>
|
||||
@@ -346,8 +347,9 @@ static Class SOGoContactGCSEntryK = Nil;
|
||||
CardElement *element;
|
||||
NSArray *elements, *values;
|
||||
NSMutableArray *units, *categories;
|
||||
NSCalendarDate *date;
|
||||
id o;
|
||||
unsigned int i;
|
||||
unsigned int i, year, month, day;
|
||||
|
||||
[card setNWithFamily: [attributes objectForKey: @"sn"]
|
||||
given: [attributes objectForKey: @"givenname"]
|
||||
@@ -355,7 +357,16 @@ static Class SOGoContactGCSEntryK = Nil;
|
||||
[card setNickname: [attributes objectForKey: @"nickname"]];
|
||||
[card setFn: [attributes objectForKey: @"fn"]];
|
||||
[card setTitle: [attributes objectForKey: @"title"]];
|
||||
[card setBday: [attributes objectForKey: @"birthday"]];
|
||||
|
||||
unsigned int seconds = [[NSString stringWithFormat: @"%@", [attributes objectForKey: @"birthday"]] intValue];
|
||||
if (seconds > 0)
|
||||
{
|
||||
date = [NSCalendarDate dateWithTimeIntervalSince1970: seconds];
|
||||
year = [date yearOfCommonEra];
|
||||
month = [date monthOfYear];
|
||||
day = [date dayOfMonth];
|
||||
[card setBday: [NSString stringWithFormat: @"%.4d%.2d%.2d", year, month, day]];
|
||||
}
|
||||
|
||||
if ([[attributes objectForKey: @"addresses"] isKindOfClass: [NSArray class]])
|
||||
{
|
||||
|
||||
@@ -89,8 +89,13 @@
|
||||
{
|
||||
id <SOGoContactFolder> folder;
|
||||
NSString *ascending, *searchText, *valueText;
|
||||
NSArray *results;
|
||||
NSMutableArray *filteredContacts;
|
||||
NSDictionary *contact;
|
||||
BOOL excludeLists;
|
||||
NSComparisonResult ordering;
|
||||
WORequest *rq;
|
||||
unsigned int i;
|
||||
|
||||
if (!contactInfos)
|
||||
{
|
||||
@@ -107,12 +112,31 @@
|
||||
else
|
||||
valueText = nil;
|
||||
|
||||
excludeLists = [[rq formValueForKey: @"excludeLists"] boolValue];
|
||||
|
||||
[contactInfos release];
|
||||
contactInfos = [folder lookupContactsWithFilter: valueText
|
||||
onCriteria: searchText
|
||||
sortBy: [self sortKey]
|
||||
ordering: ordering
|
||||
inDomain: [[context activeUser] domain]];
|
||||
results = [folder lookupContactsWithFilter: valueText
|
||||
onCriteria: searchText
|
||||
sortBy: [self sortKey]
|
||||
ordering: ordering
|
||||
inDomain: [[context activeUser] domain]];
|
||||
if (excludeLists)
|
||||
{
|
||||
filteredContacts = [NSMutableArray array];
|
||||
for (i = 0; i < [results count]; i++)
|
||||
{
|
||||
contact = [results objectAtIndex: i];
|
||||
if (![[contact objectForKey: @"c_component"] isEqualToString: @"vlist"])
|
||||
{
|
||||
[filteredContacts addObject: contact];
|
||||
}
|
||||
}
|
||||
contactInfos = [NSArray arrayWithArray: filteredContacts];
|
||||
}
|
||||
else
|
||||
{
|
||||
contactInfos = results;
|
||||
}
|
||||
[contactInfos retain];
|
||||
}
|
||||
|
||||
@@ -167,6 +191,7 @@
|
||||
{
|
||||
id <WOActionResults> result;
|
||||
id <SOGoContactFolder> folder;
|
||||
BOOL excludeLists;
|
||||
NSString *searchText, *mail, *domain;
|
||||
NSDictionary *contact, *data;
|
||||
NSArray *contacts, *descriptors, *sortedContacts;
|
||||
@@ -176,6 +201,7 @@
|
||||
WORequest *rq;
|
||||
|
||||
rq = [context request];
|
||||
excludeLists = [[rq formValueForKey: @"excludeLists"] boolValue];
|
||||
searchText = [rq formValueForKey: @"search"];
|
||||
if ([searchText length] > 0)
|
||||
{
|
||||
@@ -198,9 +224,12 @@
|
||||
for (i = 0; i < [contacts count]; i++)
|
||||
{
|
||||
contact = [contacts objectAtIndex: i];
|
||||
mail = [contact objectForKey: @"c_mail"];
|
||||
if ([mail isNotNull] && [uniqueContacts objectForKey: mail] == nil)
|
||||
[uniqueContacts setObject: contact forKey: mail];
|
||||
if (!excludeLists || ![[contact objectForKey: @"c_component"] isEqualToString: @"vlist"])
|
||||
{
|
||||
mail = [contact objectForKey: @"c_mail"];
|
||||
if ([mail isNotNull] && [uniqueContacts objectForKey: mail] == nil)
|
||||
[uniqueContacts setObject: contact forKey: mail];
|
||||
}
|
||||
}
|
||||
|
||||
if ([uniqueContacts count] > 0)
|
||||
|
||||
Reference in New Issue
Block a user