| Current Path : /home/h/a/p/happyrenas/myreco.online/administration/gestion/oldjs/ |
Linux webd005.cluster105.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 |
| Current File : /home/h/a/p/happyrenas/myreco.online/administration/gestion/oldjs/dropzone.js |
"use strict";
// Class definition
var KTDropzoneDemo = function () {
// Private functions
var demo1 = function () {
var forcage_nom = $('#forcage_nom').val();
var incrementer = $('#incrementer').val();
var acceptedFiles = $('#acceptedFiles').val();
var reload = $('#reload').val();
var reloaddiv = $('#reloaddiv').val();
var document_path1 = $('#document_path1').val();
var document_path2 = $('#document_path2').val();
var document_path3 = $('#document_path3').val();
var myDropzone5 = new Dropzone("#kt_dropzone_2", {
url: "upload.php",
parallelUploads: 5,
acceptedFiles:acceptedFiles,
//paramName: "file",
maxFiles: 10,
success: function(file, response){
var json = JSON.parse(response);
if (json["reload"]=='oui' && this.getQueuedFiles().length == 0 && this.getUploadingFiles().length == 0) {
var url = window.location.href;
var is_interrogation= url.indexOf('?');
var is_parametre = url.indexOf('&');
var is_diese = url.indexOf('#');
var interrogation="";
if (is_interrogation == -1 ) {var interrogation="?";}
if (is_parametre == -1 && is_diese == -1)
{
console.log("cas1");
var url_propre=url.split("&")[0];
window.location.href = url_propre+ interrogation+ "&miseajour=1#upload";
return false;
}
if (is_parametre != -1 && is_diese == -1)
{
console.log("cas2");
var url_propre=url.split("&")[0];
window.location="#upload";
window.location.reload();
return false;
}
if (is_parametre == -1 && is_diese != -1)
{
console.log("cas3");
var url_propre=url.split("#")[0];
window.location.href = url_propre+ interrogation+"&miseajour=1#upload";
return false;
}
if (is_parametre != -1 && is_diese != -1)
{
console.log("cas4");
var url_propre=url.split("&")[0];
console.log(url_propre);
window.location.hash += '&miseajour=1#upload';
window.location.reload();
return false;
}
}
if (json["reloaddiv"]=='oui' && this.getQueuedFiles().length == 0 && this.getUploadingFiles().length == 0) {
console.log("passe1");
console.log(response);
var encoded = encodeURIComponent(json["target_dir"]);
$('.blocdossierdetail').find('.detail').load("bibliotheque_dossier.php?dossier="+encoded);
}
},
params: {'forcage_nom':forcage_nom,'incrementer':incrementer,'reload':reload,'reloaddiv':reloaddiv, 'document_path1':document_path1, 'document_path2':document_path2, 'document_path3':document_path3 },
maxFilesize: 10,
addRemoveLinks: true,
});
}
var demo3 = function () {
// set the dropzone container id
var id = '#dropzone_bouton';
var forcage_nom = $('#forcage_nom').val();
var incrementer = $('#incrementer').val();
var acceptedFiles = $('#acceptedFiles').val();
var reload = $('#reload').val();
var reloaddiv = $('#reloaddiv').val();
var document_path1 = $('#document_path1').val();
var document_path2 = $('#document_path2').val();
var document_path3 = $('#document_path3').val();
// set the preview element template
var previewNode = $(id + " .dropzone-item");
previewNode.id = "";
var previewTemplate = previewNode.parent('.dropzone-items').html();
previewNode.remove();
var myDropzone5 = new Dropzone(id, { // Make the whole body a dropzone
url: "upload.php", // Set the url for your upload script location
parallelUploads: 20,
acceptedFiles:acceptedFiles,
success: function(file, response){
var json = JSON.parse(response);
//console.log(response);
if (json["reload"]=='oui' && this.getQueuedFiles().length == 0 && this.getUploadingFiles().length == 0) {
var url = window.location.href;
var is_parametre = url.indexOf('&');
var is_diese = url.indexOf('#');
if (is_parametre == -1 && is_diese == -1)
{
console.log("cas1");
var url_propre=url.split("&")[0];
window.location.href = url_propre+ "&miseajour=1#upload";
return false;
}
if (is_parametre != -1 && is_diese == -1)
{
console.log("cas2");
var url_propre=url.split("&")[0];
window.location="#upload";
window.location.reload();
return false;
}
if (is_parametre == -1 && is_diese != -1)
{
console.log("cas3");
var url_propre=url.split("#")[0];
window.location.href = url_propre+ "&miseajour=1#upload";
return false;
}
if (is_parametre != -1 && is_diese != -1)
{
console.log("cas4");
var url_propre=url.split("&")[0];
console.log(url_propre);
window.location.hash = '#upload';
window.location.reload();
return false;
}
}
},
params: {'forcage_nom':forcage_nom,'incrementer':incrementer,'reload':reload, 'reloaddiv':reloaddiv,'document_path1':document_path1, 'document_path2':document_path2, 'document_path3':document_path3 },
maxFilesize: 1, // Max filesize in MB
previewTemplate: previewTemplate,
previewsContainer: id + " .dropzone-items", // Define the container to display the previews
clickable: id + " .dropzone-select" // Define the element that should be used as click trigger to select files.
});
myDropzone5.on("addedfile", function(file) {
// Hookup the start button
$(document).find( id + ' .dropzone-item').css('display', '');
});
// Update the total progress bar
myDropzone5.on("totaluploadprogress", function(progress) {
$( id + " .progress-bar").css('width', progress + "%");
});
myDropzone5.on("sending", function(file) {
// Show the total progress bar when upload starts
$( id + " .progress-bar").css('opacity', "1");
});
// Hide the total progress bar when nothing's uploading anymore
myDropzone5.on("complete", function(progress) {
console.log("");
var thisProgressBar = id + " .dz-complete";
setTimeout(function(){
$( thisProgressBar + " .progress-bar, " + thisProgressBar + " .progress").css('opacity', '0');
}, 300)
});
}
return {
// public functions
init: function() {
demo1();
//demo3();
}
};
}();
KTUtil.ready(function() {
KTDropzoneDemo.init();
});