Sunday, April 10, 2011 at 1:07 AM.
radio2Suite.initUser
on initUser (adruser) {
<<Changes
<<4/9/11; 11:22:15 AM by DW
<<Init user-level callbacks table, with a single callback on building a feed for the user.
<<4/6/11; 4:35:17 PM by DW
<<Init user-level ctLogins stat.
<<3/24/11; 8:58:09 AM by DW
<<Init stats.ctShortenedUrlErrors, stats.ctGetCountErrors.
<<3/22/11; 10:43:35 AM by DW
<<Make sure there's a River2 user for this Radio2 user.
<<3/12/11; 1:05:03 PM by DW
<<Callbacks. Now you can manage your own data in each user's table.
<<3/10/11; 9:01:51 AM by DW
<<html template prefs.
<<3/9/11; 7:54:40 AM by DW
<<Init home page prompt and podcast button pref.
<<3/6/11; 2:26:09 PM by DW
<<Init customDomain for shortener prefs.
<<3/3/11; 11:28:38 AM by DW
<<Initialize whenLastGet to yesterday at this time instead of date (0).
<<3/2/11; 8:37:54 PM by DW
<<Init adruser^.stats.ctTop40HtmlBuilds.
<<2/24/11; 11:14:06 AM by DW
<<Init adruser^.stats.ctStaticFileWrites and adruser^.stats.ctJavaScriptBuilds.
<<2/23/11; 11:51:27 PM by DW
<<Init flTitleCleanup pref.
<<2/20/11; 11:50:10 AM by DW
<<Init shortener, counts prefs, stats.
<<1/4/11; 11:35:03 AM by DW
<<Turned into initUser.
<<12/14/10; 11:12:24 AM by DW
<<Created.
if not defined (adruser^) {
new (tabletype, adruser)};
if not defined (adruser^.feeds) {
new (tabletype, @adruser^.feeds)};
bundle { //prefs
if not defined (adruser^.prefs) {
new (tabletype, @adruser^.prefs)};
if not defined (adruser^.prefs.enabled) {
adruser^.prefs.enabled = false};
if not defined (adruser^.prefs.flPublishEnabled) { //12/25/10 by DW
adruser^.prefs.flPublishEnabled = true}; //makes it easy to test
if not defined (adruser^.prefs.flTitleCleanup) { //2/23/11 by DW
adruser^.prefs.flTitleCleanup = true};
if not defined (adruser^.prefs.homePagePrompt) { //3/9/11 by DW
adruser^.prefs.homePagePrompt = ""};
if not defined (adruser^.prefs.flPodcastButtonOnHomePage) { //3/9/11 by DW
adruser^.prefs.flPodcastButtonOnHomePage = false};
if not defined (adruser^.prefs.htmlArchiveTemplate) { //3/10/11 by DW
adruser^.prefs.htmlArchiveTemplate = string (radio2Suite.data.html.archiveTemplate)};
if not defined (adruser^.prefs.countsPageTemplate) { //3/10/11 by DW
adruser^.prefs.countsPageTemplate = string (radio2Suite.data.html.staticCountsPageTemplate)};
bundle { //security
if not defined (adruser^.prefs.security) {
new (tabletype, @adruser^.prefs.security)};
if not defined (adruser^.prefs.security.enabled) {
adruser^.prefs.security.enabled = true};
<<if not defined (adruser^.prefs.security.username)
<<adruser^.prefs.security.username = "admin"
if not defined (adruser^.prefs.security.password) {
adruser^.prefs.security.password = string.getrandompassword (8)}};
bundle { //s3bucket
if not defined (adruser^.prefs.s3bucket) {
new (tabletype, @adruser^.prefs.s3bucket)};
if not defined (adruser^.prefs.s3bucket.enabled) {
adruser^.prefs.s3bucket.enabled = false};
if not defined (adruser^.prefs.s3bucket.path) {
adruser^.prefs.s3bucket.path = ""};
if not defined (adruser^.prefs.s3bucket.url) {
adruser^.prefs.s3bucket.url = ""}};
bundle { //shortener, 2/17/11 by DW
if not defined (adruser^.prefs.shortener) {
new (tabletype, @adruser^.prefs.shortener)};
if not defined (adruser^.prefs.shortener.enabled) {
adruser^.prefs.shortener.enabled = false};
if not defined (adruser^.prefs.shortener.email) {
adruser^.prefs.shortener.email = ""};
if not defined (adruser^.prefs.shortener.partnerID) {
adruser^.prefs.shortener.partnerID = ""};
if not defined (adruser^.prefs.shortener.password) {
adruser^.prefs.shortener.password = ""};
if not defined (adruser^.prefs.shortener.customDomain) { //3/6/11 by DW
adruser^.prefs.shortener.customDomain = ""}};
bundle { //counts, 2/20/11 by DW
if not defined (adruser^.prefs.counts) {
new (tabletype, @adruser^.prefs.counts)};
if not defined (adruser^.prefs.counts.maxcount) {
adruser^.prefs.counts.maxcount = 40}}};
bundle { //stats
if not defined (adruser^.stats) {
new (tabletype, @adruser^.stats)};
if not defined (adruser^.stats.ctShortenedUrls) { //2/20/11 by DW
adruser^.stats.ctShortenedUrls = 0};
if not defined (adruser^.stats.ctShortenedUrlErrors) { //3/24/11 by DW
adruser^.stats.ctShortenedUrlErrors = 0};
if not defined (adruser^.stats.ctGetCountErrors) { //3/24/11 by DW
adruser^.stats.ctGetCountErrors = 0};
if not defined (adruser^.stats.ctStaticFileWrites) { //2/24/11 by DW
adruser^.stats.ctStaticFileWrites = 0};
if not defined (adruser^.stats.ctJavaScriptBuilds) { //2/24/11 by DW
adruser^.stats.ctJavaScriptBuilds = 0};
if not defined (adruser^.stats.ctTop40HtmlBuilds) { //3/2/11 by DW
adruser^.stats.ctTop40HtmlBuilds = 0};
if not defined (adruser^.stats.ctLogins) { //4/6/11 by DW
adruser^.stats.ctLogins = 0};
if not defined (adruser^.stats.lastFeedSelected) {
if sizeof (adruser^.feeds) == 0 {
adruser^.stats.lastFeedSelected = ""}
else {
adruser^.stats.lastFeedSelected = nameof (adruser^.feeds [1])}};
bundle { //ctInits
if defined (adruser^.stats.ctInits) {
adruser^.stats.ctInits++}
else {
adruser^.stats.ctInits = 0}};
bundle { //counts, 2/20/11 by DW
if not defined (adruser^.stats.counts) {
new (tabletype, @adruser^.stats.counts)};
if not defined (adruser^.stats.counts.ct) {
adruser^.stats.counts.ct = 0};
if not defined (adruser^.stats.counts.whenLastGet) { //3/3/11 by DW
adruser^.stats.counts.whenLastGet = date.yesterday (clock.now ())}}};
bundle { //callbacks, 4/9/11 by DW
if not defined (adruser^.callbacks) {
new (tabletype, @adruser^.callbacks)};
if not defined (adruser^.callbacks.buildRss) {
new (tabletype, @adruser^.callbacks.buildRss)}};
bundle { //call the callbacks, 3/12/11 by DW
local (adrdata = @config.radio2, adrscript);
for adrscript in @adrdata^.callbacks.initUser {
while typeof (adrscript^) == addresstype {
adrscript = adrscript^};
try {
adrscript^ (adruser)}}};
bundle { //make sure there's a River2 user for this Radio2 user, 3/22/11 by DW
radio2Suite.utilities.initRiver2User (adruser)};
return (adruser)};
bundle { //test code
initUser (@config.radio2.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.