Parcourir la source

add of seteventmessages

hystepik il y a 2 ans
Parent
commit
cf88987c52
3 fichiers modifiés avec 15 ajouts et 3 suppressions
  1. 5 2
      htdocs/core/lib/files.lib.php
  2. 2 0
      htdocs/langs/en_US/main.lang
  3. 8 1
      htdocs/main.inc.php

+ 5 - 2
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) },
 				})
 			});
 		});

+ 2 - 0
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

+ 8 - 1
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