plugin updates
This commit is contained in:
@@ -181,6 +181,39 @@ var wpmfFoldersModule = void 0,
|
||||
$('.page-title-action').after('<a href="#" class="wpmf_btn_upload_folder">' + wpmf.l18n.upload_folder_label + '</a><input name="id_category" class="wpmf_id_category" type="hidden" value="0">');
|
||||
}
|
||||
|
||||
// Download file table list media
|
||||
$('.wp-list-table .download').off('click').on('click', function (e){
|
||||
e.preventDefault();
|
||||
var post_id = $(this).parent().parent().parent().attr('id');
|
||||
if (post_id) {
|
||||
var post_id_array = post_id.split("-");
|
||||
if (Array.isArray(post_id_array)) {
|
||||
let id = post_id_array.pop();
|
||||
if (id) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: wpmf.vars.ajaxurl,
|
||||
data: {
|
||||
action: "wpmf",
|
||||
task: "wpmf_download_file",
|
||||
id: id,
|
||||
wpmf_nonce: wpmf.vars.wpmf_nonce
|
||||
},
|
||||
success: function success(response) {
|
||||
if (response.status) {
|
||||
window.location.href = wpmf.vars.site_url + '?act=wpmf_download_file&id=' + id + '&wpmf_nonce=' + wpmf.vars.wpmf_nonce;
|
||||
} else {
|
||||
showDialog({
|
||||
text: wpmf.l18n.cannot_download,
|
||||
closeicon: true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
//Select tag for media
|
||||
$('#doaction').on('click', function (e) {
|
||||
var action = $('#bulk-action-selector-top').val();
|
||||
@@ -512,17 +545,24 @@ var wpmfFoldersModule = void 0,
|
||||
var upload_type = 'file';
|
||||
$.extend(wp.Uploader.prototype, {
|
||||
init: function init() {
|
||||
// Add the current wpmf folder to the request
|
||||
this.uploader.bind('BeforeUpload', function (t, e) {
|
||||
e.wpmf_folder = typeof e.wpmf_folder !== "undefined" ? e.wpmf_folder : wpmfFoldersModule.last_selected_folder;
|
||||
t.settings.multipart_params.wpmf_folder = e.wpmf_folder;
|
||||
var file = e.getSource();
|
||||
delete this.settings.multipart_params['relativePath'];
|
||||
if (file.relativePath !== '') {
|
||||
this.settings.multipart_params['relativePath'] = file.relativePath;
|
||||
upload_type = 'folder';
|
||||
}
|
||||
});
|
||||
var this_url = document.URL;
|
||||
if (this_url.indexOf('media-new.php') < 0) {
|
||||
// Add the current wpmf folder to the request
|
||||
this.uploader.bind('BeforeUpload', function(up, e) {
|
||||
e.wpmf_folder = typeof e.wpmf_folder !== "undefined" ? e.wpmf_folder : wpmfFoldersModule.last_selected_folder;
|
||||
var file = e.getSource();
|
||||
delete this.settings.multipart_params['relativePath'];
|
||||
if (file.relativePath !== '') {
|
||||
this.settings.multipart_params['relativePath'] = file.relativePath;
|
||||
upload_type = 'folder';
|
||||
}
|
||||
var multipart_params = up.settings.multipart_params;
|
||||
multipart_params['wpmf_nonce'] = wpmf.vars.wpmf_nonce;
|
||||
multipart_params['no_move'] = 1;
|
||||
multipart_params['wpmf_folder'] = e.wpmf_folder;
|
||||
up.settings.multipart_params = multipart_params;
|
||||
});
|
||||
}
|
||||
|
||||
this.uploader.bind('FilesAdded', function (up, files) {
|
||||
wpmfFoldersModule.added_files_length = parseInt(wpmfFoldersModule.added_files_length) + files.length;
|
||||
@@ -1976,7 +2016,26 @@ var wpmfFoldersModule = void 0,
|
||||
$('.material_downloadfile').off('click').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var id = $(this).data('id');
|
||||
window.location.href = wpmf.vars.site_url + '?act=wpmf_download_file&id=' + id + '&wpmf_nonce=' + wpmf.vars.wpmf_nonce;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: wpmf.vars.ajaxurl,
|
||||
data: {
|
||||
action: "wpmf",
|
||||
task: "wpmf_download_file",
|
||||
id: id,
|
||||
wpmf_nonce: wpmf.vars.wpmf_nonce
|
||||
},
|
||||
success: function success(response) {
|
||||
if (response.status) {
|
||||
window.location.href = wpmf.vars.site_url + '?act=wpmf_download_file&id=' + id + '&wpmf_nonce=' + wpmf.vars.wpmf_nonce;
|
||||
} else {
|
||||
showDialog({
|
||||
text: wpmf.l18n.cannot_download,
|
||||
closeicon: true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.material_overridefile').off('click').on('click', function (e) {
|
||||
|
||||
Reference in New Issue
Block a user