Ignore:
Timestamp:
2012-01-20T20:48:26+13:00 (12 years ago)
Author:
ak19
Message:

Second commit to do with Greenstone's support for RSS. Has been tested on Linux, and works if zextra.dm and base.dm are setup properly and if the rss-items.rdf file generated by the update to BasePlugout is moved to the index folder. Modified Dr Bainbridge's code to make the way that rssaction.cpp accesses the rss-items.rdf file independent of where the GS server is located, by adding a new method to get the rss-items.rdf file's contents to the recptproto protocol class and implementing it in nullproto. The method is also mirrored in corba/corbaproto, however compilation with corba fails in a part of the code that I've not modified.

File:
1 edited

Legend:

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

    r24958 r24959  
    8484}
    8585
    86 void rssaction::generate_rss_content(text_t& rss_filename, displayclass &disp,
     86void rssaction::generate_rss_content(text_t& rss_items, displayclass &disp,
    8787                     outconvertclass &outconvert, ostream &textout,
    8888                     ostream &logout)
    8989{
    90   text_t rss_items;
    91 
    92   if (read_file(rss_filename,rss_items)) {
    93     textout << outconvert << disp << rss_items;
    94   }
    95 
    96 
     90  textout << outconvert << disp << rss_items;
    9791}
    9892
     
    108102
    109103
    110 
    111 
    112104bool rssaction::do_action (cgiargsclass &args, recptprotolistclass *protos,
    113105                browsermapclass * /*browsers*/, displayclass& disp,
    114106                outconvertclass &outconvert, ostream &textout,
    115107                ostream &logout) {
    116   //bool wassuccess = false;
    117   //comerror_t err;
    118  
     108  text_t rss_items;
     109  bool success = false;
     110  comerror_t err;
    119111
    120   /*
    121   recptproto *collectproto = protos->getrecptproto (args["c"], logout);
    122   if (!args["c"].empty() && (collectproto != NULL)) {
    123     collectproto->ping (args["c"], wassuccess, err, logout);
    124     if (err != noError) wassuccess = false; // a communication error
     112  text_t &arg_c = args["c"];
     113
     114
     115  if (!args["c"].empty()) {
     116    recptproto* collectproto = protos->getrecptproto (arg_c, logout);   
     117    if (collectproto != NULL) {
     118      collectproto->get_rss_items (arg_c, gsdlhome, rss_items, err, logout);
     119      if (err == noError) success = true;
     120      // else a communication error   
     121    }
    125122  }
    126   */
    127 
    128   text_t rss_filename = filename_cat(gsdlhome,"collect",args["c"],"index","rss-items.rdf");
    129123
    130124  generate_rss_header(disp,outconvert,textout,logout);
    131   generate_rss_content(rss_filename,disp,outconvert,textout,logout);
     125  if(success) {
     126    generate_rss_content(rss_items,disp,outconvert,textout,logout);
     127  }
    132128  generate_rss_footer(disp,outconvert,textout,logout);
    133129
    134   return true;
     130  return success;
    135131};
    136132
Note: See TracChangeset for help on using the changeset viewer.