22/12/2008

git-svn-id: https://svn.coded.pt/svn/SIPRP@867 bb69d46d-e84e-40c8-a05a-06db0d633741
lxbfYeaa
L Luís = 17 years ago
parent ae4501437d
commit 81ce4a4cd7

@ -579,10 +579,22 @@ or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties f
<copy-ear-war file="${file.reference.TableLayout.jar}" propname="included.lib.file.reference.TableLayout.jar.X"/>
<basename file="${file.reference.ashwood-1.1.jar}" property="included.lib.file.reference.ashwood-1.1.jar"/>
<copy-ear-war file="${file.reference.ashwood-1.1.jar}" propname="included.lib.file.reference.ashwood-1.1.jar.X"/>
<basename file="${file.reference.SIPRP.jar}" property="included.lib.file.reference.SIPRP.jar"/>
<copy-ear-war file="${file.reference.SIPRP.jar}" propname="included.lib.file.reference.SIPRP.jar.X"/>
<basename file="${file.reference.jdom.jar}" property="included.lib.file.reference.jdom.jar"/>
<copy-ear-war file="${file.reference.jdom.jar}" propname="included.lib.file.reference.jdom.jar.X"/>
<basename file="${file.reference.fop.jar}" property="included.lib.file.reference.fop.jar"/>
<copy-ear-war file="${file.reference.fop.jar}" propname="included.lib.file.reference.fop.jar.X"/>
<basename file="${file.reference.avalon-framework-4.2.0.jar}" property="included.lib.file.reference.avalon-framework-4.2.0.jar"/>
<copy-ear-war file="${file.reference.avalon-framework-4.2.0.jar}" propname="included.lib.file.reference.avalon-framework-4.2.0.jar.X"/>
<basename file="${file.reference.batik.jar}" property="included.lib.file.reference.batik.jar"/>
<copy-ear-war file="${file.reference.batik.jar}" propname="included.lib.file.reference.batik.jar.X"/>
<basename file="${file.reference.jai_imageio.jar}" property="included.lib.file.reference.jai_imageio.jar"/>
<copy-ear-war file="${file.reference.jai_imageio.jar}" propname="included.lib.file.reference.jai_imageio.jar.X"/>
<copy file="${libs.exceptionhandler-runtime.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
<mkdir dir="${build.web.dir}/META-INF"/>
<manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update">
<attribute name="Class-Path" value="${included.lib.libs.jsf12.classpath.1.X} ${included.lib.libs.jsf12.classpath.2.X} ${included.lib.libs.jsf12.classpath.3.X} ${included.lib.libs.jsf12.classpath.4.X} ${included.lib.libs.jsf12.classpath.5.X} ${included.lib.libs.jsf12.classpath.6.X} ${included.lib.libs.jstl11.classpath.1.X} ${included.lib.libs.jstl11.classpath.2.X} ${included.lib.libs.jsf12-support.classpath.1.X} ${included.lib.libs.jsf12-support.classpath.2.X} ${included.lib.libs.jsf12-support.classpath.3.X} ${included.lib.libs.jsf12-support.classpath.4.X} ${included.lib.libs.woodstock-components.classpath.1.X} ${included.lib.libs.woodstock-components.classpath.2.X} ${included.lib.libs.woodstock-components.classpath.3.X} ${included.lib.libs.woodstock-components.classpath.4.X} ${included.lib.libs.woodstock-components.classpath.5.X} ${included.lib.libs.woodstock-theme-default.classpath} ${included.lib.file.reference.activation.jar} ${included.lib.file.reference.mail.jar} ${included.lib.file.reference.postgresql-8.0-315.jdbc3.jar} ${included.lib.file.reference.postgresql-8.1-407.jdbc3.jar} ${included.lib.file.reference.postgresql-8.2-506.jdbc4.jar} ${included.lib.file.reference.cayenne-server-3.0M2.jar} ${included.lib.file.reference.commons-collections-3.1.jar} ${included.lib.file.reference.commons-lang-2.1.jar} ${included.lib.file.reference.commons-logging-1.1.jar} ${included.lib.file.reference.evolute.jar} ${included.lib.file.reference.jcalendar-1.3.2.jar} ${included.lib.file.reference.log4j-1.2.8.jar} ${included.lib.file.reference.mail.jar-1} ${included.lib.file.reference.TableLayout.jar} ${included.lib.file.reference.ashwood-1.1.jar} "/>
<attribute name="Class-Path" value="${included.lib.libs.jsf12.classpath.1.X} ${included.lib.libs.jsf12.classpath.2.X} ${included.lib.libs.jsf12.classpath.3.X} ${included.lib.libs.jsf12.classpath.4.X} ${included.lib.libs.jsf12.classpath.5.X} ${included.lib.libs.jsf12.classpath.6.X} ${included.lib.libs.jstl11.classpath.1.X} ${included.lib.libs.jstl11.classpath.2.X} ${included.lib.libs.jsf12-support.classpath.1.X} ${included.lib.libs.jsf12-support.classpath.2.X} ${included.lib.libs.jsf12-support.classpath.3.X} ${included.lib.libs.jsf12-support.classpath.4.X} ${included.lib.libs.woodstock-components.classpath.1.X} ${included.lib.libs.woodstock-components.classpath.2.X} ${included.lib.libs.woodstock-components.classpath.3.X} ${included.lib.libs.woodstock-components.classpath.4.X} ${included.lib.libs.woodstock-components.classpath.5.X} ${included.lib.libs.woodstock-theme-default.classpath} ${included.lib.file.reference.activation.jar} ${included.lib.file.reference.mail.jar} ${included.lib.file.reference.postgresql-8.0-315.jdbc3.jar} ${included.lib.file.reference.postgresql-8.1-407.jdbc3.jar} ${included.lib.file.reference.postgresql-8.2-506.jdbc4.jar} ${included.lib.file.reference.cayenne-server-3.0M2.jar} ${included.lib.file.reference.commons-collections-3.1.jar} ${included.lib.file.reference.commons-lang-2.1.jar} ${included.lib.file.reference.commons-logging-1.1.jar} ${included.lib.file.reference.evolute.jar} ${included.lib.file.reference.jcalendar-1.3.2.jar} ${included.lib.file.reference.log4j-1.2.8.jar} ${included.lib.file.reference.mail.jar-1} ${included.lib.file.reference.TableLayout.jar} ${included.lib.file.reference.ashwood-1.1.jar} ${included.lib.file.reference.SIPRP.jar} ${included.lib.file.reference.jdom.jar} ${included.lib.file.reference.fop.jar} ${included.lib.file.reference.avalon-framework-4.2.0.jar} ${included.lib.file.reference.batik.jar} ${included.lib.file.reference.jai_imageio.jar} "/>
</manifest>
<delete dir="${dist.ear.dir}/temp"/>
</target>
@ -620,6 +632,12 @@ or ant -Dj2ee.platform.classpath=&lt;server_classpath&gt; (where no properties f
<copy file="${file.reference.mail.jar-1}" todir="${build.web.dir}/WEB-INF/lib"/>
<copy file="${file.reference.TableLayout.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copy file="${file.reference.ashwood-1.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copy file="${file.reference.SIPRP.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copy file="${file.reference.jdom.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copy file="${file.reference.fop.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copy file="${file.reference.avalon-framework-4.2.0.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copy file="${file.reference.batik.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copy file="${file.reference.jai_imageio.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copy file="${libs.exceptionhandler-runtime.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
</target>
<target depends="init,compile,compile-jsps,-pre-dist,library-inclusion-in-manifest" name="do-ear-dist">

@ -1,8 +1,8 @@
build.xml.data.CRC32=3084e562
build.xml.data.CRC32=78944a2b
build.xml.script.CRC32=fa3993b7
build.xml.stylesheet.CRC32=cfd7ba16
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=3084e562
nbproject/build-impl.xml.script.CRC32=db27eab1
nbproject/build-impl.xml.data.CRC32=78944a2b
nbproject/build-impl.xml.script.CRC32=5dc756a4
nbproject/build-impl.xml.stylesheet.CRC32=8926891b

@ -21,19 +21,25 @@ dist.javadoc.dir=${dist.dir}/javadoc
dist.war=${dist.dir}/${war.name}
file.reference.activation.jar=jars/activation.jar
file.reference.ashwood-1.1.jar=../common/lib/ashwood-1.1.jar
file.reference.avalon-framework-4.2.0.jar=lib/avalon-framework-4.2.0.jar
file.reference.batik.jar=lib/batik.jar
file.reference.cayenne-server-3.0M2.jar=../common/lib/cayenne-server-3.0M2.jar
file.reference.common-src=../common/src
file.reference.commons-collections-3.1.jar=../common/lib/commons-collections-3.1.jar
file.reference.commons-lang-2.1.jar=../common/lib/commons-lang-2.1.jar
file.reference.commons-logging-1.1.jar=../common/lib/commons-logging-1.1.jar
file.reference.evolute.jar=../common/lib/evolute.jar
file.reference.fop.jar=lib/fop.jar
file.reference.jai_imageio.jar=lib/jai_imageio.jar
file.reference.jcalendar-1.3.2.jar=../common/lib/jcalendar-1.3.2.jar
file.reference.jdom.jar=lib/jdom.jar
file.reference.log4j-1.2.8.jar=../common/lib/log4j-1.2.8.jar
file.reference.mail.jar=jars/mail.jar
file.reference.mail.jar-1=../common/lib/mail.jar
file.reference.postgresql-8.0-315.jdbc3.jar=jars/postgresql-8.0-315.jdbc3.jar
file.reference.postgresql-8.1-407.jdbc3.jar=jars/postgresql-8.1-407.jdbc3.jar
file.reference.postgresql-8.2-506.jdbc4.jar=jars/postgresql-8.2-506.jdbc4.jar
file.reference.SIPRP.jar=lib/SIPRP.jar
file.reference.TableLayout.jar=../common/lib/TableLayout.jar
j2ee.platform=1.5
j2ee.server.type=Tomcat60
@ -58,7 +64,13 @@ javac.classpath=\
${file.reference.log4j-1.2.8.jar}:\
${file.reference.mail.jar-1}:\
${file.reference.TableLayout.jar}:\
${file.reference.ashwood-1.1.jar}
${file.reference.ashwood-1.1.jar}:\
${file.reference.SIPRP.jar}:\
${file.reference.jdom.jar}:\
${file.reference.fop.jar}:\
${file.reference.avalon-framework-4.2.0.jar}:\
${file.reference.batik.jar}:\
${file.reference.jai_imageio.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.debug=true

@ -7,101 +7,113 @@
<name>PlanosActuacao</name>
<minimum-ant-version>1.6</minimum-ant-version>
<web-module-libraries>
<library>
<library files="6">
<file>${libs.jsf12.classpath}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="2">
<file>${libs.jstl11.classpath}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="4">
<file>${libs.jsf12-support.classpath}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="5">
<file>${libs.woodstock-components.classpath}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${libs.woodstock-theme-default.classpath}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.activation.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.mail.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.postgresql-8.0-315.jdbc3.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.postgresql-8.1-407.jdbc3.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.postgresql-8.2-506.jdbc4.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.cayenne-server-3.0M2.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.commons-collections-3.1.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.commons-lang-2.1.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.commons-logging-1.1.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.evolute.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.jcalendar-1.3.2.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.log4j-1.2.8.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.mail.jar-1}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.TableLayout.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.ashwood-1.1.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.SIPRP.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.jdom.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<library files="1">
<file>${file.reference.fop.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library files="1">
<file>${file.reference.avalon-framework-4.2.0.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library files="1">
<file>${file.reference.batik.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library files="1">
<file>${file.reference.jai_imageio.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
</web-module-libraries>
<web-module-additional-libraries>
<library>
<library files="1">
<file>${libs.exceptionhandler-runtime.classpath}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>

@ -42,5 +42,6 @@ public class Global {
//public static final String ANALISE_ACIDENTES_URL = "http://192.168.111.24:8084/AnaliseAcidentesTrabalho/faces/"; //testes portatil
public static final String ANALISE_ACIDENTES_URL = "https://www.siprp.pt/AnaliseAcidentesTrabalho/faces/"; //real
public static final String LOGOS_FOLDER = "/resources/images";
public static final String LOGOS_FOLDER = "/resources/images";
public static final String PDF_FOLDER_URL = "/resources/pdf";
}

@ -10,16 +10,13 @@ import com.sun.data.provider.RowKey;
import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.webui.jsf.component.Table;
import com.sun.webui.jsf.component.TableRowGroup;
import db.entidades.Area;
import db.entidades.Medida;
import db.entidades.PlanoActuacao;
import db.entidades.PostoTrabalho;
import db.entidades.Risco;
import db.providers.UtilizadoresDataProvider;
import db.entidades.Utilizador;
import db.entidades.Valor;
import db.providers.PlanosDataProvider;
import global.Global;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@ -27,7 +24,10 @@ import java.util.List;
import javax.faces.FacesException;
import javax.faces.component.html.HtmlPanelGrid;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletResponse;
import siprp.database.cayenne.providers.PlanoActuacaoDAO;
import siprp.planoactuacao.print.PlanoActuacaoPDFCreator;
import tabledataproviders.PlanosActualDataProvider;
import tabledataproviders.PlanosConcluidosDataProvider;
import tabledataproviders.PlanosSeguimentoDataProvider;
@ -283,9 +283,96 @@ public class ListaPlanos extends AbstractPageBean {
public String goImprimirPlano_action() {
// TODO: Process the action. Return value is a navigation
// case name where null will return to the same page.
PlanoActuacao p = getTableActivosRowData();
PlanoActuacaoPDFCreator pdfCreator = new PlanoActuacaoPDFCreator();
try
{
byte[] pdf = pdfCreator.createPDF(p.getId());
showPdf(pdf);
}
catch(Exception ex)
{
ex.printStackTrace();
}
return null;
}
public String goImprimirPlanoFromSeguimento_action() {
// TODO: Process the action. Return value is a navigation
// case name where null will return to the same page.
PlanoActuacao p = getTableSeguimentoRowData();
PlanoActuacaoPDFCreator pdfCreator = new PlanoActuacaoPDFCreator();
try
{
byte[] pdf = pdfCreator.createPDF(p.getId());
showPdf(pdf);
}
catch(Exception ex)
{
ex.printStackTrace();
}
return null;
}
public String goImprimirPlanoFromConcluidos_action() {
// TODO: Process the action. Return value is a navigation
// case name where null will return to the same page.
PlanoActuacao p = getTableConcluidosRowData();
PlanoActuacaoPDFCreator pdfCreator = new PlanoActuacaoPDFCreator();
try
{
byte[] pdf = pdfCreator.createPDF(p.getId());
showPdf(pdf);
}
catch(Exception ex)
{
ex.printStackTrace();
}
return null;
}
private void showPdf(byte[] pdf) throws Exception
{
// FacesContext fc = getFacesContext();
// HttpServletResponse response = (HttpServletResponse) fc.getExternalContext().getResponse();
// response.setContentType("application/pdf");
// //response.getOutputStream().flush();
// response.flushBuffer();
// response.getOutputStream().write(pdf, 0, pdf.length);
// fc.getResponseComplete();
System.out.println("PDF LEN : " + pdf.length);
FacesContext context = FacesContext.getCurrentInstance();
HttpServletResponse response =
(HttpServletResponse)context.getExternalContext().getResponse();
response.setHeader("Expires", "0");
response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
//response.setHeader("Content-disposition","inline; filename=kiran.pdf");
response.setHeader("Pragma", "public");
response.setContentType( "application/pdf" );
//response.setHeader("Content-Disposition", "attachment;filename=\"ContactList.pdf\"");
response.addHeader("Content-disposition", "attachment;filename=\"Plano.pdf\"");
//response.setHeader("Content-disposition", "filename=plano.pdf");
response.setContentLength(pdf.length);
//try {
response.getOutputStream().write(pdf);
response.getOutputStream().flush();
response.getOutputStream().close();
context.responseComplete();
// } catch (IOException e) {
// e.printStackTrace();
// }
System.out.println("SHOW PDF");
}
private void initialize()
{
Utilizador u = getSessionBean1().getCurrentUser();

@ -36,13 +36,13 @@ public class Logos {
ServletContext context = (ServletContext) fc.getExternalContext().getContext();
File logoFolder = new File(context.getRealPath(Global.LOGOS_FOLDER));
String logoFilename = logoFolder + "/logo_empresa.jpg";
String logoFilename = logoFolder + "/logo_empresa" + empresaId.toString() + ".jpg";
OutputStream outImej = new FileOutputStream(logoFilename);
outImej.write(logo, 0, len);
System.out.println("LOGO PATH : " + logoFilename);
outImej.close();
return Global.LOGOS_FOLDER + "/logo_empresa.jpg";
return Global.LOGOS_FOLDER + "/logo_empresa" + empresaId.toString() + ".jpg";
}
catch(Exception ex)
{

@ -87,7 +87,7 @@
<webuijsf:hyperlink actionExpression="#{ListaPlanos.goVerPlanoFromSeguimento_action}" id="hyperlink3" text="#{currentRow.value['fase_nome']}"/>
</webuijsf:tableColumn>
<webuijsf:tableColumn headerText="Plano" id="tableColumn11">
<webuijsf:hyperlink actionExpression="#{ListaPlanos.goImprimirPlano_action}" id="hyperlink4"
<webuijsf:hyperlink actionExpression="#{ListaPlanos.goImprimirPlanoFromSeguimento_action}" id="hyperlink4"
style="color: #008000;" text="imprimir"/>
</webuijsf:tableColumn>
<webuijsf:tableColumn headerText="Loja" id="tableColumn14">
@ -114,7 +114,7 @@
<webuijsf:hyperlink actionExpression="#{ListaPlanos.goVerPlanoFromConcluidos_action}" id="hyperlink8" text="#{currentRow.value['fase_nome']}"/>
</webuijsf:tableColumn>
<webuijsf:tableColumn headerText="Plano" id="tableColumn12">
<webuijsf:hyperlink actionExpression="#{ListaPlanos.goImprimirPlano_action}" id="hyperlink9"
<webuijsf:hyperlink actionExpression="#{ListaPlanos.goImprimirPlanoFromConcluidos_action}" id="hyperlink9"
style="color: #008000;" text="imprimir"/>
</webuijsf:tableColumn>
<webuijsf:tableColumn headerText="Loja" id="tableColumn15">

Loading…
Cancel
Save