no message

git-svn-id: https://svn.coded.pt/svn/SIPRP@464 bb69d46d-e84e-40c8-a05a-06db0d633741
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Frederico Palma 21 years ago
parent c5932ec664
commit 02417d98d9

@ -54,7 +54,9 @@ public class doGetListaTrabalhadores extends siprpServlet{
dbQuery = new StringBuffer();
dbQuery.append("/"+super.servletName+"/?"+empresaId+"/"+estabelecimentoId+"/"+temp); // contruir url
links.add(dbQuery.toString());
desc.add((String)rs.get(index,1));
HashMap trabalhador = new HashMap();
trabalhador.put( "Nome", (String)rs.get(index,1) );
desc.add( trabalhador );
++index;
}
stmt.close();
@ -63,20 +65,20 @@ public class doGetListaTrabalhadores extends siprpServlet{
sBuffer.append("<b>"+super.nomeEmpresa(con,empresaId)+"</b><br><br><i>"
+super.nomeEstabelecimento(con, estabelecimentoId)+"</i>" );
HashMap hmValues = new HashMap();
hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) );
hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) );
hmValues.put( "estabelecimento_nome", super.nomeEstabelecimento( con, estabelecimentoId ) );
hmValues.put( "estabelecimento_id", estabelecimentoId );
hmValues.put( "userRole", userRole );
hmValues.put( "userName", session.getAttribute( sessionUser ) );
hmValues.put( msgTemplate , sBuffer.toString() ) ;
hmValues.put( templateUserRole, userRole);
hmValues.put( templateQuery, super.queryStringTrabalhadores );
hmValues.put( templateVector1,links);
hmValues.put( templateVector2,desc);
hmValues.put( templateVector3,null);
out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate));
HashMap hmValues = new HashMap();
hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) );
hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) );
hmValues.put( "estabelecimento_nome", super.nomeEstabelecimento( con, estabelecimentoId ) );
hmValues.put( "estabelecimento_id", estabelecimentoId );
hmValues.put( "userRole", userRole );
hmValues.put( "userName", session.getAttribute( sessionUser ) );
hmValues.put( msgTemplate , sBuffer.toString() ) ;
hmValues.put( templateUserRole, userRole);
hmValues.put( templateQuery, super.queryStringTrabalhadores );
hmValues.put( templateVector1,links);
hmValues.put( templateVector2,desc);
hmValues.put( templateVector3,null);
out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate));
// out.println( mergeTemplate( sBuffer.toString(), userRole, super.queryStringTrabalhadores, links, desc, null, super.authenticatedUserTemplate) );
}
else // est não pertence à empresa

@ -0,0 +1,129 @@
/*
* doGetListaTrabalhadoresTudo.java
*
* Created on 21 de Abril de 2005, 17:35
*/
package siprp.pagina;
import com.evolute.utils.arrays.*;
import com.evolute.utils.strings.*;
import java.io.*;
import java.util.*;
import java.sql.*;
import java.lang.reflect.Array;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.velocity.*;
import org.apache.velocity.app.*;
/**
*
* @author fpalma
*/
public class doGetListaTrabalhadoresTudo
extends siprpServlet
{
/** Creates a new instance of doGetListaTrabalhadores */
public doGetListaTrabalhadoresTudo(HttpServletRequest req, HttpServletResponse res) throws IOException
{
ServletOutputStream out = res.getOutputStream();
Connection con = null ;
Statement stmt = null ;
ResultSet2DArray rs;
StringBuffer dbQuery, sBuffer;
String userRole, empresaId, estabelecimentoId, temp;
HttpSession session = req.getSession(false);
Vector links = new Vector();
Vector desc = new Vector();
Vector descAdicional = new Vector();
try
{
userRole = (String)session.getAttribute(super.sessionUserRole);
empresaId = (String)session.getAttribute(super.sessionEmpresaId);
estabelecimentoId = (String)session.getAttribute(super.sessionEstabelecimentoId);
if ( userRole.equals ( super.superUserRole ) || userRole.equals ( empresaId ) )
{
Class.forName(super.bdDriver);
con = DriverManager.getConnection( super.bdUrl, super.bdUsername, super.bdPassword );
if ( super.verificaEstabelecimento(con, empresaId, estabelecimentoId) ) // estabelecimento pertence à empresa ??
{
//Class.forName(super.bdDriver);
//con = DriverManager.getConnection( super.bdUrl, super.bdUsername, super.bdPassword );
dbQuery = new StringBuffer();
dbQuery.append( "SELECT id, nome, data_ficha FROM trabalhadores "
+ "WHERE estabelecimento_id = '"+estabelecimentoId+"'"
+ " AND ultima_consulta IS NOT NULL AND realizada = 'y' AND"
+ " ( proxima_consulta IS NULL OR current_date - proxima_consulta > 14 )"
+ " ORDER BY nome" );
stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) );
int index=0;
int max = rs.columnLength();
while ( index < max )
{
temp=""+rs.get(index,0); // converter de int para String
dbQuery = new StringBuffer();
dbQuery.append("/"+super.servletName+"/?"+empresaId+"/"+estabelecimentoId+"/"+temp); // contruir url
links.add(dbQuery.toString());
HashMap trabalhador = new HashMap();
trabalhador.put( "Nome", (String)rs.get(index,1) );
Object data_ficha = rs.get(index,2);
if( data_ficha == null )
{
data_ficha = "";
}
trabalhador.put( "Data", data_ficha );
desc.add( trabalhador );
++index;
}
stmt.close();
sBuffer = new StringBuffer();
sBuffer.append("<b>"+super.nomeEmpresa(con,empresaId)+"</b><br><br><i>"
+super.nomeEstabelecimento(con, estabelecimentoId)+"</i>" );
HashMap hmValues = new HashMap();
hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) );
hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) );
hmValues.put( "estabelecimento_nome", super.nomeEstabelecimento( con, estabelecimentoId ) );
hmValues.put( "estabelecimento_id", estabelecimentoId );
hmValues.put( "userRole", userRole );
hmValues.put( "userName", session.getAttribute( sessionUser ) );
hmValues.put( msgTemplate , sBuffer.toString() ) ;
hmValues.put( templateUserRole, userRole);
hmValues.put( templateQuery, "trabalhadores_tudo" );
hmValues.put( templateVector1,links);
hmValues.put( templateVector2,desc);
hmValues.put( templateVector3,null);
out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate));
// out.println( mergeTemplate( sBuffer.toString(), userRole, super.queryStringTrabalhadores, links, desc, null, super.authenticatedUserTemplate) );
}
else // est não pertence à empresa
{
out.println( mergeTemplate( super.msgLinkFormatError , userRole, super.errorTemplate) );
}
con.close();
}
else // Role não permite ver esta informação
{
out.println( mergeTemplate( super.msgAcessoNegado , userRole, super.errorTemplate) );
}
}
catch ( SQLException e )
{
e.printStackTrace();
out.println( mergeTemplate( super.msgErroBd , super.errorTemplate) );
}
catch ( Exception e )
{
e.printStackTrace();
out.println( mergeTemplate( super.msgGenericError , super.errorTemplate) );
}
}
}

@ -148,7 +148,7 @@ System.out.println( "query: " + queryString );
}
else if ( queryString.indexOf(queryStringErro) == 0 ) // Listar Empresas
{
System.out.println( "entrou" );
// System.out.println( "entrou" );
doErro(queryString, out);
}
else // interpretar query string

@ -20,6 +20,16 @@ body
text-align: justify;
}
.bold
{
color: #497895;
font-family: verdana;
font-size: 10pt;
font-weight: bold;
text-decoration: none;
cursor: pointer;
}
td
{
font-size: 10pt;
@ -152,8 +162,8 @@ td.box6
<td style="width: 120px; vertical-align: top;"><a href="html/frame_links.html" target="_blank">links</a></td>
<td>&nbsp;</td-->
<!-- <td style="width: 120px; vertical-align: top;"><a href="html/frame_relatorio.html" target="_blank">relat&oacute;rio</a></td>-->
<td style="width: 120px; vertical-align: top;">&nbsp;</td>
<td style='color: white; vertical-align: top; text-align: right'>$userName&nbsp;&nbsp;&nbsp;<a href="/siprpWeb/">logout »&nbsp;&nbsp;&nbsp;</a></td>
<td style="color: white; width: 120px; vertical-align: top; text-align: left">&nbsp;&nbsp;&nbsp;$userName&nbsp;</td>
<td style='color: white; vertical-align: top; text-align: right'>&nbsp;&nbsp;&nbsp;<a href="/siprpWeb/">logout »&nbsp;&nbsp;&nbsp;</a></td>
</tr>
</tbody>
</table>
@ -197,7 +207,7 @@ td.box6
<tr>
<td>
#if( $query == "trabalhador" )
<a class='text' href='/siprpWeb/?$empresa_id/$estabelecimento_id'>Funcion&aacute;rio</a>: $!funcionario.nome N&ordm;: $!funcionario.numero
<a class='text' href='/siprpWeb/?$empresa_id/$estabelecimento_id'>Funcion&aacute;rio</a>: $!funcionario.nome &nbsp;Data de Nascimento: $!funcionario.data_nascimento
#else
Funcion&aacute;rio:
#end
@ -250,6 +260,12 @@ td.box6
<td class='box6'><a class='text' href='javascript:marcacaoWindow();'>Marcar</a></td>
</tr>
</table>
#elseif( $query == "trabalhadores" )
#foreach( $element in $v1 )
#set ( $counter = $velocityCount - 1 )
#set ( $dados_trabalhador = $v2.get($counter) )
<a class='text' href="$v1.get($counter)">$dados_trabalhador.Nome</a><br>
#end
#else
#foreach( $element in $v1 )
#set ( $counter = $velocityCount - 1 )

Loading…
Cancel
Save