diff --git a/js/modules/document.js b/js/modules/document.js index 51f305fd..daa7e479 100644 --- a/js/modules/document.js +++ b/js/modules/document.js @@ -55,6 +55,7 @@ window.saturne.document.event = function() { $(document).on('click', '#builddoc_generatebutton', window.saturne.document.displayLoader); $(document).on('click', '.pdf-generation', window.saturne.document.displayLoader); $(document).on('click', '.download-template', window.saturne.document.autoDownloadTemplate); + $(document).on( 'keydown', '#change_pagination', window.saturne.document.changePagination ); }; /** @@ -103,3 +104,23 @@ window.saturne.document.autoDownloadTemplate = function() { error: function () {} }); }; + + +window.saturne.document.changePagination = function (event) { + if (event.keyCode === 13) { + event.preventDefault(); + + var input = event.target; + var pageNumber = $('#page_number').val(); + var pageValue = parseInt(input.value) <= parseInt(pageNumber) ? input.value : pageNumber; + var currentUrl = new URL(window.location.href); + + if (currentUrl.searchParams.has('page')) { + currentUrl.searchParams.set('page', pageValue); + } else { + currentUrl.searchParams.append('page', pageValue); + } + + window.location.replace(currentUrl.toString()); + } +} diff --git a/js/saturne.min.js b/js/saturne.min.js index fd81cbea..d2847ae2 100644 --- a/js/saturne.min.js +++ b/js/saturne.min.js @@ -1 +1 @@ -window.saturne||(window.saturne={},window.saturne.scriptsLoaded=!1),window.saturne.scriptsLoaded||(window.saturne.init=function(){window.saturne.load_list_script()},window.saturne.load_list_script=function(){if(!window.saturne.scriptsLoaded){var e=void 0,t=void 0;for(e in window.saturne)for(t in window.saturne[e].init&&window.saturne[e].init(),window.saturne[e])window.saturne[e]&&window.saturne[e][t]&&window.saturne[e][t].init&&window.saturne[e][t].init();window.saturne.scriptsLoaded=!0}},window.saturne.refresh=function(){var e=void 0,t=void 0;for(e in window.saturne)for(t in window.saturne[e].refresh&&window.saturne[e].refresh(),window.saturne[e])window.saturne[e]&&window.saturne[e][t]&&window.saturne[e][t].refresh&&window.saturne[e][t].refresh()},$(document).ready(window.saturne.init)),window.saturne.button={},window.saturne.button.init=function(){window.saturne.button.event()},window.saturne.button.event=function(){$(document).on("click",".wpeo-button:submit, .wpeo-button.auto-download",window.saturne.button.addLoader)},window.saturne.button.addLoader=function(){$(this).hasClass("no-load")||(window.saturne.loader.display($(this)),$(this).toggleClass("button-blue button-disable"))},window.saturne.dashboard={},window.saturne.dashboard.init=function(){window.saturne.dashboard.event()},window.saturne.dashboard.event=function(){$(document).on("change",".add-dashboard-widget",window.saturne.dashboard.addDashBoardInfo),$(document).on("click",".close-dashboard-widget",window.saturne.dashboard.closeDashBoardInfo),$(document).on("click",".select-dataset-dashboard-info",window.saturne.dashboard.selectDatasetDashboardInfo)},window.saturne.dashboard.addDashBoardInfo=function(){var e=document.getElementById("dashBoardForm"),e=new FormData(e).get("boxcombo"),t=window.saturne.toolbox.getToken(),n=window.saturne.toolbox.getQuerySeparator(document.URL);$.ajax({url:document.URL+n+"action=adddashboardinfo&token="+t,type:"POST",processData:!1,data:JSON.stringify({dashboardWidgetName:e}),contentType:!1,success:function(){window.location.reload()},error:function(){}})},window.saturne.dashboard.closeDashBoardInfo=function(){let t=$(this);var e=t.attr("data-widgetname"),n=window.saturne.toolbox.getToken(),o=window.saturne.toolbox.getQuerySeparator(document.URL);$.ajax({url:document.URL+o+"action=closedashboardinfo&token="+n,type:"POST",processData:!1,data:JSON.stringify({dashboardWidgetName:e}),contentType:!1,success:function(e){t.closest(".box-flex-item").fadeOut(400),$(".add-widget-box").attr("style",""),$(".add-widget-box").html($(e).find(".add-widget-box").children())},error:function(){}})},window.saturne.dashboard.selectDatasetDashboardInfo=function(){var e=$("#search_userid").val(),t=$("#search_year").val(),n=$("#search_month").val(),o=window.saturne.toolbox.getToken(),a=window.saturne.toolbox.getQuerySeparator(document.URL);window.saturne.loader.display($(".fichecenter")),$.ajax({url:document.URL+a+"token="+o+"&search_userid="+e+"&search_year="+t+"&search_month="+n,type:"POST",processData:!1,contentType:!1,success:function(e){$(".fichecenter").replaceWith($(e).find(".fichecenter"))},error:function(){}})},window.saturne.document={},window.saturne.document.init=function(){window.saturne.document.event()},window.saturne.document.event=function(){$(document).on("click","#builddoc_generatebutton",window.saturne.document.displayLoader),$(document).on("click",".pdf-generation",window.saturne.document.displayLoader),$(document).on("click",".download-template",window.saturne.document.autoDownloadTemplate)},window.saturne.document.displayLoader=function(){window.saturne.loader.display($(this).closest(".div-table-responsive-no-min"))},window.saturne.document.autoDownloadTemplate=function(){let t=window.saturne.toolbox.getToken();var e=document.URL.replace(/#.*$/,"");let n=window.saturne.toolbox.getQuerySeparator(e),o=$(this).closest(".file-generation");var a=o.find(".template-type").attr("value");let i=o.find(".template-name").attr("value");$.ajax({url:e+n+"action=download_template&filename="+i+"&type="+a+"&token="+t,type:"POST",success:function(){var e=o.find(".template-path").attr("value");window.saturne.signature.download(e+i,i),$.ajax({url:document.URL+n+"action=remove_file&filename="+i+"&token="+t,type:"POST",success:function(){},error:function(){}})},error:function(){}})},window.saturne.dropdown={},window.saturne.dropdown.init=function(){window.saturne.dropdown.event()},window.saturne.dropdown.event=function(){$(document).on("keyup",window.saturne.dropdown.keyup),$(document).on("keypress",window.saturne.dropdown.keypress),$(document).on("click",".wpeo-dropdown:not(.dropdown-active) .dropdown-toggle:not(.disabled)",window.saturne.dropdown.open),$(document).on("click",".wpeo-dropdown.dropdown-active .saturne-dropdown-content",function(e){e.stopPropagation()}),$(document).on("click",".wpeo-dropdown.dropdown-active:not(.dropdown-force-display) .saturne-dropdown-content .dropdown-item",window.saturne.dropdown.close),$(document).on("click",".wpeo-dropdown.dropdown-active",function(e){window.saturne.dropdown.close(e),e.stopPropagation()}),$(document).on("click","body",window.saturne.dropdown.close)},window.saturne.dropdown.keyup=function(e){27===e.keyCode&&window.saturne.dropdown.close()},window.saturne.dropdown.keypress=function(e){var t=localStorage.currentString||"",n=localStorage.keypressNumber?+localStorage.keypressNumber:0;t+=e.keyCode,++n,localStorage.setItem("currentString",t),localStorage.setItem("keypressNumber",n),9body{"+e+n+e+t+n+t)},window.saturne.dropdown.open=function(e){var n=$(this),o=n.find("[data-fa-i2svg]"),t={},a=void 0;window.saturne.dropdown.close(e,$(this)),n.attr("data-action")?(window.saturne.loader.display(n),n.get_data(function(e){for(a in t)e[a]||(e[a]=t[a]);window.saturne.request.send(n,e,function(e,t){n.closest(".wpeo-dropdown").find(".saturne-dropdown-content").html(t.data.view),n.closest(".wpeo-dropdown").addClass("dropdown-active"),o&&window.saturne.dropdown.toggleAngleClass(o)})})):(n.closest(".wpeo-dropdown").addClass("dropdown-active"),o&&window.saturne.dropdown.toggleAngleClass(o)),e.stopPropagation()},window.saturne.dropdown.close=function(e){var n=$(this);$(".wpeo-dropdown.dropdown-active:not(.no-close)").each(function(){var e=$(this),t={close:!0};n.trigger("dropdown-before-close",[e,n,t]),t.close&&(e.removeClass("dropdown-active"),t=$(this).find(".dropdown-toggle").find("[data-fa-i2svg]"))&&window.saturne.dropdown.toggleAngleClass(t)})},window.saturne.dropdown.toggleAngleClass=function(e){e.hasClass("fa-caret-down")||e.hasClass("fa-caret-up")?e.toggleClass("fa-caret-down").toggleClass("fa-caret-up"):e.hasClass("fa-caret-circle-down")||e.hasClass("fa-caret-circle-up")?e.toggleClass("fa-caret-circle-down").toggleClass("fa-caret-circle-up"):e.hasClass("fa-angle-down")||e.hasClass("fa-angle-up")?e.toggleClass("fa-angle-down").toggleClass("fa-angle-up"):(e.hasClass("fa-chevron-circle-down")||e.hasClass("fa-chevron-circle-up"))&&e.toggleClass("fa-chevron-circle-down").toggleClass("fa-chevron-circle-up")},window.saturne.keyEvent={},window.saturne.keyEvent.init=function(){window.saturne.keyEvent.event()},window.saturne.keyEvent.event=function(){$(document).on("keydown",window.saturne.keyEvent.keyActions),$(document).on("keyup",".url-container",window.saturne.keyEvent.checkUrlFormat)},window.saturne.keyEvent.keyActions=function(e){0<$(this).find(".modal-active").length?("Escape"===e.key&&$(this).find(".modal-active .modal-close .fas.fa-times").first().click(),"Enter"!==e.key||$("input, textarea").is(":focus")||$(this).find(".modal-active .modal-footer .wpeo-button").not(".button-disable").first().click()):$(e.target).is("input, textarea")||("Enter"===e.key&&$(this).find(".button_search").click(),e.shiftKey&&"Enter"===e.key&&$(this).find(".button_removefilter").click())},window.saturne.keyEvent.checkUrlFormat=function(){$(this).val().match(/[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)?/gi)?$(this).attr("style","border: solid; border-color: green"):0<$("input:focus").val().length&&$(this).attr("style","border: solid; border-color: red")},window.saturne.loader={},window.saturne.loader.init=function(){window.saturne.loader.event()},window.saturne.loader.event=function(){},window.saturne.loader.display=function(e){var t;e.hasClass("button-progress")?e.addClass("button-load"):(e.addClass("wpeo-loader"),t=$(''),e[0].loaderElement=t,e.append(e[0].loaderElement))},window.saturne.loader.remove=function(e){0"),i===a&&($(".wpeo-loader").removeClass("wpeo-loader"),$("#progressBarContainer").fadeOut(800),$("#progressBarContainer").find(".loader-spin").remove(),window.saturne.loader.display(o.find(".ecm-photo-list-content")),setTimeout(()=>{o.html($(e).find("#media_gallery").children()).promise().done(()=>{1==a&&($("#media_gallery").find(".save-photo").removeClass("button-disable"),$("#media_gallery").find(".delete-photo").removeClass("button-disable"),$("#media_gallery").find(".clickable-photo0").addClass("clicked-photo")),($(e).find(".error-medias").length?($(".messageErrorSendPhoto").find(".notice-subtitle").html(m),$(".messageErrorSendPhoto")):$(".messageSuccessSendPhoto")).removeClass("hidden"),o.attr("data-from-id",r),o.attr("data-from-type",s),o.attr("data-from-subtype",l),o.attr("data-from-subdir",c),o.find(".wpeo-button").attr("value",r)})},800))}})})},window.saturne.mediaGallery.previewPhoto=function(e){var t=setInterval(function(){$(".ui-dialog").length&&(clearInterval(t),$(document).find(".ui-dialog").addClass("preview-photo"))},100)},window.saturne.mediaGallery.unlinkFile=function(e){e.preventDefault();let t=window.saturne.toolbox.getToken();var e=$(this).closest(".modal-active"),n=0<$(this).closest(".modal-active").length;let o=null,a=(o=(n?e:$(this).closest(".linked-medias")).find(".modal-options")).attr("data-from-subtype"),i=o.attr("data-from-type"),d=o.attr("data-from-subdir"),r=o.attr("data-from-id"),s=o.attr("data-photo-class");n=$(this).closest(".media-container");let l=n.find(".file-path").val(),c=n.find(".file-name").val(),u=$(this).closest(".linked-medias").find(".media-gallery-favorite.favorite").closest(".media-container").find(".file-name").val(),w=(window.saturne.loader.display(n),window.saturne.toolbox.getQuerySeparator(document.URL));$(".card__confirmation").css("display","flex"),$(document).on("click",".confirmation-close",function(){$(".wpeo-loader").removeClass("wpeo-loader"),$(".card__confirmation").css("display","none")}),$(document).on("click",".confirmation-delete",function(){$.ajax({url:document.URL+w+"subaction=unlinkFile&token="+t,type:"POST",data:JSON.stringify({filepath:l,filename:c,objectSubtype:a,objectType:i,objectSubdir:d,objectId:r}),processData:!1,success:function(e){$(".card__confirmation").css("display","none"),$("#media_gallery .modal-container").replaceWith($(e).find("#media_gallery .modal-container")),u==c&&(void 0!==s&&0"))[1].match(/>/)&&(n[1]=n[1].replace(/>/,"")),$(this).attr("title",n[1]),$(this).html(n[0])}),t.css("width","30px"),t.find(".blockvmenusearch").hide(),$("span.vmenu").attr("title"," Agrandir le menu"),$("span.vmenu").html($("span.vmenu").html()),$(this).find("span.vmenu").find(".fa-chevron-circle-left").removeClass("fa-chevron-circle-left").addClass("fa-chevron-circle-right"),localStorage.setItem("maximized","false")):0<$(this).find("span.vmenu").find(".fa-chevron-circle-right").length&&(e.each(function(){$(this).html($(this).html().replace(">","")+" "+$(this).attr("title"))}),t.css("width","188px"),t.find(".blockvmenusearch").show(),$("div.menu_titre").attr("style","width: 188px !important; cursor : pointer"),$("span.vmenu").attr("title"," Réduire le menu"),$("span.vmenu").html(' Réduire le menu'),localStorage.setItem("maximized","true"),$(this).find("span.vmenu").find(".fa-chevron-circle-right").removeClass("fa-chevron-circle-right").addClass("fa-chevron-circle-left"))},window.saturne.menu.setMenu=function(){var e,t,n;0<$(".blockvmenu.blockvmenulast .saturne-toggle-menu").length&&($(".blockvmenu.blockvmenulast .saturne-toggle-menu").closest(".menu_titre").attr("style","cursor:pointer ! important"),"false"==localStorage.maximized&&$("#id-left").attr("style","display:none !important"),"false"==localStorage.maximized&&(e="",t=$("#id-left").find("a.vmenu, span.vmenudisabled, span.vmenu, a.vsmenu"),n=$(document).find("div.vmenu"),t.each(function(){e=$(this).html().split(""),$(this).attr("title",e[1]),$(this).html(e[0]),console.log(e)}),$("#id-left").attr("style","display:block !important"),$("div.menu_titre").attr("style","width: 50px !important"),$("span.vmenu").attr("title"," Agrandir le menu"),$("span.vmenu").html($("span.vmenu").html()),$("span.vmenu").find(".fa-chevron-circle-left").removeClass("fa-chevron-circle-left").addClass("fa-chevron-circle-right"),n.css("width","30px"),n.find(".blockvmenusearch").hide()),localStorage.setItem("currentString",""),localStorage.setItem("keypressNumber",0))},window.saturne.modal={},window.saturne.modal.init=function(){window.saturne.modal.event()},window.saturne.modal.event=function(){$(document).on("click",".modal-close, .modal-active:not(.modal-container)",window.saturne.modal.closeModal),$(document).on("click",".modal-open",window.saturne.modal.openModal),$(document).on("click",".modal-refresh",window.saturne.modal.refreshModal)},window.saturne.modal.openModal=function(e){var t=$(this).find(".modal-options"),n=t.attr("data-modal-to-open"),o=t.attr("data-from-id"),a=t.attr("data-from-type"),i=t.attr("data-from-subtype"),d=t.attr("data-from-subdir"),r=t.attr("data-from-module"),t=t.attr("data-photo-class");let s="";s=document.URL.match(/#/)?document.URL.split(/#/)[0]:document.URL,history.pushState({path:document.URL},"",s),$("#"+n).attr("data-from-id",o),$("#"+n).attr("data-from-type",a),$("#"+n).attr("data-from-subtype",i),$("#"+n).attr("data-from-subdir",d),$("#"+n).attr("data-photo-class",t),r&&"function"==typeof window.saturne.modal.addMoreOpenModalData&&window.saturne.modal.addMoreOpenModalData(n,$(this)),$("#"+n).find(".wpeo-button").attr("value",o),$("#"+n).addClass("modal-active"),$(".notice").addClass("hidden")},window.saturne.modal.closeModal=function(e){$("input:focus").length<1&&$("textarea:focus").length<1&&($(e.target).hasClass("modal-active")||$(e.target).hasClass("modal-close")||$(e.target).parent().hasClass("modal-close"))&&($(this).closest(".modal-active").removeClass("modal-active"),$(".clicked-photo").attr("style",""),$(".clicked-photo").removeClass("clicked-photo"),$(".notice").addClass("hidden"))},window.saturne.modal.refreshModal=function(e){window.location.reload()},window.saturne.notice={},window.saturne.notice.init=function(){window.saturne.notice.event()},window.saturne.notice.event=function(){$(document).on("click",".notice-close",window.saturne.notice.closeNotice)},window.saturne.notice.closeNotice=function(){$(this).closest(".wpeo-notice").fadeOut(function(){$(this).closest(".wpeo-notice").addClass("hidden")}),$(this).hasClass("notice-close-forever")&&window.saturne.utils.reloadPage("close_notice",".fiche")},window.saturne.object={},window.saturne.object.init=function(){window.saturne.object.event()},window.saturne.object.event=function(){$(document).on("click",".toggle-object-infos",window.saturne.object.toggleObjectInfos)},window.saturne.object.toggleObjectInfos=function(){$(this).hasClass("fa-minus-square")?($(this).removeClass("fa-minus-square").addClass("fa-caret-square-down"),$(this).closest(".fiche").find(".fichecenter.object-infos").addClass("hidden")):($(this).removeClass("fa-caret-square-down").addClass("fa-minus-square"),$(this).closest(".fiche").find(".fichecenter.object-infos").removeClass("hidden"))},window.saturne.signature={},window.saturne.signature.canvas={},window.saturne.signature.init=function(){window.saturne.signature.event()},window.saturne.signature.event=function(){$(document).on("click",".signature-erase",window.saturne.signature.clearCanvas),$(document).on("click",".signature-validate:not(.button-disable)",window.saturne.signature.createSignature),$(document).on("click",".auto-download",window.saturne.signature.autoDownloadSpecimen),$(document).on("click",".copy-signatureurl",window.saturne.signature.copySignatureUrlClipboard),$(document).on("click",".set-attendance",window.saturne.signature.setAttendance),document.querySelector('script[src*="signature-pad.min.js"]')&&window.saturne.signature.drawSignatureOnCanvas(),$(document).on("touchstart mousedown",".canvas-signature",function(){window.saturne.toolbox.removeAddButtonClass("signature-validate","button-grey button-disable","button-blue")})},window.saturne.signature.drawSignatureOnCanvas=function(){var e;window.saturne.signature.canvas=document.querySelector(".canvas-signature"),window.saturne.signature.canvas&&(e=Math.max(window.devicePixelRatio||1,1),window.saturne.signature.canvas.signaturePad=new SignaturePad(window.saturne.signature.canvas,{penColor:"rgb(0, 0, 0)"}),window.saturne.signature.canvas.width=window.saturne.signature.canvas.offsetWidth*e,window.saturne.signature.canvas.height=window.saturne.signature.canvas.offsetHeight*e,window.saturne.signature.canvas.getContext("2d").scale(e,e))},window.saturne.signature.clearCanvas=function(){window.saturne.signature.canvas.signaturePad.clear(),window.saturne.toolbox.removeAddButtonClass("signature-validate","button-blue","button-grey button-disable")},window.saturne.signature.createSignature=function(){var e,t=window.saturne.toolbox.getToken(),n=window.saturne.toolbox.getQuerySeparator(document.URL);window.saturne.signature.canvas.signaturePad.isEmpty()||(e=window.saturne.signature.canvas.toDataURL()),window.saturne.loader.display($(this)),$.ajax({url:document.URL+n+"action=add_signature&token="+t,type:"POST",processData:!1,contentType:"application/octet-stream",data:JSON.stringify({signature:e}),success:function(e){!0===$(".public-card__container").data("public-interface")?($(".card__confirmation").removeAttr("style"),$(".signature-confirmation-close").attr("onclick","window.close()"),$(".public-card__container").replaceWith($(e).find(".public-card__container"))):window.location.reload()},error:function(){}})},window.saturne.signature.download=function(e,t){var n=document.createElement("a");n.href=e,n.setAttribute("download",t),n.click()},window.saturne.signature.autoDownloadSpecimen=function(){let o=$(this).closest(".file-generation"),a=window.saturne.toolbox.getToken(),i=window.saturne.toolbox.getQuerySeparator(document.URL);$.ajax({url:document.URL+i+"action=builddoc&token="+a,type:"POST",success:function(e){var t=o.find(".specimen-name").attr("data-specimen-name"),n=o.find(".specimen-path").attr("data-specimen-path");window.saturne.signature.download(n+t,t),$(".file-generation").replaceWith($(e).find(".file-generation")),$.ajax({url:document.URL+i+"action=remove_file&token="+a,type:"POST",success:function(){},error:function(){}})},error:function(){}})},window.saturne.signature.copySignatureUrlClipboard=function(){var e=$(this).attr("data-signature-url");navigator.clipboard.writeText(e).then(()=>{$(this).attr("class","fas fa-check copy-signatureurl"),$(this).css("color","#59ed9c"),$(this).closest(".copy-signatureurl-container").find(".copied-to-clipboard").attr("style",""),$(this).closest(".copy-signatureurl-container").find(".copied-to-clipboard").fadeOut(2500,()=>{$(this).attr("class","fas fa-clipboard copy-signatureurl"),$(this).css("color","#666")})})},window.saturne.signature.setAttendance=function(){var e=$(this).closest(".attendance-container").find('input[name="signatoryID"]').val(),t=$(this).attr("value"),n=window.saturne.toolbox.getToken(),o=window.saturne.toolbox.getQuerySeparator(document.URL),a=String(document.location.href).replace(/#formmail/,"");$.ajax({url:a+o+"action=set_attendance&token="+n,type:"POST",processData:!1,contentType:"",data:JSON.stringify({signatoryID:e,attendance:t}),success:function(e){$(".signatures-container").html($(e).find(".signatures-container"))},error:function(){}})},window.saturne.toolbox={},window.saturne.toolbox.init=function(){},window.saturne.toolbox.getQuerySeparator=function(e){return e.match(/\?/)?"&":"?"},window.saturne.toolbox.getToken=function(){return $('input[name="token"]').val()},window.saturne.toolbox.toggleButtonClass=function(e,t){$("."+e).toggleClass(t)},window.saturne.toolbox.removeAddButtonClass=function(e,t,n){$("."+e).removeClass(t).addClass(n)},window.saturne.tooltip||(window.saturne.tooltip={},window.saturne.tooltip.init=function(){window.saturne.tooltip.event()},window.saturne.tooltip.tabChanged=function(){$(".wpeo-tooltip").remove()},window.saturne.tooltip.event=function(){$(document).on("mouseenter touchstart",'.wpeo-tooltip-event:not([data-tooltip-persist="true"])',window.saturne.tooltip.onEnter),$(document).on("mouseleave touchend",'.wpeo-tooltip-event:not([data-tooltip-persist="true"])',window.saturne.tooltip.onOut)},window.saturne.tooltip.onEnter=function(e){window.saturne.tooltip.display($(this))},window.saturne.tooltip.onOut=function(e){window.saturne.tooltip.remove($(this))},window.saturne.tooltip.display=function(e){var t=$(e).data("direction")?$(e).data("direction"):"top",n=$(''+$(e).attr("aria-label")+""),o=($(e).position(),$(e).offset()),a=($(e)[0].tooltipElement=n,$("body").append($(e)[0].tooltipElement),$(e).data("color")&&n.addClass("tooltip-"+$(e).data("color")),0),i=0;switch($(e).data("direction")){case"left":a=o.top-n.outerHeight()/2+$(e).outerHeight()/2+"px",i=o.left-n.outerWidth()-10+3+"px";break;case"right":a=o.top-n.outerHeight()/2+$(e).outerHeight()/2+"px",i=o.left+$(e).outerWidth()+8+"px";break;case"bottom":a=o.top+$(e).height()+10+10+"px",i=o.left-n.outerWidth()/2+$(e).outerWidth()/2+"px";break;default:a=o.top-n.outerHeight()-4+"px",i=o.left-n.outerWidth()/2+$(e).outerWidth()/2+"px"}n.css({top:a,left:i,opacity:1}),$(e).on("remove",function(){$($(e)[0].tooltipElement).remove()})},window.saturne.tooltip.remove=function(e){$(e)[0]&&$(e)[0].tooltipElement&&$($(e)[0].tooltipElement).remove()}),window.saturne.utils={},window.saturne.utils.init=function(){window.saturne.utils.event()},window.saturne.utils.event=function(){$(document).on("mouseenter",".move-line.ui-sortable-handle",window.saturne.utils.draganddrop),$(document).on("change","#element_type",window.saturne.utils.reloadField)},window.saturne.utils.draganddrop=function(){$(this).css("cursor","pointer"),$("#tablelines tbody").sortable(),$("#tablelines tbody").sortable({handle:".move-line",connectWith:"#tablelines tbody .line-row",tolerance:"intersect",over:function(){$(this).css("cursor","grabbing")},stop:function(){$(this).css("cursor","default");var e=$(".fiche").find('input[name="token"]').val();let t="&",n=(document.URL.match(/action=/)&&(document.URL=document.URL.split(/\?/)[0],t="?"),[]);$(".line-row").each(function(){n.push($(this).attr("id"))}),$.ajax({url:document.URL+t+"action=moveLine&token="+e,type:"POST",data:JSON.stringify({order:n}),processData:!1,contentType:!1,success:function(){},error:function(){}})}})},window.saturne.utils.reloadPage=function(e,t,n="",o=""){var a=window.saturne.toolbox.getToken(),i=window.saturne.toolbox.getQuerySeparator(document.URL);$.ajax({url:document.URL+i+"action="+e+n+"&token="+a,type:"POST",processData:!1,contentType:!1,success:function(e){window.saturne.utils.checkMoreParams(o),$(t).replaceWith($(e).find(t))},error:function(){}})},window.saturne.utils.reloadField=function(){var e=$(this).val(),t=window.saturne.toolbox.getToken(),n=window.saturne.toolbox.getQuerySeparator(document.URL);window.saturne.loader.display($(".field_element_type")),window.saturne.loader.display($(".field_fk_element")),$.ajax({url:document.URL+n+"element_type="+e+"&token="+t,type:"POST",processData:!1,contentType:!1,success:function(e){$(".field_element_type").replaceWith($(e).find(".field_element_type")),$(".field_fk_element").replaceWith($(e).find(".field_fk_element"))},error:function(){}})},window.saturne.utils.enforceMinMax=function(e){""!==e.value&&(parseInt(e.value)parseInt(e.max))&&(e.value=e.max)},window.saturne.utils.checkMoreParams=function(e){e&&e.removeAttr&&$(e.removeAttr.element).removeAttr(e.removeAttr.value)}; \ No newline at end of file +window.saturne||(window.saturne={},window.saturne.scriptsLoaded=!1),window.saturne.scriptsLoaded||(window.saturne.init=function(){window.saturne.load_list_script()},window.saturne.load_list_script=function(){if(!window.saturne.scriptsLoaded){var e=void 0,t=void 0;for(e in window.saturne)for(t in window.saturne[e].init&&window.saturne[e].init(),window.saturne[e])window.saturne[e]&&window.saturne[e][t]&&window.saturne[e][t].init&&window.saturne[e][t].init();window.saturne.scriptsLoaded=!0}},window.saturne.refresh=function(){var e=void 0,t=void 0;for(e in window.saturne)for(t in window.saturne[e].refresh&&window.saturne[e].refresh(),window.saturne[e])window.saturne[e]&&window.saturne[e][t]&&window.saturne[e][t].refresh&&window.saturne[e][t].refresh()},$(document).ready(window.saturne.init)),window.saturne.button={},window.saturne.button.init=function(){window.saturne.button.event()},window.saturne.button.event=function(){$(document).on("click",".wpeo-button:submit, .wpeo-button.auto-download",window.saturne.button.addLoader)},window.saturne.button.addLoader=function(){$(this).hasClass("no-load")||(window.saturne.loader.display($(this)),$(this).toggleClass("button-blue button-disable"))},window.saturne.dashboard={},window.saturne.dashboard.init=function(){window.saturne.dashboard.event()},window.saturne.dashboard.event=function(){$(document).on("change",".add-dashboard-widget",window.saturne.dashboard.addDashBoardInfo),$(document).on("click",".close-dashboard-widget",window.saturne.dashboard.closeDashBoardInfo),$(document).on("click",".select-dataset-dashboard-info",window.saturne.dashboard.selectDatasetDashboardInfo)},window.saturne.dashboard.addDashBoardInfo=function(){var e=document.getElementById("dashBoardForm"),e=new FormData(e).get("boxcombo"),t=window.saturne.toolbox.getToken(),n=window.saturne.toolbox.getQuerySeparator(document.URL);$.ajax({url:document.URL+n+"action=adddashboardinfo&token="+t,type:"POST",processData:!1,data:JSON.stringify({dashboardWidgetName:e}),contentType:!1,success:function(){window.location.reload()},error:function(){}})},window.saturne.dashboard.closeDashBoardInfo=function(){let t=$(this);var e=t.attr("data-widgetname"),n=window.saturne.toolbox.getToken(),o=window.saturne.toolbox.getQuerySeparator(document.URL);$.ajax({url:document.URL+o+"action=closedashboardinfo&token="+n,type:"POST",processData:!1,data:JSON.stringify({dashboardWidgetName:e}),contentType:!1,success:function(e){t.closest(".box-flex-item").fadeOut(400),$(".add-widget-box").attr("style",""),$(".add-widget-box").html($(e).find(".add-widget-box").children())},error:function(){}})},window.saturne.dashboard.selectDatasetDashboardInfo=function(){var e=$("#search_userid").val(),t=$("#search_year").val(),n=$("#search_month").val(),o=window.saturne.toolbox.getToken(),a=window.saturne.toolbox.getQuerySeparator(document.URL);window.saturne.loader.display($(".fichecenter")),$.ajax({url:document.URL+a+"token="+o+"&search_userid="+e+"&search_year="+t+"&search_month="+n,type:"POST",processData:!1,contentType:!1,success:function(e){$(".fichecenter").replaceWith($(e).find(".fichecenter"))},error:function(){}})},window.saturne.document={},window.saturne.document.init=function(){window.saturne.document.event()},window.saturne.document.event=function(){$(document).on("click","#builddoc_generatebutton",window.saturne.document.displayLoader),$(document).on("click",".pdf-generation",window.saturne.document.displayLoader),$(document).on("click",".download-template",window.saturne.document.autoDownloadTemplate),$(document).on("keydown","#change_pagination",window.saturne.document.changePagination)},window.saturne.document.displayLoader=function(){window.saturne.loader.display($(this).closest(".div-table-responsive-no-min"))},window.saturne.document.autoDownloadTemplate=function(){let t=window.saturne.toolbox.getToken();var e=document.URL.replace(/#.*$/,"");let n=window.saturne.toolbox.getQuerySeparator(e),o=$(this).closest(".file-generation");var a=o.find(".template-type").attr("value");let i=o.find(".template-name").attr("value");$.ajax({url:e+n+"action=download_template&filename="+i+"&type="+a+"&token="+t,type:"POST",success:function(){var e=o.find(".template-path").attr("value");window.saturne.signature.download(e+i,i),$.ajax({url:document.URL+n+"action=remove_file&filename="+i+"&token="+t,type:"POST",success:function(){},error:function(){}})},error:function(){}})},window.saturne.document.changePagination=function(e){var t;13===e.keyCode&&(e.preventDefault(),e=e.target,t=$("#page_number").val(),e=parseInt(e.value)<=parseInt(t)?e.value:t,(t=new URL(window.location.href)).searchParams.has("page")?t.searchParams.set("page",e):t.searchParams.append("page",e),window.location.replace(t.toString()))},window.saturne.dropdown={},window.saturne.dropdown.init=function(){window.saturne.dropdown.event()},window.saturne.dropdown.event=function(){$(document).on("keyup",window.saturne.dropdown.keyup),$(document).on("keypress",window.saturne.dropdown.keypress),$(document).on("click",".wpeo-dropdown:not(.dropdown-active) .dropdown-toggle:not(.disabled)",window.saturne.dropdown.open),$(document).on("click",".wpeo-dropdown.dropdown-active .saturne-dropdown-content",function(e){e.stopPropagation()}),$(document).on("click",".wpeo-dropdown.dropdown-active:not(.dropdown-force-display) .saturne-dropdown-content .dropdown-item",window.saturne.dropdown.close),$(document).on("click",".wpeo-dropdown.dropdown-active",function(e){window.saturne.dropdown.close(e),e.stopPropagation()}),$(document).on("click","body",window.saturne.dropdown.close)},window.saturne.dropdown.keyup=function(e){27===e.keyCode&&window.saturne.dropdown.close()},window.saturne.dropdown.keypress=function(e){var t=localStorage.currentString||"",n=localStorage.keypressNumber?+localStorage.keypressNumber:0;t+=e.keyCode,++n,localStorage.setItem("currentString",t),localStorage.setItem("keypressNumber",n),9body{"+e+n+e+t+n+t)},window.saturne.dropdown.open=function(e){var n=$(this),o=n.find("[data-fa-i2svg]"),t={},a=void 0;window.saturne.dropdown.close(e,$(this)),n.attr("data-action")?(window.saturne.loader.display(n),n.get_data(function(e){for(a in t)e[a]||(e[a]=t[a]);window.saturne.request.send(n,e,function(e,t){n.closest(".wpeo-dropdown").find(".saturne-dropdown-content").html(t.data.view),n.closest(".wpeo-dropdown").addClass("dropdown-active"),o&&window.saturne.dropdown.toggleAngleClass(o)})})):(n.closest(".wpeo-dropdown").addClass("dropdown-active"),o&&window.saturne.dropdown.toggleAngleClass(o)),e.stopPropagation()},window.saturne.dropdown.close=function(e){var n=$(this);$(".wpeo-dropdown.dropdown-active:not(.no-close)").each(function(){var e=$(this),t={close:!0};n.trigger("dropdown-before-close",[e,n,t]),t.close&&(e.removeClass("dropdown-active"),t=$(this).find(".dropdown-toggle").find("[data-fa-i2svg]"))&&window.saturne.dropdown.toggleAngleClass(t)})},window.saturne.dropdown.toggleAngleClass=function(e){e.hasClass("fa-caret-down")||e.hasClass("fa-caret-up")?e.toggleClass("fa-caret-down").toggleClass("fa-caret-up"):e.hasClass("fa-caret-circle-down")||e.hasClass("fa-caret-circle-up")?e.toggleClass("fa-caret-circle-down").toggleClass("fa-caret-circle-up"):e.hasClass("fa-angle-down")||e.hasClass("fa-angle-up")?e.toggleClass("fa-angle-down").toggleClass("fa-angle-up"):(e.hasClass("fa-chevron-circle-down")||e.hasClass("fa-chevron-circle-up"))&&e.toggleClass("fa-chevron-circle-down").toggleClass("fa-chevron-circle-up")},window.saturne.keyEvent={},window.saturne.keyEvent.init=function(){window.saturne.keyEvent.event()},window.saturne.keyEvent.event=function(){$(document).on("keydown",window.saturne.keyEvent.keyActions),$(document).on("keyup",".url-container",window.saturne.keyEvent.checkUrlFormat)},window.saturne.keyEvent.keyActions=function(e){0<$(this).find(".modal-active").length?("Escape"===e.key&&$(this).find(".modal-active .modal-close .fas.fa-times").first().click(),"Enter"!==e.key||$("input, textarea").is(":focus")||$(this).find(".modal-active .modal-footer .wpeo-button").not(".button-disable").first().click()):$(e.target).is("input, textarea")||("Enter"===e.key&&$(this).find(".button_search").click(),e.shiftKey&&"Enter"===e.key&&$(this).find(".button_removefilter").click())},window.saturne.keyEvent.checkUrlFormat=function(){$(this).val().match(/[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)?/gi)?$(this).attr("style","border: solid; border-color: green"):0<$("input:focus").val().length&&$(this).attr("style","border: solid; border-color: red")},window.saturne.loader={},window.saturne.loader.init=function(){window.saturne.loader.event()},window.saturne.loader.event=function(){},window.saturne.loader.display=function(e){var t;e.hasClass("button-progress")?e.addClass("button-load"):(e.addClass("wpeo-loader"),t=$(''),e[0].loaderElement=t,e.append(e[0].loaderElement))},window.saturne.loader.remove=function(e){0"),i===a&&($(".wpeo-loader").removeClass("wpeo-loader"),$("#progressBarContainer").fadeOut(800),$("#progressBarContainer").find(".loader-spin").remove(),window.saturne.loader.display(o.find(".ecm-photo-list-content")),setTimeout(()=>{o.html($(e).find("#media_gallery").children()).promise().done(()=>{1==a&&($("#media_gallery").find(".save-photo").removeClass("button-disable"),$("#media_gallery").find(".delete-photo").removeClass("button-disable"),$("#media_gallery").find(".clickable-photo0").addClass("clicked-photo")),($(e).find(".error-medias").length?($(".messageErrorSendPhoto").find(".notice-subtitle").html(m),$(".messageErrorSendPhoto")):$(".messageSuccessSendPhoto")).removeClass("hidden"),o.attr("data-from-id",r),o.attr("data-from-type",s),o.attr("data-from-subtype",l),o.attr("data-from-subdir",c),o.find(".wpeo-button").attr("value",r)})},800))}})})},window.saturne.mediaGallery.previewPhoto=function(e){var t=setInterval(function(){$(".ui-dialog").length&&(clearInterval(t),$(document).find(".ui-dialog").addClass("preview-photo"))},100)},window.saturne.mediaGallery.unlinkFile=function(e){e.preventDefault();let t=window.saturne.toolbox.getToken();var e=$(this).closest(".modal-active"),n=0<$(this).closest(".modal-active").length;let o=null,a=(o=(n?e:$(this).closest(".linked-medias")).find(".modal-options")).attr("data-from-subtype"),i=o.attr("data-from-type"),d=o.attr("data-from-subdir"),r=o.attr("data-from-id"),s=o.attr("data-photo-class");n=$(this).closest(".media-container");let l=n.find(".file-path").val(),c=n.find(".file-name").val(),u=$(this).closest(".linked-medias").find(".media-gallery-favorite.favorite").closest(".media-container").find(".file-name").val(),w=(window.saturne.loader.display(n),window.saturne.toolbox.getQuerySeparator(document.URL));$(".card__confirmation").css("display","flex"),$(document).on("click",".confirmation-close",function(){$(".wpeo-loader").removeClass("wpeo-loader"),$(".card__confirmation").css("display","none")}),$(document).on("click",".confirmation-delete",function(){$.ajax({url:document.URL+w+"subaction=unlinkFile&token="+t,type:"POST",data:JSON.stringify({filepath:l,filename:c,objectSubtype:a,objectType:i,objectSubdir:d,objectId:r}),processData:!1,success:function(e){$(".card__confirmation").css("display","none"),$("#media_gallery .modal-container").replaceWith($(e).find("#media_gallery .modal-container")),u==c&&(void 0!==s&&0"))[1].match(/>/)&&(n[1]=n[1].replace(/>/,"")),$(this).attr("title",n[1]),$(this).html(n[0])}),t.css("width","30px"),t.find(".blockvmenusearch").hide(),$("span.vmenu").attr("title"," Agrandir le menu"),$("span.vmenu").html($("span.vmenu").html()),$(this).find("span.vmenu").find(".fa-chevron-circle-left").removeClass("fa-chevron-circle-left").addClass("fa-chevron-circle-right"),localStorage.setItem("maximized","false")):0<$(this).find("span.vmenu").find(".fa-chevron-circle-right").length&&(e.each(function(){$(this).html($(this).html().replace(">","")+" "+$(this).attr("title"))}),t.css("width","188px"),t.find(".blockvmenusearch").show(),$("div.menu_titre").attr("style","width: 188px !important; cursor : pointer"),$("span.vmenu").attr("title"," Réduire le menu"),$("span.vmenu").html(' Réduire le menu'),localStorage.setItem("maximized","true"),$(this).find("span.vmenu").find(".fa-chevron-circle-right").removeClass("fa-chevron-circle-right").addClass("fa-chevron-circle-left"))},window.saturne.menu.setMenu=function(){var e,t,n;0<$(".blockvmenu.blockvmenulast .saturne-toggle-menu").length&&($(".blockvmenu.blockvmenulast .saturne-toggle-menu").closest(".menu_titre").attr("style","cursor:pointer ! important"),"false"==localStorage.maximized&&$("#id-left").attr("style","display:none !important"),"false"==localStorage.maximized&&(e="",t=$("#id-left").find("a.vmenu, span.vmenudisabled, span.vmenu, a.vsmenu"),n=$(document).find("div.vmenu"),t.each(function(){e=$(this).html().split(""),$(this).attr("title",e[1]),$(this).html(e[0]),console.log(e)}),$("#id-left").attr("style","display:block !important"),$("div.menu_titre").attr("style","width: 50px !important"),$("span.vmenu").attr("title"," Agrandir le menu"),$("span.vmenu").html($("span.vmenu").html()),$("span.vmenu").find(".fa-chevron-circle-left").removeClass("fa-chevron-circle-left").addClass("fa-chevron-circle-right"),n.css("width","30px"),n.find(".blockvmenusearch").hide()),localStorage.setItem("currentString",""),localStorage.setItem("keypressNumber",0))},window.saturne.modal={},window.saturne.modal.init=function(){window.saturne.modal.event()},window.saturne.modal.event=function(){$(document).on("click",".modal-close, .modal-active:not(.modal-container)",window.saturne.modal.closeModal),$(document).on("click",".modal-open",window.saturne.modal.openModal),$(document).on("click",".modal-refresh",window.saturne.modal.refreshModal)},window.saturne.modal.openModal=function(e){var t=$(this).find(".modal-options"),n=t.attr("data-modal-to-open"),o=t.attr("data-from-id"),a=t.attr("data-from-type"),i=t.attr("data-from-subtype"),d=t.attr("data-from-subdir"),r=t.attr("data-from-module"),t=t.attr("data-photo-class");let s="";s=document.URL.match(/#/)?document.URL.split(/#/)[0]:document.URL,history.pushState({path:document.URL},"",s),$("#"+n).attr("data-from-id",o),$("#"+n).attr("data-from-type",a),$("#"+n).attr("data-from-subtype",i),$("#"+n).attr("data-from-subdir",d),$("#"+n).attr("data-photo-class",t),r&&"function"==typeof window.saturne.modal.addMoreOpenModalData&&window.saturne.modal.addMoreOpenModalData(n,$(this)),$("#"+n).find(".wpeo-button").attr("value",o),$("#"+n).addClass("modal-active"),$(".notice").addClass("hidden")},window.saturne.modal.closeModal=function(e){$("input:focus").length<1&&$("textarea:focus").length<1&&($(e.target).hasClass("modal-active")||$(e.target).hasClass("modal-close")||$(e.target).parent().hasClass("modal-close"))&&($(this).closest(".modal-active").removeClass("modal-active"),$(".clicked-photo").attr("style",""),$(".clicked-photo").removeClass("clicked-photo"),$(".notice").addClass("hidden"))},window.saturne.modal.refreshModal=function(e){window.location.reload()},window.saturne.notice={},window.saturne.notice.init=function(){window.saturne.notice.event()},window.saturne.notice.event=function(){$(document).on("click",".notice-close",window.saturne.notice.closeNotice)},window.saturne.notice.closeNotice=function(){$(this).closest(".wpeo-notice").fadeOut(function(){$(this).closest(".wpeo-notice").addClass("hidden")}),$(this).hasClass("notice-close-forever")&&window.saturne.utils.reloadPage("close_notice",".fiche")},window.saturne.object={},window.saturne.object.init=function(){window.saturne.object.event()},window.saturne.object.event=function(){$(document).on("click",".toggle-object-infos",window.saturne.object.toggleObjectInfos)},window.saturne.object.toggleObjectInfos=function(){$(this).hasClass("fa-minus-square")?($(this).removeClass("fa-minus-square").addClass("fa-caret-square-down"),$(this).closest(".fiche").find(".fichecenter.object-infos").addClass("hidden")):($(this).removeClass("fa-caret-square-down").addClass("fa-minus-square"),$(this).closest(".fiche").find(".fichecenter.object-infos").removeClass("hidden"))},window.saturne.signature={},window.saturne.signature.canvas={},window.saturne.signature.init=function(){window.saturne.signature.event()},window.saturne.signature.event=function(){$(document).on("click",".signature-erase",window.saturne.signature.clearCanvas),$(document).on("click",".signature-validate:not(.button-disable)",window.saturne.signature.createSignature),$(document).on("click",".auto-download",window.saturne.signature.autoDownloadSpecimen),$(document).on("click",".copy-signatureurl",window.saturne.signature.copySignatureUrlClipboard),$(document).on("click",".set-attendance",window.saturne.signature.setAttendance),document.querySelector('script[src*="signature-pad.min.js"]')&&window.saturne.signature.drawSignatureOnCanvas(),$(document).on("touchstart mousedown",".canvas-signature",function(){window.saturne.toolbox.removeAddButtonClass("signature-validate","button-grey button-disable","button-blue")})},window.saturne.signature.drawSignatureOnCanvas=function(){var e;window.saturne.signature.canvas=document.querySelector(".canvas-signature"),window.saturne.signature.canvas&&(e=Math.max(window.devicePixelRatio||1,1),window.saturne.signature.canvas.signaturePad=new SignaturePad(window.saturne.signature.canvas,{penColor:"rgb(0, 0, 0)"}),window.saturne.signature.canvas.width=window.saturne.signature.canvas.offsetWidth*e,window.saturne.signature.canvas.height=window.saturne.signature.canvas.offsetHeight*e,window.saturne.signature.canvas.getContext("2d").scale(e,e))},window.saturne.signature.clearCanvas=function(){window.saturne.signature.canvas.signaturePad.clear(),window.saturne.toolbox.removeAddButtonClass("signature-validate","button-blue","button-grey button-disable")},window.saturne.signature.createSignature=function(){var e,t=window.saturne.toolbox.getToken(),n=window.saturne.toolbox.getQuerySeparator(document.URL);window.saturne.signature.canvas.signaturePad.isEmpty()||(e=window.saturne.signature.canvas.toDataURL()),window.saturne.loader.display($(this)),$.ajax({url:document.URL+n+"action=add_signature&token="+t,type:"POST",processData:!1,contentType:"application/octet-stream",data:JSON.stringify({signature:e}),success:function(e){!0===$(".public-card__container").data("public-interface")?($(".card__confirmation").removeAttr("style"),$(".signature-confirmation-close").attr("onclick","window.close()"),$(".public-card__container").replaceWith($(e).find(".public-card__container"))):window.location.reload()},error:function(){}})},window.saturne.signature.download=function(e,t){var n=document.createElement("a");n.href=e,n.setAttribute("download",t),n.click()},window.saturne.signature.autoDownloadSpecimen=function(){let o=$(this).closest(".file-generation"),a=window.saturne.toolbox.getToken(),i=window.saturne.toolbox.getQuerySeparator(document.URL);$.ajax({url:document.URL+i+"action=builddoc&token="+a,type:"POST",success:function(e){var t=o.find(".specimen-name").attr("data-specimen-name"),n=o.find(".specimen-path").attr("data-specimen-path");window.saturne.signature.download(n+t,t),$(".file-generation").replaceWith($(e).find(".file-generation")),$.ajax({url:document.URL+i+"action=remove_file&token="+a,type:"POST",success:function(){},error:function(){}})},error:function(){}})},window.saturne.signature.copySignatureUrlClipboard=function(){var e=$(this).attr("data-signature-url");navigator.clipboard.writeText(e).then(()=>{$(this).attr("class","fas fa-check copy-signatureurl"),$(this).css("color","#59ed9c"),$(this).closest(".copy-signatureurl-container").find(".copied-to-clipboard").attr("style",""),$(this).closest(".copy-signatureurl-container").find(".copied-to-clipboard").fadeOut(2500,()=>{$(this).attr("class","fas fa-clipboard copy-signatureurl"),$(this).css("color","#666")})})},window.saturne.signature.setAttendance=function(){var e=$(this).closest(".attendance-container").find('input[name="signatoryID"]').val(),t=$(this).attr("value"),n=window.saturne.toolbox.getToken(),o=window.saturne.toolbox.getQuerySeparator(document.URL),a=String(document.location.href).replace(/#formmail/,"");$.ajax({url:a+o+"action=set_attendance&token="+n,type:"POST",processData:!1,contentType:"",data:JSON.stringify({signatoryID:e,attendance:t}),success:function(e){$(".signatures-container").html($(e).find(".signatures-container"))},error:function(){}})},window.saturne.toolbox={},window.saturne.toolbox.init=function(){},window.saturne.toolbox.getQuerySeparator=function(e){return e.match(/\?/)?"&":"?"},window.saturne.toolbox.getToken=function(){return $('input[name="token"]').val()},window.saturne.toolbox.toggleButtonClass=function(e,t){$("."+e).toggleClass(t)},window.saturne.toolbox.removeAddButtonClass=function(e,t,n){$("."+e).removeClass(t).addClass(n)},window.saturne.tooltip||(window.saturne.tooltip={},window.saturne.tooltip.init=function(){window.saturne.tooltip.event()},window.saturne.tooltip.tabChanged=function(){$(".wpeo-tooltip").remove()},window.saturne.tooltip.event=function(){$(document).on("mouseenter touchstart",'.wpeo-tooltip-event:not([data-tooltip-persist="true"])',window.saturne.tooltip.onEnter),$(document).on("mouseleave touchend",'.wpeo-tooltip-event:not([data-tooltip-persist="true"])',window.saturne.tooltip.onOut)},window.saturne.tooltip.onEnter=function(e){window.saturne.tooltip.display($(this))},window.saturne.tooltip.onOut=function(e){window.saturne.tooltip.remove($(this))},window.saturne.tooltip.display=function(e){var t=$(e).data("direction")?$(e).data("direction"):"top",n=$(''+$(e).attr("aria-label")+""),o=($(e).position(),$(e).offset()),a=($(e)[0].tooltipElement=n,$("body").append($(e)[0].tooltipElement),$(e).data("color")&&n.addClass("tooltip-"+$(e).data("color")),0),i=0;switch($(e).data("direction")){case"left":a=o.top-n.outerHeight()/2+$(e).outerHeight()/2+"px",i=o.left-n.outerWidth()-10+3+"px";break;case"right":a=o.top-n.outerHeight()/2+$(e).outerHeight()/2+"px",i=o.left+$(e).outerWidth()+8+"px";break;case"bottom":a=o.top+$(e).height()+10+10+"px",i=o.left-n.outerWidth()/2+$(e).outerWidth()/2+"px";break;default:a=o.top-n.outerHeight()-4+"px",i=o.left-n.outerWidth()/2+$(e).outerWidth()/2+"px"}n.css({top:a,left:i,opacity:1}),$(e).on("remove",function(){$($(e)[0].tooltipElement).remove()})},window.saturne.tooltip.remove=function(e){$(e)[0]&&$(e)[0].tooltipElement&&$($(e)[0].tooltipElement).remove()}),window.saturne.utils={},window.saturne.utils.init=function(){window.saturne.utils.event()},window.saturne.utils.event=function(){$(document).on("mouseenter",".move-line.ui-sortable-handle",window.saturne.utils.draganddrop),$(document).on("change","#element_type",window.saturne.utils.reloadField)},window.saturne.utils.draganddrop=function(){$(this).css("cursor","pointer"),$("#tablelines tbody").sortable(),$("#tablelines tbody").sortable({handle:".move-line",connectWith:"#tablelines tbody .line-row",tolerance:"intersect",over:function(){$(this).css("cursor","grabbing")},stop:function(){$(this).css("cursor","default");var e=$(".fiche").find('input[name="token"]').val();let t="&",n=(document.URL.match(/action=/)&&(document.URL=document.URL.split(/\?/)[0],t="?"),[]);$(".line-row").each(function(){n.push($(this).attr("id"))}),$.ajax({url:document.URL+t+"action=moveLine&token="+e,type:"POST",data:JSON.stringify({order:n}),processData:!1,contentType:!1,success:function(){},error:function(){}})}})},window.saturne.utils.reloadPage=function(e,t,n="",o=""){var a=window.saturne.toolbox.getToken(),i=window.saturne.toolbox.getQuerySeparator(document.URL);$.ajax({url:document.URL+i+"action="+e+n+"&token="+a,type:"POST",processData:!1,contentType:!1,success:function(e){window.saturne.utils.checkMoreParams(o),$(t).replaceWith($(e).find(t))},error:function(){}})},window.saturne.utils.reloadField=function(){var e=$(this).val(),t=window.saturne.toolbox.getToken(),n=window.saturne.toolbox.getQuerySeparator(document.URL);window.saturne.loader.display($(".field_element_type")),window.saturne.loader.display($(".field_fk_element")),$.ajax({url:document.URL+n+"element_type="+e+"&token="+t,type:"POST",processData:!1,contentType:!1,success:function(e){$(".field_element_type").replaceWith($(e).find(".field_element_type")),$(".field_fk_element").replaceWith($(e).find(".field_fk_element"))},error:function(){}})},window.saturne.utils.enforceMinMax=function(e){""!==e.value&&(parseInt(e.value)parseInt(e.max))&&(e.value=e.max)},window.saturne.utils.checkMoreParams=function(e){e&&e.removeAttr&&$(e.removeAttr.element).removeAttr(e.removeAttr.value)}; \ No newline at end of file diff --git a/lib/documents.lib.php b/lib/documents.lib.php index 22b67b46..42c0e2c6 100644 --- a/lib/documents.lib.php +++ b/lib/documents.lib.php @@ -94,7 +94,22 @@ function saturne_show_documents(string $modulepart, $modulesubdir, $filedir, str } else { $fileList = dol_dir_list($filedir, 'files', 0, '(\.jpg|\.jpeg|\.png|\.odt|\.zip|\.pdf)', '', 'date', SORT_DESC, 1); } - } + } + + $fileList = dol_sort_array($fileList, $sortfield, $sortorder); + + $page = GETPOST('page', 'int') ?: 1; + $filePerPage = 20; + $fileListLength = 0; + if (is_array($fileList) && !empty($fileList)) { + $fileListLength = count($fileList); + } + + if ($fileListLength > $filePerPage) { + $fileList = array_slice($fileList, ($page - 1 ) * $filePerPage, $filePerPage); + } + + $pageNumber = ceil($fileListLength / $filePerPage); if ($hideifempty && empty($fileList)) { return ''; @@ -234,6 +249,20 @@ function saturne_show_documents(string $modulepart, $modulesubdir, $filedir, str $genbutton = ''; } $out .= $genbutton; + $querySeparator = (strpos($_SERVER['REQUEST_URI'], '?') === false) ? '?' : '&'; + + $out .= ''; } else { $out .= '
' . $langs->trans('Files') . '
'; } @@ -297,7 +326,6 @@ function saturne_show_documents(string $modulepart, $modulesubdir, $filedir, str $out .= '
'; $out .= '' . "\n"; } - $fileList = dol_sort_array($fileList, $sortfield, $sortorder); // Loop on each file found if (is_array($fileList)) { @@ -442,9 +470,10 @@ function saturne_show_documents(string $modulepart, $modulesubdir, $filedir, str function get_document_title_field(string $sortfield, string $sortorder, string $name, bool $sortable = true, string $morehtml = ''): string { global $langs; + $querySeparator = (strpos($_SERVER['PHP_SELF'], '?') === false) ? '?' : '&'; $out = '
'; if ($sortable) { - $out .= ''; + $out .= ''; $out .= ($sortfield == strtolower($name) ? '' : ''); } $out .= $langs->trans($name);