Skip to content

Commit

Permalink
Merge branch 'MDL-33765_m29_offset' of git://github.com/markn86/moodl…
Browse files Browse the repository at this point in the history
…e into MOODLE_29_STABLE
  • Loading branch information
danpoltawski committed Jun 30, 2015
2 parents e228ce6 + f521c1e commit 30e59bb
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 4 deletions.
Expand Up @@ -19,6 +19,7 @@ AUTOLINKER = function() {
};
Y.extend(AUTOLINKER, Y.Base, {
overlay : null,
alertpanels: {},
initializer : function() {
var self = this;
Y.delegate('click', function(e){
Expand Down Expand Up @@ -64,7 +65,10 @@ Y.extend(AUTOLINKER, Y.Base, {
var data,
key,
alertpanel,
definition;
alertpanelid,
definition,
position;
var self = this;
try {
data = Y.JSON.parse(content);
if (data.success){
Expand All @@ -76,6 +80,18 @@ Y.extend(AUTOLINKER, Y.Base, {
message:definition, modal:false, yesLabel: M.util.get_string('ok', 'moodle')});
Y.fire(M.core.event.FILTER_CONTENT_UPDATED, {nodes: (new Y.NodeList(alertpanel.get('boundingBox')))});
Y.Node.one('#id_yuialertconfirm-' + alertpanel.get('COUNT')).focus();

// Register alertpanel for stacking.
alertpanelid = '#moodle-dialogue-' + alertpanel.get('COUNT');
alertpanel.on('complete', this._deletealertpanel(self.alertpanels, 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;
Expand All @@ -86,6 +102,18 @@ Y.extend(AUTOLINKER, Y.Base, {
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(alertpanels, alertpanelid) {
delete alertpanels[alertpanelid];
}
}, {
NAME : AUTOLINKERNAME,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -19,6 +19,7 @@ AUTOLINKER = function() {
};
Y.extend(AUTOLINKER, Y.Base, {
overlay : null,
alertpanels: {},
initializer : function() {
var self = this;
Y.delegate('click', function(e){
Expand Down Expand Up @@ -64,7 +65,10 @@ Y.extend(AUTOLINKER, Y.Base, {
var data,
key,
alertpanel,
definition;
alertpanelid,
definition,
position;
var self = this;
try {
data = Y.JSON.parse(content);
if (data.success){
Expand All @@ -76,6 +80,18 @@ Y.extend(AUTOLINKER, Y.Base, {
message:definition, modal:false, yesLabel: M.util.get_string('ok', 'moodle')});
Y.fire(M.core.event.FILTER_CONTENT_UPDATED, {nodes: (new Y.NodeList(alertpanel.get('boundingBox')))});
Y.Node.one('#id_yuialertconfirm-' + alertpanel.get('COUNT')).focus();

// Register alertpanel for stacking.
alertpanelid = '#moodle-dialogue-' + alertpanel.get('COUNT');
alertpanel.on('complete', this._deletealertpanel(self.alertpanels, 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;
Expand All @@ -86,6 +102,18 @@ Y.extend(AUTOLINKER, Y.Base, {
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(alertpanels, alertpanelid) {
delete alertpanels[alertpanelid];
}
}, {
NAME : AUTOLINKERNAME,
Expand Down
30 changes: 29 additions & 1 deletion filter/glossary/yui/src/autolinker/js/autolinker.js
Expand Up @@ -17,6 +17,7 @@ AUTOLINKER = function() {
};
Y.extend(AUTOLINKER, Y.Base, {
overlay : null,
alertpanels: {},
initializer : function() {
var self = this;
Y.delegate('click', function(e){
Expand Down Expand Up @@ -62,7 +63,10 @@ Y.extend(AUTOLINKER, Y.Base, {
var data,
key,
alertpanel,
definition;
alertpanelid,
definition,
position;
var self = this;
try {
data = Y.JSON.parse(content);
if (data.success){
Expand All @@ -74,6 +78,18 @@ Y.extend(AUTOLINKER, Y.Base, {
message:definition, modal:false, yesLabel: M.util.get_string('ok', 'moodle')});
Y.fire(M.core.event.FILTER_CONTENT_UPDATED, {nodes: (new Y.NodeList(alertpanel.get('boundingBox')))});
Y.Node.one('#id_yuialertconfirm-' + alertpanel.get('COUNT')).focus();

// Register alertpanel for stacking.
alertpanelid = '#moodle-dialogue-' + alertpanel.get('COUNT');
alertpanel.on('complete', this._deletealertpanel(self.alertpanels, 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;
Expand All @@ -84,6 +100,18 @@ Y.extend(AUTOLINKER, Y.Base, {
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(alertpanels, alertpanelid) {
delete alertpanels[alertpanelid];
}
}, {
NAME : AUTOLINKERNAME,
Expand Down
3 changes: 3 additions & 0 deletions mod/glossary/showentry_ajax.php
Expand Up @@ -61,6 +61,9 @@
}
}

// Make sure entry is not autolinking itself.
$GLOSSARY_EXCLUDEENTRY = $entry->id;

$context = context_module::instance($entry->cmid);
$definition = file_rewrite_pluginfile_urls($entry->definition, 'pluginfile.php', $context->id, 'mod_glossary', 'entry', $entry->id);

Expand Down

0 comments on commit 30e59bb

Please sign in to comment.