Changeset 25991

Show
Ignore:
Timestamp:
19.07.2012 16:42:15 (7 years ago)
Author:
sjm84
Message:

All collection pages will try to include any formatting that is global to that collection

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/PageAction.java

    r25651 r25991  
    2828    { 
    2929        Element message = this.converter.nodeToElement(message_node); 
    30  
    3130        Element request = (Element) GSXML.getChildByTagName(message, GSXML.REQUEST_ELEM); 
     31        Element paramList = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 
     32        String collection = ""; 
     33        if(paramList != null) 
     34        { 
     35            HashMap<String, Serializable> params = GSXML.extractParams(paramList, false); 
     36            if (params != null && params.get(GSParams.COLLECTION) != null) 
     37            { 
     38                collection = (String) params.get(GSParams.COLLECTION); 
     39            } 
     40        } 
     41 
    3242        // the page name is the subaction 
    3343        String page_name = request.getAttribute(GSXML.SUBACTION_ATT); 
     
    5868            logger.error("unknown page specified!"); 
    5969            response = unknownPage(request); 
     70        } 
     71 
     72        Element formatMessage = this.doc.createElement(GSXML.MESSAGE_ELEM); 
     73        Element formatRequest = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, collection, new UserContext(request)); 
     74        formatMessage.appendChild(formatRequest); 
     75        Element formatResponseMessage = (Element) this.mr.process(formatMessage); 
     76        Element formatResponse = (Element) GSXML.getChildByTagName(formatResponseMessage, GSXML.RESPONSE_ELEM); 
     77 
     78        Element globalFormat = (Element) GSXML.getChildByTagName(formatResponse, GSXML.FORMAT_ELEM); 
     79        if (globalFormat != null) 
     80        { 
     81            response.appendChild(globalFormat); 
    6082        } 
    6183