public List<BannerMainItem> getBannerMainItems() { String param = getSettings("banner.spaces", null); if (param != null) { List<BannerMainItem> items = new ArrayList<BannerMainItem>(); OrganizationController oc = getOrganisationController(); String[] spaceIds = StringUtil.split(param); for (String spaceId : spaceIds) { if (oc.isSpaceAvailable(spaceId, getUserId())) { BannerMainItem item = new BannerMainItem(oc.getSpaceInstLightById(spaceId)); String[] subspaceIds = oc.getAllSubSpaceIds(spaceId, getUserId()); for (String subspaceId : subspaceIds) { item.addSubspace(oc.getSpaceInstLightById(subspaceId)); } String[] appIds = oc.getAvailCompoIdsAtRoot(spaceId, getUserId()); for (String appId : appIds) { ComponentInstLight app = oc.getComponentInstLight(appId); if (!app.isHidden()) { item.addApp(app); } } items.add(item); } } return items; } return new ArrayList<BannerMainItem>(); }
private String printBreadCrumb() { StringBuilder result = new StringBuilder(); String information = getExtraInformation(); String path = getPath(); // print javascript to go to spaces in displayed path result.append(printScript()); if (!StringUtil.isDefined(getSpaceJavascriptCallback())) { setSpaceJavascriptCallback("goSpace"); } result.append("<div id=\"breadCrumb\">"); boolean emptyBreadCrumb = true; // Display spaces path from root to component String language = (getMainSessionController() == null) ? "" : getMainSessionController().getFavoriteLanguage(); if (StringUtil.isDefined(getComponentId()) || StringUtil.isDefined(getSpaceId())) { List<SpaceInst> spaces; OrganizationController organizationController = OrganizationControllerProvider.getOrganisationController(); if (StringUtil.isDefined(getComponentId())) { spaces = organizationController.getSpacePathToComponent(getComponentId()); } else { spaces = organizationController.getSpacePath(getSpaceId()); } boolean firstSpace = true; for (SpaceInst spaceInst : spaces) { String spaceId = spaceInst.getId(); if (!spaceId.startsWith("WA")) { spaceId = "WA" + spaceId; } String href = "javascript:" + getSpaceJavascriptCallback() + "('" + spaceId + "')"; if (!isClickable()) { href = "#"; } if (!firstSpace) { result.append(CONNECTOR); } result.append("<a href=\"").append(href).append("\""); result.append(" class=\"space\""); result.append(" id=\"space").append(spaceId).append("\""); result.append(">"); result.append(Encode.forHtml(spaceInst.getName(language))); result.append("</a>"); firstSpace = false; emptyBreadCrumb = false; } if (StringUtil.isDefined(getComponentId())) { // Display component's label ComponentInstLight componentInstLight = organizationController.getComponentInstLight(getComponentId()); if (componentInstLight != null) { result.append(CONNECTOR); result.append("<a href=\""); if (!isClickable()) { result.append("#"); } else if (StringUtil.isDefined(getComponentJavascriptCallback())) { result .append("javascript:") .append(getComponentJavascriptCallback()) .append("('") .append(getComponentId()) .append("')"); } else { result .append(URLUtil.getApplicationURL()) .append(URLUtil.getURL(getSpaceId(), getComponentId())); if (ignoreComponentLink()) { result.append("Main"); } else { result.append(getComponentLink()); } } result.append("\""); result.append(" class=\"component\""); result.append(" id=\"bc_").append(componentInstLight.getId()).append("\""); result.append(">"); result.append(Encode.forHtml(componentInstLight.getLabel(language))); result.append("</a>"); emptyBreadCrumb = false; } } } else { if (getDomainName() != null) { result.append(getDomainName()); emptyBreadCrumb = false; } if (getComponentName() != null) { if (getDomainName() != null) { result.append(CONNECTOR); } if (getComponentLink() != null) { result .append("<a href=\"") .append(getComponentLink()) .append("\">") .append(getComponentName()) .append("</a>"); } else { result.append(getComponentName()); } emptyBreadCrumb = false; } } // Display path List<BrowseBarElement> elements = getElements(); if (!elements.isEmpty()) { for (BrowseBarElement element : elements) { if (!emptyBreadCrumb) { result.append(CONNECTOR); } result.append("<a href=\"").append(element.getLink()).append("\""); result.append(" class=\"element\""); if (StringUtil.isDefined(element.getId())) { result.append(" id=\"").append(element.getId()).append("\""); } result.append(">"); result.append(EncodeHelper.javaStringToHtmlString(element.getLabel())); result.append("</a>"); emptyBreadCrumb = false; } } else if (StringUtil.isDefined(path)) { if (!emptyBreadCrumb) { result.append(CONNECTOR); } result.append("<span class=\"path\">"); result.append(path); result.append("</span>"); } // Display extra information if (StringUtil.isDefined(information)) { if (!emptyBreadCrumb) { result.append(CONNECTOR); } result.append("<span class=\"information\">"); result.append(information); result.append("</span>"); } result.append("</div>"); return result.toString(); }