mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 08:53:37 +01:00
file upload report problem back to client-side, not just "server error"
This commit is contained in:
parent
fb217d308c
commit
2ebc995ee2
@ -1029,6 +1029,20 @@ class Widget
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a validation error, to be displayed in the next exec
|
||||||
|
*
|
||||||
|
* @param string $name (complete) name of the widget causing the error
|
||||||
|
* @param string $cname =null set it to '', if the name is already a form-name, defaults to self::$name_vars
|
||||||
|
* @return string|null error-message already translated or null if there's none for the given $name
|
||||||
|
*/
|
||||||
|
public static function get_validation_errors($name, $cname=null)
|
||||||
|
{
|
||||||
|
if ($cname) $name = self::form_name($cname,$name);
|
||||||
|
|
||||||
|
return self::$validation_errors[$name] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if we have not ignored validation errors
|
* Check if we have not ignored validation errors
|
||||||
*
|
*
|
||||||
|
@ -118,6 +118,7 @@ class File extends Etemplate\Widget
|
|||||||
{
|
{
|
||||||
$widget = $template->getElementById($matches[1].':$cont[id]:'.$matches[3]);
|
$widget = $template->getElementById($matches[1].':$cont[id]:'.$matches[3]);
|
||||||
}
|
}
|
||||||
|
$mime = null;
|
||||||
if($widget && $widget->attrs['mime'])
|
if($widget && $widget->attrs['mime'])
|
||||||
{
|
{
|
||||||
$mime = $widget->attrs['mime'];
|
$mime = $widget->attrs['mime'];
|
||||||
|
@ -145,7 +145,7 @@ class Vfs extends File
|
|||||||
protected static function process_uploaded_file($field, Array &$file, $mime, Array &$file_data)
|
protected static function process_uploaded_file($field, Array &$file, $mime, Array &$file_data)
|
||||||
{
|
{
|
||||||
parent::process_uploaded_file($field, $file, $mime, $file_data);
|
parent::process_uploaded_file($field, $file, $mime, $file_data);
|
||||||
$path = self::store_file($_REQUEST['path'] ? $_REQUEST['path'] : $_REQUEST['widget_id'], $file);
|
$path = self::store_file($_REQUEST['path'] ?: $_REQUEST['widget_id'], $file);
|
||||||
if($path)
|
if($path)
|
||||||
{
|
{
|
||||||
$file_data[basename($file['tmp_name'])]['name'] = $file['name'];
|
$file_data[basename($file['tmp_name'])]['name'] = $file['name'];
|
||||||
@ -156,7 +156,7 @@ class Vfs extends File
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Something happened with the VFS
|
// Something happened with the VFS
|
||||||
$file_data[basename($file['tmp_name'])] = lang('Server error');
|
$file_data[basename($file['tmp_name'])] = self::get_validation_errors($_REQUEST['widget_id']) ?? lang('Server error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user