Monday, November 08, 2010 at 12:01 AM.
system.verbs.apps.Manila.windowTypes.types.manilaSite.close
on close (adr) { <<Close a Manila site outline, checking it in if necessary. local (atts); if not window.attributes.getAll (@atts) { //return false if no atts return (false)}; if atts.flReadOnly { //can't be saved -- return true return (true)}; local (adrinfo = atts.adrSiteInfo); local (username, password); if manila.windowTypes.getUsernameAndPassword (adrinfo, @username, @password) { manila.windowTypes.setUsernameAndPassword (adrinfo, username, password)} else { //the user cancelled the password dialog -- return false return (false)}; local (siteInfoTable = adrinfo^); siteInfoTable.username = username; siteInfoTable.password = password; try { //try to check in the outline -- NOTE: this is not foolproof; see notes below <<Here's the problem: <<If the editorial outline has never been saved, then the server will always fault when trying to check it in. <<We're not keeping track of whether the outline has ever been saved, because there's too much potential confusion. <<The correct fix is to make the server-side more friendly: Don't error if the outline doesn't exist -- but that's not always going to be there. <<So the situation in which this strategy is trouble is when the outline has never been saved, and there's a network error or a timeout. <<It's not a big problem, since a non-existant object can't be checked out, but we may need to look out for this situation in the future... manila.editorialOutline.checkIn (@siteInfoTable)}; return (true)}
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.