ask only a single time for multiple files and break on other errors, as they reset the selected files anyway

This commit is contained in:
Ralf Becker 2011-07-01 08:08:34 +00:00
parent ac78b77180
commit e45589feea

View File

@ -475,6 +475,7 @@ function check_files(upload)
//$response->addAlert(__METHOD__."('$id',".array2string($name).",'$dir')");
$ask_overwrite = array();
foreach((array)$names as $name)
{
$name = explode('/',str_replace('\\','/',$name)); // in case of win clients
@ -487,6 +488,8 @@ function check_files(upload)
{
$response->addAlert(lang('You are NOT allowed to upload a script!'));
$response->addScript("document.getElementById('$id').value='';");
$ask_overwrite = array();
break;
}
elseif (egw_vfs::stat($path))
{
@ -494,10 +497,12 @@ function check_files(upload)
{
$response->addAlert(lang("There's already a directory with that name!"));
$response->addScript("document.getElementById('$id').value='';");
$ask_overwrite = array();
break;
}
else
{
$response->addScript("if (!confirm('".addslashes(lang('Do you want to overwrite the existing file %1?',egw_vfs::decodePath($path)))."')) document.getElementById('$id').value='';");
$ask_overwrite[] = egw_vfs::decodePath($path);
}
}
else
@ -505,6 +510,10 @@ function check_files(upload)
// do nothing new file
}
}
if ($ask_overwrite)
{
$response->addScript("if (!confirm('".addslashes(lang('Do you want to overwrite the existing file %1?',implode(', ',$ask_overwrite)))."')) document.getElementById('$id').value='';");
}
return $response->getXML();
}