diff options
Diffstat (limited to 'apps/settings/js/federationscopemenu.js')
-rw-r--r-- | apps/settings/js/federationscopemenu.js | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/apps/settings/js/federationscopemenu.js b/apps/settings/js/federationscopemenu.js index 170aec15a85..d19c9d7d0bf 100644 --- a/apps/settings/js/federationscopemenu.js +++ b/apps/settings/js/federationscopemenu.js @@ -15,6 +15,8 @@ * Construct a new FederationScopeMenu instance * @constructs FederationScopeMenu * @memberof OC.Settings + * @param {object} options + * @param {array.<string>} [options.excludedScopes] array of excluded scopes */ var FederationScopeMenu = OC.Backbone.View.extend({ tagName: 'div', @@ -26,27 +28,40 @@ this.field = options.field; this._scopes = [ { - name: 'private', + name: 'v2-private', displayName: t('settings', 'Private'), - tooltip: t('settings', "Don't synchronize to servers"), + tooltip: t('settings', 'Only visible to people matched via phone number integration through Talk on mobile'), + iconClass: 'icon-phone', + active: false + }, + { + name: 'v2-local', + displayName: t('settings', 'Local'), + tooltip: t('settings', 'Only visible to people on this instance and guests'), iconClass: 'icon-password', active: false }, { - name: 'contacts', - displayName: t('settings', 'Trusted'), + name: 'v2-federated', + displayName: t('settings', 'Federated'), tooltip: t('settings', 'Only synchronize to trusted servers'), iconClass: 'icon-contacts-dark', active: false }, { - name: 'public', - displayName: t('settings', 'Public'), + name: 'v2-published', + displayName: t('settings', 'Published'), tooltip: t('settings', 'Synchronize to trusted servers and the global and public address book'), iconClass: 'icon-link', active: false } ]; + + if (options.excludedScopes && options.excludedScopes.length) { + this._scopes = this._scopes.filter(function(scopeEntry) { + return options.excludedScopes.indexOf(scopeEntry.name) === -1; + }) + } }, /** @@ -102,19 +117,11 @@ var currentlyActiveValue = $('#'+context.target.closest('form').id).find('input[type="hidden"]')[0].value; for(var i in this._scopes) { - this._scopes[i].active = false; - } - - switch (currentlyActiveValue) { - case 'private': - this._scopes[0].active = true; - break; - case 'contacts': - this._scopes[1].active = true; - break; - case 'public': - this._scopes[2].active = true; - break; + if (this._scopes[i].name === currentlyActiveValue) { + this._scopes[i].active = true; + } else { + this._scopes[i].active = false; + } } this.render(); |