/********************************************************************** * * rssaction.cpp -- * Copyright (C) 1999 The New Zealand Digital Library Project * * A component of the Greenstone digital library software * from the New Zealand Digital Library Project at the * University of Waikato, New Zealand. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *********************************************************************/ #include "gsdl_modules_cfg.h" #ifdef USE_RSS #include "fileutil.h" #include "rssaction.h" rssaction::rssaction () { // this action uses cgi variable "a" cgiarginfo arg_ainfo; arg_ainfo.shortname = "a"; arg_ainfo.longname = "action"; arg_ainfo.multiplechar = true; arg_ainfo.multiplevalue = false; arg_ainfo.defaultstatus = cgiarginfo::weak; arg_ainfo.argdefault = "rss"; arg_ainfo.savedarginfo = cgiarginfo::must; argsinfo.addarginfo (NULL, arg_ainfo); } void rssaction::get_cgihead_info (cgiargsclass &/*args*/, recptprotolistclass * /*protos*/, response_t &response, text_t &response_data, ostream &/*logout*/) { response = content; response_data = "application/rdf+xml"; } void rssaction::generate_rss_header( displayclass &disp, outconvertclass &outconvert, ostream &textout, ostream &logout) { textout << outconvert << disp << "\n" << "\n" << "\n" << " _collectionname_\n" << " _httppageabout_\n" << " _collectionextra_\n" << " _cgiargl_\n" << " Thu, 23 Aug 1999 07:00:00 GMT\n" << " Thu, 23 Aug 1999 16:20:26 GMT\n" << " _creator_\n" << " _maintainer_\n" << "\n" << " _collectionname_\n" << " _iconcollection_\n" << " _httppageabout_\n" << " _collectionextra_\n" << "\n"; } void rssaction::generate_rss_content(text_t& rss_filename, displayclass &disp, outconvertclass &outconvert, ostream &textout, ostream &logout) { text_t rss_items; if (read_file(rss_filename,rss_items)) { textout << outconvert << disp << rss_items; } } void rssaction::generate_rss_footer( displayclass &disp, outconvertclass &outconvert, ostream &textout, ostream &logout) { textout << outconvert << disp << " \n" << "\n"; } bool rssaction::do_action (cgiargsclass &args, recptprotolistclass *protos, browsermapclass * /*browsers*/, displayclass& disp, outconvertclass &outconvert, ostream &textout, ostream &logout) { //bool wassuccess = false; //comerror_t err; /* recptproto *collectproto = protos->getrecptproto (args["c"], logout); if (!args["c"].empty() && (collectproto != NULL)) { collectproto->ping (args["c"], wassuccess, err, logout); if (err != noError) wassuccess = false; // a communication error } */ text_t rss_filename = filename_cat(gsdlhome,"collect",args["c"],"index","rss-items.rdf"); generate_rss_header(disp,outconvert,textout,logout); generate_rss_content(rss_filename,disp,outconvert,textout,logout); generate_rss_footer(disp,outconvert,textout,logout); return true; }; #endif //USE_RSS