merge of '1306f5dc489a510d74accc34d99229210cecdb1e'
and '3b018c57691598e10f6e73b0f7fc31137f869040' Monotone-Parent: 1306f5dc489a510d74accc34d99229210cecdb1e Monotone-Parent: 3b018c57691598e10f6e73b0f7fc31137f869040 Monotone-Revision: 79f18765fc6ea227b58f8314495f4ef856966585 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-06-17T18:08:00 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
commit
f0b7e1b67d
|
@ -1,5 +1,11 @@
|
||||||
2009-06-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2009-06-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* SoObjects/Appointments/SOGoAppointmentFolder.m
|
||||||
|
(-fetchFields:...): don't use the privacySqlString twice.
|
||||||
|
The component parameter MUST be a NSString from now on. Fixed a
|
||||||
|
syntax problem in the where clause occuring when vtodo components
|
||||||
|
were requested.
|
||||||
|
|
||||||
* UI/MailPartViewers/UIxMailPartICalViewer.m (-storedEventObject):
|
* UI/MailPartViewers/UIxMailPartICalViewer.m (-storedEventObject):
|
||||||
use the new "storedEventFetched" bool ivar to specify whether we
|
use the new "storedEventFetched" bool ivar to specify whether we
|
||||||
already attempted to fetch the event from the user calendars.
|
already attempted to fetch the event from the user calendars.
|
||||||
|
|
|
@ -389,28 +389,6 @@ static NSArray *reducedReportQueryFields = nil;
|
||||||
|
|
||||||
/* fetching */
|
/* fetching */
|
||||||
|
|
||||||
- (NSString *) _sqlStringForComponent: (id) _component
|
|
||||||
{
|
|
||||||
NSString *sqlString;
|
|
||||||
NSArray *components;
|
|
||||||
|
|
||||||
if (_component)
|
|
||||||
{
|
|
||||||
if ([_component isKindOfClass: [NSArray class]])
|
|
||||||
components = _component;
|
|
||||||
else
|
|
||||||
components = [NSArray arrayWithObject: _component];
|
|
||||||
|
|
||||||
sqlString
|
|
||||||
= [NSString stringWithFormat: @"AND (c_component = '%@')",
|
|
||||||
[components componentsJoinedByString: @"' OR c_component = '"]];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
sqlString = @"";
|
|
||||||
|
|
||||||
return sqlString;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *) _sqlStringRangeFrom: (NSCalendarDate *) _startDate
|
- (NSString *) _sqlStringRangeFrom: (NSCalendarDate *) _startDate
|
||||||
to: (NSCalendarDate *) _endDate
|
to: (NSCalendarDate *) _endDate
|
||||||
{
|
{
|
||||||
|
@ -462,7 +440,8 @@ static NSArray *reducedReportQueryFields = nil;
|
||||||
[self initializeQuickTablesAclsInContext: context];
|
[self initializeQuickTablesAclsInContext: context];
|
||||||
grantedClasses = [NSMutableArray arrayWithCapacity: 3];
|
grantedClasses = [NSMutableArray arrayWithCapacity: 3];
|
||||||
deniedClasses = [NSMutableArray arrayWithCapacity: 3];
|
deniedClasses = [NSMutableArray arrayWithCapacity: 3];
|
||||||
for (currentClass = 0; currentClass < iCalAccessClassCount; currentClass++)
|
for (currentClass = 0;
|
||||||
|
currentClass < iCalAccessClassCount; currentClass++)
|
||||||
{
|
{
|
||||||
classNumber = [NSNumber numberWithInt: currentClass];
|
classNumber = [NSNumber numberWithInt: currentClass];
|
||||||
if (userCanAccessObjectsClassifiedAs[currentClass])
|
if (userCanAccessObjectsClassifiedAs[currentClass])
|
||||||
|
@ -477,10 +456,14 @@ static NSArray *reducedReportQueryFields = nil;
|
||||||
privacySqlString
|
privacySqlString
|
||||||
= [NSString stringWithFormat: @"c_classification != %@",
|
= [NSString stringWithFormat: @"c_classification != %@",
|
||||||
[deniedClasses objectAtIndex: 0]];
|
[deniedClasses objectAtIndex: 0]];
|
||||||
else
|
else if (grantedCount == 1)
|
||||||
privacySqlString
|
privacySqlString
|
||||||
= [NSString stringWithFormat: @"c_classification == %@",
|
= [NSString stringWithFormat: @"c_classification = %@",
|
||||||
[grantedClasses objectAtIndex: 0]];
|
[grantedClasses objectAtIndex: 0]];
|
||||||
|
else
|
||||||
|
/* We prevent any event/task from being listed. There must be a better
|
||||||
|
way... */
|
||||||
|
privacySqlString = @"c_classification = 255";
|
||||||
}
|
}
|
||||||
|
|
||||||
return privacySqlString;
|
return privacySqlString;
|
||||||
|
@ -490,7 +473,7 @@ static NSArray *reducedReportQueryFields = nil;
|
||||||
from: (NSCalendarDate *) startDate
|
from: (NSCalendarDate *) startDate
|
||||||
to: (NSCalendarDate *) endDate
|
to: (NSCalendarDate *) endDate
|
||||||
title: (NSString *) title
|
title: (NSString *) title
|
||||||
component: (id) component
|
component: (NSString *) component
|
||||||
additionalFilters: (NSString *) filters
|
additionalFilters: (NSString *) filters
|
||||||
{
|
{
|
||||||
EOQualifier *qualifier;
|
EOQualifier *qualifier;
|
||||||
|
@ -511,7 +494,11 @@ static NSArray *reducedReportQueryFields = nil;
|
||||||
else
|
else
|
||||||
titleSqlString = @"";
|
titleSqlString = @"";
|
||||||
|
|
||||||
componentSqlString = [self _sqlStringForComponent: component];
|
if (component)
|
||||||
|
componentSqlString = [NSString stringWithFormat: @"AND c_component = '%@'",
|
||||||
|
component];
|
||||||
|
else
|
||||||
|
componentSqlString = @"";
|
||||||
filterSqlString = [NSMutableString string];
|
filterSqlString = [NSMutableString string];
|
||||||
if ([filters length])
|
if ([filters length])
|
||||||
[filterSqlString appendFormat: @"AND (%@)", filters];
|
[filterSqlString appendFormat: @"AND (%@)", filters];
|
||||||
|
@ -929,16 +916,16 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
{
|
{
|
||||||
EOQualifier *qualifier;
|
EOQualifier *qualifier;
|
||||||
GCSFolder *folder;
|
GCSFolder *folder;
|
||||||
NSMutableArray *fields, *ma = nil;
|
NSMutableArray *fields, *ma;
|
||||||
NSArray *records;
|
NSArray *records;
|
||||||
NSString *sql, *dateSqlString, *titleSqlString, *componentSqlString,
|
NSMutableString *baseWhere;
|
||||||
*privacySqlString, *currentLogin;
|
NSString *where, *dateSqlString, *privacySqlString, *currentLogin;
|
||||||
NSMutableString *filterSqlString;
|
|
||||||
NSCalendarDate *endDate;
|
NSCalendarDate *endDate;
|
||||||
NGCalendarDateRange *r;
|
NGCalendarDateRange *r;
|
||||||
BOOL rememberRecords;
|
BOOL rememberRecords, canCycle;
|
||||||
|
|
||||||
rememberRecords = [self _checkIfWeCanRememberRecords: _fields];
|
rememberRecords = [self _checkIfWeCanRememberRecords: _fields];
|
||||||
|
canCycle = [_component isEqualToString: @"vevent"];
|
||||||
// if (rememberRecords)
|
// if (rememberRecords)
|
||||||
// NSLog (@"we will remember those records!");
|
// NSLog (@"we will remember those records!");
|
||||||
|
|
||||||
|
@ -950,6 +937,12 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_component)
|
||||||
|
baseWhere = [NSMutableString stringWithFormat: @"AND c_component = '%@'",
|
||||||
|
_component];
|
||||||
|
else
|
||||||
|
baseWhere = [NSMutableString string];
|
||||||
|
|
||||||
if (_startDate)
|
if (_startDate)
|
||||||
{
|
{
|
||||||
if (_endDate)
|
if (_endDate)
|
||||||
|
@ -966,22 +959,16 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
dateSqlString = @"";
|
dateSqlString = @"";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([title length])
|
|
||||||
titleSqlString = [NSString stringWithFormat: @"AND (c_title"
|
|
||||||
@" isCaseInsensitiveLike: '%%%@%%')",
|
|
||||||
[title stringByReplacingString: @"'" withString: @"\\'\\'"]];
|
|
||||||
else
|
|
||||||
titleSqlString = @"";
|
|
||||||
|
|
||||||
componentSqlString = [self _sqlStringForComponent: _component];
|
|
||||||
|
|
||||||
filterSqlString = [NSMutableString string];
|
|
||||||
if ([filters length])
|
|
||||||
[filterSqlString appendFormat: @"AND (%@)", filters];
|
|
||||||
|
|
||||||
privacySqlString = [self _privacySqlString];
|
privacySqlString = [self _privacySqlString];
|
||||||
if ([privacySqlString length])
|
if ([privacySqlString length])
|
||||||
[filterSqlString appendFormat: @"AND (%@)", privacySqlString];
|
[baseWhere appendFormat: @"AND %@", privacySqlString];
|
||||||
|
|
||||||
|
if ([title length])
|
||||||
|
[baseWhere appendFormat: @"AND c_title isCaseInsensitiveLike: '%%%@%%'",
|
||||||
|
[title stringByReplacingString: @"'" withString: @"\\'\\'"]];
|
||||||
|
|
||||||
|
if ([filters length])
|
||||||
|
[baseWhere appendFormat: @"AND (%@)", filters];
|
||||||
|
|
||||||
/* prepare mandatory fields */
|
/* prepare mandatory fields */
|
||||||
|
|
||||||
|
@ -995,19 +982,15 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
if (logger)
|
if (logger)
|
||||||
[self debugWithFormat:@"should fetch (%@=>%@) ...", _startDate, endDate];
|
[self debugWithFormat:@"should fetch (%@=>%@) ...", _startDate, endDate];
|
||||||
|
|
||||||
// We treat recurrent tasks as normal components
|
if (canCycle)
|
||||||
if ([_component caseInsensitiveCompare: @"vtodo"] == NSOrderedSame)
|
where = [NSString stringWithFormat: @"%@ %@ AND c_iscycle = 0",
|
||||||
sql = @"";
|
baseWhere, dateSqlString];
|
||||||
else
|
else
|
||||||
sql = @"(c_iscycle = 0) ";
|
where = baseWhere;
|
||||||
|
|
||||||
sql = [sql stringByAppendingFormat: @"%@ %@ %@ %@",
|
|
||||||
dateSqlString, titleSqlString, componentSqlString,
|
|
||||||
filterSqlString];
|
|
||||||
|
|
||||||
/* fetch non-recurrent apts first */
|
/* fetch non-recurrent apts first */
|
||||||
qualifier = [EOQualifier qualifierWithQualifierFormat: sql];
|
qualifier = [EOQualifier qualifierWithQualifierFormat:
|
||||||
|
[where substringFromIndex: 4]];
|
||||||
records = [folder fetchFields: fields matchingQualifier: qualifier];
|
records = [folder fetchFields: fields matchingQualifier: qualifier];
|
||||||
if (records)
|
if (records)
|
||||||
{
|
{
|
||||||
|
@ -1018,15 +1001,15 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
[records count], records];
|
[records count], records];
|
||||||
ma = [NSMutableArray arrayWithArray: records];
|
ma = [NSMutableArray arrayWithArray: records];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
ma = nil;
|
||||||
|
|
||||||
/* fetch recurrent apts now. we do NOT consider events with no cycle end. */
|
/* fetch recurrent apts now. we do NOT consider events with no cycle end. */
|
||||||
if (_endDate || filters)
|
// || _endDate || filters)
|
||||||
|
if (canCycle)
|
||||||
{
|
{
|
||||||
sql = [NSString stringWithFormat: @"(c_iscycle = 1) %@ %@ %@ %@", titleSqlString,
|
where = [NSString stringWithFormat: @"%@ AND c_iscycle = 1", baseWhere];
|
||||||
componentSqlString, privacySqlString, filterSqlString];
|
qualifier = [EOQualifier qualifierWithQualifierFormat: [where substringFromIndex: 4]];
|
||||||
|
|
||||||
qualifier = [EOQualifier qualifierWithQualifierFormat: sql];
|
|
||||||
|
|
||||||
records = [folder fetchFields: fields matchingQualifier: qualifier];
|
records = [folder fetchFields: fields matchingQualifier: qualifier];
|
||||||
if (records)
|
if (records)
|
||||||
{
|
{
|
||||||
|
@ -1410,6 +1393,8 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
return filterData;
|
return filterData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: This method should be generalized to all SOGoGCSFolder-based
|
||||||
|
classes. */
|
||||||
- (NSDictionary *) _parseRequestedProperties: (id <DOMElement>) parentNode
|
- (NSDictionary *) _parseRequestedProperties: (id <DOMElement>) parentNode
|
||||||
{
|
{
|
||||||
NSMutableDictionary *properties;
|
NSMutableDictionary *properties;
|
||||||
|
|
|
@ -544,7 +544,7 @@ SEL SOGoSelectorForPropertySetter (NSString *property)
|
||||||
NSDictionary *currentGrant, *userHREF;
|
NSDictionary *currentGrant, *userHREF;
|
||||||
NSString *principalURL;
|
NSString *principalURL;
|
||||||
|
|
||||||
currentAce = [NSMutableArray new];
|
currentAce = [NSMutableArray array];
|
||||||
roles = [[SOGoUser userWithLogin: currentUID roles: nil]
|
roles = [[SOGoUser userWithLogin: currentUID roles: nil]
|
||||||
rolesForObject: self
|
rolesForObject: self
|
||||||
inContext: context];
|
inContext: context];
|
||||||
|
@ -562,7 +562,6 @@ SEL SOGoSelectorForPropertySetter (NSString *property)
|
||||||
[currentAce addObject: currentGrant];
|
[currentAce addObject: currentGrant];
|
||||||
[aces addObject: davElementWithContent (@"ace", @"DAV:", currentAce)];
|
[aces addObject: davElementWithContent (@"ace", @"DAV:", currentAce)];
|
||||||
}
|
}
|
||||||
[currentAce release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) _fillAcesWithRolesForPseudoPrincipals: (NSMutableArray *) aces
|
- (void) _fillAcesWithRolesForPseudoPrincipals: (NSMutableArray *) aces
|
||||||
|
@ -644,7 +643,7 @@ SEL SOGoSelectorForPropertySetter (NSString *property)
|
||||||
NSMutableArray *responses;
|
NSMutableArray *responses;
|
||||||
NSArray *responseElements;
|
NSArray *responseElements;
|
||||||
|
|
||||||
responses = [NSMutableArray new];
|
responses = [NSMutableArray array];
|
||||||
|
|
||||||
hrefList = [hrefs objectEnumerator];
|
hrefList = [hrefs objectEnumerator];
|
||||||
while ((currentHref = [hrefList nextObject]))
|
while ((currentHref = [hrefList nextObject]))
|
||||||
|
@ -660,7 +659,6 @@ SEL SOGoSelectorForPropertySetter (NSString *property)
|
||||||
}
|
}
|
||||||
|
|
||||||
multiStatus = davElementWithContent (@"multistatus", @"DAV:", responses);
|
multiStatus = davElementWithContent (@"multistatus", @"DAV:", responses);
|
||||||
[responses release];
|
|
||||||
|
|
||||||
return multiStatus;
|
return multiStatus;
|
||||||
}
|
}
|
||||||
|
@ -697,11 +695,10 @@ SEL SOGoSelectorForPropertySetter (NSString *property)
|
||||||
NSMutableArray *hrefs;
|
NSMutableArray *hrefs;
|
||||||
NSDictionary *response;
|
NSDictionary *response;
|
||||||
|
|
||||||
hrefs = [NSMutableArray new];
|
hrefs = [NSMutableArray array];
|
||||||
[self _fillArrayWithPrincipalsOwnedBySelf: hrefs];
|
[self _fillArrayWithPrincipalsOwnedBySelf: hrefs];
|
||||||
|
|
||||||
response = [self _formalizePrincipalMatchResponse: hrefs];
|
response = [self _formalizePrincipalMatchResponse: hrefs];
|
||||||
[hrefs release];
|
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue