Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.prefs.templatePref
on templatePref (templateName, rows=25, flXml=false) { <<Changes <<1/27/02; 5:18:17 PM by JES <<After writing a template file to disk, publish the home page, so the change will be visible on the public site right away. <<12/20/01; 1:11:17 AM by JES <<Use file.writeTextFile to write out the new template file, instead of file.writeWholeFile. <<12/14/01; 1:26:49 PM by JES <<Call radio.prefs.refreshAfterPost, instead of implementing a redirect here. That bottleneck will be used in other places as well. <<12/2/01; 6:40:05 PM by JES <<Fixed a bug where non-xml templates were never written to disk. Rediret back to the same page after a successful POST, so that template changes are reflected in the page rendering. <<11/26/01; 10:16:54 AM by DW <<New parameter, flXml, if true, before we write the template file we make sure it's valid XML. <<11/20/01; 5:57:53 PM by DW <<Created. local (pta = html.getpagetableaddress ()); if pta^.method != "POST" { system.temp.radio.template = file.readwholefile (pta^.radioresponder.atts.[templatename])}; local (s = radio.prefs.textAreaPref ("", @system.temp.radio.template, rows:rows, cols:80)); if method == "POST" { if flXml { try { xml.compile (system.temp.radio.template, @xstruct); file.writeTextFile (pta^.radioresponder.atts.[templatename], system.temp.radio.template); radio.weblog.publish (); radio.prefs.refreshAfterPost ()} else { s = radio.prefs.errorString ("Can't save the template because the \"" + templateName + "\" template is not valid XML.") + s}} else { file.writeTextFile (pta^.radioresponder.atts.[templatename], system.temp.radio.template); radio.weblog.publish (); radio.prefs.refreshAfterPost ()}}; try {delete (@system.temp.radio.template)}; return (s)}
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.