176 lines
5.8 KiB
JavaScript
Executable File
176 lines
5.8 KiB
JavaScript
Executable File
var xMousePosition = 0;
|
|
var yMousePosition = 0;
|
|
|
|
document.onmousemove = function(e){
|
|
xMousePosition = e.clientX + window.pageXOffset + 200;
|
|
yMousePosition = e.clientY + window.pageYOffset;
|
|
};
|
|
|
|
function addF(element){
|
|
// alert("ajout");
|
|
window.self.location='./frmModale.php?affModale=82-1';
|
|
}
|
|
|
|
function modifF(element,idFam){
|
|
// alert(idFam);
|
|
window.self.location='./frmAdmin.php?affAdmin=8&affCat=2&idFam='+idFam;
|
|
}
|
|
|
|
function desactiveF(element,idFam){
|
|
// alert("desactiver");
|
|
window.self.location='./frmModale.php?affModale=82-3&idFam='+idFam;
|
|
}
|
|
|
|
function styleF(element){
|
|
alert("styleF");
|
|
window.self.location='./frmAdmin.php?affAdmin=3&theVoletCss=Menu familles&theNumCss=7';
|
|
}
|
|
|
|
function menuContFam(element,idFam, event){
|
|
var x = document.getElementById('fam');
|
|
var d = document.createElement('div');
|
|
|
|
if(element.parentNode) d.onclick = function(e) { element.parentNode.removeChild(d); }
|
|
document.body.onclick = function(e) { try{ element.parentNode.removeChild(d); } finally{} }
|
|
|
|
// ---------------------------------------------------
|
|
// ne pas ouvrir plusieur à ma fois si parents
|
|
// ---------------------------------------------------
|
|
if (event) {
|
|
event.stopPropagation(); // ← Arrête la propagation vers les parents
|
|
event.preventDefault(); // ← Optionnel : bloque le menu natif
|
|
}
|
|
|
|
d.setAttribute('class', 'mContextMenu');
|
|
d.setAttribute('id', 'fam');
|
|
element.parentNode.appendChild(d);
|
|
d.style.left = "400px";
|
|
// alert(xMousePosition);
|
|
//d.style.left = xMousePosition + "px";
|
|
d.style.top = yMousePosition +20+ "px";
|
|
d.onmouseover = function(e) { this.style.cursor = 'pointer'; }
|
|
d.onclick = function(e) { element.parentNode.removeChild(d); }
|
|
document.body.onclick = function(e) { element.parentNode.removeChild(d); }
|
|
|
|
var p = document.createElement('p');
|
|
d.appendChild(p);
|
|
p.onclick=function() { addF(element) };
|
|
p.setAttribute('class', 'mContextItem');
|
|
p.innerHTML = "Ajouter une catégorie";
|
|
|
|
var p1 = document.createElement('p1');
|
|
d.appendChild(p1);
|
|
p1.onclick=function() { modifF(element,idFam) };
|
|
p1.setAttribute('class', 'mContextItem');
|
|
p1.innerHTML = "Modifier la catégorie<br>";
|
|
// return false;
|
|
|
|
var p2 = document.createElement('p2');
|
|
d.appendChild(p2);
|
|
p2.onclick=function() { desactiveF(element,idFam) };
|
|
p2.setAttribute('class', 'mContextItem');
|
|
p2.innerHTML = "Désactiver / supprimer la catégorie<br>";
|
|
// return false;
|
|
|
|
var p3 = document.createElement('p3');
|
|
d.appendChild(p3);
|
|
p3.onclick=function() { styleF(element) };
|
|
p3.setAttribute('class', 'mContextItem');
|
|
p3.innerHTML = "Gérer le style";
|
|
|
|
return false;
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Categories
|
|
// ---------------------------------------------------
|
|
|
|
function addC(element){
|
|
// alert("ajout");
|
|
window.self.location='./frmModale.php?affModale=82-5';
|
|
}
|
|
|
|
function modifC(element,idTypePrd,idFam){
|
|
// var idTypePrd= document.getElementById('idTypePrd').value;
|
|
// alert(idFam);
|
|
window.self.location='./frmAdmin.php?affAdmin=8&affCat=2&idTypePrd='+idTypePrd+'&idFam='+idFam;
|
|
}
|
|
|
|
function desactiveC(element,idTypePrd){
|
|
// alert("desactiver");
|
|
// var idTypePrd= document.getElementById('idTypePrd').value;
|
|
window.self.location='./frmModale.php?affModale=82-7&idCat='+idTypePrd;
|
|
}
|
|
|
|
function styleC(element){
|
|
// alert("style");
|
|
window.self.location='./frmAdmin.php?affAdmin=3&theVoletCss=Menu catégories&theNumCss=4';
|
|
}
|
|
|
|
function menuContCat(element,idTypePrd,idFam, event){
|
|
var x = document.getElementById('fam');
|
|
// if (x) x.parentNode.removeChild(x);
|
|
// alert('idTypePrd='+idTypePrd);
|
|
// alert('idFam='+idFam);
|
|
|
|
|
|
var d = document.createElement('div');
|
|
d.setAttribute('class', 'mContextMenu');
|
|
d.setAttribute('id', 'fam');
|
|
element.parentNode.appendChild(d);
|
|
d.style.left = "400px";
|
|
// alert(xMousePosition);
|
|
//d.style.left = xMousePosition-50 + "px";
|
|
d.style.top = yMousePosition +20+ "px";
|
|
d.onmouseover = function(e) { this.style.cursor = 'pointer'; }
|
|
d.onclick = function(e) { element.parentNode.removeChild(d); }
|
|
document.body.onclick = function(e) { element.parentNode.removeChild(d); }
|
|
|
|
var p = document.createElement('p');
|
|
d.appendChild(p);
|
|
p.onclick=function() { addC(element) };
|
|
p.setAttribute('class', 'mContextItem');
|
|
p.innerHTML = "Ajouter une sous-catégorie";
|
|
|
|
var p1 = document.createElement('p1');
|
|
d.appendChild(p1);
|
|
p1.onclick=function() { modifC(element,idTypePrd,idFam) };
|
|
p1.setAttribute('class', 'mContextItem');
|
|
p1.innerHTML = "Modifier la sous-catégorie<br>";
|
|
// return false;
|
|
|
|
var p2 = document.createElement('p2');
|
|
d.appendChild(p2);
|
|
p2.onclick=function() { desactiveC(element,idTypePrd) };
|
|
p2.setAttribute('class', 'mContextItem');
|
|
p2.innerHTML = "Désactiver / supprimer la sous-catégorie<br>";
|
|
// return false;
|
|
|
|
var p3 = document.createElement('p3');
|
|
d.appendChild(p3);
|
|
p3.onclick=function() { styleC(element) };
|
|
p3.setAttribute('class', 'mContextItem');
|
|
p3.innerHTML = "Gérer le style";
|
|
|
|
return false;
|
|
}
|
|
|
|
function updatePrdGondTV(idPrd, famToOpen){
|
|
// alert ('updatePrdGondTV idPrd = '+idPrd);
|
|
// alert ('updatePrdGondTV famToOpen = '+famToOpen);
|
|
if (document.getElementById('idPrd')){document.getElementById('idPrd').value=idPrd;}
|
|
if (document.getElementById('famToOpen')){document.getElementById('famToOpen').value=famToOpen}
|
|
|
|
var item=document.getElementById('gond-'+idPrd);
|
|
// alert('checked'+document.getElementById('gond-'+idPrd).value);
|
|
if (item.checked==false)
|
|
{document.getElementById('gondole').value='0';}
|
|
else
|
|
{document.getElementById('gondole').value='1';}
|
|
// alert('checked'+document.getElementById('gondole').value);
|
|
|
|
if (document.getElementById('codeOpe')){document.getElementById('codeOpe').value="majTV";}
|
|
document.tvForm.submit();
|
|
}
|
|
|