15/12/2008

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

@ -3,8 +3,8 @@
<Scope Scope="Faces Configuration Only"/>
<Scope Scope="Project">
<Node id="ListaPlanos.jsp" x="349" y="128" zoom="false"/>
<Node id="Erro.jsp" x="257" y="64" zoom="true"/>
<Node id="EnviarCorrecao.jsp" x="150" y="150" zoom="false"/>
<Node id="Erro.jsp" x="257" y="64" zoom="true"/>
<Node id="Footer.jsp" x="650" y="150" zoom="true"/>
<Node id="EditarPlano.jsp" x="609" y="83" zoom="false"/>
<Node id="Dummy.jsp" x="867" y="46" zoom="true"/>

@ -1,8 +1,8 @@
build.xml.data.CRC32=3084e562
build.xml.data.CRC32=d2600779
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.data.CRC32=d2600779
nbproject/build-impl.xml.script.CRC32=db27eab1
nbproject/build-impl.xml.stylesheet.CRC32=8926891b

@ -2,7 +2,7 @@
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.project</type>
<configuration>
<creator-data xmlns="http://www.sun.com/creator/ns" jsf.current.theme="woodstock-theme-default" jsf.pagebean.package="planosactuacao" jsf.project.libraries.dir="lib" jsf.project.version="4.0" jsf.startPage="Dummy.jsp"/>
<creator-data xmlns="http://www.sun.com/creator/ns" jsf.current.theme="woodstock-theme-default" jsf.pagebean.package="planosactuacao" jsf.project.libraries.dir="lib" jsf.project.version="4.0" jsf.startPage="ListaPlanos.jsp"/>
<data xmlns="http://www.netbeans.org/ns/web-project/3">
<name>PlanosActuacao</name>
<minimum-ant-version>1.6</minimum-ant-version>

@ -17,8 +17,9 @@ import javax.servlet.http.HttpSession;
* @author lluis
*/
public class Db {
String connectionURL = "jdbc:postgresql://storage:5432/siprp"; //testes
//String connectionURL = "jdbc:postgresql://localhost:5436/siprp"; //real
//String connectionURL = "jdbc:postgresql://storage:5432/siprp"; //testes
String connectionURL = "jdbc:postgresql://localhost:5436/siprp"; //real
String User = "postgres";
String Pass = null;
Connection connection = null;

@ -21,8 +21,9 @@ import javax.servlet.http.HttpSession;
* @author lluis
*/
public class Dblocal {
String connectionURL = "jdbc:postgresql://storage/siprp_local"; //testes
//String connectionURL = "jdbc:postgresql://localhost:5436/siprp_local_3";
//String connectionURL = "jdbc:postgresql://storage/siprp_local"; //testes
String connectionURL = "jdbc:postgresql://localhost:5436/siprp_local_3";
String User = "postgres";
String Pass = null;
Connection connection = null;

@ -334,6 +334,11 @@ public class PlanosDataProvider extends GenericDataProvider{
sql += "WHERE fase = 4";
break;
}
if(userType != Global.DIRECTOR_SIPRP && userType != Global.TECNICO_HS)
{
sql += " and estabelecimento_id = " + u.getEstabelecimento_id();
}
ResultSet rs = st.executeQuery(sql);
ArrayList list = getFullPlanos(rs);
@ -370,16 +375,26 @@ public class PlanosDataProvider extends GenericDataProvider{
sql += "WHERE fase > 1 AND fase < 6";
break;
}
if(userType != Global.DIRECTOR_SIPRP && userType != Global.TECNICO_HS)
{
sql += " and estabelecimento_id = " + u.getEstabelecimento_id();
}
ResultSet rs = st.executeQuery(sql);
ArrayList list = getFullPlanos(rs);
return list;
}
public ArrayList getPlanosConcluidos() throws Exception
public ArrayList getPlanosConcluidos(Utilizador u) throws Exception
{
int userType = u.getTipo().intValue();
Statement st = createStatement();
String sql = "select * from planos_actuacao where fase = 6";
if(userType != Global.DIRECTOR_SIPRP && userType != Global.TECNICO_HS)
{
sql += " and estabelecimento_id = " + u.getEstabelecimento_id();
}
ResultSet rs = st.executeQuery(sql);
ArrayList list = getFullPlanos(rs);
return list;

@ -26,11 +26,11 @@ public class MainPhaseListener implements PhaseListener{
private boolean firstEntry = true;
public void afterPhase(PhaseEvent pe) {
// if(pe.getPhaseId() == PhaseId.RENDER_RESPONSE)
// {
// FacesContext fc = pe.getFacesContext();
if(pe.getPhaseId() == PhaseId.RENDER_RESPONSE)
{
FacesContext fc = pe.getFacesContext();
// SessionBean1 session = JSFUtils.getSessionBean(fc);
// String view = fc.getViewRoot().getViewId();
String view = fc.getViewRoot().getViewId();
// if(view.matches("/EditarPlano.jsp"))
// {
// session.setDisableMenu(true);
@ -39,8 +39,8 @@ public class MainPhaseListener implements PhaseListener{
// {
// session.setDisableMenu(false);
// }
// System.out.println("VIEW : " + view);
// }
System.out.println("RENDER RESPONSE VIEW : " + view);
}
}
public void beforePhase(PhaseEvent pe) {
@ -52,11 +52,15 @@ public class MainPhaseListener implements PhaseListener{
System.out.println("REFERER >>" + referer + "<<");
//check if comes from AnalisesAcidentes. If so, set loggedIn to true:
if(referer.indexOf("AnaliseAcidentes") != -1)
if(referer != null)
{
session.setLoggedIn(true);
String user = JSFUtils.getRequestParameter(fc, "user");
System.out.println("USER >" + user.toString() + "<");
if(referer.indexOf("AnaliseAcidentes") != -1)
{
session.setLoggedIn(true);
String user = JSFUtils.getRequestParameter(fc, "user");
System.out.println("USER >" + user.toString() + "<");
}
}
@ -89,7 +93,7 @@ public class MainPhaseListener implements PhaseListener{
}
catch(Exception ex)
{
ex.printStackTrace();
}
}

@ -8,6 +8,7 @@ package planosactuacao;
import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.webui.jsf.model.DefaultTableDataProvider;
import db.entidades.Utilizador;
import db.providers.UtilizadoresDataProvider;
import java.sql.Connection;
@ -35,6 +36,15 @@ public class Dummy extends AbstractPageBean {
*/
private void _init() throws Exception {
}
private DefaultTableDataProvider defaultTableDataProvider = new DefaultTableDataProvider();
public DefaultTableDataProvider getDefaultTableDataProvider() {
return defaultTableDataProvider;
}
public void setDefaultTableDataProvider(DefaultTableDataProvider dtdp) {
this.defaultTableDataProvider = dtdp;
}
// </editor-fold>

@ -332,7 +332,7 @@ public class ListaPlanos extends AbstractPageBean {
List listPlanosSeguimento = planos.getPlanosSeguimento(u);
getSessionBean1().getPlanosSeguimentoDataProvider().setList(listPlanosSeguimento);
List listPlanosConcluidos = planos.getPlanosConcluidos();
List listPlanosConcluidos = planos.getPlanosConcluidos(u);
getSessionBean1().getPlanosConcluidosDataProvider().setList(listPlanosConcluidos);
//checkPlanosDelayed();

@ -233,12 +233,12 @@ public class PlanosActuacao {
return list;
}
public List<PlanoActuacao> getPlanosConcluidos()
public List<PlanoActuacao> getPlanosConcluidos(Utilizador u)
{
ArrayList list = new ArrayList();
try
{
list = pdp.getPlanosConcluidos();
list = pdp.getPlanosConcluidos(u);
}
catch(Exception ex)
{

@ -36,6 +36,19 @@
<webuijsf:staticText escape="false" id="staticText5" style=""/>
</h:panelGrid>
<webuijsf:staticText escape="false" id="staticText1" style="left: 216px; top: 240px; position: absolute" text="&amp;nbsp;"/>
<webuijsf:table augmentTitle="false" id="table1" style="position: absolute; left: 240px; top: 216px" title="Table" width="450">
<webuijsf:tableRowGroup id="tableRowGroup1" rows="10" sourceData="#{Dummy.defaultTableDataProvider}" sourceVar="currentRow">
<webuijsf:tableColumn headerText="column1" id="tableColumn1" sort="column1">
<webuijsf:staticText id="staticText6" text="#{currentRow.value['column1']}"/>
</webuijsf:tableColumn>
<webuijsf:tableColumn headerText="column2" id="tableColumn2" sort="column2">
<webuijsf:staticText id="staticText7" text="#{currentRow.value['column2']}"/>
</webuijsf:tableColumn>
<webuijsf:tableColumn headerText="column3" id="tableColumn3" sort="column3">
<webuijsf:staticText id="staticText8" text="#{currentRow.value['column3']}"/>
</webuijsf:tableColumn>
</webuijsf:tableRowGroup>
</webuijsf:table>
</webuijsf:form>
</webuijsf:body>
</webuijsf:html>

@ -6,7 +6,7 @@
-->
<jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
<jsp:directive.page contentType="text/html;charset=ISO-8859-1" pageEncoding="ISO-8859-1"/>
<f:view locale="pt_PT">
<f:view>
<webuijsf:page id="page1">
<webuijsf:html id="html1">
<webuijsf:head id="head1">

@ -71,7 +71,7 @@
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/Dummy.jsp</welcome-file>
<welcome-file>faces/ListaPlanos.jsp</welcome-file>
</welcome-file-list>
<error-page>
<exception-type>javax.servlet.ServletException</exception-type>

Loading…
Cancel
Save