Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.macros.registerStorageSpace
on registerStorageSpace () {
<<Changes
<<2/19/03; 6:45:05 PM by JES
<<Run the page for registering additional storage space.
local (pta = html.getPageTableAddress ());
local (htext = "");
on add (s) {
htext = htext + (s + "\r");};
if pta^.method == "POST" { //process a POST
local (adrargs = @pta^.radioResponder.postArgs);
if defined (adrargs^.enterRenewalCode) {
local (domain = "superhonker.userland.com");
local (code = string.upper (adrargs^.renewalCode));
try { //contact UserLand, verify the code, and get new expiration date
local (totalspace);
bundle { //renew the license
local (params = {user.radio.prefs.serialNumber, code});
totalspace = xml.rpc (domain, 80, "digitalRiver.registerStorageSpace", @params, rpcPath:"/RPC2", flShowMessages:false)};
pta^.title = radio.string.getLocalizedString ("registerStorageSpace.confirmTitle");
return (string.replace (radio.string.getLocalizedString ("registerStorageSpace.confirm"), "<%totalStorage%>", string.megabyteString (totalspace)))}
else { //error
pta^.title = radio.string.getLocalizedString ("registerStorageSpace.itDidntWork");
local (s = radio.string.getLocalizedString ("registerStorageSpace.error"));
local (error = tryerror);
if error contains domain { //pop off the rpc part of the message
local (ix = string.patternMatch (":", error));
error = string.delete (error, 1, ix)};
return (string.replace (s, "<%errorMessage%>", error))}}};
bundle { //add the form text
pta^.title = radio.string.getLocalizedString ("registerStorageSpace.title");
local (s = radio.string.getLocalizedString ("registerStorageSpace.text"));
add (string.replace (s, "<%serialNumber%>", string.padWithZeros (user.radio.prefs.serialNumber, 7)))};
return (htext)}
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.