Changeset 22214 for main


Ignore:
Timestamp:
2010-06-01T15:22:29+12:00 (14 years ago)
Author:
kjdon
Message:

tidied up output_custom_metadata. when outputing dc.Identifier, it will first look for gs.OAIResourceURL (user defined link to the document), then for srclink_file (greenstone defined source file stored in index/assoc), the it will output a link to the greenstone version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/oaiservr/dublincore.cpp

    r21799 r22214  
    7474
    7575bool dublin_core::output_custom_metadata(ostream &output, outconvertclass &outconvert, bool &headerDone, const text_t &collection, ResultDocInfo_t &docInfo) {
    76   text_t value = get_metadata_value(docInfo, "srclink_file");
     76  text_t value = get_metadata_value(docInfo, "gs.OAIResourceURL");
    7777  if (value.empty()) {
    78     value = "gs doc"; // todo, situation where no source doc.
    79   } else {
    80     if (starts_with(value, "[")) {
    81       // its a format statement type value eg [SourceFile], need to get the appropriate metadata
    82       value = substr(findchar(value.begin(), value.end(), '[')+1,findchar(value.begin(), value.end(), ']') );
    83       value = get_metadata_value(docInfo, value);
    84     }
     78    // try srclink_file
     79    value = get_metadata_value(docInfo, "srclink_file");
     80    if (value.empty()) {
     81      // we have no file to link to, so link to the Greenstone version of the
     82      // document
     83      value = this->oaiConfigure->getBaseLibraryURL()+"?a=d&c="+collection+"&d="+docInfo.OID;
     84    } else {
     85      if (starts_with(value, "[")) {
     86    // its a format statement type value eg [SourceFile], need to get the appropriate metadata
     87    value = substr(findchar(value.begin(), value.end(), '[')+1,findchar(value.begin(), value.end(), ']') );
     88    value = get_metadata_value(docInfo, value);
     89      }
     90     
     91      if (!value.empty()) {
     92    text_t assocfilepath = get_metadata_value(docInfo, "assocfilepath");
     93    if (!assocfilepath.empty()) {
     94      value = this->oaiConfigure->getBaseDocRoot()+"/collect/"+collection+"/index/assoc/"+assocfilepath+"/"+value;
     95    } else {
     96      value = "";
     97    }
     98      }
     99    }
    85100  }
    86   if (!value.empty()) {
    87     text_t assocfilepath = get_metadata_value(docInfo, "assocfilepath");
    88     if (!assocfilepath.empty()) {
    89       value = this->oaiConfigure->getCollectionConfig("", "baseDocRoot")+"/collect/"+collection+"/index/assoc/"+assocfilepath+"/"+value;
    90     } else {
    91       value = "";
    92     }
    93    
    94   }
    95101  if (!value.empty()) {
    96102    if (!headerDone) {
Note: See TracChangeset for help on using the changeset viewer.