mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
MDL-51075 filter_glossary: Fix popup position when no popups
Thanks to Andrew Nicols for cleaning my eyes.
This commit is contained in:
parent
9d5d9c64ff
commit
d1fba0f4f5
@ -75,7 +75,6 @@ Y.extend(AUTOLINKER, Y.Base, {
|
||||
alertpanelid,
|
||||
definition,
|
||||
position;
|
||||
var self = this;
|
||||
try {
|
||||
data = Y.JSON.parse(content);
|
||||
if (data.success){
|
||||
@ -91,7 +90,7 @@ Y.extend(AUTOLINKER, Y.Base, {
|
||||
|
||||
// Register alertpanel for stacking.
|
||||
alertpanelid = '#moodle-dialogue-' + alertpanel.get('COUNT');
|
||||
alertpanel.on('complete', this._deletealertpanel(self.alertpanels, alertpanelid));
|
||||
alertpanel.on('complete', this._deletealertpanel, this, alertpanelid);
|
||||
|
||||
// We already have some windows opened, so set the right position...
|
||||
if (!Y.Object.isEmpty(this.alertpanels)){
|
||||
@ -120,8 +119,8 @@ Y.extend(AUTOLINKER, Y.Base, {
|
||||
});
|
||||
return lastPosition;
|
||||
},
|
||||
_deletealertpanel : function(alertpanels, alertpanelid) {
|
||||
delete alertpanels[alertpanelid];
|
||||
_deletealertpanel : function(ev, alertpanelid) {
|
||||
delete this.alertpanels[alertpanelid];
|
||||
}
|
||||
}, {
|
||||
NAME : AUTOLINKERNAME,
|
||||
|
@ -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,alertpanels:{},initializer:function(){var t=this;require(["core/event"],function(n){e.delegate("click",function(r){r.preventDefault();var i="",s=e.Node.create('<div id="glossaryfilteroverlayprogress"><img src="'+M.cfg.loadingicon+'" class="spinner" />'+"</div>"),o=new e.Overlay({headerContent:i,bodyContent:s}),u,a;t.overlay=o,o.render(e.one(document.body)),u=this.getAttribute("href").replace("showentry.php","showentry_ajax.php"),a={method:"get",context:t,on:{success:function(e,t){this.display_callback(t.responseText,n)},failure:function(e,t){var n=t.statusText;M.cfg.developerdebug&&(t.statusText+=" ("+u+")"),new M.core.exception({message:n})}}},e.io(u,a)},e.one(document.body),"a.glossary.autolink.concept")})},display_callback:function(t,n){var r,i,s,o,u,a,f=this;try{r=e.JSON.parse(t);if(r.success){this.overlay.hide();for(i in r.entries)u=r.entries[i].definition+r.entries[i].attachments,s=new M.core.alert({title:r.entries[i].concept,draggable:!0,message:u,modal:!1,yesLabel:M.util.get_string("ok","moodle")}),n.notifyFilterContentUpdated(s.get("boundingBox").getDOMNode()),e.Node.one("#id_yuialertconfirm-"+s.get("COUNT")).focus(),o="#moodle-dialogue-"+s.get("COUNT"),s.on("complete",this._deletealertpanel(f.alertpanels,o)),e.Object.isEmpty(this.alertpanels)||(a=this._getLatestWindowPosition(),e.Node.one(o).setXY([a[0]+10,a[1]+10])),this.alertpanels[o]=e.Node.one(o).getXY();return!0}r.error&&new M.core.ajaxException(r)}catch(l){new M.core.exception(l)}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"]});
|
||||
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;require(["core/event"],function(n){e.delegate("click",function(r){r.preventDefault();var i="",s=e.Node.create('<div id="glossaryfilteroverlayprogress"><img src="'+M.cfg.loadingicon+'" class="spinner" />'+"</div>"),o=new e.Overlay({headerContent:i,bodyContent:s}),u,a;t.overlay=o,o.render(e.one(document.body)),u=this.getAttribute("href").replace("showentry.php","showentry_ajax.php"),a={method:"get",context:t,on:{success:function(e,t){this.display_callback(t.responseText,n)},failure:function(e,t){var n=t.statusText;M.cfg.developerdebug&&(t.statusText+=" ("+u+")"),new M.core.exception({message:n})}}},e.io(u,a)},e.one(document.body),"a.glossary.autolink.concept")})},display_callback:function(t,n){var r,i,s,o,u,a;try{r=e.JSON.parse(t);if(r.success){this.overlay.hide();for(i in r.entries)u=r.entries[i].definition+r.entries[i].attachments,s=new M.core.alert({title:r.entries[i].concept,draggable:!0,message:u,modal:!1,yesLabel:M.util.get_string("ok","moodle")}),n.notifyFilterContentUpdated(s.get("boundingBox").getDOMNode()),e.Node.one("#id_yuialertconfirm-"+s.get("COUNT")).focus(),o="#moodle-dialogue-"+s.get("COUNT"),s.on("complete",this._deletealertpanel,this,o),e.Object.isEmpty(this.alertpanels)||(a=this._getLatestWindowPosition(),e.Node.one(o).setXY([a[0]+10,a[1]+10])),this.alertpanels[o]=e.Node.one(o).getXY();return!0}r.error&&new M.core.ajaxException(r)}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 this.alertpanels[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"]});
|
||||
|
@ -75,7 +75,6 @@ Y.extend(AUTOLINKER, Y.Base, {
|
||||
alertpanelid,
|
||||
definition,
|
||||
position;
|
||||
var self = this;
|
||||
try {
|
||||
data = Y.JSON.parse(content);
|
||||
if (data.success){
|
||||
@ -91,7 +90,7 @@ Y.extend(AUTOLINKER, Y.Base, {
|
||||
|
||||
// Register alertpanel for stacking.
|
||||
alertpanelid = '#moodle-dialogue-' + alertpanel.get('COUNT');
|
||||
alertpanel.on('complete', this._deletealertpanel(self.alertpanels, alertpanelid));
|
||||
alertpanel.on('complete', this._deletealertpanel, this, alertpanelid);
|
||||
|
||||
// We already have some windows opened, so set the right position...
|
||||
if (!Y.Object.isEmpty(this.alertpanels)){
|
||||
@ -120,8 +119,8 @@ Y.extend(AUTOLINKER, Y.Base, {
|
||||
});
|
||||
return lastPosition;
|
||||
},
|
||||
_deletealertpanel : function(alertpanels, alertpanelid) {
|
||||
delete alertpanels[alertpanelid];
|
||||
_deletealertpanel : function(ev, alertpanelid) {
|
||||
delete this.alertpanels[alertpanelid];
|
||||
}
|
||||
}, {
|
||||
NAME : AUTOLINKERNAME,
|
||||
|
@ -73,7 +73,6 @@ Y.extend(AUTOLINKER, Y.Base, {
|
||||
alertpanelid,
|
||||
definition,
|
||||
position;
|
||||
var self = this;
|
||||
try {
|
||||
data = Y.JSON.parse(content);
|
||||
if (data.success){
|
||||
@ -89,7 +88,7 @@ Y.extend(AUTOLINKER, Y.Base, {
|
||||
|
||||
// Register alertpanel for stacking.
|
||||
alertpanelid = '#moodle-dialogue-' + alertpanel.get('COUNT');
|
||||
alertpanel.on('complete', this._deletealertpanel(self.alertpanels, alertpanelid));
|
||||
alertpanel.on('complete', this._deletealertpanel, this, alertpanelid);
|
||||
|
||||
// We already have some windows opened, so set the right position...
|
||||
if (!Y.Object.isEmpty(this.alertpanels)){
|
||||
@ -118,8 +117,8 @@ Y.extend(AUTOLINKER, Y.Base, {
|
||||
});
|
||||
return lastPosition;
|
||||
},
|
||||
_deletealertpanel : function(alertpanels, alertpanelid) {
|
||||
delete alertpanels[alertpanelid];
|
||||
_deletealertpanel : function(ev, alertpanelid) {
|
||||
delete this.alertpanels[alertpanelid];
|
||||
}
|
||||
}, {
|
||||
NAME : AUTOLINKERNAME,
|
||||
|
Loading…
x
Reference in New Issue
Block a user