/** * Returns a html select box filled with the current users accessible sites.<p> * * @param htmlAttributes attributes that will be inserted into the generated html * @return a html select box filled with the current users accessible sites */ public String getSiteSelect(String htmlAttributes) { List options = new ArrayList(); List values = new ArrayList(); int selectedIndex = 0; List sites = OpenCms.getSiteManager().getAvailableSites(getCms(), true); Iterator i = sites.iterator(); int pos = 0; while (i.hasNext()) { CmsSite site = (CmsSite)i.next(); values.add(site.getSiteRoot()); options.add(site.getTitle()); if (site.getSiteRoot().equals(getSettings().getSite())) { // this is the user's current site selectedIndex = pos; } pos++; } return buildSelect(htmlAttributes, options, values, selectedIndex); }
/** * Returns a html select box filled with the current users accessible sites.<p> * * @param htmlAttributes attributes that will be inserted into the generated html * @return a html select box filled with the current users accessible sites */ public String getSiteSelect(String htmlAttributes) { List<String> options = new ArrayList<String>(); List<String> values = new ArrayList<String>(); int selectedIndex = 0; List<CmsSite> sites = OpenCms.getSiteManager().getAvailableSites(getCms(), true); Iterator<CmsSite> i = sites.iterator(); int pos = 0; while (i.hasNext()) { CmsSite site = i.next(); values.add(site.getSiteRoot()); options.add(substituteSiteTitle(site.getTitle())); String siteRoot = CmsFileUtil.addTrailingSeparator(site.getSiteRoot()); String settingsSiteRoot = getSettings().getSite(); if (settingsSiteRoot != null) { settingsSiteRoot = CmsFileUtil.addTrailingSeparator(settingsSiteRoot); } if (siteRoot.equals(settingsSiteRoot)) { // this is the user's current site selectedIndex = pos; } pos++; } return buildSelect(htmlAttributes, options, values, selectedIndex); }
return buildSelect(htmlAttributes, options, values, selectedIndex);
return buildSelect(htmlAttributes, options, values, selectedIndex);
return buildSelect(htmlAttributes, options, values, selectedIndex);
return buildSelect(htmlAttributes, options, values, selectedIndex);