Ignore:
Timestamp:
2024-04-11T12:44:19+12:00 (3 weeks ago)
Author:
kjdon
Message:

added archivedir option for backwards compatibility for old pre built collections

Location:
main/trunk/greenstone2/runtime-src/src/recpt
Files:
2 edited

Legend:

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

    r28912 r38924  
    105105text_t browsetoolsclass::get_cover_image()
    106106{
    107   return "_httpprefix_/collect/[collection]/index/assoc/{Or}{[parent(Top):assocfilepath],[assocfilepath]}/cover.jpg";
     107  return "_httpprefix_/collect/[collection]/index/assoc/{Or}{[parent(Top):assocfilepath],[assocfilepath],[parent(Top):archivedir],[archivedir]}/cover.jpg";
    108108}
    109109
    110110text_t browsetoolsclass::get_assocfile_path()
    111111{
    112   return "_httpprefix_/collect/[collection]/index/assoc/{Or}{[parent(Top):assocfilepath],[assocfilepath]}/";
     112  return "_httpprefix_/collect/[collection]/index/assoc/{Or}{[parent(Top):assocfilepath],[assocfilepath],[parent(Top):archivedir],[archivedir]}/";
    113113
    114114}
  • main/trunk/greenstone2/runtime-src/src/recpt/documentaction.cpp

    r28899 r38924  
    770770
    771771    metadata.insert ("assocfilepath");
    772 
     772    metadata.insert("archivedir"); // backwards compatibility
    773773    comerror_t err;
    774774    OptionValue_tarray options;
     
    884884      }
    885885   
    886       if (is_top (arg_d))
    887     disp.setmacro ("thisOID", displayclass::defaultpackage, dm_safe(response.docInfo[0].metadata["assocfilepath"].values[0]));
    888       else {
     886      if (is_top (arg_d)) {
     887        text_t thisOID = response.docInfo[0].metadata["assocfilepath"].values[0];
     888        if (thisOID.empty()) {
     889          thisOID = response.docInfo[0].metadata["archivedir"].values[0];
     890        }
     891    disp.setmacro ("thisOID", displayclass::defaultpackage, dm_safe(thisOID));
     892      }
     893        else {
    889894    MetadataInfo_t *parentad = response.docInfo[0].metadata["assocfilepath"].parent;
    890895    text_t thisOID;
     
    893898      parentad = parentad->parent;
    894899    }
     900        if (thisOID.empty()) {
     901          // try archivedir
     902          MetadataInfo_t *parentad = response.docInfo[0].metadata["archivedir"].parent;
     903          while (parentad != NULL) {
     904            thisOID = parentad->values[0];
     905            parentad = parentad->parent;
     906          }
     907        }
    895908    disp.setmacro ("thisOID", displayclass::defaultpackage, dm_safe(thisOID));
    896909      }
Note: See TracChangeset for help on using the changeset viewer.