From ff6d7e11fa876677ea935ccdb401b902ac6c128d Mon Sep 17 00:00:00 2001
From: Odran PHILIBERT <odran30@gmail.com>
Date: Thu, 27 Apr 2017 15:59:28 +0200
Subject: [PATCH] Modification en JQuery pour le module Note

---
 modules/notes/js/functions.js | 68 ++++++++++++++++++-----------------
 1 file changed, 36 insertions(+), 32 deletions(-)

diff --git a/modules/notes/js/functions.js b/modules/notes/js/functions.js
index d4685a3b4e5..9756460e278 100644
--- a/modules/notes/js/functions.js
+++ b/modules/notes/js/functions.js
@@ -2,41 +2,38 @@ function showNotesForm(path, width, height) {
     
     if(typeof(width)==='undefined'){
         var width = '800';
-    }
-    
+    }   
     if(typeof(height)==='undefined'){
         var height = '480';
     }  
-    
-    new Ajax.Request(path,
-    {
-        method:'post',
-        parameters: { url : path
-                    },  
-        onSuccess: function(answer) {
-            eval("response = "+answer.responseText);
-           
+
+    $j.ajax({
+        url: path,
+        type: 'POST',
+        success: function (answer) {
+           eval("response = "+answer);
             if(response.status == 0){
-             
                 var modal_content = convertToTextVisibleNewLine(response.content);
                 createModal(modal_content, 'form_notes', height, width); 
             } else {
-                window.top.$('main_error').innerHTML = response.error;
+                window.top.$j('main_error').html( response.error);
             }
+        },
+        error: function (error) {
+            alert(error);
         }
+
     });
 }
 
 function validNotesForm (path, form_id) {
-
-    new Ajax.Request(path,
-    {
-        asynchronous:false,
-        method:'post',
-        parameters: Form.serialize(form_id),
-        encoding: 'UTF-8',                       
-        onSuccess: function(answer){
-            eval("response = "+answer.responseText);
+     
+   $j.ajax({
+        url: path,
+        type: 'POST',
+        data : Form.serialize(form_id),
+        success: function (answer) {
+            eval("response = "+answer);
             if(response.status == 0){
                 if (typeof window.parent['angularSignatureBookComponent'] != "undefined") {
                     window.parent.angularSignatureBookComponent.componentAfterNotes();
@@ -46,28 +43,35 @@ function validNotesForm (path, form_id) {
             } else {
                 alert(response.error);
             }
+        },
+        error: function (error) {
+            alert(error);
         }
+
     });
 }
 
 function addTemplateToNote(templateNotes, path)
 {
-    new Ajax.Request(path,
-    {
-        method:'post',
-        parameters: { 
-                      templateId : templateNotes
-                    }, 
-        onSuccess: function(answer) {
-            eval("response = "+answer.responseText);
+    
+    $j.ajax({
+        url: path,
+        type: 'POST',
+        data : {templateId : templateNotes},
+        success: function (answer) {
+           eval("response = "+answer);
             if (response.status == 0) {
                 var strContent = response.content;
                 var reg = new RegExp(/\\n/gi);
                 var strContentReplace = strContent.replace(reg, '\n');
-                $('notes').value = $('notes').value + ' ' + strContentReplace;
+                $j('#notes').val($j('#notes').val() + ' ' + strContentReplace) ;
             } else {
-                window.top.$('main_error').innerHTML = response.error;
+                window.top.$j('main_error').html(response.error);
             }
+        },
+        error: function (error) {
+            alert(error);
         }
+
     });
 }
\ No newline at end of file
-- 
GitLab