+2007-03-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * SoObjects/SOGo/SOGoAuthenticator.m ([SOGoAuthenticator
+ -userInContext:]): returns "SOGoUser".
+
+ * SoObjects/Appointments/SOGoCalendarComponent.m
+ ([SOGoCalendarComponent -contentAsString]): overriden method that
+ takes the privacy into account and discard the relevant fields if
+ needed by generating a new content string and caching it.
+ ([SOGoCalendarComponent
+ -saveContentString:contentStringbaseVersion:baseVersion]): if the
+ new method above has cached a content string, release it and set
+ it to nil so that it will have to be regenerated in the case it is
+ requested further.
+ ([SOGoCalendarComponent -_filterPrivateComponent:component]):
+ discard the fields that have to be hidden when the card is
+ private.
+
+ * SoObjects/Appointments/SOGoAppointmentFolder.m
+ ([SOGoAppointmentFolder
+ -appendObject:objectwithBaseURL:baseURLtoREPORTResponse:r]): make
+ sure the cards are now handled as instances of
+ SOGoCalendarComponent instead of SOGoContentObject so that their
+ content string is taking the privacy classifiction into account.
+ ([SOGoAppointmentFolder -_privacySqlString]): new method that
+ generates a query to determine what information can be given and
+ if the card itself has to be shown.
+
+ * UI/Scheduler/UIxComponent+Agenor.m ([UIxComponent
+ -getICalPersonsFromValue:selectorValue]): removed useless
+ "isAccessRestricted" method.
+
+ * UI/Scheduler/UIxCalInlineAptView.m ([UIxCalInlineAptView
+ -setStyle:_style]): test whether the values of orgmail and
+ partmails are null before manipulating them, otherwise SOGo sends
+ a "rangeOfString:" message to an NSNull, which makes it crashes.
+
+ * OGoContentStore/OCSiCalFieldExtractor.m ([OCSiCalFieldExtractor
+ -extractQuickFieldsFromEvent:_event]): we now use the new
+ "symbolicAccessClass" method from iCalEntity to determine the
+ value of the "classifiction" field.
+ ([OCSiCalFieldExtractor -extractQuickFieldsFromTodo:_task]): same
+ as above.
+
+2007-03-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * SoObjects/Appointments/SOGoAppointmentFolder.m
+ ([SOGoAppointmentFolder
+ -fetchCoreInfosFrom:_startDateto:_endDatecomponent:_component]):
+ see below, the query is adapted consequently.
+
+ * OGoContentStore/OCSiCalFieldExtractor.m ([OCSiCalFieldExtractor
+ -extractQuickFieldsFromTodo:_task]): the field "ispublic" was
+ renamed to "classification" and can any integer as value.
+ ([OCSiCalFieldExtractor -extractQuickFieldsFromEvent:_event]):
+ idem.
+
2007-02-26 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/MailPartViewers/UIxMailPartHTMLViewer.m
#include <NGObjWeb/SoApplication.h>
+// @interface classtree : NSObject
+// {
+// Class topClass;
+// int indentLevel;
+// }
+
+// - (id) initWithTopClass: (Class) newTopClass;
+// - (void) dumpSiblings: (Class) node;
+
+// @end
+
+// @implementation classtree
+
+// + (id) newWithTopClass: (Class) newTopClass
+// {
+// id newTree;
+
+// newTree = [[self alloc] initWithTopClass: newTopClass];
+// [newTree autorelease];
+
+// return newTree;
+// }
+
+// - (id) initWithTopClass: (Class) newTopClass
+// {
+// if ((self = [self init]))
+// topClass = newTopClass;
+
+// return self;
+// }
+
+// #define indentGap 2
+
+// - (NSString *) indentSpaces
+// {
+// char *spaceString;
+
+// spaceString = malloc(sizeof (char *) * indentGap * indentLevel + 1);
+// *(spaceString + indentGap * indentLevel) = 0;
+// memset (spaceString, ' ', indentGap * indentLevel);
+
+// return [[NSString alloc] initWithCStringNoCopy: spaceString
+// length: indentGap * indentLevel
+// freeWhenDone: YES];
+// }
+
+// - (void) dumpNode: (Class) node
+// {
+// Class currentSubclass;
+// unsigned int count;
+
+// count = 0;
+// currentSubclass = node->subclass_list;
+// if (currentSubclass)
+// {
+// NSLog(@"%@%@:",
+// [[self indentSpaces] autorelease], NSStringFromClass(node));
+// indentLevel++;
+// [self dumpSiblings: currentSubclass];
+// indentLevel--;
+// }
+// else
+// NSLog(@"%@%@", [self indentSpaces], NSStringFromClass(node));
+// }
+
+// - (void) dumpSiblings: (Class) node
+// {
+// Class currentNode;
+
+// currentNode = node;
+// while (currentNode && currentNode->instance_size)
+// {
+// [self dumpNode: currentNode];
+// currentNode = currentNode->sibling_class;
+// }
+// }
+
+// - (void) dumpTree
+// {
+// indentLevel = 0;
+
+// [self dumpSiblings: topClass];
+// }
+
+// @end
+
@interface SOGo : SoApplication
{
NSMutableDictionary *localeLUT;
/* runtime maintenance */
+// - (void) _dumpClassAllocation
+// {
+// classtree *ct;
+
+// ct = [classtree newWithTopClass: [NSObject class]];
+// [ct dumpTree];
+// }
+
- (void)checkIfDaemonHasToBeShutdown {
unsigned int limit, vmem;
@"terminating app, vMem size limit (%d MB) has been reached"
@" (currently %d MB)",
limit, vmem];
+// [self _dumpClassAllocation];
[self terminate];
}
}
NSMutableDictionary *row;
NSCalendarDate *startDate, *endDate;
NSArray *attendees;
- NSString *uid, *title, *location, *status, *accessClass;
+ NSString *uid, *title, *location, *status;
NSNumber *sequence;
id organizer;
id participants, partmails;
NSMutableString *partstates;
unsigned i, count;
+ iCalAccessClass accessClass;
if (_event == nil)
return nil;
title = [_event summary];
location = [_event location];
sequence = [_event sequence];
- accessClass = [[_event accessClass] uppercaseString];
+ accessClass = [_event symbolicAccessClass];
status = [[_event status] uppercaseString];
attendees = [_event attendees];
if ([location isNotNull]) [row setObject: location forKey:@"location"];
if ([sequence isNotNull]) [row setObject: sequence forKey:@"sequence"];
- if ([startDate isNotNull])
+ if ([startDate isNotNull])
[row setObject: [self numberForDate: startDate] forKey:@"startdate"];
- if ([endDate isNotNull])
+ if ([endDate isNotNull])
[row setObject: [self numberForDate: endDate] forKey:@"enddate"];
if ([_event isRecurrent]) {
NSCalendarDate *date;
[row setObject: [NSNumber numberWithInt:1] forKey: @"status"];
}
- if([accessClass isNotNull] && ![accessClass isEqualToString:@"PUBLIC"]) {
- [row setObject:[NSNumber numberWithBool:NO] forKey:@"ispublic"];
- }
- else {
- [row setObject:[NSNumber numberWithBool:YES] forKey:@"ispublic"];
- }
+ [row setObject: [NSNumber numberWithUnsignedInt: accessClass]
+ forKey: @"classification"];
organizer = [_event organizer];
if (organizer) {
NSMutableDictionary *row;
NSCalendarDate *startDate, *dueDate;
NSArray *attendees;
- NSString *uid, *title, *location, *status, *accessClass;
+ NSString *uid, *title, *location, *status;
NSNumber *sequence;
id organizer, date;
id participants, partmails;
NSMutableString *partstates;
unsigned i, count, code;
+ iCalAccessClass accessClass;
if (_task == nil)
return nil;
title = [_task summary];
location = [_task location];
sequence = [_task sequence];
- accessClass = [[_task accessClass] uppercaseString];
+ accessClass = [_task symbolicAccessClass];
status = [[_task status] uppercaseString];
attendees = [_task attendees];
[row setObject:[NSNumber numberWithInt:1] forKey:@"status"];
}
- if([accessClass isNotNull] && ![accessClass isEqualToString:@"PUBLIC"]) {
- [row setObject:[NSNumber numberWithBool:NO] forKey:@"ispublic"];
- }
- else {
- [row setObject:[NSNumber numberWithBool:YES] forKey:@"ispublic"];
- }
+ [row setObject: [NSNumber numberWithUnsignedInt: accessClass]
+ forKey: @"classification"];
organizer = [_task organizer];
if (organizer) {
allowsNull = YES;
},
{
- columnName = ispublic;
+ columnName = classification;
sqlType = "INT";
allowsNull = NO;
},
participants VARCHAR(100000) NOT NULL, -- the CNs of the participants
isallday INT NULL,
iscycle INT NULL, -- client needs to fetch to resolve
- ispublic INT NOT NULL,
+ classification INT NOT NULL,
status INT NOT NULL,
isopaque INT NOT NULL,
location VARCHAR(256) NULL,
participants VARCHAR(100000) NULL, -- the CNs of the participants
isallday INT NULL,
iscycle INT NULL, -- client needs to fetch to resolve
- ispublic INT NOT NULL,
+ classification INT NOT NULL,
status INT NOT NULL,
priority INT NOT NULL, -- for marking high prio apts
isopaque INT NULL,
- (NSString *) versitString
{
- CardVersitRenderer *renderer;
NSString *string;
+ CardVersitRenderer *renderer;
renderer = [CardVersitRenderer new];
string = [renderer render: self];
+ (id) groupWithTag: (NSString *) aTag
{
- id newGroup;
-
- newGroup = [self new];
- [newGroup autorelease];
- [newGroup setTag: aTag];
-
- return newGroup;
+ return [self elementWithTag: aTag];
}
+ (id) groupWithTag: (NSString *) aTag
{
id newGroup;
- newGroup = [self new];
- [newGroup autorelease];
- [newGroup setTag: aTag];
+ newGroup = [self elementWithTag: aTag];
[newGroup addChildren: someChildren];
return newGroup;
if (![anElement isVoid])
{
rendering = [NSMutableString new];
- [rendering autorelease];
if ([anElement group])
[rendering appendFormat: @"%@.", [anElement group]];
tag = [anElement tag];
[rendering appendString: @"\r\n"];
finalRendering = [rendering foldedForVersitCards];
+ [rendering release];
}
else
finalRendering = @"";
+2007-03-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * iCalEntityObject.m ([iCalEntityObject -symbolicAccessClass]):
+ new method that parses the "CLASS" element of the card and returns
+ an enum value.
+
+ * NSString+NGCards.m ([NSString -foldedForVersitCards]):
+ simplified method by initializing and returning folderString
+ unconditionnally. If length < 76, the original string is appended
+ to it.
+
+ * CardGroup.m ([CardGroup +groupWithTag:aTag]): simply invoke
+ [self elementWithTag:].
+ ([CardGroup +groupWithTag:aTagchildren:someChildren]): same as
+ above.
+
+2007-03-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * iCalEntityObject.h (enum): added an enum with iCalAccessPublic,
+ iCalAccessPrivate and iCalAccessConfidential values.
+
2007-02-15 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* CardGroup.m ([CardGroup -firstChildWithTag:aTag]): new method.
- (NSString *) foldedForVersitCards
{
- NSString *newString;
NSMutableString *foldedString;
unsigned int length;
NSRange subStringRange;
+ foldedString = [NSMutableString new];
+ [foldedString autorelease];
+
length = [self length];
if (length < 76)
- newString = self;
+ [foldedString appendString: self];
else
{
- foldedString = [NSMutableString new];
- [foldedString autorelease];
-
subStringRange = NSMakeRange (0, 75);
[foldedString appendFormat: @"%@\r\n",
[self substringWithRange: subStringRange]];
subStringRange.length = length - subStringRange.location;
[foldedString appendFormat: @" %@",
[self substringWithRange: subStringRange]];
-
- newString = foldedString;
}
- return newString;
+ return foldedString;
}
- (NSArray *) asCardAttributeValues
@class iCalPerson;
@class NSURL;
+typedef enum
+{
+ iCalAccessPublic = 0,
+ iCalAccessPrivate = 1,
+ iCalAccessConfidential = 2,
+} iCalAccessClass;
+
@interface iCalEntityObject : CardGroup
/* accessors */
- (void) setAccessClass:(NSString *) _value;
- (NSString *) accessClass;
+- (iCalAccessClass) symbolicAccessClass;
- (BOOL) isPublic;
- (void) setPriority: (NSString *) _value;
return [[self uniqueChildWithTag: @"class"] value: 0];
}
+- (iCalAccessClass) symbolicAccessClass
+{
+ iCalAccessClass symbolicAccessClass;
+ NSString *accessClass;
+
+ accessClass = [[self accessClass] uppercaseString];
+ if ([accessClass isEqualToString: @"PRIVATE"])
+ symbolicAccessClass = iCalAccessPrivate;
+ else if ([accessClass isEqualToString: @"CONFIDENTIAL"])
+ symbolicAccessClass = iCalAccessConfidential;
+ else
+ symbolicAccessClass = iCalAccessPublic;
+
+ return symbolicAccessClass;
+}
+
- (BOOL) isPublic
{
- return [[[self accessClass] uppercaseString] isEqualToString: @"PUBLIC"];
+ return ([self symbolicAccessClass] == iCalAccessPublic);
}
- (void) setPriority: (NSString *) _value
#import <SOGo/AgenorUserManager.h>
#import <SOGo/SOGoPermissions.h>
#import <SOGo/NSString+Utilities.h>
+#import <SOGo/SOGoUser.h>
#import "common.h"
withBaseURL: (NSString *) baseURL
toREPORTResponse: (WOResponse *) r
{
- SOGoContentObject *ocsObject;
+ SOGoCalendarComponent *component;
+ Class componentClass;
NSString *c_name, *etagLine, *calString;
c_name = [object objectForKey: @"c_name"];
- ocsObject = [SOGoContentObject objectWithName: c_name
- inContainer: self];
+ if ([[object objectForKey: @"component"] isEqualToString: @"vevent"])
+ componentClass = [SOGoAppointmentObject class];
+ else
+ componentClass = [SOGoTaskObject class];
+
+ component = [componentClass objectWithName: c_name inContainer: self];
[r appendContentString: @" <D:response>\r\n"];
[r appendContentString: @" <D:href>"];
[r appendContentString: @" <D:propstat>\r\n"];
[r appendContentString: @" <D:prop>\r\n"];
etagLine = [NSString stringWithFormat: @" <D:getetag>%@</D:getetag>\r\n",
- [ocsObject davEntityTag]];
+ [component davEntityTag]];
[r appendContentString: etagLine];
[r appendContentString: @" </D:prop>\r\n"];
[r appendContentString: @" <D:status>HTTP/1.1 200 OK</D:status>\r\n"];
[r appendContentString: @" </D:propstat>\r\n"];
[r appendContentString: @" <C:calendar-data>"];
- calString = [[ocsObject contentAsString] stringByEscapingXMLString];
+ calString = [[component contentAsString] stringByEscapingXMLString];
[r appendContentString: calString];
[r appendContentString: @"</C:calendar-data>\r\n"];
[r appendContentString: @" </D:response>\r\n"];
end = (unsigned int) [_endDate timeIntervalSince1970];
return [NSString stringWithFormat:
- @" AND (startdate <= %d) AND (enddate >= %d)",
+ @" AND (startdate <= %u) AND (enddate >= %u)",
end, start];
}
+- (NSString *) _privacySqlString
+{
+ NSString *privacySqlString, *owner, *currentUser, *email;
+ WOContext *context;
+ SOGoUser *activeUser;
+
+ context = [[WOApplication application] context];
+ activeUser = [context activeUser];
+ currentUser = [activeUser login];
+ owner = [self ownerInContext: context];
+
+ if ([currentUser isEqualToString: owner])
+ privacySqlString = @"";
+ else
+ {
+ email = [activeUser email];
+ privacySqlString
+ = [NSString stringWithFormat:
+ @"(classification != %d or (orgmail = '%@')"
+ @" or ((partmails caseInsensitiveLike '%@%%'"
+ @" or partmails caseInsensitiveLike '%%\\n%@%%')))",
+ iCalAccessPrivate, email, email, email];
+ }
+
+ return privacySqlString;
+}
+
- (NSArray *) fetchFields: (NSArray *) _fields
fromFolder: (GCSFolder *) _folder
from: (NSCalendarDate *) _startDate
EOQualifier *qualifier;
NSMutableArray *fields, *ma = nil;
NSArray *records;
- NSString *sql, *dateSqlString, *componentSqlString; /* , *owner; */
+ NSString *sql, *dateSqlString, *componentSqlString, *privacySqlString; /* , *owner; */
NGCalendarDateRange *r;
if (_folder == nil) {
}
componentSqlString = [self _sqlStringForComponent: _component];
+ privacySqlString = [self _privacySqlString];
/* prepare mandatory fields */
if (logger)
[self debugWithFormat:@"should fetch (%@=>%@) ...", _startDate, _endDate];
- sql = [NSString stringWithFormat: @"(iscycle = 0)%@%@",
- dateSqlString, componentSqlString];
+ sql = [NSString stringWithFormat: @"(iscycle = 0)%@%@%@",
+ dateSqlString, componentSqlString, privacySqlString];
/* fetch non-recurrent apts first */
qualifier = [EOQualifier qualifierWithQualifierFormat: sql];
}
/* fetch recurrent apts now */
- sql = [NSString stringWithFormat: @"(iscycle = 1)%@%@",
- dateSqlString, componentSqlString];
+ sql = [NSString stringWithFormat: @"(iscycle = 1)%@%@%@",
+ dateSqlString, componentSqlString, privacySqlString];
qualifier = [EOQualifier qualifierWithQualifierFormat: sql];
[fields addObject: @"cycleinfo"];
infos = [[NSArray alloc] initWithObjects:
@"c_name", @"component",
@"title", @"location", @"orgmail",
- @"status", @"ispublic",
+ @"status", @"classification",
@"isallday", @"isopaque",
@"participants", @"partmails",
@"partstates", @"sequence", @"priority", nil];
- return [self fetchFields: infos from: _startDate to: _endDate component: _component];
+ return [self fetchFields: infos from: _startDate to: _endDate
+ component: _component];
}
- (void) deleteEntriesWithIds: (NSArray *) ids
@interface SOGoCalendarComponent : SOGoContentObject
{
iCalCalendar *calendar;
+ NSString *calContent;
}
- (NSString *) componentTag;
if ((self = [super init]))
{
calendar = nil;
+ calContent = nil;
}
return self;
{
if (calendar)
[calendar release];
+ if (calContent)
+ [calContent release];
[super dealloc];
}
return nil;
}
+- (void) _filterPrivateComponent: (iCalEntityObject *) component
+{
+ [component setSummary: @""];
+ [component setComment: @""];
+ [component setUserComment: @""];
+ [component setLocation: @""];
+ [component setCategories: @""];
+ [component setUrl: @""];
+ [component removeAllAttendees];
+ [component removeAllAlarms];
+}
+
+- (NSString *) contentAsString
+{
+ NSString *tmpContent, *email;
+ iCalCalendar *tmpCalendar;
+ iCalRepeatableEntityObject *tmpComponent;
+ WOContext *context;
+
+ if (!calContent)
+ {
+ tmpContent = [super contentAsString];
+ calContent = tmpContent;
+ if ([tmpContent length] > 0)
+ {
+ tmpCalendar = [iCalCalendar parseSingleFromSource: tmpContent];
+ tmpComponent = (iCalRepeatableEntityObject *) [tmpCalendar firstChildWithTag: [self componentTag]];
+ if (![tmpComponent isPublic])
+ {
+ context = [[WOApplication application] context];
+ email = [[context activeUser] email];
+ if (!([tmpComponent isOrganizer: email]
+ || [tmpComponent isParticipant: email]))
+ {
+ // content = tmpContent;
+ [self _filterPrivateComponent: tmpComponent];
+ calContent = [tmpCalendar versitString];
+ }
+ }
+ }
+
+ [calContent retain];
+ }
+
+ return calContent;
+}
+
+- (NSException *) saveContentString: (NSString *) contentString
+ baseVersion: (unsigned int) baseVersion
+{
+ NSException *result;
+
+ result = [super saveContentString: contentString
+ baseVersion: baseVersion];
+ if (!result && calContent)
+ {
+ [calContent release];
+ calContent = nil;
+ }
+
+ return result;
+}
+
- (iCalCalendar *) calendar
{
NSString *iCalString;
"FreeBusyLookup" = ( "Owner", "Delegate", "Assistant", "FreeBusy" );
"Add Documents, Images, and Files" = ( "Owner", "Delegate" );
"Access Contents Information" = ( "Owner", "Delegate", "Assistant" );
+ "Delete Objects" = ( "Owner", "Organizer", "Delegate" );
};
};
@class NSUserDefaults;
@class NSString;
+@class SOGoUser;
+
@interface SOGoAuthenticator : SoHTTPAuthenticator
{
NSUserDefaults *ud;
- (BOOL) LDAPCheckLogin: (NSString *) _login password: (NSString *) _pwd;
+- (SOGoUser *) userInContext: (WOContext *) _ctx;
+
@end
#endif /* __Main_SOGoAuthenticator_H__ */
/* create SOGoUser */
-- (SoUser *) userInContext:(WOContext *)_ctx
+- (SOGoUser *) userInContext: (WOContext *)_ctx
{
- static SoUser *anonymous = nil, *freebusy;
+ static SOGoUser *anonymous = nil, *freebusy;
SoUser *user;
NSArray *traversalPath;
NSString *login;
- (NSString *)contentForReply {
NSArray *keys, *partInfos;
NSDictionary *parts, *infos;
- SOGoMailObject *co;
- co = [self clientObject];
- keys = [co plainTextContentFetchKeys];
- infos = [co fetchCoreInfos];
- partInfos = [infos objectForKey: keys];
- NSLog (@"infos: '%@'", infos);
+ keys = [[self clientObject] plainTextContentFetchKeys];
+// SOGoMailObject *co;
+
+// co = [self clientObject];
+// keys = [co plainTextContentFetchKeys];
+// infos = [co fetchCoreInfos];
+// partInfos = [infos objectForKey: keys];
+// NSLog (@"infos: '%@'", infos);
if ([keys count] == 0)
return nil;
#import <Foundation/NSDictionary.h>
#import <NGObjWeb/NGObjWeb.h>
+#import <SOGo/SOGoAuthenticator.h>
+#import <NGCards/iCalEntityObject.h>
@interface UIxCalInlineAptView : WOComponent
{
[ms appendFormat:@" apt_prio%@", prio];
}
email = [[[self context] activeUser] email];
- if ((s = [appointment valueForKey:@"orgmail"])) {
- if ([s rangeOfString:email].length > 0) {
- [ms appendString:@" apt_organizer"];
- }
- else {
- [ms appendString:@" apt_other"];
- }
- }
- if ((s = [appointment valueForKey:@"partmails"])) {
- if ([s rangeOfString:email].length > 0) {
- [ms appendString:@" apt_participant"];
+ s = [appointment valueForKey:@"orgmail"];
+ if ([s isNotNull])
+ {
+ if ([s rangeOfString: email].length > 0)
+ [ms appendString:@" apt_organizer"];
+ else
+ [ms appendString:@" apt_other"];
}
- else {
- [ms appendString:@" apt_nonparticipant"];
+ s = [appointment valueForKey:@"partmails"];
+ if ([s isNotNull])
+ {
+ if ([s rangeOfString:email].length > 0)
+ [ms appendString:@" apt_participant"];
+ else
+ [ms appendString:@" apt_nonparticipant"];
}
- }
ASSIGNCOPY(style, ms);
}
/* helpers */
+- (NSString *) startHour
+{
+ NSCalendarDate *start;
+
+ start = [appointment objectForKey: @"startDate"];
+
+ return [NSString stringWithFormat: @"%.2d:%.2d",
+ [start hourOfDay], [start minuteOfHour]];
+}
+
- (NSString *) title
{
return [formatter stringForObjectValue: appointment
referenceDate: [self referenceDate]];
}
+- (BOOL) _userIsInTheCard: (NSString *) email
+{
+ NSString *orgMailString, *partMailsString;
+ NSArray *partMails;
+ BOOL userIsInTheCard;
+
+ orgMailString = [appointment objectForKey: @"orgmail"];
+ if ([orgMailString isNotNull] && [orgMailString isEqualToString: email])
+ userIsInTheCard = YES;
+ else
+ {
+ partMailsString = [appointment objectForKey: @"partmails"];
+ if ([partMailsString isNotNull])
+ {
+ partMails = [partMailsString componentsSeparatedByString: @"\n"];
+ userIsInTheCard = [partMails containsObject: email];
+ }
+ else
+ userIsInTheCard = NO;
+ }
+
+ return userIsInTheCard;
+}
+
+- (BOOL) titleShouldBeHidden
+{
+ BOOL shouldBeHidden;
+ SOGoUser *user;
+ SOGoAuthenticator *sAuth;
+
+ sAuth = [SOGoAuthenticator sharedSOGoAuthenticator];
+ user = [sAuth userInContext: context];
+
+ if ([[appointment objectForKey: @"owner"] isEqualToString: [user login]]
+ || ([[appointment objectForKey: @"classification"] intValue]
+ != iCalAccessConfidential))
+ shouldBeHidden = NO;
+ else
+ shouldBeHidden = ![self _userIsInTheCard: [user email]];
+
+ return shouldBeHidden;
+}
+
@end
- (NSArray *) filterAppointments:(NSArray *) _apts
{
NSMutableArray *filtered;
- unsigned i, count;
- NSString *email;
-
- count = [_apts count];
- if (!count) return _apts;
- if ([self shouldDisplayRejectedAppointments]) return _apts;
-
- filtered = [[[NSMutableArray alloc] initWithCapacity: count] autorelease];
- email = [self emailForUser];
+ unsigned i, count;
+ NSString *email;
+ NSDictionary *info;
+ NSArray *partmails;
+ unsigned p, pCount;
+ BOOL shouldAdd;
+ NSString *partmailsString;
+ NSArray *partstates;
+ NSString *state;
+ NSString *pEmail;
+
+ if ([self shouldDisplayRejectedAppointments])
+ return _apts;
+ {
+ count = [_apts count];
+ filtered = [[[NSMutableArray alloc] initWithCapacity: count] autorelease];
+ email = [self emailForUser];
+
+ for (i = 0; i < count; i++)
+ {
+ shouldAdd = YES;
+ info = [_apts objectAtIndex: i];
+ partmailsString = [info objectForKey: @"partmails"];
+ if ([partmailsString isNotNull])
+ {
+ partmails = [partmailsString componentsSeparatedByString: @"\n"];
+ pCount = [partmails count];
+ for (p = 0; p < pCount; p++)
+ {
+ pEmail = [partmails objectAtIndex: p];
+ if ([pEmail isEqualToString: email])
+ {
+ partstates = [[info objectForKey: @"partstates"]
+ componentsSeparatedByString: @"\n"];
+ state = [partstates objectAtIndex: p];
+ if ([state intValue] == iCalPersonPartStatDeclined)
+ shouldAdd = NO;
+ break;
+ }
+ }
+ }
+ if (shouldAdd)
+ [filtered addObject: info];
+ }
+ }
- for (i = 0; i < count; i++)
- {
- NSDictionary *info;
- NSArray *partmails;
- unsigned p, pCount;
- BOOL shouldAdd;
-
- shouldAdd = YES;
- info = [_apts objectAtIndex: i];
- partmails = [[info objectForKey: @"partmails"]
- componentsSeparatedByString: @"\n"];
- pCount = [partmails count];
- for (p = 0; p < pCount; p++)
- {
- NSString *pEmail;
-
- pEmail = [partmails objectAtIndex: p];
- if ([pEmail isEqualToString: email])
- {
- NSArray *partstates;
- NSString *state;
-
- partstates = [[info objectForKey: @"partstates"]
- componentsSeparatedByString: @"\n"];
- state = [partstates objectAtIndex: p];
- if ([state intValue] == iCalPersonPartStatDeclined)
- shouldAdd = NO;
- break;
- }
- }
- if (shouldAdd)
- [filtered addObject: info];
- }
return filtered;
}
if ([partmails rangeOfString: myEmail].length)
aptFlags.canAccessApt = YES;
else
- aptFlags.canAccessApt = [[_apt valueForKey: @"ispublic"] boolValue];
+ aptFlags.canAccessApt
+ = ([[_apt valueForKey: @"classification"] intValue]
+ == iCalAccessPublic);
}
}
- (NSArray *) getICalPersonsFromValue: (NSString *) selectorValue;
/* email, cn */
-- (NSString *)emailForUser;
-- (NSString *)cnForUser;
-
-/* restrictions */
-- (BOOL)isAccessRestricted;
+- (NSString *) emailForUser;
+- (NSString *) cnForUser;
@end
return persons;
}
-- (NSString *)emailForUser {
- return [[[self context] activeUser] email];
-}
-
-- (NSString *)cnForUser {
- return [[[self context] activeUser] cn];
+- (NSString *) emailForUser
+{
+ return [[context activeUser] email];
}
-- (BOOL)isAccessRestricted {
- return [[self context] isAccessFromIntranet] ? NO : YES;
+- (NSString *) cnForUser
+{
+ return [[context activeUser] cn];
}
@end /* UIxComponent(Agenor) */
<?xml version='1.0' standalone='yes'?>
- <div
- var:class="displayClasses"
- var:aptCName="appointment.c_name"
- var:owner="appointment.owner"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:var="http://www.skyrix.com/od/binding"
- xmlns:const="http://www.skyrix.com/od/constant"
- xmlns:rsrc="OGo:url">
- <div class="shadow shadow1"><!-- space --></div
- ><div class="shadow shadow2"><!-- space --></div
- ><div class="shadow shadow3"><!-- space --></div
- ><div class="shadow shadow4"><!-- space --></div
- ><div var:class="innerDisplayClasses"
- ><div class="gradient"
- ><img rsrc:src="event-gradient.png" class="gradient"
- /></div
- ><div class="text"
- ><var:string value="appointment.title" const:escapeHTML="NO"
- /></div>
- </div>
+<!DOCTYPE div>
+<div
+ var:class="displayClasses"
+ var:aptCName="appointment.c_name"
+ var:owner="appointment.owner"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:var="http://www.skyrix.com/od/binding"
+ xmlns:const="http://www.skyrix.com/od/constant"
+ xmlns:rsrc="OGo:url">
+ <div class="shadow shadow1"><!-- space --></div
+ ><div class="shadow shadow2"><!-- space --></div
+ ><div class="shadow shadow3"><!-- space --></div
+ ><div class="shadow shadow4"><!-- space --></div
+ ><div var:class="innerDisplayClasses"
+ ><div class="gradient"
+ ><img rsrc:src="event-gradient.png" class="gradient"
+ /></div
+ ><div class="text"
+ ><span class="eventHeader"><var:string value="startHour"
+ const:escapeHTML="NO"
+ /><var:if condition="appointment.iscycle"
+ ><img rsrc:src="repeat-16.png" class="gradient"
+ /></var:if
+ ><var:if condition="appointment.hasalarm"
+ ><img rsrc:src="alarm.png" class="gradient"
+ /></var:if
+ ></span
+ ><var:if condition="titleShouldBeHidden" const:negate="YES"
+ ><br
+ /><var:string value="appointment.title" const:escapeHTML="NO"
+ /></var:if
+ ></div>
</div>
+</div>
initCalendarContactsSelector();
}
+function onSchedulerBodyKeyUp(event) {
+ if (event.which == 46) {
+ window.alert("coucou");
+ deleteEvent();
+ event.cancelBubble = true;
+ }
+}
+
window.addEventListener("load", initCalendars, false);
+// document.body.addEventListener("keyup", onSchedulerBodyKeyUp, false);