mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 16:03:47 +01:00
File upload bugfixes:
- Javascript error uploading files with ' in their name - uploading the same file twice to a customfield did not show the file uploaded properly
This commit is contained in:
parent
163b6b6522
commit
6b294db3fc
@ -551,7 +551,7 @@ var et2_file = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
if(this.progress)
|
||||
{
|
||||
var fileName = file.fileName || 'file';
|
||||
var status = jQuery("<li data-file='"+fileName+"'>"+fileName
|
||||
var status = jQuery("<li data-file='"+fileName.replace(/'/g, '"')+"'>"+fileName
|
||||
+"<div class='remove'/><span class='progressBar'><p/></span></li>")
|
||||
.appendTo(this.progress);
|
||||
jQuery("div.remove",status).on('click', file, jQuery.proxy(this.cancel,this));
|
||||
@ -568,7 +568,7 @@ var et2_file = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
_fileProgress: function(file) {
|
||||
if(this.progress)
|
||||
{
|
||||
jQuery("li[data-file='"+file.fileName+"'] > span.progressBar > p").css("width", Math.ceil(file.progress()*100)+"%");
|
||||
jQuery("li[data-file='"+file.fileName.replace(/'/g, '"')+"'] > span.progressBar > p").css("width", Math.ceil(file.progress()*100)+"%");
|
||||
|
||||
}
|
||||
return true;
|
||||
@ -594,7 +594,7 @@ var et2_file = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
if(typeof response.response[0].data[key] == "string")
|
||||
{
|
||||
// Message from server - probably error
|
||||
jQuery("[data-file='"+name+"']",this.progress)
|
||||
jQuery("[data-file='"+name.replace(/'/g, '"')+"']",this.progress)
|
||||
.addClass("error")
|
||||
.css("display", "block")
|
||||
.text(response.response[0].data[key]);
|
||||
@ -609,14 +609,14 @@ var et2_file = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
}
|
||||
if(this.progress)
|
||||
{
|
||||
jQuery("[data-file='"+name+"']",this.progress).addClass("message success");
|
||||
jQuery("[data-file='"+name.replace(/'/g, '"')+"']",this.progress).addClass("message success");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this.progress)
|
||||
{
|
||||
jQuery("[data-file='"+name+"']",this.progress)
|
||||
jQuery("[data-file='"+name.replace(/'/g, '"')+"']",this.progress)
|
||||
.addClass("ui-state-error")
|
||||
.css("display", "block")
|
||||
.text(this.egw().lang("Server error"));
|
||||
@ -650,7 +650,7 @@ var et2_file = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
if(this.options.value[key].name == file.fileName)
|
||||
{
|
||||
delete this.options.value[key];
|
||||
jQuery('[data-file="'+file.fileName+'"]',this.node).remove();
|
||||
jQuery('[data-file="'+file.fileName.replace(/'/g, '"')+'"]',this.node).remove();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ var et2_link_to = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
id: file,
|
||||
name: self.file_upload.options.value[file].name,
|
||||
type: self.file_upload.options.value[file].type,
|
||||
remark: jQuery("li[file='"+self.file_upload.options.value[file].name+"'] > input", self.file_upload.progress)
|
||||
remark: jQuery("li[file='"+self.file_upload.options.value[file].name.replace(/'/g, '"')+"'] > input", self.file_upload.progress)
|
||||
.filter(function() { return jQuery(this).attr("placeholder") != jQuery(this).val();}).val()
|
||||
});
|
||||
}
|
||||
|
@ -722,7 +722,7 @@ var et2_vfsUpload = (function(){ "use strict"; return et2_file.extend(
|
||||
if(sender !== this && sender._type.indexOf('vfs') >= 0 )
|
||||
{
|
||||
var value = sender.getValue && sender.getValue() || sender.options.value || {};
|
||||
var row = jQuery('[data-path="'+(value.path)+'"]',this.list);
|
||||
var row = jQuery("[data-path='"+(value.path.replace(/'/g, '"'))+"']",this.list);
|
||||
if(sender._type === 'vfs-mime')
|
||||
{
|
||||
return jQuery('.icon',row).get(0) || null;
|
||||
@ -765,7 +765,7 @@ var et2_vfsUpload = (function(){ "use strict"; return et2_file.extend(
|
||||
if(value && value.path)
|
||||
{
|
||||
this._addFile(value);
|
||||
jQuery("[data-file='"+file.fileName+"']",this.progress).hide();
|
||||
jQuery("[data-file='"+file.fileName.replace(/'/g, '"')+"']",this.progress).hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -773,8 +773,20 @@ var et2_vfsUpload = (function(){ "use strict"; return et2_file.extend(
|
||||
},
|
||||
|
||||
_addFile: function(file_data) {
|
||||
if(jQuery("[data-path='"+file_data.path.replace(/'/g, '"')+"']").remove().length)
|
||||
{
|
||||
for(var child_index = this._children.length-1; child_index >= 0; child_index--)
|
||||
{
|
||||
var child = this._children[child_index];
|
||||
if(child.options.value.path === file_data.path)
|
||||
{
|
||||
this.removeChild(child);
|
||||
child.free();
|
||||
}
|
||||
}
|
||||
}
|
||||
var row = jQuery(document.createElement("tr"))
|
||||
.attr("data-path", file_data.path)
|
||||
.attr("data-path", file_data.path.replace(/'/g, '"'))
|
||||
.attr("draggable", "true")
|
||||
.appendTo(this.list);
|
||||
var mime = jQuery(document.createElement("td"))
|
||||
@ -813,7 +825,7 @@ var et2_vfsUpload = (function(){ "use strict"; return et2_file.extend(
|
||||
{
|
||||
egw.json("filemanager_ui::ajax_action", [
|
||||
'delete',
|
||||
[row.attr('data-path')],
|
||||
[row.attr('data-path').replace(/"/g, "'")],
|
||||
''
|
||||
],
|
||||
function(data) {
|
||||
|
Loading…
Reference in New Issue
Block a user