sogo/UI/Scheduler/UIxCalInlineAptView.m
Wolfgang Sourdeau 8c84f0e6f8 Monotone-Parent: 3e2187f44ea3be4208acae016be88b647bfe78a4
Monotone-Revision: 7db953f3e208a524c131effeb93c6030fda6cc6e

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-10-20T21:17:18
Monotone-Branch: ca.inverse.sogo
2006-10-20 21:17:18 +00:00

164 lines
3.6 KiB
Objective-C

/*
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 $
#import <NGObjWeb/NGObjWeb.h>
@interface UIxCalInlineAptView : WOComponent
{
id appointment;
id formatter;
id tooltipFormatter;
id url;
id style;
id queryDictionary;
id referenceDate;
BOOL canAccess;
}
@end
#include "common.h"
#include <SOGoUI/SOGoAptFormatter.h>
#include <SOGo/SOGoUser.h>
#include <NGObjWeb/WOContext+SoObjects.h>
@implementation UIxCalInlineAptView
- (void)dealloc {
[appointment release];
[formatter release];
[tooltipFormatter release];
[url release];
[style release];
[queryDictionary release];
[referenceDate release];
[super dealloc];
}
- (void)setAppointment:(id)_appointment {
ASSIGN(appointment, _appointment);
}
- (id)appointment {
return appointment;
}
- (void)setFormatter:(id)_formatter {
ASSIGN(formatter, _formatter);
}
- (id)formatter {
return formatter;
}
- (void)setTooltipFormatter:(id)_tooltipFormatter {
ASSIGN(tooltipFormatter, _tooltipFormatter);
}
- (id)tooltipFormatter {
return tooltipFormatter;
}
- (void)setUrl:(id)_url {
ASSIGN(url, _url);
}
- (id)url {
return url;
}
- (void)setStyle:(id)_style {
NSMutableString *ms;
NSNumber *prio;
NSString *s;
NSString *email;
if (_style)
ms = [NSMutableString stringWithString: _style];
else
ms = (NSMutableString *)[NSMutableString string];
if ((prio = [appointment valueForKey:@"priority"])) {
[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"];
}
else {
[ms appendString:@" apt_nonparticipant"];
}
}
ASSIGNCOPY(style, ms);
}
- (id)style {
return style;
}
- (void)setQueryDictionary:(id)_queryDictionary {
ASSIGN(queryDictionary, _queryDictionary);
}
- (id)queryDictionary {
return queryDictionary;
}
- (void)setReferenceDate:(id)_referenceDate {
ASSIGN(referenceDate, _referenceDate);
}
- (id)referenceDate {
return referenceDate;
}
- (void)setCanAccess:(BOOL)_canAccess {
canAccess = _canAccess;
}
- (BOOL)canAccess {
return canAccess;
}
- (NSString *) displayClasses
{
return [NSString stringWithFormat: @"appointmentView ownerIs%@",
[appointment objectForKey: @"owner"]];
}
/* helpers */
- (NSString *) title
{
return [formatter stringForObjectValue: appointment
referenceDate: [self referenceDate]];
}
- (NSString *) tooltip
{
return [tooltipFormatter stringForObjectValue: appointment
referenceDate: [self referenceDate]];
}
@end