/********************************************************************** * * niupepavlistbrowserclass.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. * * $Id: niupepavlistbrowserclass.cpp 4846 2003-07-01 03:09:15Z None $ * *********************************************************************/ /* $Log$ Revision 1.1 2000/03/08 20:44:50 sjboddie Initial revision */ #include "niupepavlistbrowserclass.h" #include #include "OIDtools.h" niupepavlistbrowserclass::niupepavlistbrowserclass () { } niupepavlistbrowserclass::~niupepavlistbrowserclass () { } void niupepavlistbrowserclass::load_metadata_defaults (text_tset &metadata) { metadata.insert ("haschildren"); metadata.insert ("doctype"); metadata.insert ("abstract"); } // get_link_icon attempts to work out what type of icon should be displayed for // the given section and what it should link to. // overridden for niupepa to add links/icons for abstracts as well as // papers void niupepavlistbrowserclass::get_link_icon (ResultDocInfo_t §ion, cgiargsclass &args, const text_t &collink, text_t &link, text_t &icon) { link = " 0) haschildren = section.metadata["haschildren"].values[0].getint(); text_t doctype; if (section.metadata.count("doctype") > 0) doctype = section.metadata["doctype"].values[0]; text_t abstract; if (section.metadata.count("abstract") > 0) abstract = section.metadata["abstract"].values[0]; text_t &arg_d = args["d"]; text_t &arg_cl = args["cl"]; if (args["a"] == "q") { // query results if (doctype == "Description") { icon = "_document:iconabstract_"; link += "&gg=text"; } else if (doctype == "Commentary") { icon = "_document:iconcommentary_"; link += "&gg=text"; } else { if (is_top (section.OID)) icon = "_document:iconclosedbook_"; else if (haschildren == 1) icon = "_document:iconclosedfolder_"; } link += "&cl=search&d=" + section.OID + "\">"; } else if (!arg_d.empty()) { // document level if (is_top(section.OID)) { icon = "_document:iconopenbook_"; if (arg_cl == "search") link = ""; else link += "&cl=" + arg_cl + "\">"; } else if (haschildren == 1) { if ((args["gc"] == "1") || (is_child_of (section.OID, arg_d)) || (section.OID == arg_d)) { icon = "_document:iconopenfolder_"; link += "&cl=" + arg_cl + "&d=" + section.OID + ".pr\">"; } else { icon = "_document:iconclosedfolder_"; link += "&cl=" + arg_cl + "&d=" + section.OID + "\">"; } } else link += "&cl=" + arg_cl + "&d=" + section.OID + "\">"; } else { // classification level if (haschildren == 1) { if (doctype == "classify") { if ((args["gc"] == "1") || (is_child_of (section.OID, arg_cl)) || (section.OID == arg_cl)) { icon = "_document:iconopenbookshelf_"; link += "&cl=" + section.OID + ".pr\">" + icon + ""; } else { icon = "_document:iconclosedbookshelf_"; link += "&cl=" + section.OID + "\">" + icon + ""; } } else { icon = "_document:iconclosedbook_"; if (!abstract.empty()) link += "&gg=text&cl=" + arg_cl + "&d=" + abstract + "\">" + "_document:iconabstract_" + link + "&cl=" + arg_cl + "&d=" + section.OID + "\">" + icon + ""; else link += "&cl=" + arg_cl + "&d=" + section.OID + "\">" + icon + ""; } } else { if (doctype == "classify") link = ""; else if (doctype == "Commentary") link += "&gg=text&cl=" + arg_cl + "&d=" + section.OID + "\">" + "_document:iconcommentary_"; else if (doctype == "Description") link += "&cl=" + arg_cl + "&d=" + section.OID + "\">" + "_document:iconabstract_"; else link += "&cl=" + arg_cl + "&d=" + section.OID + "\">"; } } }