X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=js%2Fkivi.File.js;h=a908114c56c3482db28bf7ad5523e4feccc91fd1;hb=cecc0509e2a2abeaca123ab95a2364eb98d0a380;hp=68ef7ac526f2d6a04d165cc5e7ef6421f33958f5;hpb=65922b0d6c4a14e29354f65c60dea2176d10f941;p=kivitendo-erp.git
diff --git a/js/kivi.File.js b/js/kivi.File.js
index 68ef7ac52..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) {
@@ -103,7 +116,7 @@ namespace('kivi.File', function(ns) {
}
catch(err2) { fname ='';}
$("#upload_result").html(kivi.t8("filename has not uploadable characters ")+fname);
- return;
+ return;
}
}
if ( filesize > maxsize ) {
@@ -149,7 +162,7 @@ namespace('kivi.File', function(ns) {
ns.delete = function(id,type,file_type,checkbox_class,is_global) {
var checkboxes = $('.'+checkbox_class).filter(function () { return $(this).prop('checked'); });
- if ((checkboxes.size() === 0) ||
+ if ((checkboxes.size() === 0) ||
!confirm(kivi.t8('Do you really want to delete the selected documents?')))
return false;
var data = {
@@ -164,10 +177,16 @@ 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'); });
- if ((checkboxes.size() === 0) ||
+ if ((checkboxes.size() === 0) ||
!confirm(kivi.t8('Do you really want to unimport the selected documents?')))
return false;
var data = {
@@ -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,
@@ -247,7 +266,6 @@ namespace('kivi.File', function(ns) {
return false;
}
-
ns.init = function() {
}