Changeset 24219 for main/trunk/greenstone3/src
- Timestamp:
- 2011-07-01T21:05:19+12:00 (13 years ago)
- Location:
- main/trunk/greenstone3/src/java/org/greenstone/gsdl3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/Action.java
r24198 r24219 105 105 meta_names.add(metadata.toString()); 106 106 } 107 108 // The XSL tranform for 109 // gsf:link type="source" 110 // makes use of 'assocfilepath' so need to make sure it's asked for 111 112 NodeList link_nodes = format.getElementsByTagName("gsf:link"); 113 for (int i=0; i<link_nodes.getLength(); i++) { 114 Element elem = (Element)link_nodes.item(i); 115 String type = elem.getAttribute("type"); 116 if (type.equals("source") || type.equals("sourcelinkfile")) { 117 meta_names.add("assocfilepath"); 118 } 119 } 120 107 108 // The XSL tranform for 109 // gsf:link type="source" 110 // makes use of 'assocfilepath' so need to make sure it's asked for 111 112 NodeList link_nodes = format.getElementsByTagName("gsf:link"); 113 for (int i=0; i<link_nodes.getLength(); i++) { 114 Element elem = (Element)link_nodes.item(i); 115 String type = elem.getAttribute("type"); 116 if (type.equals("source")) { 117 meta_names.add("assocfilepath"); 118 } else if (type.equals("sourcelinkfile")) { 119 meta_names.add("assocfilepath"); 120 //meta_names.add("srclinkFile"); 121 } 122 } 123 124 125 // get all the metadata necessary for when the user has used "gsf:equivlink" 126 // so that we can build up the equivlink from the metadata components it needs 127 link_nodes = format.getElementsByTagName("gsf:equivlinkgs3"); 128 if(link_nodes != null) { 129 130 String[] equivlink_metanames = {"equivDocIcon", "equivDocLink", "/equivDocLink"}; 131 132 for(int i = 0; i < equivlink_metanames.length; i++) { 133 StringBuffer metadata = new StringBuffer(); 134 metadata.append("all"); // this means the attr multiple = true; 135 metadata.append(GSConstants.META_RELATION_SEP); 136 137 metadata.append(GSConstants.META_SEPARATOR_SEP); 138 metadata.append(','); // attr separator = "," 139 metadata.append(GSConstants.META_SEPARATOR_SEP); 140 metadata.append(GSConstants.META_RELATION_SEP); 141 142 // the name of the metadata we're retrieving 143 metadata.append(equivlink_metanames[i]); 144 meta_names.add(metadata.toString()); 145 } 146 } 121 147 } 122 148 -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/XSLTUtil.java
r24117 r24219 97 97 } 98 98 99 /** Generates links to equivalent documents for a document with a default document icon/type. 100 * Links are generated from the parameters: a list of document icons which are each in turn embedded 101 * in the matching starting link tag in the list of docStartLinks (these starting links link to the 102 * equivalent documents in another format). Each link's start tag is closed with the corresponding 103 * closing tag in the docEndLinks list. Parameter token is the list separator. Parameter divider is 104 * the string that should separate each final link generated from the next. 105 * Returns a string that represents a sequence of links to equivalent documents, where the anchor is 106 * a document icon. */ 107 public static String getEquivDocLinks(String token, String docIconsString, String docStartLinksString, 108 String docEndLinksString, String divider) 109 { 110 String [] docIcons = StringUtils.split(docIconsString, token, -1); 111 String [] startLinks = StringUtils.split(docStartLinksString, token, -1); 112 String [] endLinks = StringUtils.split(docEndLinksString, token, -1); 113 114 StringBuffer buffer = new StringBuffer(); 115 for(int i = 0; i < docIcons.length; i++) { 116 if(i > 0) { 117 buffer.append(divider); 118 } 119 buffer.append(startLinks[i]+docIcons[i]+endLinks[i]); 120 } 121 122 return buffer.toString(); 123 } 124 99 125 100 126 public static String tidyWhitespace(String original) {
Note:
See TracChangeset
for help on using the changeset viewer.