Changeset 13850


Ignore:
Timestamp:
2007-02-05T15:06:31+13:00 (15 years ago)
Author:
kjdon
Message:

collections should be public unless explicitly made private

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/core/MessageRouter.java

    r13837 r13850  
    774774    logger.info("Activating collection: "+col_name+".");
    775775
    776     // now we need to look at the etc/collectionConfigure.xml file, and see whether the collection is public
    777     String public_info="false";
     776    // now we need to look at the etc/collectionConfig.xml file, and see whether the collection is public
     777    boolean is_public = true; // public unless state otherwise
    778778    File collectionConfig_file= new File(GSFile.collectionConfigFile(this.site_home, col_name));
    779779    if (!collectionConfig_file.exists() ) {
     
    783783   
    784784    Document collectionConfig_doc = this.converter.getDOM(collectionConfig_file);
    785     Element collectionConfig_info = collectionConfig_doc.getDocumentElement();
    786 
    787     NodeList metadateList_node_list=null;
    788     if (collectionConfig_info!=null){
    789         metadateList_node_list = collectionConfig_info.getElementsByTagName(GSXML.METADATA_ELEM);
    790      }
    791 
    792     for (int i=0; i<metadateList_node_list.getLength(); i++) {
    793         Element opt = (Element)metadateList_node_list.item(i);
    794         String name = opt.getAttribute(GSXML.NAME_ATT);
    795         if (name.equals("public")) {
    796         public_info = GSXML.getValue(opt);
    797         }
    798     }
    799 
     785    if (collectionConfig_doc != null) {
     786        Element collectionConfig_info = collectionConfig_doc.getDocumentElement();
     787
     788        if (collectionConfig_info!=null){
     789        Element metadata_list = (Element) GSXML.getChildByTagName(collectionConfig_info,GSXML.METADATA_ELEM + GSXML.LIST_MODIFIER);
     790        if (metadata_list != null) {
     791            Element meta_elem = (Element) GSXML.getNamedElement(metadata_list, GSXML.METADATA_ELEM, GSXML.NAME_ATT, "public");
     792            if (meta_elem != null) {
     793            String value = GSXML.getValue(meta_elem).toLowerCase().trim();
     794            if (value.equals("false")) {
     795                is_public = false;
     796            }
     797            }
     798        }
     799        }
     800    }
    800801
    801802    // now we need to look for the etc/collectionInit.xml file, and see what sort of Collection to load
     
    832833        // add to list of collections
    833834        this.module_map.put(col_name, c);
    834         public_info=public_info.toLowerCase().trim();
    835          if(public_info.equals("true")){
    836         //add short description_ to collection_list_
     835       
     836        if(is_public) {
     837        // only public collections will appear on the home page
     838        // add short description_ to collection_list_
    837839        Element e = this.doc.createElement(GSXML.COLLECTION_ELEM);
    838840        e.setAttribute(GSXML.NAME_ATT, col_name);
    839841        this.collection_list.appendChild(e);
    840         }else{
    841         return false;
    842         }
     842        }
    843843        return true;
    844844    } else {
Note: See TracChangeset for help on using the changeset viewer.