���ѧۧݧ�ӧ�� �ާ֧ߧ֧էا֧� - ���֧էѧܧ�ڧ��ӧѧ�� - /home3/cpr76684/public_html/glossary.tar
���ѧ٧ѧ�
styles.css 0000644 00000000157 15152701652 0006610 0 ustar 00 #glossaryfilteroverlayprogress { position: fixed; top: 50%; width: 100%; text-align: center; } db/install.php 0000644 00000002014 15152701652 0007311 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Glossary filter post install hook * * @package filter * @subpackage glossary * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); function xmldb_filter_glossary_install() { global $DB; } tests/filter_test.php 0000644 00000032270 15152701652 0010753 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Unit tests. * * @package filter_glossary * @category test * @copyright 2013 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace filter_glossary; /** * Test case for glossary. */ class filter_test extends \advanced_testcase { public function test_link_to_entry_with_alias() { global $CFG; $this->resetAfterTest(true); // Enable glossary filter at top level. filter_set_global_state('glossary', TEXTFILTER_ON); $CFG->glossary_linkentries = 1; // Create a test course. $course = $this->getDataGenerator()->create_course(); $context = \context_course::instance($course->id); // Create a glossary. $glossary = $this->getDataGenerator()->create_module('glossary', array('course' => $course->id, 'mainglossary' => 1)); // Create two entries with ampersands and one normal entry. $generator = $this->getDataGenerator()->get_plugin_generator('mod_glossary'); $normal = $generator->create_content($glossary, array('concept' => 'entry name'), array('first alias', 'second alias')); // Format text with all three entries in HTML. $html = '<p>First we have entry name, then we have it twp aliases first alias and second alias.</p>'; $filtered = format_text($html, FORMAT_HTML, array('context' => $context)); // Find all the glossary links in the result. $matches = array(); preg_match_all('~eid=([0-9]+).*?title="(.*?)"~', $filtered, $matches); // There should be 3 glossary links. $this->assertEquals(3, count($matches[1])); $this->assertEquals($normal->id, $matches[1][0]); $this->assertEquals($normal->id, $matches[1][1]); $this->assertEquals($normal->id, $matches[1][2]); // Check text of title attribute. $this->assertEquals($glossary->name . ': entry name', $matches[2][0]); $this->assertEquals($glossary->name . ': first alias', $matches[2][1]); $this->assertEquals($glossary->name . ': second alias', $matches[2][2]); } public function test_longest_link_used() { global $CFG; $this->resetAfterTest(true); // Enable glossary filter at top level. filter_set_global_state('glossary', TEXTFILTER_ON); $CFG->glossary_linkentries = 1; // Create a test course. $course = $this->getDataGenerator()->create_course(); $context = \context_course::instance($course->id); // Create a glossary. $glossary = $this->getDataGenerator()->create_module('glossary', array('course' => $course->id, 'mainglossary' => 1)); // Create two entries with ampersands and one normal entry. $generator = $this->getDataGenerator()->get_plugin_generator('mod_glossary'); $shorter = $generator->create_content($glossary, array('concept' => 'Tim')); $longer = $generator->create_content($glossary, array('concept' => 'Time')); // Format text with all three entries in HTML. $html = '<p>Time will tell</p>'; $filtered = format_text($html, FORMAT_HTML, array('context' => $context)); // Find all the glossary links in the result. $matches = array(); preg_match_all('~eid=([0-9]+).*?title="(.*?)"~', $filtered, $matches); // There should be 1 glossary link to Time, not Tim. $this->assertEquals(1, count($matches[1])); $this->assertEquals($longer->id, $matches[1][0]); // Check text of title attribute. $this->assertEquals($glossary->name . ': Time', $matches[2][0]); } public function test_link_to_category() { global $CFG; $this->resetAfterTest(true); // Enable glossary filter at top level. filter_set_global_state('glossary', TEXTFILTER_ON); $CFG->glossary_linkentries = 1; // Create a test course. $course = $this->getDataGenerator()->create_course(); $context = \context_course::instance($course->id); // Create a glossary. $glossary = $this->getDataGenerator()->create_module('glossary', array('course' => $course->id, 'mainglossary' => 1)); // Create two entries with ampersands and one normal entry. /** @var mod_glossary_generator $generator */ $generator = $this->getDataGenerator()->get_plugin_generator('mod_glossary'); $category = $generator->create_category($glossary, array('name' => 'My category', 'usedynalink' => 1)); // Format text with all three entries in HTML. $html = '<p>This is My category you know.</p>'; $filtered = format_text($html, FORMAT_HTML, array('context' => $context)); // Find all the glossary links in the result. $matches = array(); preg_match_all('~hook=([0-9]+).*?title="(.*?)"~', $filtered, $matches); // There should be 1 glossary link. $this->assertEquals(1, count($matches[1])); $this->assertEquals($category->id, $matches[1][0]); $this->assertEquals($glossary->name . ': Category My category', $matches[2][0]); } /** * Test ampersands. */ public function test_ampersands() { global $CFG; $this->resetAfterTest(true); // Enable glossary filter at top level. filter_set_global_state('glossary', TEXTFILTER_ON); $CFG->glossary_linkentries = 1; // Create a test course. $course = $this->getDataGenerator()->create_course(); $context = \context_course::instance($course->id); // Create a glossary. $glossary = $this->getDataGenerator()->create_module('glossary', array('course' => $course->id, 'mainglossary' => 1)); // Create two entries with ampersands and one normal entry. /** @var mod_glossary_generator $generator */ $generator = $this->getDataGenerator()->get_plugin_generator('mod_glossary'); $normal = $generator->create_content($glossary, array('concept' => 'normal')); $amp1 = $generator->create_content($glossary, array('concept' => 'A&B')); $amp2 = $generator->create_content($glossary, array('concept' => 'C&D')); // Format text with all three entries in HTML. $html = '<p>A&B C&D normal</p>'; $filtered = format_text($html, FORMAT_HTML, array('context' => $context)); // Find all the glossary links in the result. $matches = array(); preg_match_all('~eid=([0-9]+).*?title="(.*?)"~', $filtered, $matches); // There should be 3 glossary links. $this->assertEquals(3, count($matches[1])); $this->assertEquals($amp1->id, $matches[1][0]); $this->assertEquals($amp2->id, $matches[1][1]); $this->assertEquals($normal->id, $matches[1][2]); // Check text and escaping of title attribute. $this->assertEquals($glossary->name . ': A&B', $matches[2][0]); $this->assertEquals($glossary->name . ': C&D', $matches[2][1]); $this->assertEquals($glossary->name . ': normal', $matches[2][2]); } /** * Test brackets. */ public function test_brackets() { global $CFG; $this->resetAfterTest(true); // Enable glossary filter at top level. filter_set_global_state('glossary', TEXTFILTER_ON); $CFG->glossary_linkentries = 1; // Create a test course. $course = $this->getDataGenerator()->create_course(); $context = \context_course::instance($course->id); // Create a glossary. $glossary = $this->getDataGenerator()->create_module('glossary', array('course' => $course->id, 'mainglossary' => 1)); // Create two entries with ampersands and one normal entry. /** @var mod_glossary_generator $generator */ $generator = $this->getDataGenerator()->get_plugin_generator('mod_glossary'); $simple = $generator->create_content($glossary, array('concept' => 'simple')); $withbrackets = $generator->create_content($glossary, array('concept' => 'more complex (perhaps)')); $test2 = $generator->create_content($glossary, array('concept' => 'Test (2)')); // Format text with all three entries in HTML. $html = '<p>Some thigns are simple. Others are more complex (perhaps). Test (2).</p>'; $filtered = format_text($html, FORMAT_HTML, array('context' => $context)); // Find all the glossary links in the result. $matches = array(); preg_match_all('~eid=([0-9]+).*?title="(.*?)"~', $filtered, $matches); // There should be 3 glossary links. $this->assertEquals(3, count($matches[1])); $this->assertEquals($simple->id, $matches[1][0]); $this->assertEquals($withbrackets->id, $matches[1][1]); $this->assertEquals($test2->id, $matches[1][2]); // Check text and escaping of title attribute. $this->assertEquals($glossary->name . ': simple', $matches[2][0]); $this->assertEquals($glossary->name . ': more complex (perhaps)', $matches[2][1]); $this->assertEquals($glossary->name . ': Test (2)', $matches[2][2]); } public function test_exclude_excludes_link_to_entry_with_alias() { global $CFG, $GLOSSARY_EXCLUDEENTRY; $this->resetAfterTest(true); // Enable glossary filter at top level. filter_set_global_state('glossary', TEXTFILTER_ON); $CFG->glossary_linkentries = 1; // Create a test course. $course = $this->getDataGenerator()->create_course(); $context = \context_course::instance($course->id); // Create a glossary. $glossary = $this->getDataGenerator()->create_module('glossary', array('course' => $course->id, 'mainglossary' => 1)); // Create two entries with ampersands and one normal entry. $generator = $this->getDataGenerator()->get_plugin_generator('mod_glossary'); $tobeexcluded = $generator->create_content($glossary, array('concept' => 'entry name'), array('first alias', 'second alias')); $normal = $generator->create_content($glossary, array('concept' => 'other entry')); // Format text with all three entries in HTML. $html = '<p>First we have entry name, then we have it twp aliases first alias and second alias. ' . 'In this case, those should not be linked, but this other entry should be.</p>'; $GLOSSARY_EXCLUDEENTRY = $tobeexcluded->id; $filtered = format_text($html, FORMAT_HTML, array('context' => $context)); $GLOSSARY_EXCLUDEENTRY = null; // Find all the glossary links in the result. $matches = array(); preg_match_all('~eid=([0-9]+).*?title="(.*?)"~', $filtered, $matches); // There should be 1 glossary links. $this->assertEquals(1, count($matches[1])); $this->assertEquals($normal->id, $matches[1][0]); $this->assertEquals($glossary->name . ': other entry', $matches[2][0]); } public function test_exclude_does_not_exclude_categories() { global $CFG, $GLOSSARY_EXCLUDEENTRY; $this->resetAfterTest(true); // Enable glossary filter at top level. filter_set_global_state('glossary', TEXTFILTER_ON); $CFG->glossary_linkentries = 1; // Create a test course. $course = $this->getDataGenerator()->create_course(); $context = \context_course::instance($course->id); // Create a glossary. $glossary = $this->getDataGenerator()->create_module('glossary', array('course' => $course->id, 'mainglossary' => 1)); // Create two entries with ampersands and one normal entry. /** @var mod_glossary_generator $generator */ $generator = $this->getDataGenerator()->get_plugin_generator('mod_glossary'); $category = $generator->create_category($glossary, array('name' => 'My category', 'usedynalink' => 1)); // Format text with all three entries in HTML. $html = '<p>This is My category you know.</p>'; $GLOSSARY_EXCLUDEENTRY = $category->id; $filtered = format_text($html, FORMAT_HTML, array('context' => $context)); $GLOSSARY_EXCLUDEENTRY = null; // Find all the glossary links in the result. $matches = array(); preg_match_all('~hook=([0-9]+).*?title="(.*?)"~', $filtered, $matches); // There should be 1 glossary link. $this->assertEquals(1, count($matches[1])); $this->assertEquals($category->id, $matches[1][0]); $this->assertEquals($glossary->name . ': Category My category', $matches[2][0]); } } filter.php 0000644 00000017257 15152701652 0006562 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * This filter provides automatic linking to * glossary entries, aliases and categories when * found inside every Moodle text. * * @package filter * @subpackage glossary * @copyright 2004 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); /** * Glossary linking filter class. * * NOTE: multilang glossary entries are not compatible with this filter. */ class filter_glossary extends moodle_text_filter { /** @var null|cache_store cache used to store the terms for this course. */ protected $cache = null; public function setup($page, $context) { if ($page->requires->should_create_one_time_item_now('filter_glossary_autolinker')) { $page->requires->yui_module( 'moodle-filter_glossary-autolinker', 'M.filter_glossary.init_filter_autolinking', array(array('courseid' => 0))); $page->requires->strings_for_js(array('ok'), 'moodle'); } } /** * Get all the concepts for this context. * @return filterobject[] the concepts, and filterobjects. */ protected function get_all_concepts() { global $USER; if ($this->cache === null) { $this->cache = cache::make_from_params(cache_store::MODE_REQUEST, 'filter', 'glossary'); } // Try to get current course. $coursectx = $this->context->get_course_context(false); if (!$coursectx) { // Only global glossaries will be linked. $courseid = 0; } else { $courseid = $coursectx->instanceid; } $cached = $this->cache->get('concepts'); if ($cached !== false && ($cached->cachecourseid != $courseid || $cached->cacheuserid != $USER->id)) { // Invalidate the page cache. $cached = false; } if ($cached !== false && is_array($cached->cacheconceptlist)) { return $cached->cacheconceptlist; } list($glossaries, $allconcepts) = \mod_glossary\local\concept_cache::get_concepts($courseid); if (!$allconcepts) { $tocache = new stdClass(); $tocache->cacheuserid = $USER->id; $tocache->cachecourseid = $courseid; $tocache->cacheconceptlist = []; $this->cache->set('concepts', $tocache); return []; } $conceptlist = array(); foreach ($allconcepts as $concepts) { foreach ($concepts as $concept) { $conceptlist[] = new filterobject($concept->concept, null, null, $concept->casesensitive, $concept->fullmatch, null, [$this, 'filterobject_prepare_replacement_callback'], [$concept, $glossaries]); } } // We sort longest first, so that when we replace the terms, // the longest ones are replaced first. This does the right thing // when you have two terms like 'Moodle' and 'Moodle 3.5'. You want the longest match. usort($conceptlist, [$this, 'sort_entries_by_length']); $conceptlist = filter_prepare_phrases_for_filtering($conceptlist); $tocache = new stdClass(); $tocache->cacheuserid = $USER->id; $tocache->cachecourseid = $courseid; $tocache->cacheconceptlist = $conceptlist; $this->cache->set('concepts', $tocache); return $conceptlist; } /** * Callback used by filterobject / filter_phrases. * * @param object $concept the concept that is being replaced (from get_all_concepts). * @param array $glossaries the list of glossary titles (from get_all_concepts). * @return array [$hreftagbegin, $hreftagend, $replacementphrase] for filterobject. */ public function filterobject_prepare_replacement_callback($concept, $glossaries) { global $CFG; if ($concept->category) { // Link to a category. $title = get_string('glossarycategory', 'filter_glossary', ['glossary' => $glossaries[$concept->glossaryid], 'category' => $concept->concept]); $link = new moodle_url('/mod/glossary/view.php', ['g' => $concept->glossaryid, 'mode' => 'cat', 'hook' => $concept->id]); $attributes = array( 'href' => $link, 'title' => $title, 'class' => 'glossary autolink category glossaryid' . $concept->glossaryid); } else { // Link to entry or alias. $title = get_string('glossaryconcept', 'filter_glossary', ['glossary' => $glossaries[$concept->glossaryid], 'concept' => $concept->concept]); // Hardcoding dictionary format in the URL rather than defaulting // to the current glossary format which may not work in a popup. // for example "entry list" means the popup would only contain // a link that opens another popup. $link = new moodle_url('/mod/glossary/showentry.php', ['eid' => $concept->id, 'displayformat' => 'dictionary']); $attributes = array( 'href' => $link, 'title' => str_replace('&', '&', $title), // Undo the s() mangling. 'class' => 'glossary autolink concept glossaryid' . $concept->glossaryid); } // This flag is optionally set by resource_pluginfile() // if processing an embedded file use target to prevent getting nested Moodles. if (!empty($CFG->embeddedsoforcelinktarget)) { $attributes['target'] = '_top'; } return [html_writer::start_tag('a', $attributes), '</a>', null]; } public function filter($text, array $options = array()) { global $GLOSSARY_EXCLUDEENTRY; $conceptlist = $this->get_all_concepts(); if (empty($conceptlist)) { return $text; } if (!empty($GLOSSARY_EXCLUDEENTRY)) { foreach ($conceptlist as $key => $filterobj) { // The original concept object was stored here in when $filterobj was constructed in // get_all_concepts(). Get it back out now so we can check to see if it is excluded. $concept = $filterobj->replacementcallbackdata[0]; if (!$concept->category && $concept->id == $GLOSSARY_EXCLUDEENTRY) { unset($conceptlist[$key]); } } } if (empty($conceptlist)) { return $text; } return filter_phrases($text, $conceptlist, null, null, false, true); } /** * usort helper used in get_all_concepts above. * @param filterobject $filterobject0 first item to compare. * @param filterobject $filterobject1 second item to compare. * @return int -1, 0 or 1. */ private function sort_entries_by_length($filterobject0, $filterobject1) { return strlen($filterobject1->phrase) <=> strlen($filterobject0->phrase); } } version.php 0000644 00000002227 15152701652 0006751 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Glossary filter version information * * @package filter * @subpackage glossary * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $plugin->version = 2022112800; $plugin->requires = 2022111800; // Requires this Moodle version. $plugin->component= 'filter_glossary'; $plugin->dependencies = array('mod_glossary' => 2022111800); classes/privacy/provider.php 0000644 00000003003 15152701652 0012221 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Privacy Subsystem implementation for filter_glossary. * * @package filter_glossary * @copyright 2018 Andrew Nicols <andrew@nicols.co.uk> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace filter_glossary\privacy; defined('MOODLE_INTERNAL') || die(); /** * Privacy Subsystem for filter_glossary implementing null_provider. * * @copyright 2018 Andrew Nicols <andrew@nicols.co.uk> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class provider implements \core_privacy\local\metadata\null_provider { /** * Get the language string identifier with the component's language * file to explain why this plugin stores no data. * * @return string */ public static function get_reason() : string { return 'privacy:metadata'; } } yui/build/moodle-filter_glossary-autolinker/moodle-filter_glossary-autolinker-min.js 0000644 00000005624 15152701652 0025303 0 ustar 00 YUI.add("moodle-filter_glossary-autolinker",function(c,e){var t=function(){t.superclass.constructor.apply(this,arguments)};c.extend(t,c.Base,{overlay:null,alertpanels:{},initializer:function(){var i=this;require(["core/event"],function(o){c.delegate("click",function(e){e.preventDefault();var n,t=c.Node.create('<div id="glossaryfilteroverlayprogress"></div>'),e=new c.Overlay({headerContent:"",bodyContent:t});window.require(["core/templates"],function(e){e.renderPix("i/loading","core").then(function(e){t.append(e)})}),(i.overlay=e).render(c.one(document.body)),n=this.getAttribute("href").replace("showentry.php","showentry_ajax.php"),c.io(n,{method:"get",context:i,on:{success:function(e,t){this.display_callback(t.responseText,o)},failure:function(e,t){var o=t.statusText;M.cfg.developerdebug&&(t.statusText+=" ("+n+")"),new M.core.exception({message:o})}}})},c.one(document.body),"a.glossary.autolink.concept")})},display_callback:function(e,t){var o,n,i,r,a,l;try{if((o=c.JSON.parse(e)).success){for(n in this.overlay.hide(),o.entries)a=o.entries[n].definition+o.entries[n].attachments,i=new M.core.alert({title:o.entries[n].concept,draggable:!0,message:a,modal:!1,yesLabel:M.util.get_string("ok","moodle")}),t.notifyFilterContentUpdated(i.get("boundingBox").getDOMNode()),c.Node.one("#id_yuialertconfirm-"+i.get("COUNT")).focus(),r="#moodle-dialogue-"+i.get("COUNT"),i.on("complete",this._deletealertpanel,this,r),c.Object.isEmpty(this.alertpanels)||(l=this._getLatestWindowPosition(),c.Node.one(r).setXY([l[0]+10,l[1]+10])),this.alertpanels[r]=c.Node.one(r).getXY();return!0}o.error&&new M.core.ajaxException(o)}catch(s){new M.core.exception(s)}return!1},_getLatestWindowPosition:function(){var t=[0,0];return c.Object.each(this.alertpanels,function(e){e[0]>t[0]&&(t=e)}),t},_deletealertpanel:function(e,t){delete this.alertpanels[t]}},{NAME:"Glossary filter autolinker",ATTRS:{url:{validator:c.Lang.isString,value:M.cfg.wwwroot+"/mod/glossary/showentry.php"},name:{validator:c.Lang.isString,value:"glossaryconcept"},options:{getter:function(){return{width:this.get("width"),height:this.get("height"),menubar:this.get("menubar"),location:this.get("location"),scrollbars:this.get("scrollbars"),resizable:this.get("resizable"),toolbar:this.get("toolbar"),status:this.get("status"),directories:this.get("directories"),fullscreen:this.get("fullscreen"),dependent:this.get("dependent")}},readOnly:!0},width:{value:600},height:{value:450},menubar:{value:!1},location:{value:!1},scrollbars:{value:!0},resizable:{value:!0},toolbar:{value:!0},status:{value:!0},directories:{value:!1},fullscreen:{value:!1},dependent:{value:!0}}}),M.filter_glossary=M.filter_glossary||{},M.filter_glossary.init_filter_autolinking=function(e){return new t(e)}},"@VERSION@",{requires:["base","node","io-base","json-parse","event-delegate","overlay","moodle-core-event","moodle-core-notification-alert","moodle-core-notification-exception","moodle-core-notification-ajaxexception"]}); yui/build/moodle-filter_glossary-autolinker/moodle-filter_glossary-autolinker-debug.js 0000644 00000015172 15152701652 0025605 0 ustar 00 YUI.add('moodle-filter_glossary-autolinker', function (Y, NAME) { var AUTOLINKERNAME = 'Glossary filter autolinker', WIDTH = 'width', HEIGHT = 'height', MENUBAR = 'menubar', LOCATION = 'location', SCROLLBARS = 'scrollbars', RESIZEABLE = 'resizable', TOOLBAR = 'toolbar', STATUS = 'status', DIRECTORIES = 'directories', FULLSCREEN = 'fullscreen', DEPENDENT = 'dependent', AUTOLINKER; AUTOLINKER = function() { AUTOLINKER.superclass.constructor.apply(this, arguments); }; Y.extend(AUTOLINKER, Y.Base, { overlay: null, alertpanels: {}, initializer: function() { var self = this; require(['core/event'], function(event) { Y.delegate('click', function(e) { e.preventDefault(); // display a progress indicator var title = '', content = Y.Node.create('<div id="glossaryfilteroverlayprogress">' + '</div>'), o = new Y.Overlay({ headerContent: title, bodyContent: content }), fullurl, cfg; window.require(['core/templates'], function(Templates) { Templates.renderPix('i/loading', 'core').then(function(html) { content.append(html); }); }); self.overlay = o; o.render(Y.one(document.body)); // Switch over to the ajax url and fetch the glossary item fullurl = this.getAttribute('href').replace('showentry.php', 'showentry_ajax.php'); cfg = { method: 'get', context: self, on: { success: function(id, o) { this.display_callback(o.responseText, event); }, failure: function(id, o) { var debuginfo = o.statusText; if (M.cfg.developerdebug) { o.statusText += ' (' + fullurl + ')'; } new M.core.exception({message: debuginfo}); } } }; Y.io(fullurl, cfg); }, Y.one(document.body), 'a.glossary.autolink.concept'); }); }, /** * @method display_callback * @param {String} content - Content to display * @param {Object} event The amd event module used to fire events for jquery and yui. */ display_callback: function(content, event) { var data, key, alertpanel, alertpanelid, definition, position; try { data = Y.JSON.parse(content); if (data.success) { this.overlay.hide(); // hide progress indicator for (key in data.entries) { definition = data.entries[key].definition + data.entries[key].attachments; alertpanel = new M.core.alert({title: data.entries[key].concept, draggable: true, message: definition, modal: false, yesLabel: M.util.get_string('ok', 'moodle')}); // Notify the filters about the modified nodes. event.notifyFilterContentUpdated(alertpanel.get('boundingBox').getDOMNode()); Y.Node.one('#id_yuialertconfirm-' + alertpanel.get('COUNT')).focus(); // Register alertpanel for stacking. alertpanelid = '#moodle-dialogue-' + alertpanel.get('COUNT'); alertpanel.on('complete', this._deletealertpanel, this, alertpanelid); // We already have some windows opened, so set the right position... if (!Y.Object.isEmpty(this.alertpanels)) { position = this._getLatestWindowPosition(); Y.Node.one(alertpanelid).setXY([position[0] + 10, position[1] + 10]); } this.alertpanels[alertpanelid] = Y.Node.one(alertpanelid).getXY(); } return true; } else if (data.error) { new M.core.ajaxException(data); } } catch (e) { new M.core.exception(e); } return false; }, _getLatestWindowPosition: function() { var lastPosition = [0, 0]; Y.Object.each(this.alertpanels, function(position) { if (position[0] > lastPosition[0]) { lastPosition = position; } }); return lastPosition; }, _deletealertpanel: function(ev, alertpanelid) { delete this.alertpanels[alertpanelid]; } }, { NAME: AUTOLINKERNAME, ATTRS: { url: { validator: Y.Lang.isString, value: M.cfg.wwwroot + '/mod/glossary/showentry.php' }, name: { validator: Y.Lang.isString, value: 'glossaryconcept' }, options: { getter: function() { return { width: this.get(WIDTH), height: this.get(HEIGHT), menubar: this.get(MENUBAR), location: this.get(LOCATION), scrollbars: this.get(SCROLLBARS), resizable: this.get(RESIZEABLE), toolbar: this.get(TOOLBAR), status: this.get(STATUS), directories: this.get(DIRECTORIES), fullscreen: this.get(FULLSCREEN), dependent: this.get(DEPENDENT) }; }, readOnly: true }, width: {value: 600}, height: {value: 450}, menubar: {value: false}, location: {value: false}, scrollbars: {value: true}, resizable: {value: true}, toolbar: {value: true}, status: {value: true}, directories: {value: false}, fullscreen: {value: false}, dependent: {value: true} } }); M.filter_glossary = M.filter_glossary || {}; M.filter_glossary.init_filter_autolinking = function(config) { return new AUTOLINKER(config); }; }, '@VERSION@', { "requires": [ "base", "node", "io-base", "json-parse", "event-delegate", "overlay", "moodle-core-event", "moodle-core-notification-alert", "moodle-core-notification-exception", "moodle-core-notification-ajaxexception" ] }); yui/build/moodle-filter_glossary-autolinker/moodle-filter_glossary-autolinker.js 0000644 00000015172 15152701652 0024521 0 ustar 00 YUI.add('moodle-filter_glossary-autolinker', function (Y, NAME) { var AUTOLINKERNAME = 'Glossary filter autolinker', WIDTH = 'width', HEIGHT = 'height', MENUBAR = 'menubar', LOCATION = 'location', SCROLLBARS = 'scrollbars', RESIZEABLE = 'resizable', TOOLBAR = 'toolbar', STATUS = 'status', DIRECTORIES = 'directories', FULLSCREEN = 'fullscreen', DEPENDENT = 'dependent', AUTOLINKER; AUTOLINKER = function() { AUTOLINKER.superclass.constructor.apply(this, arguments); }; Y.extend(AUTOLINKER, Y.Base, { overlay: null, alertpanels: {}, initializer: function() { var self = this; require(['core/event'], function(event) { Y.delegate('click', function(e) { e.preventDefault(); // display a progress indicator var title = '', content = Y.Node.create('<div id="glossaryfilteroverlayprogress">' + '</div>'), o = new Y.Overlay({ headerContent: title, bodyContent: content }), fullurl, cfg; window.require(['core/templates'], function(Templates) { Templates.renderPix('i/loading', 'core').then(function(html) { content.append(html); }); }); self.overlay = o; o.render(Y.one(document.body)); // Switch over to the ajax url and fetch the glossary item fullurl = this.getAttribute('href').replace('showentry.php', 'showentry_ajax.php'); cfg = { method: 'get', context: self, on: { success: function(id, o) { this.display_callback(o.responseText, event); }, failure: function(id, o) { var debuginfo = o.statusText; if (M.cfg.developerdebug) { o.statusText += ' (' + fullurl + ')'; } new M.core.exception({message: debuginfo}); } } }; Y.io(fullurl, cfg); }, Y.one(document.body), 'a.glossary.autolink.concept'); }); }, /** * @method display_callback * @param {String} content - Content to display * @param {Object} event The amd event module used to fire events for jquery and yui. */ display_callback: function(content, event) { var data, key, alertpanel, alertpanelid, definition, position; try { data = Y.JSON.parse(content); if (data.success) { this.overlay.hide(); // hide progress indicator for (key in data.entries) { definition = data.entries[key].definition + data.entries[key].attachments; alertpanel = new M.core.alert({title: data.entries[key].concept, draggable: true, message: definition, modal: false, yesLabel: M.util.get_string('ok', 'moodle')}); // Notify the filters about the modified nodes. event.notifyFilterContentUpdated(alertpanel.get('boundingBox').getDOMNode()); Y.Node.one('#id_yuialertconfirm-' + alertpanel.get('COUNT')).focus(); // Register alertpanel for stacking. alertpanelid = '#moodle-dialogue-' + alertpanel.get('COUNT'); alertpanel.on('complete', this._deletealertpanel, this, alertpanelid); // We already have some windows opened, so set the right position... if (!Y.Object.isEmpty(this.alertpanels)) { position = this._getLatestWindowPosition(); Y.Node.one(alertpanelid).setXY([position[0] + 10, position[1] + 10]); } this.alertpanels[alertpanelid] = Y.Node.one(alertpanelid).getXY(); } return true; } else if (data.error) { new M.core.ajaxException(data); } } catch (e) { new M.core.exception(e); } return false; }, _getLatestWindowPosition: function() { var lastPosition = [0, 0]; Y.Object.each(this.alertpanels, function(position) { if (position[0] > lastPosition[0]) { lastPosition = position; } }); return lastPosition; }, _deletealertpanel: function(ev, alertpanelid) { delete this.alertpanels[alertpanelid]; } }, { NAME: AUTOLINKERNAME, ATTRS: { url: { validator: Y.Lang.isString, value: M.cfg.wwwroot + '/mod/glossary/showentry.php' }, name: { validator: Y.Lang.isString, value: 'glossaryconcept' }, options: { getter: function() { return { width: this.get(WIDTH), height: this.get(HEIGHT), menubar: this.get(MENUBAR), location: this.get(LOCATION), scrollbars: this.get(SCROLLBARS), resizable: this.get(RESIZEABLE), toolbar: this.get(TOOLBAR), status: this.get(STATUS), directories: this.get(DIRECTORIES), fullscreen: this.get(FULLSCREEN), dependent: this.get(DEPENDENT) }; }, readOnly: true }, width: {value: 600}, height: {value: 450}, menubar: {value: false}, location: {value: false}, scrollbars: {value: true}, resizable: {value: true}, toolbar: {value: true}, status: {value: true}, directories: {value: false}, fullscreen: {value: false}, dependent: {value: true} } }); M.filter_glossary = M.filter_glossary || {}; M.filter_glossary.init_filter_autolinking = function(config) { return new AUTOLINKER(config); }; }, '@VERSION@', { "requires": [ "base", "node", "io-base", "json-parse", "event-delegate", "overlay", "moodle-core-event", "moodle-core-notification-alert", "moodle-core-notification-exception", "moodle-core-notification-ajaxexception" ] }); yui/src/autolinker/meta/autolinker.json 0000644 00000000545 15152701652 0014324 0 ustar 00 { "moodle-filter_glossary-autolinker": { "requires": [ "base", "node", "io-base", "json-parse", "event-delegate", "overlay", "moodle-core-event", "moodle-core-notification-alert", "moodle-core-notification-exception", "moodle-core-notification-ajaxexception" ] } } yui/src/autolinker/build.json 0000644 00000000251 15152701652 0012312 0 ustar 00 { "name": "moodle-filter_glossary-autolinker", "builds": { "moodle-filter_glossary-autolinker": { "jsfiles": [ "autolinker.js" ] } } } yui/src/autolinker/js/autolinker.js 0000644 00000014353 15152701652 0013457 0 ustar 00 var AUTOLINKERNAME = 'Glossary filter autolinker', WIDTH = 'width', HEIGHT = 'height', MENUBAR = 'menubar', LOCATION = 'location', SCROLLBARS = 'scrollbars', RESIZEABLE = 'resizable', TOOLBAR = 'toolbar', STATUS = 'status', DIRECTORIES = 'directories', FULLSCREEN = 'fullscreen', DEPENDENT = 'dependent', AUTOLINKER; AUTOLINKER = function() { AUTOLINKER.superclass.constructor.apply(this, arguments); }; Y.extend(AUTOLINKER, Y.Base, { overlay: null, alertpanels: {}, initializer: function() { var self = this; require(['core/event'], function(event) { Y.delegate('click', function(e) { e.preventDefault(); // display a progress indicator var title = '', content = Y.Node.create('<div id="glossaryfilteroverlayprogress">' + '</div>'), o = new Y.Overlay({ headerContent: title, bodyContent: content }), fullurl, cfg; window.require(['core/templates'], function(Templates) { Templates.renderPix('i/loading', 'core').then(function(html) { content.append(html); }); }); self.overlay = o; o.render(Y.one(document.body)); // Switch over to the ajax url and fetch the glossary item fullurl = this.getAttribute('href').replace('showentry.php', 'showentry_ajax.php'); cfg = { method: 'get', context: self, on: { success: function(id, o) { this.display_callback(o.responseText, event); }, failure: function(id, o) { var debuginfo = o.statusText; if (M.cfg.developerdebug) { o.statusText += ' (' + fullurl + ')'; } new M.core.exception({message: debuginfo}); } } }; Y.io(fullurl, cfg); }, Y.one(document.body), 'a.glossary.autolink.concept'); }); }, /** * @method display_callback * @param {String} content - Content to display * @param {Object} event The amd event module used to fire events for jquery and yui. */ display_callback: function(content, event) { var data, key, alertpanel, alertpanelid, definition, position; try { data = Y.JSON.parse(content); if (data.success) { this.overlay.hide(); // hide progress indicator for (key in data.entries) { definition = data.entries[key].definition + data.entries[key].attachments; alertpanel = new M.core.alert({title: data.entries[key].concept, draggable: true, message: definition, modal: false, yesLabel: M.util.get_string('ok', 'moodle')}); // Notify the filters about the modified nodes. event.notifyFilterContentUpdated(alertpanel.get('boundingBox').getDOMNode()); Y.Node.one('#id_yuialertconfirm-' + alertpanel.get('COUNT')).focus(); // Register alertpanel for stacking. alertpanelid = '#moodle-dialogue-' + alertpanel.get('COUNT'); alertpanel.on('complete', this._deletealertpanel, this, alertpanelid); // We already have some windows opened, so set the right position... if (!Y.Object.isEmpty(this.alertpanels)) { position = this._getLatestWindowPosition(); Y.Node.one(alertpanelid).setXY([position[0] + 10, position[1] + 10]); } this.alertpanels[alertpanelid] = Y.Node.one(alertpanelid).getXY(); } return true; } else if (data.error) { new M.core.ajaxException(data); } } catch (e) { new M.core.exception(e); } return false; }, _getLatestWindowPosition: function() { var lastPosition = [0, 0]; Y.Object.each(this.alertpanels, function(position) { if (position[0] > lastPosition[0]) { lastPosition = position; } }); return lastPosition; }, _deletealertpanel: function(ev, alertpanelid) { delete this.alertpanels[alertpanelid]; } }, { NAME: AUTOLINKERNAME, ATTRS: { url: { validator: Y.Lang.isString, value: M.cfg.wwwroot + '/mod/glossary/showentry.php' }, name: { validator: Y.Lang.isString, value: 'glossaryconcept' }, options: { getter: function() { return { width: this.get(WIDTH), height: this.get(HEIGHT), menubar: this.get(MENUBAR), location: this.get(LOCATION), scrollbars: this.get(SCROLLBARS), resizable: this.get(RESIZEABLE), toolbar: this.get(TOOLBAR), status: this.get(STATUS), directories: this.get(DIRECTORIES), fullscreen: this.get(FULLSCREEN), dependent: this.get(DEPENDENT) }; }, readOnly: true }, width: {value: 600}, height: {value: 450}, menubar: {value: false}, location: {value: false}, scrollbars: {value: true}, resizable: {value: true}, toolbar: {value: true}, status: {value: true}, directories: {value: false}, fullscreen: {value: false}, dependent: {value: true} } }); M.filter_glossary = M.filter_glossary || {}; M.filter_glossary.init_filter_autolinking = function(config) { return new AUTOLINKER(config); }; lang/en/filter_glossary.php 0000644 00000002344 15152701652 0012017 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Strings for filter_glossary * * @package filter * @subpackage glossary * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $string['glossarycategory'] = '{$a->glossary}: Category {$a->category}'; $string['glossaryconcept'] = '{$a->glossary}: {$a->concept}'; $string['filtername'] = 'Glossary auto-linking'; $string['privacy:metadata'] = 'The Glossary auto-linking plugin does not store any personal data.';
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | ���֧ߧ֧�ѧ�ڧ� ����ѧߧڧ��: 0 |
proxy
|
phpinfo
|
���ѧ����ۧܧ�