Changeset 13830


Ignore:
Timestamp:
2007-01-30T17:33:33+13:00 (14 years ago)
Author:
kjdon
Message:

before adding display items into the list, we'll check for gs2 style macros - allowed _httpsite_ and _httpcollection_ at the moment

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/collection/Collection.java

    r13270 r13830  
    151151    Element display_list = (Element)GSXML.getChildByTagName(coll_config_xml, GSXML.DISPLAY_TEXT_ELEM+GSXML.LIST_MODIFIER);
    152152    if (display_list != null) {
     153        resolveMacros(display_list);
    153154        addDisplayItems(display_list);
    154155    }
    155156    return true;
    156157
     158    }
     159
     160    protected boolean resolveMacros(Element display_list) {
     161    if (display_list==null) return false;
     162    NodeList displaynodes = display_list.getElementsByTagName(GSXML.DISPLAY_TEXT_ELEM);
     163    if (displaynodes.getLength()>0) {
     164        String http_site = this.site_http_address;
     165        String http_collection = this.site_http_address +"/collect/"+this.cluster_name;
     166        for(int k=0; k<displaynodes.getLength(); k++) {
     167        Element d = (Element) displaynodes.item(k);
     168        String text = GSXML.getNodeText(d);
     169        text = text.replaceAll("_httpsite_", http_site);
     170        text = text.replaceAll("_httpcollection_", http_collection);
     171        GSXML.setNodeText(d, text);
     172        }
     173    }
     174    return true;
    157175    }
    158176    /**
Note: See TracChangeset for help on using the changeset viewer.