Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.weblog.newCategory
on newCategory (name, description="", flRenderHtml=false, language="en-us", flNotifyWeblogsCom=true) { <<Changes <<2/13/02; 12:08:46 PM by JES <<Create a #prefs.txt file with the appropriate #categoryName directive in the category folder. <<1/28/02; 6:33:14 PM by JES <<Convert the filename to a 7-bit (non-accented) string. <<1/21/02; 9:28:11 AM by DW <<New optional param, flNotifyWeblogsCom. <<1/20/02; 2:14:16 PM by DW <<New optional language category. <<1/14/02; 7:54:17 PM by JES <<On MacOS, truncate the filename if it's longer than 31 characters. <<12/22/01; 4:15:42 AM by JES <<Init adrcategory^.htmlUrl to the empty string. Initialize adrcategory^.dateLastUpload to date (0). <<12/6/01; 7:24:14 PM by JES <<New optional parameter, flRenderHtml, sets whether or not this category will be rendered as HTML files. <<1/23/01; 2:42:43 PM by DW <<Don't allow file and URL delimiters in the file name for the category. <<1/11/01; 6:28:33 PM by PBS <<Created. local (adrdata = radio.weblog.init ()); local (adrCategory = @adrdata^.categories.[name]); new (tableType, adrCategory); adrCategory^.description = description; adrCategory^.displayName = name; adrCategory^.language = language; adrCategory^.flNotifyWeblogsCom = flNotifyWeblogsCom; local (fname = name); local (i, ct = sizeOf (fname)); <<bundle //old code <<fname = string.replaceall (fname, "/", " ") <<fname = string.replaceall (fname, ":", " ") <<fname = string.replaceall (fname, "\\", " ") <<fname = string.innerCaseName (fname) fname = radio.string.convertTo7Bit (fname); for i = 1 to ct { //convert non-alpha-numeric characters to spaces if not string.isAlpha (fname[i]) { if not string.isNumeric (fname[i]) { fname[i] = ' '}}}; fname = string.innerCaseName (fname); if system.environment.isMac { //truncate to 31 chars if sizeOf (fname) > 31 { fname = string.mid (fname, 1, 31)}}; adrCategory^.fileName = fname; adrCategory^.flDirty = false; adrCategory^.flRenderHtml = flRenderHtml; adrCategory^.htmlUrl = ""; adrCategory^.dateLastUpload = date (0); wp.newTextObject ("", @adrCategory^.rss); adrCategory^.rssUrl = ""; adrCategory^.storyList = {}; bundle { //write out the #prefs.txt file local (f = radio.weblog.file.getCategoryFolder (name, adrdata) + "#prefs.txt"); local (s = "#categoryName \"" + string.replaceAll (name, "\"", "\\\"") + "\""); file.sureFilePath (f); file.writeTextFile (f, s)}; 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.