Bug #6170 - Glossary bug: it displays nothing when autolinking to non-ascii text and other minor cleanup

This commit is contained in:
skodak
2006-07-30 22:18:14 +00:00
parent 2a94a64a06
commit d2b00aae1d
4 changed files with 14 additions and 13 deletions
+4 -4
View File
@@ -31,9 +31,9 @@ if (! $glossary = get_record("glossary", "id", $cm->instance)) {
}
if ($CFG->dbtype == 'postgres7' ) {
$ucase = 'upper';
$ucase = 'lower';
} else {
$ucase = 'ucase';
$ucase = 'lcase';
}
if (!$glossary->studentcanpost && !isteacher($glossary->course)) {
@@ -132,7 +132,7 @@ if ( $confirm ) {
$permissiongranted = 1;
if ( !$glossary->allowduplicatedentries ) {
if ($dupentries = get_records("glossary_entries","$ucase(concept)", strtoupper($newentry->concept))) {
if ($dupentries = get_records("glossary_entries","$ucase(concept)", moodle_strtolower($newentry->concept))) {
foreach ($dupentries as $curentry) {
if ( $glossary->id == $curentry->glossaryid ) {
if ( $curentry->id != $e ) {
@@ -172,7 +172,7 @@ if ( $confirm ) {
$permissiongranted = 1;
if ( !$glossary->allowduplicatedentries ) {
if ($dupentries = get_record("glossary_entries","$ucase(concept)", strtoupper($newentry->concept), "glossaryid", $glossary->id)) {
if ($dupentries = get_record("glossary_entries","$ucase(concept)", moodle_strtolower($newentry->concept), "glossaryid", $glossary->id)) {
$permissiongranted = 0;
}
}
+3 -3
View File
@@ -24,9 +24,9 @@
}
if ($CFG->dbtype == 'postgres7' ) {
$ucase = 'upper';
$ucase = 'lower';
} else {
$ucase = 'ucase';
$ucase = 'lcase';
}
if ( !isteacher($cm->course) ) {
@@ -63,7 +63,7 @@
} else {
if ( ! $mainglossary->allowduplicatedentries ) {
$dupentry = get_record('glossary_entries','glossaryid', $mainglossary->id, $ucase.'(concept)',strtoupper(addslashes($entry->concept)));
$dupentry = get_record('glossary_entries','glossaryid', $mainglossary->id, $ucase.'(concept)',moodle_strtolower(addslashes($entry->concept)));
if ( $dupentry ) {
$PermissionGranted = 0;
}
+2 -2
View File
@@ -227,9 +227,9 @@
$dupentry = get_record("glossary_entries","concept",$newentry->concept,"glossaryid",$glossary->id);
} else {
if ($CFG->dbtype == 'postgres7') {
$dupentry = get_record("glossary_entries","upper(concept)",strtoupper($newentry->concept),"glossaryid",$glossary->id);
$dupentry = get_record("glossary_entries","lower(concept)",moodle_strtolower($newentry->concept),"glossaryid",$glossary->id);
}else {
$dupentry = get_record("glossary_entries","ucase(concept)",strtoupper($newentry->concept),"glossaryid",$glossary->id);
$dupentry = get_record("glossary_entries","lcase(concept)",moodle_strtolower($newentry->concept),"glossaryid",$glossary->id);
}
}
if ($dupentry) {
+5 -4
View File
@@ -505,7 +505,7 @@ function glossary_get_entries_search($concept, $courseid) {
$bypassteacher = 0; //This means YES
}
$conceptupper = strtoupper(trim($concept));
$conceptlower = moodle_strtolower(trim($concept));
return get_records_sql("SELECT e.*, g.name as glossaryname, cm.id as cmid, cm.course as courseid
FROM {$CFG->prefix}glossary_entries e,
@@ -518,7 +518,7 @@ function glossary_get_entries_search($concept, $courseid) {
(cm.course = '$courseid' AND cm.visible = $bypassteacher)) AND
g.id = cm.instance AND
e.glossaryid = g.id AND
( (e.casesensitive != 0 AND UPPER(concept) = '$conceptupper') OR
( (e.casesensitive != 0 AND LOWER(concept) = '$conceptlower') OR
(e.casesensitive = 0 and concept = '$concept')) AND
(g.course = '$courseid' OR g.globalglossary = 1) AND
e.usedynalink != 0 AND
@@ -1495,9 +1495,10 @@ global $CFG;
}
function glossary_sort_entries ( $entry0, $entry1 ) {
if ( strtolower(ltrim($entry0->concept)) < strtolower(ltrim($entry1->concept)) ) {
if ( moodle_strtolower(ltrim($entry0->concept)) < moodle_strtolower(ltrim($entry1->concept)) ) {
return -1;
} elseif ( strtolower(ltrim($entry0->concept)) > strtolower(ltrim($entry1->concept)) ) {
} elseif ( moodle_strtolower(ltrim($entry0->concept)) > moodle_strtolower(ltrim($entry1->concept)) ) {
return 1;
} else {
return 0;