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

system.verbs.builtins.radio.macros.renewLicense

on renewLicense () {
	<<Changes
		<<12/26/02; 1:10:57 PM by JES
			<<Run the Renew License page.
	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
				bundle { //renew the license
					local (params = {user.radio.prefs.serialNumber, code}, retval, whenExpires);
					retval = xml.rpc (domain, 80, "digitalRiver.renewLicense", @params, rpcPath:"/RPC2", flShowMessages:false);
					whenExpires = 0 - number (base64.decode (retval));
					user.radio.settings.whenSNExpires = whenExpires};
				pta^.title = radio.string.getLocalizedString ("renewLicense.confirmTitle");
				return (radio.string.getLocalizedString ("renewLicense.confirm"))}
			else { //error
				pta^.title = radio.string.getLocalizedString ("renewLicense.itDidntWork");
				local (s = radio.string.getLocalizedString ("renewLicense.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 ("renewLicense.title");
		local (s = radio.string.getLocalizedString ("renewLicense.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.