continue to reimplement sharee list view. still WIP
This commit is contained in:
parent
c17d022ca4
commit
5db1db38ef
|
@ -92,7 +92,7 @@
|
||||||
render: function() {
|
render: function() {
|
||||||
var linkShareTemplate = this.template();
|
var linkShareTemplate = this.template();
|
||||||
|
|
||||||
if( !this.model.hasSharePermission()
|
if( !this.model.sharePermissionPossible()
|
||||||
|| !this.showLink
|
|| !this.showLink
|
||||||
|| !this.configModel.isShareWithLinkAllowed())
|
|| !this.configModel.isShareWithLinkAllowed())
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
|
|
||||||
var publicUpload =
|
var publicUpload =
|
||||||
this.model.isFolder()
|
this.model.isFolder()
|
||||||
&& this.model.hasCreatePermission()
|
&& this.model.createPermissionPossible()
|
||||||
&& this.configModel.isPublicUploadEnabled();
|
&& this.configModel.isPublicUploadEnabled();
|
||||||
|
|
||||||
var publicUploadChecked = '';
|
var publicUploadChecked = '';
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
var TEMPLATE =
|
var TEMPLATE =
|
||||||
'<span class="reshare">' +
|
'<span class="reshare">' +
|
||||||
' {{#if avatarEnabled}}' +
|
' {{#if avatarEnabled}}' +
|
||||||
' <div class="avatar"></div>' +
|
' <div class="avatar" data-userName="{{reshareOwner}}"></div>' +
|
||||||
' {{/if}}' +
|
' {{/if}}' +
|
||||||
' {{sharedByText}}' +
|
' {{sharedByText}}' +
|
||||||
'</span><br/>'
|
'</span><br/>'
|
||||||
|
@ -92,6 +92,7 @@
|
||||||
|
|
||||||
this.$el.html(reshareTemplate({
|
this.$el.html(reshareTemplate({
|
||||||
avatarEnabled: this.configModel.areAvatarsEnabled(),
|
avatarEnabled: this.configModel.areAvatarsEnabled(),
|
||||||
|
reshareOwner: this.model.getReshareOwner(),
|
||||||
sharedByText: sharedByText
|
sharedByText: sharedByText
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -16,18 +16,41 @@
|
||||||
var TEMPLATE =
|
var TEMPLATE =
|
||||||
'<ul id="shareWithList">' +
|
'<ul id="shareWithList">' +
|
||||||
'{{#each sharees}}' +
|
'{{#each sharees}}' +
|
||||||
|
' {{#if isCollection}}' +
|
||||||
|
' <li data-collection="{{collectionID}}">{{text}}</li>' +
|
||||||
|
' {{/if}}' +
|
||||||
|
' {{#unless isCollection}}' +
|
||||||
' <li data-share-type="{{shareType}}" data-share-with="{{shareWith}}" title="{{shareWith}}">' +
|
' <li data-share-type="{{shareType}}" data-share-with="{{shareWith}}" title="{{shareWith}}">' +
|
||||||
' <a href="#" class="unshare"><img class="svg" alt="{{unshareLabel}}" title="{{unshareLabel}}" src="{{unshareImage}}" /></a>' +
|
' <a href="#" class="unshare"><img class="svg" alt="{{unshareLabel}}" title="{{unshareLabel}}" src="{{unshareImage}}" /></a>' +
|
||||||
' {{#if avatarEnabled}}' +
|
' {{#if avatarEnabled}}' +
|
||||||
' <div class="avatar"></div>' +
|
' <div class="avatar {{#if modSeed}}imageplaceholderseed{{/if}}" data-username="{{shareWith}}" {{#if modSeed}}data-seed="{{shareWith}} {{shareType}}"{{/if}}></div>' +
|
||||||
' {{/if}}' +
|
' {{/if}}' +
|
||||||
' <span class="username">{{shareWithDisplayName}}</span>' +
|
' <span class="username">{{shareWithDisplayName}}</span>' +
|
||||||
' {{#if mailPublicNotificationEnabled}} {{#unless isRemoteShare}}' +
|
' {{#if mailPublicNotificationEnabled}} {{#unless isRemoteShare}}' +
|
||||||
' <label><input type="checkbox" name="mailNotification" class="mailNotification" {{isMailSent}} />{{notifyByMailLabel}}</label>' +
|
' <label><input type="checkbox" name="mailNotification" class="mailNotification" {{#if wasMailSent}}checked="checked"{{/if}} />{{notifyByMailLabel}}</label>' +
|
||||||
' {{/unless}} {{/if}}' +
|
' {{/unless}} {{/if}}' +
|
||||||
' {{#if isResharingAllowed}} {{#if hasSharePermission}}' +
|
' {{#if isResharingAllowed}} {{#if sharePermissionPossible}}' +
|
||||||
|
' <label><input id="canShare-{{shareWith}}" type="checkbox" name="share" class="permissions" {{#if hasSharePermission}}checked="checked"{{/if}} data-permissions="{{sharePermission}}" />{{canShareLabel}}</label>' +
|
||||||
' {{/if}} {{/if}}' +
|
' {{/if}} {{/if}}' +
|
||||||
|
' {{#if editPermissionPossible}}' +
|
||||||
|
' <label><input id="canEdit-{{shareWith}}" type="checkbox" name="edit" class="permissions" {{#if hasEditPermission}}checked="checked"{{/if}} />{{canEditLabel}}</label>' +
|
||||||
|
' {{/if}}' +
|
||||||
|
' {{#unless isRemoteShare}}' +
|
||||||
|
' <a href="#" class="showCruds"><img class="svg" alt="{{crudsLabel}}" src="{{triangleSImage}}"/></a>' +
|
||||||
|
' <div class="cruds" class="hidden">' +
|
||||||
|
' {{#if createPermissionPossible}}' +
|
||||||
|
' <label><input id="canCreate-{{shareWith}}" type="checkbox" name="create" class="permissions" {{#if hasCreatePermission}}checked="checked"{{/if}} data-permissions="{{createPermission}}"/>{{createPermissionLabel}}</label>' +
|
||||||
|
' {{/if}}' +
|
||||||
|
' {{#if updatePermissionPossible}}' +
|
||||||
|
' <label><input id="canUpdate-{{shareWith}}" type="checkbox" name="update" class="permissions" {{#if hasUpdatePermission}}checked="checked"{{/if}} data-permissions="{{updatePermission}}"/>{{updatePermissionLabel}}</label>' +
|
||||||
|
' {{/if}}' +
|
||||||
|
' {{#if deletePermissionPossible}}' +
|
||||||
|
' <label><input id="canDelete-{{shareWith}}" type="checkbox" name="delete" class="permissions" {{#if hasDeletePermission}}checked="checked"{{/if}} data-permissions="{{deletePermission}}"/>{{deletePermissionLabel}}</label>' +
|
||||||
|
' {{/if}}' +
|
||||||
|
' </div>' +
|
||||||
|
' {{/unless}}' +
|
||||||
' </li>' +
|
' </li>' +
|
||||||
|
' {{/unless}}' +
|
||||||
'{{/each}}' +
|
'{{/each}}' +
|
||||||
'</ul>'
|
'</ul>'
|
||||||
;
|
;
|
||||||
|
@ -61,6 +84,54 @@
|
||||||
} else {
|
} else {
|
||||||
throw 'missing OC.Share.ShareConfigModel';
|
throw 'missing OC.Share.ShareConfigModel';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var view = this;
|
||||||
|
this.model.on('change:shares', function() {
|
||||||
|
view.render();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
getCollectionObject: function(shareIndex) {
|
||||||
|
var type = this.model.getCollectionType(shareIndex);
|
||||||
|
var id = this.model.getCollectionPath(shareIndex);
|
||||||
|
if(type !== 'file' && type !== 'folder') {
|
||||||
|
id = this.model.getCollectionSource(shareIndex);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
collectionID: id,
|
||||||
|
text: t('core', 'Shared in {item} with {user}', {'item': id, user: this.model.getShareWithDisplayName(shareIndex)})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {OC.Share.Types.ShareInfo} shareInfo
|
||||||
|
* @returns {object}
|
||||||
|
*/
|
||||||
|
getShareeObject: function(shareIndex) {
|
||||||
|
var shareWith = this.model.getShareWith(shareIndex);
|
||||||
|
var shareWithDisplayName = this.model.getShareWithDisplayName(shareIndex);
|
||||||
|
var shareType = this.model.getShareType(shareIndex);
|
||||||
|
|
||||||
|
if (shareType === OC.Share.SHARE_TYPE_GROUP) {
|
||||||
|
shareWithDisplayName = shareWithDisplayName + " (" + t('core', 'group') + ')';
|
||||||
|
} else if (shareType === OC.Share.SHARE_TYPE_REMOTE) {
|
||||||
|
shareWithDisplayName = shareWithDisplayName + " (" + t('core', 'remote') + ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
hasSharePermission: this.model.hasSharePermission(shareIndex),
|
||||||
|
hasEditPermission: this.model.hasEditPermission(shareIndex),
|
||||||
|
hasCreatePermission: this.model.hasCreatePermission(shareIndex),
|
||||||
|
hasUpdatePermission: this.model.hasUpdatePermission(shareIndex),
|
||||||
|
hasDeletePermission: this.model.hasDeletePermission(shareIndex),
|
||||||
|
wasMailSent: this.model.notificationMailWasSent(shareIndex),
|
||||||
|
shareWith: shareWith,
|
||||||
|
shareWithDisplayName: shareWithDisplayName,
|
||||||
|
shareType: shareType,
|
||||||
|
modSeed: shareType !== OC.Share.SHARE_TYPE_USER
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
getShareeList: function() {
|
getShareeList: function() {
|
||||||
|
@ -69,23 +140,49 @@
|
||||||
mailPublicNotificationEnabled: this.configModel.isMailPublicNotificationEnabled(),
|
mailPublicNotificationEnabled: this.configModel.isMailPublicNotificationEnabled(),
|
||||||
notifyByMailLabel: t('core', 'notify by email'),
|
notifyByMailLabel: t('core', 'notify by email'),
|
||||||
unshareLabel: t('core', 'Unshare'),
|
unshareLabel: t('core', 'Unshare'),
|
||||||
unshareImage: OC.imagePath('core', 'actions/delete')
|
unshareImage: OC.imagePath('core', 'actions/delete'),
|
||||||
|
canShareLabel: t('core', 'can share'),
|
||||||
|
canEditLabel: t('core', 'can edit'),
|
||||||
|
createPermissionLabel: t('core', 'create'),
|
||||||
|
updatePermissionLabel: t('core', 'change'),
|
||||||
|
deletePermissionLabel: t('core', 'delete'),
|
||||||
|
crudsLabel: t('core', 'access control'),
|
||||||
|
triangleSImage: OC.imagePath('core', 'actions/triangle-s'),
|
||||||
|
isResharingAllowed: this.configModel.isResharingAllowed(),
|
||||||
|
sharePermissionPossible: this.model.sharePermissionPossible(),
|
||||||
|
editPermissionPossible: this.model.editPermissionPossible(),
|
||||||
|
createPermissionPossible: this.model.createPermissionPossible(),
|
||||||
|
updatePermissionPossible: this.model.updatePermissionPossible(),
|
||||||
|
deletePermissionPossible: this.model.deletePermissionPossible(),
|
||||||
|
sharePermission: OC.PERMISSION_SHARE,
|
||||||
|
createPermission: OC.PERMISSION_CREATE,
|
||||||
|
updatePermission: OC.PERMISSION_UPDATE,
|
||||||
|
deletePermission: OC.PERMISSION_DELETE
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: sharess must have following attributes
|
// TODO: sharess must have following attributes
|
||||||
// shareType
|
|
||||||
// shareWith
|
|
||||||
// shareWithDisplayName
|
|
||||||
// isRemoteShare
|
// isRemoteShare
|
||||||
// isMailSent
|
// isMailSent
|
||||||
|
|
||||||
var list = _.extend({}, universal);
|
if(!this.model.hasShares()) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
var list = [];
|
||||||
|
for(var index in this.model.get('shares')) {
|
||||||
|
if(this.model.isCollection(index)) {
|
||||||
|
list.unshift(this.getCollectionObject(index));
|
||||||
|
} else {
|
||||||
|
list.push(_.extend(this.getShareeObject(index), universal))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
var shareeListTemplate = this.template();
|
var shareeListTemplate = this.template();
|
||||||
|
var list = this.getShareeList();
|
||||||
this.$el.html(shareeListTemplate({
|
this.$el.html(shareeListTemplate({
|
||||||
sharees: this.getShareeList()
|
sharees: this.getShareeList()
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -63,6 +63,9 @@
|
||||||
/** @type {object} **/
|
/** @type {object} **/
|
||||||
expirationView: undefined,
|
expirationView: undefined,
|
||||||
|
|
||||||
|
/** @type {object} **/
|
||||||
|
shareeListView: undefined,
|
||||||
|
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
var view = this;
|
var view = this;
|
||||||
this.model.on('change', function() {
|
this.model.on('change', function() {
|
||||||
|
@ -118,11 +121,18 @@
|
||||||
this.expirationView.render();
|
this.expirationView.render();
|
||||||
|
|
||||||
this.shareeListView.$el = this.$el.find('.shareeListView');
|
this.shareeListView.$el = this.$el.find('.shareeListView');
|
||||||
this.shareeListView.redner();
|
this.shareeListView.render();
|
||||||
|
|
||||||
this.$el.find('.hasTooltip').tooltip();
|
this.$el.find('.hasTooltip').tooltip();
|
||||||
if(this.configModel.areAvatarsEnabled()) {
|
if(this.configModel.areAvatarsEnabled()) {
|
||||||
this.$el.find('.avatar').avatar(this.model.getReshareOwner, 32);
|
this.$el.find('.avatar').each(function() {
|
||||||
|
var $this = $(this);
|
||||||
|
$this.avatar($this.data('username'), 32);
|
||||||
|
});
|
||||||
|
this.$el.find('.avatar.imageplaceholderseed').each(function() {
|
||||||
|
var $this = $(this);
|
||||||
|
$this.imageplaceholder($this.data('seed'));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -14,6 +14,13 @@
|
||||||
OC.Share.Types = {};
|
OC.Share.Types = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} OC.Share.Types.Collection
|
||||||
|
* @property {string} item_type
|
||||||
|
* @property {string} path
|
||||||
|
* @property {string} item_source TODO: verify
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {object} OC.Share.Types.Reshare
|
* @typedef {object} OC.Share.Types.Reshare
|
||||||
* @property {string} uid_owner
|
* @property {string} uid_owner
|
||||||
|
@ -33,7 +40,7 @@
|
||||||
* @property {string} share_with
|
* @property {string} share_with
|
||||||
* @property {string} share_with_displayname
|
* @property {string} share_with_displayname
|
||||||
* @property {string} share_mail_send
|
* @property {string} share_mail_send
|
||||||
* @property {bool} collection //TODO: verify
|
* @property {OC.Share.Types.Collection|undefined} collection
|
||||||
* @property {Date} expiration optional?
|
* @property {Date} expiration optional?
|
||||||
* @property {number} stime optional?
|
* @property {number} stime optional?
|
||||||
*/
|
*/
|
||||||
|
@ -95,13 +102,79 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* whether this item has reshare information
|
* whether this item has share information
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
hasShares: function() {
|
hasShares: function() {
|
||||||
return _.isObject(this.get('shares'));
|
var shares = this.get('shares');
|
||||||
|
return _.isArray(this.get('shares'));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number} shareIndex
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
getCollectionType: function(shareIndex) {
|
||||||
|
/** @type OC.Share.Types.ShareInfo **/
|
||||||
|
var share = this.get('shares')[shareIndex];
|
||||||
|
if(!_.isObject(share)) {
|
||||||
|
throw "Unknown Share";
|
||||||
|
} else if(_.isUndefined(share.collection)) {
|
||||||
|
throw "Share is not a collection";
|
||||||
|
}
|
||||||
|
|
||||||
|
return share.collection.item_type;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number} shareIndex
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
getCollectionPath: function(shareIndex) {
|
||||||
|
/** @type OC.Share.Types.ShareInfo **/
|
||||||
|
var share = this.get('shares')[shareIndex];
|
||||||
|
if(!_.isObject(share)) {
|
||||||
|
throw "Unknown Share";
|
||||||
|
} else if(_.isUndefined(share.collection)) {
|
||||||
|
throw "Share is not a collection";
|
||||||
|
}
|
||||||
|
|
||||||
|
return share.collection.path;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number} shareIndex
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
getCollectionSource: function(shareIndex) {
|
||||||
|
/** @type OC.Share.Types.ShareInfo **/
|
||||||
|
var share = this.get('shares')[shareIndex];
|
||||||
|
if(!_.isObject(share)) {
|
||||||
|
throw "Unknown Share";
|
||||||
|
} else if(_.isUndefined(share.collection)) {
|
||||||
|
throw "Share is not a collection";
|
||||||
|
}
|
||||||
|
|
||||||
|
return share.collection.item_source;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number} shareIndex
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
isCollection: function(shareIndex) {
|
||||||
|
/** @type OC.Share.Types.ShareInfo **/
|
||||||
|
var share = this.get('shares')[shareIndex];
|
||||||
|
if(!_.isObject(share)) {
|
||||||
|
throw "Unknown Share";
|
||||||
|
}
|
||||||
|
if(_.isUndefined(share.collection)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
|
@ -132,19 +205,144 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {boolean}
|
* @param shareIndex
|
||||||
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
hasSharePermission: function() {
|
getShareWith: function(shareIndex) {
|
||||||
return (this.get('permissions') & OC.PERMISSION_SHARE) === OC.PERMISSION_SHARE;
|
/** @type OC.Share.Types.ShareInfo **/
|
||||||
|
var share = this.get('shares')[shareIndex];
|
||||||
|
if(!_.isObject(share)) {
|
||||||
|
throw "Unknown Share";
|
||||||
|
}
|
||||||
|
return share.share_with;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param shareIndex
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
getShareWithDisplayName: function(shareIndex) {
|
||||||
|
/** @type OC.Share.Types.ShareInfo **/
|
||||||
|
var share = this.get('shares')[shareIndex];
|
||||||
|
if(!_.isObject(share)) {
|
||||||
|
throw "Unknown Share";
|
||||||
|
}
|
||||||
|
return share.share_with_displayname;
|
||||||
|
},
|
||||||
|
|
||||||
|
getShareType: function(shareIndex) {
|
||||||
|
/** @type OC.Share.Types.ShareInfo **/
|
||||||
|
var share = this.get('shares')[shareIndex];
|
||||||
|
if(!_.isObject(share)) {
|
||||||
|
throw "Unknown Share";
|
||||||
|
}
|
||||||
|
return share.share_type;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* whether a share from shares has the requested permission
|
||||||
|
*
|
||||||
|
* @param {number} shareIndex
|
||||||
|
* @param {number} permission
|
||||||
|
* @returns {boolean}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_shareHasPermission: function(shareIndex, permission) {
|
||||||
|
/** @type OC.Share.Types.ShareInfo **/
|
||||||
|
var share = this.get('shares')[shareIndex];
|
||||||
|
if(!_.isObject(share)) {
|
||||||
|
throw "Unknown Share";
|
||||||
|
}
|
||||||
|
return (share.permissions & permission) === permission;
|
||||||
|
},
|
||||||
|
|
||||||
|
notificationMailWasSent: function(shareIndex) {
|
||||||
|
/** @type OC.Share.Types.ShareInfo **/
|
||||||
|
var share = this.get('shares')[shareIndex];
|
||||||
|
if(!_.isObject(share)) {
|
||||||
|
throw "Unknown Share";
|
||||||
|
}
|
||||||
|
return share.share_mail_send === '1';
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
hasCreatePermission: function() {
|
sharePermissionPossible: function() {
|
||||||
|
return (this.get('permissions') & OC.PERMISSION_SHARE) === OC.PERMISSION_SHARE;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number} shareIndex
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
hasSharePermission: function(shareIndex) {
|
||||||
|
return this._shareHasPermission(shareIndex, OC.PERMISSION_SHARE);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
createPermissionPossible: function() {
|
||||||
return (this.get('permissions') & OC.PERMISSION_CREATE) === OC.PERMISSION_CREATE;
|
return (this.get('permissions') & OC.PERMISSION_CREATE) === OC.PERMISSION_CREATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number} shareIndex
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
hasCreatePermission: function(shareIndex) {
|
||||||
|
return this._shareHasPermission(shareIndex, OC.PERMISSION_CREATE);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
updatePermissionPossible: function() {
|
||||||
|
return (this.get('permissions') & OC.PERMISSION_UPDATE) === OC.PERMISSION_UPDATE;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number} shareIndex
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
hasUpdatePermission: function(shareIndex) {
|
||||||
|
return this._shareHasPermission(shareIndex, OC.PERMISSION_UPDATE);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
deletePermissionPossible: function() {
|
||||||
|
return (this.get('permissions') & OC.PERMISSION_DELETE) === OC.PERMISSION_DELETE;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number} shareIndex
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
hasDeletePermission: function(shareIndex) {
|
||||||
|
return this._shareHasPermission(shareIndex, OC.PERMISSION_DELETE);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
editPermissionPossible: function() {
|
||||||
|
return this.createPermissionPossible()
|
||||||
|
|| this.updatePermissionPossible()
|
||||||
|
|| this.deletePermissionPossible();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
hasEditPermission: function(shareIndex) {
|
||||||
|
return this.hasCreatePermission(shareIndex)
|
||||||
|
|| this.hasUpdatePermission(shareIndex)
|
||||||
|
|| this.hasDeletePermission(shareIndex);
|
||||||
|
},
|
||||||
|
|
||||||
fetch: function() {
|
fetch: function() {
|
||||||
var model = this;
|
var model = this;
|
||||||
OC.Share.loadItem(this.get('itemType'), this.get('itemSource'), function(data) {
|
OC.Share.loadItem(this.get('itemType'), this.get('itemSource'), function(data) {
|
||||||
|
@ -159,6 +357,8 @@
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(data.shares);
|
||||||
|
|
||||||
var permissions = this.get('possiblePermissions');
|
var permissions = this.get('possiblePermissions');
|
||||||
if(!_.isUndefined(data.reshare) && !_.isUndefined(data.reshare.permissions)) {
|
if(!_.isUndefined(data.reshare) && !_.isUndefined(data.reshare.permissions)) {
|
||||||
permissions = permissions & data.reshare.permissions;
|
permissions = permissions & data.reshare.permissions;
|
||||||
|
@ -176,7 +376,7 @@
|
||||||
|
|
||||||
return {
|
return {
|
||||||
reshare: data.reshare,
|
reshare: data.reshare,
|
||||||
shares: data.shares,
|
shares: $.map(data.shares, function(value) { return [value]; }),
|
||||||
permissions: permissions,
|
permissions: permissions,
|
||||||
allowPublicUploadStatus: allowPublicUploadStatus
|
allowPublicUploadStatus: allowPublicUploadStatus
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue