Changeset 3987 for trunk/gsdl3/src/java/org/greenstone/gsdl3/action
- Timestamp:
- 2003-03-25T16:15:49+12:00 (21 years ago)
- 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 189 189 dc_request.appendChild(ds_doc_list); 190 190 191 // System.out.println("(DocumentAction) Content request:\n" + converter_.getString(dc_request));192 191 Element dc_response_message = (Element) mr_.process(dc_message); 193 // System.out.println("(DocumentAction) Content response:\n" + converter_.getString(dc_response));194 192 195 193 path = GSPath.appendLink(path, GSXML.DOC_NODE_ELEM); … … 218 216 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.DISPLAY_ELEM), true)); 219 217 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); 221 231 222 232 // 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 227 236 // Finally, process using the stylesheet, and return 228 237 String stylesheet = GSFile.stylesheetFile(config_, "document.xsl"); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/PageAction.java
r3944 r3987 35 35 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true)); 36 36 // 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); 39 39 40 40 if (page_name.equals(HOME_PAGE)) { … … 47 47 } 48 48 } 49 49 50 50 51 protected Element homePage(Element page, Element orig_message) { 51 52 … … 98 99 99 100 // 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); 101 104 102 105 String stylesheet = GSFile.stylesheetFile(config_, "home.xsl"); … … 128 131 129 132 // 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); 131 136 132 137 // process using the stylesheet -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/ProcessAction.java
r3966 r3987 38 38 Element page = doc_.createElement(GSXML.PAGE_ELEM); 39 39 page.setAttribute(GSXML.LANG_ATT, request.getAttribute(GSXML.LANG_ATT)); 40 System.out.println("(ProcessAction) Page:\n" + converter_.getPrettyString(page)); 40 41 41 42 // what is carried out depends on the request_type -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/QueryAction.java
r3948 r3987 57 57 // if we have this here, do we need to overwrite default values in the 58 58 // 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); 61 61 62 62 // extract the params from the cgi-request, and check that we have a coll specified … … 123 123 } 124 124 } 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 129 137 Element format_response = (Element)mr_info_response.getElementsByTagName(GSXML.RESPONSE_ELEM).item(1); // the second response 130 138 131 139 // just a display request 132 140 if (request_type.equals("d")) { 141 page.appendChild(page_response); 142 System.out.println("(QueryAction) Finished page:\n" + converter_.getPrettyString(page)); 133 143 // output the page 134 144 // process using the stylesheet … … 145 155 Element query_param_list = (Element)doc_.importNode(cgi_param_list, true); 146 156 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); 149 158 150 159 path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER); … … 172 181 173 182 Element result_response = (Element)GSXML.getChildByTagName(mr_query_response, GSXML.RESPONSE_ELEM); 174 183 175 184 page.appendChild(doc_.importNode(result_response, true)); 176 177 185 GSXSLT.absoluteIncludePaths(style_doc, config_); 178 186 return (Element)transformer_.transform(style_doc, page); … … 183 191 Element format_elem = getAndTransformFormat(format_response); 184 192 if (format_elem != null) { 185 186 193 GSXSLT.mergeStylesheets(style_doc, format_elem); 187 194 } 188 189 195 190 196 // we have a doc list, so get the metadata - for now, get title. … … 208 214 209 215 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 } 213 224 // If there is some metadata about the query results, add it in 214 225 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)); 216 227 } 217 228 // If there is some metadata about the query results, add it in 218 229 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 224 237 // output the page 225 238 // process using the stylesheet 226 239 GSXSLT.absoluteIncludePaths(style_doc, config_); 227 240 return (Element)transformer_.transform(style_doc, page); 228 229 241 } 230 242 }
Note:
See TracChangeset
for help on using the changeset viewer.