public String buildSelectStartGalleries(String htmlAttributes) {

        StringBuffer result = new StringBuffer(1024);
        HttpServletRequest request = getJsp().getRequest();
        // set the attributes for the select tag
        if (htmlAttributes != null) {
            htmlAttributes += " name=\"" + PARAM_STARTGALLERY_PREFIX;
        }
        Map<String, A_CmsAjaxGallery> galleriesTypes = OpenCms.getWorkplaceManager().getGalleries();
        if (galleriesTypes != null) {

            // sort the galleries by localized name
            Map<String, String> localizedGalleries = new TreeMap<String, String>();
            for (Iterator<String> i = galleriesTypes.keySet().iterator(); i.hasNext();) {
                String currentGalleryType = i.next();
                String localizedName = CmsWorkplaceMessages.getResourceTypeName(this, currentGalleryType);
                localizedGalleries.put(localizedName, currentGalleryType);
            }

            for (Iterator<Map.Entry<String, String>> i = localizedGalleries.entrySet().iterator(); i.hasNext();) {
                Map.Entry<String, String> entry = i.next();
                // first: retrieve the gallery type
                String currentGalleryType = entry.getValue();
                // second: retrieve the gallery type id
                int currentGalleryTypeId = 0;
                try {
                    currentGalleryTypeId = OpenCms.getResourceManager().getResourceType(currentGalleryType).getTypeId();
                } catch (CmsLoaderException e) {
                    // resource type not found, log error
                    if (LOG.isErrorEnabled()) {
                        LOG.error(e.getLocalizedMessage(), e);
                    }
                    continue;
                }
                // third: get the available galleries for this gallery type id
                List<CmsResource> availableGalleries = A_CmsAjaxGallery.getGalleries(currentGalleryTypeId, getCms());

                // forth: fill the select box
                List<String> options = new ArrayList<String>(availableGalleries.size() + 2);
                List<String> values = new ArrayList<String>(availableGalleries.size() + 2);
                options.add(key(Messages.GUI_PREF_STARTGALLERY_PRESELECT_0));
                values.add(INPUT_DEFAULT);
                options.add(key(Messages.GUI_PREF_STARTGALLERY_NONE_0));
                values.add(INPUT_NONE);

                String savedValue = computeStartGalleryPreselection(request, currentGalleryType);
                int counter = 2;
                int selectedIndex = 0;
                Iterator<CmsResource> iGalleries = availableGalleries.iterator();
                while (iGalleries.hasNext()) {
                    CmsResource res = iGalleries.next();
                    String rootPath = res.getRootPath();
                    String sitePath = getCms().getSitePath(res);
                    // select the value
                    if ((savedValue != null) && (savedValue.equals(rootPath))) {
                        selectedIndex = counter;
                    }
                    counter++;
                    // gallery title
                    String title = "";
                    try {
                        // read the gallery title
                        title = getCms().readPropertyObject(
                            sitePath,
                            CmsPropertyDefinition.PROPERTY_TITLE,
                            false).getValue("");
                    } catch (CmsException e) {
                        // error reading title property
                        if (LOG.isErrorEnabled()) {
                            LOG.error(e.getLocalizedMessage(), e);
                        }
                    }
                    options.add(title.concat(" (").concat(sitePath).concat(")"));
                    values.add(rootPath);

                }
                // select the value
                if ((savedValue != null) && savedValue.equals(INPUT_NONE)) {
                    selectedIndex = 1;
                }

                // create the table row for the current resource type
                result.append("<tr>\n\t<td style=\"white-space: nowrap;\">");

                result.append(entry.getKey());
                result.append("</td>\n\t<td>");
                result.append(buildSelect(htmlAttributes + currentGalleryType + "\"", options, values, selectedIndex));
                result.append("</td>\n</tr>\n");

            }

        }
        return result.toString();
    }
public String buildSelectStartGalleries ( String htmlAttributes ) { StringBuffer result = new StringBuffer ( 1024 ) ; HttpServletRequest request = getJsp ( ) . getRequest ( ) ; if ( htmlAttributes != null ) { htmlAttributes += " name=\"" + PARAM_STARTGALLERY_PREFIX ; } Map < String , A_CmsAjaxGallery > galleriesTypes = OpenCms . getWorkplaceManager ( ) . getGalleries ( ) ; if ( galleriesTypes != null ) { Map < String , String > localizedGalleries = new TreeMap < String , String > ( ) ; for ( Iterator < String > i = galleriesTypes . keySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { String currentGalleryType = i . next ( ) ; String localizedName = CmsWorkplaceMessages . getResourceTypeName ( this , currentGalleryType ) ; localizedGalleries . put ( localizedName , currentGalleryType ) ; } for ( Iterator < Map . Entry < String , String > > i = localizedGalleries . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Map . Entry < String , String > entry = i . next ( ) ; String currentGalleryType = entry . getValue ( ) ; int currentGalleryTypeId = 0 ; try { currentGalleryTypeId = OpenCms . getResourceManager ( ) . getResourceType ( currentGalleryType ) . getTypeId ( ) ; } catch ( CmsLoaderException e ) { if ( LOG . isErrorEnabled ( ) ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } continue ; } List < CmsResource > availableGalleries = A_CmsAjaxGallery . getGalleries ( currentGalleryTypeId , getCms ( ) ) ; List < String > options = new ArrayList < String > ( availableGalleries . size ( ) + 2 ) ; List < String > values = new ArrayList < String > ( availableGalleries . size ( ) + 2 ) ; options . add ( key ( Messages . GUI_PREF_STARTGALLERY_PRESELECT_0 ) ) ; values . add ( INPUT_DEFAULT ) ; options . add ( key ( Messages . GUI_PREF_STARTGALLERY_NONE_0 ) ) ; values . add ( INPUT_NONE ) ; String savedValue = computeStartGalleryPreselection ( request , currentGalleryType ) ; int counter = 2 ; int selectedIndex = 0 ; Iterator < CmsResource > iGalleries = availableGalleries . iterator ( ) ; while ( iGalleries . hasNext ( ) ) { CmsResource res = iGalleries . next ( ) ; String rootPath = res . getRootPath ( ) ; String sitePath = getCms ( ) . getSitePath ( res ) ; if ( ( savedValue != null ) && ( savedValue . equals ( rootPath ) ) ) { selectedIndex = counter ; } counter ++ ; String title = "" ; try { title = getCms ( ) . readPropertyObject ( sitePath , CmsPropertyDefinition . PROPERTY_TITLE , false ) . getValue ( "" ) ; } catch ( CmsException e ) { if ( LOG . isErrorEnabled ( ) ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } } options . add ( title . concat ( " (" ) . concat ( sitePath ) . concat ( ")" ) ) ; values . add ( rootPath ) ; } if ( ( savedValue != null ) && savedValue . equals ( INPUT_NONE ) ) { selectedIndex = 1 ; } result . append ( "<tr>\n\t<td style=\"white-space: nowrap;\">" ) ; result . append ( entry . getKey ( ) ) ; result . append ( "</td>\n\t<td>" ) ; result . append ( buildSelect ( htmlAttributes + currentGalleryType + "\"" , options , values , selectedIndex ) ) ; result . append ( "</td>\n</tr>\n" ) ; } } return result . toString ( ) ; }
Builds the HTML for the start galleries settings as select boxes.<p>

@param htmlAttributes optional HTML attributes for the &lgt;select&gt; tag
@return the HTML for start galleries select boxes