From f68812e90fdf6c5db4c8351697fb05a2f00b6ce1 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 7 Mar 2008 22:09:33 +0000 Subject: [PATCH] Monotone-Parent: a23a8f2b57305fececc0699f4dbc0d1ae1aaac63 Monotone-Revision: b76970a2508695482a2184b33fcd48d53793fd10 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-03-07T22:09:33 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 20 +++++++ UI/Contacts/GNUmakefile | 2 + UI/Contacts/UIxContactEditor.m | 63 +++++++++++--------- UI/Contacts/UIxListEditor.h | 32 ++++++++++ UI/Contacts/UIxListEditor.m | 61 +++++++++++++++++++ UI/Contacts/UIxListView.h | 32 ++++++++++ UI/Contacts/UIxListView.m | 27 +++++++++ UI/Contacts/product.plist | 49 ++++++++++++++- UI/Templates/ContactsUI/UIxContactEditor.wox | 10 ++-- UI/Templates/ContactsUI/UIxListEditor.wox | 12 ++++ UI/Templates/ContactsUI/UIxListView.wox | 12 ++++ 11 files changed, 284 insertions(+), 36 deletions(-) create mode 100644 UI/Contacts/UIxListEditor.h create mode 100644 UI/Contacts/UIxListEditor.m create mode 100644 UI/Contacts/UIxListView.h create mode 100644 UI/Contacts/UIxListView.m create mode 100644 UI/Templates/ContactsUI/UIxListEditor.wox create mode 100644 UI/Templates/ContactsUI/UIxListView.wox diff --git a/ChangeLog b/ChangeLog index 740164b02..dc62fc6b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2008-03-07 Wolfgang Sourdeau + + * UI/Contacts/UIxContactEditor.m ([UIxContactEditor -saveURL]): + new accessor that returns the url + "saveAsContact". + ([UIxContactEditor + -shouldTakeValuesFromRequest:requestinContext:context]): changed + method to match the one from the event and todo editor module. + ([UIxContactEditor -editActionName]): changed to "editAsContact". + ([UIxContactEditor -newAction]): changed method to match the one + from the event and todo editor module. + + * UI/Contacts/UIxListView.m: new view module for the VLIST format + components. + + * UI/Contacts/UIxListEditor.m: new edition module for the VLIST + format components. + + * SoObjects/Contacts/SOGoContactGCSList.m: new controller module + for the VLIST format. + 2008-03-04 Wolfgang Sourdeau * SoObjects/SOGo/SOGoObject.m ([SOGoObject -isFolderish]): new diff --git a/UI/Contacts/GNUmakefile b/UI/Contacts/GNUmakefile index b9d4b0eb7..a561d82f5 100644 --- a/UI/Contacts/GNUmakefile +++ b/UI/Contacts/GNUmakefile @@ -17,6 +17,8 @@ ContactsUI_OBJC_FILES = \ UIxContactsFilterPanel.m \ UIxContactView.m \ UIxContactEditor.m \ + UIxListView.m \ + UIxListEditor.m \ UIxContactsListView.m \ UIxContactsListViewContainer.m \ UIxContactFoldersView.m \ diff --git a/UI/Contacts/UIxContactEditor.m b/UI/Contacts/UIxContactEditor.m index 754b6ea78..af0317af6 100644 --- a/UI/Contacts/UIxContactEditor.m +++ b/UI/Contacts/UIxContactEditor.m @@ -25,13 +25,15 @@ #import #import #import +#import #import #import #import #import -#import +#import +#import #import "UIxContactEditor.h" @@ -57,6 +59,12 @@ /* accessors */ +- (NSString *) saveURL +{ + return [NSString stringWithFormat: @"%@/saveAsContact", + [[self clientObject] baseURL]]; +} + - (NSArray *) htmlMailFormatList { static NSArray *htmlMailFormatItems = nil; @@ -136,10 +144,15 @@ /* actions */ -- (BOOL) shouldTakeValuesFromRequest: (WORequest *) _rq - inContext: (WOContext*) _c +- (BOOL) shouldTakeValuesFromRequest: (WORequest *) request + inContext: (WOContext*) context { - return YES; + NSString *actionName; + + actionName = [[request requestHandlerPath] lastPathComponent]; + + return ([[self clientObject] isKindOfClass: [SOGoContactGCSEntry class]] + && [actionName hasPrefix: @"save"]); } - (void) _setSnapshotValue: (NSString *) key @@ -375,7 +388,7 @@ - (NSString *) editActionName { /* this is overridden in the mail based contacts UI to redirect to tb.edit */ - return @"edit"; + return @"editAsContact"; } - (CardElement *) _elementWithTag: (NSString *) tag @@ -492,7 +505,7 @@ - (id ) saveAction { - id contact; + SOGoContactGCSEntry *contact; id result; NSString *jsRefreshMethod; @@ -552,35 +565,27 @@ return [self redirectToLocation: url]; } +#warning Could this be part of a common parent with UIxAppointment/UIxTaskEditor/UIxListEditor ? - (id) newAction { - // TODO: this is almost a DUP of UIxAppointmentEditor - /* - This method creates a unique ID and redirects to the "edit" method on the - new ID. - It is actually a folder method and should be defined on the folder. - - Note: 'clientObject' is the SOGoAppointmentFolder! - Update: remember that there are group folders as well. - */ - NSString *uri, *objectId, *nextMethod; - SOGoObject *co; + NSString *objectId, *method, *uri; + id result; + SOGoContactGCSFolder *co; co = [self clientObject]; - if ([co respondsToSelector: @selector (globallyUniqueObjectId)]) - objectId = [co globallyUniqueObjectId]; + objectId = [co globallyUniqueObjectId]; + if ([objectId length] > 0) + { + method = [NSString stringWithFormat:@"%@/%@.vcf/editAsContact", + [co soURL], objectId]; + uri = [self completeHrefForMethod: method]; + result = [self redirectToLocation: uri]; + } else - objectId = nil; + result = [NSException exceptionWithHTTPStatus: 500 /* Internal Error */ + reason: @"could not create a unique ID"]; - if ([objectId length] == 0) - return [NSException exceptionWithHTTPStatus: 500 /* Internal Error */ - reason: @"could not create a unique ID"]; - - nextMethod = [NSString stringWithFormat: @"../%@.vcf/%@", - objectId, [self editActionName]]; - uri = [self _completeURIForMethod: nextMethod]; - - return [self redirectToLocation: uri]; + return result; } @end /* UIxContactEditor */ diff --git a/UI/Contacts/UIxListEditor.h b/UI/Contacts/UIxListEditor.h new file mode 100644 index 000000000..f895eae8b --- /dev/null +++ b/UI/Contacts/UIxListEditor.h @@ -0,0 +1,32 @@ +/* UIxListEditor.h - this file is part of SOGo + * + * Copyright (C) 2008 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef UIXLISTEDITOR_H +#define UIXLISTEDITOR_H + +#import + +@interface UIxListEditor : UIxComponent + +@end + +#endif /* UIXLISTEDITOR_H */ diff --git a/UI/Contacts/UIxListEditor.m b/UI/Contacts/UIxListEditor.m new file mode 100644 index 000000000..ba9e57a4d --- /dev/null +++ b/UI/Contacts/UIxListEditor.m @@ -0,0 +1,61 @@ +/* UIxListEditor.m - this file is part of SOGo + * + * Copyright (C) 2008 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import +#import + +#import + +#import "UIxListEditor.h" + +@implementation UIxListEditor + +- (NSString *) saveURL +{ + return [NSString stringWithFormat: @"%@/saveAsList", + [[self clientObject] baseURL]]; +} + +#warning Could this be part of a common parent with UIxAppointment/UIxTaskEditor/UIxListEditor ? +- (id) newAction +{ + NSString *objectId, *method, *uri; + id result; + SOGoContactGCSFolder *co; + + co = [self clientObject]; + objectId = [co globallyUniqueObjectId]; + if ([objectId length] > 0) + { + method = [NSString stringWithFormat:@"%@/%@.vls/editAsList", + [co soURL], objectId]; + uri = [self completeHrefForMethod: method]; + result = [self redirectToLocation: uri]; + } + else + result = [NSException exceptionWithHTTPStatus: 500 /* Internal Error */ + reason: @"could not create a unique ID"]; + + return result; +} + +@end diff --git a/UI/Contacts/UIxListView.h b/UI/Contacts/UIxListView.h new file mode 100644 index 000000000..40783eb9e --- /dev/null +++ b/UI/Contacts/UIxListView.h @@ -0,0 +1,32 @@ +/* UIxListView.h - this file is part of SOGo + * + * Copyright (C) 2008 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef UIXLISTVIEW_H +#define UIXLISTVIEW_H + +#import + +@interface UIxListView : UIxComponent + +@end + +#endif /* UIXLISTVIEW_H */ diff --git a/UI/Contacts/UIxListView.m b/UI/Contacts/UIxListView.m new file mode 100644 index 000000000..de69286c6 --- /dev/null +++ b/UI/Contacts/UIxListView.m @@ -0,0 +1,27 @@ +/* UIxListView.m - this file is part of SOGo + * + * Copyright (C) 2008 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import "UIxListView.h" + +@implementation UIxListView + +@end diff --git a/UI/Contacts/product.plist b/UI/Contacts/product.plist index 4a0285aee..5b19b2f6e 100644 --- a/UI/Contacts/product.plist +++ b/UI/Contacts/product.plist @@ -77,11 +77,16 @@ protectedBy = "View"; pageName = "UIxContactsListView"; }; - new = { + newcontact = { protectedBy = "Add Documents, Images, and Files"; pageName = "UIxContactEditor"; actionName = "new"; }; + newlist = { + protectedBy = "Add Documents, Images, and Files"; + pageName = "UIxListEditor"; + actionName = "new"; + }; mailer-contacts = { protectedBy = "View"; pageName = "UIxContactsListView"; @@ -144,11 +149,20 @@ protectedBy = "Access Contents Information"; pageName = "UIxContactEditor"; }; + editAsContact = { + protectedBy = "Access Contents Information"; + pageName = "UIxContactEditor"; + }; save = { protectedBy = "Change Images And Files"; pageName = "UIxContactEditor"; actionName = "save"; }; + saveAsContact = { + protectedBy = "Change Images And Files"; + pageName = "UIxContactEditor"; + actionName = "save"; + }; write = { protectedBy = "View"; pageName = "UIxContactEditor"; @@ -157,6 +171,38 @@ }; }; + SOGoContactGCSList = { + methods = { + view = { + protectedBy = "Access Contents Information"; + pageName = "UIxListView"; + }; + delete = { + protectedBy = "Delete Objects"; + pageName = "UIxListView"; + actionName = "delete"; + }; + edit = { + protectedBy = "Access Contents Information"; + pageName = "UIxListEditor"; + }; + editAsList = { + protectedBy = "Access Contents Information"; + pageName = "UIxListEditor"; + }; + save = { + protectedBy = "Change Images And Files"; + pageName = "UIxListEditor"; + actionName = "save"; + }; + saveAsList = { + protectedBy = "Change Images And Files"; + pageName = "UIxListEditor"; + actionName = "save"; + }; + }; + }; + SOGoContactLDIFEntry = { methods = { view = { @@ -176,4 +222,3 @@ }; }; } - diff --git a/UI/Templates/ContactsUI/UIxContactEditor.wox b/UI/Templates/ContactsUI/UIxContactEditor.wox index 96894d145..2f49e537a 100644 --- a/UI/Templates/ContactsUI/UIxContactEditor.wox +++ b/UI/Templates/ContactsUI/UIxContactEditor.wox @@ -9,7 +9,7 @@ title="name" const:popup="YES" > -
@@ -336,17 +336,17 @@
+ name="cancel"/> + name="submit" />
diff --git a/UI/Templates/ContactsUI/UIxListEditor.wox b/UI/Templates/ContactsUI/UIxListEditor.wox new file mode 100644 index 000000000..02bb02116 --- /dev/null +++ b/UI/Templates/ContactsUI/UIxListEditor.wox @@ -0,0 +1,12 @@ + + Unimplemented diff --git a/UI/Templates/ContactsUI/UIxListView.wox b/UI/Templates/ContactsUI/UIxListView.wox new file mode 100644 index 000000000..02bb02116 --- /dev/null +++ b/UI/Templates/ContactsUI/UIxListView.wox @@ -0,0 +1,12 @@ + + Unimplemented