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.sogomaint-2.0.2
commit
f0b7e1b67d
|
@ -1,5 +1,11 @@
|
|||
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):
|
||||
use the new "storedEventFetched" bool ivar to specify whether we
|
||||
already attempted to fetch the event from the user calendars.
|
||||
|
|
|
@ -389,28 +389,6 @@ static NSArray *reducedReportQueryFields = nil;
|
|||
|
||||
/* 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
|
||||
to: (NSCalendarDate *) _endDate
|
||||
{
|
||||
|
@ -462,7 +440,8 @@ static NSArray *reducedReportQueryFields = nil;
|
|||
[self initializeQuickTablesAclsInContext: context];
|
||||
grantedClasses = [NSMutableArray arrayWithCapacity: 3];
|
||||
deniedClasses = [NSMutableArray arrayWithCapacity: 3];
|
||||
for (currentClass = 0; currentClass < iCalAccessClassCount; currentClass++)
|
||||
for (currentClass = 0;
|
||||
currentClass < iCalAccessClassCount; currentClass++)
|
||||
{
|
||||
classNumber = [NSNumber numberWithInt: currentClass];
|
||||
if (userCanAccessObjectsClassifiedAs[currentClass])
|
||||
|
@ -477,10 +456,14 @@ static NSArray *reducedReportQueryFields = nil;
|
|||
privacySqlString
|
||||
= [NSString stringWithFormat: @"c_classification != %@",
|
||||
[deniedClasses objectAtIndex: 0]];
|
||||
else
|
||||
else if (grantedCount == 1)
|
||||
privacySqlString
|
||||
= [NSString stringWithFormat: @"c_classification == %@",
|
||||
= [NSString stringWithFormat: @"c_classification = %@",
|
||||
[grantedClasses objectAtIndex: 0]];
|
||||
else
|
||||
/* We prevent any event/task from being listed. There must be a better
|
||||
way... */
|
||||
privacySqlString = @"c_classification = 255";
|
||||
}
|
||||
|
||||
return privacySqlString;
|
||||
|
@ -490,7 +473,7 @@ static NSArray *reducedReportQueryFields = nil;
|
|||
from: (NSCalendarDate *) startDate
|
||||
to: (NSCalendarDate *) endDate
|
||||
title: (NSString *) title
|
||||
component: (id) component
|
||||
component: (NSString *) component
|
||||
additionalFilters: (NSString *) filters
|
||||
{
|
||||
EOQualifier *qualifier;
|
||||
|
@ -511,7 +494,11 @@ static NSArray *reducedReportQueryFields = nil;
|
|||
else
|
||||
titleSqlString = @"";
|
||||
|
||||
componentSqlString = [self _sqlStringForComponent: component];
|
||||
if (component)
|
||||
componentSqlString = [NSString stringWithFormat: @"AND c_component = '%@'",
|
||||
component];
|
||||
else
|
||||
componentSqlString = @"";
|
||||
filterSqlString = [NSMutableString string];
|
||||
if ([filters length])
|
||||
[filterSqlString appendFormat: @"AND (%@)", filters];
|
||||
|
@ -929,16 +916,16 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
{
|
||||
EOQualifier *qualifier;
|
||||
GCSFolder *folder;
|
||||
NSMutableArray *fields, *ma = nil;
|
||||
NSMutableArray *fields, *ma;
|
||||
NSArray *records;
|
||||
NSString *sql, *dateSqlString, *titleSqlString, *componentSqlString,
|
||||
*privacySqlString, *currentLogin;
|
||||
NSMutableString *filterSqlString;
|
||||
NSMutableString *baseWhere;
|
||||
NSString *where, *dateSqlString, *privacySqlString, *currentLogin;
|
||||
NSCalendarDate *endDate;
|
||||
NGCalendarDateRange *r;
|
||||
BOOL rememberRecords;
|
||||
BOOL rememberRecords, canCycle;
|
||||
|
||||
rememberRecords = [self _checkIfWeCanRememberRecords: _fields];
|
||||
canCycle = [_component isEqualToString: @"vevent"];
|
||||
// if (rememberRecords)
|
||||
// NSLog (@"we will remember those records!");
|
||||
|
||||
|
@ -950,6 +937,12 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
return nil;
|
||||
}
|
||||
|
||||
if (_component)
|
||||
baseWhere = [NSMutableString stringWithFormat: @"AND c_component = '%@'",
|
||||
_component];
|
||||
else
|
||||
baseWhere = [NSMutableString string];
|
||||
|
||||
if (_startDate)
|
||||
{
|
||||
if (_endDate)
|
||||
|
@ -966,22 +959,16 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
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];
|
||||
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 */
|
||||
|
||||
|
@ -995,19 +982,15 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
if (logger)
|
||||
[self debugWithFormat:@"should fetch (%@=>%@) ...", _startDate, endDate];
|
||||
|
||||
// We treat recurrent tasks as normal components
|
||||
if ([_component caseInsensitiveCompare: @"vtodo"] == NSOrderedSame)
|
||||
sql = @"";
|
||||
if (canCycle)
|
||||
where = [NSString stringWithFormat: @"%@ %@ AND c_iscycle = 0",
|
||||
baseWhere, dateSqlString];
|
||||
else
|
||||
sql = @"(c_iscycle = 0) ";
|
||||
|
||||
sql = [sql stringByAppendingFormat: @"%@ %@ %@ %@",
|
||||
dateSqlString, titleSqlString, componentSqlString,
|
||||
filterSqlString];
|
||||
|
||||
/* fetch non-recurrent apts first */
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat: sql];
|
||||
where = baseWhere;
|
||||
|
||||
/* fetch non-recurrent apts first */
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat:
|
||||
[where substringFromIndex: 4]];
|
||||
records = [folder fetchFields: fields matchingQualifier: qualifier];
|
||||
if (records)
|
||||
{
|
||||
|
@ -1018,15 +1001,15 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
[records count], records];
|
||||
ma = [NSMutableArray arrayWithArray: records];
|
||||
}
|
||||
else
|
||||
ma = nil;
|
||||
|
||||
/* 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,
|
||||
componentSqlString, privacySqlString, filterSqlString];
|
||||
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat: sql];
|
||||
|
||||
where = [NSString stringWithFormat: @"%@ AND c_iscycle = 1", baseWhere];
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat: [where substringFromIndex: 4]];
|
||||
records = [folder fetchFields: fields matchingQualifier: qualifier];
|
||||
if (records)
|
||||
{
|
||||
|
@ -1410,6 +1393,8 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
return filterData;
|
||||
}
|
||||
|
||||
/* TODO: This method should be generalized to all SOGoGCSFolder-based
|
||||
classes. */
|
||||
- (NSDictionary *) _parseRequestedProperties: (id <DOMElement>) parentNode
|
||||
{
|
||||
NSMutableDictionary *properties;
|
||||
|
|
|
@ -544,7 +544,7 @@ SEL SOGoSelectorForPropertySetter (NSString *property)
|
|||
NSDictionary *currentGrant, *userHREF;
|
||||
NSString *principalURL;
|
||||
|
||||
currentAce = [NSMutableArray new];
|
||||
currentAce = [NSMutableArray array];
|
||||
roles = [[SOGoUser userWithLogin: currentUID roles: nil]
|
||||
rolesForObject: self
|
||||
inContext: context];
|
||||
|
@ -562,7 +562,6 @@ SEL SOGoSelectorForPropertySetter (NSString *property)
|
|||
[currentAce addObject: currentGrant];
|
||||
[aces addObject: davElementWithContent (@"ace", @"DAV:", currentAce)];
|
||||
}
|
||||
[currentAce release];
|
||||
}
|
||||
|
||||
- (void) _fillAcesWithRolesForPseudoPrincipals: (NSMutableArray *) aces
|
||||
|
@ -644,7 +643,7 @@ SEL SOGoSelectorForPropertySetter (NSString *property)
|
|||
NSMutableArray *responses;
|
||||
NSArray *responseElements;
|
||||
|
||||
responses = [NSMutableArray new];
|
||||
responses = [NSMutableArray array];
|
||||
|
||||
hrefList = [hrefs objectEnumerator];
|
||||
while ((currentHref = [hrefList nextObject]))
|
||||
|
@ -660,7 +659,6 @@ SEL SOGoSelectorForPropertySetter (NSString *property)
|
|||
}
|
||||
|
||||
multiStatus = davElementWithContent (@"multistatus", @"DAV:", responses);
|
||||
[responses release];
|
||||
|
||||
return multiStatus;
|
||||
}
|
||||
|
@ -697,11 +695,10 @@ SEL SOGoSelectorForPropertySetter (NSString *property)
|
|||
NSMutableArray *hrefs;
|
||||
NSDictionary *response;
|
||||
|
||||
hrefs = [NSMutableArray new];
|
||||
hrefs = [NSMutableArray array];
|
||||
[self _fillArrayWithPrincipalsOwnedBySelf: hrefs];
|
||||
|
||||
response = [self _formalizePrincipalMatchResponse: hrefs];
|
||||
[hrefs release];
|
||||
|
||||
return response;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue