diff --git a/mod/glossary/showentry.php b/mod/glossary/showentry.php index 9045c2115d6..f6e0b27b5fd 100644 --- a/mod/glossary/showentry.php +++ b/mod/glossary/showentry.php @@ -8,6 +8,11 @@ $courseid = optional_param('courseid', 0, PARAM_INT); $eid = optional_param('eid', 0, PARAM_INT); // glossary entry id $displayformat = optional_param('displayformat',-1, PARAM_SAFEDIR); $popup = optional_param('popup',0, PARAM_INT); +$ajax = optional_param('ajax',0, PARAM_INT); + +if ($ajax && !defined('AJAX_SCRIPT')) { + define('AJAX_SCRIPT', true); +} $url = new moodle_url('/mod/glossary/showentry.php'); $url->param('concept', $concept); @@ -42,6 +47,8 @@ if ($eid) { if ($popup) { $PAGE->set_pagelayout('popup'); +} else if (!$ajax) { + $PAGE->set_pagelayout('course'); } if ($entries) { @@ -70,6 +77,14 @@ if ($entries) { } } +if ($ajax) { + $result = new stdClass; + $result->success = true; + $result->entries = $entries; + echo json_encode($result); + die(); +} + if (!empty($courseid)) { $strglossaries = get_string('modulenameplural', 'glossary'); $strsearch = get_string('search'); diff --git a/mod/glossary/styles.css b/mod/glossary/styles.css index 0ac192f2511..d7c005bcff1 100644 --- a/mod/glossary/styles.css +++ b/mod/glossary/styles.css @@ -26,4 +26,6 @@ #page-mod-glossary-view table.glossarycategoryheader {margin-bottom:0em;} #page-mod-glossary-view table.glossarycategoryheader th {padding:0px;} -#page-mod-glossary-showentry #page-content {min-width:600px;} \ No newline at end of file +#page-mod-glossary-showentry #page-content {min-width:600px;} + +#glossaryoverlayprogress {position:fixed;top:50%;width:100%;text-align:center;} \ No newline at end of file diff --git a/mod/glossary/yui/autolinker/autolinker.js b/mod/glossary/yui/autolinker/autolinker.js index 56e014d26fc..dcd5915da1c 100644 --- a/mod/glossary/yui/autolinker/autolinker.js +++ b/mod/glossary/yui/autolinker/autolinker.js @@ -22,16 +22,65 @@ YUI.add('moodle-mod_glossary-autolinker', function(Y) { AUTOLINKER.superclass.constructor.apply(this, arguments); } Y.extend(AUTOLINKER, Y.Base, { + overlay : null, initializer : function(config) { var popupname = this.get(POPUPNAME), - popupoptions = this.get(POPUPOPTIONS); + popupoptions = this.get(POPUPOPTIONS), + self = this; Y.delegate('click', function(e){ - openpopup(e, { - url : this.getAttribute('href')+'&popup=1', - name : popupname, - options : build_windowoptionsstring(popupoptions) - }) + + e.preventDefault(); + + //display a progress indicator + var title = ''; + var content = Y.Node.create('