Re: [phpldapadmin] Patch for multipart surnames
Deon George <[email protected]>
| Newsgroups | gmane.comp.ldap.davedap |
|---|---|
| Message-ID | <[email protected]> |
Thomas, Patches on the mailling list dont make it into PLA. Mainly because the mailling list alters the patch (or truncates it if it is too big), making it difficult to apply. If you want your patch to make it into PLA, submit it on SF Patch tracker for consideration. Thanks ...deon ----- Original Message ----- From: Thomas Bliesener <[email protected]> Sent: Mon, 9/2/2009 6:42am To: [email protected] Subject: [phpldapadmin] Patch for multipart surnames In Latinamerica, Spain and other countries the people wear two surnames. This is a problem when you want to create an uid or homeDirectory from their complete names using autoFill. You can't separate the two surnames and get variables wich include spaces. I propose the following patch (against 1.1.0.6) as a solution. It introduces the flag "K" which uses a space as a separator for split(), e.g. <onchange>autoFill:uid,%givenName|0-1/l%%sn|0-1/lK%</onchange> So "Carlos Jose Garcia Arreola" results in the uid "cgarcia" and not "cgarcia arreola". --- template_functions.php 2009-02-08 12:09:01.000000000 -0600 +++ template_functions.php_patched 2009-02-08 12:10:14.000000000 -0600 @@ -531,6 +531,8 @@ If the "k" flag is given: The string read will be split into fields, using : as a delimiter "start" indicates which field number to pass through. + K: The string read will be split into fields, using ' ' as a delimiter + "start" indicates which field number to pass through. l: Make the result lower case. U: Make the result upper case. */ @@ -599,6 +601,15 @@ $tok_idx = '0'; } $_js_hash['autoFill'.$origin] .= sprintf(" %s = %s.split(':')[%s];\n",$match_attr,$match_attr,$tok_idx); + } elseif (strstr($match_mod,'K')) { + preg_match_all('/([0-9]+)/',trim($match_subst),$substrarray); + if (isset($substrarray[1][0])) { + $tok_idx = $substrarray[1][0]; + } else { + $tok_idx = '0'; + } + $_js_hash['autoFill'.$origin] + .= sprintf(" %s = %s.split(' ')[%s];\n",$match_attr,$match_attr,$tok_idx); } else { preg_match_all('/([0-9]*)-([0-9]*)/',trim($match_subst),$substrarray); if ((isset($substrarray[1][0]) && $substrarray[1][0]) || (isset($substrarray[2][0]) && $substrarray[2][0])) { -- Thomas ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com ______________________________________ phpLDAPadmin development mailing list. To unsbuscribe: https://lists.sourceforge.net/lists/listinfo/phpldapadmin-devel http://phpldapadmin.sourceforge.net/ ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com ______________________________________ phpLDAPadmin development mailing list. To unsbuscribe: https://lists.sourceforge.net/lists/listinfo/phpldapadmin-devel http://phpldapadmin.sourceforge.net/