Wednesday, March 16, 2011 at 3:29 PM.

scripting2Suite.server.buildAfterSave

on buildAfterSave (username, adrstory) {
	<<Changes
		<<3/16/11; 3:25:34 PM by DW
			<<If we're building the first story in the website, don't try to build the previous one -- there is no prev. 
		<<6/27/10; 7:38:20 PM by DW
			<<If the story is the live-blog, then rebuild the live-blog feed.
		<<6/12/10; 8:32:57 AM by DW
			<<The first time you update in a day, all the other pages in the month must be rebuilt because their calendars have a new day.
		<<6/9/10; 6:37:28 AM by DW
			<<You've just saved a story. Now it's time to rebuild the home page, the archive page for the month, day, and yesterday's page if this is the first save of the day. (Haven't done this yet.)
	local (adrdata = scripting2suite.inituser (username));
	scripting2Suite.server.buildHomePage (username);
	bundle { //if it's the live-blog then rebuild the live-blog feed
		if defined (adrstory^.flLiveBlog) {
			if adrstory^.flLiveBlog {
				scripting2Suite.server.buildLiveBlogFeed (username, adrstory)}}};
	scripting2Suite.server.buildRecentStories (username); //build js include
	scripting2Suite.server.buildMonthPage (username, adrstory^.postdate);
	scripting2Suite.server.buildDayPage (username, adrstory^.postdate);
	<<scripting2Suite.server.buildDayPage (username, date.yesterday (adrstory^.postdate))
	bundle { //if it's the first build of this story, build it's prev too
		if defined (adrstory^.flFirstBuild) {
			if adrstory^.flFirstBuild {
				if sizeof (adrstory^.adrprev) > 0 { //not the first story in the website, 3/16/11 by DW
					local (adrprev = address (adrstory^.adrprev));
					scripting2Suite.server.buildStoryPage (username, adrprev);
					adrstory^.flFirstBuild = false}}}};
	bundle { //do special stuff if first new post in a day, 6/12/10 by DW
		local (postdate = adrstory^.postdate);
		if postdate > adrdata^.stats.whenLastBuildAfterSave {
			if not date.sameday (postdate, adrdata^.stats.whenLastBuildAfterSave) { //starting a new day
				thread.callscript (@scripting2suite.server.buildThisMonthsStories, {username, postdate})};
			adrdata^.stats.whenLastBuildAfterSave = postdate}}}



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.