git-svn-id: https://svn.coded.pt/svn/SIPRP@1533 bb69d46d-e84e-40c8-a05a-06db0d633741

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Diogo Neves 15 years ago
parent 1df2eaf6ed
commit b947948046

@ -17,9 +17,11 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import utils.JSFUtils;
/**
@ -143,27 +145,61 @@ public class Global {
ctx.release();
}
}
public static void redirectToPlanos(FacesContext fc, Utilizador currentUser)
{
String curUser = "?user=" + currentUser.getId().toString();
String estab = "";
if(currentUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR)
{
//obtem estabelecimento da lista de estabelecimentos
estab = "&estab_gestor=" + currentUser.getEstabelecimento_gestor().intValue();
}
fc = fc.getCurrentInstance();
try
{
JSFUtils.redirect(fc, Global.PLANOS_ACTUACAO_URL + curUser + estab);
//JSFUtils.dispatch(fc, Global.PLANOS_ACTUACAO_URL + curUser);
}
catch(Exception ex)
{
ErrorLogger.logException( ex );
}
}
public static void redirectToPlanos( FacesContext fc, Utilizador currentUser )
{
if ( fc != null )
{
// String url = Global.PLANOS_ACTUACAO_URL;
String url = "http://localhost:8084/PlanosActuacao/faces/ListaPlanos.jsp";
ExternalContext ec = fc.getExternalContext();
if ( ec != null )
{
HttpSession session = ( HttpSession ) ec.getSession( false );
if ( session != null )
{
url += "?sessionID=" + session.getId();
int userType = currentUser == null ? -1 : currentUser.getTipo() == null ? -1 : currentUser.getTipo().intValue();
if ( userType == Global.TIPO_UTILIZADOR_GESTOR )
{
url += "&estab_gestor=" + currentUser.getEstabelecimento_gestor();
}
try
{
System.out.println( "\tRedirecting to : " + url );
JSFUtils.redirect( fc, url );
}
catch ( Exception e )
{
ErrorLogger.logException( e );
}
}
}
}
}
// public static void redirectToPlanos( FacesContext fc, Utilizador currentUser )
// {
// String curUser = "?user=" + currentUser.getId().toString();
// String estab = "";
// if ( currentUser.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR )
// {
// estab = "&estab_gestor=" + currentUser.getEstabelecimento_gestor().intValue();
// }
// fc = fc.getCurrentInstance();
// try
// {
// JSFUtils.redirect(fc, Global.PLANOS_ACTUACAO_URL + curUser + estab);
// }
// catch(Exception ex)
// {
// ErrorLogger.logException( ex );
// }
// }
}

Loading…
Cancel
Save