2010-01-28 09:32:35 +00:00

233 lines
7.1 KiB
JavaScript

//<script language="Javascript">
var sFamily='';
// fonction permettant de renseigner le module et la famille pour la réponse en provenance d'une demande simple
function MenuClick(sMod, sFam) {
var oInput;
oInput=MM_findObj('ident');
if (oInput.value!=null && oInput.value!='') {
window.document.frmForm.Mod.value=sMod;
sFamily = sFam;
}
}
function strFillIn(max) {
var sTemp='';
for (var i=0; i<max; i++) sTemp= sTemp + ' ';
return sTemp;
}
function validRechAlpha(objLink, sPathWay, sOrigine) {
var sURL, oInput;
var sTemp='|', oTemp;
var sMod='';
var sDiv;
sURL = sPathWay + 'Module.asp?'
oInput=MM_findObj('mod');
sURL += 'Mod=' + oInput.value;
oInput=MM_findObj('txt_refint');
if (oInput.value!=null && oInput.value!='') sURL += '&RefClient=' + oInput.value;
switch (sOrigine) {
case 'multiid' :
for (i=1;i<=cstMaxId;i++) {
oTemp = MM_findObj('ident' + i);
if (oTemp.value!='' && oTemp.value!=null) sTemp+= oTemp.value + '|';
}
sURL += '&ident=' + sTemp;
sURL += '&origine=' + sOrigine;
oInput=MM_findObj('txt_mod');
if (oInput.value!=null && oInput.value!='') sURL += '&txt_mod=' + oInput.value;
break;
case 'multimod' :
for (i=1;i<=cstMaxMod;i++) {
oTemp = MM_findObj('module' + i);
if (oTemp.value!='' && oTemp.value!=null) sTemp+= oTemp.value + '|';
}
sURL += '&txt_mod=' + sTemp;
sURL += '&origine=' + sOrigine;
oInput=MM_findObj('ident');
if (oInput.value!=null && oInput.value!='') sURL += '&ident=' + oInput.value;
break;
case 'simple' :
oInput=MM_findObj('ident');
if (oInput.value!=null && oInput.value!='') sURL += '&ident=' + oInput.value;
oInput=MM_findObj('txt_mod');
if (oInput.value!=null && oInput.value!='') sURL += '&txt_mod=' + oInput.value;
break;
case 'alerte' :
oInput=MM_findObj('ident');
if (oInput.value!=null && oInput.value!='') sURL += '&ident=' + oInput.value;
oInput=MM_findObj('txt_mod');
i=-1;
while (sMod=='' & ++i<oInput.length) if (oInput[i].checked) sMod=oInput[i].value;
sURL += '&txt_mod=' + sMod;
sURL += '&origine=' + sOrigine;
break;
}
oInput=MM_findObj('txt_code');
if (oInput.value!=null && oInput.value!='') sURL += '&Code=' + oInput.value;
oInput=MM_findObj('txt_denom');
MM_showHideLayers('',arSigneErreurLayers);
sDiv='<div class="clErreur">' ;
if(oInput.value=="")
{
MM_setTextOfLayer('erreur','',sDiv + aErreur['U051'] + "</div>")
MM_showHideLayers('',arSigneErreurLayers,'erreur','signeNom');
return(false) ;
}
if (oInput.value!=null && oInput.value!='') sURL += '&Denom=' + oInput.value;
oInput=MM_findObj('lst_Type');
sURL += '&Type=' + oInput.options[oInput.selectedIndex].value;
oInput=MM_findObj('lst_SousSect');
sURL += '&division=' + oInput.options[oInput.selectedIndex].value;
oInput=MM_findObj('lst_Classe');
sURL += '&ssClasse=' + oInput.options[oInput.selectedIndex].value;
oInput=MM_findObj('chk_RechEt');
if (oInput.checked) {
sURL += '&RechEt=O'
}
else
{
sURL += '&RechEt=N'
}
objLink.href = sURL;
}
// fonction qui traite du click sur un identifiant renvoyé par la recherche alphabétique
function IdClick(moddem, from, sIdClicked, sId, sMod, sRefint, objLink) {
var sUrl='';
var i = -1;
switch (moddem){
case '07S' :
sMod = window.document.frmForm.Mod.value;
sRefint = window.document.frmForm.Refint.value;
if (sMod!='') requestBDFInfos(sMod, sRefint, sFamily, sIdClicked, false,false,objLink)
else {
sUrl = '/FIBEN/Demandes/Demandes.asp?Type=SIMPLE&refint=' + sRefint +'&module=' + sMod + '&ident=' + sIdClicked;
objLink.href=sUrl;
}
break;
case '07M' :
switch (from){
case 'multimod' :
sUrl = '/FIBEN/Demandes/Demandes.asp?Type=MULTIMOD&refint=' + sRefint +'&module=' + sMod + '&ident=' + sIdClicked;
objLink.href=sUrl;
break;
case 'multiid' :
sUrl = '/FIBEN/Demandes/Demandes.asp?Type=MULTIID&refint=' + sRefint +'&module=' + sMod + '&ident=' + sId + sIdClicked + '|';
objLink.href=sUrl;
}
break;
case '07A' :
sMod = '';
while (sMod=='' & ++i<window.document.frmForm.chk_mod.length) if (window.document.frmForm.chk_mod[i].checked) sMod=window.document.frmForm.chk_mod[i].value;
sRefint = window.document.frmForm.txt_refint.value;
if (sMod!='') requestBDFInfos(sMod, sRefint, sFamily, sIdClicked, false,false,objLink)
else {
sUrl = '/FIBEN/Demandes/Demandes.asp?Type=ALERTE&refint=' + sRefint +'&module=' + sMod + '&ident=' + sIdClicked;
objLink.href=sUrl;
}
break;
}
}
var arSigneErreurLayers = new Array();
arSigneErreurLayers[0]='signeId';
arSigneErreurLayers[1]='signeMod';
arSigneErreurLayers[2]='signeNom';
arSigneErreurLayers[3]='erreur';
function resetFieldsRalph()
{
var objRef;
objRef=MM_findObj('txt_denom');
objRef.value='';
objRef=MM_findObj('txt_code');
objRef.value='';
MM_showHideLayers('',arSigneErreurLayers);
objRef=MM_findObj('lst_Type');
objRef.options[0].selected=true;
objRef=MM_findObj('chk_RechEt');
objRef.checked=true;
objRef=MM_findObj('lst_SousSect');
objRef.options[0].selected=true;
objRef=MM_findObj('lst_Classe');
objRef.length=1;
objRef.options[0].selected=true;
MM_showHideLayers('',arSigneErreurLayers);
return(false);
// return(true);
}
function initSousSections(oSelect,valueSelected){
var i,oOpt,sTxt,iSelected;
oSelect.length=0;
iSelected=0;
oOpt = new Option('...' + strFillIn(134) + '.','',true,true);
oSelect.options[oSelect.length]=oOpt;
for (i=0;i<arSectionClasse.length;i++){
sTxt = arSectionClasse[i][0];
oOpt = new Option(sTxt,sTxt.substr(0,2),false,false);
if (sTxt.substr(0,2)==valueSelected) iSelected = i+1;
oSelect.options[oSelect.length]=oOpt;
}
oSelect.options[iSelected].selected=true;
}
function initClasses(oSelect,iSectIndex){
var i,oOpt,sTxt;
oSelect.length=0;
oOpt = new Option('...' + strFillIn(134) + '.','',true,true);
oSelect.options[oSelect.length]=oOpt;
if (iSectIndex>=0) {
for (i=1;i<arSectionClasse[iSectIndex].length;i++){
sTxt = arSectionClasse[iSectIndex][i];
oOpt = new Option(sTxt,sTxt.substr(0,5),false,false);
oSelect.options[oSelect.length]=oOpt;
}
}
// ligne nécessaire sous netscape pour forcer la sélection initiale sur le premier élément de la liste
oSelect.options[0].selected=true;
}
function initselectClasses(oSelect,valueSelected){
var i,j,oOpt,sTxt;
oSelect.length=0;
oOpt = new Option('...' + strFillIn(134) + '.','',true,true);
oSelect.options[oSelect.length]=oOpt;
for (i=0;i<arSectionClasse.length;i++) {
for (j=1;j<arSectionClasse[i].length;j++){
if (arSectionClasse[i][j].substr(0,5)==valueSelected) {
initClasses(oSelect,i);
oSelect.options[j].selected=true;
return i+1;
}
}
}
return 0;
}
function selectType(oSelect,valueSelected){
switch (valueSelected){
case 'J' :
oSelect.options[1].selected=true;
break;
case 'X' :
oSelect.options[2].selected=true;
break;
case 'S' :
oSelect.options[3].selected=true;
break;
default :
oSelect.options[0].selected=true;
}
}