protected String[] getStaticPortletIds(String position) { Layout layout = getLayout(); String selector1 = StringPool.BLANK; Group group = null; try { group = layout.getGroup(); } catch (PortalException pe) { _log.error("Unable to get group " + layout.getGroupId()); return new String[0]; } if (group.isUser()) { selector1 = LayoutTypePortletConstants.STATIC_PORTLET_USER_SELECTOR; } else if (group.isOrganization()) { selector1 = LayoutTypePortletConstants.STATIC_PORTLET_ORGANIZATION_SELECTOR; } else if (group.isRegularSite()) { selector1 = LayoutTypePortletConstants.STATIC_PORTLET_REGULAR_SITE_SELECTOR; } String selector2 = layout.getFriendlyURL(); String[] portletIds = PropsUtil.getArray(position, new Filter(selector1, selector2)); for (int i = 0; i < portletIds.length; i++) { portletIds[i] = JS.getSafeName(portletIds[i]); } return portletIds; }
protected boolean isGroupFriendlyURL( Group group, Layout layout, String layoutURL, Locale locale) { if (Validator.isNull(layoutURL)) { return true; } int pos = layoutURL.lastIndexOf(CharPool.SLASH); String layoutURLLanguageId = layoutURL.substring(pos + 1); Locale layoutURLLocale = LocaleUtil.fromLanguageId(layoutURLLanguageId, true, false); if (layoutURLLocale != null) { return true; } if (PortalUtil.isGroupFriendlyURL( layoutURL, group.getFriendlyURL(), layout.getFriendlyURL(locale))) { return true; } return false; }
@Override protected void validateImportedStagedModel( StagedModel stagedModel, StagedModel importedStagedModel) throws Exception { Assert.assertTrue( stagedModel.getCreateDate() + " " + importedStagedModel.getCreateDate(), DateUtil.equals(stagedModel.getCreateDate(), importedStagedModel.getCreateDate())); Assert.assertEquals(stagedModel.getUuid(), importedStagedModel.getUuid()); Layout layout = (Layout) stagedModel; Layout importedLayout = (Layout) importedStagedModel; Assert.assertEquals(layout.getName(), importedLayout.getName()); Assert.assertEquals(layout.getTitle(), importedLayout.getTitle()); Assert.assertEquals(layout.getDescription(), importedLayout.getDescription()); Assert.assertEquals(layout.getKeywords(), importedLayout.getKeywords()); Assert.assertEquals(layout.getRobots(), importedLayout.getRobots()); Assert.assertEquals(layout.getType(), importedLayout.getType()); Assert.assertEquals(layout.getFriendlyURL(), importedLayout.getFriendlyURL()); Assert.assertEquals(layout.getCss(), importedLayout.getCss()); }
@Override public ActionForward execute( ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); String languageId = ParamUtil.getString(request, "languageId"); Locale locale = LocaleUtil.fromLanguageId(languageId); if (LanguageUtil.isAvailableLocale(themeDisplay.getSiteGroupId(), locale)) { boolean persistState = ParamUtil.getBoolean(request, "persistState", true); if (themeDisplay.isSignedIn() && persistState) { User user = themeDisplay.getUser(); Contact contact = user.getContact(); AdminUtil.updateUser( request, user.getUserId(), user.getScreenName(), user.getEmailAddress(), user.getFacebookId(), user.getOpenId(), languageId, user.getTimeZoneId(), user.getGreeting(), user.getComments(), contact.getSmsSn(), contact.getFacebookSn(), contact.getJabberSn(), contact.getSkypeSn(), contact.getTwitterSn()); } session.setAttribute(Globals.LOCALE_KEY, locale); LanguageUtil.updateCookie(request, response, locale); } // Send redirect String redirect = ParamUtil.getString(request, "redirect"); String layoutURL = StringPool.BLANK; String queryString = StringPool.BLANK; int pos = redirect.indexOf(Portal.FRIENDLY_URL_SEPARATOR); if (pos == -1) { pos = redirect.indexOf(StringPool.QUESTION); } if (pos != -1) { layoutURL = redirect.substring(0, pos); queryString = redirect.substring(pos); } else { layoutURL = redirect; } Layout layout = themeDisplay.getLayout(); if (isGroupFriendlyURL(layout.getGroup(), layout, layoutURL, locale)) { if (PropsValues.LOCALE_PREPEND_FRIENDLY_URL_STYLE == 0) { redirect = layoutURL; } else { redirect = PortalUtil.getGroupFriendlyURL(layout.getLayoutSet(), themeDisplay, locale); } } else { if (PropsValues.LOCALE_PREPEND_FRIENDLY_URL_STYLE == 0) { if (themeDisplay.isI18n()) { redirect = layout.getFriendlyURL(locale); } else { redirect = PortalUtil.getLayoutURL(layout, themeDisplay, locale); } } else { redirect = PortalUtil.getLayoutFriendlyURL(layout, themeDisplay, locale); } } if (layout.isTypeControlPanel()) { redirect = redirect + queryString; } response.sendRedirect(redirect); return null; }