Saturday, April 02, 2011 at 9:17 PM.
beautSuite.getRiverJson
on getRiverJson (adruser, adrcal=nil, fnamecache=nil) {
<<Changes
<<3/24/11; 9:18:48 PM by DW
<<New optional param, fnamecache. For the feed viewing pages, the calendar always has the same name, and the cache pages would overwrite each other. So the caller provides us with the name, which is computed, based on the URL of the feed. We don't want or need to know how this happens.
<<3/20/11; 1:44:43 PM by DW
<<Created.
local (adrdata = beautSuite.init (), now = clock.now (), username = nameof (adruser^), cachename, fldebugging = false);
bundle { //set cachename
if adrcal == nil {
cachename = username}
else {
if fnamecache == nil {
cachename = username + "." + nameof (adrcal^)}
else {
cachename = username + "." + fnamecache}}};
local (adrcache = @system.temp.beaut.cache.[cachename]);
if (not defined (adrcache^)) or fldebugging {
local (adrriverdata = river2suite.init (), adrriveruser = @adrriverdata^.users.[username]);
local (adrradiodata = radio2suite.init (), adrradiouser = @adrradiodata^.users.[username]);
river2Suite.static.bindReadingListToUser (adrriveruser);
local (s = river2Suite.viewJsonNews3 (adruser:adrriveruser, adrcal:adrcal), fname);
bundle { //set fname
if fnamecache == nil {
if adrcal == nil {
fname = "main"}
else {
fname = nameof (adrcal^)}}
else {
fname = fnamecache}}; //3/24/11 by DW
local (url = radio2suite.writestaticfile (adrradiouser, "tmp/" + fname + ".js", "onGetRiverStream (" + s + ")"));
new (tabletype, adrcache);
<<adrcache^.text = s
adrcache^.url = url;
adrcache^.ctAccesses = 0};
bundle { //stats
adrcache^.ctAccesses++;
adrcache^.whenLastAccess = now;
adrdata^.stats.ctJsonGets++;
adrdata^.stats.whenLastJsonGet = now};
return (adrcache^.url)};
bundle { //test code
getRiverJson (@default.users.dave)}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.