Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.prefs.textAreaPref
on textAreaPref (prompt, adrstring, cols=70, rows=5, colspan=1, labelAlign="right") {
<<Changes
<<10/28/07; 9:48:16 AM by DW
<<Optional param, labelAlign, defaults to right.
<<8/3/02; 8:43:10 PM by JES
<<Quote characters in addresses were mangling the HTML, so now addresses are url-encoded when generating the form element. When processing a POST, we look for the url-encoded field in the postArgs table.
<<2/17/02; 5:00:41 PM by DW
<<Get postargs from different place in Frontier.
<<2/17/02; 4:49:50 PM by DW
<<Call html.translateToEntities instead of radio.html.translateToEntities.
<<1/28/02; 6:31:49 PM by JES
<<If this is MacOS, convert POSTed strings to Mac text, before storing the value.
<<1/7/02; 6:07:54 PM by JES
<<Call radio.html.translateToEntities instead of doing string replacements here. Also, replace carriage returns with
. These changes together make it so that textarea prefs will round-trip properly.
<<11/21/01; 8:36:33 PM by JES
<<If adrstring points at a wpText, convert it to a string.
on demunge (s) {
if typeOf (s) != stringType {
table.assign (@s, string (s))};
s = string.replaceall (s, "\t", " ");
s = html.translateToEntities (s);
s = string.replaceall (s, "\r\n", "\r");
s = string.replaceall (s, "\r", "
");
return (s)};
local (pta = html.getpagetableaddress ());
if pta^.method == "POST" {
local (postargs);
if system.environment.isRadio {
postargs = pta^.radioresponder.postargs}
else {
postargs = pta^.postargs};
local (adr = address (string.popFileFromAddress (adrstring)));
if defined (adr^) {
if typeof (adr^) != stringtype {
delete (adr)}};
local (s = postargs.[string.urlEncode (string.popFileFromAddress (adrstring))] );
if system.environment.isMac {
s = string.latinToMac (s)};
adr^ = s};
if sizeof (prompt) > 0 {
prompt = prompt + ":"};
return ("<tr><td valign=\"top\" align=\"" + labelAlign + "\">" + prompt + "</td><td valign=\"top\" colspan=\"" + colspan + "\"><textarea name=\"" + string.urlEncode (string.popFileFromAddress (adrstring)) + "\" cols=\"" + cols + "\" rows=\"" + rows + "\">" + demunge (adrstring^) + "</textarea></td></tr>")}
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.