Changeset 27145 for main/trunk


Ignore:
Timestamp:
2013-03-28T14:01:26+13:00 (11 years ago)
Author:
kjdon
Message:

get the format info even when we are just displaying the search page. This means that we will get any global format info, including for example additionalHeaderContent template which may link to a different theme just for the collection

File:
1 edited

Legend:

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

    r26026 r27145  
    7070        }
    7171
     72        // get the format info - there may be global format info in the collection that searching needs
     73        Element format_elem = getFormatInfo(to, userContext);
     74        // set the format type
     75        format_elem.setAttribute(GSXML.TYPE_ATT, "search");
     76        // for now just add to the response
     77        page_response.appendChild(this.doc.importNode(format_elem, true));
     78
    7279        if (request_type.indexOf("d") != -1)
    7380        {
     
    115122        mr_query_request.appendChild(query_param_list);
    116123
    117         // also get the format stuff now if there is some
    118         Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, userContext);
    119         mr_query_message.appendChild(format_request);
    120 
    121124        logger.debug(GSXML.xmlNodeToString(mr_query_message));
    122125
     
    133136        }
    134137
    135         NodeList responses = mr_query_response.getElementsByTagName(GSXML.RESPONSE_ELEM);
    136         Element query_response = (Element) responses.item(0);
    137         Element format_response = (Element) responses.item(1);
    138 
     138        Element query_response = (Element) GSXML.getChildByTagName(mr_query_response, GSXML.RESPONSE_ELEM);
    139139        Element query_result_metadata_list = (Element) GSXML.getChildByTagName(query_response, GSXML.METADATA_ELEM + GSXML.LIST_MODIFIER);
    140140        if (query_result_metadata_list == null)
     
    196196        HashSet<String> metadata_names = new HashSet<String>();
    197197        metadata_names.add("Title");
    198         // add in the format info to the stylesheet if there is any
    199         Element format_elem = (Element) GSXML.getChildByTagName(format_response, GSXML.FORMAT_ELEM);
     198        // we already got the format element earlier
    200199        if (format_elem != null)
    201200        {
    202             Element global_format_elem = (Element) GSXML.getChildByTagName(format_response, GSXML.GLOBAL_FORMAT_ELEM);
    203             if (global_format_elem != null)
    204             {
    205                 GSXSLT.mergeFormatElements(format_elem, global_format_elem, false);
    206             }
    207             // set the format type
    208             format_elem.setAttribute(GSXML.TYPE_ATT, "search");
    209             // for now just add to the response
    210             page_response.appendChild(this.doc.importNode(format_elem, true));
    211             getRequiredMetadataNames(format_elem, metadata_names);
     201          getRequiredMetadataNames(format_elem, metadata_names);
    212202        }
    213203
Note: See TracChangeset for help on using the changeset viewer.