From 27b25471324e509372b82e7648b363b399d96e03 Mon Sep 17 00:00:00 2001 From: JeromeMBourgeois Date: Tue, 6 Aug 2024 14:54:14 +0200 Subject: [PATCH 01/20] sanitization --- pages/common/client-naf.html | 45 +++++-- pages/common/eap2017/display-item.htm | 154 +++++++++++++----------- pages/common/eap2018/display-item.htm | 154 +++++++++++++----------- pages/common/eap2019/display-item.htm | 154 +++++++++++++----------- pages/common/eap2020/display-item.htm | 154 +++++++++++++----------- pages/common/eap2021/display-item.htm | 152 +++++++++++++----------- pages/common/eap2022/display-item.htm | 152 +++++++++++++----------- pages/common/eap2023/display-item.htm | 152 +++++++++++++----------- pages/common/emb2018/display-item.htm | 162 ++++++++++++++------------ pages/common/emb2019/display-item.htm | 162 ++++++++++++++------------ pages/common/emb2020/display-item.htm | 162 ++++++++++++++------------ pages/common/emb2021/display-item.htm | 162 ++++++++++++++------------ pages/common/emb2022/display-item.htm | 160 +++++++++++++------------ pages/common/emb2023/display-item.htm | 160 +++++++++++++------------ pages/common/emb2024/display-item.htm | 160 +++++++++++++------------ pages/common/naf/display-item.htm | 125 ++++++++++++-------- 16 files changed, 1295 insertions(+), 1075 deletions(-) diff --git a/pages/common/client-naf.html b/pages/common/client-naf.html index e6db2b0..e6c8fb4 100644 --- a/pages/common/client-naf.html +++ b/pages/common/client-naf.html @@ -1,38 +1,61 @@ - + + + + + Recherche dans la NAF +

Recherche dans la NAF

- +
-
+
diff --git a/pages/common/eap2017/display-item.htm b/pages/common/eap2017/display-item.htm index bb7d440..0c94aa6 100644 --- a/pages/common/eap2017/display-item.htm +++ b/pages/common/eap2017/display-item.htm @@ -1,20 +1,20 @@ - + - - EAP - consultation - + + + + EAP - consultation + diff --git a/pages/common/eap2018/display-item.htm b/pages/common/eap2018/display-item.htm index c2f60ae..2d4f7cc 100644 --- a/pages/common/eap2018/display-item.htm +++ b/pages/common/eap2018/display-item.htm @@ -1,20 +1,20 @@ - + - - EAP - consultation - + + + + EAP - consultation + diff --git a/pages/common/eap2019/display-item.htm b/pages/common/eap2019/display-item.htm index 6dafaf5..e9b997f 100644 --- a/pages/common/eap2019/display-item.htm +++ b/pages/common/eap2019/display-item.htm @@ -1,20 +1,20 @@ - + - - EAP - consultation - + + + + EAP - consultation + diff --git a/pages/common/eap2020/display-item.htm b/pages/common/eap2020/display-item.htm index f11dbcf..4f5b795 100644 --- a/pages/common/eap2020/display-item.htm +++ b/pages/common/eap2020/display-item.htm @@ -1,20 +1,20 @@ - + - - EAP - consultation - + + + + EAP - consultation + diff --git a/pages/common/eap2021/display-item.htm b/pages/common/eap2021/display-item.htm index 822aae7..5ee0dde 100644 --- a/pages/common/eap2021/display-item.htm +++ b/pages/common/eap2021/display-item.htm @@ -1,20 +1,20 @@ - + - - EAP - consultation - + + + + EAP - consultation + diff --git a/pages/common/eap2022/display-item.htm b/pages/common/eap2022/display-item.htm index 41d49cd..7b2e1e6 100644 --- a/pages/common/eap2022/display-item.htm +++ b/pages/common/eap2022/display-item.htm @@ -1,20 +1,20 @@ - + - - EAP - consultation - + + + + EAP - consultation + diff --git a/pages/common/eap2023/display-item.htm b/pages/common/eap2023/display-item.htm index 874948d..b41b958 100644 --- a/pages/common/eap2023/display-item.htm +++ b/pages/common/eap2023/display-item.htm @@ -1,20 +1,20 @@ - + - - EAP - consultation - + + + + EAP - consultation + diff --git a/pages/common/emb2018/display-item.htm b/pages/common/emb2018/display-item.htm index fac873c..c59657f 100644 --- a/pages/common/emb2018/display-item.htm +++ b/pages/common/emb2018/display-item.htm @@ -1,151 +1,163 @@ - + - - EMB - consultation - + + + + EMB - consultation + diff --git a/pages/common/emb2019/display-item.htm b/pages/common/emb2019/display-item.htm index e7d5b32..b8d4347 100644 --- a/pages/common/emb2019/display-item.htm +++ b/pages/common/emb2019/display-item.htm @@ -1,151 +1,163 @@ - + - - EMB - consultation - + + + + EMB - consultation + diff --git a/pages/common/emb2020/display-item.htm b/pages/common/emb2020/display-item.htm index 2cffa4f..1e5a130 100644 --- a/pages/common/emb2020/display-item.htm +++ b/pages/common/emb2020/display-item.htm @@ -1,151 +1,163 @@ - + - - EMB - consultation - + + + + EMB - consultation + diff --git a/pages/common/emb2021/display-item.htm b/pages/common/emb2021/display-item.htm index 76418be..fc046dd 100644 --- a/pages/common/emb2021/display-item.htm +++ b/pages/common/emb2021/display-item.htm @@ -1,151 +1,163 @@ - + - - EMB - consultation - + + + + EMB - consultation + diff --git a/pages/common/emb2022/display-item.htm b/pages/common/emb2022/display-item.htm index 102ae0d..ac4f7d1 100644 --- a/pages/common/emb2022/display-item.htm +++ b/pages/common/emb2022/display-item.htm @@ -1,151 +1,163 @@ - + - - EMB - consultation - + + + + EMB - consultation + diff --git a/pages/common/emb2023/display-item.htm b/pages/common/emb2023/display-item.htm index 8136032..4bc525c 100644 --- a/pages/common/emb2023/display-item.htm +++ b/pages/common/emb2023/display-item.htm @@ -1,151 +1,163 @@ - + - - EMB - consultation - + + + + EMB - consultation + diff --git a/pages/common/emb2024/display-item.htm b/pages/common/emb2024/display-item.htm index 544e429..fbe80ef 100644 --- a/pages/common/emb2024/display-item.htm +++ b/pages/common/emb2024/display-item.htm @@ -1,151 +1,163 @@ - + - - EMB - consultation - + + + + EMB - consultation + diff --git a/pages/common/naf/display-item.htm b/pages/common/naf/display-item.htm index 23ea293..f032a0c 100644 --- a/pages/common/naf/display-item.htm +++ b/pages/common/naf/display-item.htm @@ -1,13 +1,14 @@ - + - - NAF 2008 - consulation - + + + + NAF 2008 - consultation + - + - - -
-

-
-
-
-
-
-
-
-
-
- + function getParentCode(code) { + var codeParent; + if (code && code.length > 6) { + codeParent = code.substr(0, parentLength[1]); + if (code.slice(-1).match(/[A-Z]/)) { + codeParent += code.slice(-1).toLowerCase(); + } + return codeParent; + } + return null; + } + + + +
+

+
+
+
+
+
+
+
+
+
+ From 66af3aabe4713043768b71e1cf94173e19be1fcc Mon Sep 17 00:00:00 2001 From: JeromeMBourgeois Date: Tue, 6 Aug 2024 15:54:01 +0200 Subject: [PATCH 04/20] Update display-item.htm --- pages/common/eap2021/display-item.htm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pages/common/eap2021/display-item.htm b/pages/common/eap2021/display-item.htm index 84ed49c..1299747 100644 --- a/pages/common/eap2021/display-item.htm +++ b/pages/common/eap2021/display-item.htm @@ -33,6 +33,12 @@ return text.replace(/[&<>"']/g, function(m) { return map[m]; }); } + function decodeHtml(html) { + var txt = document.createElement("textarea"); + txt.innerHTML = html; + return txt.value; + } + function getLabel(code) { var query = "PREFIX skos: "; query += "SELECT ?uri ?label WHERE {"; @@ -45,17 +51,17 @@ $.getJSON(queryURL).done(function(data) { if (data.results.bindings.length > 0) { var itemURI = data.results.bindings[0].uri.value; - $('#label').html(escapeHtml(code) + " - " + escapeHtml(data.results.bindings[0].label.value)); + $('#label').text(escapeHtml(code) + " - " + decodeHtml(escapeHtml(data.results.bindings[0].label.value))); if (code.length > 6) { getDescription(itemURI); } var childTypeIndex = (code.length == 6 ? 1 : 0); getChildren(itemURI, itemTypes[childTypeIndex]); } else { - $('#label').html("

Code non trouvé

"); + $('#label').text("Code non trouvé"); } }).fail(function() { - $('#label').html("

Erreur lors de la récupération des données

"); + $('#label').text("Erreur lors de la récupération des données"); }); } @@ -88,7 +94,7 @@ var innerHTML = '

Liste des produits détaillés

'; $('#sous-items').html(innerHTML); @@ -109,8 +115,8 @@ $.getJSON(queryURL).done(function(data) { if (data.results.bindings.length > 0) { - var noteText = escapeHtml(data.results.bindings[0].text.value.replace(regex, replacement)); - $('#' + tag).append(noteText.replace(/\\\$/g, "
")); + var noteText = decodeHtml(escapeHtml(data.results.bindings[0].text.value.replace(regex, replacement))); + $('#' + tag).append('
' + noteText.replace(/\\\$/g, "
") + '
'); $('#' + tag).addClass(tag); } }).fail(function() { From 2fc9fe2528e57f5d02c86ef7287deab34ebbd7c4 Mon Sep 17 00:00:00 2001 From: JeromeMBourgeois Date: Tue, 6 Aug 2024 16:06:44 +0200 Subject: [PATCH 05/20] Update display-item.htm --- pages/common/eap2021/display-item.htm | 39 +++++++++++---------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/pages/common/eap2021/display-item.htm b/pages/common/eap2021/display-item.htm index 1299747..2f69b5b 100644 --- a/pages/common/eap2021/display-item.htm +++ b/pages/common/eap2021/display-item.htm @@ -18,7 +18,7 @@ $(document).ready(function() { var code = getURLParameter('code'); - $('#fil-ariane').html('
    ' + breadcrumbs(code, false) + '
'); + $('#fil-ariane').html(breadcrumbs(code, false)); getLabel(code); }); @@ -33,12 +33,6 @@ return text.replace(/[&<>"']/g, function(m) { return map[m]; }); } - function decodeHtml(html) { - var txt = document.createElement("textarea"); - txt.innerHTML = html; - return txt.value; - } - function getLabel(code) { var query = "PREFIX skos: "; query += "SELECT ?uri ?label WHERE {"; @@ -51,7 +45,7 @@ $.getJSON(queryURL).done(function(data) { if (data.results.bindings.length > 0) { var itemURI = data.results.bindings[0].uri.value; - $('#label').text(escapeHtml(code) + " - " + decodeHtml(escapeHtml(data.results.bindings[0].label.value))); + $('#label').text(code + " - " + data.results.bindings[0].label.value); if (code.length > 6) { getDescription(itemURI); } @@ -91,14 +85,15 @@ $.getJSON(queryURL).done(function(data) { if (data.results.bindings.length > 0) { - var innerHTML = '

Liste des produits détaillés