185 lines
5.2 KiB
JavaScript
185 lines
5.2 KiB
JavaScript
//----------------------------------------//
|
|
// Questo file contiene gli script //
|
|
// javascript per validare le pagine jsp //
|
|
// lato client. //
|
|
// @Autore : Alessia Streglio //
|
|
// @Data : 13/02/2003 //
|
|
//----------------------------------------//
|
|
|
|
|
|
|
|
//----------------------------------------//
|
|
//Controlla la pagina Acquisisci.jsp
|
|
//----------------------------------------//
|
|
function checkPageAcquisisci(frm){
|
|
var sFile = frm.inputFile.value; //inpuet type file
|
|
var bRit = false;
|
|
var iExt ;
|
|
var EXT_XML = ".xml";
|
|
if(sFile != ""){
|
|
|
|
iExt = sFile.search(EXT_XML); //controllo che sia un file .xml
|
|
if( iExt >= 0 ){bRit = true;}
|
|
else{ alert("ATTENZIONE : IL FILE SELEZIONATO DEVE\nESSERE CON ESTENSIONE .XML");}
|
|
|
|
}
|
|
else{ alert("ATTENZIONE : SELEZIONARE UN FILE");}
|
|
return bRit;
|
|
}
|
|
//----------------------------------------//
|
|
//Controlla la pagina ForzaturaPrevalidazione.jsp
|
|
//----------------------------------------//
|
|
function checkPageForzaturaPrevalidazione(frm){
|
|
var sFile = frm.inputFileCsvFP.value; //inpuet type file
|
|
var bRit = false;
|
|
var iExt ;
|
|
var EXT_CSV = ".csv";
|
|
if(sFile != ""){
|
|
|
|
iExt = sFile.search(EXT_CSV ); //controllo che sia un file .csv
|
|
if( iExt >= 0 ){bRit = true;}
|
|
else{ alert("ATTENZIONE : IL FILE SELEZIONATO DEVE\nESSERE CON ESTENSIONE .CSV");}
|
|
|
|
}
|
|
else{ alert("ATTENZIONE : SELEZIONARE UN FILE");}
|
|
return bRit;
|
|
}
|
|
//----------------------------------------//
|
|
//Controlla la pagina Invia.jsp
|
|
//----------------------------------------//
|
|
function checkPageSpedisci(frm){
|
|
var sFile = frm.inputFile.value; //input type file
|
|
var sTipoFile = frm.cmbTipoFile.value; //combo tipo file
|
|
var sTipoProcesso = frm.cmbTipoProcesso.value;//combo tipo processo
|
|
var sDestinatario = frm.cmbDestinatario.value;//destinatario/i.
|
|
var bRit = false;
|
|
var iExt ;
|
|
var EXT_CSV = ".csv";
|
|
var EXT_TXT = ".txt";
|
|
|
|
if(sFile != ""){// Se il file e' valorizzato
|
|
if(sTipoProcesso == ""){
|
|
alert("ATTENZIONE : SELEZIONARE UN TIPO PROCESSO");
|
|
return bRit;
|
|
}
|
|
if(sTipoFile == ""){
|
|
alert("ATTENZIONE : SELEZIONARE UN TIPO FILE");
|
|
return bRit;
|
|
}
|
|
|
|
if(sDestinatario == ""){
|
|
alert("ATTENZIONE : SELEZIONARE ALMENO UN DESTINATARIO");
|
|
return bRit;
|
|
}
|
|
|
|
//continuo...
|
|
iExt = sFile.search(EXT_CSV);
|
|
iExt = iExt + sFile.search(EXT_TXT);
|
|
|
|
if( iExt >= 0 ){bRit = true;}
|
|
else{ alert("ATTENZIONE : IL FILE SELEZIONATO DEVE\nESSERE CON ESTENSIONE .CSV OPPURE .TXT");}
|
|
|
|
}
|
|
else{ alert("ATTENZIONE : SELEZIONARE UN FILE");}
|
|
return bRit;
|
|
}
|
|
|
|
|
|
//----------------------------------------//
|
|
//Controlla la pagina SimulazioneInvioEsitoGisp.jsp e RicezioneEsitiGISP
|
|
//----------------------------------------//
|
|
function checkPageSimulEsitoGisp(frm){
|
|
var idRichiesta = frm.inputFileGISP.value;//Campo input text inserimento id richiesta
|
|
var bRit = false;
|
|
var iExt ;
|
|
|
|
if(idRichiesta == ""){
|
|
alert("ATTENZIONE : Inserire un ID Richiesta");
|
|
return bRit;
|
|
}else{
|
|
bRit = true;
|
|
}
|
|
return bRit;
|
|
}
|
|
//----------------------------------------//
|
|
//Controlla la pagina Reinvia.jsp
|
|
//----------------------------------------//
|
|
function checkPageReinvia(frm){
|
|
var sFile = frm.txtFile.value; //input type text : nome del file
|
|
if(sFile == ""){
|
|
alert("ATTENZIONE : IMMETTERE UN NOME FILE");
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
//----------------------------------------//
|
|
// Richiamato dalla pagina Spedisci.jsp
|
|
// Si occupa di ricaricare la pagina a
|
|
// seconda del tipo processo selezionato
|
|
// per ricaricare la combo dei tipi file
|
|
// e ricaricare il nome del file se c'.
|
|
//----------------------------------------//
|
|
function ricaricaPagina(nome,valore,path){
|
|
var sNomeFile = document.forms[0].inputFile.value;
|
|
var strFile;
|
|
|
|
if(sNomeFile != ""){
|
|
sNomeFile = sNomeFile.replace("\\","/");
|
|
strFile = "&inputFile="+""+sNomeFile;
|
|
}else{
|
|
strFile = "";
|
|
}
|
|
|
|
var stringa = "";
|
|
|
|
if(nome == "cmbTipoProcesso"){
|
|
stringa = "?sTipoProcessoSpec=";
|
|
}else if(nome == "cmbTipoFile"){//per ora non implementata
|
|
stringa = "?sTipoFileSpec=";
|
|
}
|
|
|
|
var pathCreato = path+"/jsp/Invio.jsp"+stringa+valore+strFile;
|
|
//+strFile;
|
|
document.forms[0].action = pathCreato;
|
|
document.forms[0].submit();
|
|
}
|
|
|
|
function annullaInvio(){
|
|
var pathInvio = "/mnp/MainDispatcher?nomePagina=Invio";
|
|
document.forms[0].action = pathInvio;
|
|
document.forms[0].submit();
|
|
}
|
|
function annullaInvioFS(){
|
|
|
|
var pathInvio = "/mnp/MainDispatcher?nomePagina=InvioFS";
|
|
document.forms[0].action = pathInvio;
|
|
document.forms[0].submit();
|
|
}
|
|
//Controllo che almeno un file sia stato selezionato
|
|
//nella pagina di lista file .
|
|
function checkListaFile(){
|
|
var cont = 0;
|
|
for (x=0;x<document.frmListaFile.length;x++){
|
|
if(document.frmListaFile.elements[x].name == 'chkFile'){
|
|
if(document.frmListaFile.elements[x].checked == true){
|
|
cont = cont + 1;
|
|
}
|
|
}
|
|
}//chiude for_
|
|
if(cont == 0){
|
|
alert("E' NECESSARIO SELEZIONARE ALMENO UN FILE.");
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
//input: document.form.oggetto.value
|
|
function checkFile(objValue){
|
|
if(objValue == ""){
|
|
alert("ATTENZIONE : SELEZIONARE UN FILE");
|
|
return false;
|
|
}
|
|
}//fx
|