From 04ce86c312a375a052f3654deba61898e4267dd2 Mon Sep 17 00:00:00 2001 From: helge Date: Sun, 26 Jun 2005 19:11:35 +0000 Subject: [PATCH] fixed MailerContactsUI for MacOSX (some code reorgs) git-svn-id: http://svn.opengroupware.org/SOGo/trunk@651 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/Contacts/ChangeLog | 5 ++ SOGo/UI/Contacts/GNUmakefile | 11 +++-- SOGo/UI/Contacts/GNUmakefile.preamble | 18 ++++++++ ...ContactEditor.h => UIxContactEditorBase.h} | 9 +++- ...ContactEditor.m => UIxContactEditorBase.m} | 34 ++++++++++---- ...tsListView.h => UIxContactsListViewBase.h} | 10 ++-- ...tsListView.m => UIxContactsListViewBase.m} | 6 +-- SOGo/UI/Contacts/UIxContactsSelectionView.m | 46 +++++++++---------- SOGo/UI/Contacts/Version | 2 +- SOGo/UI/Contacts/bundle-info.plist | 4 +- SOGo/UI/MailerContactsUI/ChangeLog | 9 ++++ SOGo/UI/MailerContactsUI/GNUmakefile.preamble | 9 ++++ .../MailerContactsUI/UIxMailContactEditor.m | 24 ++++++++-- SOGo/UI/MailerContactsUI/UIxMailContactList.m | 4 +- SOGo/UI/MailerContactsUI/Version | 2 +- SOGo/UI/MailerContactsUI/bundle-info.plist | 16 +++++++ SOGo/UI/MailerContactsUI/product.plist | 11 ++++- SOGo/UI/Templates/ChangeLog | 5 ++ SOGo/UI/Templates/UIxMailContactEditor.wox | 2 + SOGo/UI/common.make | 2 +- 20 files changed, 169 insertions(+), 60 deletions(-) rename SOGo/UI/Contacts/{UIxContactEditor.h => UIxContactEditorBase.h} (82%) rename SOGo/UI/Contacts/{UIxContactEditor.m => UIxContactEditorBase.m} (89%) rename SOGo/UI/Contacts/{UIxContactsListView.h => UIxContactsListViewBase.h} (81%) rename SOGo/UI/Contacts/{UIxContactsListView.m => UIxContactsListViewBase.m} (96%) create mode 100644 SOGo/UI/MailerContactsUI/GNUmakefile.preamble create mode 100644 SOGo/UI/MailerContactsUI/bundle-info.plist diff --git a/SOGo/UI/Contacts/ChangeLog b/SOGo/UI/Contacts/ChangeLog index 1e1c211b..aa320240 100644 --- a/SOGo/UI/Contacts/ChangeLog +++ b/SOGo/UI/Contacts/ChangeLog @@ -1,3 +1,8 @@ +2005-06-26 Helge Hess + + * created a library containing shared base classes (for + MailerContactsUI) (v0.9.23) + 2005-03-23 Marcus Mueller * renamed "default.strings" to "Localizable.strings" (v0.9.22) diff --git a/SOGo/UI/Contacts/GNUmakefile b/SOGo/UI/Contacts/GNUmakefile index cbac87f2..b7f4f3f6 100644 --- a/SOGo/UI/Contacts/GNUmakefile +++ b/SOGo/UI/Contacts/GNUmakefile @@ -2,20 +2,24 @@ include ../common.make +LIBRARY_NAME = libContactsUI BUNDLE_NAME = ContactsUI ContactsUI_PRINCIPAL_CLASS = ContactsUIProduct ContactsUI_LANGUAGES = English French +libContactsUI_OBJC_FILES = \ + UIxContactsListViewBase.m \ + UIxContactEditorBase.m \ + ContactsUI_OBJC_FILES = \ ContactsUIProduct.m \ - \ - UIxContactsListView.m \ UIxContactsSelectionView.m \ UIxContactView.m \ - UIxContactEditor.m \ UIxContactSelector.m \ + UIxContactEditor.m \ + UIxContactsListView.m \ ContactsUI_RESOURCE_FILES += \ Version \ @@ -27,6 +31,7 @@ ContactsUI_LOCALIZED_RESOURCE_FILES += \ # make -include GNUmakefile.preamble +include $(GNUSTEP_MAKEFILES)/library.make include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUmakefile.postamble include ../../fhsbundle.make diff --git a/SOGo/UI/Contacts/GNUmakefile.preamble b/SOGo/UI/Contacts/GNUmakefile.preamble index ca886a67..e7b69962 100644 --- a/SOGo/UI/Contacts/GNUmakefile.preamble +++ b/SOGo/UI/Contacts/GNUmakefile.preamble @@ -2,3 +2,21 @@ ADDITIONAL_INCLUDE_DIRS += \ -I.. -I../.. -I../../.. + +ADDITIONAL_LIB_DIRS += \ + -L./$(GNUSTEP_OBJ_DIR) + +libContactsUI_LIBRARIES_DEPEND_UPON += \ + -lOGoContentStore \ + -lSOGo \ + \ + -lGDLContentStore \ + -lGDLAccess \ + -lNGObjWeb \ + -lNGLdap \ + -lNGiCal \ + -lNGMime \ + -lNGStreams -lNGExtensions -lEOControl \ + -lXmlRpc -lDOM -lSaxObjC + +ContactsUI_BUNDLE_LIBS += -lContactsUI diff --git a/SOGo/UI/Contacts/UIxContactEditor.h b/SOGo/UI/Contacts/UIxContactEditorBase.h similarity index 82% rename from SOGo/UI/Contacts/UIxContactEditor.h rename to SOGo/UI/Contacts/UIxContactEditorBase.h index 535b297d..b9a26c55 100644 --- a/SOGo/UI/Contacts/UIxContactEditor.h +++ b/SOGo/UI/Contacts/UIxContactEditorBase.h @@ -19,11 +19,14 @@ 02111-1307, USA. */ +#ifndef __UIxContactEditorBase_H__ +#define __UIxContactEditorBase_H__ + #include -@class NSMutableDictionary; +@class NSString, NSMutableDictionary; -@interface UIxContactEditor : UIxComponent +@interface UIxContactEditorBase : UIxComponent { NSString *contentString; NSString *errorText; @@ -31,3 +34,5 @@ } @end + +#endif /* __UIxContactEditorBase_H__ */ diff --git a/SOGo/UI/Contacts/UIxContactEditor.m b/SOGo/UI/Contacts/UIxContactEditorBase.m similarity index 89% rename from SOGo/UI/Contacts/UIxContactEditor.m rename to SOGo/UI/Contacts/UIxContactEditorBase.m index d37eb1ea..6e67a38a 100644 --- a/SOGo/UI/Contacts/UIxContactEditor.m +++ b/SOGo/UI/Contacts/UIxContactEditorBase.m @@ -19,12 +19,12 @@ 02111-1307, USA. */ -#include "UIxContactEditor.h" +#include "UIxContactEditorBase.h" #include #include #include "common.h" -@implementation UIxContactEditor +@implementation UIxContactEditorBase - (id)init { if ((self = [super init])) { @@ -228,19 +228,31 @@ respondsToSelector:@selector(saveContentString:)]; } +- (NSString *)viewActionName { + /* this is overridden in the mail based contacts UI to redirect to tb.edit */ + return @""; +} +- (NSString *)editActionName { + /* this is overridden in the mail based contacts UI to redirect to tb.edit */ + return @"edit"; +} + - (id)saveAction { NSException *ex; - NSString *recstr; + NSString *recstr, *uri; id record; if (![self isWriteableClientObject]) { - /* return 400 == Bad Request */ - return [NSException exceptionWithHTTPStatus:400 + return [NSException exceptionWithHTTPStatus:400 /* Bad Request */ reason:@"method cannot be invoked on " @"the specified object"]; } - record = [[[[self contentString] propertyList] mutableCopy] autorelease]; + if ((record = [self contentString]) == nil) { + [self setErrorText:@"Missing object content!"]; // localize + return self; + } + record = [[[record propertyList] mutableCopy] autorelease]; if (record == nil) { [self setErrorText:@"Invalid property list data ..."]; // localize return self; @@ -256,7 +268,10 @@ return self; } - return [self redirectToLocation:[self _completeURIForMethod:@".."]]; + uri = ([(uri = [self viewActionName]) length] > 0) + ? [self viewActionName] : @".."; + uri = [self _completeURIForMethod:uri]; + return [self redirectToLocation:uri]; } - (id)testAction { @@ -282,9 +297,10 @@ reason:@"could not create a unique ID"]; } - nextMethod = [NSString stringWithFormat:@"../%@/edit", objectId]; + nextMethod = [NSString stringWithFormat:@"../%@/%@", + objectId, [self editActionName]]; uri = [self _completeURIForMethod:nextMethod]; return [self redirectToLocation:uri]; } -@end /* UIxContactEditor */ +@end /* UIxContactEditorBase */ diff --git a/SOGo/UI/Contacts/UIxContactsListView.h b/SOGo/UI/Contacts/UIxContactsListViewBase.h similarity index 81% rename from SOGo/UI/Contacts/UIxContactsListView.h rename to SOGo/UI/Contacts/UIxContactsListViewBase.h index 31d68c27..8205f9be 100644 --- a/SOGo/UI/Contacts/UIxContactsListView.h +++ b/SOGo/UI/Contacts/UIxContactsListViewBase.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -19,14 +19,14 @@ 02111-1307, USA. */ -#ifndef __UIxContactsListView_H__ -#define __UIxContactsListView_H__ +#ifndef __UIxContactsListViewBase_H__ +#define __UIxContactsListViewBase_H__ #include @class NSString, NSArray; -@interface UIxContactsListView : UIxComponent +@interface UIxContactsListViewBase : UIxComponent { NSArray *allRecords; NSArray *filteredRecords; @@ -36,4 +36,4 @@ @end -#endif /* __UIxContactsListView_H__ */ +#endif /* __UIxContactsListViewBase_H__ */ diff --git a/SOGo/UI/Contacts/UIxContactsListView.m b/SOGo/UI/Contacts/UIxContactsListViewBase.m similarity index 96% rename from SOGo/UI/Contacts/UIxContactsListView.m rename to SOGo/UI/Contacts/UIxContactsListViewBase.m index a028b42e..ddb2b425 100644 --- a/SOGo/UI/Contacts/UIxContactsListView.m +++ b/SOGo/UI/Contacts/UIxContactsListViewBase.m @@ -19,11 +19,11 @@ 02111-1307, USA. */ -#include "UIxContactsListView.h" +#include "UIxContactsListViewBase.h" #include #include "common.h" -@implementation UIxContactsListView +@implementation UIxContactsListViewBase - (void)dealloc { [self->allRecords release]; @@ -128,4 +128,4 @@ return YES; } -@end /* UIxContactsListView */ +@end /* UIxContactsListViewBase */ diff --git a/SOGo/UI/Contacts/UIxContactsSelectionView.m b/SOGo/UI/Contacts/UIxContactsSelectionView.m index ff13bca4..ee926fd2 100644 --- a/SOGo/UI/Contacts/UIxContactsSelectionView.m +++ b/SOGo/UI/Contacts/UIxContactsSelectionView.m @@ -1,30 +1,28 @@ /* - 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$ - - -#include "UIxContactsListView.h" + 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 "UIxContactsListViewBase.h" #include -@interface UIxContactsSelectionView : UIxContactsListView +@interface UIxContactsSelectionView : UIxContactsListViewBase { NSString *callback; } diff --git a/SOGo/UI/Contacts/Version b/SOGo/UI/Contacts/Version index 9e92ea2e..09d4f5bf 100644 --- a/SOGo/UI/Contacts/Version +++ b/SOGo/UI/Contacts/Version @@ -1,6 +1,6 @@ # GNUstep makefile -SUBMINOR_VERSION:=22 +SUBMINOR_VERSION:=23 # v0.9.18 requires NGExtensions v4.5.136 # v0.9.16 requires libSOGoUI v0.9.16 diff --git a/SOGo/UI/Contacts/bundle-info.plist b/SOGo/UI/Contacts/bundle-info.plist index fa33c7db..e990cf99 100644 --- a/SOGo/UI/Contacts/bundle-info.plist +++ b/SOGo/UI/Contacts/bundle-info.plist @@ -1,6 +1,4 @@ { - "__cvs__" = "$Id$"; - requires = { bundleManagerVersion = 1; classes = ( @@ -10,8 +8,10 @@ provides = { classes = ( + { name = UIxContactEditor; } ); WOComponents = ( + { name = UIxContactEditor; } ); }; } diff --git a/SOGo/UI/MailerContactsUI/ChangeLog b/SOGo/UI/MailerContactsUI/ChangeLog index f9c44d27..c87a3d01 100644 --- a/SOGo/UI/MailerContactsUI/ChangeLog +++ b/SOGo/UI/MailerContactsUI/ChangeLog @@ -1,3 +1,12 @@ +2005-06-26 Helge Hess + + * use new ContactsUI library from Contacts (v0.9.9) + +2005-06-24 Helge Hess + + * UIxMailContactEditor.m: fixed an exception with Cocoa due to empty + fields on contact creation (v0.9.8) + 2005-02-22 Helge Hess * UIxMailContactList.m: hide frame if "noframe" query parameter is set diff --git a/SOGo/UI/MailerContactsUI/GNUmakefile.preamble b/SOGo/UI/MailerContactsUI/GNUmakefile.preamble new file mode 100644 index 00000000..994890c5 --- /dev/null +++ b/SOGo/UI/MailerContactsUI/GNUmakefile.preamble @@ -0,0 +1,9 @@ +# compile flags + +ADDITIONAL_INCLUDE_DIRS += \ + -I.. -I../.. -I../../.. + +ADDITIONAL_LIB_DIRS += \ + -L../Contacts/$(GNUSTEP_OBJ_DIR) + +MailerContactsUI_BUNDLE_LIBS += -lContactsUI diff --git a/SOGo/UI/MailerContactsUI/UIxMailContactEditor.m b/SOGo/UI/MailerContactsUI/UIxMailContactEditor.m index e241cd09..26900fe9 100644 --- a/SOGo/UI/MailerContactsUI/UIxMailContactEditor.m +++ b/SOGo/UI/MailerContactsUI/UIxMailContactEditor.m @@ -19,9 +19,9 @@ 02111-1307, USA. */ -#include +#include -@interface UIxMailContactEditor : UIxContactEditor +@interface UIxMailContactEditor : UIxContactEditorBase { } @@ -43,12 +43,26 @@ return [[l stringByAppendingString:@", "] stringByAppendingString:f]; } - (NSString *)panelTitle { - NSString *s; + NSString *s, *t; + t = [self objectTitle]; s = [self labelForKey:@"Edit Contact"]; - s = [s stringByAppendingString:@": "]; - s = [s stringByAppendingString:[self objectTitle]]; + if ([t isNotNull]) { + s = [s stringByAppendingString:@": "]; + s = [s stringByAppendingString:t]; + } return s; } +/* actions */ + +- (NSString *)editActionName { + /* this is called by the parent class new action */ + return @"tb.edit"; +} +- (NSString *)viewxActionName { + /* this is called by the parent class save action */ + return @"tb.edit"; +} + @end /* UIxMailContactEditor */ diff --git a/SOGo/UI/MailerContactsUI/UIxMailContactList.m b/SOGo/UI/MailerContactsUI/UIxMailContactList.m index 10a80e0b..0140a39c 100644 --- a/SOGo/UI/MailerContactsUI/UIxMailContactList.m +++ b/SOGo/UI/MailerContactsUI/UIxMailContactList.m @@ -19,9 +19,9 @@ 02111-1307, USA. */ -#include +#include -@interface UIxMailContactList : UIxContactsListView +@interface UIxMailContactList : UIxContactsListViewBase { } diff --git a/SOGo/UI/MailerContactsUI/Version b/SOGo/UI/MailerContactsUI/Version index bf17f459..c92539a5 100644 --- a/SOGo/UI/MailerContactsUI/Version +++ b/SOGo/UI/MailerContactsUI/Version @@ -1,5 +1,5 @@ # version file -SUBMINOR_VERSION:=7 +SUBMINOR_VERSION:=9 # v0.9.5 requires MailerUI v0.9.116 diff --git a/SOGo/UI/MailerContactsUI/bundle-info.plist b/SOGo/UI/MailerContactsUI/bundle-info.plist new file mode 100644 index 00000000..0217dc55 --- /dev/null +++ b/SOGo/UI/MailerContactsUI/bundle-info.plist @@ -0,0 +1,16 @@ +{ + requires = { + bundleManagerVersion = 1; + classes = ( + { name = NSObject; } + ); + }; + + provides = { + classes = ( + ); + WOComponents = ( + { name = UIxMailContactEditor; } + ); + }; +} diff --git a/SOGo/UI/MailerContactsUI/product.plist b/SOGo/UI/MailerContactsUI/product.plist index f8d68b2e..b94a617d 100644 --- a/SOGo/UI/MailerContactsUI/product.plist +++ b/SOGo/UI/MailerContactsUI/product.plist @@ -22,9 +22,10 @@ cssClass = "tbicon_getmail"; label = "Get Mail"; }, { - link = "new"; - // onclick = "clickedCompose(this);return false;"; + link = "tb.new"; + // onclick = "clickedNewContact(this);return false;"; cssClass = "tbicon_compose"; label = "New Contact"; + target = "_blank"; }, /* enable if we actually can do that { link = "tb.compose"; target = "_blank"; @@ -49,6 +50,12 @@ actionClass = "UIxMailEditorAction"; actionName = "compose"; }; + + "tb.new" = { + protectedBy = "View"; + pageName = "UIxMailContactEditor"; + actionName = "new"; + }; }; }; diff --git a/SOGo/UI/Templates/ChangeLog b/SOGo/UI/Templates/ChangeLog index bb67646d..48ce1327 100644 --- a/SOGo/UI/Templates/ChangeLog +++ b/SOGo/UI/Templates/ChangeLog @@ -1,3 +1,8 @@ +2005-06-26 Helge Hess + + * UIxMailContactEditor.wox: added a hidden field containing the contact + content + 2005-03-23 Marcus Mueller * UIxCalWeekOverview.wox: changed the right corner URL yet again diff --git a/SOGo/UI/Templates/UIxMailContactEditor.wox b/SOGo/UI/Templates/UIxMailContactEditor.wox index a6b2ac7a..38fab053 100644 --- a/SOGo/UI/Templates/UIxMailContactEditor.wox +++ b/SOGo/UI/Templates/UIxMailContactEditor.wox @@ -198,4 +198,6 @@ div#contacteditor_extended { + + diff --git a/SOGo/UI/common.make b/SOGo/UI/common.make index 72153ffd..ecb62dbf 100644 --- a/SOGo/UI/common.make +++ b/SOGo/UI/common.make @@ -26,7 +26,7 @@ RELBUILD_DIR_libSOGo = \ RELBUILD_DIR_libSOGoUI = \ $(GNUSTEP_BUILD_DIR)/../SOGoUI/$(GNUSTEP_OBJ_DIR_NAME) RELBUILD_DIR_libOGoContentStore = \ - $(GNUSTEP_BUILD_DIR)/../../../OGoContentStore/$(GNUSTEP_OBJ_DIR_NAME) + $(GNUSTEP_BUILD_DIR)/../../OGoContentStore/$(GNUSTEP_OBJ_DIR_NAME) ADDITIONAL_LIB_DIRS += \ -L$(RELBUILD_DIR_libSOGo) \ -- 2.39.2