Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.userInterface.editButton
on editButton (f=nil, buttonlabel="", systemImagePath=nil) { <<Changes: <<10/12/02; 4:14:43 AM by JES <<Localized the Edit This Page button. <<1/27/02; 5:32:10 AM by JES <<Don't display the Edit This Page button if pta^.radioResponder.flStaticRendering is true. <<1/26/02; 4:46:45 PM by JES <<Allow display of the Edit This Page button when accessing Radio remotely. <<12/12/01; 12:44:51 PM by JES <<Only add searchArgs to the action url for the form, if pta^.searchArgs is non-empty. <<11/19/01; 2:55:11 PM by JES <<Return the empty string for system pages, unless user.radio.prefs.flSystemEditor is true. <<7/25/01; 8:47:42 PM by JES <<New optional parameter: systemImagePath, is the path to an image in the www/system/images folder, to use for the button. local (pta = html.getPageTableAddress ()); <<bundle //debugging code <<workspace.pt = pta^; edit (@workspace.pt) if defined (pta^.editThisPageButton) { if not pta^.editThisPageButton { return ("")}}; if pta^.radioResponder.flStaticRendering { return ("")}; <<if not pta^.radioResponder.flSameMachine <<return ("") if defined (pta^.flSystemPage) { //return the empty string for system pages if pta^.flSystemPage { if not user.radio.prefs.flSystemEditor { return ("")}}}; if buttonlabel == "" { buttonlabel = radio.string.getLocalizedString ("buttons.editThisPage")}; local (htmltext = "\r", indentlevel = 0); on add (s) { htmltext = htmltext + string.filledstring ("\t", indentlevel) + s + "\r\n"}; local (action = ""); bundle { //build action, adding searchArgs so that the reloaded page is still the same if defined (pta^.searchArgs) { if pta^.searchArgs != "" { action = "?" + pta^.searchArgs}}}; add ("<form method=\"POST\" action=\"" + action + "\">"); indentlevel++; add ("<input name=\"command\" type=\"hidden\" value=\"edit\">"); if f != nil { add ("<input name=\"f\" type=\"hidden\" value=\"" + string.urlencode (f) + "\">")}; if systemImagePath == nil { //use a standard button add ("<input type=\"submit\" value=\"" + buttonlabel + "\">")} else { //use an image for the button local (flSameMachine = pta^.radioResponder.flSameMachine); local (imgUrl = string.nthField (radio.images.systemImageRef (systemImagePath, flFileUrl:flSameMachine), "\"", 2)); add ("<input type=\"image\" value=\"submit\" src=\"" + imgUrl + "\">")}; add ("</form>"); indentlevel--; return (htmltext)}
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.