Merge branch 'MDL-33765_m29_offset' of git://github.com/markn86/moodle into MOODLE_29_STABLE
This commit is contained in:
+29
-1
@@ -19,6 +19,7 @@ AUTOLINKER = function() {
|
||||
};
|
||||
Y.extend(AUTOLINKER, Y.Base, {
|
||||
overlay : null,
|
||||
alertpanels: {},
|
||||
initializer : function() {
|
||||
var self = this;
|
||||
Y.delegate('click', function(e){
|
||||
@@ -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){
|
||||
@@ -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;
|
||||
@@ -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,
|
||||
|
||||
filter/glossary/yui/build/moodle-filter_glossary-autolinker/moodle-filter_glossary-autolinker-min.js
Vendored
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-filter_glossary-autolinker",function(e,t){var n="Glossary filter autolinker",r="width",i="height",s="menubar",o="location",u="scrollbars",a="resizable",f="toolbar",l="status",c="directories",h="fullscreen",p="dependent",d;d=function(){d.superclass.constructor.apply(this,arguments)},e.extend(d,e.Base,{overlay:null,initializer:function(){var t=this;e.delegate("click",function(n){n.preventDefault();var r="",i=e.Node.create('<div id="glossaryfilteroverlayprogress"><img src="'+M.cfg.loadingicon+'" class="spinner" />'+"</div>"),s=new e.Overlay({headerContent:r,bodyContent:i}),o,u;t.overlay=s,s.render(e.one(document.body)),o=this.getAttribute("href").replace("showentry.php","showentry_ajax.php"),u={method:"get",context:t,on:{success:function(e,t){this.display_callback(t.responseText)},failure:function(e,t){var n=t.statusText;M.cfg.developerdebug&&(t.statusText+=" ("+o+")"),this.display_callback("bodyContent",n)}}},e.io(o,u)},e.one(document.body),"a.glossary.autolink.concept")},display_callback:function(t){var n,r,i,s;try{n=e.JSON.parse(t);if(n.success){this.overlay.hide();for(r in n.entries)s=n.entries[r].definition+n.entries[r].attachments,i=new M.core.alert({title:n.entries[r].concept,draggable:!0,message:s,modal:!1,yesLabel:M.util.get_string("ok","moodle")}),e.fire(M.core.event.FILTER_CONTENT_UPDATED,{nodes:new e.NodeList(i.get("boundingBox"))}),e.Node.one("#id_yuialertconfirm-"+i.get("COUNT")).focus();return!0}n.error&&new M.core.ajaxException(n)}catch(o){new M.core.exception(o)}return!1}},{NAME:n,ATTRS:{url:{validator:e.Lang.isString,value:M.cfg.wwwroot+"/mod/glossary/showentry.php"},name:{validator:e.Lang.isString,value:"glossaryconcept"},options:{getter:function(){return{width:this.get(r),height:this.get(i),menubar:this.get(s),location:this.get(o),scrollbars:this.get(u),resizable:this.get(a),toolbar:this.get(f),status:this.get(l),directories:this.get(c),fullscreen:this.get(h),dependent:this.get(p)}},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 d(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.add("moodle-filter_glossary-autolinker",function(e,t){var n="Glossary filter autolinker",r="width",i="height",s="menubar",o="location",u="scrollbars",a="resizable",f="toolbar",l="status",c="directories",h="fullscreen",p="dependent",d;d=function(){d.superclass.constructor.apply(this,arguments)},e.extend(d,e.Base,{overlay:null,alertpanels:{},initializer:function(){var t=this;e.delegate("click",function(n){n.preventDefault();var r="",i=e.Node.create('<div id="glossaryfilteroverlayprogress"><img src="'+M.cfg.loadingicon+'" class="spinner" />'+"</div>"),s=new e.Overlay({headerContent:r,bodyContent:i}),o,u;t.overlay=s,s.render(e.one(document.body)),o=this.getAttribute("href").replace("showentry.php","showentry_ajax.php"),u={method:"get",context:t,on:{success:function(e,t){this.display_callback(t.responseText)},failure:function(e,t){var n=t.statusText;M.cfg.developerdebug&&(t.statusText+=" ("+o+")"),this.display_callback("bodyContent",n)}}},e.io(o,u)},e.one(document.body),"a.glossary.autolink.concept")},display_callback:function(t){var n,r,i,s,o,u,a=this;try{n=e.JSON.parse(t);if(n.success){this.overlay.hide();for(r in n.entries)o=n.entries[r].definition+n.entries[r].attachments,i=new M.core.alert({title:n.entries[r].concept,draggable:!0,message:o,modal:!1,yesLabel:M.util.get_string("ok","moodle")}),e.fire(M.core.event.FILTER_CONTENT_UPDATED,{nodes:new e.NodeList(i.get("boundingBox"))}),e.Node.one("#id_yuialertconfirm-"+i.get("COUNT")).focus(),s="#moodle-dialogue-"+i.get("COUNT"),i.on("complete",this._deletealertpanel(a.alertpanels,s)),e.Object.isEmpty(this.alertpanels)||(u=this._getLatestWindowPosition(),e.Node.one(s).setXY([u[0]+10,u[1]+10])),this.alertpanels[s]=e.Node.one(s).getXY();return!0}n.error&&new M.core.ajaxException(n)}catch(f){new M.core.exception(f)}return!1},_getLatestWindowPosition:function(){var t=[0,0];return e.Object.each(this.alertpanels,function(e){e[0]>t[0]&&(t=e)}),t},_deletealertpanel:function(e,t){delete e[t]}},{NAME:n,ATTRS:{url:{validator:e.Lang.isString,value:M.cfg.wwwroot+"/mod/glossary/showentry.php"},name:{validator:e.Lang.isString,value:"glossaryconcept"},options:{getter:function(){return{width:this.get(r),height:this.get(i),menubar:this.get(s),location:this.get(o),scrollbars:this.get(u),resizable:this.get(a),toolbar:this.get(f),status:this.get(l),directories:this.get(c),fullscreen:this.get(h),dependent:this.get(p)}},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 d(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"]});
|
||||
|
||||
Vendored
+29
-1
@@ -19,6 +19,7 @@ AUTOLINKER = function() {
|
||||
};
|
||||
Y.extend(AUTOLINKER, Y.Base, {
|
||||
overlay : null,
|
||||
alertpanels: {},
|
||||
initializer : function() {
|
||||
var self = this;
|
||||
Y.delegate('click', function(e){
|
||||
@@ -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){
|
||||
@@ -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;
|
||||
@@ -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,
|
||||
|
||||
+29
-1
@@ -17,6 +17,7 @@ AUTOLINKER = function() {
|
||||
};
|
||||
Y.extend(AUTOLINKER, Y.Base, {
|
||||
overlay : null,
|
||||
alertpanels: {},
|
||||
initializer : function() {
|
||||
var self = this;
|
||||
Y.delegate('click', function(e){
|
||||
@@ -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){
|
||||
@@ -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;
|
||||
@@ -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,
|
||||
|
||||
@@ -61,6 +61,9 @@ if ($entries) {
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user