Monday, November 08, 2010 at 12:05 AM.

system.verbs.builtins.radio.macros.enterSerialNumber

<<Changes
	<<7/21/02; 6:40:59 PM by JES
		<<Get the store url from radio.data.cloudUrls.store instead of using a hard-coded url.
	<<1/7/02; 12:47:39 AM by JES
		<<On a POST, convert the serial number to upper-case before doing anything with it. Also trim whitespace.
	<<12/2/01; 9:53:08 AM by DW
		<<Created.

local (pta = html.getpagetableaddress ());
pta^.title = radio.string.getlocalizedstring ("serialNumber.title");
local (htmltext = "", indentlevel = 0);
on add (s) {
	htmltext = htmltext + string.filledstring ("\t", indentlevel) + s + "\r\n"};
local (flInvalidSerialNumber = false, serialNumberForDisplay = user.radio.prefs.serialNumber);
if pta^.method == "POST" {
	<<scratchpad.params = pta^; edit (@scratchpad.params.radioresponder)
	local (sn = string.trimWhiteSpace (string.upper (pta^.radioResponder.postArgs.serialNumber)));
	serialNumberForDisplay = sn;
	if sn == "" {
		filemenu.quit ()};
	if userLand.isValidSerialNumber (sn) {
		user.radio.settings.flExpired = false;
		user.radio.settings.flTrialVersion = false;
		user.radio.prefs.serialnumber = sn;
		radio.webserver.redirect (radio.data.systemurls.thankYou)}
	else {
		flInvalidSerialNumber = true}};
bundle { //intro text
	local (t); new (tableType, @t);
	t.storeUrl = radio.data.cloudUrls.store;
	add ("<p>" + radio.string.getlocalizedstring ("serialNumber.intro", @t) + "</p>")};
bundle { //add the form
	add ("<form method=\"POST\">"); indentlevel++;
	add ("<table cellspacing=\"10\" cellpadding=\"0\">"); indentlevel++;
	add ("<tr><td>Serial number:</td><td><input type=text size=\"35\" name=\"serialNumber\" value=\"" + serialNumberForDisplay + "\"></td><td><input type=\"submit\" value=\"" + radio.string.getlocalizedstring ("serialNumber.submit") + "\"></td></tr>");
	if flInvalidSerialNumber {
		add ("<tr><td> </td><td colspan=\"2\">" + radio.string.getlocalizedstring ("serialNumber.invalidSerialNumber") + "</td></tr>")};
	add ("</table>"); indentlevel--;
	add ("</form>"); indentlevel--};
add ("<p>" + radio.string.getlocalizedstring ("serialNumber.postscript") + "</p>");
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.