2006-06-15 21:34:10 +02:00
|
|
|
/*
|
|
|
|
Copyright (C) 2000-2004 SKYRIX Software AG
|
|
|
|
|
|
|
|
This file is part of OGo
|
|
|
|
|
|
|
|
OGo is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU Lesser General Public License as published by the
|
|
|
|
Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
later version.
|
|
|
|
|
|
|
|
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
|
|
License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with OGo; see the file COPYING. If not, write to the
|
|
|
|
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
02111-1307, USA.
|
|
|
|
*/
|
|
|
|
// $Id: UIxCalInlineAptView.m 885 2005-07-21 16:41:34Z znek $
|
|
|
|
|
2006-10-16 20:50:33 +02:00
|
|
|
#import <NGObjWeb/NGObjWeb.h>
|
2006-06-15 21:34:10 +02:00
|
|
|
|
|
|
|
@interface UIxCalInlineAptView : WOComponent
|
|
|
|
{
|
2006-09-07 00:30:49 +02:00
|
|
|
id appointment;
|
|
|
|
id formatter;
|
|
|
|
id tooltipFormatter;
|
|
|
|
id url;
|
|
|
|
id style;
|
|
|
|
id queryDictionary;
|
|
|
|
id referenceDate;
|
2006-06-15 21:34:10 +02:00
|
|
|
BOOL canAccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include <SOGoUI/SOGoAptFormatter.h>
|
|
|
|
#include <SOGo/SOGoUser.h>
|
|
|
|
#include <NGObjWeb/WOContext+SoObjects.h>
|
|
|
|
|
|
|
|
@implementation UIxCalInlineAptView
|
|
|
|
|
|
|
|
- (void)dealloc {
|
2006-09-07 00:30:49 +02:00
|
|
|
[appointment release];
|
|
|
|
[formatter release];
|
|
|
|
[tooltipFormatter release];
|
|
|
|
[url release];
|
|
|
|
[style release];
|
|
|
|
[queryDictionary release];
|
|
|
|
[referenceDate release];
|
2006-06-15 21:34:10 +02:00
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setAppointment:(id)_appointment {
|
2006-09-07 00:30:49 +02:00
|
|
|
ASSIGN(appointment, _appointment);
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
- (id)appointment {
|
2006-09-07 00:30:49 +02:00
|
|
|
return appointment;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setFormatter:(id)_formatter {
|
2006-09-07 00:30:49 +02:00
|
|
|
ASSIGN(formatter, _formatter);
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
- (id)formatter {
|
2006-09-07 00:30:49 +02:00
|
|
|
return formatter;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setTooltipFormatter:(id)_tooltipFormatter {
|
2006-09-07 00:30:49 +02:00
|
|
|
ASSIGN(tooltipFormatter, _tooltipFormatter);
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
- (id)tooltipFormatter {
|
2006-09-07 00:30:49 +02:00
|
|
|
return tooltipFormatter;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setUrl:(id)_url {
|
2006-09-07 00:30:49 +02:00
|
|
|
ASSIGN(url, _url);
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
- (id)url {
|
2006-09-07 00:30:49 +02:00
|
|
|
return url;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setStyle:(id)_style {
|
|
|
|
NSMutableString *ms;
|
2006-09-07 00:30:49 +02:00
|
|
|
NSNumber *prio;
|
|
|
|
NSString *s;
|
|
|
|
NSString *email;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2006-09-07 00:30:49 +02:00
|
|
|
if (_style)
|
|
|
|
ms = [NSMutableString stringWithString: _style];
|
|
|
|
else
|
2006-06-15 21:34:10 +02:00
|
|
|
ms = (NSMutableString *)[NSMutableString string];
|
2006-09-07 00:30:49 +02:00
|
|
|
|
|
|
|
if ((prio = [appointment valueForKey:@"priority"])) {
|
2006-06-15 21:34:10 +02:00
|
|
|
[ms appendFormat:@" apt_prio%@", prio];
|
|
|
|
}
|
|
|
|
email = [[[self context] activeUser] email];
|
2006-09-07 00:30:49 +02:00
|
|
|
if ((s = [appointment valueForKey:@"orgmail"])) {
|
2006-06-15 21:34:10 +02:00
|
|
|
if ([s rangeOfString:email].length > 0) {
|
|
|
|
[ms appendString:@" apt_organizer"];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
[ms appendString:@" apt_other"];
|
|
|
|
}
|
|
|
|
}
|
2006-09-07 00:30:49 +02:00
|
|
|
if ((s = [appointment valueForKey:@"partmails"])) {
|
2006-06-15 21:34:10 +02:00
|
|
|
if ([s rangeOfString:email].length > 0) {
|
|
|
|
[ms appendString:@" apt_participant"];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
[ms appendString:@" apt_nonparticipant"];
|
|
|
|
}
|
|
|
|
}
|
2006-09-07 00:30:49 +02:00
|
|
|
ASSIGNCOPY(style, ms);
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
- (id)style {
|
2006-09-07 00:30:49 +02:00
|
|
|
return style;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setQueryDictionary:(id)_queryDictionary {
|
2006-09-07 00:30:49 +02:00
|
|
|
ASSIGN(queryDictionary, _queryDictionary);
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
- (id)queryDictionary {
|
2006-09-07 00:30:49 +02:00
|
|
|
return queryDictionary;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setReferenceDate:(id)_referenceDate {
|
2006-09-07 00:30:49 +02:00
|
|
|
ASSIGN(referenceDate, _referenceDate);
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
- (id)referenceDate {
|
2006-09-07 00:30:49 +02:00
|
|
|
return referenceDate;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setCanAccess:(BOOL)_canAccess {
|
2006-09-07 00:30:49 +02:00
|
|
|
canAccess = _canAccess;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
- (BOOL)canAccess {
|
2006-09-07 00:30:49 +02:00
|
|
|
return canAccess;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2006-10-16 20:50:33 +02:00
|
|
|
- (NSString *) displayClasses
|
|
|
|
{
|
|
|
|
return [NSString stringWithFormat: @"appointmentView ownerIs%@",
|
2006-10-20 23:17:18 +02:00
|
|
|
[appointment objectForKey: @"owner"]];
|
2006-10-16 20:50:33 +02:00
|
|
|
}
|
|
|
|
|
2006-06-15 21:34:10 +02:00
|
|
|
/* helpers */
|
|
|
|
|
2006-09-05 21:53:29 +02:00
|
|
|
- (NSString *) title
|
|
|
|
{
|
2006-09-07 00:30:49 +02:00
|
|
|
return [formatter stringForObjectValue: appointment
|
|
|
|
referenceDate: [self referenceDate]];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2006-09-05 21:53:29 +02:00
|
|
|
- (NSString *) tooltip
|
|
|
|
{
|
2006-09-07 00:30:49 +02:00
|
|
|
return [tooltipFormatter stringForObjectValue: appointment
|
|
|
|
referenceDate: [self referenceDate]];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|