Changeset 456 for trunk


Ignore:
Timestamp:
1999-08-13T16:16:43+12:00 (25 years ago)
Author:
sjboddie
Message:

added some collection-level metadata stuff

Location:
trunk/gsdl/src/recpt
Files:
2 edited

Legend:

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

    r451 r456  
    1212/*
    1313   $Log$
     14   Revision 1.24  1999/08/13 04:16:42  sjboddie
     15   added some collection-level metadata stuff
     16
    1417   Revision 1.23  1999/08/11 23:28:59  sjboddie
    1518   added support for html classifier (i.e. the hp argumant now must be
     
    520523  }
    521524
     525  // get collection information
     526  collectinfo.clear();
     527  if (!collection.empty()) {
     528    comerror_t err;
     529    collectproto->get_collectinfo (collection, collectinfo, err, logout);
     530    if (err != noError) collectinfo.clear();
     531  }
     532
    522533  // translate "d", "cl", and "hp" arguments if required
    523534  translate_OIDs (args, collectproto, logout);
     
    740751}
    741752
    742 // prepare_page sets up page parameters, sets display macros,
    743 // gets format information and opens the page ready for output
     753// prepare_page sets up page parameters, sets display macros
     754// and opens the page ready for output
    744755void receptionist::prepare_page (action *a, cgiargsclass &args, recptproto *collectproto,
    745756                 outconvertclass &outconvert, ostream &logout) {
     
    763774    if (first) pageparams += ",language=" + args["l"];
    764775    else pageparams += ",language=" + args["l"];
    765  
    766   // get collection information
    767   collectinfo.clear();
    768   if (!collection.empty()) {
    769     comerror_t err;
    770     collectproto->get_collectinfo (collection, collectinfo, err, logout);
    771     if (err != noError) collectinfo.clear();
    772   }
    773776
    774777  // open the page
     
    777780
    778781  // define general macros
    779   define_general_macros (args, outconvert, logout);
     782  define_general_macros (args, collectproto, outconvert, logout);
    780783
    781784 
     
    795798}
    796799
    797 void receptionist::define_general_macros (cgiargsclass &args, outconvertclass &/*outconvert*/,
    798                       ostream &logout) {
     800void receptionist::define_general_macros (cgiargsclass &args, recptproto *collectproto,
     801                      outconvertclass &/*outconvert*/, ostream &logout) {
     802
     803  text_t &collection = args["c"];
     804
    799805  disp.setmacro ("gwcgi", "Global", configinfo.gwcgi);
    800806  disp.setmacro ("httpimg", "Global", configinfo.httpimg);
     
    813819    argshere ++;
    814820  }
    815 }
     821
     822  // set collection specific macros
     823  if ((!collection.empty()) && (collectproto != NULL)) {
     824    FilterResponse_t response;
     825    text_tarray metadata;
     826    //    metadata.push_back (".collectionimage");
     827   
     828    get_info ("collection", collection, metadata, false,
     829          collectproto, response, logout);
     830
     831    if (!response.docInfo[0].metadata.empty()) {
     832      MetadataInfo_tarray::const_iterator here = response.docInfo[0].metadata.begin();
     833      MetadataInfo_tarray::const_iterator end = response.docInfo[0].metadata.end();
     834      while (here != end) {
     835    if (((*here).name != "haschildren") && ((*here).name != "hasnext") &&
     836        ((*here).name != "hasprevious")) {
     837      disp.setmacro ((*here).name, "Global", (*here).values[0]);
     838    }
     839    here ++;
     840      }
     841    }
     842  }
     843}
  • trunk/gsdl/src/recpt/receptionist.h

    r438 r456  
    5757  virtual void translate_OIDs (cgiargsclass &args, recptproto *collectproto, ostream &logout);
    5858
    59   virtual void define_general_macros (cgiargsclass &args, outconvertclass &outconvert,
    60                       ostream &logout);
     59
     60  virtual void define_general_macros (cgiargsclass &args, recptproto *collectproto,
     61                      outconvertclass &outconvert, ostream &logout);
    6162
    6263public:
     
    8182  // The converters remain the property of the calling code.
    8283  void add_converter (const text_t &name, inconvertclass *inconverter,
    83               rzwsoutconvertclass *outconverter)
    84     {converters.add_converter(name, inconverter, outconverter);}
     84              rzwsoutconvertclass *outconverter) {
     85    converters.add_converter(name, inconverter, outconverter);}
    8586  convertinfoclass *get_convertinfo_ptr () {return &converters;}
    86 
    87 
     87 
     88 
    8889  // configure should be called for each line in the
    8990  // configuration files to configure the receptionist and everything
     
    122123  virtual bool produce_cgi_page (cgiargsclass &args, ostream &contentout,
    123124                 ostream &logout);
    124 
     125 
    125126  // get_cgihead_info determines the cgi header information for
    126127  // a set of cgi arguments. If response contains location then
     
    130131  virtual void get_cgihead_info (cgiargsclass &args, response_t &response,
    131132                 text_t &response_data, ostream &logout);
    132 
     133 
    133134  // produce the page content
    134135  virtual bool produce_content (cgiargsclass &args, ostream &contentout,
    135136                ostream &logout);
    136 
     137 
    137138  // returns the compressed argument ("e") corresponding to the argument
    138139  // list. This can be used to save preferences between sessions.
    139140  text_t get_compressed_arg (cgiargsclass &args, ostream &logout);
    140 
     141 
    141142protected:
    142143  // will read in all the macro files. If one is not found an
Note: See TracChangeset for help on using the changeset viewer.