Examples of PortalRequestContext


Examples of org.exoplatform.portal.application.PortalRequestContext

     *
     * @throws Exception
     */
    public UIPortalApplication() throws Exception {
        log = ExoLogger.getLogger("portal:UIPortalApplication");
        PortalRequestContext context = PortalRequestContext.getCurrentInstance();

        // userPortalConfig_ = (UserPortalConfig)context.getAttribute(UserPortalConfig.class);
        // if (userPortalConfig_ == null)
        // throw new Exception("Can't load user portal config");

        // dang.tung - set portal language by user preference -> browser ->
        // default
        // ------------------------------------------------------------------------------
        LocaleConfigService localeConfigService = getApplicationComponent(LocaleConfigService.class);

        Locale locale = context.getLocale();
        if (locale == null) {
            if (log.isWarnEnabled())
                log.warn("No locale set on PortalRequestContext! Falling back to 'en'.");
            locale = Locale.ENGLISH;
        }

        String localeName = LocaleContextInfo.getLocaleAsString(locale);
        LocaleConfig localeConfig = localeConfigService.getLocaleConfig(localeName);
        if (localeConfig == null) {
            if (log.isWarnEnabled())
                log.warn("Unsupported locale set on PortalRequestContext: " + localeName + "! Falling back to 'en'.");
            localeConfig = localeConfigService.getLocaleConfig(Locale.ENGLISH.getLanguage());
        }
        setOrientation(localeConfig.getOrientation());

        // -------------------------------------------------------------------------------
        context.setUIApplication(this);

        this.all_UIPortals = new HashMap<SiteKey, UIPortal>(5);

        initWorkspaces();
    }
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

                tmp.setNavPath(uiPortal.getNavPath());
                tmp.refreshUIPage();

                setCurrentSite(tmp);
                if (SiteType.PORTAL.equals(siteKey.getType())) {
                    PortalRequestContext pcontext = Util.getPortalRequestContext();
                    if (pcontext != null) {
                        UserPortalConfig userPortalConfig = pcontext.getUserPortalConfig();
                        userPortalConfig.setPortalConfig(portalConfig);
                    }
                }
            }
        }
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

        redirectHandler = (RedirectHandler) ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(
                RedirectHandler.class);
    }

    public List<RedirectLink> getAlternativeSites() {
        PortalRequestContext prc = (PortalRequestContext) PortalRequestContext.getCurrentInstance();

        String siteName = ((PortalRequestContext) PortalRequestContext.getCurrentInstance()).getSiteName();
        String portalName = PortalContainer.getCurrentPortalContainerName();

        Map<String, String> redirects = redirectHandler.getAlternativeRedirects(siteName, prc.getRequestURI(), true);

        List<RedirectLink> redirectLinks = new ArrayList<RedirectLink>();
        if (redirects != null) {
            for (String siteNames : redirects.keySet()) {
                RedirectLink redirectLink = new RedirectLink(siteNames, redirects.get(siteNames));
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

                        new UIFormStringInput("height", "height", null).addValidator(ExpressionValidator.class,
                                "(^([1-9]\\d*)(px|%)$)?", "UIContainerForm.msg.InvalidWidthHeight"));
        addChild(infoInputSet);
        setSelectedTab(infoInputSet.getId());

        PortalRequestContext prc = Util.getPortalRequestContext();
        if (prc.getSiteType() != SiteType.USER) {
            UIListPermissionSelector uiListPermissionSelector = createUIComponent(UIListPermissionSelector.class, null, null);
            uiListPermissionSelector.configure(WebuiRequestContext.generateUUID("UIListPermissionSelector"), "accessPermissions");
            uiListPermissionSelector.addValidator(EmptyIteratorValidator.class);
            UIFormInputSet uiPermissionSet = createUIComponent(UIFormInputSet.class, "UIContainerPermission", null);
            uiPermissionSet.addChild(uiListPermissionSelector);
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

        }
        if (uiParent == null)
            return;
        String layoutMode = clazz.getSimpleName();

        PortalRequestContext context = Util.getPortalRequestContext();
        if (uiParent instanceof UIPage) {
            context.getJavascriptManager().require("SHARED/portal", "portal")
                    .addScripts("eXo.portal.UIPortal.showLayoutModeForPage('" + layoutMode + "');");
        }
    }
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

            uiPortal.setMaximizedUIComponent(null);
        }

        String layoutMode = clazz.getSimpleName();

        PortalRequestContext context = Util.getPortalRequestContext();
        context.getJavascriptManager().require("SHARED/portal", "portal")
                .addScripts("portal.UIPortal.showViewMode('" + layoutMode + "');");
    }
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

        context.getJavascriptManager().require("SHARED/portal", "portal")
                .addScripts("portal.UIPortal.showViewMode('" + layoutMode + "');");
    }

    public static UIWorkingWorkspace updateUIApplication(Event<? extends UIComponent> event) {
        PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext();
        UIPortalApplication uiPortalApp = event.getSource().getAncestorOfType(UIPortalApplication.class);

        UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
        pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
        pcontext.ignoreAJAXUpdateOnPortlets(true);
        return uiWorkingWS;
    }
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

    public static class SaveActionListener extends EventListener<UIContainerForm> {
        public void execute(final Event<UIContainerForm> event) throws Exception {
            UIContainerForm uiForm = event.getSource();
            UIContainer uiContainer = uiForm.getContainer();
            uiForm.invokeSetBindingBean(uiContainer);
            PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext();

            UIMaskWorkspace uiMaskWorkspace = uiForm.getParent();
            uiMaskWorkspace.createEvent("Close", Phase.DECODE, pcontext).broadcast();

            UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
            UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
            pcontext.getJavascriptManager().require("SHARED/portalComposer", "portalComposer")
                    .addScripts("portalComposer.toggleSaveButton();");
            pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
            pcontext.ignoreAJAXUpdateOnPortlets(true);
        }
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

        }
    }

    public static class EditInlineActionListener extends EventListener<UIWorkingWorkspace> {
        public void execute(Event<UIWorkingWorkspace> event) throws Exception {
            PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext();
            UIPortalApplication portalApp = (UIPortalApplication) pcontext.getUIApplication();
            UIPortal currentPortal = portalApp.getCurrentSite();
            UIWorkingWorkspace uiWorkingWS = event.getSource();

            UserACL userACL = portalApp.getApplicationComponent(UserACL.class);
            if (!userACL.hasEditPermissionOnPortal(currentPortal.getSiteType().getName(), currentPortal.getName(),
                    currentPortal.getEditPermission())) {
                portalApp.addMessage(new ApplicationMessage("UIPortalManagement.msg.Invalid-EditLayout-Permission",
                        new String[] { currentPortal.getName() }));
                return;
            }

            DataStorage dataStorage = portalApp.getApplicationComponent(DataStorage.class);
            PortalConfig portalConfig = dataStorage.getPortalConfig(pcontext.getSiteType().getName(), pcontext.getSiteName());
            UIPortal transientPortal = uiWorkingWS.createUIComponent(UIPortal.class, null, null);
            PortalDataMapper.toUIPortal(transientPortal, portalConfig);
            transientPortal.setNavPath(currentPortal.getNavPath());
            transientPortal.refreshUIPage();

            uiWorkingWS.setBackupUIPortal(currentPortal);
            portalApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);

            UIEditInlineWorkspace uiEditWS = uiWorkingWS.getChild(UIEditInlineWorkspace.class);
            uiEditWS.setUIComponent(transientPortal);
            UISiteBody siteBody = uiWorkingWS.findFirstComponentOfType(UISiteBody.class);
            siteBody.setUIComponent(null);

            UIPortalComposer uiComposer = uiEditWS.getComposer().setRendered(true);
            uiComposer.setComponentConfig(UIPortalComposer.class, null);
            uiComposer.setShowControl(true);
            uiComposer.setEditted(false);
            uiComposer.setCollapse(false);
            uiComposer.setId(UIPortalComposer.UIPORTAL_COMPOSER);

            uiWorkingWS.setRenderedChild(UIEditInlineWorkspace.class);
            pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
            pcontext.ignoreAJAXUpdateOnPortlets(true);
        }
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

        public void execute(Event<UIForgetPassword> event) throws Exception {
            UIForgetPassword uiForm = event.getSource();
            UILogin uilogin = uiForm.getParent();
            WebuiRequestContext requestContext = event.getRequestContext();
            PortalRequestContext portalContext = PortalRequestContext.getCurrentInstance();
            MailService mailSrc = uiForm.getApplicationComponent(MailService.class);
            OrganizationService orgSrc = uiForm.getApplicationComponent(OrganizationService.class);
            String userName = uiForm.getUIStringInput(Username).getValue();
            String email = uiForm.getUIStringInput(Email).getValue();
            uiForm.reset();

            User user = null;

            String tokenId = null;

            // User provided his username
            if (userName != null) {
                user = orgSrc.getUserHandler().findUserByName(userName);
                if (user == null) {
                    requestContext.getUIApplication().addMessage(
                            new ApplicationMessage("UIForgetPassword.msg.user-not-exist", null));
                    return;
                }
            }

            // User provided his email address
            if (user == null && email != null) {
                Query query = new Query();
                // Querying on email won't work. PLIDM-12
                // Note that querying on email is inefficient as it loops over all users...
                query.setEmail(email);
                PageList<User> users = orgSrc.getUserHandler().findUsers(query);
                if (users.getAll().size() > 0) {
                    user = users.getAll().get(0);
                } else {
                    requestContext.getUIApplication().addMessage(
                            new ApplicationMessage("UIForgetPassword.msg.email-not-exist", null));
                    return;
                }
            }

            email = user.getEmail();

            // Create token
            RemindPasswordTokenService tokenService = uiForm.getApplicationComponent(RemindPasswordTokenService.class);
            Credentials credentials = new Credentials(user.getUserName(), "");
            tokenId = tokenService.createToken(credentials);

            String portalName = URLEncoder.encode(Util.getUIPortal().getName(), "UTF-8");

            ResourceBundle res = requestContext.getApplicationResourceBundle();
            String headerMail = "headermail";
            String footerMail = "footer";
            try {
                headerMail = res.getString(uiForm.getId() + ".mail.header") + "\n\n"
                        + res.getString(uiForm.getId() + ".mail.user") + user.getUserName() + "\n"
                        + res.getString(uiForm.getId() + ".mail.link");
                footerMail = "\n\n\n" + res.getString(uiForm.getId() + ".mail.footer");
            } catch (MissingResourceException e) {
                log.error(e.getMessage(), e);
            }
            HttpServletRequest request = portalContext.getRequest();
            String host = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();
            String activeLink = host + requestContext.getRequestContextPath() + "/public/" + portalName + "?"
                    + ComponentURL.PORTAL_COMPONENT_ID + "=UIPortal&portal:action=RecoveryPasswordAndUsername&tokenId="
                    + tokenId;
            String mailText = headerMail + "\n" + activeLink + footerMail;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.