Tuesday, August 18, 2009 at 7:51 PM.
godsTweetSuite.buildReport
on buildReport (accountname) { <<Changes <<5/4/09; 5:36:19 PM by DW <<Created. local (adrdata = godsTweetSuite.init (accountname), htmltext = "", indentlevel = 0, t); adrdata^.stats.ctReportBuilds++; on add (s) { htmltext = htmltext + string.filledstring ("\t", indentlevel) + s + "\r"}; on visit (adrtweet) { local (screenname = adrtweet^.userScreenName); if screenname == "cluelessnewbie" { //5/7/09 by DW -- his updates show up when he follows/unfollows return (true)}; local (accounturl = "http://twitter.com/" + screenname + "/"); local (adrprofile = godsTweetSuite.initProfile (accountname, screenname), imgurl, commentlink); bundle { //set imgurl imgurl = adrtweet^.userProfileImageUrl}; //5/9/09 by DW <<scratchpad.screenname = screenname <<if defined (adrdata^.images.[screenname]) <<imgurl = adrdata^.images.[screenname] <<else <<imgurl = adrprofile^.profile.profileImageUrl bundle { //set commentlink if defined (adrtweet^.urldiscuss) { local (url = adrtweet^.urldiscuss); <<http://100twt.com/discuss/2009/05/05/00227.html url = string.replace (url, "100twt.com/discuss", "discuss.100twt.com"); commentlink = "<br /><a href=\"" + url + "#disqus_thread\" dsqid=\"" + nameof (adrtweet^) + "\"></a>"} <<<a href="http://discuss.100twt.com/2009/05/07/01979.html" dsqid="01979#disqus_thread"></a> else { commentlink = ""}}; local (img = "<img src=\"" + imgurl + "\" width=\"48\" height=\"48\" border=\"0\" vspace=\"6\" hspace=\"6\" />", ranklink); bundle { //build rank link local (url = "http://twittercounter.com/" + screenname + "/all"); if adrprofile^.rank == 0 { ranklink = ""} else { ranklink = "<a href=\"" + url + "\"><br />#" + adrprofile^.rank + "</a>"}; ranklink = "<font size=\"-1\">" + string.addcommas (adrtweet^.userFollowedBy) + ranklink + "</font>"}; add ("<tr>"); indentlevel++; add ("<th scope=\"row\" class=\"spec\"><a href=\"" + accounturl + "\">" + img + "</a><br />" + "</th>"); add ("<td valign=\"top\"><a href=\"" + accounturl + "\">" + screenname + "</a>: " + adrtweet^.textProcessed + "</td>"); bundle { //add link extracted from the tweet local (s); if sizeof (adrtweet^.shortUrl) == 0 { s = " "} else { local (link = adrtweet^.longUrl, ul); scratchpad.adrtweet = adrtweet; if not (link beginswith "http://") { link = adrtweet^.shorturl}; try { ul = string.urlsplit (link)} else { ul = string.urlsplit (link + "/")}; local (domain = string.lower (ul [2])); if domain beginswith "www." { domain = string.delete (domain, 1, 4)}; if domain endswith ".co.uk" { //do an extra popsuffix domain = string.popsuffix (domain)}; domain = string.popsuffix (domain); //get rid of .com, .net, .org if domain contains "." { domain = string.lastfield (domain, ".")}; <<if sizeof (domain) > xxx <<domain = string.mid (domain, 1, xxx) + "..." s ="<br /><a href=\"" + adrtweet^.longurl + "\">" + domain + "</a>"}; add ("<td align=\"right\" valign=\"top\"><center><font size=\"-1\">" + date.timestring (adrtweet^.when, false) + s + commentlink + "</font></center></td>")}; add ("<td nowrap valign=\"top\" align=\"right\"><center>" + ranklink + "</center></td>"); bundle { //add retweet, 5/18/09 by DW local (rt = "RT @" + screenname + " " + adrtweet^.text); local (url = "http://twitter.com/home?status=" + string.urlencode (rt)); add ("<td valign=\"top\"><a href=\"" + url + "\"><font size=\"-1\">RT</font></a></td>")}; add ("</tr>"); indentlevel--; <<add ("<tr height=\"8\"><td> </td></tr>") return (++cttweets < adrdata^.prefs.ctTweetsInReport)}; <<bundle //saved template stuff local (cttweets = 0); mainresponder.calendar.visitReverseChronologic (@adrdata^.calendar, @visit); new (tabletype, @t); t.now = clock.now (); t.tablerows = htmltext; t.tagline = adrdata^.prefs.tagline; t.image = adrdata^.prefs.image; t.bgcolor = adrdata^.prefs.bgcolor; t.countergroup = adrdata^.prefs.countergroup; t.navigationMenu = godsTweetSuite.navigationMenu (accountname); //5/16/09 by DW <<t.title = "Clueless Newbie's timeline" <<t.screenName = adrdata^.prefs.username <<t.profileImageUrl = adrdata^.stats.ownerProfile.profileImageUrl <<t.url = adrdata^.stats.ownerProfile.url <<t.name = string.replaceall (adrdata^.stats.ownerProfile.name, " ", " ") <<t.description = adrdata^.stats.ownerProfile.description t.disqusScript = string (godsTweetSuite.data.disqusScript); htmltext = string.multiplereplaceall (string (godsTweetSuite.data.template), @t, false, "<%", "%>"); workspace.ftptoscripting (htmltext, adrdata^.prefs.ftpPath + "index.html"); bundle { //save it to calendar structure local (path = adrdata^.prefs.ftpPath + file.getdatepath ("/", flLastSeparator:false) + ".html"); workspace.ftptoscripting (htmltext, path)}}; <<s3.newobject ("/static.scripting.com/twitter/gods.html", htmltext) bundle { //test code buildReport ("gangfan")}
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.