mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 15:38:15 +00:00
[share link] modification about permissions
This commit is contained in:
@@ -110,7 +110,7 @@ define([
|
||||
clickCheckbox: function(e) {
|
||||
var $el = $(e.currentTarget);
|
||||
// for link options such as 'password', 'expire'
|
||||
$el.closest('.checkbox-label').next().toggleClass('hide');
|
||||
$el.closest('.checkbox-label').next('div').toggleClass('hide');
|
||||
},
|
||||
|
||||
downloadLinkPanelInit: function() {
|
||||
@@ -217,6 +217,11 @@ define([
|
||||
if (link_type == 'download') {
|
||||
var set_expiration_checkbox = $('[name="set_expiration"]', form),
|
||||
set_expiration = set_expiration_checkbox.prop('checked');
|
||||
|
||||
if (app.pageOptions.is_pro) {
|
||||
var $preview_only = $('[name="preview_only"]', form);
|
||||
var preview_only = $preview_only.prop('checked');
|
||||
}
|
||||
}
|
||||
var post_data = {};
|
||||
|
||||
@@ -244,7 +249,7 @@ define([
|
||||
post_data["password"] = passwd;
|
||||
}
|
||||
|
||||
if (set_expiration) { // for upload link, 'set_expiration' is undefined
|
||||
if (link_type == 'download' && set_expiration) {
|
||||
var expire_days_input = $('[name="expire_days"]', form),
|
||||
expire_days = $.trim(expire_days_input.val());
|
||||
if (!expire_days) {
|
||||
@@ -258,6 +263,13 @@ define([
|
||||
post_data["expire_days"] = expire_days;
|
||||
}
|
||||
|
||||
if (link_type == 'download' && preview_only) {
|
||||
post_data["permissions"] = JSON.stringify({
|
||||
"can_preview": true,
|
||||
"can_download": false
|
||||
});
|
||||
}
|
||||
|
||||
$('.error', form).addClass('hide').html('');
|
||||
var gen_btn = $('[type="submit"]', form);
|
||||
Common.disableButton(gen_btn);
|
||||
@@ -280,7 +292,7 @@ define([
|
||||
passwd_input.val('');
|
||||
passwd_again_input.val('');
|
||||
}
|
||||
if (set_expiration) {
|
||||
if (link_type == 'download' && set_expiration) {
|
||||
set_expiration_checkbox.prop('checked', false)
|
||||
.parent().removeClass('checkbox-checked')
|
||||
// hide 'day' input
|
||||
@@ -288,6 +300,10 @@ define([
|
||||
expire_days_input.val('');
|
||||
}
|
||||
|
||||
if (link_type == 'download' && preview_only) {
|
||||
$preview_only.prop('checked', false);
|
||||
}
|
||||
|
||||
if (link_type == 'download') {
|
||||
_this.$('#download-link').html(data["link"]); // TODO: add 'click & select' func
|
||||
_this.$('#direct-dl-link').html(data['link'] + '?dl=1');
|
||||
|
Reference in New Issue
Block a user