Ignore:
Timestamp:
2010-03-03T11:06:37+13:00 (14 years ago)
Author:
kjdon
Message:

now we dynamically generate srclink (and /srclink, and new srchref which is the link without the a tag), using srclink_file metadata. This is to get gs2 receptionist stuff out of metadata and into the source code where it belongs

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

Legend:

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

    r21743 r21758  
    107107}
    108108
     109text_t browsetoolsclass::get_assocfile_path()
     110{
     111  return "_httpprefix_/collect/[collection]/index/assoc/{Or}{[parent(Top):assocfilepath],[assocfilepath]}/";
     112
     113}
    109114// at the moment this just writes out the html to display
    110115// the cover image (assuming it's called cover.jpg)
  • main/trunk/greenstone2/runtime-src/src/recpt/browsetoolsclass.h

    r12183 r21758  
    4949
    5050  virtual text_t get_cover_image();
    51 
     51  virtual text_t get_assocfile_path();
    5252  virtual void load_extended_options(text_tmap &options, cgiargsclass &args, browsermapclass *browsers,
    5353                                     formatinfo_t &formatinfo, recptproto *collectproto,
  • main/trunk/greenstone2/runtime-src/src/recpt/formattools.cpp

    r21752 r21758  
    631631    formatlistptr->command = comEndLink;
    632632
     633  else if (meta == "srclink") {
     634    formatlistptr->command = comAssocLink;
     635    formatlistptr->meta.metaname = "srclink_file";
     636    metadata.insert("srclink_file");
     637  }
     638  else if (meta == "srchref") {
     639    formatlistptr->command = comAssocLink;
     640    formatlistptr->text = "href";
     641    formatlistptr->meta.metaname = "srclink_file";
     642    metadata.insert("srclink_file");
     643  }
     644  else if (meta == "/srclink") {
     645    formatlistptr->command = comEndAssocLink;
     646    formatlistptr->meta.metaname = "srclink_file";
     647  }
     648  // and weblink etc
    633649  else if (meta == "href")
    634650    formatlistptr->command = comHref;
     
    17771793    return options["link"];
    17781794     case comEndLink:
    1779     if (options["link"].empty()) return "";
     1795       {
     1796     if (options["link"].empty()) return "";
    17801797    else return "</a>";
     1798       }
    17811799     case comHref:
    17821800    return get_href(options["link"]);
     
    17901808     case comSummary:
    17911809       return format_summary(collection, collectproto, docinfo, disp, options, logout);
    1792 
     1810     case comAssocLink:
     1811       {
     1812     text_t link_filename = get_meta(collection, collectproto, docinfo, disp, formatlistptr->meta, options, logout);
     1813         if (!link_filename.empty()) {
     1814       text_t href= expand_metadata(options["assocfilepath"]+link_filename, collection, collectproto, docinfo, disp, options, logout);
     1815       if (formatlistptr->text == "href") {
     1816         return href;
     1817       }
     1818       return "<a href=\""+ href + "\">";
     1819     }
     1820     return "";
     1821       }
     1822  case comEndAssocLink:
     1823    {
     1824    text_t link_filename = get_meta(collection, collectproto, docinfo, disp, formatlistptr->meta, options, logout);
     1825    if (!link_filename.empty()) {
     1826      return "</a>";
     1827    }
     1828    return "";
     1829    }
    17931830     case comMeta:
    17941831    {
  • main/trunk/greenstone2/runtime-src/src/recpt/formattools.h

    r21752 r21758  
    3838        comTOC, comImage, comDocumentButtonDetach, comDocumentButtonHighlight,
    3939        comDocumentButtonExpandContents, comDocumentButtonExpandText, comOID, comTopOID, comRank,
    40         comCollection, comDocTermsFreqTotal};
     40        comCollection, comDocTermsFreqTotal,
     41        comAssocLink, comEndAssocLink};
    4142
    4243enum mcommand_t {mNone=0, mCgiSafe=1, mParent=2, mSibling=4, mChild=8, mSpecial=16, mTruncate=32, mXMLSafe=64, mHTMLSafe=128};
  • main/trunk/greenstone2/runtime-src/src/recpt/vlistbrowserclass.cpp

    r18570 r21758  
    140140  else options["highlight"] = "0";
    141141  options["DocImage"] = btools.get_cover_image();
     142  options["assocfilepath"] = btools.get_assocfile_path();
    142143  textout << outconvert << disp
    143144      << get_formatted_string (collection, collectproto,
     
    205206  options["highlight"] = "0";
    206207  options["DocImage"] = btools.get_cover_image();
    207  
     208  options["assocfilepath"] = btools.get_assocfile_path();
     209
    208210  if ( thissection != endsection ) { // only if there are results (else corrupts display)
    209211    fstring = get_formatted_string (collection, collectproto, *thissection,
     
    238240    else options["highlight"] = "0";
    239241    options["DocImage"] = btools.get_cover_image();
    240    
     242    options["assocfilepath"] = btools.get_assocfile_path();
     243
    241244    textout << outconvert << disp
    242245        << " " << get_formatted_string (collection, collectproto, *thissection, disp,
Note: See TracChangeset for help on using the changeset viewer.