Search in sources :

Example 1 with ActionRuntime

use of org.lastaflute.web.ruts.process.ActionRuntime in project fess by codelibs.

the class FessSearchAction method setupHtmlData.

@Override
protected void setupHtmlData(final ActionRuntime runtime) {
    super.setupHtmlData(runtime);
    systemHelper.setupSearchHtmlData(this, runtime);
    runtime.registerData("osddLink", openSearchHelper.hasOpenSearchFile());
    final List<Map<String, String>> labelTypeItems = labelTypeHelper.getLabelTypeItemList(SearchRequestType.SEARCH, request.getLocale() == null ? Locale.ROOT : request.getLocale());
    runtime.registerData("labelTypeItems", labelTypeItems);
    runtime.registerData("displayLabelTypeItems", labelTypeItems != null && !labelTypeItems.isEmpty());
    Locale locale = ComponentUtil.getRequestManager().getUserLocale();
    if (locale == null) {
        locale = Locale.ENGLISH;
    }
    runtime.registerData("langItems", systemHelper.getLanguageItems(locale));
    final String username = systemHelper.getUsername();
    runtime.registerData("username", username);
    runtime.registerData("editableUser", fessLoginAssist.getSavedUserBean().map(FessUserBean::isEditable).orElse(false));
    runtime.registerData("adminUser", fessConfig.isAdminUser(username) || fessLoginAssist.getSavedUserBean().map(user -> user.hasRoles(fessConfig.getAuthenticationAdminRolesAsArray())).orElse(false));
    runtime.registerData("pageLoginLink", fessConfig.isLoginLinkEnabled());
}
Also used : Locale(java.util.Locale) Constants(org.codelibs.fess.Constants) UserInfoHelper(org.codelibs.fess.helper.UserInfoHelper) OptionalThing(org.dbflute.optional.OptionalThing) ActionRuntime(org.lastaflute.web.ruts.process.ActionRuntime) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) LinkedHashMap(java.util.LinkedHashMap) FessUserBean(org.codelibs.fess.mylasta.action.FessUserBean) HttpServletRequest(javax.servlet.http.HttpServletRequest) SearchRequestType(org.codelibs.fess.entity.SearchRequestParams.SearchRequestType) ThumbnailManager(org.codelibs.fess.thumbnail.ThumbnailManager) Locale(java.util.Locale) PopularWordHelper(org.codelibs.fess.helper.PopularWordHelper) Map(java.util.Map) QueryHelper(org.codelibs.fess.helper.QueryHelper) HtmlNext(org.lastaflute.web.response.next.HtmlNext) HtmlResponse(org.lastaflute.web.response.HtmlResponse) SearchHelper(org.codelibs.fess.helper.SearchHelper) HttpSession(javax.servlet.http.HttpSession) OpenSearchHelper(org.codelibs.fess.helper.OpenSearchHelper) SsoAction(org.codelibs.fess.app.web.sso.SsoAction) Resource(javax.annotation.Resource) StringUtil(org.codelibs.core.lang.StringUtil) Set(java.util.Set) StringEscapeUtils(org.apache.commons.text.StringEscapeUtils) URLUtil(org.codelibs.core.net.URLUtil) ActionResponse(org.lastaflute.web.response.ActionResponse) List(java.util.List) ComponentUtil(org.codelibs.fess.util.ComponentUtil) LoginManager(org.lastaflute.web.login.LoginManager) LabelTypeHelper(org.codelibs.fess.helper.LabelTypeHelper) RoleQueryHelper(org.codelibs.fess.helper.RoleQueryHelper) FessUserBean(org.codelibs.fess.mylasta.action.FessUserBean) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 2 with ActionRuntime

use of org.lastaflute.web.ruts.process.ActionRuntime in project fess by codelibs.

the class FessFwAssistantDirector method prepareWebDirection.

// ===================================================================================
// Web
// =====
@Override
protected void prepareWebDirection(final FwWebDirection direction) {
    direction.directRequest(createUserLocaleProcessProvider(), createUserTimeZoneProcessProvider());
    direction.directCookie(createCookieResourceProvider());
    direction.directAdjustment(createActionAdjustmentProvider());
    direction.directMessage(createMessageNameList(), "fess_label");
    direction.directApiCall(createApiFailureHook());
    direction.directMultipart(FessMultipartRequestHandler::new);
    direction.directHtmlRendering(new JspHtmlRenderingProvider() {

        @Override
        protected String getShowErrorsForwardPath(final ActionRuntime runtime) {
            if (FessAdminAction.class.isAssignableFrom(runtime.getActionType())) {
                return "/admin/error/error.jsp";
            }
            return "/error/system.jsp";
        }
    });
}
Also used : JspHtmlRenderingProvider(org.lastaflute.web.ruts.renderer.JspHtmlRenderingProvider) FessAdminAction(org.codelibs.fess.app.web.base.FessAdminAction) ActionRuntime(org.lastaflute.web.ruts.process.ActionRuntime) FessMultipartRequestHandler(org.codelibs.fess.mylasta.direction.sponsor.FessMultipartRequestHandler)

Aggregations

ActionRuntime (org.lastaflute.web.ruts.process.ActionRuntime)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Locale (java.util.Locale)1 Map (java.util.Map)1 Set (java.util.Set)1 Resource (javax.annotation.Resource)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpSession (javax.servlet.http.HttpSession)1 StringEscapeUtils (org.apache.commons.text.StringEscapeUtils)1 StringUtil (org.codelibs.core.lang.StringUtil)1 URLUtil (org.codelibs.core.net.URLUtil)1 Constants (org.codelibs.fess.Constants)1 FessAdminAction (org.codelibs.fess.app.web.base.FessAdminAction)1 SsoAction (org.codelibs.fess.app.web.sso.SsoAction)1 SearchRequestType (org.codelibs.fess.entity.SearchRequestParams.SearchRequestType)1 LabelTypeHelper (org.codelibs.fess.helper.LabelTypeHelper)1 OpenSearchHelper (org.codelibs.fess.helper.OpenSearchHelper)1