Commit 15e27788 authored by Hamza Dely's avatar Hamza Dely
Browse files

Ajout des fichiers statiques oubliés jusqu'alors

parent 334bf65a
/* CSS spécifique à la NK2018 */
/* Couleurs de la note */
:root {
--major-color: rgb(136, 37, 88);
--minor-color: rgb(43, 200, 45);
}
.bg-nk-major {
background-color: var(--major-color);
}
.bg-nk-minor {
background-color: var(--minor-color);
}
.text-nk-major {
color: var(--major-color);
}
.text-nk-minor {
color: var(--minor-color);
}
/* Modifications d'appoint sur les listes */
.list-inline-item + .list-inline-item::before {
content : "|";
color : var(--major-color);
}
span + span::before {
content : ", ";
}
@font-face{font-family:Icons;src:url(../fonts/open-iconic.eot);src:url(../fonts/open-iconic.eot?#iconic-sm) format('embedded-opentype'),url(../fonts/open-iconic.woff) format('woff'),url(../fonts/open-iconic.ttf) format('truetype'),url(../fonts/open-iconic.otf) format('opentype'),url(../fonts/open-iconic.svg#iconic-sm) format('svg');font-weight:400;font-style:normal}.oi{position:relative;top:1px;display:inline-block;speak:none;font-family:Icons;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.oi:empty:before{width:1em;text-align:center;box-sizing:content-box}.oi.oi-align-center:before{text-align:center}.oi.oi-align-left:before{text-align:left}.oi.oi-align-right:before{text-align:right}.oi.oi-flip-horizontal:before{-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.oi.oi-flip-vertical:before{-webkit-transform:scale(1,-1);-ms-transform:scale(-1,1);transform:scale(1,-1)}.oi.oi-flip-horizontal-vertical:before{-webkit-transform:scale(-1,-1);-ms-transform:scale(-1,1);transform:scale(-1,-1)}.oi-account-login:before{content:'\e000'}.oi-account-logout:before{content:'\e001'}.oi-action-redo:before{content:'\e002'}.oi-action-undo:before{content:'\e003'}.oi-align-center:before{content:'\e004'}.oi-align-left:before{content:'\e005'}.oi-align-right:before{content:'\e006'}.oi-aperture:before{content:'\e007'}.oi-arrow-bottom:before{content:'\e008'}.oi-arrow-circle-bottom:before{content:'\e009'}.oi-arrow-circle-left:before{content:'\e00a'}.oi-arrow-circle-right:before{content:'\e00b'}.oi-arrow-circle-top:before{content:'\e00c'}.oi-arrow-left:before{content:'\e00d'}.oi-arrow-right:before{content:'\e00e'}.oi-arrow-thick-bottom:before{content:'\e00f'}.oi-arrow-thick-left:before{content:'\e010'}.oi-arrow-thick-right:before{content:'\e011'}.oi-arrow-thick-top:before{content:'\e012'}.oi-arrow-top:before{content:'\e013'}.oi-audio-spectrum:before{content:'\e014'}.oi-audio:before{content:'\e015'}.oi-badge:before{content:'\e016'}.oi-ban:before{content:'\e017'}.oi-bar-chart:before{content:'\e018'}.oi-basket:before{content:'\e019'}.oi-battery-empty:before{content:'\e01a'}.oi-battery-full:before{content:'\e01b'}.oi-beaker:before{content:'\e01c'}.oi-bell:before{content:'\e01d'}.oi-bluetooth:before{content:'\e01e'}.oi-bold:before{content:'\e01f'}.oi-bolt:before{content:'\e020'}.oi-book:before{content:'\e021'}.oi-bookmark:before{content:'\e022'}.oi-box:before{content:'\e023'}.oi-briefcase:before{content:'\e024'}.oi-british-pound:before{content:'\e025'}.oi-browser:before{content:'\e026'}.oi-brush:before{content:'\e027'}.oi-bug:before{content:'\e028'}.oi-bullhorn:before{content:'\e029'}.oi-calculator:before{content:'\e02a'}.oi-calendar:before{content:'\e02b'}.oi-camera-slr:before{content:'\e02c'}.oi-caret-bottom:before{content:'\e02d'}.oi-caret-left:before{content:'\e02e'}.oi-caret-right:before{content:'\e02f'}.oi-caret-top:before{content:'\e030'}.oi-cart:before{content:'\e031'}.oi-chat:before{content:'\e032'}.oi-check:before{content:'\e033'}.oi-chevron-bottom:before{content:'\e034'}.oi-chevron-left:before{content:'\e035'}.oi-chevron-right:before{content:'\e036'}.oi-chevron-top:before{content:'\e037'}.oi-circle-check:before{content:'\e038'}.oi-circle-x:before{content:'\e039'}.oi-clipboard:before{content:'\e03a'}.oi-clock:before{content:'\e03b'}.oi-cloud-download:before{content:'\e03c'}.oi-cloud-upload:before{content:'\e03d'}.oi-cloud:before{content:'\e03e'}.oi-cloudy:before{content:'\e03f'}.oi-code:before{content:'\e040'}.oi-cog:before{content:'\e041'}.oi-collapse-down:before{content:'\e042'}.oi-collapse-left:before{content:'\e043'}.oi-collapse-right:before{content:'\e044'}.oi-collapse-up:before{content:'\e045'}.oi-command:before{content:'\e046'}.oi-comment-square:before{content:'\e047'}.oi-compass:before{content:'\e048'}.oi-contrast:before{content:'\e049'}.oi-copywriting:before{content:'\e04a'}.oi-credit-card:before{content:'\e04b'}.oi-crop:before{content:'\e04c'}.oi-dashboard:before{content:'\e04d'}.oi-data-transfer-download:before{content:'\e04e'}.oi-data-transfer-upload:before{content:'\e04f'}.oi-delete:before{content:'\e050'}.oi-dial:before{content:'\e051'}.oi-document:before{content:'\e052'}.oi-dollar:before{content:'\e053'}.oi-double-quote-sans-left:before{content:'\e054'}.oi-double-quote-sans-right:before{content:'\e055'}.oi-double-quote-serif-left:before{content:'\e056'}.oi-double-quote-serif-right:before{content:'\e057'}.oi-droplet:before{content:'\e058'}.oi-eject:before{content:'\e059'}.oi-elevator:before{content:'\e05a'}.oi-ellipses:before{content:'\e05b'}.oi-envelope-closed:before{content:'\e05c'}.oi-envelope-open:before{content:'\e05d'}.oi-euro:before{content:'\e05e'}.oi-excerpt:before{content:'\e05f'}.oi-expand-down:before{content:'\e060'}.oi-expand-left:before{content:'\e061'}.oi-expand-right:before{content:'\e062'}.oi-expand-up:before{content:'\e063'}.oi-external-link:before{content:'\e064'}.oi-eye:before{content:'\e065'}.oi-eyedropper:before{content:'\e066'}.oi-file:before{content:'\e067'}.oi-fire:before{content:'\e068'}.oi-flag:before{content:'\e069'}.oi-flash:before{content:'\e06a'}.oi-folder:before{content:'\e06b'}.oi-fork:before{content:'\e06c'}.oi-fullscreen-enter:before{content:'\e06d'}.oi-fullscreen-exit:before{content:'\e06e'}.oi-globe:before{content:'\e06f'}.oi-graph:before{content:'\e070'}.oi-grid-four-up:before{content:'\e071'}.oi-grid-three-up:before{content:'\e072'}.oi-grid-two-up:before{content:'\e073'}.oi-hard-drive:before{content:'\e074'}.oi-header:before{content:'\e075'}.oi-headphones:before{content:'\e076'}.oi-heart:before{content:'\e077'}.oi-home:before{content:'\e078'}.oi-image:before{content:'\e079'}.oi-inbox:before{content:'\e07a'}.oi-infinity:before{content:'\e07b'}.oi-info:before{content:'\e07c'}.oi-italic:before{content:'\e07d'}.oi-justify-center:before{content:'\e07e'}.oi-justify-left:before{content:'\e07f'}.oi-justify-right:before{content:'\e080'}.oi-key:before{content:'\e081'}.oi-laptop:before{content:'\e082'}.oi-layers:before{content:'\e083'}.oi-lightbulb:before{content:'\e084'}.oi-link-broken:before{content:'\e085'}.oi-link-intact:before{content:'\e086'}.oi-list-rich:before{content:'\e087'}.oi-list:before{content:'\e088'}.oi-location:before{content:'\e089'}.oi-lock-locked:before{content:'\e08a'}.oi-lock-unlocked:before{content:'\e08b'}.oi-loop-circular:before{content:'\e08c'}.oi-loop-square:before{content:'\e08d'}.oi-loop:before{content:'\e08e'}.oi-magnifying-glass:before{content:'\e08f'}.oi-map-marker:before{content:'\e090'}.oi-map:before{content:'\e091'}.oi-media-pause:before{content:'\e092'}.oi-media-play:before{content:'\e093'}.oi-media-record:before{content:'\e094'}.oi-media-skip-backward:before{content:'\e095'}.oi-media-skip-forward:before{content:'\e096'}.oi-media-step-backward:before{content:'\e097'}.oi-media-step-forward:before{content:'\e098'}.oi-media-stop:before{content:'\e099'}.oi-medical-cross:before{content:'\e09a'}.oi-menu:before{content:'\e09b'}.oi-microphone:before{content:'\e09c'}.oi-minus:before{content:'\e09d'}.oi-monitor:before{content:'\e09e'}.oi-moon:before{content:'\e09f'}.oi-move:before{content:'\e0a0'}.oi-musical-note:before{content:'\e0a1'}.oi-paperclip:before{content:'\e0a2'}.oi-pencil:before{content:'\e0a3'}.oi-people:before{content:'\e0a4'}.oi-person:before{content:'\e0a5'}.oi-phone:before{content:'\e0a6'}.oi-pie-chart:before{content:'\e0a7'}.oi-pin:before{content:'\e0a8'}.oi-play-circle:before{content:'\e0a9'}.oi-plus:before{content:'\e0aa'}.oi-power-standby:before{content:'\e0ab'}.oi-print:before{content:'\e0ac'}.oi-project:before{content:'\e0ad'}.oi-pulse:before{content:'\e0ae'}.oi-puzzle-piece:before{content:'\e0af'}.oi-question-mark:before{content:'\e0b0'}.oi-rain:before{content:'\e0b1'}.oi-random:before{content:'\e0b2'}.oi-reload:before{content:'\e0b3'}.oi-resize-both:before{content:'\e0b4'}.oi-resize-height:before{content:'\e0b5'}.oi-resize-width:before{content:'\e0b6'}.oi-rss-alt:before{content:'\e0b7'}.oi-rss:before{content:'\e0b8'}.oi-script:before{content:'\e0b9'}.oi-share-boxed:before{content:'\e0ba'}.oi-share:before{content:'\e0bb'}.oi-shield:before{content:'\e0bc'}.oi-signal:before{content:'\e0bd'}.oi-signpost:before{content:'\e0be'}.oi-sort-ascending:before{content:'\e0bf'}.oi-sort-descending:before{content:'\e0c0'}.oi-spreadsheet:before{content:'\e0c1'}.oi-star:before{content:'\e0c2'}.oi-sun:before{content:'\e0c3'}.oi-tablet:before{content:'\e0c4'}.oi-tag:before{content:'\e0c5'}.oi-tags:before{content:'\e0c6'}.oi-target:before{content:'\e0c7'}.oi-task:before{content:'\e0c8'}.oi-terminal:before{content:'\e0c9'}.oi-text:before{content:'\e0ca'}.oi-thumb-down:before{content:'\e0cb'}.oi-thumb-up:before{content:'\e0cc'}.oi-timer:before{content:'\e0cd'}.oi-transfer:before{content:'\e0ce'}.oi-trash:before{content:'\e0cf'}.oi-underline:before{content:'\e0d0'}.oi-vertical-align-bottom:before{content:'\e0d1'}.oi-vertical-align-center:before{content:'\e0d2'}.oi-vertical-align-top:before{content:'\e0d3'}.oi-video:before{content:'\e0d4'}.oi-volume-high:before{content:'\e0d5'}.oi-volume-low:before{content:'\e0d6'}.oi-volume-off:before{content:'\e0d7'}.oi-warning:before{content:'\e0d8'}.oi-wifi:before{content:'\e0d9'}.oi-wrench:before{content:'\e0da'}.oi-x:before{content:'\e0db'}.oi-yen:before{content:'\e0dc'}.oi-zoom-in:before{content:'\e0dd'}.oi-zoom-out:before{content:'\e0de'}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="110.4211"
height="109.8461"
id="svg2169"
sodipodi:version="0.32"
inkscape:version="0.45.1"
version="1.0"
sodipodi:docbase="/home/bene/Desktop"
sodipodi:docname="dessin-1.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs2171">
<linearGradient
id="linearGradient11301"
inkscape:collect="always">
<stop
id="stop11303"
offset="0"
style="stop-color:#ffe052;stop-opacity:1" />
<stop
id="stop11305"
offset="1"
style="stop-color:#ffc331;stop-opacity:1" />
</linearGradient>
<linearGradient
gradientUnits="userSpaceOnUse"
y2="168.1012"
x2="147.77737"
y1="111.92053"
x1="89.136749"
id="linearGradient11307"
xlink:href="#linearGradient11301"
inkscape:collect="always" />
<linearGradient
id="linearGradient9515"
inkscape:collect="always">
<stop
id="stop9517"
offset="0"
style="stop-color:#387eb8;stop-opacity:1" />
<stop
id="stop9519"
offset="1"
style="stop-color:#366994;stop-opacity:1" />
</linearGradient>
<linearGradient
gradientUnits="userSpaceOnUse"
y2="131.85291"
x2="110.14919"
y1="77.070274"
x1="55.549179"
id="linearGradient9521"
xlink:href="#linearGradient9515"
inkscape:collect="always" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.24748737"
inkscape:cx="-260.46312"
inkscape:cy="316.02744"
inkscape:document-units="px"
inkscape:current-layer="layer1"
width="131.10236px"
height="184.25197px"
inkscape:window-width="872"
inkscape:window-height="624"
inkscape:window-x="5"
inkscape:window-y="48" />
<metadata
id="metadata2174">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-473.36088,-251.72485)">
<g
id="g1894"
transform="translate(428.42338,184.2561)">
<path
style="opacity:1;color:#000000;fill:url(#linearGradient9521);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
d="M 99.75,67.46875 C 71.718268,67.468752 73.46875,79.625 73.46875,79.625 L 73.5,92.21875 L 100.25,92.21875 L 100.25,96 L 62.875,96 C 62.875,96 44.9375,93.965724 44.9375,122.25 C 44.937498,150.53427 60.59375,149.53125 60.59375,149.53125 L 69.9375,149.53125 L 69.9375,136.40625 C 69.9375,136.40625 69.433848,120.75 85.34375,120.75 C 101.25365,120.75 111.875,120.75 111.875,120.75 C 111.875,120.75 126.78125,120.99096 126.78125,106.34375 C 126.78125,91.696544 126.78125,82.125 126.78125,82.125 C 126.78125,82.124998 129.04443,67.46875 99.75,67.46875 z M 85,75.9375 C 87.661429,75.937498 89.8125,78.088571 89.8125,80.75 C 89.812502,83.411429 87.661429,85.5625 85,85.5625 C 82.338571,85.562502 80.1875,83.411429 80.1875,80.75 C 80.187498,78.088571 82.338571,75.9375 85,75.9375 z "
id="path8615" />
<path
id="path8620"
d="M 100.5461,177.31485 C 128.57784,177.31485 126.82735,165.1586 126.82735,165.1586 L 126.7961,152.56485 L 100.0461,152.56485 L 100.0461,148.7836 L 137.4211,148.7836 C 137.4211,148.7836 155.3586,150.81787 155.3586,122.53359 C 155.35861,94.249323 139.70235,95.252343 139.70235,95.252343 L 130.3586,95.252343 L 130.3586,108.37734 C 130.3586,108.37734 130.86226,124.03359 114.95235,124.03359 C 99.042448,124.03359 88.421098,124.03359 88.421098,124.03359 C 88.421098,124.03359 73.514848,123.79263 73.514848,138.43985 C 73.514848,153.08705 73.514848,162.6586 73.514848,162.6586 C 73.514848,162.6586 71.251668,177.31485 100.5461,177.31485 z M 115.2961,168.8461 C 112.63467,168.8461 110.4836,166.69503 110.4836,164.0336 C 110.4836,161.37217 112.63467,159.2211 115.2961,159.2211 C 117.95753,159.2211 120.1086,161.37217 120.1086,164.0336 C 120.10861,166.69503 117.95753,168.8461 115.2961,168.8461 z "
style="opacity:1;color:#000000;fill:url(#linearGradient11307);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
</g>
</g>
</svg>
/* Fonctions pour afficher/cacher des éléments de formulaires */
function cacher(champs) {
for (let champ of champs) {
$('#id_' + champ).parent('.form-group').addClass('hidden-xs-up');
}
}
function afficher(champs) {
for (let champ of champs) {
$('#id_' + champ).parent('.form-group').removeClass('hidden-xs-up');
}
}
function adapter_form_pour_type() {
var new_type = $(this).val();
var champs = ['prenom', 'sexe', 'section', 'remunere', 'remarque', 'pbsante'];
if (new_type != 'personne') {
cacher(champs);
$('#id_prenom').attr("required", false);
$('#id_section').attr("required", false);
if (new_type != 'débit') {
$('[for=id_nom]').text($(this).find('option:selected').text());
} else {
cacher(['nom']);
$('#id_nom').attr("required", false);
}
} else {
afficher(champs);
afficher(['nom']);
$('#id_nom').attr("required", true);
$('#id_prenom').attr("required", true);
$('#id_section').attr("required", true);
$('[for=id_nom]').text('Nom');
}
}
/* Lorsque le type de compte à créer change, on masque certains champs */
$('#id_type').change(adapter_form_pour_type);
$('#id_type').each(adapter_form_pour_type);
/* Fonction pour formatter les chaînes de caractère */
String.prototype.format = String.prototype.format ||
function () {
"use strict";
var str = this.toString();
if (arguments.length) {
var t = typeof arguments[0];
var key;
var args = ("string" === t || "number" === t) ?
Array.prototype.slice.call(arguments)
: arguments[0];
for (key in args) {
str = str.replace(new RegExp("\\{" + key + "\\}", "gi"), args[key]);
}
}
return str;
};
/* Fonction permettant de capitaliser une chaîne de caractères */
String.prototype.capitalize = String.prototype.capitalize ||
function () {
"use strict";
return this.charAt(0).toUpperCase() + this.slice(1);
};
/* Fonction permettant de retirer toutes les occurences d'un élément dans un tableau */
Array.prototype.remove = Array.prototype.remove ||
function (element) {
"use strict";
return this.filter(item => item !== element);
}
/* Fonction permettant de marquer une input */
function highlightInput(dom_id, mark) {
"use strict";
$(dom_id).parent().addClass('has-{0}'.format(mark));
$(dom_id).addClass('form-control-{0}'.format(mark));
}
/* Fonction permettant de retirer le marquage d'une input */
function unhighlightInput(dom_id, mark) {
"use strict";
$(dom_id).parent().removeClass('has-{0}'.format(mark));
$(dom_id).removeClass('form-control-{0}'.format(mark));
}
/* Fonction permettant d'afficher des messages en haut de page */
function display_message(message, level) {
"use strict";
var css_level = {
debug : 'debug', info : 'info', success : 'success', warning : 'warning', error : 'danger',
};
var _alert = $(document.createElement("div")).text(message);
_alert.addClass("alert alert-{0} alert-dismissible fade show".format(css_level[level]));
_alert.attr('role', 'alert');
var cross = $(document.createElement("button")).append($(document.createElement("span")).html("&times;"));
cross.addClass('close');
cross.attr('data-dismiss', 'alert').attr('aria-hidden', 'true').attr('aria-label', 'Close');
_alert.prepend(cross);
$('#idMessageContainer').prepend(_alert);
}
/* Fonction pour récupérer la valeur d'un cookie
* Récupérée depuis https://docs.djangoproject.com/fr/1.11/ref/csrf/ */
function getCookie(name) {
"use strict";
var cookieValue = null;
if (document.cookie && document.cookie !== '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = $.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) === (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
/* Drapeaux de contrôle des options de recherche */
var INCLUDE_DISABLED = 0x1 // Inclure les comptes désactivés
var INCLUDE_OLD = 0x2 // Inclure les comptes supprimés
var INCLUDE_SPECIAL = 0x4 // Inclure les comptes spéciaux (débit ...)
var EXCLUDE_SELF = 0x8 // Exclure le réquérant des résultats le cas échéant
var ALIASES_LOOKUP = 0x10 // Chercher parmi les aliases
var USE_HISTORY = 0x20 // Utiliser l'historique des aliases
var STARTS_WITH = 0x40 // Chercher une correspondance au début du texte
var EXACT_MATCH = 0x80 // Rechercher une correspondance exacte
/* Callbacks pour consulter le détail d'un résultat de recherche via la page de recherche */
function bindDetailPages(data_attribute, template_url) {
function redirectToDetailPage (index) {
var attr_id = $(this).data(data_attribute);
$(this).click(function (){window.location = template_url.format(attr_id);});
}
$.each($('#tableResultats tbody tr'), redirectToDetailPage);
}
/* Générateurs de callbacks pour mettre à jour la table des résultats d'une page de recherche */
function renewResultTable(column_generators, data_attribute, template_url) {
return function (data) {
unhighlightInput("#inputRechRapide", 'danger');
$('#tableResultats table tbody tr').remove();
var table_resultats = $('#tableResultats table tbody');
var new_lign = null;
var new_case = null;
for (const result of data) {
new_lign = $(document.createElement("tr"));
new_lign.attr("data-{0}".format(data_attribute), result.id);
for (const column of column_generators) {
new_case = $(document.createElement("td")).text(column(result));
new_lign.append(new_case);
}
table_resultats.append(new_lign);
}
bindDetailPages(data_attribute, template_url);
}
}
/* Générateur de callbacks pour indiquer une recherche infructueuse */
function showNoResults(colspan) {
return function (jqxhr) {
highlightInput("#inputRechRapide", 'danger')
$('#tableResultats table tbody tr').remove();
var table_resultats = $('#tableResultats table tbody');
var new_lign = $(document.createElement("tr")).addClass('text-center');
var new_case = $(document.createElement("td")).text("Aucun résultat").attr('colspan', colspan);
new_lign.append(new_case);
table_resultats.append(new_lign);
if (jqxhr.status !== 404) {
display_message(jqxhr.responseJSON.detail, "error");
}
}
}
/* Fonction permettant l'extraction de valeurs associées à une même clé dans liste de dictionnaire */
function extractFromDictList(dictlist, key) {
var values = [];
for (const dict of dictlist){if (dict !== null) {values.push(dict[key]);}}
if (values.length == 0) {
return [""];
} else {
return values;
}
}
/* Fonction wrappant les appels à la lib AJAX de jQuery
*
* Place automatiquement le CSRF-Token lorsque des requêtes différentes de GET/HEAD/OPTIONS/TRACE sont effectuées
* Transforme les données à envoyer en JSON
* Décode les données reçues du serveur */
function xhr(url, method, data, success, fail) {
console.log(method);
var safe_methods = ["GET", "HEAD", "OPTIONS", "TRACE"];
var xhr_settings = {
'type' : method.toLocaleUpperCase(),
'url' : url,
'contentType' : 'application/json',
'accepts' : {'json' : 'application/json', 'yaml' : 'application/yaml'},
'dataType' : 'json',
};
if (typeof data === "string") {
xhr_settings['data'] = data;
} else {
xhr_settings['data'] = JSON.stringify(data);
}
if (!safe_methods.includes(method.toLocaleUpperCase())) {
xhr_settings['headers'] = {'X-CSRFToken' : getCookie('csrftoken')};
}
return $.ajax(xhr_settings).done(success).fail(fail);
}
/* Callback pour afficher à l'utilisateur l'erreur renvoyée par l'API */
function showError(jqxhr) {display_message(jqxhr.responseJSON.detail, 'error');}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment