157 lines
4.4 KiB
JavaScript
157 lines
4.4 KiB
JavaScript
/////////////////////////////////////////////////////////////////
|
||
// gestione window secondarie di ricerca
|
||
//v. 03-09-2008
|
||
//gestito focus sul ritorno
|
||
/*
|
||
tipico esempio:
|
||
<input name="id_progetto" type="text" class="readonlyField" id="id_progetto" value="<%= CR.getId_progetto() %>" size="4" maxlength="">
|
||
<input type="text" id="descrizioneProgetto" onKeyUp="document.ricerca.crNS.value=0;" onKeyDown="if(event.keyCode==13) {document.ricerca.crNS.value=1;document.getElementById('searchTxt').focus();}" onBlur="if(proChanged){openSW('/gest/Progetto.abl?flgStato=ZAM&searchTxt='+ricerca.descrizioneProgetto.value,'NSF.ricerca.searchTxt,ricerca.id_progetto,ricerca.descrizioneProgetto');proChanged=false;}" onChange="proChanged=true;" name="descrizioneProgetto" size="60" maxlength="254" value="<ab:inputTextFormat><%= CR.getProgetto().getDescrizioneProgetto() %></ab:inputTextFormat>">
|
||
<a href="javascript:openSW('/gest/Progetto.abl?flgStato=ZAM','ricerca.id_progetto,ricerca.descrizioneProgetto');"><img src="../../admin/img/Icons/Find16.gif" alt="Cerca Progetto" width="16" height="16" border="0"></a> <a href="javascript:clrField('ricerca','id_progetto','descrizioneProgetto');"><img src="../../admin/img/Icons/48x48/shadow/recycle.gif" alt="Pulisci Cliente" width="16" height="16" border="0"></a> <a href="javascript:modificaProgetto();"> <img src="../../admin/img/Icons/Edit16.gif" alt="Modifica Progetto" width="16" height="16" border="0"></a>
|
||
|
||
|
||
*/
|
||
/////////////////////////////////////////////////////////////////
|
||
|
||
var ggWinSW;
|
||
var ggWinSW2;
|
||
var debug=false;
|
||
var wwD="700";
|
||
var whD="500";
|
||
|
||
function openSW() {
|
||
|
||
searchSvlt = arguments[0];
|
||
//campo di ritorno completo
|
||
if (arguments[1]!=null)
|
||
{
|
||
RI=arguments[1];
|
||
}
|
||
else
|
||
{
|
||
RI="";
|
||
}
|
||
//larghezza finestra di ricerca
|
||
if (arguments[2]!=null)
|
||
{
|
||
windowWidth=arguments[2];
|
||
}
|
||
else
|
||
{
|
||
windowWidth=wwD;
|
||
}
|
||
//altezza finestra di ricerca
|
||
if (arguments[3]!=null)
|
||
{
|
||
windowHeigth=arguments[3];
|
||
}
|
||
else
|
||
{
|
||
windowHeigth=whD;
|
||
}
|
||
if (searchSvlt.charAt(0)=="/")
|
||
{//path assoluto
|
||
searchSvlt=webApp+searchSvlt;
|
||
}
|
||
if(searchSvlt.indexOf("?")>0)
|
||
swcmd="&cmd=search&act=sw&RI="+RI;
|
||
else
|
||
swcmd="?cmd=search&act=sw&RI="+RI;
|
||
if(debug==false)
|
||
{
|
||
ggWinSW = window.open(searchSvlt+swcmd, "Search_Window","width="+windowWidth+",height="+windowHeigth+",status=no,resizable=yes,top=100,left=100,scrollbars=yes");
|
||
}
|
||
else
|
||
{
|
||
ggWinSW = window.open(searchSvlt+swcmd);
|
||
}
|
||
|
||
ggWinSW.opener = self;
|
||
}
|
||
|
||
function openSW2() {
|
||
windowName= arguments[0];
|
||
searchSvlt = arguments[1];
|
||
//campo di ritorno completo
|
||
if (arguments[2]!=null)
|
||
{
|
||
RI=arguments[2];
|
||
}
|
||
else
|
||
{
|
||
RI="";
|
||
}
|
||
//larghezza finestra di ricerca
|
||
if (arguments[3]!=null)
|
||
{
|
||
windowWidth=arguments[3];
|
||
}
|
||
else
|
||
{
|
||
windowWidth=wwD;
|
||
}
|
||
//altezza finestra di ricerca
|
||
if (arguments[4]!=null)
|
||
{
|
||
windowHeigth=arguments[4];
|
||
}
|
||
else
|
||
{
|
||
windowHeigth=whD;
|
||
}
|
||
if (searchSvlt.charAt(0)=="/")
|
||
{//path assoluto
|
||
searchSvlt=webApp+searchSvlt;
|
||
}
|
||
if(searchSvlt.indexOf("?")>0)
|
||
swcmd="&cmd=search&act=sw&RI="+RI;
|
||
else
|
||
swcmd="?cmd=search&act=sw&RI="+RI;
|
||
if(debug==false)
|
||
{
|
||
//ggWinSW2 = window.open(searchSvlt+swcmd);
|
||
ggWinSW2 = window.open(searchSvlt+swcmd, windowName,"width="+windowWidth+",height="+windowHeigth+",resizable=yes,top=100,left=100,scrollbars=yes");
|
||
}
|
||
else
|
||
{
|
||
ggWinSW2 = window.open(searchSvlt+swcmd);
|
||
}
|
||
ggWinSW2.opener = self;
|
||
}
|
||
|
||
|
||
function selectKey()
|
||
{
|
||
//in questo caso mi aspetto tante coppie del tipo valore,modulo.campo
|
||
var returnItemKey,returnItemDesc,nomeModulo,nomeCampo,args=selectKey.arguments;
|
||
var i;
|
||
for (i=0; i<(args.length-1); i+=2)
|
||
{
|
||
returnItemValue=args[i];
|
||
returnItemField=args[i+1];
|
||
|
||
//debug
|
||
//alert("riv: "+returnItemValue+" rif: "+returnItemField);
|
||
if(returnItemField!="")
|
||
{
|
||
//returnItem <20> del tipo nomeModulo.nomeCampo
|
||
nomeModulo=returnItemField.substring(0,returnItemField.indexOf('.'));
|
||
nomeCampo=returnItemField.substring(returnItemField.indexOf('.')+1,returnItemField.length);
|
||
if(debug==true)
|
||
alert(nomeCampo+": "+returnItemValue);
|
||
self.opener.document[nomeModulo][nomeCampo].value=returnItemValue;
|
||
}
|
||
|
||
|
||
}
|
||
//gestione focus
|
||
//alert(i+" "+args.length);
|
||
if(i<args.length)
|
||
{ //alert(args[i]);
|
||
focusField=args[i];
|
||
nomeModulo=focusField.substring(0,focusField.indexOf('.'));
|
||
nomeCampo=focusField.substring(focusField.indexOf('.')+1,focusField.length);
|
||
self.opener.document[nomeModulo][nomeCampo].select();
|
||
}
|
||
window.close();
|
||
|
||
}
|