Search in sources :

Example 1 with BreadcrumbBuilder

use of org.mifos.ui.core.controller.BreadcrumbBuilder in project head by mifos.

the class PentahoReportingController method getBreadCrumbs.

@ModelAttribute("breadcrumbs")
public List<BreadCrumbsLinks> getBreadCrumbs(HttpServletRequest request) {
    Integer reportId = getReportId(request);
    String reportName = this.pentahoReportsService.getReportName(reportId);
    return new BreadcrumbBuilder().withLink("tab.Reports", REPORTS_MAIN_URL).withLink(reportName, "viewPentahoReport.ftl?reportId=" + reportId).build();
}
Also used : BreadcrumbBuilder(org.mifos.ui.core.controller.BreadcrumbBuilder) ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute)

Example 2 with BreadcrumbBuilder

use of org.mifos.ui.core.controller.BreadcrumbBuilder in project head by mifos.

the class BackUrlInterceptor method preHandle.

@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
    String errorPage = request.getRequestURI().replaceFirst(".+/", "");
    String accountingActivationStatus = null;
    try {
        accountingActivationStatus = request.getSession().getAttribute("accountingActivationStatus").toString();
    } catch (Exception e) {
        accountingActivationStatus = "false";
    }
    String urlToBackPage = (String) request.getSession().getAttribute("previousPageUrl");
    if ("pageNotFound.ftl".equals(errorPage)) {
        breadcrumbs = new BreadcrumbBuilder().withLink("previousPage", urlToBackPage).withLink("pageNotFound", errorPage).build();
        request.setAttribute("accessDeniedBreadcrumbs", breadcrumbs);
    } else if ("viewPentahoReport.ftl".equals(errorPage)) {
        breadcrumbs = new BreadcrumbBuilder().withLink("previousPage", urlToBackPage).withLink("JNDIError", errorPage).build();
        request.setAttribute("accessDeniedBreadcrumbs", breadcrumbs);
    } else {
        breadcrumbs = new BreadcrumbBuilder().withLink("previousPage", urlToBackPage).withLink("accessDenied", errorPage).build();
        request.setAttribute("accessDeniedBreadcrumbs", breadcrumbs);
    }
    if (!"getMifosLogo.ftl?".equals(urlToBackPage)) {
        request.getSession().setAttribute(Constants.URLTOBACKPAGE, urlToBackPage);
    }
    request.setAttribute(Constants.URLTOBACKPAGE, urlToBackPage);
    request.setAttribute("accountingActivationStatus", Boolean.parseBoolean(accountingActivationStatus));
    request.getSession().setAttribute("previousPageUrl", UrlHelper.constructCurrentPageUrl(request));
    return true;
}
Also used : BreadcrumbBuilder(org.mifos.ui.core.controller.BreadcrumbBuilder)

Aggregations

BreadcrumbBuilder (org.mifos.ui.core.controller.BreadcrumbBuilder)2 ModelAttribute (org.springframework.web.bind.annotation.ModelAttribute)1