Changeset 30634
- Timestamp:
- 2016-07-28T12:58:54+12:00 (7 years ago)
- Location:
- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractBrowse.java
r29989 r30634 234 234 Element cl = (Element) classifiers.item(i); 235 235 Element new_cl = (Element) doc.importNode(cl, false); // just import this node, not the children 236 237 //String content = cl.getAttribute(GSXML.CLASSIFIER_CONTENT_ATT); 238 236 cl_list.appendChild(new_cl); 237 238 // have we got a displayItem for the classifier title? 239 String text = getDisplayText(cl, GSXML.DISPLAY_TEXT_NAME, lang, "en", "metadata_names"); 239 240 //get the classify title from the database 240 241 String class_id = cl.getAttribute(GSXML.NAME_ATT); 241 242 String content = getMetadata(class_id, "Title"); 242 243 cl_list.appendChild(new_cl); 244 String text = GSXML.getDisplayText(cl, GSXML.DISPLAY_TEXT_NAME, lang, "en"); 245 if (text == null || text.equals("")) 246 { 247 // no display element was specified, use the metadata name 248 // for now this looks in the class properties file 249 // this needs to use a general metadata thing instead 250 text = getMetadataNameText(content + ".buttonname", lang); 251 } 252 if (text == null) 253 { 254 text = content; 255 } 256 243 if (text == null || text.equals("")) { 244 245 // no display element was specified, use the metadata name 246 if (!content.equals("")) { 247 248 text = getTextString(content + ".buttonname", lang, "metadata_names"); 249 if (text == null) { 250 251 text = content; 252 } 253 } 254 255 if (text == null) { 256 text=class_id; 257 } 258 } 257 259 Element cl_name = GSXML.createDisplayTextElement(doc, GSXML.DISPLAY_TEXT_NAME, text); 258 260 new_cl.appendChild(cl_name); … … 260 262 // description 261 263 262 String meta_name = get MetadataNameText(content, lang);264 String meta_name = getTextString(content, lang, "metadata_names"); 263 265 if (meta_name == null) 264 266 { -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2TextSearch.java
r29558 r30634 253 253 } 254 254 index_ids.add(shortname); 255 String display_name = GSXML.getDisplayText(index, GSXML.DISPLAY_TEXT_NAME, lang, "en");255 String display_name = getDisplayText(index, GSXML.DISPLAY_TEXT_NAME, lang, "en", "metadata_names"); 256 256 if (display_name.equals("")) 257 257 { … … 261 261 display_name = shortname; 262 262 } 263 String d_name = getTextString(display_name+".buttonname", lang, "metadata_names"); 264 if (d_name == null) { 265 d_name = getTextString(cleanUpMetadata(display_name)+".buttonname", lang, "metadata_names"); 266 } 267 if (d_name == null) { 268 d_name = getTextString(display_name, lang, "metadata_names"); 269 } 270 if (d_name != null) { 271 272 display_name = d_name; 273 } 263 274 } 264 275 index_names.add(display_name); … … 266 277 } 267 278 279 protected String cleanUpMetadata(String meta) { 280 // remove namespace, and only take the first item if there is a list of them. 281 282 logger.error("clean up "+meta); 283 String[] parts = meta.split("[,;]"); 284 String cleaned = parts[0]; 285 if (cleaned.lastIndexOf('.') != -1) { 286 cleaned = cleaned.substring(cleaned.lastIndexOf('.')+1); 287 } 288 logger.error("returning "+cleaned); 289 return cleaned; 290 291 } 268 292 protected void getIndexSubcollectionData(ArrayList<String> index_sub_ids, ArrayList<String> index_sub_names, String lang) 269 293 { … … 282 306 } 283 307 index_sub_ids.add(shortname); 284 String display_name = GSXML.getDisplayText(indexsub, GSXML.DISPLAY_TEXT_NAME, lang, "en");308 String display_name = getDisplayText(indexsub, GSXML.DISPLAY_TEXT_NAME, lang, "en"); 285 309 if (display_name.equals("")) 286 310 { … … 311 335 } 312 336 index_lang_ids.add(shortname); 313 String display_name = GSXML.getDisplayText(indexlang, GSXML.DISPLAY_TEXT_NAME, lang, "en");337 String display_name = getDisplayText(indexlang, GSXML.DISPLAY_TEXT_NAME, lang, "en", "metadata_names"); 314 338 if (display_name.equals("")) 315 339 {
Note:
See TracChangeset
for help on using the changeset viewer.