(feat) handle links to addressbooks like we do for calendars
also included missing template commit for calendar
This commit is contained in:
parent
7b5541b5d1
commit
20bf66d931
|
@ -1,6 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2006-2014 Inverse inc.
|
Copyright (C) 2006-2015 Inverse inc.
|
||||||
Copyright (C) 2004-2005 SKYRIX Software AG
|
|
||||||
|
|
||||||
This file is part of SOGo.
|
This file is part of SOGo.
|
||||||
|
|
||||||
|
@ -32,9 +31,13 @@
|
||||||
@class NSString;
|
@class NSString;
|
||||||
|
|
||||||
@interface SOGoContactGCSFolder : SOGoGCSFolder <SOGoContactFolder>
|
@interface SOGoContactGCSFolder : SOGoGCSFolder <SOGoContactFolder>
|
||||||
|
{
|
||||||
|
NSString *baseCardDAVURL, *basePublicCardDAVURL;
|
||||||
|
}
|
||||||
- (void) fixupContactRecord: (NSMutableDictionary *) contactRecord;
|
- (void) fixupContactRecord: (NSMutableDictionary *) contactRecord;
|
||||||
- (NSDictionary *) lookupContactWithName: (NSString *) aName;
|
- (NSDictionary *) lookupContactWithName: (NSString *) aName;
|
||||||
|
- (NSString *) cardDavURL;
|
||||||
|
- (NSString *) publicCardDavURL;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2006-2013 Inverse inc.
|
Copyright (C) 2006-2013-2015 Inverse inc.
|
||||||
Copyright (C) 2004-2005 SKYRIX Software AG
|
|
||||||
|
|
||||||
This file is part of SOGo.
|
This file is part of SOGo.
|
||||||
|
|
||||||
|
@ -67,6 +66,24 @@ static NSArray *folderListingFields = nil;
|
||||||
@"c_component", nil];
|
@"c_component", nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (id) init
|
||||||
|
{
|
||||||
|
if ((self = [super init]))
|
||||||
|
{
|
||||||
|
baseCardDAVURL = nil;
|
||||||
|
basePublicCardDAVURL = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
[baseCardDAVURL release];
|
||||||
|
[basePublicCardDAVURL release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
- (Class) objectClassForContent: (NSString *) content
|
- (Class) objectClassForContent: (NSString *) content
|
||||||
{
|
{
|
||||||
CardGroup *cardEntry;
|
CardGroup *cardEntry;
|
||||||
|
@ -436,4 +453,48 @@ static NSArray *folderListingFields = nil;
|
||||||
return [NSString stringWithFormat: @"%@:%@", nsRep, nodeName];
|
return [NSString stringWithFormat: @"%@:%@", nsRep, nodeName];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) _baseCardDAVURL
|
||||||
|
{
|
||||||
|
NSString *davURL;
|
||||||
|
|
||||||
|
if (!baseCardDAVURL)
|
||||||
|
{
|
||||||
|
davURL = [[self realDavURL] absoluteString];
|
||||||
|
if ([davURL hasSuffix: @"/"])
|
||||||
|
baseCardDAVURL = [davURL substringToIndex: [davURL length] - 1];
|
||||||
|
else
|
||||||
|
baseCardDAVURL = davURL;
|
||||||
|
[baseCardDAVURL retain];
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseCardDAVURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *) cardDavURL
|
||||||
|
{
|
||||||
|
return [NSString stringWithFormat: @"%@/", [self _baseCardDAVURL]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *) _basePublicCardDAVURL
|
||||||
|
{
|
||||||
|
NSString *davURL;
|
||||||
|
|
||||||
|
if (!basePublicCardDAVURL)
|
||||||
|
{
|
||||||
|
davURL = [[self publicDavURL] absoluteString];
|
||||||
|
if ([davURL hasSuffix: @"/"])
|
||||||
|
basePublicCardDAVURL = [davURL substringToIndex: [davURL length] - 1];
|
||||||
|
else
|
||||||
|
basePublicCardDAVURL = davURL;
|
||||||
|
[basePublicCardDAVURL retain];
|
||||||
|
}
|
||||||
|
|
||||||
|
return basePublicCardDAVURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *) publicCardDavURL
|
||||||
|
{
|
||||||
|
return [NSString stringWithFormat: @"%@/", [self _basePublicCardDAVURL]];
|
||||||
|
}
|
||||||
|
|
||||||
@end /* SOGoContactGCSFolder */
|
@end /* SOGoContactGCSFolder */
|
||||||
|
|
|
@ -20,14 +20,6 @@
|
||||||
|
|
||||||
#import <SOGoUI/UIxComponent.h>
|
#import <SOGoUI/UIxComponent.h>
|
||||||
|
|
||||||
@class NSString;
|
|
||||||
|
|
||||||
@class SOGoContactGCSFolder;
|
|
||||||
|
|
||||||
@interface UIxContactFolderLinksTemplate : UIxComponent
|
@interface UIxContactFolderLinksTemplate : UIxComponent
|
||||||
{
|
|
||||||
SOGoContactGCSFolder *addressBook;
|
|
||||||
NSString *baseCardDAVURL, *basePublicCardDAVURL;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -24,69 +24,6 @@
|
||||||
|
|
||||||
@implementation UIxContactFolderLinksTemplate
|
@implementation UIxContactFolderLinksTemplate
|
||||||
|
|
||||||
- (id) init
|
|
||||||
{
|
|
||||||
if ((self = [super init]))
|
|
||||||
{
|
|
||||||
addressBook = [self clientObject];
|
|
||||||
baseCardDAVURL = nil;
|
|
||||||
basePublicCardDAVURL = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) dealloc
|
|
||||||
{
|
|
||||||
[baseCardDAVURL release];
|
|
||||||
[basePublicCardDAVURL release];
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *) _baseCardDAVURL
|
|
||||||
{
|
|
||||||
NSString *davURL;
|
|
||||||
|
|
||||||
if (!baseCardDAVURL)
|
|
||||||
{
|
|
||||||
davURL = [[addressBook realDavURL] absoluteString];
|
|
||||||
if ([davURL hasSuffix: @"/"])
|
|
||||||
baseCardDAVURL = [davURL substringToIndex: [davURL length] - 1];
|
|
||||||
else
|
|
||||||
baseCardDAVURL = davURL;
|
|
||||||
[baseCardDAVURL retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
return baseCardDAVURL;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *) cardDavURL
|
|
||||||
{
|
|
||||||
return [NSString stringWithFormat: @"%@/", [self _baseCardDAVURL]];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *) _basePublicCardDAVURL
|
|
||||||
{
|
|
||||||
NSString *davURL;
|
|
||||||
|
|
||||||
if (!basePublicCardDAVURL)
|
|
||||||
{
|
|
||||||
davURL = [[addressBook publicDavURL] absoluteString];
|
|
||||||
if ([davURL hasSuffix: @"/"])
|
|
||||||
basePublicCardDAVURL = [davURL substringToIndex: [davURL length] - 1];
|
|
||||||
else
|
|
||||||
basePublicCardDAVURL = davURL;
|
|
||||||
[basePublicCardDAVURL retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
return basePublicCardDAVURL;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *) publicCardDavURL
|
|
||||||
{
|
|
||||||
return [NSString stringWithFormat: @"%@/", [self _basePublicCardDAVURL]];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL) isPublicAccessEnabled
|
- (BOOL) isPublicAccessEnabled
|
||||||
{
|
{
|
||||||
// NOTE: This method is the same found in Common/UIxAclEditor.m
|
// NOTE: This method is the same found in Common/UIxAclEditor.m
|
||||||
|
|
|
@ -275,12 +275,19 @@ Class SOGoContactSourceFolderK, SOGoGCSFolderK;
|
||||||
return [[self queryParameterForKey: @"popup"] boolValue];
|
return [[self queryParameterForKey: @"popup"] boolValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) isPublicAccessEnabled
|
||||||
|
{
|
||||||
|
// NOTE: This method is the same found in Common/UIxAclEditor.m
|
||||||
|
return [[SOGoSystemDefaults sharedSystemDefaults] enablePublicAccess];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *) contactFolders
|
- (NSString *) contactFolders
|
||||||
{
|
{
|
||||||
SOGoContactFolders *folderContainer;
|
SOGoContactFolders *folderContainer;
|
||||||
NSArray *folders;
|
|
||||||
NSMutableArray *foldersAttrs;
|
NSMutableArray *foldersAttrs;
|
||||||
|
NSMutableDictionary *urls;
|
||||||
NSDictionary *folderAttrs;
|
NSDictionary *folderAttrs;
|
||||||
|
NSArray *folders;
|
||||||
id currentFolder;
|
id currentFolder;
|
||||||
int max, i;
|
int max, i;
|
||||||
|
|
||||||
|
@ -291,9 +298,25 @@ Class SOGoContactSourceFolderK, SOGoGCSFolderK;
|
||||||
folders = [folderContainer subFolders];
|
folders = [folderContainer subFolders];
|
||||||
max = [folders count];
|
max = [folders count];
|
||||||
foldersAttrs = [NSMutableArray arrayWithCapacity: max];
|
foldersAttrs = [NSMutableArray arrayWithCapacity: max];
|
||||||
|
urls = nil;
|
||||||
|
|
||||||
for (i = 0; i < max; i++)
|
for (i = 0; i < max; i++)
|
||||||
{
|
{
|
||||||
currentFolder = [folders objectAtIndex: i];
|
currentFolder = [folders objectAtIndex: i];
|
||||||
|
|
||||||
|
if ([currentFolder respondsToSelector: @selector(cardDavURL)])
|
||||||
|
{
|
||||||
|
urls = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||||
|
[currentFolder cardDavURL], @"cardDavURL",
|
||||||
|
nil];
|
||||||
|
if ([self isPublicAccessEnabled])
|
||||||
|
{
|
||||||
|
[urls setObject: [currentFolder publicCardDavURL] forKey: @"publicCardDavURL"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: keep urls as the last key/value here, to avoid chopping the dictionary
|
||||||
|
// if it is not a GCS folder
|
||||||
folderAttrs = [NSDictionary dictionaryWithObjectsAndKeys:
|
folderAttrs = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
[NSString stringWithFormat: @"%@", [currentFolder nameInContainer]], @"id",
|
[NSString stringWithFormat: @"%@", [currentFolder nameInContainer]], @"id",
|
||||||
[currentFolder displayName], @"name",
|
[currentFolder displayName], @"name",
|
||||||
|
@ -301,6 +324,7 @@ Class SOGoContactSourceFolderK, SOGoGCSFolderK;
|
||||||
[NSNumber numberWithBool: [currentFolder isKindOfClass: SOGoGCSFolderK]], @"isEditable",
|
[NSNumber numberWithBool: [currentFolder isKindOfClass: SOGoGCSFolderK]], @"isEditable",
|
||||||
[NSNumber numberWithBool: [currentFolder isKindOfClass: SOGoContactSourceFolderK]
|
[NSNumber numberWithBool: [currentFolder isKindOfClass: SOGoContactSourceFolderK]
|
||||||
&& ![currentFolder isPersonalSource]], @"isRemote",
|
&& ![currentFolder isPersonalSource]], @"isRemote",
|
||||||
|
urls, @"urls",
|
||||||
nil];
|
nil];
|
||||||
[foldersAttrs addObject: folderAttrs];
|
[foldersAttrs addObject: folderAttrs];
|
||||||
}
|
}
|
||||||
|
@ -419,12 +443,6 @@ Class SOGoContactSourceFolderK, SOGoGCSFolderK;
|
||||||
return [super defaultAction];
|
return [super defaultAction];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) isPublicAccessEnabled
|
|
||||||
{
|
|
||||||
// NOTE: This method is the same found in Common/UIxAclEditor.m
|
|
||||||
return [[SOGoSystemDefaults sharedSystemDefaults] enablePublicAccess];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface UIxContactViewTemplate : UIxComponent
|
@interface UIxContactViewTemplate : UIxComponent
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
<div class="md-toolbar-tools">
|
<div class="md-toolbar-tools">
|
||||||
<div class="pseudo-input-container md-flex">
|
<div class="pseudo-input-container md-flex">
|
||||||
<label class="pseudo-input-label"><var:string label:value="Links to this Address Book"/></label>
|
<label class="pseudo-input-label"><var:string label:value="Links to this Address Book"/></label>
|
||||||
<div class="pseudo-input-field sg-md-title"><var:string value="addressBook.displayName"/></div>
|
<div class="pseudo-input-field sg-md-title">{{links.addressbook.name}}</div>
|
||||||
</div>
|
</div>
|
||||||
<md-button class="md-icon-button" ng-click="close()">
|
<md-button class="md-icon-button" ng-click="links.close()">
|
||||||
<md-icon aria-label="Close dialog">close</md-icon>
|
<md-icon aria-label="Close dialog">close</md-icon>
|
||||||
</md-button>
|
</md-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
<div class="sg-md-title"><var:string label:value="Authenticated User Access"/></div>
|
<div class="sg-md-title"><var:string label:value="Authenticated User Access"/></div>
|
||||||
<md-input-container>
|
<md-input-container>
|
||||||
<label><var:string label:value="CardDAV URL"/></label>
|
<label><var:string label:value="CardDAV URL"/></label>
|
||||||
<input var:value="cardDavURL" ng-readonly="true"/>
|
<input type="text" ng-model="links.addressbook.urls.cardDavURL" ng-readonly="true"/>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
</div>
|
</div>
|
||||||
<var:if condition="isPublicAccessEnabled">
|
<var:if condition="isPublicAccessEnabled">
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
<div class="sg-md-title"><var:string label:value="Public Access"/></div>
|
<div class="sg-md-title"><var:string label:value="Public Access"/></div>
|
||||||
<md-input-container>
|
<md-input-container>
|
||||||
<label><var:string label:value="CardDAV URL"/></label>
|
<label><var:string label:value="CardDAV URL"/></label>
|
||||||
<input var:value="publicCardDavURL" ng-readonly="true"/>
|
<input type="text" ng-model="links.addressbook.urls.publicCardDavURL" ng-readonly="true"/>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
</div>
|
</div>
|
||||||
</var:if>
|
</var:if>
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
<div class="md-toolbar-tools">
|
<div class="md-toolbar-tools">
|
||||||
<div class="pseudo-input-container md-flex">
|
<div class="pseudo-input-container md-flex">
|
||||||
<label class="pseudo-input-label"><var:string label:value="Links to this Calendar"/></label>
|
<label class="pseudo-input-label"><var:string label:value="Links to this Calendar"/></label>
|
||||||
<div class="pseudo-input-field sg-md-title"><var:string value="calendar.displayName"/></div>
|
<div class="pseudo-input-field sg-md-title">{{links.calendar.name}}</div>
|
||||||
</div>
|
</div>
|
||||||
<md-button class="md-icon-button" ng-click="close()">
|
<md-button class="md-icon-button" ng-click="links.close()">
|
||||||
<md-icon label:aria-label="Close">close</md-icon>
|
<md-icon label:aria-label="Close">close</md-icon>
|
||||||
</md-button>
|
</md-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -25,50 +25,45 @@
|
||||||
<div layout="column" layout-padding="layout-padding">
|
<div layout="column" layout-padding="layout-padding">
|
||||||
|
|
||||||
<div layout="column" layout-padding="layout-padding">
|
<div layout="column" layout-padding="layout-padding">
|
||||||
|
<md-input-container ng-show="links.calendar.isWebCalendar">
|
||||||
<var:if condition="isWebCalendar">
|
|
||||||
<md-input-container>
|
|
||||||
<label><var:string label:value="URL"/></label>
|
<label><var:string label:value="URL"/></label>
|
||||||
<input var:value="webCalendarURL" ng-readonly="true"/>
|
<input type="text" ng-model="links.calendar.urls.webCalendarURL" ng-readonly="true"/>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
</var:if>
|
|
||||||
<var:if condition="isWebCalendar" const:negate="YES">
|
|
||||||
<div class="sg-md-title"><var:string label:value="Authenticated User Access"/></div>
|
|
||||||
|
|
||||||
|
<div ng-hide="links.calendar.isWebCalendar">
|
||||||
|
<div class="sg-md-title"><var:string label:value="Authenticated User Access"/></div>
|
||||||
<md-input-container>
|
<md-input-container>
|
||||||
<label><var:string label:value="CalDAV URL"/></label>
|
<label><var:string label:value="CalDAV URL"/></label>
|
||||||
<input var:value="calDavURL" ng-readonly="true"/>
|
<input type="text" ng-model="links.calendar.urls.calDavURL" ng-readonly="true"/>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
<md-input-container>
|
<md-input-container>
|
||||||
<label><var:string label:value="WebDAV ICS URL"/></label>
|
<label><var:string label:value="WebDAV ICS URL"/></label>
|
||||||
<input var:value="webDavICSURL" ng-readonly="true"/>
|
<input type="text" ng-model="links.calendar.urls.webDavICSURL" ng-readonly="true"/>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
<md-input-container>
|
<md-input-container>
|
||||||
<label><var:string label:value="WebDAV XML URL"/></label>
|
<label><var:string label:value="WebDAV XML URL"/></label>
|
||||||
<input var:value="webDavXMLURL" ng-readonly="true"/>
|
<input type="text" ng-model="links.calendar.urls.webDavXMLURL" ng-readonly="true"/>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
</var:if>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<var:if condition="isPublicAccessEnabled">
|
<var:if condition="isPublicAccessEnabled">
|
||||||
<var:if condition="isWebCalendar" const:negate="YES">
|
<div layout="column" layout-padding="layout-padding" ng-hide="links.calendar.isWebCalendar">
|
||||||
<div layout="column" layout-padding="layout-padding">
|
|
||||||
<div class="sg-md-title"><var:string label:value="Public Access"/></div>
|
<div class="sg-md-title"><var:string label:value="Public Access"/></div>
|
||||||
<md-input-container>
|
<md-input-container>
|
||||||
<label><var:string label:value="CalDAV URL"/></label>
|
<label><var:string label:value="CalDAV URL"/></label>
|
||||||
<input var:value="publicCalDavURL" ng-readonly="true"/>
|
<input type="text" ng-model="links.calendar.urls.publicCalDavURL" ng-readonly="true"/>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
<md-input-container>
|
<md-input-container>
|
||||||
<label><var:string label:value="WebDAV ICS URL"/></label>
|
<label><var:string label:value="WebDAV ICS URL"/></label>
|
||||||
<input var:value="publicWebDavICSURL" ng-readonly="true"/>
|
<input type="text" ng-model="links.calendar.urls.publicWebDavICSURL" ng-readonly="true"/>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
<md-input-container>
|
<md-input-container>
|
||||||
<label><var:string label:value="WebDAV XML URL"/></label>
|
<label><var:string label:value="WebDAV XML URL"/></label>
|
||||||
<input var:value="publicWebDavXMLURL" ng-readonly="true"/>
|
<input type="text" ng-model="links.calendar.urls.publicWebDavXMLURL" ng-readonly="true"/>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
</div>
|
</div>
|
||||||
</var:if>
|
</var:if>
|
||||||
</var:if>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</md-dialog-content>
|
</md-dialog-content>
|
||||||
|
|
|
@ -109,25 +109,31 @@
|
||||||
window.location.href = ApplicationBaseURL + '/' + vm.service.selectedFolder.id + '/exportFolder';
|
window.location.href = ApplicationBaseURL + '/' + vm.service.selectedFolder.id + '/exportFolder';
|
||||||
}
|
}
|
||||||
|
|
||||||
function showLinks(selectedFolder) {
|
function showLinks(addressbook) {
|
||||||
$mdDialog.show({
|
$mdDialog.show({
|
||||||
parent: angular.element(document.body),
|
parent: angular.element(document.body),
|
||||||
clickOutsideToClose: true,
|
clickOutsideToClose: true,
|
||||||
escapeToClose: true,
|
escapeToClose: true,
|
||||||
templateUrl: selectedFolder.id + '/links',
|
templateUrl: addressbook.id + '/links',
|
||||||
|
controller: LinksDialogController,
|
||||||
|
controllerAs: 'links',
|
||||||
locals: {
|
locals: {
|
||||||
},
|
addressbook: addressbook
|
||||||
controller: LinksDialogController
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ngInject
|
* @ngInject
|
||||||
*/
|
*/
|
||||||
LinksDialogController.$inject = ['scope', '$mdDialog'];
|
LinksDialogController.$inject = ['$mdDialog', 'addressbook'];
|
||||||
function LinksDialogController(scope, $mdDialog) {
|
function LinksDialogController($mdDialog, addressbook) {
|
||||||
scope.close = function() {
|
var vm = this;
|
||||||
|
this.addressbook = addressbook;
|
||||||
|
this.close = close;
|
||||||
|
|
||||||
|
function close() {
|
||||||
$mdDialog.hide();
|
$mdDialog.hide();
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue