diff --git a/core/js/shareconfigmodel.js b/core/js/shareconfigmodel.js index 857e356a35..e948c57cba 100644 --- a/core/js/shareconfigmodel.js +++ b/core/js/shareconfigmodel.js @@ -55,6 +55,13 @@ return oc_appconfig.core.remoteShareAllowed; }, + /** + * @returns {boolean} + */ + isResharingAllowed: function() { + return oc_appconfig.core.resharingAllowed + }, + /** * @returns {boolean} */ diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js new file mode 100644 index 0000000000..177e0b4a89 --- /dev/null +++ b/core/js/sharedialogshareelistview.js @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2015 + * + * This file is licensed under the Affero General Public License version 3 + * or later. + * + * See the COPYING-README file. + * + */ + +(function() { + if (!OC.Share) { + OC.Share = {}; + } + + var TEMPLATE = + '' + ; + + /** + * @class OCA.Share.ShareDialogShareeListView + * @member {OC.Share.ShareItemModel} model + * @member {jQuery} $el + * @memberof OCA.Sharing + * @classdesc + * + * Represents the sharee list part in the GUI of the share dialogue + * + */ + var ShareDialogShareeListView = OC.Backbone.View.extend({ + /** @type {string} **/ + id: 'shareDialogLinkShare', + + /** @type {OC.Share.ShareConfigModel} **/ + configModel: undefined, + + /** @type {Function} **/ + _template: undefined, + + /** @type {boolean} **/ + showLink: true, + + initialize: function(options) { + if(!_.isUndefined(options.configModel)) { + this.configModel = options.configModel; + } else { + throw 'missing OC.Share.ShareConfigModel'; + } + }, + + getShareeList: function() { + var universal = { + avatarEnabled: this.configModel.areAvatarsEnabled(), + mailPublicNotificationEnabled: this.configModel.isMailPublicNotificationEnabled(), + notifyByMailLabel: t('core', 'notify by email'), + unshareLabel: t('core', 'Unshare'), + unshareImage: OC.imagePath('core', 'actions/delete') + }; + + // TODO: sharess must have following attributes + // shareType + // shareWith + // shareWithDisplayName + // isRemoteShare + // isMailSent + + var list = _.extend({}, universal); + + return list; + }, + + render: function() { + var shareeListTemplate = this.template(); + this.$el.html(shareeListTemplate({ + sharees: this.getShareeList() + })); + + return this; + }, + + /** + * @returns {Function} from Handlebars + * @private + */ + template: function () { + if (!this._template) { + this._template = Handlebars.compile(TEMPLATE); + } + return this._template; + } + + }); + + OC.Share.ShareDialogShareeListView = ShareDialogShareeListView; + +})(); diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index 8cd68962d4..2348c14bb8 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -22,8 +22,7 @@ '' + // FIXME: find a good position for remoteShareInfo '{{{remoteShareInfo}}}' + - '' + + '
' + '
' + '
' ; @@ -88,7 +87,8 @@ var subViews = { resharerInfoView: 'ShareDialogResharerInfoView', linkShareView: 'ShareDialogLinkShareView', - expirationView: 'ShareDialogExpirationView' + expirationView: 'ShareDialogExpirationView', + shareeListView: 'ShareDialogShareeListView' }; for(var name in subViews) { @@ -117,6 +117,9 @@ this.expirationView.$el = this.$el.find('.expirationView'); this.expirationView.render(); + this.shareeListView.$el = this.$el.find('.shareeListView'); + this.shareeListView.redner(); + this.$el.find('.hasTooltip').tooltip(); if(this.configModel.areAvatarsEnabled()) { this.$el.find('.avatar').avatar(this.model.getReshareOwner, 32); diff --git a/lib/private/share/share.php b/lib/private/share/share.php index b5d508b30b..802b146cfb 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -88,6 +88,7 @@ class Share extends Constants { \OC_Util::addScript('core', 'sharedialogresharerinfoview'); \OC_Util::addScript('core', 'sharedialoglinkshareview'); \OC_Util::addScript('core', 'sharedialogexpirationview'); + \OC_Util::addScript('core', 'sharedialogshareelistview'); \OC_Util::addScript('core', 'sharedialogview'); \OC_Util::addScript('core', 'share'); \OC_Util::addStyle('core', 'share');