Monotone-Parent: c59459e186c2878e5e6d52251e7dc74f9c8c5b2b
Monotone-Revision: 10bd36248ea07224b256dcee6fb1ba205a8338d6 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2008-07-16T04:17:46 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
a81875a7fa
commit
0770d6b77a
|
@ -29,14 +29,25 @@
|
|||
|
||||
@class NGVCard;
|
||||
|
||||
@class SOGoContactFolder;
|
||||
|
||||
@interface UIxContactEditor : UIxComponent
|
||||
{
|
||||
id addressBookItem;
|
||||
NSString *preferredEmail;
|
||||
NSString *item;
|
||||
NGVCard *card;
|
||||
NSMutableDictionary *snapshot; /* contains the values for editing */
|
||||
}
|
||||
|
||||
- (void) setAddressBookItem: (id) _item;
|
||||
- (id) addressBookItem;
|
||||
|
||||
- (BOOL) isNew;
|
||||
- (NSArray *) addressBooksList;
|
||||
- (SOGoContactFolder *) componentAddressBook;
|
||||
- (NSString *) addressBookDisplayName;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __UIxContactEditor_H__ */
|
||||
|
|
|
@ -21,8 +21,11 @@
|
|||
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
|
||||
#import <NGObjWeb/NSException+HTTP.h>
|
||||
#import <NGObjWeb/SoPermissions.h>
|
||||
#import <NGObjWeb/SoSecurityManager.h>
|
||||
#import <NGObjWeb/SoObject.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
#import <NGObjWeb/WOResponse.h>
|
||||
|
@ -31,6 +34,8 @@
|
|||
#import <NGCards/NGVCard.h>
|
||||
#import <NGCards/NSArray+NGCards.h>
|
||||
|
||||
#import <Contacts/SOGoContactFolder.h>
|
||||
#import <Contacts/SOGoContactFolders.h>
|
||||
#import <Contacts/SOGoContactObject.h>
|
||||
#import <Contacts/SOGoContactGCSEntry.h>
|
||||
#import <Contacts/SOGoContactGCSFolder.h>
|
||||
|
@ -59,6 +64,16 @@
|
|||
|
||||
/* accessors */
|
||||
|
||||
- (void) setAddressBookItem: (id) _item
|
||||
{
|
||||
ASSIGN (addressBookItem, _item);
|
||||
}
|
||||
|
||||
- (id) addressBookItem
|
||||
{
|
||||
return addressBookItem;
|
||||
}
|
||||
|
||||
- (NSString *) saveURL
|
||||
{
|
||||
return [NSString stringWithFormat: @"%@/saveAsContact",
|
||||
|
@ -142,6 +157,63 @@
|
|||
return [self completeHrefForMethod:uri];
|
||||
}
|
||||
|
||||
- (BOOL) isNew
|
||||
{
|
||||
return [[self clientObject] isNew];
|
||||
}
|
||||
|
||||
- (NSArray *) addressBooksList
|
||||
{
|
||||
NSEnumerator *folders;
|
||||
NSMutableArray *addressBooksList;
|
||||
SoSecurityManager *sm;
|
||||
SOGoContactFolders *folderContainer;
|
||||
SOGoContactFolder *folder, *currentFolder;
|
||||
|
||||
addressBooksList = [NSMutableArray new];
|
||||
sm = [SoSecurityManager sharedSecurityManager];
|
||||
folderContainer = [[[self clientObject] container] container];
|
||||
folders = [[folderContainer subFolders] objectEnumerator];
|
||||
folder = [self componentAddressBook];
|
||||
currentFolder = [folders nextObject];
|
||||
|
||||
while (currentFolder)
|
||||
{
|
||||
if ([currentFolder isEqual: folder] ||
|
||||
![sm validatePermission: SoPerm_AddDocumentsImagesAndFiles
|
||||
onObject: currentFolder
|
||||
inContext: context])
|
||||
[addressBooksList addObject: currentFolder];
|
||||
currentFolder = [folders nextObject];
|
||||
}
|
||||
|
||||
return addressBooksList;
|
||||
}
|
||||
|
||||
- (SOGoContactFolder *) componentAddressBook
|
||||
{
|
||||
SOGoContactFolder *folder;
|
||||
|
||||
folder = [[self clientObject] container];
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
- (NSString *) addressBookDisplayName
|
||||
{
|
||||
NSString *fDisplayName;
|
||||
SOGoContactFolder *folder;
|
||||
SOGoContactFolders *parentFolder;
|
||||
|
||||
fDisplayName = [addressBookItem displayName];
|
||||
folder = [[self clientObject] container];
|
||||
parentFolder = [folder container];
|
||||
if ([fDisplayName isEqualToString: [parentFolder defaultFolderName]])
|
||||
fDisplayName = [self labelForKey: fDisplayName];
|
||||
|
||||
return fDisplayName;
|
||||
}
|
||||
|
||||
/* actions */
|
||||
|
||||
- (BOOL) shouldTakeValuesFromRequest: (WORequest *) request
|
||||
|
|
|
@ -12,6 +12,16 @@
|
|||
<form var:href="saveURL" name="editform"
|
||||
onsubmit="return validateContactEditor()">
|
||||
|
||||
<var:if condition="isNew"><div id="addressBookSelector">
|
||||
<style type="text/css">DIV#editorTabs { top: 3.0em; };</style>
|
||||
<var:string label:value="Add to:" />
|
||||
<var:popup const:id="addressBooksList"
|
||||
list="addressBooksList" item="addressBookItem"
|
||||
string="addressBookDisplayName"
|
||||
var:selection="componentAddressBook"
|
||||
/>
|
||||
</div></var:if>
|
||||
|
||||
<div class="tabsContainer" id="editorTabs">
|
||||
<ul>
|
||||
<li target="baseInfos"><var:string label:value="Contact" /></li>
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
DIV#addressBookSelector
|
||||
{ margin: .5em; }
|
||||
|
||||
DIV#editorTabs
|
||||
{ position: absolute;
|
||||
top: .5em;
|
||||
|
|
Loading…
Reference in a new issue