From 60f37890fbec2073130aced0e81bcd485815161a Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Thu, 12 Dec 2024 14:34:11 +0000 Subject: [PATCH] MDL-83995 mod_glossary: support export/import of entry trusted text. --- mod/glossary/import.php | 5 +++++ mod/glossary/lib.php | 1 + 2 files changed, 6 insertions(+) diff --git a/mod/glossary/import.php b/mod/glossary/import.php index f1bcbbd8040..85c4f1d620d 100644 --- a/mod/glossary/import.php +++ b/mod/glossary/import.php @@ -188,6 +188,11 @@ if ($xml = glossary_read_imported_file($result)) { throw new \moodle_exception('errorparsingxml', 'glossary'); } $newentry->definition = trusttext_strip($definition); + + if (isset($xmlentry['#']['DEFINITIONTRUST'][0]['#'])) { + $newentry->definitiontrust = !empty($xmlentry['#']['DEFINITIONTRUST'][0]['#']) && trusttext_trusted($context); + } + if ( isset($xmlentry['#']['CASESENSITIVE'][0]['#']) ) { $newentry->casesensitive = $xmlentry['#']['CASESENSITIVE'][0]['#']; } else { diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index 5f275de2dd8..de95bb8a08a 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -2363,6 +2363,7 @@ function glossary_generate_export_file($glossary, $ignored = "", $hook = 0) { $co .= glossary_full_tag("CONCEPT",4,false,trim($entry->concept)); $co .= glossary_full_tag("DEFINITION",4,false,$entry->definition); $co .= glossary_full_tag("FORMAT",4,false,$entry->definitionformat); // note: use old name for BC reasons + $co .= glossary_full_tag('DEFINITIONTRUST', 4, false, $entry->definitiontrust); $co .= glossary_full_tag("USEDYNALINK",4,false,$entry->usedynalink); $co .= glossary_full_tag("CASESENSITIVE",4,false,$entry->casesensitive); $co .= glossary_full_tag("FULLMATCH",4,false,$entry->fullmatch);