Changeset 32203 for main/trunk/greenstone2
- Timestamp:
- 2018-06-19T11:41:54+12:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/runtime-src/src/oaiservr/dublincore.cpp
r24226 r32203 99 99 } 100 100 101 // output dc:identifier for gs.OAIResourceURL, srclink, and link (whichever are defined) 101 102 bool dublin_core::output_custom_metadata(ostream &output, outconvertclass &outconvert, bool &headerDone, const text_t &collection, ResultDocInfo_t &docInfo) { 103 text_tarray values; 102 104 text_t value = get_metadata_value(docInfo, "gs.OAIResourceURL"); 103 if (value.empty()) { 104 // try srclinkFile (the metaname "srclink_file" is deprecated, use "srclinkFile") 105 value = get_metadata_value(docInfo, "srclinkFile"); 106 if (value.empty()) { 107 // we have no file to link to, so link to the Greenstone version of the 108 // document 109 value = this->oaiConfigure->getBaseLibraryURL()+"?a=d&c="+collection+"&d="+docInfo.OID; 110 } else { 111 if (starts_with(value, "[")) { 112 // its a format statement type value eg [SourceFile], need to get the appropriate metadata 113 value = substr(findchar(value.begin(), value.end(), '[')+1,findchar(value.begin(), value.end(), ']') ); 114 value = get_metadata_value(docInfo, value); 105 if (!value.empty()) { 106 values.push_back(value); 107 } 108 // try srclinkFile (the metaname "srclink_file" is deprecated, use "srclinkFile") 109 value = get_metadata_value(docInfo, "srclinkFile"); 110 if (!value.empty()) { 111 if (starts_with(value, "[")) { 112 // its a format statement type value eg [SourceFile], need to get the appropriate metadata 113 value = substr(findchar(value.begin(), value.end(), '[')+1,findchar(value.begin(), value.end(), ']') ); 114 value = get_metadata_value(docInfo, value); 115 } 116 117 if (!value.empty()) { 118 text_t assocfilepath = get_metadata_value(docInfo, "assocfilepath"); 119 if (!assocfilepath.empty()) { 120 value = this->oaiConfigure->getBaseDocRoot()+"/collect/"+collection+"/index/assoc/"+assocfilepath+"/"+value; 121 values.push_back(value); 122 } else { 123 value = ""; 115 124 } 116 117 if (!value.empty()) { 118 text_t assocfilepath = get_metadata_value(docInfo, "assocfilepath"); 119 if (!assocfilepath.empty()) { 120 value = this->oaiConfigure->getBaseDocRoot()+"/collect/"+collection+"/index/assoc/"+assocfilepath+"/"+value; 121 } else { 122 value = ""; 123 } 124 } 125 } 125 } 126 126 } 127 if (!value.empty()) { 128 if (!headerDone) { 129 this->output_metadata_header(output); 130 headerDone = true; 131 } 127 // now add link 128 value = this->oaiConfigure->getBaseLibraryURL()+"?a=d&c="+collection+"&d="+docInfo.OID; 129 values.push_back(value); 130 131 if (!headerDone) { 132 this->output_metadata_header(output); 133 headerDone = true; 134 } 135 for (int i=0; i<values.size(); i++) { 132 136 if (this->oaiConfigure->getOAIVersion() >= 200) { 133 output << outconvert << " <dc:identifier>" << xml_safe(value ) << "</dc:identifier>\n";137 output << outconvert << " <dc:identifier>" << xml_safe(values[i]) << "</dc:identifier>\n"; 134 138 } 135 139 else { 136 output << outconvert << " <identifier>" << xml_safe(value ) << "</identifier>\n";140 output << outconvert << " <identifier>" << xml_safe(values[i]) << "</identifier>\n"; 137 141 } 138 142 } 143 139 144 return true; 140 145 }
Note:
See TracChangeset
for help on using the changeset viewer.