Search in sources :

Example 1 with BreadcrumbTrail

use of org.akaza.openclinica.view.BreadcrumbTrail in project OpenClinica by OpenClinica.

the class SecureController method forwardPage.

/**
     * <P>
     * Forwards to a jsp page. Additions to the forwardPage() method involve checking the session for the bread crumb trail
     * and setting it, if necessary. Setting it here allows the developer to only have to update the
     * <code>BreadcrumbTrail</code> class.
     *
     * @param jspPage The page to go to.
     * @param checkTrail The command to check for, and set a trail in the session.
     */
protected void forwardPage(Page jspPage, boolean checkTrail) {
    Page page1 = Page.valueOf(jspPage.name());
    String temp;
    // YW 10-03-2007 <<
    response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Pragma", "no-cache");
    response.setDateHeader("Expires", -1);
    response.setHeader("Cache-Control", "no-store");
    if (request.getAttribute(POP_UP_URL) == null) {
        request.setAttribute(POP_UP_URL, "");
    }
    try {
        // Added 01/19/2005 for breadcrumbs, tbh
        if (checkTrail) {
            BreadcrumbTrail bt = new BreadcrumbTrail();
            if (session != null) {
                // added bu jxu, fixed bug for log out
                /*    ArrayList trail = (ArrayList) session.getAttribute("trail");
                    if (trail == null) {
                        trail = bt.generateTrail(jspPage, request);
                    } else {
                        bt.setTrail(trail);
                        trail = bt.generateTrail(jspPage, request);
                    }
                    session.setAttribute("trail", trail);*/
                panel = (StudyInfoPanel) session.getAttribute(STUDY_INFO_PANEL);
                if (panel == null) {
                    panel = new StudyInfoPanel();
                    panel.setData(jspPage, session, request);
                } else {
                    panel.setData(jspPage, session, request);
                }
                session.setAttribute(STUDY_INFO_PANEL, panel);
            }
        // we are also using checkTrail to update the panel, tbh
        // 01/31/2005
        }
        temp = page1.getFileName();
        // above added 01/19/2005, tbh
        context.getRequestDispatcher(temp).forward(request, response);
    } catch (Exception se) {
        /*            if ("View Notes".equals(jspPage.getTitle())) {
                String viewNotesURL = jspPage.getFileName();
                if (viewNotesURL != null && viewNotesURL.contains("listNotes_p_=")) {
                    String[] ps = viewNotesURL.split("listNotes_p_=");
                    String t = ps[1].split("&")[0];
                    int p = t.length() > 0 ? Integer.valueOf(t).intValue() : -1;
                    if (p > 1) {
                        viewNotesURL = viewNotesURL.replace("listNotes_p_=" + p, "listNotes_p_=" + (p - 1));
                        //forwardPage(Page.setNewPage(viewNotesURL, "View Notes"));
                    	try {
							getServletContext().getRequestDispatcher(viewNotesURL).forward(request, response);
						} catch (ServletException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						} catch (IOException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}
                    } else if (p <= 0) {
                        forwardPage(Page.VIEW_DISCREPANCY_NOTES_IN_STUDY);
                    }
                }
            }
*/
        logger.error(se.getMessage(), se);
    } finally {
        page1 = null;
        jspPage = null;
        temp = null;
    }
}
Also used : Page(org.akaza.openclinica.view.Page) BreadcrumbTrail(org.akaza.openclinica.view.BreadcrumbTrail) StudyInfoPanel(org.akaza.openclinica.view.StudyInfoPanel) ServletException(javax.servlet.ServletException) OpenClinicaException(org.akaza.openclinica.exception.OpenClinicaException) MessagingException(javax.mail.MessagingException) MailException(org.springframework.mail.MailException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) InconsistentStateException(org.akaza.openclinica.web.InconsistentStateException) InsufficientPermissionException(org.akaza.openclinica.web.InsufficientPermissionException) SchedulerException(org.quartz.SchedulerException) MalformedURLException(java.net.MalformedURLException)

Aggregations

UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 MalformedURLException (java.net.MalformedURLException)1 MessagingException (javax.mail.MessagingException)1 ServletException (javax.servlet.ServletException)1 OpenClinicaException (org.akaza.openclinica.exception.OpenClinicaException)1 BreadcrumbTrail (org.akaza.openclinica.view.BreadcrumbTrail)1 Page (org.akaza.openclinica.view.Page)1 StudyInfoPanel (org.akaza.openclinica.view.StudyInfoPanel)1 InconsistentStateException (org.akaza.openclinica.web.InconsistentStateException)1 InsufficientPermissionException (org.akaza.openclinica.web.InsufficientPermissionException)1 SchedulerException (org.quartz.SchedulerException)1 MailException (org.springframework.mail.MailException)1