Ignore:
Timestamp:
2013-03-18T21:06:22+13:00 (11 years ago)
Author:
ak19
Message:

httpdomain macro in rss items resolved in receptionist with primary preference given to what's in zextra.dm. At present, forced to use package Global in the code that sets the macro, since a new macro file, rss.dm, registered in etc/main.cfg and containing the package name rss(feed) wasn't getting through with the setmacro call.

File:
1 edited

Legend:

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

    r24959 r27093  
    6868      << "<channel>\n"
    6969      << "  <title>_collectionname_</title>\n"
    70       << "  <link>_httppageabout_</link>\n"
     70      << "  <link>_httpdomain__httppageabout_</link>\n"
    7171      << "  <description>_collectionextra_</description>\n"
    7272      << "  <language>_cgiargl_</language>\n"
     
    7979      << "  <title>_collectionname_</title>\n"
    8080      << "  <url>_iconcollection_</url>\n"
    81       << "  <link>_httppageabout_</link>\n"
     81      << "  <link>_httpdomain__httppageabout_</link>\n"
    8282      << "  <description>_collectionextra_</description>\n"
    8383      << "</image>\n";
     
    112112  text_t &arg_c = args["c"];
    113113
     114  // For some reason, setting the _httpdomain_ macro only works when its package name is specified as Global
     115  // Doesn't work if package name is set as rssfeed, even though etc/main.cfg refers to new rss.dm containing a package by that name
     116 
     117  // Before resolving the _httpdomain_ macro
     118  // 1. Check if _httpdomain_ was defined by user in macros (packages rssfeed of rss.dm and Global).
     119  // E.g. user could have defined it in package Global of zextra.dm
     120  // If none found, try to get it from the cgiargs hostname= (set using javascript),
     121  // and set as macro for package Rss.
     122 
     123  if(disp.havemacro("Global", "httpdomain") == 0) { // checks rss(feed) and Global packages and if not found
     124   
     125    if(!args["hostname"].empty()) {
     126      disp.setmacro("httpdomain", "Global", "http://" + args["hostname"]); //disp.setmacro("httpdomain", "Global", args["hostname"]);
     127    }
     128    else { // we shouldn't have to get here
     129      disp.setmacro("httpdomain", "Global", "http://localhost:8282"); // the default used in zextra.dm. (Could perhaps default this to localhost too)
     130    }
     131  }
     132
    114133
    115134  if (!args["c"].empty()) {
Note: See TracChangeset for help on using the changeset viewer.