From c4514f451cafef9523c720f45e48cc6f4a2788b3 Mon Sep 17 00:00:00 2001
From: nicrausaz <n.crausaz99@gmail.com>
Date: Wed, 6 Mar 2019 11:06:19 +0100
Subject: [PATCH] update script

---
 canapEPFL/script.js          | 6 +++---
 canapEPFL/templates/head.php | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/canapEPFL/script.js b/canapEPFL/script.js
index 2e70c44..d73ef81 100644
--- a/canapEPFL/script.js
+++ b/canapEPFL/script.js
@@ -66,15 +66,15 @@ function addChildren(parentId, maxItems, childTemplate, addButtonId) {
 function changeTitleFile(objFile) {
     var filename = $(objFile)[0].value.replace(/^.*[\\/]/, '');
     if (filename) {
-        $(objFile.parentElement)[0].children[3].innerHTML = filename;
+        location.search == "?edit" ? $(objFile.parentElement)[0].children[4].innerHTML = filename : $(objFile.parentElement)[0].children[3].innerHTML = filename;
     } else {
-        $(objFile.parentElement)[0].children[3].innerHTML = 'Choisir...';
+        location.search == "?edit" ? $(objFile.parentElement)[0].children[4].innerHTML = 'Remplacer...' : $(objFile.parentElement)[0].children[3].innerHTML = 'Choisir...';
     }
     checkFileFormat($(objFile)[0]);
 }
 
 function checkFileFormat(obj) {
-    var errorZone = $(obj.parentElement)[0].children[5];
+    var errorZone = location.search == "?edit" ? $(obj.parentElement)[0].children[6] : $(obj.parentElement)[0].children[5];
     var allowedExtensions = ['pdf', 'jpeg', 'png', 'jpg'];
     var fileExtension = obj.value.split('.').pop().toLowerCase();
 
diff --git a/canapEPFL/templates/head.php b/canapEPFL/templates/head.php
index 1169763..1639fee 100644
--- a/canapEPFL/templates/head.php
+++ b/canapEPFL/templates/head.php
@@ -23,8 +23,8 @@
 <?php
   ini_set("display_errors", 0);
   error_reporting(0);
-  ini_set("display_errors", 1);
-  error_reporting(E_ALL);
+  // ini_set("display_errors", 1);
+  // error_reporting(E_ALL);
   require_once('configs/config.php');
   require('configs/db.php');
   if (!isset($_SESSION)) { session_start(); }
-- 
GitLab