Merge branch 'MDL-52365_new' of git://github.com/mkassaei/moodle

This commit is contained in:
Dan Poltawski 2015-12-22 13:15:02 +00:00
commit 29747350b1
8 changed files with 76 additions and 19 deletions

View File

@ -260,7 +260,13 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
false, 10, this.create_all_drag_and_drops);
this.doc.drag_item_homes().after('load', this.poll_for_image_load, this,
false, 10, this.create_all_drag_and_drops);
Y.later(500, this, this.reposition_drags_for_question, [this.pendingid], true);
if (!this.get('readonly')) {
Y.later(500, this, this.reposition_drags_for_question, true);
} else {
Y.one('window').on('resize', function() {
this.reposition_drags_for_question();
}, this);
}
},
/**
@ -402,7 +408,7 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
inputnode.set('value', '');
}
},
reposition_drags_for_question : function() {
reposition_drags_for_question : function(dotimeout) {
this.doc.drag_items().removeClass('placed');
this.doc.drag_items().each (function (dragitem) {
if (dragitem.dd !== undefined) {
@ -435,6 +441,9 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
dragitem.setXY(dragitemhome.getXY());
}
}, this);
if (dotimeout) {
Y.later(500, this, this.reposition_drags_for_question, true);
}
},
get_choices_for_drop : function(choice, drop) {
var group = drop.getData('group');
@ -445,7 +454,7 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
var dragitems = this.get_choices_for_drop(choice, drop);
var dragitem = null;
dragitems.some(function (d) {
if (!d.hasClass('placed') && !d.hasClass('yui3-dd-dragging')) {
if (this.get('readonly') || (!d.hasClass('placed') && !d.hasClass('yui3-dd-dragging'))) {
dragitem = d;
return true;
} else {

View File

@ -260,7 +260,13 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
false, 10, this.create_all_drag_and_drops);
this.doc.drag_item_homes().after('load', this.poll_for_image_load, this,
false, 10, this.create_all_drag_and_drops);
Y.later(500, this, this.reposition_drags_for_question, [this.pendingid], true);
if (!this.get('readonly')) {
Y.later(500, this, this.reposition_drags_for_question, true);
} else {
Y.one('window').on('resize', function() {
this.reposition_drags_for_question();
}, this);
}
},
/**
@ -402,7 +408,7 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
inputnode.set('value', '');
}
},
reposition_drags_for_question : function() {
reposition_drags_for_question : function(dotimeout) {
this.doc.drag_items().removeClass('placed');
this.doc.drag_items().each (function (dragitem) {
if (dragitem.dd !== undefined) {
@ -435,6 +441,9 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
dragitem.setXY(dragitemhome.getXY());
}
}, this);
if (dotimeout) {
Y.later(500, this, this.reposition_drags_for_question, true);
}
},
get_choices_for_drop : function(choice, drop) {
var group = drop.getData('group');
@ -445,7 +454,7 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
var dragitems = this.get_choices_for_drop(choice, drop);
var dragitem = null;
dragitems.some(function (d) {
if (!d.hasClass('placed') && !d.hasClass('yui3-dd-dragging')) {
if (this.get('readonly') || (!d.hasClass('placed') && !d.hasClass('yui3-dd-dragging'))) {
dragitem = d;
return true;
} else {

View File

@ -258,7 +258,13 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
false, 10, this.create_all_drag_and_drops);
this.doc.drag_item_homes().after('load', this.poll_for_image_load, this,
false, 10, this.create_all_drag_and_drops);
Y.later(500, this, this.reposition_drags_for_question, [this.pendingid], true);
if (!this.get('readonly')) {
Y.later(500, this, this.reposition_drags_for_question, true);
} else {
Y.one('window').on('resize', function() {
this.reposition_drags_for_question();
}, this);
}
},
/**
@ -400,7 +406,7 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
inputnode.set('value', '');
}
},
reposition_drags_for_question : function() {
reposition_drags_for_question : function(dotimeout) {
this.doc.drag_items().removeClass('placed');
this.doc.drag_items().each (function (dragitem) {
if (dragitem.dd !== undefined) {
@ -433,6 +439,9 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
dragitem.setXY(dragitemhome.getXY());
}
}, this);
if (dotimeout) {
Y.later(500, this, this.reposition_drags_for_question, true);
}
},
get_choices_for_drop : function(choice, drop) {
var group = drop.getData('group');
@ -443,7 +452,7 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
var dragitems = this.get_choices_for_drop(choice, drop);
var dragitem = null;
dragitems.some(function (d) {
if (!d.hasClass('placed') && !d.hasClass('yui3-dd-dragging')) {
if (this.get('readonly') || (!d.hasClass('placed') && !d.hasClass('yui3-dd-dragging'))) {
dragitem = d;
return true;
} else {

View File

@ -43,7 +43,14 @@ Y.extend(DDWTOS_DD, Y.Base, {
this.clone_drag_items();
this.initial_place_of_drag_items();
this.make_drop_zones();
Y.later(500, this, this.position_drag_items, [pendingid], true);
if (!this.get('readonly')) {
Y.later(500, this, this.position_drag_items, [pendingid, true]);
} else {
Y.later(500, this, this.position_drag_items, [pendingid]);
Y.one('window').on('resize', function() {
this.position_drag_items(pendingid);
}, this);
}
},
/**
* put all our selectors in the same place so we can quickly find and change them later
@ -298,9 +305,12 @@ Y.extend(DDWTOS_DD, Y.Base, {
remove_drag_from_drop : function (drop) {
this.place_drag_in_drop(null, drop);
},
position_drag_items : function (pendingid) {
position_drag_items : function (pendingid, dotimeout) {
Y.all(this.selectors.drags()).each(this.position_drag_item, this);
M.util.js_complete(pendingid);
if (dotimeout) {
Y.later(500, this, this.position_drag_items, [pendingid, true]);
}
},
position_drag_item : function (drag) {
if (!drag.hasClass('yui3-dd-dragging')) {

File diff suppressed because one or more lines are too long

View File

@ -43,7 +43,14 @@ Y.extend(DDWTOS_DD, Y.Base, {
this.clone_drag_items();
this.initial_place_of_drag_items();
this.make_drop_zones();
Y.later(500, this, this.position_drag_items, [pendingid], true);
if (!this.get('readonly')) {
Y.later(500, this, this.position_drag_items, [pendingid, true]);
} else {
Y.later(500, this, this.position_drag_items, [pendingid]);
Y.one('window').on('resize', function() {
this.position_drag_items(pendingid);
}, this);
}
},
/**
* put all our selectors in the same place so we can quickly find and change them later
@ -298,9 +305,12 @@ Y.extend(DDWTOS_DD, Y.Base, {
remove_drag_from_drop : function (drop) {
this.place_drag_in_drop(null, drop);
},
position_drag_items : function (pendingid) {
position_drag_items : function (pendingid, dotimeout) {
Y.all(this.selectors.drags()).each(this.position_drag_item, this);
M.util.js_complete(pendingid);
if (dotimeout) {
Y.later(500, this, this.position_drag_items, [pendingid, true]);
}
},
position_drag_item : function (drag) {
if (!drag.hasClass('yui3-dd-dragging')) {

View File

@ -41,7 +41,14 @@ Y.extend(DDWTOS_DD, Y.Base, {
this.clone_drag_items();
this.initial_place_of_drag_items();
this.make_drop_zones();
Y.later(500, this, this.position_drag_items, [pendingid], true);
if (!this.get('readonly')) {
Y.later(500, this, this.position_drag_items, [pendingid, true]);
} else {
Y.later(500, this, this.position_drag_items, [pendingid]);
Y.one('window').on('resize', function() {
this.position_drag_items(pendingid);
}, this);
}
},
/**
* put all our selectors in the same place so we can quickly find and change them later
@ -296,9 +303,12 @@ Y.extend(DDWTOS_DD, Y.Base, {
remove_drag_from_drop : function (drop) {
this.place_drag_in_drop(null, drop);
},
position_drag_items : function (pendingid) {
position_drag_items : function (pendingid, dotimeout) {
Y.all(this.selectors.drags()).each(this.position_drag_item, this);
M.util.js_complete(pendingid);
if (dotimeout) {
Y.later(500, this, this.position_drag_items, [pendingid, true]);
}
},
position_drag_item : function (drag) {
if (!drag.hasClass('yui3-dd-dragging')) {