コード例 #1
0
  public void editSharing(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    Portlet portlet = ActionUtil.getPortlet(actionRequest);

    PortletPreferences portletPreferences =
        ActionUtil.getLayoutPortletSetup(actionRequest, portlet);

    actionRequest = ActionUtil.getWrappedActionRequest(actionRequest, portletPreferences);

    updateAnyWebsite(actionRequest, portletPreferences);
    updateFacebook(actionRequest, portletPreferences);
    updateFriends(actionRequest, portletPreferences);
    updateGoogleGadget(actionRequest, portletPreferences);
    updateNetvibes(actionRequest, portletPreferences);

    portletPreferences.store();

    if (!SessionErrors.isEmpty(actionRequest)) {
      return;
    }

    String portletResource = ParamUtil.getString(actionRequest, "portletResource");

    SessionMessages.add(
        actionRequest,
        PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET,
        portletResource);

    SessionMessages.add(
        actionRequest,
        PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_UPDATED_CONFIGURATION);
  }
コード例 #2
0
  public void editScope(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    Portlet portlet = ActionUtil.getPortlet(actionRequest);

    PortletPreferences portletPreferences =
        ActionUtil.getLayoutPortletSetup(actionRequest, portlet);

    actionRequest = ActionUtil.getWrappedActionRequest(actionRequest, portletPreferences);

    updateScope(actionRequest, portlet);

    if (!SessionErrors.isEmpty(actionRequest)) {
      return;
    }

    String portletResource = ParamUtil.getString(actionRequest, "portletResource");

    SessionMessages.add(
        actionRequest,
        PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET,
        portletResource);

    SessionMessages.add(
        actionRequest,
        PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_UPDATED_CONFIGURATION);
  }
コード例 #3
0
  public void restoreArchivedSetup(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    Portlet portlet = ActionUtil.getPortlet(actionRequest);

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    Settings portletInstanceSettings =
        SettingsFactoryUtil.getSettings(
            new PortletInstanceSettingsLocator(themeDisplay.getLayout(), portlet.getPortletId()));

    ModifiableSettings portletInstanceModifiableSettings =
        portletInstanceSettings.getModifiableSettings();

    String name = ParamUtil.getString(actionRequest, "name");

    ArchivedSettings archivedSettings =
        SettingsFactoryUtil.getPortletInstanceArchivedSettings(
            themeDisplay.getSiteGroupId(), portlet.getRootPortletId(), name);

    portletInstanceModifiableSettings.reset();

    portletInstanceModifiableSettings.setValues(archivedSettings);

    portletInstanceModifiableSettings.store();

    String portletResource = ParamUtil.getString(actionRequest, "portletResource");

    SessionMessages.add(
        actionRequest,
        PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET,
        portletResource);
  }
コード例 #4
0
  @Override
  public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
      throws IOException, PortletException {

    super.processAction(actionRequest, actionResponse);

    MultiSessionMessages.add(
        actionRequest, PortalUtil.getPortletId(actionRequest) + "requestProcessed");
  }
コード例 #5
0
  public void resetPrototype(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    SitesUtil.resetPrototype(themeDisplay.getLayout());

    MultiSessionMessages.add(
        actionRequest, PortalUtil.getPortletId(actionRequest) + "requestProcessed");
  }
コード例 #6
0
  public void resetCustomizationView(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    if (!LayoutPermissionUtil.contains(
        themeDisplay.getPermissionChecker(), themeDisplay.getLayout(), ActionKeys.CUSTOMIZE)) {

      throw new PrincipalException();
    }

    LayoutTypePortlet layoutTypePortlet = themeDisplay.getLayoutTypePortlet();

    if ((layoutTypePortlet != null)
        && layoutTypePortlet.isCustomizable()
        && layoutTypePortlet.isCustomizedView()) {

      layoutTypePortlet.resetUserPreferences();
    }

    MultiSessionMessages.add(
        actionRequest, PortalUtil.getPortletId(actionRequest) + "requestProcessed");
  }