X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=js%2Fkivi.File.js;h=a908114c56c3482db28bf7ad5523e4feccc91fd1;hb=da2f5aa8cea79ff0a3e1e5e88e74cbf7e9e79794;hp=4bf79ba77e154f909632a1c6c39e95427b67315c;hpb=33749625e16aae5386b5b59a45c9c0e987bd5b4e;p=kivitendo-erp.git
diff --git a/js/kivi.File.js b/js/kivi.File.js
index 4bf79ba77..a908114c5 100644
--- a/js/kivi.File.js
+++ b/js/kivi.File.js
@@ -1,66 +1,79 @@
namespace('kivi.File', function(ns) {
ns.rename = function(id,type,file_type,checkbox_class,is_global) {
+ var $dlg = $('#rename_dialog_'+file_type);
+ var parent_id = $dlg.parent("div.ui-tabs-panel").attr('id');
var checkboxes = $('.'+checkbox_class).filter(function () { return $(this).prop('checked'); });
if (checkboxes.size() === 0) {
- alert(kivi.t8("No file selected, please set one checkbox!"));
- return false;
- }
+ alert(kivi.t8("No file selected, please set one checkbox!"));
+ return false;
+ }
if (checkboxes.size() > 1) {
- alert(kivi.t8("More than one file selected, please set only one checkbox!"));
- return false;
- }
+ alert(kivi.t8("More than one file selected, please set only one checkbox!"));
+ return false;
+ }
var file_id = checkboxes[0].value;
- $('#newfilename_id').val($('#filename_'+file_id).text());
- $('#next_ids_id').val('');
- $('#is_global_id').val(is_global);
- $('#rename_id_id').val(file_id);
- $('#sessionfile_id').val('');
- $('#rename_extra_text').html('');
+ $('#newfilename_id_'+file_type).val($('#filename_'+file_id).text());
+ $('#next_ids_id_'+file_type).val('');
+ $('#is_global_id_'+file_type).val(is_global);
+ $('#rename_id_id_'+file_type).val(file_id);
+ $('#sessionfile_id_'+file_type).val('');
+ $('#rename_extra_text_'+file_type).html('');
kivi.popup_dialog({
- id: 'rename_dialog',
+ id: 'rename_dialog_'+file_type,
dialog: { title: kivi.t8("Rename attachment")
, width: 400
, height: 200
- , modal: true } });
+ , modal: true
+ , close: function() {
+ $dlg.remove().appendTo('#' + parent_id);
+ }
+ }
+ });
return true;
}
- ns.renameclose = function() {
- $("#rename_dialog").dialog('close');
+ ns.renameclose = function(file_type) {
+ $("#rename_dialog_"+file_type).dialog('close');
return false;
}
- ns.renameaction = function() {
- $("#rename_dialog").dialog('close');
+ ns.renameaction = function(file_type) {
+ $("#rename_dialog_"+file_type).dialog('close');
var data = {
action: 'File/ajax_rename',
- id: $('#rename_id_id').val(),
- to: $('#newfilename_id').val(),
- next_ids: $('#next_ids_id').val(),
- is_global: $('#is_global_id').val(),
- sessionfile: $('#sessionfile_id').val(),
+ id: $('#rename_id_id_'+file_type).val(),
+ to: $('#newfilename_id_'+file_type).val(),
+ next_ids: $('#next_ids_id_'+file_type).val(),
+ is_global: $('#is_global_id_'+file_type).val(),
+ sessionfile: $('#sessionfile_id_'+file_type).val(),
};
$.post("controller.pl", data, kivi.eval_json_result);
return true;
}
- ns.askForRename = function(file_id,file_name,sessionfile,next_ids,is_global) {
- $('#newfilename_id').val(file_name);
- $('#rename_id_id').val(file_id);
- $('#is_global_id').val(is_global);
- $('#next_ids_id').val(next_ids);
- $('#sessionfile_id').val(sessionfile);
- $('#rename_extra_text').html(kivi.t8("The uploaded filename still exists.
If you not modify the name this is a new version of the file"));
+ ns.askForRename = function(file_id,file_type,file_name,sessionfile,next_ids,is_global) {
+ $('#newfilename_id_'+file_type).val(file_name);
+ $('#rename_id_id_'+file_type).val(file_id);
+ $('#is_global_id_'+file_type).val(is_global);
+ $('#next_ids_id_'+file_type).val(next_ids);
+ $('#sessionfile_id_'+file_type).val(sessionfile);
+ $('#rename_extra_text_'+file_type).html(kivi.t8("The uploaded filename still exists.
If you not modify the name this is a new version of the file"));
+ var $dlg = $('#rename_dialog_'+file_type);
+ var parent_id = $dlg.parent("div.ui-tabs-panel").attr('id');
kivi.popup_dialog(
{
- id: 'rename_dialog',
+ id: 'rename_dialog_'+file_type,
dialog: { title: kivi.t8("Rename attachment")
, width: 400
, height: 200
- , modal: true }
- });
+ , modal: true
+ , close: function() {
+ $dlg.remove().appendTo('#' + parent_id);
+ } }
+ }
+ );
}
ns.upload = function(id,type,filetype,upload_title,gl) {
@@ -164,6 +177,12 @@ namespace('kivi.File', function(ns) {
return false;
}
+ ns.delete_file = function(id,controller_action) {
+ $.post('controller.pl', { action: controller_action, id: id }, function(data) {
+ kivi.eval_json_result(data);
+ });
+ };
+
ns.unimport = function(id,type,file_type,checkbox_class) {
var checkboxes = $('.'+checkbox_class).filter(function () { return $(this).prop('checked'); });
@@ -209,20 +228,20 @@ namespace('kivi.File', function(ns) {
});
return true;
}
-
+
ns.importclose = function() {
$("#import_dialog").dialog('close');
return false;
}
-
+
ns.importaction = function(id,type,file_type,fromwhere,frompath,checkbox_class) {
var checkboxes = $('.'+checkbox_class).filter(function () { return $(this).prop('checked'); });
- $("#import_dialog").dialog('close');
+ $("#import_dialog").dialog('close');
if (checkboxes.size() === 0) {
- return false;
- }
- var data = {
+ return false;
+ }
+ var data = {
action : 'File/ajax_import',
object_id : id,
object_type: type,
@@ -236,7 +255,7 @@ namespace('kivi.File', function(ns) {
}
ns.downloadOrderitemsFiles = function(type,id) {
- var data = {
+ var data = {
action: 'DownloadZip/download_orderitems_files',
object_type: type,
object_id: id,