Changeset 3987


Ignore:
Timestamp:
2003-03-25T16:15:49+12:00 (21 years ago)
Author:
mdewsnip
Message:

Improvements to page element structure, for better image handling.

Location:
trunk/gsdl3/src/java/org/greenstone/gsdl3/action
Files:
4 edited

Legend:

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

    r3965 r3987  
    189189    dc_request.appendChild(ds_doc_list);
    190190
    191     // System.out.println("(DocumentAction) Content request:\n" + converter_.getString(dc_request));
    192191    Element dc_response_message = (Element) mr_.process(dc_message);
    193     // System.out.println("(DocumentAction) Content response:\n" + converter_.getString(dc_response));
    194192   
    195193    path = GSPath.appendLink(path, GSXML.DOC_NODE_ELEM);
     
    218216    page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.DISPLAY_ELEM), true));
    219217    page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true));
    220     page.appendChild(doc_.importNode(request, true));
     218    Element page_request = GSXML.duplicateWithNewName(doc_, request, "pageRequest", true);
     219    page.appendChild(page_request);
     220
     221    // get the collection or cluster description
     222    Element coll_about_message = doc_.createElement(GSXML.MESSAGE_ELEM);
     223    Element coll_about_request = GSXML.createBasicRequest(doc_, GSXML.REQUEST_TYPE_DESCRIBE,  collection, page.getAttribute(GSXML.LANG_ATT));
     224    coll_about_message.appendChild(coll_about_request);
     225    Element coll_about_response = (Element)mr_.process(coll_about_message);
     226
     227    // add the response to the page
     228    Element response = (Element) GSXML.getChildByTagName(coll_about_response, GSXML.RESPONSE_ELEM);
     229    Element page_response = GSXML.duplicateWithNewName(doc_, response, "pageResponse", false);
     230    page_response.appendChild(the_document);
    221231
    222232    // Add the results of the action to the page
    223     Element response = doc_.createElement(GSXML.RESPONSE_ELEM);
    224     page.appendChild(response);
    225     response.appendChild(the_document);
    226        
     233    page.appendChild(page_response);
     234    System.out.println("Page:\n" + converter_.getPrettyString(page));
     235
    227236    // Finally, process using the stylesheet, and return
    228237    String stylesheet = GSFile.stylesheetFile(config_, "document.xsl");
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/action/PageAction.java

    r3944 r3987  
    3535    page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true));
    3636    // add the cgi args request
    37     Element cgi_request = (Element)doc_.importNode(request, true);
    38     page.appendChild(cgi_request);
     37    Element page_request = GSXML.duplicateWithNewName(doc_, request, "pageRequest", true);
     38    page.appendChild(page_request);
    3939
    4040    if (page_name.equals(HOME_PAGE)) {
     
    4747    }
    4848    }
    49    
     49
     50
    5051    protected Element homePage(Element page, Element orig_message) {
    5152   
     
    9899
    99100    // add it in to the page xml tree
    100     page.appendChild(doc_.importNode(GSXML.getChildByTagName(coll_list_response, GSXML.RESPONSE_ELEM), true));
     101    Element response = (Element) GSXML.getChildByTagName(coll_list_response, GSXML.RESPONSE_ELEM);
     102    Element page_response = GSXML.duplicateWithNewName(doc_, response, "pageResponse", false);
     103    page.appendChild(page_response);
    101104
    102105    String stylesheet = GSFile.stylesheetFile(config_, "home.xsl");
     
    128131
    129132    // add the response to the page
    130     page.appendChild(doc_.importNode(GSXML.getChildByTagName(coll_about_response, GSXML.RESPONSE_ELEM), true));
     133    Element response = (Element) GSXML.getChildByTagName(coll_about_response, GSXML.RESPONSE_ELEM);
     134    Element page_response = GSXML.duplicateWithNewName(doc_, response, "pageResponse", false);
     135    page.appendChild(page_response);
    131136
    132137    // process using the stylesheet
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/action/ProcessAction.java

    r3966 r3987  
    3838    Element page = doc_.createElement(GSXML.PAGE_ELEM);
    3939    page.setAttribute(GSXML.LANG_ATT, request.getAttribute(GSXML.LANG_ATT));
     40    System.out.println("(ProcessAction) Page:\n" + converter_.getPrettyString(page));
    4041
    4142    // what is carried out depends on the request_type
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/action/QueryAction.java

    r3948 r3987  
    5757    // if we have this here, do we need to overwrite default values in the
    5858    // param list down below??
    59     Element cgi_request = (Element)doc_.importNode(request, true);
    60     page.appendChild(cgi_request);
     59    Element page_request = GSXML.duplicateWithNewName(doc_, request, "pageRequest", true);
     60    page.appendChild(page_request);
    6161
    6262    // extract the params from the cgi-request, and check that we have a coll specified
     
    123123        }
    124124    }
    125    
    126     // append the description to the page
    127     page.appendChild(description);
    128    
     125
     126    // get the collection or cluster description
     127    Element coll_about_message = doc_.createElement(GSXML.MESSAGE_ELEM);
     128    Element coll_about_request = GSXML.createBasicRequest(doc_, GSXML.REQUEST_TYPE_DESCRIBE,  collection, page.getAttribute(GSXML.LANG_ATT));
     129    coll_about_message.appendChild(coll_about_request);
     130    Element coll_about_response = (Element)mr_.process(coll_about_message);
     131
     132    // add the response to the page
     133    Element response = (Element) GSXML.getChildByTagName(coll_about_response, GSXML.RESPONSE_ELEM);
     134    Element page_response = GSXML.duplicateWithNewName(doc_, response, "pageResponse", false);
     135    page_response.appendChild(description);
     136
    129137    Element format_response = (Element)mr_info_response.getElementsByTagName(GSXML.RESPONSE_ELEM).item(1); // the second response
    130138
    131139    // just a display request
    132140    if (request_type.equals("d")) {
     141        page.appendChild(page_response);
     142        System.out.println("(QueryAction) Finished page:\n" + converter_.getPrettyString(page));
    133143        // output the page
    134144        // process using the stylesheet
     
    145155    Element query_param_list = (Element)doc_.importNode(cgi_param_list, true);
    146156    mr_query_request.appendChild(query_param_list);
    147        
    148     Element mr_query_response = (Element)mr_.process(mr_query_message);
     157        Element mr_query_response = (Element)mr_.process(mr_query_message);
    149158
    150159    path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER);
     
    172181       
    173182        Element result_response = (Element)GSXML.getChildByTagName(mr_query_response, GSXML.RESPONSE_ELEM);
    174        
     183
    175184        page.appendChild(doc_.importNode(result_response, true));
    176        
    177185        GSXSLT.absoluteIncludePaths(style_doc, config_);
    178186        return (Element)transformer_.transform(style_doc, page);   
     
    183191    Element format_elem = getAndTransformFormat(format_response);
    184192    if (format_elem != null) {
    185        
    186193        GSXSLT.mergeStylesheets(style_doc, format_elem);
    187194    }
    188    
    189195
    190196    // we have a doc list, so get the metadata - for now, get title.
     
    208214
    209215    mr_metadata_request.appendChild(doc_.importNode(document_list, true));
    210     Element mr_metadata_response = (Element)mr_.process(mr_metadata_message);   
    211     Element result_response = (Element)GSXML.getChildByTagName(mr_metadata_response, GSXML.RESPONSE_ELEM);
    212    
     216    Element mr_metadata_response = (Element) mr_.process(mr_metadata_message); 
     217
     218    path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER);
     219    Element query_result_document_list = (Element) GSXML.getNodeByPath(mr_metadata_response, path);
     220
     221    if (query_result_document_list != null) {
     222        page_response.appendChild(doc_.importNode(query_result_document_list, true));
     223    }
    213224    // If there is some metadata about the query results, add it in
    214225    if (query_result_metadata_list != null) {
    215         result_response.appendChild(query_result_metadata_list);
     226        page_response.appendChild(doc_.importNode(query_result_metadata_list, true));
    216227    }
    217228    // If there is some metadata about the query results, add it in
    218229    if (query_term_info_list != null) {
    219         result_response.appendChild(query_term_info_list);
    220     }
    221 
    222     page.appendChild(doc_.importNode(result_response, true));
    223    
     230        page_response.appendChild(doc_.importNode(query_term_info_list, true));
     231    }
     232
     233    // Add the pageResponse element to the page
     234    page.appendChild(page_response);
     235    // System.out.println("Query page:\n" + converter_.getPrettyString(page));
     236
    224237    // output the page
    225238    // process using the stylesheet
    226239    GSXSLT.absoluteIncludePaths(style_doc, config_);
    227240    return (Element)transformer_.transform(style_doc, page);
    228    
    229241    }
    230242}
Note: See TracChangeset for help on using the changeset viewer.