/**
   * Explode a site into a map suitable for use in the map
   *
   * @see
   *     org.sakaiproject.portal.api.PortalSiteHelper#convertSiteToMap(javax.servlet.http.HttpServletRequest,
   *     org.sakaiproject.site.api.Site, java.lang.String, java.lang.String, java.lang.String,
   *     boolean, boolean, boolean, boolean, java.lang.String, boolean)
   */
  public Map convertSiteToMap(
      HttpServletRequest req,
      Site s,
      String prefix,
      String currentSiteId,
      String myWorkspaceSiteId,
      boolean includeSummary,
      boolean expandSite,
      boolean resetTools,
      boolean doPages,
      String toolContextPath,
      boolean loggedIn) {
    if (s == null) return null;
    Map<String, Object> m = new HashMap<String, Object>();

    // In case the effective is different than the actual site
    String effectiveSite = getSiteEffectiveId(s);

    boolean isCurrentSite =
        currentSiteId != null
            && (s.getId().equals(currentSiteId) || effectiveSite.equals(currentSiteId));
    m.put("isCurrentSite", Boolean.valueOf(isCurrentSite));
    m.put(
        "isMyWorkspace",
        Boolean.valueOf(
            myWorkspaceSiteId != null
                && (s.getId().equals(myWorkspaceSiteId)
                    || effectiveSite.equals(myWorkspaceSiteId))));
    int siteTitleMaxLength = ServerConfigurationService.getInt("site.title.maxlength", 25);
    String titleStr = s.getTitle();
    String fullTitle = titleStr;
    if (titleStr != null) {
      titleStr = titleStr.trim();
      if (titleStr.length() > siteTitleMaxLength && siteTitleMaxLength >= 10) {
        titleStr = titleStr.substring(0, siteTitleMaxLength - 4) + " ...";
      } else if (titleStr.length() > siteTitleMaxLength) {
        titleStr = titleStr.substring(0, siteTitleMaxLength);
      }
      titleStr = titleStr.trim();
    }
    m.put("siteTitle", Web.escapeHtml(titleStr));
    m.put("fullTitle", Web.escapeHtml(fullTitle));
    m.put("siteDescription", Web.escapeHtml(s.getDescription()));
    m.put("shortDescription", Web.escapeHtml(s.getShortDescription()));
    String siteUrl = Web.serverUrl(req) + ServerConfigurationService.getString("portalPath") + "/";
    if (prefix != null) siteUrl = siteUrl + prefix + "/";
    // siteUrl = siteUrl + Web.escapeUrl(siteHelper.getSiteEffectiveId(s));
    m.put("siteUrl", siteUrl + Web.escapeUrl(getSiteEffectiveId(s)));
    m.put("siteType", s.getType());
    m.put("siteId", s.getId());

    // TODO: This should come from the site neighbourhood.
    ResourceProperties rp = s.getProperties();
    String ourParent = rp.getProperty(PROP_PARENT_ID);
    // We are not really a child unless the parent exists
    // And we have a valid pwd
    boolean isChild = false;

    // Get the current site hierarchy
    if (ourParent != null && isCurrentSite) {
      List<Site> pwd = getPwd(s, ourParent);
      if (pwd != null) {
        List<Map> l = new ArrayList<Map>();
        for (int i = 0; i < pwd.size(); i++) {
          Site site = pwd.get(i);
          // System.out.println("PWD["+i+"]="+site.getId()+"
          // "+site.getTitle());
          Map<String, Object> pm = new HashMap<String, Object>();
          pm.put("siteTitle", Web.escapeHtml(site.getTitle()));
          pm.put("siteUrl", siteUrl + Web.escapeUrl(getSiteEffectiveId(site)));
          l.add(pm);
          isChild = true;
        }
        if (l.size() > 0) m.put("pwd", l);
      }
    }

    // If we are a child and have a non-zero length, pwd
    // show breadcrumbs
    if (isChild) {
      m.put("isChild", Boolean.valueOf(isChild));
      m.put("parentSite", ourParent);
    }

    if (includeSummary) {
      summarizeTool(m, s, "sakai.announce");
    }
    if (expandSite) {
      Map pageMap =
          pageListToMap(
              req,
              loggedIn,
              s, /* SitePage */
              null,
              toolContextPath,
              prefix,
              doPages,
              resetTools,
              includeSummary);
      m.put("sitePages", pageMap);
    }

    return m;
  }