Changeset 4189
- Timestamp:
- 2003-04-17T15:26:50+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/BrowseAction.java
r4144 r4189 17 17 18 18 public static final String CLASSIFIER_ARG = "cl"; 19 19 public static final String SIBLING_ARG = "sib"; 20 20 /* add the action specific args to the cgi param list 21 21 */ … … 67 67 } 68 68 69 //whether to retrieve siblings or not 70 boolean get_siblings = false; 71 String sibs = (String) params.get(SIBLING_ARG); 72 if (sibs != null && sibs.equals("1")) { 73 get_siblings = true; 74 } 75 69 76 // the main response for the page is in a pageResponse element 70 77 Element page_response = doc_.createElement(GSXML.PAGE_RESPONSE_ELEM); … … 114 121 } 115 122 116 // create a classifier elem to return in the page117 Element page_classifier = doc_.createElement(GSXML.CLASSIFIER_ELEM);118 page_response.appendChild(page_classifier);119 120 123 // the id of the classifier is the top id of the selected node 121 124 String top_id = OID.getTop(classifier_node); 122 page_classifier.setAttribute(GSXML.NAME_ATT, top_id);123 125 124 126 // add in the format info into the stylesheet 125 System.out.println("transforming format:"+converter_.getString(format_response));127 //System.out.println("transforming format:"+converter_.getString(format_response)); 126 128 Element format_elem = getAndTransformFormat(format_response); 127 System.out.println("transformed format:"+converter_.getString(format_elem));129 //System.out.println("transformed format:"+converter_.getString(format_elem)); 128 130 if (format_elem != null) { 129 131 Element this_format = GSXML.getNamedElement(format_elem, GSXML.CLASSIFIER_ELEM, GSXML.NAME_ATT, top_id); … … 155 157 param.setAttribute(GSXML.NAME_ATT, "structure"); 156 158 param.setAttribute(GSXML.VALUE_ATT, "children"); 159 if (get_siblings) { 160 param = doc_.createElement(GSXML.PARAM_ELEM); 161 param_list.appendChild(param); 162 param.setAttribute(GSXML.NAME_ATT, "structure"); 163 param.setAttribute(GSXML.VALUE_ATT, "siblings"); 164 } 157 165 158 166 // put the classifier node into a classifier node list … … 169 177 path = GSPath.appendLink(path, GSXML.CLASS_NODE_ELEM); 170 178 path = GSPath.appendLink(path, GSXML.NODE_STRUCTURE_ELEM); 171 // assume that we always get back the top level CL1 node - want to throw this away179 // assume that we always get back the top level CL1 node - this becomes the page_classifier node 172 180 path = GSPath.appendLink(path, GSXML.CLASS_NODE_ELEM); 173 181 Element cl_structure = (Element)GSXML.getNodeByPath(classify_response, … … 181 189 } 182 190 183 // add the classifier nodes from the structure request into teh page_classifier 184 NodeList cl_nodes = cl_structure.getChildNodes(); 185 for (int i=0; i<cl_nodes.getLength(); i++) { 186 Node n = cl_nodes.item(i); 187 if (n.getNodeType() == Node.TEXT_NODE) { 188 // ignore 189 continue; 190 } 191 page_classifier.appendChild(doc_.importNode(n, true)); 192 } 193 191 // add the classifier node as the page classifier 192 Element page_classifier = GSXML.duplicateWithNewName(doc_, cl_structure, GSXML.CLASSIFIER_ELEM, true); 193 page_response.appendChild(page_classifier); 194 page_classifier.setAttribute(GSXML.NAME_ATT, top_id); 194 195 195 196 // get the metadata for each classifier node, … … 205 206 // create a metadata request for the classifier, and add it to 206 207 // the the message 207 cl_nodes = page_classifier.getElementsByTagName(GSXML.CLASS_NODE_ELEM);208 NodeList cl_nodes = page_classifier.getElementsByTagName(GSXML.CLASS_NODE_ELEM); 208 209 209 210 if (cl_nodes.getLength() > 0) { … … 304 305 305 306 306 //System.out.println("(BrowseAction) Page:\n" + converter_.getPrettyString(page));307 System.out.println("(BrowseAction) Page:\n" + converter_.getPrettyString(page)); 307 308 308 309 // transform the page
Note:
See TracChangeset
for help on using the changeset viewer.