Package org.exoplatform.portal.webui.portal

Examples of org.exoplatform.portal.webui.portal.UIPortal


        return new ArrayList<String>();
    }

    public Map<String, String[]> getPublicParameters() {
        Map<String, String[]> publicParamsMap = new HashMap<String, String[]>();
        UIPortal uiPortal = Util.getUIPortal();
        Map<String, String[]> publicParams = uiPortal.getPublicParameters();
        Set<String> allPublicParamsNames = publicParams.keySet();
        List<String> supportedPublicParamNames = getPublicRenderParamNames();

        for (String oneOfAllParams : allPublicParamsNames) {
            if (supportedPublicParamNames.contains(oneOfAllParams)) {
View Full Code Here


    }

    public static class ViewStep3ActionListener extends EventListener<UIPageCreationWizard> {

        private void setDefaultPermission(Page page, SiteKey siteKey) {
            UIPortal uiPortal = Util.getUIPortal();
            if (SiteType.PORTAL.equals(siteKey.getType())) {
                page.setAccessPermissions(uiPortal.getAccessPermissions());
                page.setEditPermission(uiPortal.getEditPermission());
            } else if (SiteType.GROUP.equals(siteKey.getType())) {
                UserACL acl = Util.getUIPortalApplication().getApplicationComponent(UserACL.class);
                String siteName = siteKey.getName().startsWith("/") ? siteKey.getName() : "/" + siteKey.getName();
                page.setAccessPermissions(new String[] { "*:" + siteName });
                page.setEditPermission(acl.getMakableMT() + ":" + siteName);
View Full Code Here

        Text markup = null;

        try {
            Map<String, String[]> paramMap = prcontext.getRequest().getParameterMap();
            if (paramMap.containsKey("removePP")) {
                UIPortal uiPortal = Util.getUIPortal();
                for (String publicParamName : paramMap.get("removePP")) {
                    uiPortal.getPublicParameters().remove(publicParamName);
                }
            }

            RenderInvocation renderInvocation = uicomponent.create(RenderInvocation.class, prcontext);
View Full Code Here

     * It goes throughs all the request parameters and add to the public render parameters Map the one that are supported by the
     * targeted portlet
     */
    public static void setupPublicRenderParams(UIPortlet uiPortlet, Map<String, String[]> requestParams) {
        if (ParameterValidation.existsAndIsNotEmpty(requestParams)) {
            UIPortal uiPortal = Util.getUIPortal();
            Map<String, String[]> publicParams = uiPortal.getPublicParameters();

            for (String key : requestParams.keySet()) {
                String[] value = requestParams.get(key);
                if (uiPortlet.supportsPublicParam(key)) {
                    if (value.length > 0) {
View Full Code Here

            PortalConfig portalConfig = storage.getPortalConfig(siteKey.getTypeName(), siteKey.getName());
            Container layout = portalConfig.getPortalLayout();
            if (layout != null) {
                userPortalConfig.setPortalConfig(portalConfig);
            }
            UIPortal uiPortal = uiPortalApp.createUIComponent(UIPortal.class, null, null);

            // Reset selected navigation on userPortalConfig
            PortalDataMapper.toUIPortal(uiPortal, userPortalConfig.getPortalConfig());
            return uiPortal;
        }
View Full Code Here

        UIPortalApplication portalApp = getUIPortalApplication();
        UIEditInlineWorkspace uiEditWS = portalApp.findFirstComponentOfType(UIEditInlineWorkspace.class);

        UIComponent uiComponent = uiEditWS.getUIComponent();
        if (uiComponent instanceof UIPortal) {
            UIPortal uiPortal = (UIPortal) uiComponent;
            uiPortal.setMaximizedUIComponent(null);
        } else {
            UIPortalToolPanel uiPortalToolPanel = getUIPortalToolPanel();
            UIPage uiPage = uiPortalToolPanel.findFirstComponentOfType(UIPage.class);
            if (uiPage != null) {
                Util.getPortalRequestContext()
View Full Code Here

        UIPortalApplication portalApp = getUIPortalApplication();
        UIEditInlineWorkspace uiEditWS = portalApp.findFirstComponentOfType(UIEditInlineWorkspace.class);

        UIComponent uiComponent = uiEditWS.getUIComponent();
        if (uiComponent instanceof UIPortal) {
            UIPortal uiPortal = (UIPortal) uiComponent;
            uiPortal.setMaximizedUIComponent(null);
        }

        PortalRequestContext context = Util.getPortalRequestContext();
        context.getJavascriptManager().require("SHARED/portal", "portal")
                .addScripts("portal.UIPortal.showComponentEditInViewMode();");
View Full Code Here

    public static class ChangeNodeActionListener extends EventListener<UIPortalApplication> {
        public void execute(Event<UIPortalApplication> event) throws Exception {
            PortalRequestContext pcontext = PortalRequestContext.getCurrentInstance();
            UserPortal userPortal = pcontext.getUserPortalConfig().getUserPortal();
            UIPortalApplication uiPortalApp = event.getSource();
            UIPortal showedUIPortal = uiPortalApp.getCurrentSite();

            UserNodeFilterConfig.Builder builder = UserNodeFilterConfig.builder();
            builder.withReadCheck();

            PageNodeEvent<UIPortalApplication> pageNodeEvent = (PageNodeEvent<UIPortalApplication>) event;
            String nodePath = pageNodeEvent.getTargetNodeUri();

            UserNode targetNode = null;
            SiteKey siteKey = pageNodeEvent.getSiteKey();
            if (siteKey != null) {
                if (pcontext.getRemoteUser() == null
                        && (siteKey.getType().equals(SiteType.GROUP) || siteKey.getType().equals(SiteType.USER))) {
                    NavigationService service = uiPortalApp.getApplicationComponent(NavigationService.class);
                    NavigationContext navContext = service.loadNavigation(siteKey);
                    if (navContext != null) {
                        uiPortalApp.setLastRequestNavData(null);
                        pcontext.requestAuthenticationLogin();
                        return;
                    }
                }

                UserNavigation navigation = userPortal.getNavigation(siteKey);
                if (navigation != null) {
                    targetNode = userPortal.resolvePath(navigation, builder.build(), nodePath);
                    if (targetNode == null) {
                        // If unauthenticated users have no permission on PORTAL node and URL is valid, they will be required to
                        // login
                        if (pcontext.getRemoteUser() == null && siteKey.getType().equals(SiteType.PORTAL)) {
                            targetNode = userPortal.resolvePath(navigation, null, nodePath);
                            if (targetNode != null) {
                                uiPortalApp.setLastRequestNavData(null);
                                pcontext.requestAuthenticationLogin();
                                return;
                            }
                        } else {
                            // If path to node is invalid, get the default node instead of.
                            targetNode = userPortal.getDefaultPath(navigation, builder.build());
                        }
                    }
                }

                if (targetNode != null) {
                    // let's check if this node can be shown at this time
                    long now = System.currentTimeMillis();
                    long startPublicationTime = targetNode.getStartPublicationTime();
                    long endPublicationTime = targetNode.getEndPublicationTime();
                    boolean restrictOutsidePublicationWindow = targetNode.isRestrictOutsidePublicationWindow();

                    if (shouldRestrictAccess(restrictOutsidePublicationWindow, now, startPublicationTime, endPublicationTime)) {
                        if (log.isInfoEnabled()) {
                            log.info("User "
                                    +pcontext.getRemoteUser()
                                    +" has tried to access a node ("
                                    +targetNode.getURI()
                                    +") which is outside of the publishing window and is restricted.");
                        }
                        targetNode = userPortal.getDefaultPath(navigation, builder.build());
                    }
                }
            }

            if (targetNode == null) {
                targetNode = userPortal.getDefaultPath(builder.build());
                if (targetNode == null) {
                    if (showedUIPortal != null) {
                        UIPageBody uiPageBody = showedUIPortal.findFirstComponentOfType(UIPageBody.class);
                        uiPageBody.setUIComponent(null);
                    }
                    return;
                }
            }

            UserNavigation targetNav = targetNode.getNavigation();
            UserNode currentNavPath = null;
            if (showedUIPortal != null) {
                currentNavPath = showedUIPortal.getNavPath();
            }

            if (currentNavPath != null && currentNavPath.getNavigation().getKey().equals(targetNav.getKey())) {
                // Case 1: Both navigation type and id are not changed, but current page node is changed and it is not a first
                // request.
                if (!currentNavPath.getURI().equals(targetNode.getURI())) {
                    showedUIPortal.setNavPath(targetNode);
                }
            } else {
                // Case 2: Either navigation type or id has been changed
                // First, we try to find a cached UIPortal
                UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
                uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
                uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
                showedUIPortal = uiPortalApp.getCachedUIPortal(targetNav.getKey());
                if (showedUIPortal != null) {
                    showedUIPortal.setNavPath(targetNode);
                    uiPortalApp.setCurrentSite(showedUIPortal);

                    DataStorage storageService = uiPortalApp.getApplicationComponent(DataStorage.class);
                    PortalConfig associatedPortalConfig = storageService.getPortalConfig(targetNav.getKey().getTypeName(),
                            targetNav.getKey().getName());
                    UserPortalConfig userPortalConfig = pcontext.getUserPortalConfig();

                    // Update layout-related data on UserPortalConfig
                    userPortalConfig.setPortalConfig(associatedPortalConfig);
                } else {
                    showedUIPortal = buildUIPortal(targetNav.getKey(), uiPortalApp, pcontext.getUserPortalConfig());
                    if (showedUIPortal == null) {
                        return;
                    }
                    showedUIPortal.setNavPath(targetNode);
                    uiPortalApp.setCurrentSite(showedUIPortal);
                    uiPortalApp.putCachedUIPortal(showedUIPortal);
                }
            }

            showedUIPortal.refreshUIPage();
            pcontext.setFullRender(true);
            pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID));
        }
View Full Code Here

            if (!userACL.hasEditPermission(page)) {
                uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.delete.NotDelete", new String[] { id }, 1));
                return;
            }

            UIPortal uiPortal = Util.getUIPortal();
            UserNode userNode = uiPortal.getSelectedUserNode();
            boolean isDeleteCurrentPage = page.getKey().equals(userNode.getPageRef());

            service.getPageService().destroyPage(page.getKey());
            // Minh Hoang TO: The cached UIPage objects corresponding to removed Page should be removed here.
            // As we have multiple UIPortal, which means multiple caches of UIPage. It 's unwise to garbage
            // all UIPage caches at once. Better solution is to clear UIPage on browsing to PageNode having Page
            // removed

            if (isDeleteCurrentPage) {
                SiteKey siteKey = userNode.getNavigation().getKey();
                PageNodeEvent<UIPortalApplication> pnevent = new PageNodeEvent<UIPortalApplication>(
                        Util.getUIPortalApplication(), PageNodeEvent.CHANGE_NODE, siteKey, userNode.getURI());
                uiPortal.broadcast(pnevent, Phase.PROCESS);
            } else {
                boolean dataAvailable = uiPageBrowser.feedDataWithQuery(uiPageBrowser.getLastQuery());
                if (!dataAvailable) {
                    showNoResultMessagePopup();
                }
View Full Code Here

                    // Update navigation and UserToolbarGroupPortlet

                    String pageRef = page.getKey().format();
                    if (pageRef != null && pageRef.length() > 0) {
                        // Remove from cache
                        UIPortal uiPortal = Util.getUIPortal();
                        uiPortal.clearUIPage(pageRef);
                    }

                    // Update UserToolbarDashboardPortlet
                    ActionResponse actResponse = event.getRequestContext().getResponse();
                    actResponse.setEvent(new QName("NavigationChange"), userNode.getName());
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.webui.portal.UIPortal

Copyright © 2018 www.massapicom. 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.