From: <de...@de...> - 2009-12-09 21:46:53
|
Author: PeterThoeny Date: 2009-12-09 15:46:42 -0600 (Wed, 09 Dec 2009) New Revision: 18248 Trac url: http://develop.twiki.org/trac/changeset/18248 Modified: twiki/trunk/TWikiUserMappingContrib/data/TWiki/TWikiRegistration.txt Log: Item6372: More robust WikiWord build in TWikiRegistration form Modified: twiki/trunk/TWikiUserMappingContrib/data/TWiki/TWikiRegistration.txt =================================================================== --- twiki/trunk/TWikiUserMappingContrib/data/TWiki/TWikiRegistration.txt 2009-12-09 21:46:05 UTC (rev 18247) +++ twiki/trunk/TWikiUserMappingContrib/data/TWiki/TWikiRegistration.txt 2009-12-09 21:46:42 UTC (rev 18248) @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="TWikiContributor" date="1247086842" format="1.1" version="$Rev$"}% +%META:TOPICINFO{author="TWikiContributor" date="1260393962" format="1.1" version="$Rev$"}% ---+ %MAKETEXT{"Registration"}% %IF{"context registration_supported" @@ -20,61 +20,62 @@ <!-- function capitalise(name) { -var sIn = name; -var sOut = ''; -var chgUpper = true; -for ( var i = 0; i < sIn.length; i++ ) { - var ch = sIn.charAt( i ); - var chVal = ch.charCodeAt(0); - var ch2 = ''; - if( (chVal==192) || (chVal==193) || (chVal==194) || (chVal==195) ) { ch = 'A'; } - if( chVal==196) { ch = 'A'; ch2 = 'E'; } - if( chVal==197) { ch = 'A'; ch2 = 'A'; } - if( chVal==198) { ch = 'A'; ch2 = 'E'; } - if( chVal==199) { ch = 'C'; } - if( (chVal==200) || (chVal==201) || (chVal==202) || (chVal==203) ) { ch = 'E'; } - if( (chVal==204) || (chVal==205) || (chVal==206) || (chVal==207) ) { ch = 'I'; } - if( chVal==208) { ch = 'd'; } - if( chVal==209) { ch = 'N'; } - if( (chVal==210) || (chVal==211) || (chVal==212) || (chVal==213) ) { ch = 'O'; } - if( chVal==214) { ch = 'O'; ch2 = 'E'; } - if( chVal==216) { ch = 'O'; ch2 = 'E'; } - if( (chVal==217) || (chVal==218) || (chVal==219) ) { ch = 'U'; } - if( chVal==220) { ch = 'U'; ch2 = 'E'; } - if( chVal==221) { ch = 'Y'; } - if( chVal==222) { ch = 'P'; } - if( chVal==223) { ch = 's'; ch2 = 's'; } - if( (chVal==224) || (chVal==225) || (chVal==226) || (chVal==227) ) { ch = 'a'; } - if( chVal==228) { ch = 'a'; ch2 = 'e'; } - if( chVal==229) { ch = 'a'; ch2 = 'a'; } - if( chVal==230) { ch = 'a'; ch2 = 'e'; } - if( chVal==231) { ch = 'c'; } - if( (chVal==232) || (chVal==233) || (chVal==234) || (chVal==235) ) { ch = 'e'; } - if( (chVal==236) || (chVal==237) || (chVal==238) || (chVal==239) ) { ch = 'i'; } - if( chVal==240) { ch = 'd'; } - if( chVal==241) { ch = 'n'; } - if( (chVal==242) || (chVal==243) || (chVal==244) || (chVal==245) ) { ch = 'o'; } - if( chVal==246) { ch = 'o'; ch2 = 'e'; } - if( chVal==248) { ch = 'o'; ch2 = 'e'; } - if( (chVal==249) || (chVal==250) || (chVal==251) ) { ch = 'u'; } - if( chVal==252) { ch = 'u'; ch2 = 'e'; } - if( chVal==253) { ch = 'y'; } - if( chVal==254) { ch = 'p'; } - if( chVal==255) { ch = 'y'; } - if( ch!=' ' ) { - if( chgUpper ) { - ch = ch.toUpperCase(); chgUpper = false; + var sIn = name; + var sOut = ''; + var chgUpper = true; + for ( var i = 0; i < sIn.length; i++ ) { + var ch = sIn.charAt( i ); + var chVal = ch.charCodeAt(0); + var ch1 = ''; + var ch2 = ''; + if( ((chVal>=48) && (chVal<=57)) || ((chVal>=65) && (chVal<=90)) || ((chVal>=97) && (chVal<=122)) ) { ch1 = ch; } + else if( chVal<=126 ) { ch1 = ' '; } + if( (chVal==192) || (chVal==193) || (chVal==194) || (chVal==195) ) { ch1 = 'A'; } + if( chVal==196) { ch1 = 'A'; ch2 = 'E'; } + if( chVal==197) { ch1 = 'A'; ch2 = 'A'; } + if( chVal==198) { ch1 = 'A'; ch2 = 'E'; } + if( chVal==199) { ch1 = 'C'; } + if( (chVal==200) || (chVal==201) || (chVal==202) || (chVal==203) ) { ch1 = 'E'; } + if( (chVal==204) || (chVal==205) || (chVal==206) || (chVal==207) ) { ch1 = 'I'; } + if( chVal==208) { ch1 = 'd'; } + if( chVal==209) { ch1 = 'N'; } + if( (chVal==210) || (chVal==211) || (chVal==212) || (chVal==213) ) { ch1 = 'O'; } + if( chVal==214) { ch1 = 'O'; ch2 = 'E'; } + if( chVal==216) { ch1 = 'O'; ch2 = 'E'; } + if( (chVal==217) || (chVal==218) || (chVal==219) ) { ch1 = 'U'; } + if( chVal==220) { ch1 = 'U'; ch2 = 'E'; } + if( chVal==221) { ch1 = 'Y'; } + if( chVal==222) { ch1 = 'P'; } + if( chVal==223) { ch1 = 's'; ch2 = 's'; } + if( (chVal==224) || (chVal==225) || (chVal==226) || (chVal==227) ) { ch1 = 'a'; } + if( chVal==228) { ch1 = 'a'; ch2 = 'e'; } + if( chVal==229) { ch1 = 'a'; ch2 = 'a'; } + if( chVal==230) { ch1 = 'a'; ch2 = 'e'; } + if( chVal==231) { ch1 = 'c'; } + if( (chVal==232) || (chVal==233) || (chVal==234) || (chVal==235) ) { ch1 = 'e'; } + if( (chVal==236) || (chVal==237) || (chVal==238) || (chVal==239) ) { ch1 = 'i'; } + if( chVal==240) { ch1 = 'd'; } + if( chVal==241) { ch1 = 'n'; } + if( (chVal==242) || (chVal==243) || (chVal==244) || (chVal==245) ) { ch1 = 'o'; } + if( chVal==246) { ch1 = 'o'; ch2 = 'e'; } + if( chVal==248) { ch1 = 'o'; ch2 = 'e'; } + if( (chVal==249) || (chVal==250) || (chVal==251) ) { ch1 = 'u'; } + if( chVal==252) { ch1 = 'u'; ch2 = 'e'; } + if( chVal==253) { ch1 = 'y'; } + if( chVal==254) { ch1 = 'p'; } + if( chVal==255) { ch1 = 'y'; } + if( ch1!=' ' ) { + if( chgUpper ) { + ch1 = ch1.toUpperCase(); chgUpper = false; + } + sOut+=ch1; + sOut+=ch2; + } else { + chgUpper = true; } - sOut+=ch; - if( ch2!='') { - sOut+=ch2; - } - } else { - chgUpper = true; - } + } + return sOut; } -return sOut; -} //--> </script> @@ -91,28 +92,28 @@ </tr> <tr> <td align="right"> %MAKETEXT{"First Name:"}% </td> - <td><input %NOREGISTRATION% type="text" name="Twk1FirstName" size="40" class="twikiInputField" value="" onblur="this.form.Twk1WikiName.value=capitalise(this.value)+capitalise(this.form.Twk1LastName.value)" /> =<font color="red">**</font>= </td> + <td><input %NOREGISTRATION% type="text" name="Twk1FirstName" size="30" class="twikiInputField" value="" onblur="this.form.Twk1WikiName.value=capitalise(this.value)+capitalise(this.form.Twk1LastName.value)" /> =<font color="red">**</font>= </td> </tr> <tr> <td align="right"> %MAKETEXT{"Last Name:"}% </td> - <td><input %NOREGISTRATION% type="text" name="Twk1LastName" size="40" class="twikiInputField" value="" onblur="this.form.Twk1WikiName.value=capitalise(this.form.Twk1FirstName.value)+capitalise(this.value)" /> =<font color="red">**</font>= </td> + <td><input %NOREGISTRATION% type="text" name="Twk1LastName" size="30" class="twikiInputField" value="" onblur="this.form.Twk1WikiName.value=capitalise(this.form.Twk1FirstName.value)+capitalise(this.value)" /> =<font color="red">**</font>= </td> </tr> <td align="right"> %MAKETEXT{"(identifies you to others) WikiName:"}% </td> - <td><input %NOREGISTRATION% type="text" name="Twk1WikiName" size="40" class="twikiInputField" value="" onblur="" /> =<font color="red">**</font>= </td> + <td><input %NOREGISTRATION% type="text" name="Twk1WikiName" size="30" class="twikiInputField" value="" onblur="" /> =<font color="red">**</font>= </td> </tr> <!-- # optional row for login name, enabled by {Register}{AllowLoginName} option in =configure= - * Set BESPOKE_AUTH = <tr><td align=\"right\"> %MAKETEXT{"(how you log in) LoginName:"}% </td><td><input %NOREGISTRATION% type=\"text\" name=\"Twk1LoginName\" size=\"40\" class=\"twikiInputField\" value=\"%REMOTE_USER%\" /> =<font color='red'>**</font>= </td></tr> + * Set BESPOKE_AUTH = <tr><td align=\"right\"> %MAKETEXT{"(how you log in) LoginName:"}% </td><td><input %NOREGISTRATION% type=\"text\" name=\"Twk1LoginName\" size=\"30\" class=\"twikiInputField\" value=\"%REMOTE_USER%\" /> =<font color='red'>**</font>= </td></tr> --> %IF{"$ ALLOWLOGINNAME" then="%BESPOKE_AUTH%"}% <tr> <td align="right"> %MAKETEXT{"E-mail address:"}% </td> - <td><input %NOREGISTRATION% type="text" name="Twk1Email" size="40" class="twikiInputField" value="" /> =<font color="red">**</font>= </td> + <td><input %NOREGISTRATION% type="text" name="Twk1Email" size="30" class="twikiInputField" value="" /> =<font color="red">**</font>= </td> </tr> <!-- # optional rows for password, enabled by {Register}{AllowLoginName} option in =configure=, we assume that login name means that TWiki does not handle passwords - * Set BESPOKE_PASSWORD = <tr><td align=\"right\"> %MAKETEXT{"Your password:"}% </td><td><input %NOREGISTRATION% type=\"password\" name=\"Twk0Password\" size=\"40\" class=\"twikiInputField\" value=\"\" /> =<font color=\"red\">**</font>= </td></tr>\ - <tr><td align=\"right\"> %MAKETEXT{"Retype password:"}% </td><td><input %NOREGISTRATION% type=\"password\" name=\"Twk0Confirm\" size=\"40\" class=\"twikiInputField\" value=\"\" /> =<font color=\"red\">**</font>= </td></tr> + * Set BESPOKE_PASSWORD = <tr><td align=\"right\"> %MAKETEXT{"Your password:"}% </td><td><input %NOREGISTRATION% type=\"password\" name=\"Twk0Password\" size=\"30\" class=\"twikiInputField\" value=\"\" /> =<font color=\"red\">**</font>= </td></tr>\ + <tr><td align=\"right\"> %MAKETEXT{"Retype password:"}% </td><td><input %NOREGISTRATION% type=\"password\" name=\"Twk0Confirm\" size=\"30\" class=\"twikiInputField\" value=\"\" /> =<font color=\"red\">**</font>= </td></tr> --> %IF{"$ ALLOWLOGINNAME < 1" then="%BESPOKE_PASSWORD%"}% <tr> |