Tuesday, August 18, 2009 at 7:52 PM.
godsTweetSuite.followers.buildReport
on buildReport (accountname) { <<Changes <<5/31/09; 10:23:38 PM by DW <<Created. local (adrdata = godsTweetSuite.init (accountname)); bundle { //sort the table local (oldtarget = target.set (@adrdata^.rankings)); table.sortby ("Value"); target.set (oldtarget)}; bundle { //zero the sultable local (adr); for adr in @godsTweetSuite.followers.sultable { adr^ = 0}}; local (htmltext = "", indentlevel = 0, ct=0); on add (s) { htmltext = htmltext + string.filledstring ("\t", indentlevel) + s + "\r"}; <<add ("<table cellspacing=\"1\" cellpadding=\"3\">"); indentlevel++ for i = sizeof (adrdata^.rankings) downto 1 { local (adr = @adrdata^.rankings [i]); local (adrprofile = @twitterProfiles.[accountname].[nameof (adr^)]); local (urltwitter = "http://twitter.com/" + adrprofile^.userscreenname); local (flonsul, td, location); bundle { //set flonsul local (adr = @godsTweetSuite.followers.sultable.[adrprofile^.userscreenname]); if defined (adr^) { flonsul = true; adr^++} else { flonsul = false}}; add ("<tr>"); indentlevel++; bundle { //set td if flonsul { td = "<td class=\"alt\""} else { td = "<td"}}; bundle { //set location location = adrprofile^.userLocation; if location == "" { location = " "} else { location = "<a href=\"" + adrprofile^.userurl + "\">" + location + "</a>"}}; bundle { //add row head <<add (td + " align=\"right\">" + ++ct + ". </td>") add ("<th scope=\"row\" abbr=\"" + ++ct + "\" class=\"spec\" align=\"right\"><center>" + ct + ".</center></th>")}; add (td + "><a href=\"" + urltwitter + "\">" + adrprofile^.username + "</a></td>"); add (td + ">" + location + "</td>"); add (td + " align=\"right\">" + string.addcommas (adrprofile^.userFollowedBy) + " </td>"); add (td + ">" + adr^ + "</td>"); add ("</tr>"); indentlevel--; <<if ct >= 500 <<break scratchpad.ct = ct}; <<add ("</table>"); indentlevel-- bundle { //do the rendering local (t); new (tabletype, @t); t.tablerows = htmltext; t.now = clock.now (); t.preamble = string (godsTweetSuite.followers.data.preambles.[accountname]); t.tagline = godsTweetSuite.followers.data.titles.[accountname]; t.image = ""; t.bgcolor = adrdata^.prefs.bgcolor; t.countergroup = adrdata^.prefs.countergroup; t.navigationMenu = ""; t.disqusScript = ""; htmltext = string.multiplereplaceall (string (godsTweetSuite.followers.template), @t, false, "<%", "%>")}; s3.newobject ("/static.scripting.com/twitter/follows/" + accountname + ".html", htmltext); workspace.ftptoscripting (htmltext, "sul/" + accountname + ".html")}; bundle { //test code buildReport ("nyt")}
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.