Ignore:
Timestamp:
2004-01-28T15:10:55+13:00 (20 years ago)
Author:
kjdon
Message:

modified the datelist display so that it can use other metadata eg dc.Date not just Date. The classifier itself had been modified a while ago to take a datemeta argument, and then build the classifier on that metadata rather than assuming Date. It now adds a mdtype value into the top level classifier node, which contains the name of the date metadata. The documentaction when making the nav bar macros looks for mdtype if it comes across a datelist, and sets the dm arg for that classifier button. datelist browser now looks for the dm arg and uses that metadata to create the special years and months bit down the side. Formattools is also modified. It used to modify the Date metadata to display it as xx month YYYY - now it does that for any metadata that ends in .Date - ignores namespaces

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/formattools.cpp

    r6020 r6645  
    154154
    155155
     156text_t remove_namespace(const text_t &meta_name) {
     157  text_t::const_iterator end = meta_name.end();
     158  text_t::const_iterator it = findchar(meta_name.begin(), end, '.');
     159  if (it != end) {
     160    return substr(it+1, end);
     161  }
     162  return meta_name;
     163
     164}
    156165// returns a date of form 31 _textmonthnn_ 1999
    157166// input is date of type 19991231
     
    858867
    859868  MetadataInfo_t *parent = docinfo.metadata[meta.metaname].parent;
    860 
     869  text_t no_ns_metaname = remove_namespace(meta.metaname);
    861870  switch (meta.parentcommand) {
    862871  case pNone:
     
    873882    for (int i=start_i; i<=end_i; i++) {
    874883      if (!first) tmp += meta.functionoptions;
    875       if (meta.metaname == "Date") tmp += format_date (metaname_rec.values[i]);
    876       else if (meta.metaname == "Language") tmp += iso639(metaname_rec.values[i]);
     884     
     885      if (no_ns_metaname == "Date") tmp += format_date (metaname_rec.values[i]);
     886      else if (no_ns_metaname == "Language") tmp += iso639(metaname_rec.values[i]);
    877887      else tmp += metaname_rec.values[i];
    878888      first = false;
     
    890900    text_t metadata_item = docinfo.metadata[meta.metaname].values[metaname_index];
    891901   
    892     if (meta.metaname == "Date")
     902    if (no_ns_metaname == "Date")
    893903      return format_date (metadata_item);
    894     else if (meta.metaname == "Language")
     904    else if (no_ns_metaname == "Language")
    895905      return iso639(metadata_item);
    896906    if (meta.metacommand & mCgiSafe)
     
    902912  case pImmediate:
    903913    if (parent != NULL) {
    904       if (meta.metaname == "Date")
     914      if (no_ns_metaname == "Date")
    905915    return format_date (parent->values[0]);
    906916      if (meta.metacommand & mCgiSafe)
     
    914924      while (parent->parent != NULL) parent = parent->parent;
    915925
    916       if (meta.metaname == "Date")
     926      if (no_ns_metaname == "Date")
    917927    return format_date (parent->values[0]);
    918928      if (meta.metacommand & mCgiSafe)
     
    936946      while (here != end) {
    937947    if (!first) tmp += meta.functionoptions;
    938     if (meta.metaname == "Date") tmp += format_date (*here);
     948    if (no_ns_metaname == "Date") tmp += format_date (*here);
    939949    else tmp += *here;
    940950    first = false;
Note: See TracChangeset for help on using the changeset viewer.