From 25fc08a38dadeb1ffc848557be2299bcfe7e430f Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Tue, 25 Nov 2014 09:36:24 -0500 Subject: [PATCH] We can now show links to the address book --- UI/Contacts/UIxContactFoldersView.m | 9 +++- UI/Contacts/UIxContactsListActions.m | 42 ++++++++++++++++++- .../ContactsUI/UIxContactFoldersView.wox | 28 ++++++++++--- UI/WebServerResources/js/ContactsUI.js | 3 ++ UI/WebServerResources/scss/ContactsUI.scss | 23 ++++++++++ 5 files changed, 96 insertions(+), 9 deletions(-) diff --git a/UI/Contacts/UIxContactFoldersView.m b/UI/Contacts/UIxContactFoldersView.m index 0550f14f7..3a85187cb 100644 --- a/UI/Contacts/UIxContactFoldersView.m +++ b/UI/Contacts/UIxContactFoldersView.m @@ -1,6 +1,6 @@ /* UIxContactFoldersView.m - this file is part of SOGo * - * Copyright (C) 2006-2013 Inverse inc. + * Copyright (C) 2006-2014 Inverse inc. * * 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 @@ -38,6 +38,7 @@ #import #import +#import #import #import #import @@ -418,4 +419,10 @@ Class SOGoContactSourceFolderK, SOGoGCSFolderK; return [super defaultAction]; } +- (BOOL) isPublicAccessEnabled +{ + // NOTE: This method is the same found in Common/UIxAclEditor.m + return [[SOGoSystemDefaults sharedSystemDefaults] enablePublicAccess]; +} + @end diff --git a/UI/Contacts/UIxContactsListActions.m b/UI/Contacts/UIxContactsListActions.m index 69d4bb57f..e7fe34ea7 100644 --- a/UI/Contacts/UIxContactsListActions.m +++ b/UI/Contacts/UIxContactsListActions.m @@ -1,6 +1,5 @@ /* - Copyright (C) 2006-2012 Inverse inc. - Copyright (C) 2004-2005 SKYRIX Software AG + Copyright (C) 2006-2014 Inverse inc. This file is part of SOGo. @@ -24,6 +23,7 @@ #import #import #import +#import #import #import @@ -179,6 +179,8 @@ data = [NSDictionary dictionaryWithObjectsAndKeys: [[self clientObject] nameInContainer], @"id", newContactsList, @"cards", + [self cardDavURL], @"cardDavURL", + [self publicCardDavURL], @"publicCardDavURL", nil]; result = [self responseWithStatus: 200 @@ -255,4 +257,40 @@ return result; } +- (NSString *) cardDavURL +{ + NSString *davURL, *baseCardDAVURL; + + davURL = @""; + + if ([[self clientObject] respondsToSelector: @selector(realDavURL)]) + davURL = [[[self clientObject] realDavURL] absoluteString]; + + if ([davURL hasSuffix: @"/"]) + baseCardDAVURL = [davURL substringToIndex: [davURL length] - 1]; + else + baseCardDAVURL = davURL; + + return [NSString stringWithFormat: @"%@/", baseCardDAVURL]; +} + +- (NSString *) publicCardDavURL +{ + if ([[self clientObject] respondsToSelector: @selector(publicDavURL)] && + [[SOGoSystemDefaults sharedSystemDefaults] enablePublicAccess]) + { + NSString *davURL, *basePublicCardDAVURL; + + davURL = [[[self clientObject] publicDavURL] absoluteString]; + if ([davURL hasSuffix: @"/"]) + basePublicCardDAVURL = [davURL substringToIndex: [davURL length] - 1]; + else + basePublicCardDAVURL = davURL; + + return [NSString stringWithFormat: @"%@/", basePublicCardDAVURL]; + } + + return @""; +} + @end /* UIxContactsListActions */ diff --git a/UI/Templates/ContactsUI/UIxContactFoldersView.wox b/UI/Templates/ContactsUI/UIxContactFoldersView.wox index 6e2dc4e74..2b569b288 100644 --- a/UI/Templates/ContactsUI/UIxContactFoldersView.wox +++ b/UI/Templates/ContactsUI/UIxContactFoldersView.wox @@ -114,21 +114,21 @@
  • - +
  • -
  • +
  • -
  • +
  • -
  • +
  • -
  • +
@@ -139,6 +139,22 @@
  • + + +
    + data-ng-show="currentFolderIsConfigurable(folder)"> diff --git a/UI/WebServerResources/js/ContactsUI.js b/UI/WebServerResources/js/ContactsUI.js index e80c2c4c2..7757e523a 100644 --- a/UI/WebServerResources/js/ContactsUI.js +++ b/UI/WebServerResources/js/ContactsUI.js @@ -139,6 +139,9 @@ } }); }; + $scope.currentFolderIsConfigurable = function(folder) { + return ($scope.addressbook.id == folder.id && !folder.isRemote); + }; $scope.edit = function(i) { if (!$rootScope.addressbook.isRemote) { if (angular.isUndefined(i)) { diff --git a/UI/WebServerResources/scss/ContactsUI.scss b/UI/WebServerResources/scss/ContactsUI.scss index 89265d8b5..f40473bea 100644 --- a/UI/WebServerResources/scss/ContactsUI.scss +++ b/UI/WebServerResources/scss/ContactsUI.scss @@ -477,6 +477,29 @@ $column-gutter: 0; width: 350px; } +#addressbookLinks { + background-color: #fff; + width: 450px; + height: 135px; + cursor: none; + + .title { + background-color: $secondary-color; + padding: $f-dropdown-list-padding; + text-transform: uppercase; + } + + .subtitle { + background-color: #6F5A73; + padding: $f-dropdown-list-padding; + } + + .value { + color: #000; + font-weight: bold; + } +} + .buttonsToolbar { text-align: right; .button {