Ignore:
Timestamp:
2017-05-18T13:46:43+12:00 (7 years ago)
Author:
kjdon
Message:

this wasn't looking lang args to the depositormetadata cfg line, and was therefore setting depositormetaata to [l=en]. Made it use lang params

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/recpt/depositoraction.cpp

    r30466 r31687  
    461461      text_t cfgfile_name = filename_cat (collecthome, args[macro_prefix + "dirname"], "etc", "collect.cfg");
    462462      text_t key;
     463      text_t params;
    463464      text_tarray cfgline;
    464465      char *cstr = cfgfile_name.getcstr();
     
    467468
    468469      text_t metadata_str;
     470      text_t default_metadata_str;
    469471      if (confin) {
    470472    while (read_cfg_line(confin, cfgline) >= 0) {
    471       if (cfgline.size () >= 2) {
     473      if (cfgline.size () >= 3) {
    472474        key = cfgline[0];
    473475        if (key == "collectionmeta") {
    474476          if (cfgline[1] == "depositormetadata") {
    475         metadata_str = cfgline[2];
    476          
    477         break;
     477        if (cfgline.size() == 3) {
     478          // no lang arg
     479          default_metadata_str = cfgline[2];
     480        } else {
     481          params = cfgline[2];
     482          text_t::const_iterator first=params.begin()+1;
     483          text_t::const_iterator last=params.end()-1;
     484          params=substr(first, last);
     485          // get the lang out of params
     486          paramhashtype params_hash;
     487          splitparams(params, params_hash);
     488     
     489          text_t lang = params_hash["l"];
     490          if (lang == args["l"]) {
     491            metadata_str = cfgline[3];
     492            break;
     493          }
     494          if (default_metadata_str.empty()) {
     495            default_metadata_str = cfgline[3];
     496          }
     497        }
    478498          }
    479499        }
     
    482502      }
    483503      confin.close ();
    484      
     504      // use default value if there was one
     505     if (metadata_str.empty()) {
     506    metadata_str = default_metadata_str;
     507      }
     508     // if there still isn't one set, use this default setting
    485509      if (metadata_str == "") {
    486510    metadata_str = "{\"name\":\"dc.Title\",\"label\":\"Title\",\"tooltip\":\"dc.Title: A name given to the resource.\",\"type\":\"text\"}, {\"name\":\"dc.Creator\",\"label\":\"Creator\",\"tooltip\":\"dc.Creator: An entity primarily responsible for making the content of the resource.\",\"type\":\"text\"}, {\"name\":\"dc.Description\",\"label\":\"Description\",\"tooltip\":\"dc.Description: An account of the content of the resource.\",\"type\":\"textarea\"}";
Note: See TracChangeset for help on using the changeset viewer.