Changeset 5694 for trunk/gsdl3/src/java/org/greenstone/gsdl3/action
- Timestamp:
- 2003-10-21T11:16:31+13:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/DocumentAction.java
r5401 r5694 87 87 document_name = document_name+"."+sibling_num+".ss"; 88 88 } 89 90 boolean expand_document = false; 91 String ed_arg = (String) params.get(GSParams.EXPAND_DOCUMENT); 92 if (ed_arg != null && ed_arg.equals("1")) { 93 expand_document = true; 94 } 95 96 97 boolean expand_contents = false; 98 if (expand_document) { // we always expand the contents with the text 99 expand_contents = true; 100 } else { 101 String ec_arg = (String) params.get(GSParams.EXPAND_CONTENTS); 102 if (ec_arg != null && ec_arg.equals("1")) { 103 expand_contents = true; 104 } 105 } 89 106 // get the additional data needed for the page 90 107 getBackgroundData(page_response, collection, lang); … … 129 146 } else if (document_type.equals("hierarchy")){ 130 147 get_structure = true; 131 // get the info needed for table of contents 132 ds_param = this.doc.createElement(GSXML.PARAM_ELEM); 133 ds_param_list.appendChild(ds_param); 134 ds_param.setAttribute(GSXML.NAME_ATT, "structure"); 135 ds_param.setAttribute(GSXML.VALUE_ATT, "ancestors"); 136 ds_param = this.doc.createElement(GSXML.PARAM_ELEM); 137 ds_param_list.appendChild(ds_param); 138 ds_param.setAttribute(GSXML.NAME_ATT, "structure"); 139 ds_param.setAttribute(GSXML.VALUE_ATT, "children"); 140 if (get_siblings) { 148 if (expand_contents) { 141 149 ds_param = this.doc.createElement(GSXML.PARAM_ELEM); 142 150 ds_param_list.appendChild(ds_param); 143 151 ds_param.setAttribute(GSXML.NAME_ATT, "structure"); 144 ds_param.setAttribute(GSXML.VALUE_ATT, "siblings"); 152 ds_param.setAttribute(GSXML.VALUE_ATT, "entire"); 153 } else { 154 // get the info needed for table of contents 155 ds_param = this.doc.createElement(GSXML.PARAM_ELEM); 156 ds_param_list.appendChild(ds_param); 157 ds_param.setAttribute(GSXML.NAME_ATT, "structure"); 158 ds_param.setAttribute(GSXML.VALUE_ATT, "ancestors"); 159 ds_param = this.doc.createElement(GSXML.PARAM_ELEM); 160 ds_param_list.appendChild(ds_param); 161 ds_param.setAttribute(GSXML.NAME_ATT, "structure"); 162 ds_param.setAttribute(GSXML.VALUE_ATT, "children"); 163 if (get_siblings) { 164 ds_param = this.doc.createElement(GSXML.PARAM_ELEM); 165 ds_param_list.appendChild(ds_param); 166 ds_param.setAttribute(GSXML.NAME_ATT, "structure"); 167 ds_param.setAttribute(GSXML.VALUE_ATT, "siblings"); 168 } 145 169 } 146 170 } else { … … 280 304 dc_request.appendChild(dc_param_list); 281 305 282 // the doc list for the content request is the same as the one for the structure request 283 dc_request.appendChild(basic_doc_list); 284 306 // the doc list for the content request is the same as the one for the structure request unless we want the whole document, in which case its the same as for the metadata request. 307 if (expand_document) { 308 dc_request.appendChild(dm_doc_list); 309 } else { 310 dc_request.appendChild(basic_doc_list); 311 } 285 312 Element dc_response_message = (Element) this.mr.process(dc_message); 286 path = GSPath.appendLink(path, GSXML.DOC_NODE_ELEM); 287 Element dc_response_doc = (Element) GSXML.getNodeByPath(dc_response_message, path); 288 Element dc_response_doc_content = (Element) GSXML.getChildByTagName(dc_response_doc, GSXML.NODE_CONTENT_ELEM); 313 Element dc_response_doc_list = (Element) GSXML.getNodeByPath(dc_response_message, path); 314 315 if (expand_document) { 316 // Merge the content with the structure information 317 NodeList dc_response_docs = dc_response_doc_list.getChildNodes(); 318 for (int i = 0; i < doc_nodes.getLength(); i++) { 319 doc_nodes.item(i).appendChild(this.doc.importNode(GSXML.getChildByTagName((Element)dc_response_docs.item(i), "nodeContent"), true)); 320 //GSXML.mergeMetadataLists(doc_nodes.item(i), dm_response_docs.item(i)); 321 } 322 } else { 323 324 //path = GSPath.appendLink(path, GSXML.DOC_NODE_ELEM); 325 Element dc_response_doc = (Element) GSXML.getChildByTagName(dc_response_doc_list, GSXML.DOC_NODE_ELEM); 326 Element dc_response_doc_content = (Element) GSXML.getChildByTagName(dc_response_doc, GSXML.NODE_CONTENT_ELEM); 289 327 290 328 291 boolean highlight_query_terms = true; 292 if (highlight_query_terms) { 293 dc_response_doc.removeChild(dc_response_doc_content); 294 295 dc_response_doc_content = highlightQueryTerms(request, dc_response_doc_content); 296 dc_response_doc.appendChild(dc_response_doc.getOwnerDocument().importNode(dc_response_doc_content, true)); 297 } 329 boolean highlight_query_terms = true; 330 if (highlight_query_terms) { 331 dc_response_doc.removeChild(dc_response_doc_content); 332 333 dc_response_doc_content = highlightQueryTerms(request, dc_response_doc_content); 334 dc_response_doc.appendChild(dc_response_doc.getOwnerDocument().importNode(dc_response_doc_content, true)); 335 } 336 337 /* 298 338 if (provide_annotations) { 299 339 String service_selected = (String)params.get(ENRICH_DOC_ARG); … … 323 363 } 324 364 } 365 366 */ 325 367 // use the returned id rather than the sent one cos there may have 326 368 // been modifiers such as .pr that are removed. … … 357 399 } 358 400 } 359 401 } 360 402 ///ystem.out.println("(DocumentAction) Page:\n" + this.converter.getPrettyString(result)); 361 403 return result; … … 383 425 // these could all be cached 384 426 Element info_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 385 String path = GSPath.appendLink(collection, "Document MetadataRetrieve");427 String path = GSPath.appendLink(collection, "DocumentContentRetrieve"); 386 428 // the format request - ignore for now, where does this request go to?? 387 429 Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, path, lang);
Note:
See TracChangeset
for help on using the changeset viewer.