Allow to hide download option for folders shared by link
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
1bf742c462
commit
fb8aa31dbf
|
@ -362,15 +362,17 @@
|
||||||
// remove previous
|
// remove previous
|
||||||
$tr.find('.action-menu').remove();
|
$tr.find('.action-menu').remove();
|
||||||
|
|
||||||
var $el = this._renderInlineAction({
|
if (this.actions.length > 0) {
|
||||||
name: 'menu',
|
var $el = this._renderInlineAction({
|
||||||
displayName: '',
|
name: 'menu',
|
||||||
iconClass: 'icon-more',
|
displayName: '',
|
||||||
altText: t('files', 'Actions'),
|
iconClass: 'icon-more',
|
||||||
action: this._showMenuClosure
|
altText: t('files', 'Actions'),
|
||||||
}, false, context);
|
action: this._showMenuClosure
|
||||||
|
}, false, context);
|
||||||
|
|
||||||
$el.addClass('permanent');
|
$el.addClass('permanent');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -50,6 +50,8 @@ OCA.Sharing.PublicApp = {
|
||||||
this.initialDir = $('#dir').val();
|
this.initialDir = $('#dir').val();
|
||||||
|
|
||||||
var token = $('#sharingToken').val();
|
var token = $('#sharingToken').val();
|
||||||
|
var hideDownload = $('#hideDownload').val();
|
||||||
|
|
||||||
|
|
||||||
// file list mode ?
|
// file list mode ?
|
||||||
if ($el.find('#filestable').length) {
|
if ($el.find('#filestable').length) {
|
||||||
|
@ -92,6 +94,9 @@ OCA.Sharing.PublicApp = {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
if (hideDownload === 'true') {
|
||||||
|
this.fileList._allowSelection = false;
|
||||||
|
}
|
||||||
this.files = OCA.Files.Files;
|
this.files = OCA.Files.Files;
|
||||||
this.files.initialize();
|
this.files.initialize();
|
||||||
// TODO: move to PublicFileList.initialize() once
|
// TODO: move to PublicFileList.initialize() once
|
||||||
|
@ -192,6 +197,27 @@ OCA.Sharing.PublicApp = {
|
||||||
return OC.generateUrl('/s/' + token + '/download') + '?' + OC.buildQueryString(params);
|
return OC.generateUrl('/s/' + token + '/download') + '?' + OC.buildQueryString(params);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.fileList._createRow = function(fileData) {
|
||||||
|
var $tr = OCA.Files.FileList.prototype._createRow.apply(this, arguments);
|
||||||
|
if (hideDownload === 'true') {
|
||||||
|
this.fileActions.currentFile = $tr.find('td');
|
||||||
|
var mime = this.fileActions.getCurrentMimeType();
|
||||||
|
var type = this.fileActions.getCurrentType();
|
||||||
|
var permissions = this.fileActions.getCurrentPermissions();
|
||||||
|
var action = this.fileActions.getDefault(mime, type, permissions);
|
||||||
|
if (action) {
|
||||||
|
// remove link href if there is a default action configured (disables downloading when trying to open in a new tab)
|
||||||
|
$tr.find('a.name').attr('href', '#');
|
||||||
|
}
|
||||||
|
delete this.fileActions.actions.all.Download;
|
||||||
|
}
|
||||||
|
return $tr;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.fileList.isSelectedDownloadable = function () {
|
||||||
|
return hideDownload !== 'true';
|
||||||
|
};
|
||||||
|
|
||||||
this.fileList.getUploadUrl = function(fileName, dir) {
|
this.fileList.getUploadUrl = function(fileName, dir) {
|
||||||
if (_.isUndefined(dir)) {
|
if (_.isUndefined(dir)) {
|
||||||
dir = this.getCurrentDirectory();
|
dir = this.getCurrentDirectory();
|
||||||
|
@ -270,6 +296,10 @@ OCA.Sharing.PublicApp = {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
OC.redirect(FileList.getDownloadUrl());
|
OC.redirect(FileList.getDownloadUrl());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (hideDownload === 'true') {
|
||||||
|
this.fileList.$el.find('#headerSelection').remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('click', '#directLink', function () {
|
$(document).on('click', '#directLink', function () {
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if showHideDownloadCheckbox}}
|
|
||||||
<li>
|
<li>
|
||||||
<span class="menuitem">
|
<span class="menuitem">
|
||||||
<span class="icon-loading-small hidden"></span>
|
<span class="icon-loading-small hidden"></span>
|
||||||
|
@ -46,7 +45,6 @@
|
||||||
<label for="sharingDialogHideDownload-{{cid}}">{{hideDownloadLabel}}</label>
|
<label for="sharingDialogHideDownload-{{cid}}">{{hideDownloadLabel}}</label>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
|
||||||
{{#if showPasswordCheckBox}}
|
{{#if showPasswordCheckBox}}
|
||||||
<li>
|
<li>
|
||||||
<span class="menuitem">
|
<span class="menuitem">
|
||||||
|
|
|
@ -868,7 +868,6 @@
|
||||||
var isTalkEnabled = oc_appswebroots['spreed'] !== undefined;
|
var isTalkEnabled = oc_appswebroots['spreed'] !== undefined;
|
||||||
var sendPasswordByTalk = share.sendPasswordByTalk;
|
var sendPasswordByTalk = share.sendPasswordByTalk;
|
||||||
|
|
||||||
var showHideDownloadCheckbox = !this.model.isFolder();
|
|
||||||
var hideDownload = share.hideDownload;
|
var hideDownload = share.hideDownload;
|
||||||
|
|
||||||
var maxDate = null;
|
var maxDate = null;
|
||||||
|
@ -905,7 +904,6 @@
|
||||||
shareNote: share.note,
|
shareNote: share.note,
|
||||||
hasNote: share.note !== '',
|
hasNote: share.note !== '',
|
||||||
maxDate: maxDate,
|
maxDate: maxDate,
|
||||||
showHideDownloadCheckbox: showHideDownloadCheckbox,
|
|
||||||
hideDownload: hideDownload,
|
hideDownload: hideDownload,
|
||||||
isExpirationEnforced: isExpirationEnforced,
|
isExpirationEnforced: isExpirationEnforced,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue