[turba] Sorting addressbook with national alphabet

Rashid N. Achilov achilov-rn at askd.ru
Wed Jul 15 11:34:28 UTC 2009


On Monday 13 July 2009, Rashid N. Achilov wrote:
> When turba displays addressbook, it split content per 'perpage' lines, when 
> addressbook records quantity more than 'perpage' and displays 'guide' to 
> addressbook as line with letters A,B,C... and displays at these pages only 
> records, started from A, from B, from C...

I'll answer by myself. I had have implemented this. Now I can see in 
addressbook view line with links "russian A, russian B, russian W..." and 
when I pressing this link I'll see records, started from this letter. But I 
do not know how to do this by universal matter, because I have done some 
descructive patches.

First. For generating russian guides I have changed 
turba/templates/list/alphaPager.inc

--- alphaPager.inc.old	2009-05-01 17:12:37.000000000 +0700
+++ alphaPager.inc	2009-07-15 16:41:17.000000000 +0700
@@ -9,8 +9,10 @@
     echo Horde::link(Horde::applicationUrl(Util::addParameter($viewurl, 
array('page'=> '*', 'show' => $show)))) . _("All") . '</a>&nbsp;';
 }
-for ($i = 65; $i < 91; $i++) {
-    $a = chr($i);
+
+for ($i = 192; $i <= 223; $i++) {
+    $a = String::convertCharset(chr($i), "cp1251", "utf-8");
+
     if ($currentPage == $a) {
         echo '<strong>(' . $a . ')</strong>&nbsp;';
     } else {

I have used another range and instead of chr() use String::convert to convert 
generated one-byte chars to UTF8. Now I'll see russian letters. As you can 
see, here is hardcoded codepage and chars range. I do not know how to adopt 
this to another national alphabet

Than, I had changed the processor turba/lib/ListView.php


-- 
   With Best Regards.
   Rashid N. Achilov (RNA1-RIPE), JID: citycat4 at jabber.org
   OOO "ACK" telecommunications administrator, e-mail: achilov-rn [at] askd.ru
   PGP: 83 CD E2 A7 37 4A D5 81 D6 D6 52 BF C9 2F 85 AF 97 BE CB 0A


More information about the turba mailing list