From aafd0aca65940d31d5d89457e4b781848ce6de21 Mon Sep 17 00:00:00 2001 From: Frederico Palma Date: Tue, 15 Feb 2005 16:29:58 +0000 Subject: [PATCH] no message git-svn-id: https://svn.coded.pt/svn/SIPRP@436 bb69d46d-e84e-40c8-a05a-06db0d633741 --- .../siprp/pagina/doGetListaEmpresas.java | 3 +- .../pagina/doGetListaEstabelecimentos.java | 3 +- .../siprp/pagina/doGetListaTrabalhadores.java | 3 +- .../siprp/pagina/doGetTrabalhador.java | 116 ++++-- .../classes/siprp/pagina/doPostLogin.java | 3 +- .../classes/siprp/pagina/siprpServlet.java | 43 ++- trunk/html/frame_1.html | 21 ++ trunk/html/frame_2.html | 33 ++ trunk/html/frame_3.html | 10 + trunk/html/index.html | 2 +- trunk/html/servicos_text.html | 2 +- trunk/html/user.html | 329 +++++++++++++++++- 12 files changed, 500 insertions(+), 68 deletions(-) create mode 100644 trunk/html/frame_1.html create mode 100644 trunk/html/frame_2.html create mode 100644 trunk/html/frame_3.html diff --git a/trunk/WEB-INF/classes/siprp/pagina/doGetListaEmpresas.java b/trunk/WEB-INF/classes/siprp/pagina/doGetListaEmpresas.java index aeb04cd5..293d80dc 100644 --- a/trunk/WEB-INF/classes/siprp/pagina/doGetListaEmpresas.java +++ b/trunk/WEB-INF/classes/siprp/pagina/doGetListaEmpresas.java @@ -14,8 +14,7 @@ import org.apache.velocity.app.*; public class doGetListaEmpresas extends siprpServlet{ /** Creates a new instance of doGetListaEmpresas */ - public doGetListaEmpresas(HttpServletRequest req, HttpServletResponse res) - throws IOException + public doGetListaEmpresas(HttpServletRequest req, HttpServletResponse res) throws IOException { ServletOutputStream out = res.getOutputStream(); Connection con = null ; diff --git a/trunk/WEB-INF/classes/siprp/pagina/doGetListaEstabelecimentos.java b/trunk/WEB-INF/classes/siprp/pagina/doGetListaEstabelecimentos.java index f911cc23..092af37b 100644 --- a/trunk/WEB-INF/classes/siprp/pagina/doGetListaEstabelecimentos.java +++ b/trunk/WEB-INF/classes/siprp/pagina/doGetListaEstabelecimentos.java @@ -14,8 +14,7 @@ import org.apache.velocity.app.*; public class doGetListaEstabelecimentos extends siprpServlet{ /** Creates a new instance of doGetListaEstabelecimentos */ - public doGetListaEstabelecimentos(HttpServletRequest req, HttpServletResponse res) - throws IOException + public doGetListaEstabelecimentos(HttpServletRequest req, HttpServletResponse res) throws IOException { ServletOutputStream out = res.getOutputStream(); Connection con = null ; diff --git a/trunk/WEB-INF/classes/siprp/pagina/doGetListaTrabalhadores.java b/trunk/WEB-INF/classes/siprp/pagina/doGetListaTrabalhadores.java index 6b429f7d..e528bf7c 100644 --- a/trunk/WEB-INF/classes/siprp/pagina/doGetListaTrabalhadores.java +++ b/trunk/WEB-INF/classes/siprp/pagina/doGetListaTrabalhadores.java @@ -14,8 +14,7 @@ import org.apache.velocity.app.*; public class doGetListaTrabalhadores extends siprpServlet{ /** Creates a new instance of doGetListaTrabalhadores */ - public doGetListaTrabalhadores(HttpServletRequest req, HttpServletResponse res) - throws IOException + public doGetListaTrabalhadores(HttpServletRequest req, HttpServletResponse res) throws IOException { ServletOutputStream out = res.getOutputStream(); Connection con = null ; diff --git a/trunk/WEB-INF/classes/siprp/pagina/doGetTrabalhador.java b/trunk/WEB-INF/classes/siprp/pagina/doGetTrabalhador.java index fb871ea5..9a4ffac6 100644 --- a/trunk/WEB-INF/classes/siprp/pagina/doGetTrabalhador.java +++ b/trunk/WEB-INF/classes/siprp/pagina/doGetTrabalhador.java @@ -15,8 +15,7 @@ public class doGetTrabalhador extends siprpServlet { /** Creates a new instance of doGetTrabalhador */ - public doGetTrabalhador(HttpServletRequest req, HttpServletResponse res) - throws IOException + public doGetTrabalhador(HttpServletRequest req, HttpServletResponse res) throws IOException { ServletOutputStream out = res.getOutputStream(); Connection con = null ; @@ -47,39 +46,79 @@ public class doGetTrabalhador extends siprpServlet dbQuery.append( " SELECT * FROM trabalhadores where id='"+trabalhadorId+"'"); stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); - int index=0; - int max = super.trabalhadorDescFields.length; - - while ( index < max ) - { - dbQuery = new StringBuffer(); - dbQuery.append( " SELECT "+super.trabalhadorDescFields[index][1]+" FROM trabalhadores where id='"+trabalhadorId+"'"); - stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); - names.add(trabalhadorDescFields[index][0]); - - if (rs.get(0,0) == null ) - { - values.add(super.bdNullString); - } - else - { -// values.add(rs.get(0,0).toString()); - temp=rs.get(0,0).toString(); - - if ( temp.equals("n") ) - { - temp="n\u00E3o"; - } - else if ( temp.equals("y") ) - { - temp="sim"; - } - values.add(temp); } - - ++index; - - } + +// int index=0; +// int max = super.trabalhadorDescFields.length; + +HashMap hmFuncionario = new HashMap(); + if( rs.columnLength() > 0 ) + { + String tmp; + hmFuncionario.put( "sexo", rs.get( 0, "sexo" ) ); + hmFuncionario.put( "categoria", rs.get( 0, "categoria" ) ); + hmFuncionario.put( "data_nascimento", rs.get( 0, "data_nascimento" ) ); + hmFuncionario.put( "nome", rs.get( 0, "nome" ) ); + hmFuncionario.put( "numero", rs.get( 0, "numero_mecanografico" ) ); + hmFuncionario.put( "ultimo_exame", rs.get( 0, "ultimo_exame" ) ); + tmp = ( String ) rs.get( 0, "realizado" ); + if( tmp != null ) + { + if( tmp.equals( "n" ) ) + { + hmFuncionario.put( "realizado", "não" ); + } + else if( tmp.equals( "s" ) ) + { + hmFuncionario.put( "realizado", "sim" ); + } + } + hmFuncionario.put( "proximo_exame", rs.get( 0, "proximo_exame" ) ); + hmFuncionario.put( "ultima_consulta", rs.get( 0, "ultima_consulta" ) ); + tmp = ( String ) rs.get( 0, "realizada" ); + if( tmp != null ) + { + if( tmp.equals( "n" ) ) + { + hmFuncionario.put( "realizada", "n\u00E3o" ); + } + else if( tmp.equals( "s" ) ) + { + hmFuncionario.put( "realizada", "sim" ); + } + } + hmFuncionario.put( "proxima_consulta", rs.get( 0, "proxima_consulta" ) ); + } + +// while ( index < max ) +// { +// dbQuery = new StringBuffer(); +// dbQuery.append( " SELECT "+super.trabalhadorDescFields[index][1]+" FROM trabalhadores where id='"+trabalhadorId+"'"); +// stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); +// rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); +// names.add(trabalhadorDescFields[index][0]); +// +// if (rs.get(0,0) == null ) +// { +// values.add(super.bdNullString); +// } +// else +// { +//// values.add(rs.get(0,0).toString()); +// temp=rs.get(0,0).toString(); +// +// if ( temp.equals("n") ) +// { +// temp="n\u00E3o"; +// } +// else if ( temp.equals("y") ) +// { +// temp="sim"; +// } +// values.add(temp); } +// +// ++index; +// +// } stmt.close(); sBuffer = new StringBuffer(); @@ -96,9 +135,10 @@ hmValues.put( "userName", session.getAttribute( sessionUser ) ); hmValues.put( msgTemplate , sBuffer.toString() ) ; hmValues.put( templateUserRole, userRole); hmValues.put( templateQuery, super.queryStringTrabalhador ); -hmValues.put( templateVector1,names); -hmValues.put( templateVector2,values); -hmValues.put( templateVector3,null); +hmValues.put( "funcionario", hmFuncionario ); +//hmValues.put( templateVector1,names); +//hmValues.put( templateVector2,values); +//hmValues.put( templateVector3,null); out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); // out.println( mergeTemplate( sBuffer.toString(), userRole, super.queryStringTrabalhador, names, values, null, super.authenticatedUserTemplate) ); diff --git a/trunk/WEB-INF/classes/siprp/pagina/doPostLogin.java b/trunk/WEB-INF/classes/siprp/pagina/doPostLogin.java index 5bb3b55a..5eda3c99 100644 --- a/trunk/WEB-INF/classes/siprp/pagina/doPostLogin.java +++ b/trunk/WEB-INF/classes/siprp/pagina/doPostLogin.java @@ -15,8 +15,7 @@ public class doPostLogin extends siprpServlet { /** Creates a new instance of doPostLogin */ - public doPostLogin(HttpServletRequest req, HttpServletResponse res) - throws IOException + public doPostLogin(HttpServletRequest req, HttpServletResponse res) throws IOException { ServletOutputStream out = res.getOutputStream(); StringBuffer dbQuery; diff --git a/trunk/WEB-INF/classes/siprp/pagina/siprpServlet.java b/trunk/WEB-INF/classes/siprp/pagina/siprpServlet.java index 69820d51..71671699 100644 --- a/trunk/WEB-INF/classes/siprp/pagina/siprpServlet.java +++ b/trunk/WEB-INF/classes/siprp/pagina/siprpServlet.java @@ -440,13 +440,20 @@ public static final String errorTemplate = "error.html"; { dbQuery = new StringBuffer(); dbQuery.append( "SELECT "+bdEmpresaNomeRef+" FROM empresas WHERE "+bdEmpresaIdRef+" ='"+empresaId+"'"); - stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); - returnString = (String)rs.get(0,0); - stmt.close(); - return returnString; + if( rs.columnLength() > 0 ) + { + returnString = (String)rs.get(0,0); + stmt.close(); + return returnString; + } + else + { + return null; + } } - catch ( Exception e ) + catch ( Exception e ) { e.printStackTrace(); } @@ -466,9 +473,16 @@ public static final String errorTemplate = "error.html"; dbQuery.append( "SELECT "+bdEstNomeRef+" FROM estabelecimentos WHERE "+bdEstIdRef+" ='"+estabelecimentoId+"'"); stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); - returnString = (String)rs.get(0,0); - stmt.close(); - return returnString; + if( rs.columnLength() > 0 ) + { + returnString = (String)rs.get(0,0); + stmt.close(); + return returnString; + } + else + { + return null; + } } catch ( Exception e ) { @@ -490,9 +504,16 @@ public static final String errorTemplate = "error.html"; dbQuery.append( "SELECT "+bdTrabNomeRef+" FROM trabalhadores where id='"+trabalhadorId+"'"); stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); - returnString = (String)rs.get(0,0); - stmt.close(); - return returnString; + if( rs.columnLength() > 0 ) + { + returnString = (String)rs.get(0,0); + stmt.close(); + return returnString; + } + else + { + return null; + } } catch ( Exception e ) { diff --git a/trunk/html/frame_1.html b/trunk/html/frame_1.html new file mode 100644 index 00000000..4d581f66 --- /dev/null +++ b/trunk/html/frame_1.html @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + +
-Higiene e Segurança
+ -Medicina do Trabalho
+ -Politica de Qualidade e Tratamento da Vertente Burocratica
+ -Serviços Complementares _______________________________ +
+ + diff --git a/trunk/html/frame_2.html b/trunk/html/frame_2.html new file mode 100644 index 00000000..31ef9f51 --- /dev/null +++ b/trunk/html/frame_2.html @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + +
   frame_2
+ + + + + + + + + + +
+

+ + diff --git a/trunk/html/frame_3.html b/trunk/html/frame_3.html new file mode 100644 index 00000000..f68b974a --- /dev/null +++ b/trunk/html/frame_3.html @@ -0,0 +1,10 @@ + + + + + + + + FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
FRAME_3
+ + diff --git a/trunk/html/index.html b/trunk/html/index.html index 7b46a69d..d5e0daa5 100644 --- a/trunk/html/index.html +++ b/trunk/html/index.html @@ -58,7 +58,7 @@ function s( e ) - + +    acesso restrito + + + + + + + + + + + + + + + + + + + + +
+ #if( $userRole == "manager" ) + Empresa: $!empresa_nome + #else + Empresa: $empresa_nome + #end + + $userName   
+ Logout »   
+
+ #if( $estabelecimento_id ) + Estabelecimento: $!estabelecimento_nome + #else + Estabelecimento: + #end +
+ #if( $query == "trabalhador" ) - Funcionário: $v2.get( 0 ) Nº: $v2.get( 1 ) + + Funcionário: $funcionario.nome + #else + Funcionário: + #end + + #if( $query == "trabalhador" ) + + #end +
+ +
+ + + + + + + + - #if( $query == "estabelecimentos" ) - #set( $listaTitle = "Estabelecimentos" ) + #if( $query == "empresas" ) + + #set( $listaTitle = "empresas" ) + + #elseif( $query == "estabelecimentos" ) + + #set( $listaTitle = "estabelecimentos" ) + #elseif( $query == "trabalhadores" ) - #set( $listaTitle = "Funcionários" ) + + #set( $listaTitle = "funcionários" ) + + #elseif( $query == "trabalhador" ) + + #set( $listaTitle = "dados do funcionário" ) + #else ##( $query == "trabalhador" ) + #set( $listaTitle = "" ) + #end + + + +    $listaTitle + + + + + + + + #if ($query == "trabalhador") + + + + Número Mecanográfico: $funcionario.numero
+ + Data de Nascimento: $funcionario.data_nascimento
+ + Categoria: $funcionario.categoria
+ + Sexo: $funcionario.sexo

+ + + + - + + + + - + + + +
Último ExameRealizadoPróximo ExameÚltima ConsultaRealizadaPróxima ConsultaMarcaçãoÚltimo
exame
RealizadoPróximo
exame
Última
consulta
RealizadaPróxima
consulta
Marcação
$v2.get( 2 ) $v2.get( 3 ) $v2.get( 4 ) $v2.get( 5 ) $v2.get( 6 ) $v2.get( 7 )  $!funcionario.ultimo_exame $!funcionario.realizado $!funcionario.proximo_exame $!funcionario.ultima_consulta $!funcionario.realizada $!funcionario.proxima_consulta  
+ ##
+ ## + ## + ##
- #else + + + + + + #else + + + #foreach( $element in $v1 ) + #set ( $counter = $velocityCount - 1 ) - $v2.get($counter)
+ + $v2.get($counter) + + #if ($v3) + + - Nº: + + $v3.get($counter) + + #end + +
+ #end + + + + + #end + + + + + + + + + + + + + + - Site optimizado para 800x600 - Todos os direitos reservados Sociedade Ibérica de Prevenção de Riscos Profissionais  
Desenvolvido por Evolute - Consultoria Informática e 2/3 Design   + + Site optimizado para 800x600 - Todos os direitos reservados Sociedade Ibérica de Prevenção de Riscos Profissionais  
Desenvolvido por Evolute - Consultoria Informática e 2/3 Design   + + + + + + + + + +