コード例 #1
0
  private String _getBreadcrumbLayoutURL(
      Layout selLayout, String selLayoutParam, PortletURL portletURL, ThemeDisplay themeDisplay)
      throws Exception {
    if (portletURL == null) {
      return PortalUtil.getLayoutURL(selLayout, themeDisplay);
    } else {
      portletURL.setParameter(selLayoutParam, String.valueOf(selLayout.getPlid()));

      if (selLayout.isTypeControlPanel()) {
        if (themeDisplay.getDoAsGroupId() > 0) {
          portletURL.setParameter("doAsGroupId", String.valueOf(themeDisplay.getDoAsGroupId()));
        }

        if (themeDisplay.getRefererPlid() != LayoutConstants.DEFAULT_PLID) {
          portletURL.setParameter("refererPlid", String.valueOf(themeDisplay.getRefererPlid()));
        }
      }

      return portletURL.toString();
    }
  }
コード例 #2
0
  protected long getRefererGroupId(ThemeDisplay themeDisplay) throws Exception {

    long refererGroupId = 0;

    try {
      Layout refererLayout = LayoutLocalServiceUtil.getLayout(themeDisplay.getRefererPlid());

      refererGroupId = refererLayout.getGroupId();
    } catch (NoSuchLayoutException nsle) {
    }

    return refererGroupId;
  }
コード例 #3
0
  @Override
  public void addAndStoreSelection(
      PortletRequest portletRequest, String className, long classPK, int assetEntryOrder)
      throws Exception {

    String referringPortletResource =
        ParamUtil.getString(portletRequest, "referringPortletResource");

    if (Validator.isNull(referringPortletResource)) {
      return;
    }

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

    Layout layout = LayoutLocalServiceUtil.getLayout(themeDisplay.getRefererPlid());

    PortletPreferences portletPreferences =
        PortletPreferencesFactoryUtil.getPortletSetup(
            themeDisplay.getScopeGroupId(), layout, referringPortletResource, null);

    String selectionStyle = portletPreferences.getValue("selectionStyle", "dynamic");

    if (selectionStyle.equals("dynamic")) {
      return;
    }

    AssetEntry assetEntry = AssetEntryLocalServiceUtil.getEntry(className, classPK);

    addSelection(
        themeDisplay,
        portletPreferences,
        referringPortletResource,
        assetEntry.getEntryId(),
        assetEntryOrder,
        className);

    portletPreferences.store();
  }
コード例 #4
0
  @Override
  public void addSelection(
      ThemeDisplay themeDisplay,
      PortletPreferences portletPreferences,
      String portletId,
      long assetEntryId,
      int assetEntryOrder,
      String assetEntryType)
      throws Exception {

    AssetEntry assetEntry = AssetEntryLocalServiceUtil.getEntry(assetEntryId);

    String[] assetEntryXmls = portletPreferences.getValues("assetEntryXml", new String[0]);

    String assetEntryXml = _getAssetEntryXml(assetEntryType, assetEntry.getClassUuid());

    if (!ArrayUtil.contains(assetEntryXmls, assetEntryXml)) {
      if (assetEntryOrder > -1) {
        assetEntryXmls[assetEntryOrder] = assetEntryXml;
      } else {
        assetEntryXmls = ArrayUtil.append(assetEntryXmls, assetEntryXml);
      }

      portletPreferences.setValues("assetEntryXml", assetEntryXmls);
    }

    long plid = themeDisplay.getRefererPlid();

    if (plid == 0) {
      plid = themeDisplay.getPlid();
    }

    List<AssetEntry> assetEntries = new ArrayList<AssetEntry>();

    assetEntries.add(assetEntry);

    notifySubscribers(portletPreferences, plid, portletId, assetEntries);
  }