}
ns.allow_upload_submit = function() {
- $('#upload_selected_button').prop('disabled',$('#upload_files').val() === '');
+ const disable = $('#upload_files').val() === '';
+ $('#upload_selected_button').prop('disabled', disable)
+ .toggleClass('disabled', disable);
}
ns.upload_status_dialog = function() {
$('.thumbnail').on('mouseover', ns.add_enlarged_thumbnail);
};
+ ns.download = function(e) {
+ var file_id = $(e.target).data('file-id');
+ var file_version = $(e.target).data('file-version');
+
+ var data = {
+ action: 'File/download',
+ id: file_id,
+ version: file_version,
+ };
+
+ $.post("controller.pl", data, kivi.eval_json_result);
+
+ };
+
ns.init = function() {
// Preventing page from redirecting
$("#" + ns.list_div_id).on("dragover", function(e) {
});
$('.thumbnail').on('mouseover', ns.add_enlarged_thumbnail);
- $('.overlay_img').on('click', ns.remove_enlarged_thumbnail);
$('.overlay_img').on('mouseout', ns.remove_enlarged_thumbnail);
+ $('.overlay_div img').on('click', ns.download);
+ };
+
+ ns.doc_tab_init = function(tabs_id, doc_tab_id, id, object_type) {
+ var url = 'controller.pl?action=File/list&file_type=document&object_type=' + object_type + '&object_id=' + $('#id').val();
+
+ $('#' + tabs_id).on('tabsbeforeactivate', function(e, ui) {
+ if (ui.newPanel.attr('id') !== doc_tab_id) return;
+ $('#' + doc_tab_id).html(kivi.t8('Loading...'));
+ $('#' + doc_tab_id).load(url);
+ });
+
+ $('#' + tabs_id).on('tabscreate', function(e, ui) {
+ if (ui.panel.attr('id') !== doc_tab_id) return;
+ $('#' + doc_tab_id).html(kivi.t8('Loading...'));
+ $('#' + doc_tab_id).load(url);
+ });
};
});