From: francis Date: Thu, 11 Oct 2007 22:18:52 +0000 (+0000) Subject: git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1187 d1b88da0-ebda-0310... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ddb5f44493cc35e046e27e5483557dab6d35fdc;p=scalable-opengroupware.org git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1187 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/Main/GNUmakefile b/Main/GNUmakefile index 9526d647..f8113691 100644 --- a/Main/GNUmakefile +++ b/Main/GNUmakefile @@ -5,6 +5,9 @@ include $(GNUSTEP_MAKEFILES)/common.make include ../Version include ./Version +ADDITIONAL_INCLUDE_DIRS += -I../SOPE/sope-gdl1/ +ADDITIONAL_LIB_DIRS += -L../SOPE/sope-gdl1/GDLContentStore/obj/ + SOGOD = sogod-$(MAJOR_VERSION).$(MINOR_VERSION) TOOL_NAME = $(SOGOD) diff --git a/OGoContentStore/GNUmakefile b/OGoContentStore/GNUmakefile index d66c95f2..d74e2646 100644 --- a/OGoContentStore/GNUmakefile +++ b/OGoContentStore/GNUmakefile @@ -13,6 +13,9 @@ libOGoContentStore_HEADER_FILES_DIR = . libOGoContentStore_HEADER_FILES_INSTALL_DIR = /OGoContentStore # no headers, commented out: FHS_HEADER_DIRS = OGoContentStore +ADDITIONAL_INCLUDE_DIRS += -I../SOPE/sope-gdl1/ +ADDITIONAL_LIB_DIRS += -L../SOPE/sope-gdl1/GDLContentStore/obj/ + libOGoContentStore_OBJC_FILES += \ iCalEntityObject+OCS.m \ iCalRepeatableEntityObject+OCS.m \ diff --git a/SOPE/sope-patchset-r1544.diff b/SOPE/sope-patchset-r1544.diff new file mode 100644 index 00000000..5909c448 --- /dev/null +++ b/SOPE/sope-patchset-r1544.diff @@ -0,0 +1,435 @@ +Index: sope-mime/NGImap4/NGImap4Connection.m +=================================================================== +--- sope-mime/NGImap4/NGImap4Connection.m (revision 1544) ++++ sope-mime/NGImap4/NGImap4Connection.m (working copy) +@@ -381,7 +381,7 @@ + + if (debugCache) [self logWithFormat:@" no folders cached yet .."]; + +- result = [[self client] list:(onlyFetchInbox ? @"INBOX" : @"*") ++ result = [[self client] list:(onlyFetchInbox ? @"INBOX" : @"") + pattern:@"*"]; + if (![[result valueForKey:@"result"] boolValue]) { + [self errorWithFormat:@"Could not list mailbox hierarchy!"]; +Index: sope-mime/NGImap4/NGImap4ResponseParser.m +=================================================================== +--- sope-mime/NGImap4/NGImap4ResponseParser.m (revision 1544) ++++ sope-mime/NGImap4/NGImap4ResponseParser.m (working copy) +@@ -84,6 +84,8 @@ + static NSDictionary *_parseMultipartBody(NGImap4ResponseParser *self, + BOOL isBodyStructure); + ++static NSArray *_parseLanguages(); ++ + static NSString *_parseBodyString(NGImap4ResponseParser *self, + BOOL _convertString); + static NSString *_parseBodyDecodeString(NGImap4ResponseParser *self, +@@ -1627,6 +1629,29 @@ + return _parseBodyDecodeString(self, _convertString, NO /* no decode */); + } + ++static NSArray *_parseLanguages(NGImap4ResponseParser *self) { ++ NSMutableArray *languages; ++ NSString *language; ++ ++ languages = [NSMutableArray array]; ++ if (_la(self, 0) == '(') { ++ while (_la(self, 0) != ')') { ++ _consume(self,1); ++ language = _parseBodyString(self, YES); ++ if ([language length]) ++ [languages addObject: language]; ++ } ++ _consume(self,1); ++ } ++ else { ++ language = _parseBodyString(self, YES); ++ if ([language length]) ++ [languages addObject: language]; ++ } ++ ++ return languages; ++} ++ + static NSDictionary *_parseBodyParameterList(NGImap4ResponseParser *self) + { + NSMutableDictionary *list; +@@ -1734,10 +1759,11 @@ + *encoding, *bodysize; + NSDictionary *parameterList; + NSMutableDictionary *dict; ++ NSArray *languages; + + type = [_parseBodyString(self, YES) lowercaseString]; + _consumeIfMatch(self, ' '); +- subtype = _parseBodyString(self, YES); ++ subtype = [_parseBodyString(self, YES) lowercaseString]; + _consumeIfMatch(self, ' '); + parameterList = _parseBodyParameterList(self); + _consumeIfMatch(self, ' '); +@@ -1762,7 +1788,8 @@ + _consumeIfMatch(self, ' '); + [dict setObject:_parseBodyString(self, YES) forKey:@"lines"]; + } +- else if ([type isEqualToString:@"message"]) { ++ else if ([type isEqualToString:@"message"] ++ && [subtype isEqualToString:@"rfc822"]) { + if (_la(self, 0) != ')') { + _consumeIfMatch(self, ' '); + _consumeIfMatch(self, '('); +@@ -1805,14 +1832,9 @@ + forKey: @"disposition"]; + if (_la(self, 0) != ')') { + _consume(self,1); +- if (_la(self, 0) == '(') { +- [dict setObject: _parseBodyParameterList(self) +- forKey: @"language"]; +- } +- else { +- [dict setObject: _parseBodyString(self, YES) +- forKey: @"language"]; +- } ++ languages = _parseLanguages(self); ++ if ([languages count]) ++ [dict setObject: languages forKey: @"languages"]; + if (_la(self, 0) != ')') { + _consume(self,1); + [dict setObject: _parseBodyString(self, YES) +@@ -1829,6 +1851,7 @@ + static NSDictionary *_parseMultipartBody(NGImap4ResponseParser *self, + BOOL isBodyStructure) { + NSMutableArray *parts; ++ NSArray *languages; + NSString *kind; + NSMutableDictionary *dict; + +@@ -1854,14 +1877,9 @@ + forKey: @"disposition"]; + if (_la(self, 0) != ')') { + _consume(self,1); +- if (_la(self, 0) == '(') { +- [dict setObject: _parseBodyParameterList(self) +- forKey: @"language"]; +- } +- else { +- [dict setObject: _parseBodyString(self, YES) +- forKey: @"language"]; +- } ++ languages = _parseLanguages(self); ++ if ([languages count]) ++ [dict setObject: languages forKey: @"languages"]; + if (_la(self, 0) != ')') { + _consume(self,1); + [dict setObject: _parseBodyString(self, YES) +Index: sope-mime/NGMime/NGMimeBodyPart.m +=================================================================== +--- sope-mime/NGMime/NGMimeBodyPart.m (revision 1544) ++++ sope-mime/NGMime/NGMimeBodyPart.m (working copy) +@@ -31,18 +31,6 @@ + return 2; + } + +-static NGMimeType *defaultType = nil; +- +-+ (void)initialize { +- static BOOL isInitialized = NO; +- if (!isInitialized) { +- isInitialized = YES; +- +- defaultType = +- [[NGMimeType mimeType:@"text/plain; charset=us-ascii"] retain]; +- } +-} +- + + (id)bodyPartWithHeader:(NGHashMap *)_header { + return [[[self alloc] initWithHeader:_header] autorelease]; + } +@@ -156,13 +144,12 @@ + if (!Fields) + Fields = (NGMimeHeaderNames *)[NGMimePartParser headerFieldNames]; + +- + type = [self->header objectForKey:Fields->contentType]; + + if (![type isKindOfClass:[NGMimeType class]]) + type = [NGMimeType mimeType:[type stringValue]]; + +- return (type != nil ? type : (id)defaultType); ++ return type; + } + + - (NSString *)contentId { +Index: sope-mime/NGMime/NGMimeBodyParser.m +=================================================================== +--- sope-mime/NGMime/NGMimeBodyParser.m (revision 1544) ++++ sope-mime/NGMime/NGMimeBodyParser.m (working copy) +@@ -67,7 +67,10 @@ + if (_data == nil) return nil; + + ctype = [_part contentType]; +- ++ if (!ctype ++ && [_d respondsToSelector: @selector(parser:contentTypeOfPart:)]) ++ ctype = [_d parser: self contentTypeOfPart: _part]; ++ + if (![ctype isKindOfClass:[NGMimeType class]]) + ctype = [NGMimeType mimeType:[ctype stringValue]]; + +Index: sope-mime/NGMime/NGMimePartParser.h +=================================================================== +--- sope-mime/NGMime/NGMimePartParser.h (revision 1544) ++++ sope-mime/NGMime/NGMimePartParser.h (working copy) +@@ -117,6 +117,7 @@ + BOOL parserParseRawBodyDataOfPart:1; + BOOL parserBodyParserForPart:1; + BOOL parserDecodeBodyOfPart:1; ++ BOOL parserContentTypeOfPart:1; + } delegateRespondsTo; + + +@@ -275,6 +276,9 @@ + - (id)parser:(NGMimePartParser *)_parser + bodyParserForPart:(id)_part; + ++- (NGMimeType *)parser:(id)_parser ++ contentTypeOfPart:(id)_part; ++ + @end /* NSObject(NGMimePartParserDelegate) */ + + @interface NSObject(NGMimePartParser) +Index: sope-mime/NGMime/NGMimePartParser.m +=================================================================== +--- sope-mime/NGMime/NGMimePartParser.m (revision 1544) ++++ sope-mime/NGMime/NGMimePartParser.m (working copy) +@@ -1091,7 +1091,10 @@ + id bodyParser = nil; + + ctype = [_p contentType]; +- ++ if (!ctype ++ && self->delegateRespondsTo.parserContentTypeOfPart) ++ ctype = [self->delegate parser: self contentTypeOfPart: _p]; ++ + contentType = ([ctype isKindOfClass:[NGMimeType class]]) + ? ctype + : [NGMimeType mimeType:[ctype stringValue]]; +Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.h +=================================================================== +--- sope-gdl1/PostgreSQL/PostgreSQL72Channel.h (revision 1544) ++++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.h (working copy) +@@ -28,6 +28,7 @@ + #define ___PostgreSQL72_Channel_H___ + + #include ++#include + #include + + @class NSArray, NSString, NSMutableDictionary; +@@ -40,7 +41,7 @@ + int modification; + } PostgreSQL72FieldInfo; + +-@interface PostgreSQL72Channel : EOAdaptorChannel ++@interface PostgreSQL72Channel : EOAdaptorChannel + { + // connection is valid after an openChannel call + PGConnection *connection; +Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.m +=================================================================== +--- sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (revision 1544) ++++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (working copy) +@@ -713,6 +713,39 @@ + return ms; + } + ++/* GCSEOAdaptorChannel protocol */ ++static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \ ++ @" c_name VARCHAR (256) NOT NULL,\n" ++ @" c_content VARCHAR (100000) NOT NULL,\n" ++ @" c_creationdate INT4 NOT NULL,\n" ++ @" c_lastmodified INT4 NOT NULL,\n" ++ @" c_version INT4 NOT NULL,\n" ++ @" c_deleted INT4 NULL\n" ++ @")"); ++static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n" \ ++ @" c_uid VARCHAR (256) NOT NULL,\n" ++ @" c_object VARCHAR (256) NOT NULL,\n" ++ @" c_role VARCHAR (80) NOT NULL\n" ++ @")"); ++ ++- (NSException *) createGCSFolderTableWithName: (NSString *) tableName ++{ ++ NSString *sql; ++ ++ sql = [NSString stringWithFormat: sqlFolderFormat, tableName]; ++ ++ return [self evaluateExpressionX: sql]; ++} ++ ++- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName ++{ ++ NSString *sql; ++ ++ sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName]; ++ ++ return [self evaluateExpressionX: sql]; ++} ++ + @end /* PostgreSQL72Channel */ + + @implementation PostgreSQL72Channel(PrimaryKeyGeneration) +Index: sope-appserver/NGObjWeb/GNUmakefile.postamble +=================================================================== +--- sope-appserver/NGObjWeb/GNUmakefile.postamble (revision 1544) ++++ sope-appserver/NGObjWeb/GNUmakefile.postamble (working copy) +@@ -23,14 +23,20 @@ + + # install makefiles + +-after-install :: ++after-install :: $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/ngobjweb.make ++ ++ifneq ($(GNUSTEP_MAKE_VERSION),1.3.0) ++after-install :: $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/woapp.make $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/wobundle.make ++endif ++ ++$(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/ngobjweb.make: ngobjweb.make + $(MKDIRS) $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/ + $(INSTALL_DATA) ngobjweb.make $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/ngobjweb.make + +-ifneq ($(GNUSTEP_MAKE_VERSION),1.3.0) +-after-install :: ++$(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/woapp.make: woapp-gs.make + $(INSTALL_DATA) woapp-gs.make \ + $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/woapp.make ++ ++$(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/wobundle.make: wobundle-gs.make + $(INSTALL_DATA) wobundle-gs.make \ + $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/wobundle.make +-endif +Index: sope-appserver/NGObjWeb/WOContext.m +=================================================================== +--- sope-appserver/NGObjWeb/WOContext.m (revision 1544) ++++ sope-appserver/NGObjWeb/WOContext.m (working copy) +@@ -64,11 +64,13 @@ + static BOOL testNSURLs = NO; + static BOOL newCURLStyle = NO; + static NSString *WOApplicationSuffix = nil; ++static NSURL *redirectURL = nil; + + + (void)initialize { + static BOOL didInit = NO; + NSUserDefaults *ud; + NSString *cn; ++ NSString *url; + + if (didInit) return; + +@@ -91,6 +93,9 @@ + debugCursor = [ud boolForKey:@"WODebugCursor"] ? 1 : 0; + debugComponentAwake = [ud boolForKey:@"WODebugComponentAwake"]; + WOApplicationSuffix = [[ud stringForKey:@"WOApplicationSuffix"] copy]; ++ url = [ud stringForKey:@"WOApplicationRedirectURL"]; ++ if (url != nil) ++ redirectURL = [NSURL URLWithString: url]; + } + + + (id)contextWithRequest:(WORequest *)_r { +@@ -503,6 +508,11 @@ + return nil; + } + ++ if (redirectURL) { ++ // Use URL from user defaults (WOApplicationRedirectURL) ++ return redirectURL; ++ } ++ + if ((serverURL = [rq headerForKey:@"x-webobjects-server-url"]) == nil) { + if ((host = [rq headerForKey:@"host"])) + serverURL = [@"http://" stringByAppendingString:host]; +Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m +=================================================================== +--- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m (revision 1544) ++++ sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m (working copy) +@@ -216,6 +216,12 @@ + assocCount++; + } + } ++ if (count > 0) { ++ if ((self->isAbsolute = OWGetProperty(_config, @"absolute"))) { ++ count--; ++ assocCount++; ++ } ++ } + + self->rest = _config; + +Index: sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m +=================================================================== +--- sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m (revision 1544) ++++ sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m (working copy) +@@ -40,6 +40,7 @@ + WOAssociation *string; + WOAssociation *target; + WOAssociation *disabled; ++ WOAssociation *isAbsolute; + WOElement *template; + + /* new in WO4: */ +@@ -359,6 +360,7 @@ + { + if ((self = [super initWithName:_name hyperlinkInfo:_info template:_t])) { + self->href = _info->href; ++ self->isAbsolute = _info->isAbsolute; + } + return self; + } +@@ -374,6 +376,9 @@ + // TODO: we need a binding to disable rewriting! + NSRange r; + ++ if ([[self->isAbsolute valueInContext:_ctx] boolValue] == YES) ++ return NO; ++ + r = [_s rangeOfString:@":"]; + if (r.length == 0) + return YES; +Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h +=================================================================== +--- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h (revision 1544) ++++ sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h (working copy) +@@ -41,7 +41,8 @@ + WOAssociation *pageName; + WOAssociation *actionClass; + WOAssociation *directActionName; +- ++ WOAssociation *isAbsolute; ++ + BOOL sidInUrl; + + /* 'ivar' associations */ +Index: sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m +=================================================================== +--- sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m (revision 1544) ++++ sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m (working copy) +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + #include "common.h" + + #include +@@ -1016,6 +1017,12 @@ + - (void)parser:(NGMimePartParser *)_parser didParseHeader:(NGHashMap *)_header { + } + ++- (NGMimeType *)parser:(id)_parser ++ contentTypeOfPart:(id)_part ++{ ++ return [NGMimeType mimeType: @"text/plain; charset=utf-8"]; ++} ++ + @end /* WOHttpAdaptor */ + + @implementation WOCoreApplication(SimpleParserSelection) diff --git a/SoObjects/Appointments/GNUmakefile b/SoObjects/Appointments/GNUmakefile index 0ae0a98f..6b51f6b4 100644 --- a/SoObjects/Appointments/GNUmakefile +++ b/SoObjects/Appointments/GNUmakefile @@ -47,6 +47,9 @@ Appointments_COMPONENTS += \ SOGoAptMailGermanRemoval.wo \ SOGoAptMailGermanDeletion.wo \ +ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/sope-gdl1/ +ADDITIONAL_LIB_DIRS += -L../../SOPE/sope-gdl1/GDLContentStore/obj/ + -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/wobundle.make -include GNUmakefile.postamble diff --git a/SoObjects/Contacts/GNUmakefile b/SoObjects/Contacts/GNUmakefile index 3c1711c1..a979a373 100644 --- a/SoObjects/Contacts/GNUmakefile +++ b/SoObjects/Contacts/GNUmakefile @@ -19,6 +19,9 @@ Contacts_RESOURCE_FILES += \ Version \ product.plist \ +ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/sope-gdl1/ +ADDITIONAL_LIB_DIRS += -L../../SOPE/sope-gdl1/GDLContentStore/obj/ + -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUmakefile.postamble diff --git a/SoObjects/Mailer/GNUmakefile b/SoObjects/Mailer/GNUmakefile index 2abb34c7..cc04cf25 100644 --- a/SoObjects/Mailer/GNUmakefile +++ b/SoObjects/Mailer/GNUmakefile @@ -41,6 +41,9 @@ Mailer_RESOURCE_FILES += \ SOGoMailFrenchForward.wo \ SOGoMailGermanForward.wo +ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/sope-gdl1/ +ADDITIONAL_LIB_DIRS += -L../../SOPE/sope-gdl1/GDLContentStore/obj/ + -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/wobundle.make -include GNUmakefile.postamble diff --git a/SoObjects/SOGo/GNUmakefile b/SoObjects/SOGo/GNUmakefile index d2b9d356..2530959f 100644 --- a/SoObjects/SOGo/GNUmakefile +++ b/SoObjects/SOGo/GNUmakefile @@ -87,6 +87,8 @@ agenor_emails4uid_OBJC_FILES += agenor_emails4uid.m agenor_defaults_OBJC_FILES += agenor_defaults.m ADDITIONAL_TOOL_LIBS += -Lobj -lSOGo$(LIBRARY_NAME_SUFFIX) +ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/sope-gdl1/ +ADDITIONAL_LIB_DIRS += -L../../SOPE/sope-gdl1/GDLContentStore/obj/ -include GNUmakefile.preamble include ../common.make diff --git a/UI/Common/GNUmakefile b/UI/Common/GNUmakefile index 80a1a594..e25a1ae1 100644 --- a/UI/Common/GNUmakefile +++ b/UI/Common/GNUmakefile @@ -39,6 +39,9 @@ CommonUI_LOCALIZED_RESOURCE_FILES += \ # make +ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/sope-gdl1/ +ADDITIONAL_LIB_DIRS += -L../../SOPE/sope-gdl1/GDLContentStore/obj/ + -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUmakefile.postamble diff --git a/UI/Contacts/GNUmakefile b/UI/Contacts/GNUmakefile index 34a2f8fc..cb61ff5c 100644 --- a/UI/Contacts/GNUmakefile +++ b/UI/Contacts/GNUmakefile @@ -33,6 +33,9 @@ ContactsUI_LOCALIZED_RESOURCE_FILES += \ # make +ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/sope-gdl1/ +ADDITIONAL_LIB_DIRS += -L../../SOPE/sope-gdl1/GDLContentStore/obj/ + -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUmakefile.postamble diff --git a/UI/MailPartViewers/GNUmakefile b/UI/MailPartViewers/GNUmakefile index ae6a49d2..dcfb3665 100644 --- a/UI/MailPartViewers/GNUmakefile +++ b/UI/MailPartViewers/GNUmakefile @@ -40,6 +40,9 @@ MailPartViewers_LOCALIZED_RESOURCE_FILES += \ # make +ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/sope-gdl1/ +ADDITIONAL_LIB_DIRS += -L../../SOPE/sope-gdl1/GDLContentStore/obj/ + -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUmakefile.postamble diff --git a/UI/MailerUI/GNUmakefile b/UI/MailerUI/GNUmakefile index 7a7c36b4..ba2c9579 100644 --- a/UI/MailerUI/GNUmakefile +++ b/UI/MailerUI/GNUmakefile @@ -50,6 +50,9 @@ MailerUI_LOCALIZED_RESOURCE_FILES += \ # make +ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/sope-gdl1/ +ADDITIONAL_LIB_DIRS += -L../../SOPE/sope-gdl1/GDLContentStore/obj/ + -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUmakefile.postamble diff --git a/UI/MainUI/GNUmakefile b/UI/MainUI/GNUmakefile index 83e84c18..5bad0b55 100644 --- a/UI/MainUI/GNUmakefile +++ b/UI/MainUI/GNUmakefile @@ -26,6 +26,9 @@ MainUI_RESOURCE_FILES += \ MainUI_LOCALIZED_RESOURCE_FILES += \ Locale Localizable.strings +ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/sope-gdl1/ +ADDITIONAL_LIB_DIRS += -L../../SOPE/sope-gdl1/GDLContentStore/obj/ + -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUmakefile.postamble diff --git a/UI/PreferencesUI/GNUmakefile b/UI/PreferencesUI/GNUmakefile index 2f8eaba0..e3e70797 100644 --- a/UI/PreferencesUI/GNUmakefile +++ b/UI/PreferencesUI/GNUmakefile @@ -24,6 +24,9 @@ PreferencesUI_RESOURCE_FILES += \ PreferencesUI_LOCALIZED_RESOURCE_FILES += \ Localizable.strings \ +ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/sope-gdl1/ +ADDITIONAL_LIB_DIRS += -L../../SOPE/sope-gdl1/GDLContentStore/obj/ + -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUmakefile.postamble diff --git a/UI/Scheduler/GNUmakefile b/UI/Scheduler/GNUmakefile index 8c65e344..7ef2b615 100644 --- a/UI/Scheduler/GNUmakefile +++ b/UI/Scheduler/GNUmakefile @@ -66,6 +66,9 @@ SchedulerUI_RESOURCE_FILES += \ # make +ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/sope-gdl1/ +ADDITIONAL_LIB_DIRS += -L../../SOPE/sope-gdl1/GDLContentStore/obj/ + -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUmakefile.postamble diff --git a/UI/WebServerResources/browser_firefox.gif b/UI/WebServerResources/browser_firefox.gif new file mode 100644 index 00000000..d9134046 Binary files /dev/null and b/UI/WebServerResources/browser_firefox.gif differ diff --git a/UI/WebServerResources/browser_ie.gif b/UI/WebServerResources/browser_ie.gif new file mode 100644 index 00000000..20f97efd Binary files /dev/null and b/UI/WebServerResources/browser_ie.gif differ diff --git a/UI/WebServerResources/browser_safari.gif b/UI/WebServerResources/browser_safari.gif new file mode 100644 index 00000000..40d24fc6 Binary files /dev/null and b/UI/WebServerResources/browser_safari.gif differ diff --git a/UI/WebServerResources/tablekit-trueresize.js b/UI/WebServerResources/tablekit-trueresize.js new file mode 100644 index 00000000..662ce5a7 --- /dev/null +++ b/UI/WebServerResources/tablekit-trueresize.js @@ -0,0 +1,101 @@ +/** + * This work is licensed under a Creative Commons Attribution 3.0 License + * (http://creativecommons.org/licenses/by/3.0/). + * + * You are free: + * to Share - to copy, distribute and transmit the work + * to Remix - to adapt the work + * Under the following conditions: + * Attribution. You must attribute the work in the manner specified + * by the author or licensor (but not in any way that suggests that + * they endorse you or your use of the work). + * + * For any reuse or distribution, you must make clear to others the license + * terms of this work. The best way to do this is with a link to the + * Creative Commons web page. + * + * Any of the above conditions can be waived if you get permission from + * the copyright holder. Nothing in this license impairs or restricts + * the author's moral rights. + * + * Disclaimer + * + * Your fair dealing and other rights are in no way affected by the above. + * This is a human-readable summary of the Legal Code (the full license). + * + * The author of this work is Vlad Bailescu (http://vlad.bailescu.ro). No + * warranty or support will be provided for this work, although updates + * might be made available at http://vlad.bailescu.ro/javascript/tablekit . + * + * Licence code and basic description provided by Creative Commons. + * + */ +Object.extend(TableKit.options || {}, { + // If true table width gets recalculated on column resize + trueResize : false, + // If true table width will be kept constant on column resize + keepWidth : false +}); + +Object.extend(TableKit.Resizable, { + resize : function(table, index, w) { + // This part is taken from Andrew Tetlaw's original TableKit.Resizable.resize + var cell; + if(typeof index === 'number') { + if(!table || (table.tagName && table.tagName !== "TABLE")) {return;} + table = $(table); + index = Math.min(table.rows[0].cells.length, index); + index = Math.max(1, index); + index -= 1; + cell = (table.tHead && table.tHead.rows.length > 0) ? $(table.tHead.rows[table.tHead.rows.length-1].cells[index]) : $(table.rows[0].cells[index]); + } else { + cell = $(index); + table = table ? $(table) : cell.up('table'); + index = TableKit.getCellIndex(cell); + } + // And now, for the fun stuff + // Read the new options values for the given table + var op = TableKit.option('trueResize keepWidth minWidth', table.id); + // Took also the minWidth as we're gonna use it later anyway + var pad = parseInt(cell.getStyle('paddingLeft'),10) + parseInt(cell.getStyle('paddingRight'),10); + // Improvement: add cell border to padding as width incorporates both + pad += parseInt(cell.getStyle('borderLeftWidth'),10) + parseInt(cell.getStyle('borderRightWidth'),10); + w = Math.max(w-pad, op.minWidth); // This will also be used later + if (!op.trueResize) { + // Original resize method + cell.setStyle({'width' : w + 'px'}); // Using previously read minWidth instead of the old way + } else { + // New stuff + var delta = (w + pad - parseInt(cell.getWidth())); + if (!op.keepWidth) { + // We'll be updating the table width + var tableWidth = parseInt(table.getWidth()) + delta; + cell.setStyle({'width' : w + 'px'}); + table.setStyle({'width' : tableWidth + 'px'}); + } else { + // Let's see what we have to do to keep the table width constant + var cells = TableKit.getHeaderCells(table); + if (index < 0 || index > cells.length) { return; } + var nbour; + if (index == cells.length - 1) { // Rightmost cell + nbour = cells[index - 1]; + } else { // Left or inner cell + nbour = cells[index + 1]; + } + var nbourWidth = parseInt(nbour.getWidth()); + var nbourPad = parseInt(nbour.getStyle('paddingLeft'),10) + parseInt(nbour.getStyle('paddingRight'),10); + var proposedNbourWidth = nbourWidth - nbourPad - delta; + var newNbourWidth; + if (proposedNbourWidth < op.minWidth) { + // Don't be mean to neighbours. Step off their porch. + newNbourWidth = Math.min(nbourWidth - nbourPad, op.minWidth); + w -= newNbourWidth - proposedNbourWidth; + } else { + newNbourWidth = proposedNbourWidth; + } + nbour.setStyle({'width' : newNbourWidth + 'px'}); + cell.setStyle({'width' : w + 'px'}); + } + } + } +}); \ No newline at end of file diff --git a/UI/WebServerResources/tablekit.js b/UI/WebServerResources/tablekit.js new file mode 100644 index 00000000..cda8431a --- /dev/null +++ b/UI/WebServerResources/tablekit.js @@ -0,0 +1,858 @@ +/* +* +* Copyright (c) 2007 Andrew Tetlaw & Millstream Web Software +* http://www.millstream.com.au/view/code/tablekit/ +* Version: 1.2.1 2007-03-11 +* +* Permission is hereby granted, free of charge, to any person +* obtaining a copy of this software and associated documentation +* files (the "Software"), to deal in the Software without +* restriction, including without limitation the rights to use, copy, +* modify, merge, publish, distribute, sublicense, and/or sell copies +* of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* * +*/ + +// Use the TableKit class constructure if you'd prefer to init your tables as JS objects +var TableKit = Class.create(); + +TableKit.prototype = { + initialize : function(elm, options) { + var table = $(elm); + if(table.tagName !== "TABLE") { + return; + } + TableKit.register(table,Object.extend(TableKit.options,options || {})); + this.id = table.id; + var op = TableKit.option('sortable resizable editable', this.id); + if(op.sortable) { + TableKit.Sortable.init(table); + } + if(op.resizable) { + TableKit.Resizable.init(table); + } + if(op.editable) { + TableKit.Editable.init(table); + } + }, + sort : function(column, order) { + TableKit.Sortable.sort(this.id, column, order); + }, + resizeColumn : function(column, w) { + TableKit.Resizable.resize(this.id, column, w); + }, + editCell : function(row, column) { + TableKit.Editable.editCell(this.id, row, column); + } +}; + +Object.extend(TableKit, { + getBodyRows : function(table) { + table = $(table); + var id = table.id; + if(!TableKit.rows[id]) { + TableKit.rows[id] = (table.tHead && table.tHead.rows.length > 0) ? $A(table.tBodies[0].rows) : $A(table.rows).without(table.rows[0]); + } + return TableKit.rows[id]; + }, + getHeaderCells : function(table, cell) { + if(!table) { table = $(cell).up('table'); } + var id = table.id; + if(!TableKit.heads[id]) { + //TableKit.heads[id] = $A((table.tHead && table.tHead.rows.length > 0) ? table.tHead.rows[table.tHead.rows.length-1].cells : table.rows[0].cells); + TableKit.heads[id] = $A((table.tHead && table.tHead.rows.length > 0) ? table.tHead.rows[0].cells : table.rows[0].cells); + } + return TableKit.heads[id]; + }, + getCellIndex : function(cell) { + return $A(cell.parentNode.cells).indexOf(cell); + }, + getRowIndex : function(row) { + return $A(row.parentNode.rows).indexOf(row); + }, + getCellText : function(cell, refresh) { + if(!cell) { return ""; } + TableKit.registerCell(cell); + var data = TableKit.cells[cell.id]; + if(refresh || data.refresh || !data.textContent) { + data.textContent = cell.textContent ? cell.textContent : cell.innerText; + data.refresh = false; + } + return data.textContent; + }, + register : function(table, options) { + if(!table.id) { + TableKit._tblcount += 1; + table.id = "tablekit-table-" + TableKit._tblcount; + } + var id = table.id; + TableKit.tables[id] = TableKit.tables[id] ? Object.extend(TableKit.tables[id], options || {}) : Object.extend({sortable:false,resizable:false,editable:false}, options || {}); + }, + registerCell : function(cell) { + if(!cell.id) { + TableKit._cellcount += 1; + cell.id = "tablekit-cell-" + TableKit._cellcount; + } + if(!TableKit.cells[cell.id]) { + TableKit.cells[cell.id] = {textContent : '', htmlContent : '', active : false}; + } + }, + isSortable : function(table) { + return TableKit.tables[table.id] ? TableKit.tables[table.id].sortable : false; + }, + isResizable : function(table) { + return TableKit.tables[table.id] ? TableKit.tables[table.id].resizable : false; + }, + isEditable : function(table) { + return TableKit.tables[table.id] ? TableKit.tables[table.id].editable : false; + }, + setup : function(o) { + Object.extend(TableKit.options, o || {} ); + }, + option : function(s, id, o1, o2) { + o1 = o1 || TableKit.options; + o2 = o2 || (id ? (TableKit.tables[id] ? TableKit.tables[id] : {}) : {}); + var key = id + s; + if(!TableKit._opcache[key]){ + TableKit._opcache[key] = $A($w(s)).inject([],function(a,v){ + a.push(a[v] = o2[v] || o1[v]); + return a; + }); + } + return TableKit._opcache[key]; + }, + e : function(event) { + return event || window.event; + }, + tables : {}, + _opcache : {}, + cells : {}, + rows : {}, + heads : {}, + options : { + autoLoad : true, + stripe : true, + sortable : true, + resizable : true, + editable : true, + rowEvenClass : 'roweven', + rowOddClass : 'rowodd', + sortableSelector : ['table.sortable'], + columnClass : 'sortcol', + descendingClass : 'sortdesc', + ascendingClass : 'sortasc', + noSortClass : 'nosort', + sortFirstAscendingClass : 'sortfirstasc', + sortFirstDecendingClass : 'sortfirstdesc', + resizableSelector : ['table.resizable'], + minWidth : 10, + showHandle : true, + resizeOnHandleClass : 'resize-handle-active', + editableSelector : ['table.editable'], + formClassName : 'editable-cell-form', + noEditClass : 'noedit', + editAjaxURI : '/', + editAjaxOptions : {} + }, + _tblcount : 0, + _cellcount : 0, + load : function() { + if(TableKit.options.autoLoad) { + if(TableKit.options.sortable) { + $A(TableKit.options.sortableSelector).each(function(s){ + $$(s).each(function(t) { + TableKit.Sortable.init(t); + }); + }); + } + if(TableKit.options.resizable) { + $A(TableKit.options.resizableSelector).each(function(s){ + $$(s).each(function(t) { + TableKit.Resizable.init(t); + }); + }); + } + if(TableKit.options.editable) { + $A(TableKit.options.editableSelector).each(function(s){ + $$(s).each(function(t) { + TableKit.Editable.init(t); + }); + }); + } + } + } +}); + +TableKit.Rows = { + stripe : function(table) { + var rows = TableKit.getBodyRows(table); + rows.each(function(r,i) { + TableKit.Rows.addStripeClass(table,r,i); + }); + }, + addStripeClass : function(t,r,i) { + t = t || r.up('table'); + var op = TableKit.option('rowEvenClass rowOddClass', t.id); + var css = ((i+1)%2 === 0 ? op[0] : op[1]); + // using prototype's assClassName/RemoveClassName was not efficient for large tables, hence: + var cn = r.className.split(/\s+/); + var newCn = []; + for(var x = 0, l = cn.length; x < l; x += 1) { + if(cn[x] !== op[0] && cn[x] !== op[1]) { newCn.push(cn[x]); } + } + newCn.push(css); + r.className = newCn.join(" "); + } +}; + +TableKit.Sortable = { + init : function(elm, options){ + var table = $(elm); + if(table.tagName !== "TABLE") { + return; + } + TableKit.register(table,Object.extend(options || {},{sortable:true})); + var sortFirst; + var cells = TableKit.getHeaderCells(table); + var op = TableKit.option('noSortClass columnClass sortFirstAscendingClass sortFirstDecendingClass', table.id); + cells.each(function(c){ + c = $(c); + if(!c.hasClassName(op.noSortClass)) { + Event.observe(c, 'mousedown', TableKit.Sortable._sort); + c.addClassName(op.columnClass); + if(c.hasClassName(op.sortFirstAscendingClass) || c.hasClassName(op.sortFirstDecendingClass)) { + sortFirst = c; + } + } + }); + + if(sortFirst) { + if(sortFirst.hasClassName(op.sortFirstAscendingClass)) { + TableKit.Sortable.sort(table, sortFirst, 1); + } else { + TableKit.Sortable.sort(table, sortFirst, -1); + } + } else { // just add row stripe classes + TableKit.Rows.stripe(table); + } + }, + reload : function(table) { + table = $(table); + var cells = TableKit.getHeaderCells(table); + var op = TableKit.option('noSortClass columnClass', table.id); + cells.each(function(c){ + c = $(c); + if(!c.hasClassName(op.noSortClass)) { + Event.stopObserving(c, 'mousedown', TableKit.Sortable._sort); + c.removeClassName(op.columnClass); + } + }); + TableKit.Sortable.init(table); + }, + _sort : function(e) { + if(TableKit.Resizable._onHandle) {return;} + e = TableKit.e(e); + Event.stop(e); + var cell = Event.element(e); + while(!(cell.tagName && cell.tagName.match(/td|th/gi))) { + cell = cell.parentNode; + } + TableKit.Sortable.sort(null, cell); + }, + sort : function(table, index, order) { + var cell; + if(typeof index === 'number') { + if(!table || (table.tagName && table.tagName !== "TABLE")) { + return; + } + table = $(table); + index = Math.min(table.rows[0].cells.length, index); + index = Math.max(1, index); + index -= 1; + cell = (table.tHead && table.tHead.rows.length > 0) ? $(table.tHead.rows[table.tHead.rows.length-1].cells[index]) : $(table.rows[0].cells[index]); + } else { + cell = $(index); + table = table ? $(table) : cell.up('table'); + index = TableKit.getCellIndex(cell); + } + var op = TableKit.option('noSortClass descendingClass ascendingClass', table.id); + + if(cell.hasClassName(op.noSortClass)) {return;} + + order = order ? order : (cell.hasClassName(op.descendingClass) ? 1 : -1); + var rows = TableKit.getBodyRows(table); + + if(cell.hasClassName(op.ascendingClass) || cell.hasClassName(op.descendingClass)) { + rows.reverse(); // if it was already sorted we just need to reverse it. + } else { + var datatype = TableKit.Sortable.getDataType(cell,index,table); + var tkst = TableKit.Sortable.types; + rows.sort(function(a,b) { + return order * tkst[datatype].compare(TableKit.getCellText(a.cells[index]),TableKit.getCellText(b.cells[index])); + }); + } + var tb = table.tBodies[0]; + var tkr = TableKit.Rows; + rows.each(function(r,i) { + tb.appendChild(r); + tkr.addStripeClass(table,r,i); + }); + var hcells = TableKit.getHeaderCells(null, cell); + $A(hcells).each(function(c,i){ + c = $(c); + c.removeClassName(op.ascendingClass); + c.removeClassName(op.descendingClass); + if(index === i) { + if(order === 1) { + c.removeClassName(op.descendingClass); + c.addClassName(op.ascendingClass); + } else { + c.removeClassName(op.ascendingClass); + c.addClassName(op.descendingClass); + } + } + }); + }, + types : {}, + detectors : [], + addSortType : function() { + $A(arguments).each(function(o){ + TableKit.Sortable.types[o.name] = o; + }); + }, + getDataType : function(cell,index,table) { + cell = $(cell); + index = (index || index === 0) ? index : TableKit.getCellIndex(cell); + + var colcache = TableKit.Sortable._coltypecache; + var cache = colcache[table.id] ? colcache[table.id] : (colcache[table.id] = {}); + + if(!cache[index]) { + var t = ''; + // first look for a data type id on the heading row cell + if(cell.id && TableKit.Sortable.types[cell.id]) { + t = cell.id; + } + t = cell.classNames().detect(function(n){ // then look for a data type classname on the heading row cell + return (TableKit.Sortable.types[n]) ? true : false; + }); + if(!t) { + var rows = TableKit.getBodyRows(table); + cell = rows[0].cells[index]; // grab same index cell from body row to try and match data type + t = TableKit.Sortable.detectors.detect( + function(d){ + return TableKit.Sortable.types[d].detect(TableKit.getCellText(cell)); + }); + } + cache[index] = t; + } + return cache[index]; + }, + _coltypecache : {} +}; + +TableKit.Sortable.detectors = $A($w('date-iso date date-eu date-au time currency datasize number casesensitivetext text')); // setting it here because Safari complained when I did it above... + +TableKit.Sortable.Type = Class.create(); +TableKit.Sortable.Type.prototype = { + initialize : function(name, options){ + this.name = name; + options = Object.extend({ + normal : function(v){ + return v; + }, + pattern : /.*/ + }, options || {}); + this.normal = options.normal; + this.pattern = options.pattern; + if(options.compare) { + this.compare = options.compare; + } + if(options.detect) { + this.detect = options.detect; + } + }, + compare : function(a,b){ + return TableKit.Sortable.Type.compare(this.normal(a), this.normal(b)); + }, + detect : function(v){ + return this.pattern.test(v); + } +}; + +TableKit.Sortable.Type.compare = function(a,b) { + return a < b ? -1 : a === b ? 0 : 1; +}; + +TableKit.Sortable.addSortType( + new TableKit.Sortable.Type('number', { + pattern : /^[-+]?[\d]*\.?[\d]+(?:[eE][-+]?[\d]+)?/, + normal : function(v) { + // This will grab the first thing that looks like a number from a string, so you can use it to order a column of various srings containing numbers. + v = parseFloat(v.replace(/^.*?([-+]?[\d]*\.?[\d]+(?:[eE][-+]?[\d]+)?).*$/,"$1")); + return isNaN(v) ? 0 : v; + }}), + new TableKit.Sortable.Type('text',{ + normal : function(v) { + return v ? v.toLowerCase() : ''; + }}), + new TableKit.Sortable.Type('casesensitivetext',{pattern : /^[A-Z]+$/}), + new TableKit.Sortable.Type('datasize',{ + pattern : /^[-+]?[\d]*\.?[\d]+(?:[eE][-+]?[\d]+)?\s?[k|m|g|t]b$/i, + normal : function(v) { + var r = v.match(/^([-+]?[\d]*\.?[\d]+([eE][-+]?[\d]+)?)\s?([k|m|g|t]?b)?/i); + var b = r[1] ? Number(r[1]).valueOf() : 0; + var m = r[3] ? r[3].substr(0,1).toLowerCase() : ''; + var result = b; + switch(m) { + case 'k': + result = b * 1024; + break; + case 'm': + result = b * 1024 * 1024; + break; + case 'g': + result = b * 1024 * 1024 * 1024; + break; + case 't': + result = b * 1024 * 1024 * 1024 * 1024; + break; + } + return result; + }}), + new TableKit.Sortable.Type('date-au',{ + pattern : /^\d{2}\/\d{2}\/\d{4}\s?(?:\d{1,2}\:\d{2}(?:\:\d{2})?\s?[a|p]?m?)?/i, + normal : function(v) { + if(!this.pattern.test(v)) {return 0;} + var r = v.match(/^(\d{2})\/(\d{2})\/(\d{4})\s?(?:(\d{1,2})\:(\d{2})(?:\:(\d{2}))?\s?([a|p]?m?))?/i); + var yr_num = r[3]; + var mo_num = parseInt(r[2],10)-1; + var day_num = r[1]; + var hr_num = r[4] ? r[4] : 0; + if(r[7] && r[7].toLowerCase().indexOf('p') !== -1) { + hr_num = parseInt(r[4],10) + 12; + } + var min_num = r[5] ? r[5] : 0; + var sec_num = r[6] ? r[6] : 0; + return new Date(yr_num, mo_num, day_num, hr_num, min_num, sec_num, 0).valueOf(); + }}), + new TableKit.Sortable.Type('date-us',{ + pattern : /^\d{2}\/\d{2}\/\d{4}\s?(?:\d{1,2}\:\d{2}(?:\:\d{2})?\s?[a|p]?m?)?/i, + normal : function(v) { + if(!this.pattern.test(v)) {return 0;} + var r = v.match(/^(\d{2})\/(\d{2})\/(\d{4})\s?(?:(\d{1,2})\:(\d{2})(?:\:(\d{2}))?\s?([a|p]?m?))?/i); + var yr_num = r[3]; + var mo_num = parseInt(r[1],10)-1; + var day_num = r[2]; + var hr_num = r[4] ? r[4] : 0; + if(r[7] && r[7].toLowerCase().indexOf('p') !== -1) { + hr_num = parseInt(r[4],10) + 12; + } + var min_num = r[5] ? r[5] : 0; + var sec_num = r[6] ? r[6] : 0; + return new Date(yr_num, mo_num, day_num, hr_num, min_num, sec_num, 0).valueOf(); + }}), + new TableKit.Sortable.Type('date-eu',{ + pattern : /^\d{2}-\d{2}-\d{4}/i, + normal : function(v) { + if(!this.pattern.test(v)) {return 0;} + var r = v.match(/^(\d{2})-(\d{2})-(\d{4})/); + var yr_num = r[3]; + var mo_num = parseInt(r[2],10)-1; + var day_num = r[1]; + return new Date(yr_num, mo_num, day_num).valueOf(); + }}), + new TableKit.Sortable.Type('date-iso',{ + pattern : /[\d]{4}-[\d]{2}-[\d]{2}(?:T[\d]{2}\:[\d]{2}(?:\:[\d]{2}(?:\.[\d]+)?)?(Z|([-+][\d]{2}:[\d]{2})?)?)?/, // 2005-03-26T19:51:34Z + normal : function(v) { + if(!this.pattern.test(v)) {return 0;} + var d = v.match(/([\d]{4})(-([\d]{2})(-([\d]{2})(T([\d]{2}):([\d]{2})(:([\d]{2})(\.([\d]+))?)?(Z|(([-+])([\d]{2}):([\d]{2})))?)?)?)?/); + var offset = 0; + var date = new Date(d[1], 0, 1); + if (d[3]) { date.setMonth(d[3] - 1) ;} + if (d[5]) { date.setDate(d[5]); } + if (d[7]) { date.setHours(d[7]); } + if (d[8]) { date.setMinutes(d[8]); } + if (d[10]) { date.setSeconds(d[10]); } + if (d[12]) { date.setMilliseconds(Number("0." + d[12]) * 1000); } + if (d[14]) { + offset = (Number(d[16]) * 60) + Number(d[17]); + offset *= ((d[15] === '-') ? 1 : -1); + } + offset -= date.getTimezoneOffset(); + if(offset !== 0) { + var time = (Number(date) + (offset * 60 * 1000)); + date.setTime(Number(time)); + } + return date.valueOf(); + }}), + new TableKit.Sortable.Type('date',{ + pattern: /^(?:sun|mon|tue|wed|thu|fri|sat)\,\s\d{1,2}\s(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\s\d{4}(?:\s\d{2}\:\d{2}(?:\:\d{2})?(?:\sGMT(?:[+-]\d{4})?)?)?/i, //Mon, 18 Dec 1995 17:28:35 GMT + compare : function(a,b) { // must be standard javascript date format + if(a && b) { + return TableKit.Sortable.Type.compare(new Date(a),new Date(b)); + } else { + return TableKit.Sortable.Type.compare(a ? 1 : 0, b ? 1 : 0); + } + }}), + new TableKit.Sortable.Type('time',{ + pattern : /^\d{1,2}\:\d{2}(?:\:\d{2})?(?:\s[a|p]m)?$/i, + compare : function(a,b) { + var d = new Date(); + var ds = d.getMonth() + "/" + d.getDate() + "/" + d.getFullYear() + " "; + return TableKit.Sortable.Type.compare(new Date(ds + a),new Date(ds + b)); + }}), + new TableKit.Sortable.Type('currency',{ + pattern : /^[$£¥€¤]/, // dollar,pound,yen,euro,generic currency symbol + normal : function(v) { + return v ? parseFloat(v.replace(/[^-\d\.]/g,'')) : 0; + }}) +); + +TableKit.Resizable = { + init : function(elm, options){ + var table = $(elm); + if(table.tagName !== "TABLE") {return;} + TableKit.register(table,Object.extend(options || {},{resizable:true})); + var cells = TableKit.getHeaderCells(table); + cells.each(function(c){ + c = $(c); + //log ("init on " + c.firstChild.nodeValue); + Event.observe(c, 'mouseover', TableKit.Resizable.initDetect); + Event.observe(c, 'mouseout', TableKit.Resizable.killDetect); + }); + }, + reload : function(table) { + table = $(table); + var cells = TableKit.getHeaderCells(table); + cells.each(function(c){ + c = $(c); + Event.stopObserving(c, 'mouseover', TableKit.Resizable.initDetect); + Event.stopObserving(c, 'mouseout', TableKit.Resizable.killDetect); + }); + TableKit.Resizable.init(table); + }, + resize : function(table, index, w) { + var cell; + if(typeof index === 'number') { + if(!table || (table.tagName && table.tagName !== "TABLE")) {return;} + table = $(table); + index = Math.min(table.rows[0].cells.length, index); + index = Math.max(1, index); + index -= 1; + cell = (table.tHead && table.tHead.rows.length > 0) ? $(table.tHead.rows[table.tHead.rows.length-1].cells[index]) : $(table.rows[0].cells[index]); + } else { + cell = $(index); + table = table ? $(table) : cell.up('table'); + index = TableKit.getCellIndex(cell); + } + var pad = parseInt(cell.getStyle('paddingLeft'),10) + parseInt(cell.getStyle('paddingRight'),10); + w = Math.max(w-pad, TableKit.option('minWidth', table.id)[0]); + cell.setStyle({'width' : w + 'px'}); + }, + initDetect : function(e) { + e = TableKit.e(e); + var cell = Event.element(e); + Event.observe(cell, 'mousemove', TableKit.Resizable.detectHandle); + Event.observe(cell, 'mousedown', TableKit.Resizable.startResize); + }, + detectHandle : function(e) { + e = TableKit.e(e); + var cell = Event.element(e); + if(TableKit.Resizable.pointerPos(cell,Event.pointerX(e),Event.pointerY(e))){ + cell.addClassName(TableKit.option('resizeOnHandleClass', cell.up('table').id)[0]); + TableKit.Resizable._onHandle = true; + } else { + cell.removeClassName(TableKit.option('resizeOnHandleClass', cell.up('table').id)[0]); + TableKit.Resizable._onHandle = false; + } + }, + killDetect : function(e) { + e = TableKit.e(e); + TableKit.Resizable._onHandle = false; + var cell = Event.element(e); + if (!cell.tagName || cell.tagName != 'TD') return; + Event.stopObserving(cell, 'mousemove', TableKit.Resizable.detectHandle); + Event.stopObserving(cell, 'mousedown', TableKit.Resizable.startResize); + cell.removeClassName(TableKit.option('resizeOnHandleClass', cell.up('table').id)[0]); + }, + startResize : function(e) { + e = TableKit.e(e); + if(!TableKit.Resizable._onHandle) { return;} + var cell = Event.element(e); + Event.stopObserving(cell, 'mousemove', TableKit.Resizable.detectHandle); + Event.stopObserving(cell, 'mousedown', TableKit.Resizable.startResize); + Event.stopObserving(cell, 'mouseout', TableKit.Resizable.killDetect); + TableKit.Resizable._cell = cell; + var table = cell.up('table'); + TableKit.Resizable._tbl = table; + if(TableKit.option('showHandle', table.id)[0]) { + TableKit.Resizable._handle = $(document.createElement('div')).addClassName('resize-handle').setStyle({ + 'top' : Position.cumulativeOffset(cell)[1] + 'px', + 'left' : Event.pointerX(e) + 'px', + 'height' : table.getDimensions().height + 'px' + }); + document.body.appendChild(TableKit.Resizable._handle); + } + Event.observe(document, 'mousemove', TableKit.Resizable.drag); + Event.observe(document, 'mouseup', TableKit.Resizable.endResize); + Event.stop(e); + }, + endResize : function(e) { + e = TableKit.e(e); + var cell = TableKit.Resizable._cell; + TableKit.Resizable.resize(null, cell, (Event.pointerX(e) - Position.cumulativeOffset(cell)[0])); + Event.stopObserving(document, 'mousemove', TableKit.Resizable.drag); + Event.stopObserving(document, 'mouseup', TableKit.Resizable.endResize); + if(TableKit.option('showHandle', TableKit.Resizable._tbl.id)[0]) { + $$('div.resize-handle').each(function(elm){ + document.body.removeChild(elm); + }); + } + Event.observe(cell, 'mouseout', TableKit.Resizable.killDetect); + TableKit.Resizable._tbl = TableKit.Resizable._handle = TableKit.Resizable._cell = null; + Event.stop(e); + }, + drag : function(e) { + e = TableKit.e(e); + if(TableKit.Resizable._handle === null) { + try { + TableKit.Resizable.resize(TableKit.Resizable._tbl, TableKit.Resizable._cell, (Event.pointerX(e) - Position.cumulativeOffset(TableKit.Resizable._cell)[0])); + } catch(e) {} + } else { + TableKit.Resizable._handle.setStyle({'left' : Event.pointerX(e) + 'px'}); + } + return false; + }, + pointerPos : function(element, x, y) { + var offset = Position.cumulativeOffset(element); + return (y >= offset[1] && + y < offset[1] + element.offsetHeight && + x >= offset[0] + element.offsetWidth - 5 && + x < offset[0] + element.offsetWidth); + }, + _onHandle : false, + _cell : null, + _tbl : null, + _handle : null +}; + + +TableKit.Editable = { + init : function(elm, options){ + var table = $(elm); + if(table.tagName !== "TABLE") {return;} + TableKit.register(table,Object.extend(options || {},{editable:true})); + Event.observe(table.tBodies[0], 'click', TableKit.Editable._editCell); + }, + _editCell : function(e) { + e = TableKit.e(e); + var cell = Event.findElement(e,'td'); + TableKit.Editable.editCell(null, cell); + }, + editCell : function(table, index, cindex) { + var cell, row; + if(typeof index === 'number') { + if(!table || (table.tagName && table.tagName !== "TABLE")) {return;} + table = $(table); + index = Math.min(table.tBodies[0].rows.length, index); + index = Math.max(1, index); + index -= 1; + cindex = Math.min(table.rows[0].cells.length, cindex); + cindex = Math.max(1, cindex); + cindex -= 1; + row = $(table.tBodies[0].rows[index]); + cell = $(row.cells[cindex]); + } else { + cell = $(index); + table = (table && table.tagName && table.tagName !== "TABLE") ? $(table) : cell.up('table'); + row = cell.up('tr'); + } + var op = TableKit.option('noEditClass', table.id); + if(cell.hasClassName(op.noEditClass)) {return;} + + var head = $(TableKit.getHeaderCells(table, cell)[TableKit.getCellIndex(cell)]); + if(head.hasClassName(op.noEditClass)) {return;} + + TableKit.registerCell(cell); + var data = TableKit.cells[cell.id]; + if(data.active) {return;} + data.htmlContent = cell.innerHTML; + var ftype = TableKit.Editable.types['text-input']; + if(head.id && TableKit.Editable.types[head.id]) { + ftype = TableKit.Editable.types[head.id]; + } else { + var n = head.classNames().detect(function(n){ + return (TableKit.Editable.types[n]) ? true : false; + }); + ftype = n ? TableKit.Editable.types[n] : ftype; + } + ftype.edit(cell); + data.active = true; + }, + types : {}, + addCellEditor : function(o) { + if(o && o.name) { TableKit.Editable.types[o.name] = o; } + } +}; + +TableKit.Editable.CellEditor = Class.create(); +TableKit.Editable.CellEditor.prototype = { + initialize : function(name, options){ + this.name = name; + this.options = Object.extend({ + element : 'input', + attributes : {name : 'value', type : 'text'}, + selectOptions : [], + showSubmit : true, + submitText : 'OK', + showCancel : true, + cancelText : 'Cancel', + ajaxURI : null, + ajaxOptions : null + }, options || {}); + }, + edit : function(cell) { + cell = $(cell); + var op = this.options; + var table = cell.up('table'); + + var form = $(document.createElement("form")); + form.id = cell.id + '-form'; + form.addClassName(TableKit.option('formClassName', table.id)[0]); + form.onsubmit = this._submit.bindAsEventListener(this); + + var field = document.createElement(op.element); + $H(op.attributes).each(function(v){ + field[v.key] = v.value; + }); + switch(op.element) { + case 'input': + case 'textarea': + field.value = TableKit.getCellText(cell); + break; + + case 'select': + var txt = TableKit.getCellText(cell); + $A(op.selectOptions).each(function(v){ + field.options[field.options.length] = new Option(v[0], v[1]); + if(txt === v[1]) { + field.options[field.options.length-1].selected = 'selected'; + } + }); + break; + } + form.appendChild(field); + if(op.element === 'textarea') { + form.appendChild(document.createElement("br")); + } + if(op.showSubmit) { + var okButton = document.createElement("input"); + okButton.type = "submit"; + okButton.value = op.submitText; + okButton.className = 'editor_ok_button'; + form.appendChild(okButton); + } + if(op.showCancel) { + var cancelLink = document.createElement("a"); + cancelLink.href = "#"; + cancelLink.appendChild(document.createTextNode(op.cancelText)); + cancelLink.onclick = this._cancel.bindAsEventListener(this); + cancelLink.className = 'editor_cancel'; + form.appendChild(cancelLink); + } + cell.innerHTML = ''; + cell.appendChild(form); + }, + _submit : function(e) { + var cell = Event.findElement(e,'td'); + var form = Event.findElement(e,'form'); + Event.stop(e); + this.submit(cell,form); + }, + submit : function(cell, form) { + var op = this.options; + form = form ? form : cell.down('form'); + var head = $(TableKit.getHeaderCells(null, cell)[TableKit.getCellIndex(cell)]); + var row = cell.up('tr'); + var table = cell.up('table'); + var s = '&row=' + (TableKit.getRowIndex(row)+1) + '&cell=' + (TableKit.getCellIndex(cell)+1) + '&id=' + row.id + '&field=' + head.id + '&' + Form.serialize(form); + this.ajax = new Ajax.Updater(cell, op.ajaxURI || TableKit.option('editAjaxURI', table.id)[0], Object.extend(op.ajaxOptions || TableKit.option('editAjaxOptions', table.id)[0], { + postBody : s, + onComplete : function() { + var data = TableKit.cells[cell.id]; + data.active = false; + data.refresh = true; // mark cell cache for refreshing, in case cell contents has changed and sorting is applied + } + })); + }, + _cancel : function(e) { + var cell = Event.findElement(e,'td'); + Event.stop(e); + this.cancel(cell); + }, + cancel : function(cell) { + this.ajax = null; + var data = TableKit.cells[cell.id]; + cell.innerHTML = data.htmlContent; + data.htmlContent = ''; + data.active = false; + }, + ajax : null +}; + +TableKit.Editable.textInput = function(n,attributes) { + TableKit.Editable.addCellEditor(new TableKit.Editable.CellEditor(n, { + element : 'input', + attributes : Object.extend({name : 'value', type : 'text'}, attributes||{}) + })); +}; +TableKit.Editable.textInput('text-input'); + +TableKit.Editable.multiLineInput = function(n,attributes) { + TableKit.Editable.addCellEditor(new TableKit.Editable.CellEditor(n, { + element : 'textarea', + attributes : Object.extend({name : 'value', rows : '5', cols : '20'}, attributes||{}) + })); +}; +TableKit.Editable.multiLineInput('multi-line-input'); + +TableKit.Editable.selectInput = function(n,attributes,selectOptions) { + TableKit.Editable.addCellEditor(new TableKit.Editable.CellEditor(n, { + element : 'select', + attributes : Object.extend({name : 'value'}, attributes||{}), + 'selectOptions' : selectOptions + })); +}; + +/* +TableKit.Bench = { + bench : [], + start : function(){ + TableKit.Bench.bench[0] = new Date().getTime(); + }, + end : function(s){ + TableKit.Bench.bench[1] = new Date().getTime(); + alert(s + ' ' + ((TableKit.Bench.bench[1]-TableKit.Bench.bench[0])/1000)+' seconds.') //console.log(s + ' ' + ((TableKit.Bench.bench[1]-TableKit.Bench.bench[0])/1000)+' seconds.') + TableKit.Bench.bench = []; + } +} */ + +if(window.FastInit) { + FastInit.addOnLoad(TableKit.load); +} else { + Event.observe(window, 'load', TableKit.load); +} diff --git a/sogo.spec b/sogo.spec new file mode 100644 index 00000000..9ce2f710 --- /dev/null +++ b/sogo.spec @@ -0,0 +1,185 @@ +%define lfmaj 1 +%define lfmin 1 + +Summary: Scalable OpenGroupware.org (Inverse edition) +Name: sogo +Version: %{sogo_version}.%{sogo_release} +Release: gnustep.%{dist_suffix} +Vendor: http://www.inverse.ca/ +Packager: Wolfgang Sourdeau +License: GPL +URL: http://www.inverse.ca/contributions/sogo.html +Group: Productivity/Groupware +Source: %{sogo_source} +Prefix: %{sogo_prefix} +AutoReqProv: off +Requires: gnustep-base sope%{sope_major_version}%{sope_minor_version}-core httpd mod_ngobjweb sope%{sope_major_version}%{sope_minor_version}-cards +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} +BuildPreReq: gcc-objc gnustep-base gnustep-make sope%{sope_major_version}%{sope_minor_version}-appserver-devel sope%{sope_major_version}%{sope_minor_version}-core-devel sope%{sope_major_version}%{sope_minor_version}-ldap-devel sope%{sope_major_version}%{sope_minor_version}-mime-devel sope%{sope_major_version}%{sope_minor_version}-xml-devel sope%{sope_major_version}%{sope_minor_version}-gdl1-devel sope%{sope_major_version}%{sope_minor_version}-cards-devel + +%description +SOGo is a groupware server built around OpenGroupware.org (OGo) and +the SOPE application server. It focuses on scalability. + +The Inverse edition of this project has many feature enhancements: +- CalDAV and GroupDAV compliance +- full handling of vCard as well as vCalendar/iCalendar formats +- support for folder sharing and ACLs + +The Web interface has been rewritten in an AJAX fashion to provided a faster +UI for the users, consistency in look and feel with the Mozilla applications, +and to reduce the load of the transactions on the server. + +%package -n sogo-devel +Summary: Development headers and libraries for SOGo +Group: Development/Libraries/Objective C +AutoReqProv: off + +%description -n sogo-devel +Development headers and libraries for SOGo. Needed to create modules. + +%package -n sope%{sope_major_version}%{sope_minor_version}-gdl1-contentstore +Summary: Storage backend for folder abstraction. +Group: Development/Libraries/Objective C +Requires: sope%{sope_major_version}%{sope_minor_version}-gdl1 +AutoReqProv: off + +%description -n sope%{sope_major_version}%{sope_minor_version}-gdl1-contentstore +The storage backend implements the "low level" folder abstraction, which is +basically an arbitary "BLOB" containing some document. + +SOPE is a framework for developing web applications and services. The +name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE. + +%package -n sope%{sope_major_version}%{sope_minor_version}-gdl1-contentstore-devel +Summary: Development files for the GNUstep database libraries +Group: Development/Libraries/Objective C +Requires: sope%{sope_major_version}%{sope_minor_version}-gdl1 +AutoReqProv: off + +%description -n sope%{sope_major_version}%{sope_minor_version}-gdl1-contentstore-devel +This package contains the header files for SOPE's GDLContentStore library. + +SOPE is a framework for developing web applications and services. The +name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE. + + +%package -n sope%{sope_major_version}%{sope_minor_version}-gdl1-tools +Summary: Tools (gcs_cat/gcs_gensql/gcs_ls/gcs_mkdir/gcs_recreatequick) +Group: Development/Libraries/Objective C +Requires: sope%{sope_major_version}%{sope_minor_version}-gdl1 +AutoReqProv: off + +%description -n sope%{sope_major_version}%{sope_minor_version}-gdl1-tools +Various tools around the GDLContentStore. + +SOPE is a framework for developing web applications and services. The +name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE. + +######################################## +%prep +rm -fr ${RPM_BUILD_ROOT} +%setup -q -n sogo + +# ****************************** build ******************************** +%build +. /usr/GNUstep/System/Library/Makefiles/GNUstep.sh +./configure \ + --enable-strip \ + --disable-debug \ + --with-gnustep + +make + +# ****************************** install ****************************** +%install +make INSTALL_ROOT_DIR=${RPM_BUILD_ROOT} \ + GNUSTEP_INSTALLATION_DIR=${RPM_BUILD_ROOT}%{prefix} \ + install +cp -a UI/WebServerResources UI/Templates ${RPM_BUILD_ROOT}%{prefix}/Library/SOGo-%{sogo_version} +mkdir -p ${RPM_BUILD_ROOT}/etc/init.d +mkdir -p ${RPM_BUILD_ROOT}/etc/httpd/conf.d +mkdir -p ${RPM_BUILD_ROOT}/usr/sbin +mkdir -p ${RPM_BUILD_ROOT}/var/run/sogo +mkdir -p ${RPM_BUILD_ROOT}/var/log/sogo +cp Apache/SOGo.conf ${RPM_BUILD_ROOT}/etc/httpd/conf.d/ +cp Scripts/sogo-init.d-rhel4 ${RPM_BUILD_ROOT}/etc/init.d/sogod +cp Scripts/sogod-redhat ${RPM_BUILD_ROOT}/usr/sbin/sogod +rm -rf ${RPM_BUILD_ROOT}%{prefix}/Tools/test_quick_extract +rm -rf ${RPM_BUILD_ROOT}%{prefix}/Library/Headers/NGCards +rm -rf ${RPM_BUILD_ROOT}%{prefix}/Library/Libraries/libNGCards.* +rm -rf ${RPM_BUILD_ROOT}%{prefix}/Library/SaxDrivers-%{sope_major_version}.%{sope_minor_version} +rm -rf ${RPM_BUILD_ROOT}%{prefix}/Library/SaxMappings + +# ****************************** clean ******************************** +%clean +rm -fr ${RPM_BUILD_ROOT} + +# ****************************** files ******************************** +%files -n sogo +%defattr(-,root,root,-) + +/etc/init.d/sogod +/etc/httpd/conf.d/SOGo.conf +/usr/sbin/sogod +/var/run/sogo +/var/log/sogo +%{prefix}/Tools/sogod-0.9 +%{prefix}/Library/Libraries/libSOGo.so.* +%{prefix}/Library/Libraries/libSOGoUI.so.* +%{prefix}/Library/Libraries/libOGoContentStore.so* +%{prefix}/Library/SOGo-%{sogo_version}/*.SOGo +%{prefix}/Library/SOGo-%{sogo_version}/Templates +%{prefix}/Library/SOGo-%{sogo_version}/WebServerResources +%{prefix}/Library/OCSTypeModels/appointment.ocs +%{prefix}/Library/OCSTypeModels/contact.ocs +%{prefix}/Library/OCSTypeModels/appointment-oracle.ocs +%{prefix}/Library/OCSTypeModels/contact-oracle.ocs +%{prefix}/Library/WOxElemBuilders-%{sope_version}/SOGoElements.wox + +%doc ChangeLog README NEWS Scripts/sql-update-20070724.sh Scripts/sql-update-20070822.sh + +%files -n sogo-devel +%{prefix}/Library/Headers/SOGo +%{prefix}/Library/Headers/SOGoUI +%{prefix}/Library/Libraries/libSOGo.so +%{prefix}/Library/Libraries/libSOGoUI.so + +%files -n sope%{sope_major_version}%{sope_minor_version}-gdl1-contentstore +%defattr(-,root,root,-) +%{prefix}/Library/Libraries/libGDLContentStore*.so.%{sope_version}* + +%files -n sope%{sope_major_version}%{sope_minor_version}-gdl1-contentstore-devel +%{prefix}/Library/Headers/GDLContentStore +%{prefix}/Library/Libraries/libGDLContentStore*.so + +%files -n sope%{sope_major_version}%{sope_minor_version}-gdl1-tools +%defattr(-,root,root,-) +%{prefix}/Tools/gcs_cat +%{prefix}/Tools/gcs_gensql +%{prefix}/Tools/gcs_ls +%{prefix}/Tools/gcs_mkdir +%{prefix}/Tools/gcs_recreatequick + +# **************************** pkgscripts ***************************** +%post +if ! id sogo >& /dev/null; then /usr/sbin/adduser sogo; fi +/bin/chown sogo /var/run/sogo +/bin/chown sogo /var/log/sogo + +%postun +if test "$1" = "0" +then + /usr/sbin/userdel sogo + /usr/sbin/groupdel sogo + /bin/rm -rf /var/run/sogo +fi + +# ********************************* changelog ************************* +%changelog +* Tue Oct 4 2007 Francis Lachapelle +- added package sope-gdl1-contentstore + +* Wed Jul 18 2007 Wolfgang Sourdeau +- initial build +