10/12/2008

git-svn-id: https://svn.coded.pt/svn/SIPRP@817 bb69d46d-e84e-40c8-a05a-06db0d633741
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
L Luís = 17 years ago
parent f618aaed49
commit 963a54eb9f

@ -18,6 +18,7 @@ import java.sql.Statement;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import utils.Utils;
/**
*
@ -425,7 +426,7 @@ public class PlanosDataProvider extends GenericDataProvider{
Area a = new Area();
a.setId( new Integer(rs.getInt("id")) );
a.setPlano_id(new Integer( rs.getInt("plano_id") ));
a.setDescricao(rs.getString("descricao"));
a.setDescricao(Utils.unicodeToHTML(rs.getString("descricao")));
a.setRiscos(getRiscosByArea(a));
areas.add(a);
}while(rs.next());
@ -449,7 +450,7 @@ public class PlanosDataProvider extends GenericDataProvider{
Risco r = new Risco();
r.setId( new Integer(rs.getInt("id")) );
r.setArea_id(new Integer( rs.getInt("area_id") ));
r.setDescricao(rs.getString("descricao"));
r.setDescricao(Utils.unicodeToHTML(rs.getString("descricao")));
//// r.setResponsavel_execucao(rs.getString("responsavel_execucao"));
// r.setRecursos_necessarios(rs.getString("recursos_necessarios"));
// java.sql.Date sqlDataInicio = rs.getDate("data_inicio");
@ -528,7 +529,7 @@ public class PlanosDataProvider extends GenericDataProvider{
Medida m = new Medida();
m.setId( new Integer(rs.getInt("id")) );
m.setValor_id(new Integer( rs.getInt("valor_id") ));
m.setDescricao(rs.getString("descricao"));
m.setDescricao(Utils.unicodeToHTML(rs.getString("descricao")));
m.setPostos(getPostosByMedida(m));
medidas.add(m);
}while(rs.next());
@ -552,7 +553,7 @@ public class PlanosDataProvider extends GenericDataProvider{
PostoTrabalho p = new PostoTrabalho();
p.setId( new Integer(rs.getInt("id")) );
p.setMedida_id(new Integer( rs.getInt("medida_id") ));
p.setDescricao(rs.getString("descricao"));
p.setDescricao(Utils.unicodeToHTML(rs.getString("descricao")));
postos.add(p);
}while(rs.next());
}

@ -163,7 +163,8 @@ public class RelatoriosDataProvider extends GenericDataProvider {
Statement st = dblocal.createStatement();
String sql = "select distinct medida_id, valor, descricao from ";
sql += "( select distinct hs_relatorio_posto_medida.medida_id, hs_relatorio_posto_risco.risco_id, hs_relatorio_medida.description as descricao, ";
sql += "case hs_relatorio_posto_risco.valor_qualitativo_id isnull when true then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade ";
sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null ";
sql += "when hs_relatorio_posto_risco.valor_qualitativo_id isnull then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade ";
sql += "else hs_relatorio_posto_risco.valor_qualitativo_id ";
sql += "end as valor ";
sql += "from hs_relatorio_posto ";
@ -173,9 +174,9 @@ public class RelatoriosDataProvider extends GenericDataProvider {
sql += "inner join hs_relatorio_posto_risco on (hs_relatorio_posto_risco.posto_id = hs_relatorio_posto.id and hs_relatorio_posto_risco.risco_id = hs_relatorio_risco.id) ";
sql += "inner join hs_relatorio on hs_relatorio.id = hs_relatorio_risco.relatorio_id ";
sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id ";
// sql += "where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + " and hs_relatorio_posto_medida.is_plano_actuacao = true" + ") subquery ";
sql += "where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + ") subquery ";
sql += "where valor = " + v.getValor() + " ";
sql += "where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + " and hs_relatorio_posto_medida.is_plano_actuacao = true" + ") subquery ";
//sql += "where hs_relatorio_posto_risco.risco_id = " + r.getId() + " and area_id = " + a.getId() + ") subquery ";
//sql += "where valor = " + v.getValor() + " ";
sql += "order by subquery.medida_id, valor";
System.out.println("MEDIDAS BY VALOR SQL : " + sql);
ResultSet rs = st.executeQuery(sql);
@ -202,7 +203,8 @@ public class RelatoriosDataProvider extends GenericDataProvider {
Statement st = dblocal.createStatement();
String sql = "select subquery.posto_id, valor, descricao from ";
sql += "(select hs_relatorio_posto_medida.posto_id, hs_relatorio_posto.description as descricao, ";
sql += "case hs_relatorio_posto_risco.valor_qualitativo_id isnull when true then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade ";
sql += "case when hs_relatorio_posto_risco.valor_qualitativo_id isnull and hs_relatorio_posto_risco.probabilidade isnull and hs_relatorio_posto_risco.severidade isnull then null ";
sql += "when hs_relatorio_posto_risco.valor_qualitativo_id isnull then hs_relatorio_posto_risco.probabilidade * hs_relatorio_posto_risco.severidade ";
sql += "else hs_relatorio_posto_risco.valor_qualitativo_id ";
sql += "end as valor ";
sql += "from hs_relatorio_posto_medida ";
@ -210,7 +212,7 @@ public class RelatoriosDataProvider extends GenericDataProvider {
sql += "inner join hs_relatorio_posto on hs_relatorio_posto.id = hs_relatorio_posto_medida.posto_id ";
sql += "inner join hs_relatorio_area on hs_relatorio_area.id = area_id ";
sql += "where medida_id = " + m.getId() + " and area_id = " + a.getId() + ") subquery ";
sql += "where valor = " + v.getValor();
//sql += "where valor = " + v.getValor();
System.out.println("POSTOS BY MEDIDA SQL : " + sql);
ResultSet rs = st.executeQuery(sql);
List<PostoTrabalho> postos = new ArrayList();

@ -38,6 +38,7 @@ public class Global {
public static final String[] FASES_TEXTO = new String[]{"SIPRP(Emissão)", "Segurança Auchan(Preenchimento)", "Director de loja(Validação)", "DNS(Parecer)", "SIPRP(Verificação/Conclusão)", "Concluído"};
public static final String ANALISE_ACIDENTES_URL = "http://localhost:8084/AnaliseAcidentesTrabalho/faces/"; //testes
//public static final String ANALISE_ACIDENTES_URL = "http://localhost:8084/AnaliseAcidentesTrabalho/faces/"; //testes
public static final String ANALISE_ACIDENTES_URL = "http://192.168.111.24:8084/AnaliseAcidentesTrabalho/faces/"; //testes portatil
}

@ -64,10 +64,34 @@ public class MainPhaseListener implements PhaseListener{
HttpServletRequest req = (HttpServletRequest) fc.getExternalContext().getRequest();
UIViewRoot view = fc.getViewRoot();
System.out.println("SESSION VALID : " + req.isRequestedSessionIdValid());
if(!req.isRequestedSessionIdValid() && view.getViewId().indexOf("Login") == -1 ){
NavigationHandler nh = fc.getApplication().getNavigationHandler();
nh.handleNavigation(fc, null, "login");
//if(!req.isRequestedSessionIdValid() && view.getViewId().indexOf("Login") == -1 ){
if(!req.isRequestedSessionIdValid() && referer.indexOf("AnaliseAcidentes") == -1 ){
System.out.println("VIEW ID :" + view.getViewId());
//NavigationHandler nh = fc.getApplication().getNavigationHandler();
//nh.handleNavigation(fc, null, "login");
try
{
//JSFUtils.logout(fc);
//JSFUtils.navigateTo(fc, "login");
try
{
//JSFUtils.redirect(fc, "http://localhost:8084/AnaliseAcidentesTrabalho/faces/Login.jsp");
JSFUtils.redirect(fc, Global.ANALISE_ACIDENTES_URL + "Login.jsp");
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
catch(Exception ex)
{
}
}
//Determin if user is logged in

@ -45,6 +45,7 @@ import mail.Mail;
import pagination.Pagina;
import pagination.Pagination;
import utils.JSFUtils;
import utils.Utils;
/**
* <p>Page bean that corresponds to a similarly named JSP page. This
@ -766,15 +767,18 @@ public class EditarPlano extends AbstractPageBean {
gridPlano.getChildren().add(gridArea);
Area a = p.getAreas().get(0);
showArea(a);
Risco r = a.getRiscos().get(0);
showRisco(r);
//showValores(r);
if(r.getValores().size() > 0)
if(p.getAreas().size() > 0)
{
showValor(r.getValores().get(0));
showResponsavel(r.getValores().get(0));
Area a = p.getAreas().get(0);
showArea(a);
Risco r = a.getRiscos().get(0);
showRisco(r);
//showValores(r);
if(r.getValores().size() > 0)
{
showValor(r.getValores().get(0));
showResponsavel(r.getValores().get(0));
}
}
showPreviousValidacoes(p);
}
@ -789,7 +793,7 @@ public class EditarPlano extends AbstractPageBean {
pg.getChildren().add(st);
st = new StaticText();
st.setEscape(false);
st.setText(a.getDescricao());
st.setText(Utils.unicodeToHTML(a.getDescricao()));
pg.getChildren().add(st);
gridArea.getChildren().add(pg);

@ -107,7 +107,8 @@ public class Header extends AbstractFragmentBean {
//JSFUtils.navigateTo(fc, "login");
try
{
JSFUtils.redirect(fc, "http://localhost:8084/AnaliseAcidentesTrabalho/faces/Login.jsp");
//JSFUtils.redirect(fc, "http://localhost:8084/AnaliseAcidentesTrabalho/faces/Login.jsp");
JSFUtils.redirect(fc, Global.ANALISE_ACIDENTES_URL + "Login.jsp");
}
catch(Exception ex)
{

@ -103,6 +103,7 @@ public class PlanosActuacao {
private PlanoActuacao createPlano(HsRelatorio relatorio) throws Exception
{
System.out.println("CREATE PLANO - RELATORIO ID : " + relatorio.getId().toString());
PlanoActuacao p = new PlanoActuacao();
p.setData_visita(relatorio.getToHsMarcacoesEstabelecimento().getData());
p.setFase(new Integer(Global.FASE_SEGURANCA_PREENCHIMENTO));

@ -81,12 +81,16 @@
function show(chk)
{
hid = document.getElementById("form1:hidValidacao");
//alert('hid : ' + hid.value);
//alert('chk : ' + chk.checked);
if(chk.checked)
{
if(hid.value == 'dir_loja')
{
webui.suntheme4_2.widget.common._createWidget('_form1:groupPanel2:butEnviar',{"id":"form1:groupPanel2:butEnviar","widgetType":"webui.suntheme4_2.widget.button","style":"width: 223px","visible":true,"primary":false,"value":"Enviar a Director Nacional Segurança&gt;&gt;","escape":true,"mini":false,"disabled":false});
//var but = document.getElementById("form1:groupPanel2:butEnviar");
//but.disabled = false;
}
else if(hid.value == 'dns')
{
@ -141,8 +145,9 @@
if(chk.checked)
{
webui.suntheme4_2.widget.common._createWidget('_form1:groupPanel2:butEnviarCorrecao',{"id":"form1:groupPanel2:butEnviarCorrecao","widgetType":"webui.suntheme4_2.widget.button","visible":true,"primary":false,"value":"Enviar correcão","escape":false,"mini":false,"disabled":true});
//var butEnviar = document.getElementById("form1:groupPanel2:butEnviar");
//butEnviar.value = "Enviar para Director Nacional de Segurança&gt;&gt;";
//var butEnviarCor = document.getElementById("form1:groupPanel2:butEnviarCorrecao");
//alert(butEnviarCor.disabled);
//butEnviarCor.disabled = true;
}
else
{
@ -189,7 +194,7 @@
<h:panelGrid binding="#{EditarPlano.gridObservacoes}" columnClasses="gridColLeft" columns="1" id="gridObservacoes" style="height: 24px; width: 100%"/>
<webuijsf:panelGroup id="groupPanel3">
<webuijsf:staticText id="staticText2" styleClass="label" text="Validar processo:"/>
<webuijsf:checkbox binding="#{EditarPlano.chkValidacao}" id="chkValidacao" onChange="show(this)" valueChangeListenerExpression="#{EditarPlano.chkValidacao_processValueChange}"/>
<webuijsf:checkbox binding="#{EditarPlano.chkValidacao}" id="chkValidacao" onClick="show(this)" valueChangeListenerExpression="#{EditarPlano.chkValidacao_processValueChange}"/>
</webuijsf:panelGroup>
</h:panelGrid>
</h:panelGrid>

@ -6,47 +6,49 @@
-->
<div style="height: 30px; width: 100%; -rave-layout: grid" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
<f:subview id="Header">
<h:panelGrid columnClasses="gridColRight" columns="1" id="gridPanel1" style="height: 24px; left: 0px; top: 0px; position: absolute; width: 80%" styleClass="centerBlock">
<h:panelGrid columnClasses="gridCol40,gridCol60" columns="2" id="gridPanel2" style="height: 24px; width: 100%" styleClass="centerBlock" width="552">
<webuijsf:panelGroup id="groupPanel1">
<webuijsf:image id="image1" rendered="#{SessionBean1.renderTopMenuImages}" url="/resources/images/SIPRP_logo_small.jpg"/>
<webuijsf:staticText escape="false" id="staticText1" style="" text="&amp;nbsp;"/>
<webuijsf:image height="40" id="image2" rendered="#{SessionBean1.renderTopMenuImages}" style="" url="/resources/images/Logo_Auchan_novo.jpg"/>
</webuijsf:panelGroup>
<h:panelGrid columnClasses="gridColRight" columns="1" id="gridPanel3" style="height: 24px; width: 100%" styleClass="centerBlock">
<webuijsf:panelGroup id="groupPanel2" style="">
<webuijsf:hyperlink actionExpression="#{Header.lnkAnaliseAcidentes_action}" disabled="#{SessionBean1.disableMenuAnalises}"
id="lnkAnaliseAcidentes1" text="análises acidentes&gt;&gt;"/>
</webuijsf:panelGroup>
<webuijsf:panelGroup id="groupPanel3">
<webuijsf:staticText escape="false" id="lblUser1" styleClass="label" text="#{SessionBean1.currentUser.login}"/>
<webuijsf:staticText escape="false" id="staticText2" text="&amp;nbsp;&amp;nbsp;&amp;nbsp;"/>
<webuijsf:hyperlink actionExpression="#{Header.lnkPlanosActuacao1_action}" disabled="#{SessionBean1.disableMenuPlanos}"
id="lnkPlanosActuacao1" text="planos actuação"/>
<webuijsf:staticText escape="false" id="staticText3" text="&amp;nbsp;|&amp;nbsp;"/>
<webuijsf:hyperlink actionExpression="#{Header.lnkGerirUtilizadores1_action}" disabled="#{SessionBean1.disableMenuUtilizadores}"
id="lnkGerirUtilizadores1" style="" text="gerir utilizadores"/>
<webuijsf:staticText escape="false" id="staticText4" text="&amp;nbsp;|&amp;nbsp;"/>
<webuijsf:hyperlink actionExpression="#{Header.lnkDadosUtilizador1_action}" disabled="#{SessionBean1.disableMenuDadosUtilizador}"
id="lnkDadosUtilizador1" style="" text="alterar dados utilizador"/>
<webuijsf:staticText escape="false" id="staticText6" text="&amp;nbsp;|&amp;nbsp;"/>
<webuijsf:hyperlink actionExpression="#{Header.lnkAjuda_action}" id="lnkAjuda" style="" text="ajuda"/>
<webuijsf:staticText escape="false" id="staticText5" text="&amp;nbsp;|&amp;nbsp;"/>
<webuijsf:hyperlink actionExpression="#{Header.lnkLogout_action}" id="lnkLogout1" text="sair&gt;&gt;"/>
<h:panelGrid columns="1" id="gridPanel1" style="height: 24px; left: 0px; top: 0px; position: absolute; width: 100%" styleClass="centerBlock">
<h:panelGrid columnClasses="gridColRight" columns="1" id="gridPanel5" style="height: 24px; width: 80%" styleClass="centerBlock">
<h:panelGrid columnClasses="gridCol40,gridCol60" columns="2" id="gridPanel2" style="height: 24px; width: 100%" styleClass="centerBlock" width="552">
<webuijsf:panelGroup id="groupPanel1">
<webuijsf:image id="image1" rendered="#{SessionBean1.renderTopMenuImages}" url="/resources/images/SIPRP_logo_small.jpg"/>
<webuijsf:staticText escape="false" id="staticText1" style="" text="&amp;nbsp;"/>
<webuijsf:image height="40" id="image2" rendered="#{SessionBean1.renderTopMenuImages}" style="" url="/resources/images/Logo_Auchan_novo.jpg"/>
</webuijsf:panelGroup>
<h:panelGrid columnClasses="gridColRight" columns="1" id="gridPanel3" style="height: 24px; width: 100%" styleClass="centerBlock">
<webuijsf:panelGroup id="groupPanel2" style="">
<webuijsf:hyperlink actionExpression="#{Header.lnkAnaliseAcidentes_action}" disabled="#{SessionBean1.disableMenuAnalises}"
id="lnkAnaliseAcidentes1" text="análises acidentes&gt;&gt;"/>
</webuijsf:panelGroup>
<webuijsf:panelGroup id="groupPanel3">
<webuijsf:staticText escape="false" id="lblUser1" styleClass="label" text="#{SessionBean1.currentUser.login}"/>
<webuijsf:staticText escape="false" id="staticText2" text="&amp;nbsp;&amp;nbsp;&amp;nbsp;"/>
<webuijsf:hyperlink actionExpression="#{Header.lnkPlanosActuacao1_action}" disabled="#{SessionBean1.disableMenuPlanos}"
id="lnkPlanosActuacao1" text="planos actuação"/>
<webuijsf:staticText escape="false" id="staticText3" text="&amp;nbsp;|&amp;nbsp;"/>
<webuijsf:hyperlink actionExpression="#{Header.lnkGerirUtilizadores1_action}" disabled="#{SessionBean1.disableMenuUtilizadores}"
id="lnkGerirUtilizadores1" style="" text="gerir utilizadores"/>
<webuijsf:staticText escape="false" id="staticText4" text="&amp;nbsp;|&amp;nbsp;"/>
<webuijsf:hyperlink actionExpression="#{Header.lnkDadosUtilizador1_action}" disabled="#{SessionBean1.disableMenuDadosUtilizador}"
id="lnkDadosUtilizador1" style="" text="alterar dados utilizador"/>
<webuijsf:staticText escape="false" id="staticText6" text="&amp;nbsp;|&amp;nbsp;"/>
<webuijsf:hyperlink actionExpression="#{Header.lnkAjuda_action}" id="lnkAjuda" style="" text="ajuda"/>
<webuijsf:staticText escape="false" id="staticText5" text="&amp;nbsp;|&amp;nbsp;"/>
<webuijsf:hyperlink actionExpression="#{Header.lnkLogout_action}" id="lnkLogout1" text="sair&gt;&gt;"/>
</webuijsf:panelGroup>
</h:panelGrid>
</h:panelGrid>
</h:panelGrid>
<h:panelGrid columnClasses="gridColLeft30,gridColCenter40,gridColRight30" columns="3" id="gridSubHeader" rendered="#{SessionBean1.renderSubHeader}"
style="border: 1px solid black; background-color: #ffffff; height: 24px; width: 100%" width="480">
<webuijsf:image id="image3" url="/resources/images/SIPRP_logo_small.jpg"/>
<h:panelGrid columnClasses="gridColCenter" columns="1" id="gridPanel4" style="height: 24px; width: 100%">
<webuijsf:staticText escape="false" id="staticText7" styleClass="label" text="PLANO DE ACTUA&amp;Ccedil;&amp;Atilde;O"/>
<webuijsf:panelGroup id="groupPanel4">
<webuijsf:staticText escape="false" id="staticText8" styleClass="label" text="DATA:&amp;nbsp;"/>
<webuijsf:staticText binding="#{Header.stDataPlano}" escape="false" id="stDataPlano" text="#{SessionBean1.planoActuacao.data_visita_str}"/>
</webuijsf:panelGroup>
<h:panelGrid columnClasses="gridColLeft30,gridColCenter40,gridColRight30" columns="3" id="gridSubHeader"
rendered="#{SessionBean1.renderSubHeader}" style="border: 1px solid black; background-color: rgb(255, 255, 255); height: 24px; width: 100%" width="480">
<webuijsf:image id="image3" url="/resources/images/SIPRP_logo_small.jpg"/>
<h:panelGrid columnClasses="gridColCenter" columns="1" id="gridPanel4" style="height: 24px; width: 100%">
<webuijsf:staticText escape="false" id="staticText7" styleClass="label" text="PLANO DE ACTUA&amp;Ccedil;&amp;Atilde;O"/>
<webuijsf:panelGroup id="groupPanel4">
<webuijsf:staticText escape="false" id="staticText8" styleClass="label" text="DATA:&amp;nbsp;"/>
<webuijsf:staticText binding="#{Header.stDataPlano}" escape="false" id="stDataPlano" text="#{SessionBean1.planoActuacao.data_visita_str}"/>
</webuijsf:panelGroup>
</h:panelGrid>
<webuijsf:image height="40" id="image4" url="/resources/images/Logo_Auchan_novo.jpg"/>
</h:panelGrid>
<webuijsf:image height="40" id="image4" url="/resources/images/Logo_Auchan_novo.jpg"/>
</h:panelGrid>
</h:panelGrid>
</f:subview>

@ -68,9 +68,7 @@
<url-pattern>/theme/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/Dummy.jsp</welcome-file>

Loading…
Cancel
Save