2006-06-15 21:34:10 +02:00
|
|
|
/*
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
#import "common.h"
|
|
|
|
#import <NGObjWeb/SoComponent.h>
|
|
|
|
#import <NGObjWeb/WOComponent.h>
|
|
|
|
|
2006-07-07 23:19:48 +02:00
|
|
|
#import <SOGoUI/UIxComponent.h>
|
|
|
|
#import <SOGo/SOGoUser.h>
|
|
|
|
|
2007-08-21 16:45:38 +02:00
|
|
|
#import <Main/build.h>
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
#import "UIxPageFrame.h"
|
2006-06-15 21:34:10 +02:00
|
|
|
|
|
|
|
@implementation UIxPageFrame
|
|
|
|
|
2006-11-07 19:15:16 +01:00
|
|
|
- (id) init
|
|
|
|
{
|
|
|
|
if ((self = [super init]))
|
|
|
|
{
|
|
|
|
toolbar = nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (void) dealloc
|
|
|
|
{
|
2006-11-07 19:15:16 +01:00
|
|
|
[item release];
|
|
|
|
[title release];
|
|
|
|
if (toolbar)
|
|
|
|
[toolbar release];
|
2006-06-15 21:34:10 +02:00
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* accessors */
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (void) setTitle: (NSString *) _value
|
|
|
|
{
|
2006-11-07 19:15:16 +01:00
|
|
|
ASSIGNCOPY(title, _value);
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
2006-07-29 00:59:11 +02:00
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) title
|
|
|
|
{
|
2006-06-15 21:34:10 +02:00
|
|
|
if ([self isUIxDebugEnabled])
|
2006-11-07 19:15:16 +01:00
|
|
|
return title;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2006-09-19 17:20:03 +02:00
|
|
|
return [self labelForKey: @"SOGo"];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (void) setItem: (id) _item
|
|
|
|
{
|
2006-11-07 19:15:16 +01:00
|
|
|
ASSIGN(item, _item);
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
2006-07-29 00:59:11 +02:00
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (id) item
|
|
|
|
{
|
2006-11-07 19:15:16 +01:00
|
|
|
return item;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2007-08-21 16:45:38 +02:00
|
|
|
- (NSString *) buildDate
|
|
|
|
{
|
|
|
|
return SOGoBuildDate;
|
|
|
|
}
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) ownerInContext
|
|
|
|
{
|
|
|
|
return [[self clientObject] ownerInContext: nil];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2006-09-26 20:40:04 +02:00
|
|
|
- (NSString *) doctype
|
|
|
|
{
|
2006-10-03 16:36:03 +02:00
|
|
|
return (@"<?xml version=\"1.0\"?>\n"
|
|
|
|
@"<!DOCTYPE html"
|
|
|
|
@" PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
|
|
|
|
@" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
|
2006-09-26 20:40:04 +02:00
|
|
|
}
|
|
|
|
|
2006-06-15 21:34:10 +02:00
|
|
|
/* Help URL/target */
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) helpURL
|
2006-07-29 00:59:11 +02:00
|
|
|
{
|
2006-11-07 19:15:16 +01:00
|
|
|
return [NSString stringWithFormat: @"help/%@.html", title];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
2006-07-29 00:59:11 +02:00
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) helpWindowTarget
|
2006-07-29 00:59:11 +02:00
|
|
|
{
|
2006-11-07 19:15:16 +01:00
|
|
|
return [NSString stringWithFormat: @"Help_%@", title];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* notifications */
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (void) sleep
|
|
|
|
{
|
2006-11-07 19:15:16 +01:00
|
|
|
[item release];
|
|
|
|
item = nil;
|
2006-06-15 21:34:10 +02:00
|
|
|
[super sleep];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* URL generation */
|
|
|
|
// TODO: I think all this should be done by the clientObject?!
|
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (NSString *) relativeHomePath
|
|
|
|
{
|
2006-07-12 00:29:19 +02:00
|
|
|
return [self relativePathToUserFolderSubPath: @""];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) relativeCalendarPath
|
2006-07-29 00:59:11 +02:00
|
|
|
{
|
2006-07-12 00:29:19 +02:00
|
|
|
return [self relativePathToUserFolderSubPath: @"Calendar/"];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) relativeContactsPath
|
2006-07-29 00:59:11 +02:00
|
|
|
{
|
2006-07-12 00:29:19 +02:00
|
|
|
return [self relativePathToUserFolderSubPath: @"Contacts/"];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) relativeMailPath
|
2006-07-29 00:59:11 +02:00
|
|
|
{
|
2006-07-12 00:29:19 +02:00
|
|
|
return [self relativePathToUserFolderSubPath: @"Mail/"];
|
|
|
|
}
|
|
|
|
|
2007-06-19 20:05:22 +02:00
|
|
|
- (NSString *) relativePreferencesPath
|
|
|
|
{
|
|
|
|
return [self relativePathToUserFolderSubPath: @"preferences"];
|
|
|
|
}
|
|
|
|
|
2007-03-18 16:13:30 +01:00
|
|
|
- (NSString *) logoffPath
|
2006-07-29 00:59:11 +02:00
|
|
|
{
|
2006-07-12 00:29:19 +02:00
|
|
|
return [self relativePathToUserFolderSubPath: @"logoff"];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
/* popup handling */
|
|
|
|
- (void) setPopup: (BOOL) popup
|
|
|
|
{
|
|
|
|
isPopup = popup;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2006-07-07 23:19:48 +02:00
|
|
|
- (BOOL) isPopup
|
|
|
|
{
|
2006-07-29 00:59:11 +02:00
|
|
|
return isPopup;
|
2006-07-07 23:19:48 +02:00
|
|
|
}
|
|
|
|
|
2006-12-14 22:20:13 +01:00
|
|
|
- (NSString *) bodyClasses
|
2006-11-01 21:30:36 +01:00
|
|
|
{
|
2006-12-14 22:20:13 +01:00
|
|
|
return (isPopup ? @"popup" : @"main");
|
2006-11-01 21:30:36 +01:00
|
|
|
}
|
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
/* page based JavaScript */
|
|
|
|
|
2006-07-07 23:19:48 +02:00
|
|
|
- (NSString *) pageJavaScriptURL
|
|
|
|
{
|
2006-06-15 21:34:10 +02:00
|
|
|
WOComponent *page;
|
2006-07-29 00:59:11 +02:00
|
|
|
NSString *pageJSFilename;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
|
|
|
page = [[self context] page];
|
2006-07-29 00:59:11 +02:00
|
|
|
pageJSFilename = [NSString stringWithFormat: @"%@.js",
|
|
|
|
NSStringFromClass([page class])];
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
return [self urlForResourceFilename: pageJSFilename];
|
|
|
|
}
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (NSString *) productJavaScriptURL
|
|
|
|
{
|
|
|
|
WOComponent *page;
|
|
|
|
NSString *fwJSFilename;
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
page = [[self context] page];
|
|
|
|
fwJSFilename = [NSString stringWithFormat: @"%@.js",
|
|
|
|
[page frameworkName]];
|
|
|
|
|
|
|
|
return [self urlForResourceFilename: fwJSFilename];
|
|
|
|
}
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2006-08-25 22:45:16 +02:00
|
|
|
- (NSString *) productFrameworkName
|
|
|
|
{
|
|
|
|
WOComponent *page;
|
|
|
|
|
|
|
|
page = [[self context] page];
|
|
|
|
|
|
|
|
return [NSString stringWithFormat: @"%@.SOGo", [page frameworkName]];
|
|
|
|
}
|
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (BOOL) hasPageSpecificJavaScript
|
|
|
|
{
|
|
|
|
return ([[self pageJavaScriptURL] length] > 0);
|
2006-07-07 23:19:48 +02:00
|
|
|
}
|
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (BOOL) hasProductSpecificJavaScript
|
|
|
|
{
|
|
|
|
return ([[self productJavaScriptURL] length] > 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) pageCSSURL
|
2006-07-07 23:19:48 +02:00
|
|
|
{
|
|
|
|
WOComponent *page;
|
2006-07-29 00:59:11 +02:00
|
|
|
NSString *pageJSFilename;
|
2007-03-18 16:13:30 +01:00
|
|
|
|
|
|
|
page = [[self context] page];
|
2006-07-29 00:59:11 +02:00
|
|
|
pageJSFilename = [NSString stringWithFormat: @"%@.css",
|
|
|
|
NSStringFromClass([page class])];
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
return [self urlForResourceFilename: pageJSFilename];
|
|
|
|
}
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (NSString *) productCSSURL
|
|
|
|
{
|
|
|
|
WOComponent *page;
|
|
|
|
NSString *fwJSFilename;
|
2006-07-07 23:19:48 +02:00
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
page = [[self context] page];
|
|
|
|
fwJSFilename = [NSString stringWithFormat: @"%@.css",
|
|
|
|
[page frameworkName]];
|
|
|
|
|
|
|
|
return [self urlForResourceFilename: fwJSFilename];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2006-08-25 22:45:16 +02:00
|
|
|
- (NSString *) thisPageURL
|
|
|
|
{
|
|
|
|
return [[[self context] page] uri];
|
|
|
|
}
|
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (BOOL) hasPageSpecificCSS
|
2006-07-07 23:19:48 +02:00
|
|
|
{
|
2006-07-29 00:59:11 +02:00
|
|
|
return ([[self pageCSSURL] length] > 0);
|
2006-07-07 23:19:48 +02:00
|
|
|
}
|
|
|
|
|
2006-07-29 00:59:11 +02:00
|
|
|
- (BOOL) hasProductSpecificCSS
|
2006-07-07 23:19:48 +02:00
|
|
|
{
|
2006-07-29 00:59:11 +02:00
|
|
|
return ([[self productCSSURL] length] > 0);
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
2006-11-07 19:15:16 +01:00
|
|
|
- (void) setToolbar: (NSString *) newToolbar
|
|
|
|
{
|
|
|
|
ASSIGN (toolbar, newToolbar);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) toolbar
|
|
|
|
{
|
|
|
|
return toolbar;
|
|
|
|
}
|
|
|
|
|
2006-06-15 21:34:10 +02:00
|
|
|
@end /* UIxPageFrame */
|