Hi all,
I've implement the idea I posted in http://moodle.org/mod/forum/discuss.php?d=23666 and made it simpler.
First, you should create a table named 'mdl_glossary_letter_map'. The structure of it is
+-----------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | | PRI | NULL | auto_increment |
| letter | char(1) | | MUL | | |
| character | char(4) | | | | |
+-----------+------------------+------+-----+---------+----------------+
`letter` is the index (A,B,C,...,Z, must be uppercase), character is your chars in your charset.
Following is diff of mod/glossary/sql.php
[root@somehost moodle]# cvs diff mod/glossary/sql.php
Index: mod/glossary/sql.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/glossary/sql.php,v
retrieving revision 1.23
diff -r1.23 sql.php
276c276,277
<
$where = 'AND left(ucase(concept),' . strlen($hook) . ") = '" .
strtoupper($hook) . "'";
---
>
//$where = 'AND left(ucase(concept),' . strlen($hook) . ") = '" .
strtoupper($hook) . "'";
>
$where = 'AND EXISTS (SELECT * FROM `mdl_glossary_letter_map` WHERE
letter = '' .strtoupper($hook) . "' AND strcmp(ucase(left(concept,
length(`character`))), `character`) = 0)";
295c296,298
<
$where = 'AND left(ucase(concept),1) NOT IN (' .
strtoupper($sqlalphabet) . ')';
---
>
//$where = 'AND left(ucase(concept),1) NOT IN (' .
strtoupper($sqlalphabet) . ')';
>
$where = 'AND NOT EXISTS (SELECT * FROM `mdl_glossary_letter_map` WHERE
strcmp(ucase(left(concept, length(`character`))), `character`)=0 )';
>
The code above only supports MySQL 4.1 or above.
Wish it can be merged into CVS...
Glossary
Let glossary module support index of non-ASCII charset
This discussion has been locked so you can no longer reply to it.