Ejemplo n.º 1
0
  public static BreadcrumbEntry getGuestGroupBreadcrumbEntry(ThemeDisplay themeDisplay)
      throws Exception {

    Group group = GroupLocalServiceUtil.getGroup(themeDisplay.getCompanyId(), GroupConstants.GUEST);

    if (group.getPublicLayoutsPageCount() == 0) {
      return null;
    }

    LayoutSet layoutSet = LayoutSetLocalServiceUtil.getLayoutSet(group.getGroupId(), false);

    BreadcrumbEntry breadcrumbEntry = new BreadcrumbEntry();

    Account account = themeDisplay.getAccount();

    breadcrumbEntry.setTitle(account.getName());

    String layoutSetFriendlyURL = PortalUtil.getLayoutSetFriendlyURL(layoutSet, themeDisplay);

    if (themeDisplay.isAddSessionIdToURL()) {
      layoutSetFriendlyURL =
          PortalUtil.getURLWithSessionId(layoutSetFriendlyURL, themeDisplay.getSessionId());
    }

    breadcrumbEntry.setURL(layoutSetFriendlyURL);

    return breadcrumbEntry;
  }
Ejemplo n.º 2
0
  private static void _addGroupsBreadcrumbEntries(
      List<BreadcrumbEntry> breadcrumbEntries,
      ThemeDisplay themeDisplay,
      LayoutSet layoutSet,
      boolean includeParentGroups)
      throws Exception {

    Group group = layoutSet.getGroup();

    if (group.isControlPanel()) {
      return;
    }

    if (includeParentGroups) {
      LayoutSet parentLayoutSet = _getParentLayoutSet(layoutSet);

      if (parentLayoutSet != null) {
        _addGroupsBreadcrumbEntries(breadcrumbEntries, themeDisplay, parentLayoutSet, true);
      }
    }

    int layoutsPageCount = 0;

    if (layoutSet.isPrivateLayout()) {
      layoutsPageCount = group.getPrivateLayoutsPageCount();
    } else {
      layoutsPageCount = group.getPublicLayoutsPageCount();
    }

    if ((layoutsPageCount > 0) && !group.isGuest()) {
      String layoutSetFriendlyURL = PortalUtil.getLayoutSetFriendlyURL(layoutSet, themeDisplay);

      if (themeDisplay.isAddSessionIdToURL()) {
        layoutSetFriendlyURL =
            PortalUtil.getURLWithSessionId(layoutSetFriendlyURL, themeDisplay.getSessionId());
      }

      BreadcrumbEntry breadcrumbEntry = new BreadcrumbEntry();

      breadcrumbEntry.setTitle(group.getDescriptiveName(themeDisplay.getLocale()));
      breadcrumbEntry.setURL(layoutSetFriendlyURL);

      breadcrumbEntries.add(breadcrumbEntry);
    }
  }
Ejemplo n.º 3
0
  private static void _addLayoutBreadcrumbEntries(
      List<BreadcrumbEntry> breadcrumbEntries, ThemeDisplay themeDisplay, Layout layout)
      throws Exception {

    if (layout.getParentLayoutId() != LayoutConstants.DEFAULT_PARENT_LAYOUT_ID) {

      Layout parentLayout = LayoutLocalServiceUtil.getParentLayout(layout);

      _addLayoutBreadcrumbEntries(breadcrumbEntries, themeDisplay, parentLayout);
    }

    BreadcrumbEntry breadcrumbEntry = new BreadcrumbEntry();

    breadcrumbEntry.setBaseModel(layout);

    LayoutType layoutType = layout.getLayoutType();

    if (!layoutType.isBrowsable()) {
      breadcrumbEntry.setBrowsable(false);
    }

    String layoutName = layout.getName(themeDisplay.getLocale());

    if (layout.isTypeControlPanel()) {
      if (layoutName.equals(LayoutConstants.NAME_CONTROL_PANEL_DEFAULT)) {
        layoutName = LanguageUtil.get(themeDisplay.getLocale(), "control-panel");
      }
    }

    breadcrumbEntry.setTitle(layoutName);

    String layoutURL = PortalUtil.getLayoutFullURL(layout, themeDisplay);

    if (themeDisplay.isAddSessionIdToURL()) {
      layoutURL = PortalUtil.getURLWithSessionId(layoutURL, themeDisplay.getSessionId());
    }

    breadcrumbEntry.setURL(layoutURL);

    breadcrumbEntries.add(breadcrumbEntry);
  }