mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-06 08:55:08 +00:00
see ChangeLog
Monotone-Revision: 9054022ef1ca8aeba6e34842d27d9b94ce002b89 Monotone-Author: dev-unix.inverse.qc.ca Monotone-Date: 2006-06-15T19:34:10 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -0,0 +1,211 @@
|
||||
2005-08-01 Helge Hess <helge.hess@skyrix.com>
|
||||
|
||||
* added FHS installation (v0.9.36)
|
||||
|
||||
2005-07-30 Helge Hess <helge.hess@opengroupware.org>
|
||||
|
||||
* SOGoDateFormatter.m: hardened against nil arguments (v0.9.35)
|
||||
|
||||
2005-07-21 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* UIxComponent.m: changed -userFolderPath to generate the path to the
|
||||
activeUser, _NOT_ the owner (v0.9.34)
|
||||
|
||||
2005-07-20 Helge Hess <helge.hess@opengroupware.org>
|
||||
|
||||
* UIxComponent.m: added fragile base class check (v0.9.33)
|
||||
|
||||
2005-07-20 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* UIxComponent.m: changed language lookup to meet the status quo
|
||||
(v0.9.32)
|
||||
|
||||
2005-07-18 Helge Hess <helge.hess@opengroupware.org>
|
||||
|
||||
* UIxComponent.m: minor code reorgs (v0.9.31)
|
||||
|
||||
2005-07-18 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* SOGoAptFormatter.[hm]: added -titlePlaceholder API for properly
|
||||
formatting appointments without titles (v0.9.30)
|
||||
|
||||
2005-07-13 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* WOContext+UIx.[hm]: new category to WOContext, currently provides
|
||||
-isUIxDebugEnabled (v0.9.29)
|
||||
|
||||
2005-07-08 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* UIxComponent.m: moved -isAccessRestricted method to
|
||||
UIxComponent+Agenor (v0.9.28)
|
||||
|
||||
2005-07-07 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* v0.9.27
|
||||
|
||||
* UIxComponent.m: implicitly set the context's queryPathSeperator
|
||||
when generating URIs used in redirects
|
||||
|
||||
* v0.9.26
|
||||
|
||||
* UIxComponent.m: added method -isAccessRestricted to indicate whether
|
||||
certain options might have to be disabled due to restrictions
|
||||
set by the customer
|
||||
|
||||
2005-07-06 Helge Hess <helge.hess@opengroupware.org>
|
||||
|
||||
* UIxComponent.m: added method -isInvokedBySafeMethod to check whether
|
||||
the current HTTP method is a safe one (eg HEAD/GET) (v0.9.25)
|
||||
|
||||
2005-07-05 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* SOGoAptFormatter.[hm]: new API. -stringForObjectValue: is deprecated
|
||||
now and should not be used anymore. Formatting needs a referenceDate
|
||||
in order to properly display time ranges. Time ranges are currently
|
||||
rendered in SOGoAptFormatter, but this should probably be delegated
|
||||
to a natural language aware auxiliary (date-)formatter. Also, some
|
||||
new formatting options have been introduced. (v0.9.24)
|
||||
|
||||
2005-01-26 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* SOGoDateFormatter.[hm]: new method -setFrenchDateFormat: to override
|
||||
the default ISO format. This will be chosen depending on locale
|
||||
automatically. The full description uses this setting when generating
|
||||
the appropriate part of the description. (v0.9.23)
|
||||
|
||||
2004-12-17 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* SOGoAptFormatter.m: remove "appointment" prefix from tooltips
|
||||
(v0.9.22)
|
||||
|
||||
2004-12-13 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* SOGoAptFormatter.[hm]: new option for formatter (v0.9.21)
|
||||
|
||||
* SOGoAptFormatter.[hm]: added ability to set custom title for private
|
||||
appointments. (v0.9.20)
|
||||
|
||||
2004-12-10 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* SOGoAptFormatter.[hm]: added formatting for private apts, additional
|
||||
cleanup (v0.9.19)
|
||||
|
||||
2004-12-08 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* UIxComponent.m: changed to use NGLogging (v0.9.18)
|
||||
|
||||
2004-10-22 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* UIxComponent.m: rewrote handling of queryParameters, these get
|
||||
constructed lazily now (v0.9.17)
|
||||
|
||||
2004-10-20 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* SOGoJSStringFormatter.[hm]: new formatter to properly escape certain
|
||||
strings passed to JavaScript (v0.9.16)
|
||||
|
||||
2004-10-18 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* UIxComponent.m: changed the implementation of -ownPath and fixed a
|
||||
bug in -userFolderPath (v0.9.15)
|
||||
|
||||
2004-10-12 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* UIxComponent.m: added some helper methods for computing relative
|
||||
paths within the application (v0.9.14)
|
||||
|
||||
2004-09-26 Helge Hess <helge.hess@opengroupware.org>
|
||||
|
||||
* UIxComponent.m: minor code cleanups (v0.9.13)
|
||||
|
||||
2004-09-25 Helge Hess <helge.hess@opengroupware.org>
|
||||
|
||||
* v0.9.12
|
||||
|
||||
* GNUmakefile.preamble: fixed library dependencies (used wrong project
|
||||
name)
|
||||
|
||||
* SOGoAptFormatter.m: minor code cleanups, fixed issue on MacOSX
|
||||
|
||||
2004-08-26 Helge Hess <helge.hess@skyrix.com>
|
||||
|
||||
* v0.9.11
|
||||
|
||||
* SOGoDateFormatter.m: minor cleanups
|
||||
|
||||
* UIxComponent.m: fixed includes to fix warnings
|
||||
|
||||
* added common.h
|
||||
|
||||
2004-08-24 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* UIxComponent.m: new date related methods moved here from UIxCalView
|
||||
(v0.9.10)
|
||||
|
||||
2004-08-14 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* UIxComponent.m: new method -isUIxDebugEnabled, triggered by new
|
||||
default "SOGoUIxDebugEnabled" (v0.9.9)
|
||||
|
||||
2004-08-13 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* v0.9.8
|
||||
|
||||
* SOGoAptFormatter.[hm]: added new formatter for appointments.
|
||||
|
||||
* UIxComponent.m: added warning.
|
||||
|
||||
* GNUmakefile: added SOGoAptFormatter.[hm]
|
||||
|
||||
2004-08-11 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* UIxComponent.[hm]: added -SoUser (v0.9.7)
|
||||
|
||||
2004-08-10 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* v0.9.6
|
||||
|
||||
* SOGoDateFormatter.[hm]: added fast localizable date formatter.
|
||||
|
||||
* GNUmakefile: added SOGoDateFormatter.[hm]
|
||||
|
||||
2004-07-26 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* UIxComponent.m: added "hm" queryParameter to add hour/minute part to
|
||||
selectedDate which is necessary for appointment proposals. Removed
|
||||
all additional stuff from -dateForDateString: and moved this to
|
||||
-selectedDate. IMHO this is always high-level behaviour which needs to
|
||||
be refined in the appropriate high-level method, not at conversion
|
||||
level. (v0.9.5)
|
||||
|
||||
2004-07-21 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* UIxComponent.[hm]: renamed some of the labels to better reflect the
|
||||
intention (and to avoid name clashes) (v0.9.4)
|
||||
|
||||
2004-07-21 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* UIxComponent.[hm]: date specific labels (weekday names, month names)
|
||||
(v0.9.3)
|
||||
|
||||
2004-07-20 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* UIxComponent.[hm]: new method -labelForKey: implemented very similar to
|
||||
new WOLabelAssociation in SOPE. Also implemented -locale. (v0.9.2)
|
||||
|
||||
2004-07-19 Marcus Mueller <znek@mulle-kybernetik.com>
|
||||
|
||||
* UIxComponent.m: new method -backendTimeZone.
|
||||
|
||||
2004-07-02 Helge Hess <helge.hess@opengroupware.org>
|
||||
|
||||
* UIxComponent.m: introduced 'viewTimeZone' method and adds some
|
||||
timezone correction to date methods
|
||||
|
||||
2004-06-30 Helge Hess <helge.hess@opengroupware.org>
|
||||
|
||||
* product.plist: make categories on SOGoObject instead of SxFolder
|
||||
|
||||
* GNUmakefile: patches for different build/runtime environment
|
||||
|
||||
* created ChangeLog
|
||||
@@ -0,0 +1,33 @@
|
||||
# GNUstep makefile
|
||||
|
||||
-include ../../config.make
|
||||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
include ../../Version
|
||||
include ./Version
|
||||
|
||||
LIBRARY_NAME = libSOGoUI
|
||||
|
||||
libSOGoUI_HEADER_FILES_DIR = .
|
||||
libSOGoUI_HEADER_FILES_INSTALL_DIR = /SOGoUI
|
||||
FHS_HEADER_DIRS = SOGoUI
|
||||
|
||||
libSOGoUI_HEADER_FILES += \
|
||||
UIxComponent.h \
|
||||
SOGoDateFormatter.h \
|
||||
SOGoAptFormatter.h \
|
||||
SOGoJSStringFormatter.h \
|
||||
WOContext+UIx.h \
|
||||
|
||||
libSOGoUI_OBJC_FILES += \
|
||||
UIxComponent.m \
|
||||
SOGoDateFormatter.m \
|
||||
SOGoAptFormatter.m \
|
||||
SOGoJSStringFormatter.m \
|
||||
WOContext+UIx.m \
|
||||
|
||||
# make
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
include $(GNUSTEP_MAKEFILES)/library.make
|
||||
-include GNUmakefile.postamble
|
||||
-include ../../fhslib.make
|
||||
@@ -0,0 +1,15 @@
|
||||
# compile settings
|
||||
|
||||
ifneq ($(GNUSTEP_BUILD_DIR),)
|
||||
RELBUILD_DIR_libSOGoCommonUI = $(GNUSTEP_OBJ_DIR)
|
||||
else
|
||||
RELBUILD_DIR_libSOGoCommonUI = $(GNUSTEP_OBJ_DIR)
|
||||
endif
|
||||
|
||||
libSOGoUI_LIBRARIES_DEPEND_UPON += \
|
||||
-lNGObjWeb \
|
||||
-lNGMime \
|
||||
-lNGStreams -lNGExtensions -lEOControl \
|
||||
-lXmlRpc -lDOM -lSaxObjC
|
||||
|
||||
SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib
|
||||
@@ -0,0 +1,7 @@
|
||||
Defaults
|
||||
========
|
||||
|
||||
|
||||
Name Value Synopsis
|
||||
------------------------------------------------------------------------------
|
||||
SOGoUIxDebugEnabled BOOL Trigger display of debug UI. Default is NO.
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
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: SOGoAptFormatter.h 797 2005-07-18 15:15:32Z znek $
|
||||
|
||||
|
||||
#ifndef __SOGoAptFormatter_H_
|
||||
#define __SOGoAptFormatter_H_
|
||||
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface SOGoAptFormatter : NSFormatter
|
||||
{
|
||||
NSTimeZone *tz;
|
||||
SEL formatAction;
|
||||
NSString *privateTitle;
|
||||
NSString *titlePlaceholder;
|
||||
BOOL omitsEndDate;
|
||||
}
|
||||
|
||||
- (id)initWithDisplayTimeZone:(NSTimeZone *)_tz;
|
||||
|
||||
- (void)setTooltip;
|
||||
- (void)setSingleLineFullDetails;
|
||||
- (void)setFullDetails;
|
||||
- (void)setTitleOnly;
|
||||
- (void)setShortTitleOnly;
|
||||
- (void)setOmitsEndDate;
|
||||
|
||||
- (void)setPrivateTooltip;
|
||||
- (void)setPrivateDetails;
|
||||
- (void)setPrivateTitleOnly;
|
||||
- (void)setPrivateSuppressAll;
|
||||
|
||||
- (void)setPrivateTitle:(NSString *)_privateTitle;
|
||||
- (NSString *)privateTitle;
|
||||
|
||||
- (void)setTitlePlaceholder:(NSString *)_titlePlaceholder;
|
||||
- (NSString *)titlePlaceholder;
|
||||
|
||||
- (NSString *)stringForObjectValue:(id)_obj
|
||||
referenceDate:(NSCalendarDate *)_refDate;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __SOGoAptFormatter_H_ */
|
||||
@@ -0,0 +1,321 @@
|
||||
/*
|
||||
Copyright (C) 2004-2005 SKYRIX Software AG
|
||||
|
||||
This file is part of OpenGroupware.org.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "SOGoAptFormatter.h"
|
||||
#include "common.h"
|
||||
|
||||
@interface SOGoAptFormatter(PrivateAPI)
|
||||
- (NSString *)titleForApt:(id)_apt :(NSCalendarDate *)_refDate;
|
||||
- (NSString *)shortTitleForApt:(id)_apt :(NSCalendarDate *)_refDate;
|
||||
- (NSTimeZone *)displayTZ;
|
||||
|
||||
- (void)appendTimeInfoForDate:(NSCalendarDate *)_date
|
||||
usingReferenceDate:(NSCalendarDate *)_refDate
|
||||
toBuffer:(NSMutableString *)_buf;
|
||||
|
||||
- (void)appendTimeInfoFromApt:(id)_apt
|
||||
usingReferenceDate:(NSCalendarDate *)_refDate
|
||||
toBuffer:(NSMutableString *)_buf;
|
||||
@end
|
||||
|
||||
// TODO: Clean this up, put it into NGExtensions!
|
||||
@interface NSCalendarDate (UIxCalMonthOverviewExtensions_UsedPrivates)
|
||||
- (BOOL)isDateInSameMonth:(NSCalendarDate *)_other;
|
||||
@end
|
||||
|
||||
@implementation SOGoAptFormatter
|
||||
|
||||
- (id)initWithDisplayTimeZone:(NSTimeZone *)_tz {
|
||||
if ((self = [super init])) {
|
||||
self->tz = [_tz retain];
|
||||
[self setFullDetails];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[self->tz release];
|
||||
[self->privateTitle release];
|
||||
[self->titlePlaceholder release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/* accessors */
|
||||
|
||||
- (void)setTooltip {
|
||||
self->formatAction = @selector(tooltipForApt::);
|
||||
}
|
||||
|
||||
- (void)setSingleLineFullDetails {
|
||||
self->formatAction = @selector(singleLineFullDetailsForApt::);
|
||||
}
|
||||
|
||||
- (void)setFullDetails {
|
||||
self->formatAction = @selector(fullDetailsForApt::);
|
||||
}
|
||||
|
||||
- (void)setPrivateTooltip {
|
||||
self->formatAction = @selector(tooltipForPrivateApt::);
|
||||
}
|
||||
|
||||
- (void)setPrivateDetails {
|
||||
self->formatAction = @selector(detailsForPrivateApt::);
|
||||
}
|
||||
|
||||
- (void)setTitleOnly {
|
||||
self->formatAction = @selector(titleForApt::);
|
||||
}
|
||||
|
||||
- (void)setShortTitleOnly {
|
||||
self->formatAction = @selector(shortTitleForApt::);
|
||||
}
|
||||
|
||||
- (void)setPrivateSuppressAll {
|
||||
self->formatAction = @selector(suppressApt::);
|
||||
}
|
||||
|
||||
- (void)setPrivateTitleOnly {
|
||||
self->formatAction = @selector(titleOnlyForPrivateApt::);
|
||||
}
|
||||
|
||||
- (void)setPrivateTitle:(NSString *)_privateTitle {
|
||||
ASSIGN(self->privateTitle, _privateTitle);
|
||||
}
|
||||
- (NSString *)privateTitle {
|
||||
return self->privateTitle;
|
||||
}
|
||||
|
||||
- (void)setTitlePlaceholder:(NSString *)_titlePlaceholder {
|
||||
ASSIGN(self->titlePlaceholder, _titlePlaceholder);
|
||||
}
|
||||
- (NSString *)titlePlaceholder {
|
||||
return self->titlePlaceholder;
|
||||
}
|
||||
|
||||
- (void)setOmitsEndDate {
|
||||
self->omitsEndDate = YES;
|
||||
}
|
||||
|
||||
- (NSString *)stringForObjectValue:(id)_obj {
|
||||
[self warnWithFormat:@"%s called, please use "
|
||||
@"stringForObjectValue:referenceDate: instead!",
|
||||
__PRETTY_FUNCTION__];
|
||||
return [self stringForObjectValue:_obj referenceDate:nil];
|
||||
}
|
||||
|
||||
- (NSString *)stringForObjectValue:(id)_obj
|
||||
referenceDate:(NSCalendarDate *)_refDate
|
||||
{
|
||||
return [self performSelector:self->formatAction
|
||||
withObject:_obj
|
||||
withObject:_refDate];
|
||||
}
|
||||
|
||||
/* Private */
|
||||
|
||||
- (NSTimeZone *)displayTZ {
|
||||
return self->tz;
|
||||
}
|
||||
|
||||
- (void)appendTimeInfoForDate:(NSCalendarDate *)_date
|
||||
usingReferenceDate:(NSCalendarDate *)_refDate
|
||||
toBuffer:(NSMutableString *)_buf
|
||||
{
|
||||
/* several cases:
|
||||
* 12:00
|
||||
* 12:00 - 13:00
|
||||
* 12:00 (07-05) - 13:00 (07-07)
|
||||
* 12:00 (12-30-2004) - 13:00 (01-01-2005)
|
||||
*/
|
||||
|
||||
[_buf appendFormat:@"%02i:%02i",
|
||||
[_date hourOfDay],
|
||||
[_date minuteOfHour]];
|
||||
if (_refDate && ![_date isDateOnSameDay:_refDate]) {
|
||||
[_buf appendFormat:@" (%02i-%02i",
|
||||
[_date monthOfYear],
|
||||
[_date dayOfMonth]];
|
||||
if ([_date yearOfCommonEra] != [_refDate yearOfCommonEra])
|
||||
[_buf appendFormat:@"-%04i", [_date yearOfCommonEra]];
|
||||
[_buf appendString:@")"];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)appendTimeInfoFromApt:(id)_apt
|
||||
usingReferenceDate:(NSCalendarDate *)_refDate
|
||||
toBuffer:(NSMutableString *)_buf
|
||||
{
|
||||
NSCalendarDate *startDate, *endDate, *date;
|
||||
NSTimeZone *dtz;
|
||||
BOOL spansRange;
|
||||
|
||||
spansRange = NO;
|
||||
dtz = [self displayTZ];
|
||||
startDate = [_apt valueForKey:@"startDate"];
|
||||
[startDate setTimeZone:dtz];
|
||||
endDate = [_apt valueForKey:@"endDate"];
|
||||
if(endDate != nil) {
|
||||
[endDate setTimeZone:dtz];
|
||||
spansRange = ![endDate isEqualToDate:startDate];
|
||||
}
|
||||
if (_refDate)
|
||||
[_refDate setTimeZone:dtz];
|
||||
|
||||
#if 0
|
||||
if (!_refDate || [startDate isDateOnSameDay:_refDate])
|
||||
date = startDate;
|
||||
else
|
||||
date = [startDate hour:0 minute:0];
|
||||
#else
|
||||
date = startDate;
|
||||
#endif
|
||||
|
||||
[self appendTimeInfoForDate:date
|
||||
usingReferenceDate:_refDate
|
||||
toBuffer:_buf];
|
||||
|
||||
if (spansRange && !self->omitsEndDate) {
|
||||
[_buf appendString:@" - "];
|
||||
#if 0
|
||||
if (!_refDate || [endDate isDateOnSameDay:_refDate])
|
||||
date = endDate;
|
||||
else
|
||||
date = [endDate hour:23 minute:59];
|
||||
#else
|
||||
date = endDate;
|
||||
#endif
|
||||
[self appendTimeInfoForDate:date
|
||||
usingReferenceDate:_refDate
|
||||
toBuffer:_buf];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)titleForApt:(id)_apt :(NSCalendarDate *)_refDate {
|
||||
NSString *title;
|
||||
|
||||
title = [_apt valueForKey:@"title"];
|
||||
if (![title isNotEmpty])
|
||||
title = [self titlePlaceholder];
|
||||
return title;
|
||||
}
|
||||
|
||||
- (NSString *)shortTitleForApt:(id)_apt :(NSCalendarDate *)_refDate {
|
||||
NSString *title;
|
||||
|
||||
title = [self titleForApt:_apt :_refDate];
|
||||
if ([title length] > 12)
|
||||
title = [[title substringToIndex:11] stringByAppendingString:@"..."];
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
- (NSString *)singleLineFullDetailsForApt:(id)_apt :(NSCalendarDate *)_refDate {
|
||||
NSMutableString *aptDescr;
|
||||
NSString *s;
|
||||
|
||||
aptDescr = [NSMutableString stringWithCapacity:60];
|
||||
[self appendTimeInfoFromApt:_apt
|
||||
usingReferenceDate:_refDate
|
||||
toBuffer:aptDescr];
|
||||
if ((s = [_apt valueForKey:@"location"]) != nil) {
|
||||
[aptDescr appendFormat:@"; (%@)", s];
|
||||
}
|
||||
if ((s = [self titleForApt:_apt :_refDate]) != nil)
|
||||
[aptDescr appendFormat:@"; %@", s];
|
||||
return aptDescr;
|
||||
}
|
||||
|
||||
- (NSString *)fullDetailsForApt:(id)_apt :(NSCalendarDate *)_refDate {
|
||||
NSMutableString *aptDescr;
|
||||
NSString *s;
|
||||
|
||||
aptDescr = [NSMutableString stringWithCapacity:60];
|
||||
[self appendTimeInfoFromApt:_apt
|
||||
usingReferenceDate:_refDate
|
||||
toBuffer:aptDescr];
|
||||
if ((s = [_apt valueForKey:@"location"]) != nil) {
|
||||
if([s length] > 12)
|
||||
s = [[s substringToIndex:11] stringByAppendingString:@"..."];
|
||||
[aptDescr appendFormat:@" (%@)", s];
|
||||
}
|
||||
if ((s = [self shortTitleForApt:_apt :_refDate]) != nil)
|
||||
[aptDescr appendFormat:@"<br />%@", s];
|
||||
|
||||
return aptDescr;
|
||||
}
|
||||
|
||||
- (NSString *)detailsForPrivateApt:(id)_apt :(NSCalendarDate *)_refDate {
|
||||
NSMutableString *aptDescr;
|
||||
NSString *s;
|
||||
|
||||
aptDescr = [NSMutableString stringWithCapacity:40];
|
||||
[self appendTimeInfoFromApt:_apt
|
||||
usingReferenceDate:_refDate
|
||||
toBuffer:aptDescr];
|
||||
if ((s = [self privateTitle]) != nil)
|
||||
[aptDescr appendFormat:@"<br />%@", s];
|
||||
return aptDescr;
|
||||
}
|
||||
|
||||
- (NSString *)titleOnlyForPrivateApt:(id)_apt :(NSCalendarDate *)_refDate {
|
||||
NSString *s;
|
||||
|
||||
s = [self privateTitle];
|
||||
if(!s)
|
||||
return @"";
|
||||
return s;
|
||||
}
|
||||
|
||||
- (NSString *)tooltipForApt:(id)_apt :(NSCalendarDate *)_refDate {
|
||||
NSMutableString *aptDescr;
|
||||
NSString *s;
|
||||
|
||||
aptDescr = [NSMutableString stringWithCapacity:60];
|
||||
[self appendTimeInfoFromApt:_apt
|
||||
usingReferenceDate:_refDate
|
||||
toBuffer:aptDescr];
|
||||
if ((s = [self titleForApt:_apt :_refDate]) != nil)
|
||||
[aptDescr appendFormat:@"\n%@", s];
|
||||
if ((s = [_apt valueForKey:@"location"]) != nil)
|
||||
[aptDescr appendFormat:@"\n%@", s];
|
||||
|
||||
return aptDescr;
|
||||
}
|
||||
|
||||
- (NSString *)tooltipForPrivateApt:(id)_apt :(NSCalendarDate *)_refDate {
|
||||
NSMutableString *aptDescr;
|
||||
NSString *s;
|
||||
|
||||
aptDescr = [NSMutableString stringWithCapacity:25];
|
||||
[self appendTimeInfoFromApt:_apt
|
||||
usingReferenceDate:_refDate
|
||||
toBuffer:aptDescr];
|
||||
if ((s = [self privateTitle]) != nil)
|
||||
[aptDescr appendFormat:@"\n%@", s];
|
||||
|
||||
return aptDescr;
|
||||
}
|
||||
|
||||
- (NSString *)suppressApt:(id)_apt :(NSCalendarDate *)_refDate {
|
||||
return @"";
|
||||
}
|
||||
|
||||
@end /* SOGoAptFormatter */
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright (C) 2004 SKYRIX Software AG
|
||||
|
||||
This file is part of OpenGroupware.org.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef __SOGoDateFormatter_H_
|
||||
#define __SOGoDateFormatter_H_
|
||||
|
||||
#import <Foundation/NSFormatter.h>
|
||||
|
||||
@class NSString, NSDictionary;
|
||||
|
||||
@interface SOGoDateFormatter : NSFormatter
|
||||
{
|
||||
NSDictionary *locale;
|
||||
SEL formatAction;
|
||||
SEL auxFormatAction;
|
||||
}
|
||||
|
||||
- (id)initWithLocale:(NSDictionary *)_locale;
|
||||
|
||||
- (void)setISODateFormat;
|
||||
- (void)setFrenchDateFormat;
|
||||
|
||||
- (void)setFullWeekdayNameAndDetails;
|
||||
|
||||
- (NSString *)stringForObjectValue:(id)_obj;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __SOGoDateFormatter_H_ */
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
Copyright (C) 2004 SKYRIX Software AG
|
||||
|
||||
This file is part of OpenGroupware.org.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "SOGoDateFormatter.h"
|
||||
#include "common.h"
|
||||
|
||||
@interface SOGoDateFormatter (PrivateAPI)
|
||||
- (NSString *)shortDayOfWeek:(int)_day;
|
||||
- (NSString *)fullDayOfWeek:(int)_day;
|
||||
- (NSString *)shortMonthOfYear:(int)_month;
|
||||
- (NSString *)fullMonthOfYear:(int)_month;
|
||||
|
||||
- (NSString *)isoDateFormatForDate:(NSCalendarDate *)_date;
|
||||
- (NSString *)fullWeekdayNameAndDetailsForDate:(NSCalendarDate *)_date;
|
||||
@end
|
||||
|
||||
@implementation SOGoDateFormatter
|
||||
|
||||
- (id)initWithLocale:(NSDictionary *)_locale {
|
||||
if ((self = [super init])) {
|
||||
self->locale = [_locale retain];
|
||||
|
||||
if ([[self->locale objectForKey:@"NSLocaleCode"] isEqualToString:@"fr"])
|
||||
[self setFrenchDateFormat];
|
||||
else
|
||||
[self setISODateFormat];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[self->locale release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/* accessors */
|
||||
|
||||
- (void)setISODateFormat {
|
||||
self->formatAction = @selector(isoDateFormatForDate:);
|
||||
}
|
||||
|
||||
- (void)setFrenchDateFormat {
|
||||
self->formatAction = @selector(frenchDateFormatForDate:);
|
||||
}
|
||||
|
||||
- (void)setFullWeekdayNameAndDetails {
|
||||
self->auxFormatAction = self->formatAction;
|
||||
self->formatAction = @selector(fullWeekdayNameAndDetailsForDate:);
|
||||
}
|
||||
|
||||
/* operation */
|
||||
|
||||
- (NSString *)stringForObjectValue:(id)_obj {
|
||||
return [self performSelector:self->formatAction
|
||||
withObject:_obj];
|
||||
}
|
||||
|
||||
/* Helpers */
|
||||
|
||||
- (NSString *)shortDayOfWeek:(int)_day {
|
||||
return [[self->locale objectForKey:@"NSShortWeekDayNameArray"]
|
||||
objectAtIndex:_day];
|
||||
}
|
||||
|
||||
- (NSString *)fullDayOfWeek:(int)_day {
|
||||
return [[self->locale objectForKey:@"NSWeekDayNameArray"]
|
||||
objectAtIndex:_day];
|
||||
}
|
||||
|
||||
- (NSString *)shortMonthOfYear:(int)_month {
|
||||
return [[self->locale objectForKey:@"NSShortMonthNameArray"]
|
||||
objectAtIndex:_month - 1];
|
||||
}
|
||||
|
||||
- (NSString *)fullMonthOfYear:(int)_month {
|
||||
return [[self->locale objectForKey:@"NSMonthNameArray"]
|
||||
objectAtIndex:_month - 1];
|
||||
}
|
||||
|
||||
|
||||
/* Private API */
|
||||
|
||||
- (NSString *)isoDateFormatForDate:(NSCalendarDate *)_date {
|
||||
char buf[16];
|
||||
|
||||
if (_date == nil) return nil;
|
||||
snprintf(buf, sizeof(buf),
|
||||
"%04d-%02d-%02d",
|
||||
[_date yearOfCommonEra], [_date monthOfYear], [_date dayOfMonth]);
|
||||
return [NSString stringWithCString:buf];
|
||||
}
|
||||
|
||||
- (NSString *)frenchDateFormatForDate:(NSCalendarDate *)_date {
|
||||
char buf[16];
|
||||
|
||||
if (_date == nil) return nil;
|
||||
snprintf(buf, sizeof(buf),
|
||||
"%02d/%02d/%04d",
|
||||
[_date dayOfMonth], [_date monthOfYear], [_date yearOfCommonEra]);
|
||||
return [NSString stringWithCString:buf];
|
||||
}
|
||||
|
||||
- (NSString *)fullWeekdayNameAndDetailsForDate:(NSCalendarDate *)_date {
|
||||
NSMutableString *desc;
|
||||
|
||||
if (_date == nil) return nil;
|
||||
|
||||
desc = [NSMutableString stringWithCapacity:24];
|
||||
[desc appendString:[self fullDayOfWeek:[_date dayOfWeek]]];
|
||||
[desc appendString:@", "];
|
||||
[desc appendString:[self performSelector:self->auxFormatAction
|
||||
withObject:_date]];
|
||||
[desc appendString:@" "];
|
||||
[desc appendFormat:@"%02d:%02d ", [_date hourOfDay], [_date minuteOfHour]];
|
||||
[desc appendString:[[_date timeZone] abbreviation]];
|
||||
return desc;
|
||||
}
|
||||
|
||||
@end /* SOGoDateFormatter */
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
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: SOGoJSStringFormatter.h 415 2004-10-20 15:47:45Z znek $
|
||||
|
||||
|
||||
#ifndef __SOGoJSStringFormatter_H_
|
||||
#define __SOGoJSStringFormatter_H_
|
||||
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#include <NGExtensions/NSString+Escaping.h>
|
||||
|
||||
@interface SOGoJSStringFormatter : NSObject <NGStringEscaping>
|
||||
{
|
||||
}
|
||||
|
||||
+ (id)sharedFormatter;
|
||||
|
||||
- (NSString *)stringByEscapingQuotesInString:(NSString *)_s;
|
||||
- (NSString *)stringByEscapingSingleQuotesInString:(NSString *)_s;
|
||||
- (NSString *)stringByEscapingDoubleQuotesInString:(NSString *)_s;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __SOGoJSStringFormatter_H_ */
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
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: SOGoJSStringFormatter.m 415 2004-10-20 15:47:45Z znek $
|
||||
|
||||
|
||||
#include "SOGoJSStringFormatter.h"
|
||||
#include "common.h"
|
||||
|
||||
@implementation SOGoJSStringFormatter
|
||||
|
||||
static NSCharacterSet *quotesSet = nil;
|
||||
static NSCharacterSet *squoteSet = nil;
|
||||
static NSCharacterSet *dquoteSet = nil;
|
||||
|
||||
+ (void)initialize {
|
||||
static BOOL didInit = NO;
|
||||
|
||||
if(didInit)
|
||||
return;
|
||||
|
||||
didInit = YES;
|
||||
quotesSet = \
|
||||
[[NSCharacterSet characterSetWithCharactersInString:@"'\""] retain];
|
||||
squoteSet = \
|
||||
[[NSCharacterSet characterSetWithCharactersInString:@"'"] retain];
|
||||
dquoteSet = \
|
||||
[[NSCharacterSet characterSetWithCharactersInString:@"\""] retain];
|
||||
}
|
||||
|
||||
+ (id)sharedFormatter {
|
||||
static id sharedInstance = nil;
|
||||
if(!sharedInstance) {
|
||||
sharedInstance = [[self alloc] init];
|
||||
}
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
- (NSString *)stringByEscapingQuotesInString:(NSString *)_s {
|
||||
return [_s stringByEscapingCharactersFromSet:quotesSet
|
||||
usingStringEscaping:self];
|
||||
}
|
||||
|
||||
- (NSString *)stringByEscapingSingleQuotesInString:(NSString *)_s {
|
||||
return [_s stringByEscapingCharactersFromSet:squoteSet
|
||||
usingStringEscaping:self];
|
||||
}
|
||||
|
||||
- (NSString *)stringByEscapingDoubleQuotesInString:(NSString *)_s {
|
||||
return [_s stringByEscapingCharactersFromSet:dquoteSet
|
||||
usingStringEscaping:self];
|
||||
}
|
||||
|
||||
- (NSString *)stringByEscapingString:(NSString *)_s {
|
||||
if([_s isEqualToString:@"'"]) {
|
||||
return @"&apos;";
|
||||
}
|
||||
return @"&quot;";
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
Copyright (C) 2000-2005 SKYRIX Software AG
|
||||
|
||||
This file is part of OpenGroupware.org.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef __UIxComponent_H_
|
||||
#define __UIxComponent_H_
|
||||
|
||||
#include <NGObjWeb/SoComponent.h>
|
||||
|
||||
/*
|
||||
UIxComponent
|
||||
|
||||
Common superclass for most components used in SOGo.
|
||||
|
||||
TODO: document facilities.
|
||||
*/
|
||||
|
||||
@class NSCalendarDate, NSTimeZone, NSMutableDictionary, SoUser;
|
||||
|
||||
@interface UIxComponent : SoComponent
|
||||
{
|
||||
NSMutableDictionary *queryParameters;
|
||||
}
|
||||
|
||||
- (NSString *)queryParameterForKey:(NSString *)_key;
|
||||
- (NSDictionary *)queryParameters;
|
||||
|
||||
/* use this to set 'sticky' query parameters */
|
||||
- (void)setQueryParameter:(NSString *)_param forKey:(NSString *)_key;
|
||||
|
||||
/* date related query parameters */
|
||||
- (NSDictionary *)queryParametersBySettingSelectedDate:(NSCalendarDate *)_date;
|
||||
- (void)setSelectedDateQueryParameter:(NSCalendarDate *)_newDate
|
||||
inDictionary:(NSMutableDictionary *)_qp;
|
||||
|
||||
/* appends queryParameters to _method if any are set */
|
||||
- (NSString *)completeHrefForMethod:(NSString *)_method;
|
||||
|
||||
- (NSString *)ownMethodName;
|
||||
|
||||
- (NSString *)userFolderPath;
|
||||
- (NSString *)ownPath;
|
||||
- (NSString *)relativePathToUserFolderSubPath:(NSString *)_sub;
|
||||
|
||||
/* date selection */
|
||||
- (NSTimeZone *)viewTimeZone;
|
||||
- (NSTimeZone *)backendTimeZone;
|
||||
- (NSCalendarDate *)selectedDate;
|
||||
- (NSString *)dateStringForDate:(NSCalendarDate *)_date;
|
||||
- (NSCalendarDate *)dateForDateString:(NSString *)_dateString;
|
||||
|
||||
/* SoUser */
|
||||
- (SoUser *)user;
|
||||
- (NSString *)shortUserNameForDisplay;
|
||||
|
||||
/* labels */
|
||||
- (NSString *)labelForKey:(NSString *)_key;
|
||||
|
||||
- (NSString *)localizedNameForDayOfWeek:(unsigned)_dayOfWeek;
|
||||
- (NSString *)localizedAbbreviatedNameForDayOfWeek:(unsigned)_dayOfWeek;
|
||||
- (NSString *)localizedNameForMonthOfYear:(unsigned)_monthOfYear;
|
||||
- (NSString *)localizedAbbreviatedNameForMonthOfYear:(unsigned)_monthOfYear;
|
||||
|
||||
/* HTTP method safety */
|
||||
- (BOOL)isInvokedBySafeMethod;
|
||||
|
||||
/* locale */
|
||||
- (NSDictionary *)locale;
|
||||
|
||||
/* Debugging */
|
||||
- (BOOL)isUIxDebugEnabled;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __UIxComponent_H_ */
|
||||
@@ -0,0 +1,459 @@
|
||||
/*
|
||||
Copyright (C) 2004 SKYRIX Software AG
|
||||
|
||||
This file is part of OpenGroupware.org.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "UIxComponent.h"
|
||||
#include "SOGoJSStringFormatter.h"
|
||||
#include "common.h"
|
||||
#include <NGObjWeb/SoHTTPAuthenticator.h>
|
||||
|
||||
@interface UIxComponent (PrivateAPI)
|
||||
- (void)_parseQueryString:(NSString *)_s;
|
||||
- (NSMutableDictionary *)_queryParameters;
|
||||
@end
|
||||
|
||||
@implementation UIxComponent
|
||||
|
||||
static NSTimeZone *MET = nil;
|
||||
static NSTimeZone *GMT = nil;
|
||||
|
||||
static NSMutableArray *dayLabelKeys = nil;
|
||||
static NSMutableArray *abbrDayLabelKeys = nil;
|
||||
static NSMutableArray *monthLabelKeys = nil;
|
||||
static NSMutableArray *abbrMonthLabelKeys = nil;
|
||||
|
||||
static BOOL uixDebugEnabled = NO;
|
||||
|
||||
+ (int)version {
|
||||
return [super version] + 0 /* v2 */;
|
||||
}
|
||||
|
||||
+ (void)initialize {
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
NSAssert2([super version] == 2,
|
||||
@"invalid superclass (%@) version %i !",
|
||||
NSStringFromClass([self superclass]), [super version]);
|
||||
|
||||
uixDebugEnabled = [ud boolForKey:@"SOGoUIxDebugEnabled"];
|
||||
|
||||
if (MET == nil) {
|
||||
MET = [[NSTimeZone timeZoneWithAbbreviation:@"MET"] retain];
|
||||
GMT = [[NSTimeZone timeZoneWithAbbreviation:@"GMT"] retain];
|
||||
}
|
||||
if (dayLabelKeys == nil) {
|
||||
dayLabelKeys = [[NSMutableArray alloc] initWithCapacity:7];
|
||||
[dayLabelKeys addObject:@"Sunday"];
|
||||
[dayLabelKeys addObject:@"Monday"];
|
||||
[dayLabelKeys addObject:@"Tuesday"];
|
||||
[dayLabelKeys addObject:@"Wednesday"];
|
||||
[dayLabelKeys addObject:@"Thursday"];
|
||||
[dayLabelKeys addObject:@"Friday"];
|
||||
[dayLabelKeys addObject:@"Saturday"];
|
||||
|
||||
abbrDayLabelKeys = [[NSMutableArray alloc] initWithCapacity:7];
|
||||
[abbrDayLabelKeys addObject:@"a2_Sunday"];
|
||||
[abbrDayLabelKeys addObject:@"a2_Monday"];
|
||||
[abbrDayLabelKeys addObject:@"a2_Tuesday"];
|
||||
[abbrDayLabelKeys addObject:@"a2_Wednesday"];
|
||||
[abbrDayLabelKeys addObject:@"a2_Thursday"];
|
||||
[abbrDayLabelKeys addObject:@"a2_Friday"];
|
||||
[abbrDayLabelKeys addObject:@"a2_Saturday"];
|
||||
|
||||
monthLabelKeys = [[NSMutableArray alloc] initWithCapacity:12];
|
||||
[monthLabelKeys addObject:@"January"];
|
||||
[monthLabelKeys addObject:@"February"];
|
||||
[monthLabelKeys addObject:@"March"];
|
||||
[monthLabelKeys addObject:@"April"];
|
||||
[monthLabelKeys addObject:@"May"];
|
||||
[monthLabelKeys addObject:@"June"];
|
||||
[monthLabelKeys addObject:@"July"];
|
||||
[monthLabelKeys addObject:@"August"];
|
||||
[monthLabelKeys addObject:@"September"];
|
||||
[monthLabelKeys addObject:@"October"];
|
||||
[monthLabelKeys addObject:@"November"];
|
||||
[monthLabelKeys addObject:@"December"];
|
||||
|
||||
abbrMonthLabelKeys = [[NSMutableArray alloc] initWithCapacity:12];
|
||||
[abbrMonthLabelKeys addObject:@"a3_January"];
|
||||
[abbrMonthLabelKeys addObject:@"a3_February"];
|
||||
[abbrMonthLabelKeys addObject:@"a3_March"];
|
||||
[abbrMonthLabelKeys addObject:@"a3_April"];
|
||||
[abbrMonthLabelKeys addObject:@"a3_May"];
|
||||
[abbrMonthLabelKeys addObject:@"a3_June"];
|
||||
[abbrMonthLabelKeys addObject:@"a3_July"];
|
||||
[abbrMonthLabelKeys addObject:@"a3_August"];
|
||||
[abbrMonthLabelKeys addObject:@"a3_September"];
|
||||
[abbrMonthLabelKeys addObject:@"a3_October"];
|
||||
[abbrMonthLabelKeys addObject:@"a3_November"];
|
||||
[abbrMonthLabelKeys addObject:@"a3_December"];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[self->queryParameters release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/* query parameters */
|
||||
|
||||
- (void)_parseQueryString:(NSString *)_s {
|
||||
NSEnumerator *e;
|
||||
NSString *part;
|
||||
|
||||
e = [[_s componentsSeparatedByString:@"&"] objectEnumerator];
|
||||
while ((part = [e nextObject]) != nil) {
|
||||
NSRange r;
|
||||
NSString *key, *value;
|
||||
|
||||
r = [part rangeOfString:@"="];
|
||||
if (r.length == 0) {
|
||||
/* missing value of query parameter */
|
||||
key = [part stringByUnescapingURL];
|
||||
value = @"1";
|
||||
}
|
||||
else {
|
||||
key = [[part substringToIndex:r.location] stringByUnescapingURL];
|
||||
value = [[part substringFromIndex:(r.location + r.length)]
|
||||
stringByUnescapingURL];
|
||||
}
|
||||
[self->queryParameters setObject:value forKey:key];
|
||||
}
|
||||
}
|
||||
- (void)addKeepAliveFormValuesToQueryParameters {
|
||||
}
|
||||
|
||||
- (NSString *)queryParameterForKey:(NSString *)_key {
|
||||
return [[self _queryParameters] objectForKey:_key];
|
||||
}
|
||||
|
||||
- (void)setQueryParameter:(NSString *)_param forKey:(NSString *)_key {
|
||||
if(_key == nil)
|
||||
return;
|
||||
|
||||
if(_param != nil)
|
||||
[[self _queryParameters] setObject:_param forKey:_key];
|
||||
else
|
||||
[[self _queryParameters] removeObjectForKey:_key];
|
||||
}
|
||||
|
||||
- (NSMutableDictionary *)_queryParameters {
|
||||
// TODO: this code is weird, should use WORequest methods for parsing
|
||||
WORequest *req;
|
||||
NSString *uri;
|
||||
NSRange r;
|
||||
|
||||
if (self->queryParameters)
|
||||
return self->queryParameters;
|
||||
|
||||
self->queryParameters = [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
|
||||
req = [[self context] request];
|
||||
uri = [req uri];
|
||||
r = [uri rangeOfString:@"?" options:NSBackwardsSearch];
|
||||
if (r.length > 0) {
|
||||
NSString *qs;
|
||||
|
||||
qs = [uri substringFromIndex:NSMaxRange(r)];
|
||||
[self _parseQueryString:qs];
|
||||
}
|
||||
|
||||
/* add form values */
|
||||
[self addKeepAliveFormValuesToQueryParameters];
|
||||
|
||||
return self->queryParameters;
|
||||
}
|
||||
|
||||
- (NSDictionary *)queryParameters {
|
||||
return [self _queryParameters];
|
||||
}
|
||||
|
||||
- (NSDictionary *)queryParametersBySettingSelectedDate:(NSCalendarDate *)_date{
|
||||
NSMutableDictionary *qp;
|
||||
|
||||
qp = [[self queryParameters] mutableCopy];
|
||||
[self setSelectedDateQueryParameter:_date inDictionary:qp];
|
||||
return [qp autorelease];
|
||||
}
|
||||
|
||||
- (void)setSelectedDateQueryParameter:(NSCalendarDate *)_newDate
|
||||
inDictionary:(NSMutableDictionary *)_qp;
|
||||
{
|
||||
if(_newDate != nil)
|
||||
[_qp setObject:[self dateStringForDate:_newDate] forKey:@"day"];
|
||||
else
|
||||
[_qp removeObjectForKey:@"day"];
|
||||
}
|
||||
|
||||
- (NSString *)completeHrefForMethod:(NSString *)_method {
|
||||
WOContext *ctx;
|
||||
NSDictionary *qp;
|
||||
NSString *qs, *qps;
|
||||
|
||||
qp = [self queryParameters];
|
||||
if([qp count] == 0)
|
||||
return _method;
|
||||
|
||||
ctx = [self context];
|
||||
qps = [ctx queryPathSeparator];
|
||||
[ctx setQueryPathSeparator:@"&"];
|
||||
qs = [ctx queryStringFromDictionary:qp];
|
||||
[ctx setQueryPathSeparator:qps];
|
||||
return [_method stringByAppendingFormat:@"?%@", qs];
|
||||
}
|
||||
|
||||
- (NSString *)ownMethodName {
|
||||
NSString *uri;
|
||||
NSRange r;
|
||||
|
||||
uri = [[[self context] request] uri];
|
||||
|
||||
/* first: cut off query parameters */
|
||||
|
||||
r = [uri rangeOfString:@"?" options:NSBackwardsSearch];
|
||||
if (r.length > 0)
|
||||
uri = [uri substringToIndex:r.location];
|
||||
|
||||
/* next: strip trailing slash */
|
||||
|
||||
if ([uri hasSuffix:@"/"]) uri = [uri substringToIndex:([uri length] - 1)];
|
||||
r = [uri rangeOfString:@"/" options:NSBackwardsSearch];
|
||||
|
||||
/* then: cut of last path component */
|
||||
|
||||
if (r.length == 0) // no slash? are we at root?
|
||||
return @"/";
|
||||
|
||||
return [uri substringFromIndex:(r.location + 1)];
|
||||
}
|
||||
|
||||
- (NSString *)userFolderPath {
|
||||
WOContext *ctx;
|
||||
NSArray *traversalObjects;
|
||||
NSString *url;
|
||||
NSString *path;
|
||||
|
||||
ctx = [self context];
|
||||
traversalObjects = [ctx objectTraversalStack];
|
||||
url = [[traversalObjects objectAtIndex:0]
|
||||
baseURLInContext:ctx];
|
||||
path = [[NSURL URLWithString:url] path];
|
||||
path = [path stringByAppendingPathComponent:[[ctx activeUser] login]];
|
||||
return path;
|
||||
}
|
||||
|
||||
- (NSString *)ownPath {
|
||||
NSString *uri;
|
||||
NSRange r;
|
||||
|
||||
uri = [[[self context] request] uri];
|
||||
|
||||
/* first: cut off query parameters */
|
||||
|
||||
r = [uri rangeOfString:@"?" options:NSBackwardsSearch];
|
||||
if (r.length > 0)
|
||||
uri = [uri substringToIndex:r.location];
|
||||
return uri;
|
||||
}
|
||||
|
||||
- (NSString *)relativePathToUserFolderSubPath:(NSString *)_sub {
|
||||
NSString *dst, *rel;
|
||||
|
||||
dst = [[self userFolderPath] stringByAppendingPathComponent:_sub];
|
||||
rel = [dst urlPathRelativeToPath:[self ownPath]];
|
||||
return rel;
|
||||
}
|
||||
|
||||
/* date */
|
||||
|
||||
- (NSTimeZone *)viewTimeZone {
|
||||
// Note: also in the folder, should be based on a cookie?
|
||||
return MET;
|
||||
}
|
||||
|
||||
- (NSTimeZone *)backendTimeZone {
|
||||
return GMT;
|
||||
}
|
||||
|
||||
- (NSCalendarDate *)selectedDate {
|
||||
NSString *s;
|
||||
NSCalendarDate *cdate;
|
||||
|
||||
s = [self queryParameterForKey:@"day"];
|
||||
cdate = ([s length] > 0)
|
||||
? [self dateForDateString:s]
|
||||
: [NSCalendarDate date];
|
||||
[cdate setTimeZone:[self viewTimeZone]];
|
||||
s = [self queryParameterForKey:@"hm"];
|
||||
if([s length] == 4) {
|
||||
unsigned hour, minute;
|
||||
|
||||
hour = [[s substringToIndex:2] unsignedIntValue];
|
||||
minute = [[s substringFromIndex:2] unsignedIntValue];
|
||||
cdate = [cdate hour:hour minute:minute];
|
||||
}
|
||||
else {
|
||||
cdate = [cdate hour:12 minute:0];
|
||||
}
|
||||
return cdate;
|
||||
}
|
||||
|
||||
- (NSString *)dateStringForDate:(NSCalendarDate *)_date {
|
||||
[_date setTimeZone:[self viewTimeZone]];
|
||||
return [_date descriptionWithCalendarFormat:@"%Y%m%d"];
|
||||
}
|
||||
|
||||
- (NSCalendarDate *)dateForDateString:(NSString *)_dateString {
|
||||
return [NSCalendarDate dateWithString:_dateString
|
||||
calendarFormat:@"%Y%m%d"];
|
||||
}
|
||||
|
||||
|
||||
/* SoUser */
|
||||
|
||||
- (SoUser *)user {
|
||||
WOContext *ctx;
|
||||
|
||||
ctx = [self context];
|
||||
return [[[self clientObject] authenticatorInContext:ctx] userInContext:ctx];
|
||||
}
|
||||
|
||||
- (NSString *)shortUserNameForDisplay {
|
||||
// TODO: better use a SoUser formatter?
|
||||
// TODO: who calls that?
|
||||
NSString *s;
|
||||
NSRange r;
|
||||
|
||||
// TODO: USE USER MANAGER INSTEAD!
|
||||
|
||||
s = [[self user] login];
|
||||
if ([s length] < 10)
|
||||
return s;
|
||||
|
||||
// TODO: algorithm might be inappropriate, depends on the actual UID
|
||||
|
||||
r = [s rangeOfString:@"."];
|
||||
if (r.length == 0)
|
||||
return s;
|
||||
|
||||
return [s substringToIndex:r.location];
|
||||
}
|
||||
|
||||
/* labels */
|
||||
|
||||
- (NSString *)labelForKey:(NSString *)_str {
|
||||
WOResourceManager *rm;
|
||||
NSArray *languages;
|
||||
NSString *label;
|
||||
NSString *lKey, *lTable, *lVal;
|
||||
NSRange r;
|
||||
|
||||
if ([_str length] == 0)
|
||||
return nil;
|
||||
|
||||
/* lookup languages */
|
||||
|
||||
languages = [[self context] resourceLookupLanguages];
|
||||
|
||||
/* find resource manager */
|
||||
|
||||
if ((rm = [self resourceManager]) == nil)
|
||||
rm = [[WOApplication application] resourceManager];
|
||||
if (rm == nil)
|
||||
[self warnWithFormat:@"missing resource manager!"];
|
||||
|
||||
/* get parameters */
|
||||
|
||||
r = [_str rangeOfString:@"/"];
|
||||
if (r.length > 0) {
|
||||
lTable = [_str substringToIndex:r.location];
|
||||
lKey = [_str substringFromIndex:(r.location + r.length)];
|
||||
}
|
||||
else {
|
||||
lTable = nil;
|
||||
lKey = _str;
|
||||
}
|
||||
lVal = lKey;
|
||||
|
||||
if ([lKey hasPrefix:@"$"])
|
||||
lKey = [self valueForKeyPath:[lKey substringFromIndex:1]];
|
||||
|
||||
if ([lTable hasPrefix:@"$"])
|
||||
lTable = [self valueForKeyPath:[lTable substringFromIndex:1]];
|
||||
|
||||
#if 0
|
||||
if ([lVal hasPrefix:@"$"])
|
||||
lVal = [self valueForKeyPath:[lVal substringFromIndex:1]];
|
||||
|
||||
#endif
|
||||
|
||||
/* lookup string */
|
||||
|
||||
label = [rm stringForKey:lKey inTableNamed:lTable withDefaultValue:lVal
|
||||
languages:languages];
|
||||
return label;
|
||||
}
|
||||
|
||||
- (NSString *)localizedNameForDayOfWeek:(unsigned)_dayOfWeek {
|
||||
NSString *key = [dayLabelKeys objectAtIndex:_dayOfWeek % 7];
|
||||
return [self labelForKey:key];
|
||||
}
|
||||
|
||||
- (NSString *)localizedAbbreviatedNameForDayOfWeek:(unsigned)_dayOfWeek {
|
||||
NSString *key = [abbrDayLabelKeys objectAtIndex:_dayOfWeek % 7];
|
||||
return [self labelForKey:key];
|
||||
}
|
||||
|
||||
- (NSString *)localizedNameForMonthOfYear:(unsigned)_monthOfYear {
|
||||
NSString *key = [monthLabelKeys objectAtIndex:(_monthOfYear - 1) % 12];
|
||||
return [self labelForKey:key];
|
||||
}
|
||||
|
||||
- (NSString *)localizedAbbreviatedNameForMonthOfYear:(unsigned)_monthOfYear {
|
||||
NSString *key = [abbrMonthLabelKeys objectAtIndex:(_monthOfYear - 1) % 12];
|
||||
return [self labelForKey:key];
|
||||
}
|
||||
|
||||
/* HTTP method safety */
|
||||
|
||||
- (BOOL)isInvokedBySafeMethod {
|
||||
// TODO: move to WORequest?
|
||||
NSString *m;
|
||||
|
||||
m = [[[self context] request] method];
|
||||
if ([m isEqualToString:@"GET"]) return YES;
|
||||
if ([m isEqualToString:@"HEAD"]) return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
/* locale */
|
||||
|
||||
- (NSDictionary *)locale {
|
||||
/* we need no fallback here, as locale is guaranteed to be set by sogod */
|
||||
return [[self context] valueForKey:@"locale"];
|
||||
}
|
||||
|
||||
/* debugging */
|
||||
|
||||
- (BOOL)isUIxDebugEnabled {
|
||||
return uixDebugEnabled;
|
||||
}
|
||||
|
||||
@end /* UIxComponent */
|
||||
@@ -0,0 +1,5 @@
|
||||
# version file
|
||||
|
||||
SUBMINOR_VERSION:=36
|
||||
|
||||
# v0.9.18 requires NGExtensions v4.5.136
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
Copyright (C) 2000-2005 SKYRIX Software AG
|
||||
|
||||
This file is part of OpenGroupware.org.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef __SOGoUI_WOContext_UIx_H_
|
||||
#define __SOGoUI_WOContext_UIx_H_
|
||||
|
||||
#include <NGObjWeb/WOContext.h>
|
||||
|
||||
@interface WOContext (UIx)
|
||||
|
||||
- (BOOL)isUIxDebugEnabled;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __SOGoUI_WOContext_UIx_H_ */
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
Copyright (C) 2000-2005 SKYRIX Software AG
|
||||
|
||||
This file is part of OpenGroupware.org.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "WOContext+UIx.h"
|
||||
#include "common.h"
|
||||
|
||||
@implementation WOContext (UIx)
|
||||
|
||||
- (BOOL)isUIxDebugEnabled {
|
||||
NSNumber *bv;
|
||||
|
||||
if ((bv = [self objectForKey:@"_isUIxDebugEnabled"]) == nil) {
|
||||
NSUserDefaults *ud;
|
||||
BOOL uixDebugEnabled;
|
||||
|
||||
ud = [NSUserDefaults standardUserDefaults];
|
||||
uixDebugEnabled = [ud boolForKey:@"SOGoUIxDebugEnabled"];
|
||||
bv = [NSNumber numberWithBool:uixDebugEnabled];
|
||||
[self setObject:bv forKey:@"_isUIxDebugEnabled"];
|
||||
}
|
||||
return [bv boolValue];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright (C) 2004 SKYRIX Software AG
|
||||
|
||||
This file is part of OpenGroupware.org.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#include <NGExtensions/NGExtensions.h>
|
||||
|
||||
#include <NGObjWeb/NGObjWeb.h>
|
||||
#include <NGObjWeb/SoObjects.h>
|
||||
Reference in New Issue
Block a user