Hi again,
I'm using the sendPage to pass the parameters in mi own cocoon
aplication and it works good. But my problem is when I have to send
parameters to a external cocoon aplication that get the parameters by POST.
Thanks.
Víctor Pergolesi escribió:
Hi, Ma Magdalena, I used without problem your third option.
Below there are some code actually in production in a file (.js)
The function consultas have the "sendPage"
cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
importClass (java.util.Date);
importClass (java.util.Locale);
function porcorreo() {
//
var tipocprb = 0;
var numecprb = "";
var tipoenvi = 0;
var destinos = 0;
var codictav = 0;
var i = 0;
//
var fchaenvi = new java.util.Date();
var formatoFecha = new java.text.SimpleDateFormat("EEE MMM dd HH:mm:ss z
yyyy",Locale.US);
var formatoEnvio = new java.text.SimpleDateFormat("dd/MM/yyyy");
//
var form = new Form("cl03_cprb01_d.xml");
//
form.showForm("mostrar-cargacomprobantes");
//
// Comprobantes
//
var repeaterComprobantes = form.getChild("comprobantes");
var comprobantes = "";
if (repeaterComprobantes != null) {
//
// Recorre comprobantes
//
for (i=0;i<repeaterComprobantes.getSize();i++) {
comprobantes = comprobantes + "c*";
tipocprb =
repeaterComprobantes.getRow(i).getChild("tipocprb").getValue();
numecprb =
repeaterComprobantes.getRow(i).getChild("numecprb").getValue();
tipoenvi =
repeaterComprobantes.getRow(i).getChild("tipoenvi").getValue();
destinos =
repeaterComprobantes.getRow(i).getChild("destinos").getValue();
codictav =
repeaterComprobantes.getRow(i).getChild("codictav").getValue();
comprobantes = comprobantes + tipocprb + "/" + numecprb + "/" + tipoenvi +
"/"
+ destinos + "/" + codictav + ";";
}
}
//
// Fecha de env�o
//
fchaenvi = formatoFecha.parse(form.getChild("fchaenvi").getValue());
//
// Arma datos para enviar
//
var viewData = { "comprobantes": comprobantes , "fchaenvi":
formatoEnvio.format(fchaenvi)
};
//
cocoon.sendPage("cargacomprobantes-procesado", viewData);
}
function leerCabezaComprobante(tipocprb, numecprb) {
//
importPackage(Packages.comprobante);
importClass(Packages.comprobante.cabezacomprobante);
importClass(Packages.comprobante.envioporcorreo);
//
var tipo = new java.lang.Integer(tipocprb);
var envio = new envioporcorreo(tipo.intValue(),numecprb);
var cabeza = envio.leerCabezaComprobante();
//
var resultado = new Array();
resultado[0] = cabeza.getFchacprb();
resultado[1] = new java.lang.Integer(cabeza.getTipocprb());
resultado[2] = cabeza.getNumecprb();
resultado[3] = cabeza.getDenomina();
resultado[4] = cabeza.getImpotota();
resultado[5] = new java.lang.Integer(cabeza.getCodictav());
//
return resultado;
}
function consultas() {
//
var fchadesde = new java.util.Date();
var fchahasta = new java.util.Date();
var tipoenvi = 0;
var codictav = 0;
var comprobante = "";
var ip = "";
var i = 0;
//
var formatoFecha = new java.text.SimpleDateFormat("EEE MMM dd HH:mm:ss z
yyyy",Locale.US);
var formatoEnvio = new java.text.SimpleDateFormat("dd/MM/yyyy");
var formatoFechaActual = new java.text.SimpleDateFormat("ddMMyyyy");
var formatoHora = new java.text.SimpleDateFormat("hh:mm");
//
var form = new Form("cl03_cons01_d.xml");
//
form.showForm("mostrar-consultacomprobantes");
//
// Tipo de operacion
//
var tipotarea = form.getChild("estadotab").getValue();
//
if (tipotarea.compareTo("0") == 0) {
//
// Ventas
//
// Fechas
//
fchadesde = formatoFecha.parse(form.getChild("fchadesde").getValue());
fchahasta = formatoFecha.parse(form.getChild("fchahasta").getValue());
//
// Codictav
//
codictav = form.getChild("codictav").getValue();
//
// Tipoenvi
//
tipoenvi = form.getChild("tipoenvi").getValue();
//
// Comprobante
//
comprobante = form.getChild("comprobante").getValue();
//
if (comprobante != null) {
// ARMA letra tipo numero
comprobante = comprobante.substring(0,1).toUpperCase() + '000' +
comprobante.substring(1,2)
+ '00' + comprobante.substring(2,8);
}
//
} else if (tipotarea.compareTo("1") == 0) {
//
// Deudores
//
//
// Fechas
//
fchadesde =
formatoFecha.parse(form.getChild("fchadesdeDeudores").getValue());
fchahasta =
formatoFecha.parse(form.getChild("fchahastaDeudores").getValue());
//
// Codictav
//
codictav = form.getChild("codictav").getValue();
//
// Tipoenvi
//
tipoenvi = form.getChild("tipoenviDeudores").getValue();
//
// Comprobante
//
comprobante = form.getChild("comprobanteDeudores").getValue();
//
if (comprobante != null) {
// ARMA letra tipo numero
comprobante = comprobante.substring(0,1).toUpperCase() + '000' +
comprobante.substring(1,2)
+ '00' + comprobante.substring(2,8);
}
//
}
//
// Datos del contexto: ip fecha hora
//
var ip = cocoon.request.getRemoteAddr();
var fechaActual = new java.util.Date();
var fecha = formatoFechaActual.format(fechaActual);
var hora = formatoHora.format(fechaActual);
//
// Arma datos para enviar
//
var viewData = { "fchadesde": formatoEnvio.format(fchadesde), "fchahasta":
formatoEnvio.format(fchahasta),
"codictav" : codictav, "tipoenvi" : tipoenvi, "comprobante" : comprobante, "ip" : ip,
"fecha"
: fecha, "hora": hora, "tipotarea": tipotarea};
//
cocoon.sendPage("consultacomprobantes-procesado", viewData);
}
If you want I can send you the sitemap, xml and xsl of the application. I hope
this help you.
Victor Pergolesi
From: M� Magdalena Buades Fuster [mailto:[email protected]]
To: [email protected]
Sent: Wed, 18 Mar 2009 10:42:08 +0000
Subject: Sending parameters in the POST with flowscript
Hi,
I don't know how to send a post parameter in flowscript. I tried some
options like:
* cocoon.request.set('name', value);
* cocoon.request.setAtribute('name', value);
* sendPage ('url', {"name": value});
Is it possible?
Thanks in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Este mensaje y sus adjuntos contienen informaci�n confidencial y son para uso
exclusivo del
destinatario. Si hubiese recibido este mensaje por error, o contuviera
informaci�n que Ud.
no desea recibir, por favor le agradecemos nos lo haga saber y lo elimine de su
sistema. Cualquier
inconveniente, enviarlo a [email protected].
Este correo ha sido chequeado por el servidor de Codimat S.A. www.codimat.com.ar
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]