Changeset 3998


Ignore:
Timestamp:
2003-03-26T12:13:33+12:00 (21 years ago)
Author:
kjdon
Message:

now gets the collection info if a collection is specified - this is needed for the httpPath metadata used to find the coll image, and code tidy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/action/BrowseAction.java

    r3988 r3998  
    5353
    5454    // the first part of the data for the page is the cgi-params
    55     // Element page_request = GSXML.duplicateWithNewName(doc_, request, "pageRequest", true);
    56     // page.appendChild(page_request);
    57     Element cgi_request = (Element)doc_.importNode(request, true);
    58     page.appendChild(cgi_request);
    59 
     55    Element page_request = GSXML.duplicateWithNewName(doc_, request, GSXML.PAGE_REQUEST_ELEM, true);
     56    page.appendChild(page_request);
     57   
    6058    // extract the params from the cgi-request, and check that we have a coll specified
    6159    Element cgi_paramList = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
     
    7068    }
    7169   
     70    // the main response for the page is in a pageResponse element
     71    Element page_response = doc_.createElement(GSXML.PAGE_RESPONSE_ELEM);
     72    page.appendChild(page_response);
     73
    7274    String lang = request.getAttribute(GSXML.LANG_ATT);
    7375    String to = GSPath.appendLink(collection, service_name);
     
    8082    Element info_request = GSXML.createBasicRequest(doc_, GSXML.REQUEST_TYPE_DESCRIBE, to, lang);
    8183    info_message.appendChild(info_request);
    82 
     84   
     85    // also get the collection description (should be just metadata?) for the http address stuff
     86    Element coll_info_request = GSXML.createBasicRequest(doc_, GSXML.REQUEST_TYPE_DESCRIBE, collection, lang);
     87    info_message.appendChild(coll_info_request);
    8388    // also get the format stuff now if there is some
    8489    Element format_request = GSXML.createBasicRequest(doc_, GSXML.REQUEST_TYPE_FORMAT, to, lang);
    8590    info_message.appendChild(format_request);
    8691    // process the requests
     92
    8793    Element info_response = (Element) mr_.process(info_message);
    8894
    89     // get out the description
    90     String path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.SERVICE_ELEM);
    91     Element description = (Element)doc_.importNode(GSXML.getNodeByPath(info_response, path), true);
    92     page.appendChild(description);
    93    
    94     Element format_response = (Element)info_response.getElementsByTagName(GSXML.RESPONSE_ELEM).item(1); // the second response
    95    
    96     // the main response for the page is in a response element
    97     Element response = doc_.createElement(GSXML.RESPONSE_ELEM);
    98     page.appendChild(response);
    99    
     95    // the three responses
     96    NodeList responses = info_response.getElementsByTagName(GSXML.RESPONSE_ELEM);
     97    Element service_response = (Element)responses.item(0);
     98    Element coll_response = (Element)responses.item(1);
     99    Element format_response = (Element)responses.item(2);
     100
     101    Element service_description = (Element)GSXML.getChildByTagName(service_response, GSXML.SERVICE_ELEM);
     102    page_response.appendChild(doc_.importNode(service_description, true));
     103   
     104    Element coll_description = (Element)GSXML.getChildByTagName(coll_response, GSXML.COLLECTION_ELEM);
     105    page_response.appendChild(doc_.importNode(coll_description, true));
     106   
     107       
    100108    // get the node that the user has clicked on
    101109    String classifier_node = (String)params.get(CLASSIFIER_ARG);
     
    110118    // create a classifier elem to return in the page
    111119    Element page_classifier = doc_.createElement(GSXML.CLASSIFIER_ELEM);
    112     response.appendChild(page_classifier);
     120    page_response.appendChild(page_classifier);
    113121
    114122    // the id of the classifier is the top id of the selected node
     
    149157    Element classify_response = (Element)mr_.process(classify_message);
    150158    // get the structure element
    151     path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.CLASS_NODE_ELEM+GSXML.LIST_MODIFIER);
     159    String path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.CLASS_NODE_ELEM+GSXML.LIST_MODIFIER);
    152160    path = GSPath.appendLink(path, GSXML.CLASS_NODE_ELEM);
    153161    path = GSPath.appendLink(path, GSXML.NODE_STRUCTURE_ELEM);
Note: See TracChangeset for help on using the changeset viewer.