From cf88987c52bed0ef957d53c64add486294c4e552 Mon Sep 17 00:00:00 2001 From: hystepik Date: Wed, 22 Mar 2023 16:24:46 +0100 Subject: [PATCH] add of seteventmessages --- htdocs/core/lib/files.lib.php | 7 +++++-- htdocs/langs/en_US/main.lang | 2 ++ htdocs/main.inc.php | 9 ++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index ae2a6493028..3c19ef11528 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3383,9 +3383,12 @@ function dragAndDropFileUpload($htmlname) data:fd, success:function(){ console.log("Uploaded.",arguments); - window.location.href = "'.$_SERVER["PHP_SELF"].'?id='.dol_escape_json($object->id).'"; + window.location.href = "'.$_SERVER["PHP_SELF"].'?id='.dol_escape_json($object->id).'&seteventmessages=uploadFileDragDropSuccess:mesgs"; + }, + error:function(){ + console.log("Error Uploading.",arguments) + window.location.href = "'.$_SERVER["PHP_SELF"].'?id='.dol_escape_json($object->id).'&seteventmessages=uploadFileDragDropError:errors"; }, - error:function(){ console.log("Error Uploading.",arguments) }, }) }); }); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index a8d96c77f6f..9952a9b2ad6 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1228,3 +1228,5 @@ PublicVirtualCardUrl=Virtual business card page URL PublicVirtualCard=Virtual business card TreeView=Tree view DropFileToAddItToObject=Drop a file to add it to this object +uploadFileDragDropSuccess=The file(s) have been uploaded successfully +uploadFileDragDropError=There was an error while the file(s) upload diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2ba86f7d319..b77f7fbf403 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1388,7 +1388,14 @@ if (!defined('NOREQUIREMENU')) { $menumanager->loadMenu(); } - +if (!empty(GETPOST('seteventmessages', 'alpha'))) { + $message = GETPOST('seteventmessages', 'alpha'); + $messages = explode(',', $message); + foreach ($messages as $key => $msg) { + $tmp = explode(':', $msg); + setEventMessages($tmp[0], null, !empty($tmp[1]) ? $tmp[1] : 'mesgs'); + } +} // Functions