From c063832d0dacb016ef7ee97e4f4b206942aa7acd Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Mon, 3 Nov 2014 15:58:54 -0500 Subject: [PATCH] Move ACL editor into a separate template The user rights remain dynamic, based on the object type (addressbook vs mailbox vs calendar). --- UI/Common/product.plist | 4 + .../ContactsUI/UIxContactFoldersView.wox | 132 +++++------------- UI/Templates/UIxAclEditor.wox | 121 +++++++++------- .../js/Contacts/addressbook-model.js | 6 +- UI/WebServerResources/js/ContactsUI.js | 10 +- 5 files changed, 122 insertions(+), 151 deletions(-) diff --git a/UI/Common/product.plist b/UI/Common/product.plist index e58a36c62..75b9a78b0 100644 --- a/UI/Common/product.plist +++ b/UI/Common/product.plist @@ -64,6 +64,10 @@ pageName = "UIxAclEditor"; actionName = "acls"; }; + aclsTemplate = { + protectedBy = "ReadAcls"; + pageName = "UIxAclEditor"; + }; }; }; SOGoParentFolder = { diff --git a/UI/Templates/ContactsUI/UIxContactFoldersView.wox b/UI/Templates/ContactsUI/UIxContactFoldersView.wox index b0c319b78..28c560b60 100644 --- a/UI/Templates/ContactsUI/UIxContactFoldersView.wox +++ b/UI/Templates/ContactsUI/UIxContactFoldersView.wox @@ -65,107 +65,47 @@
- - -
-
-
- - - -
-
-
- - - - + xmlns:var="http://www.skyrix.com/od/binding" + xmlns:const="http://www.skyrix.com/od/constant" + xmlns:uix="OGo:uix" + xmlns:label="OGo:label" + xmlns:rsrc="OGo:url" + className="UIxPageFrame" + title="title" + const:toolbar="none" + const:popup="YES"> +
+

- {{addressbook.name}}

+
    + +
  • +
      +
    • + + + + + {{user.$shortFormat()}} + + + +
    • +
    + + + + + + +
    + + + + +
    +
  • + + +
  • +
    + {{selectedUser.$shortFormat()}}
    -
      -
    • - -
    • -
      -
    -
-
- +
+ + +
+
+ + +
+ diff --git a/UI/WebServerResources/js/Contacts/addressbook-model.js b/UI/WebServerResources/js/Contacts/addressbook-model.js index b8eff57cc..db88bc1a1 100644 --- a/UI/WebServerResources/js/Contacts/addressbook-model.js +++ b/UI/WebServerResources/js/Contacts/addressbook-model.js @@ -38,7 +38,8 @@ $timeout: $timeout, $$resource: new Resource(Settings.baseURL), $Card: Card, - $$Acl: Acl + $$Acl: Acl, + activeUser: Settings.activeUser }); return AddressBook; // return constructor @@ -77,6 +78,9 @@ // Instanciate AddressBook objects angular.forEach(this.$addressbooks, function(o, i) { _this.$addressbooks[i] = new AddressBook(o); + // Add 'isOwned' attribute based on active user (TODO: add it server-side?) + _this.$addressbooks[i].isOwned = _this.activeUser.isSuperUser + || _this.$addressbooks[i].owner == _this.activeUser.login; }); } return this.$addressbooks; diff --git a/UI/WebServerResources/js/ContactsUI.js b/UI/WebServerResources/js/ContactsUI.js index 17614771e..e48bba450 100644 --- a/UI/WebServerResources/js/ContactsUI.js +++ b/UI/WebServerResources/js/ContactsUI.js @@ -9,7 +9,13 @@ angular.module('SOGo.ContactsUI', ['ngSanitize', 'ui.router', 'mm.foundation', 'SOGo.Common', 'SOGo.UIDesktop']) .constant('sgSettings', { - baseURL: ApplicationBaseURL + baseURL: ApplicationBaseURL, + activeUser: { + login: UserLogin, + language: UserLanguage, + folderURL: UserFolderURL, + isSuperUser: IsSuperUser + } }) .config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) { @@ -181,7 +187,7 @@ }; $scope.share = function() { var modal = $modal.open({ - templateUrl: 'addressbookSharing.html', + templateUrl: stateAddressbook.id + '/aclsTemplate', resolve: { modalUsers: function() { return stateAddressbook.$acl.$users();