mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
Merge branch 'MDL-32729-im' of git://github.com/andrewnicols/moodle
This commit is contained in:
commit
e070ffd8ab
@ -54,7 +54,7 @@ class behat_question_base extends behat_base {
|
|||||||
|
|
||||||
return array(
|
return array(
|
||||||
new Given('I set the field "' . $this->escape($questiontypename) . '" to "1"'),
|
new Given('I set the field "' . $this->escape($questiontypename) . '" to "1"'),
|
||||||
new Given('I click on "#chooseqtype_submit" "css_element"'),
|
new Given('I click on ".submitbutton" "css_element"'),
|
||||||
new Given('I set the following fields to these values:', $questiondata),
|
new Given('I set the following fields to these values:', $questiondata),
|
||||||
new Given('I press "id_submitbutton"')
|
new Given('I press "id_submitbutton"')
|
||||||
);
|
);
|
||||||
|
@ -4,8 +4,7 @@ var SELECTORS = {
|
|||||||
CREATENEWQUESTION: 'div.createnewquestion',
|
CREATENEWQUESTION: 'div.createnewquestion',
|
||||||
CREATENEWQUESTIONFORM: 'div.createnewquestion form',
|
CREATENEWQUESTIONFORM: 'div.createnewquestion form',
|
||||||
CHOOSERDIALOGUE: 'div.chooserdialogue',
|
CHOOSERDIALOGUE: 'div.chooserdialogue',
|
||||||
CHOOSERHEADER: 'div.choosertitle',
|
CHOOSERHEADER: 'div.choosertitle'
|
||||||
QBANKCATEGORY: '#qbankcategory'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function Chooser() {
|
function Chooser() {
|
||||||
@ -14,7 +13,11 @@ function Chooser() {
|
|||||||
|
|
||||||
Y.extend(Chooser, M.core.chooserdialogue, {
|
Y.extend(Chooser, M.core.chooserdialogue, {
|
||||||
initializer: function() {
|
initializer: function() {
|
||||||
Y.one(SELECTORS.CREATENEWQUESTIONFORM).on('submit', this.displayQuestionChooser, this);
|
Y.all('form').each(function(node) {
|
||||||
|
if (/question\/addquestion\.php/.test(node.getAttribute('action'))) {
|
||||||
|
node.on('submit', this.displayQuestionChooser, this);
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
},
|
},
|
||||||
displayQuestionChooser: function(e) {
|
displayQuestionChooser: function(e) {
|
||||||
var dialogue = Y.one(SELECTORS.CREATENEWQUESTION + ' ' + SELECTORS.CHOOSERDIALOGUE),
|
var dialogue = Y.one(SELECTORS.CREATENEWQUESTION + ' ' + SELECTORS.CHOOSERDIALOGUE),
|
||||||
@ -26,10 +29,17 @@ Y.extend(Chooser, M.core.chooserdialogue, {
|
|||||||
this.prepare_chooser();
|
this.prepare_chooser();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the category ID in the form - this may have been updated since the dialogue
|
// Update all of the hidden fields within the questionbank form.
|
||||||
// was previously displayed so we must update it here.
|
var originForm = e.target.ancestor('form', true),
|
||||||
this.container.one(SELECTORS.QBANKCATEGORY).set('value',
|
targetForm = this.container.one('form'),
|
||||||
Y.one(SELECTORS.CREATENEWQUESTIONFORM).get('category').get('value'));
|
hiddenElements = originForm.all('input[type="hidden"]');
|
||||||
|
|
||||||
|
targetForm.all('input.customfield').remove();
|
||||||
|
hiddenElements.each(function(field) {
|
||||||
|
targetForm.appendChild(field.cloneNode())
|
||||||
|
.removeAttribute('id')
|
||||||
|
.addClass('customfield');
|
||||||
|
});
|
||||||
|
|
||||||
// Display the chooser dialogue.
|
// Display the chooser dialogue.
|
||||||
this.display_chooser(e);
|
this.display_chooser(e);
|
||||||
|
@ -1 +1 @@
|
|||||||
YUI.add("moodle-question-chooser",function(e,t){function r(){r.superclass.constructor.apply(this,arguments)}var n={CREATENEWQUESTION:"div.createnewquestion",CREATENEWQUESTIONFORM:"div.createnewquestion form",CHOOSERDIALOGUE:"div.chooserdialogue",CHOOSERHEADER:"div.choosertitle",QBANKCATEGORY:"#qbankcategory"};e.extend(r,M.core.chooserdialogue,{initializer:function(){e.one(n.CREATENEWQUESTIONFORM).on("submit",this.displayQuestionChooser,this)},displayQuestionChooser:function(t){var r=e.one(n.CREATENEWQUESTION+" "+n.CHOOSERDIALOGUE),i=e.one(n.CREATENEWQUESTION+" "+n.CHOOSERHEADER);this.container===null&&(this.setup_chooser_dialogue(r,i,{}),this.prepare_chooser()),this.container.one(n.QBANKCATEGORY).set("value",e.one(n.CREATENEWQUESTIONFORM).get("category").get("value")),this.display_chooser(t)}},{NAME:"questionChooser"}),M.question=M.question||{},M.question.init_chooser=function(e){return new r(e)}},"@VERSION@",{requires:["moodle-core-chooserdialogue"]});
|
YUI.add("moodle-question-chooser",function(e,t){function r(){r.superclass.constructor.apply(this,arguments)}var n={CREATENEWQUESTION:"div.createnewquestion",CREATENEWQUESTIONFORM:"div.createnewquestion form",CHOOSERDIALOGUE:"div.chooserdialogue",CHOOSERHEADER:"div.choosertitle"};e.extend(r,M.core.chooserdialogue,{initializer:function(){e.all("form").each(function(e){/question\/addquestion\.php/.test(e.getAttribute("action"))&&e.on("submit",this.displayQuestionChooser,this)},this)},displayQuestionChooser:function(t){var r=e.one(n.CREATENEWQUESTION+" "+n.CHOOSERDIALOGUE),i=e.one(n.CREATENEWQUESTION+" "+n.CHOOSERHEADER);this.container===null&&(this.setup_chooser_dialogue(r,i,{}),this.prepare_chooser());var s=t.target.ancestor("form",!0),o=this.container.one("form"),u=s.all('input[type="hidden"]');o.all("input.customfield").remove(),u.each(function(e){o.appendChild(e.cloneNode()).removeAttribute("id").addClass("customfield")}),this.display_chooser(t)}},{NAME:"questionChooser"}),M.question=M.question||{},M.question.init_chooser=function(e){return new r(e)}},"@VERSION@",{requires:["moodle-core-chooserdialogue"]});
|
||||||
|
@ -4,8 +4,7 @@ var SELECTORS = {
|
|||||||
CREATENEWQUESTION: 'div.createnewquestion',
|
CREATENEWQUESTION: 'div.createnewquestion',
|
||||||
CREATENEWQUESTIONFORM: 'div.createnewquestion form',
|
CREATENEWQUESTIONFORM: 'div.createnewquestion form',
|
||||||
CHOOSERDIALOGUE: 'div.chooserdialogue',
|
CHOOSERDIALOGUE: 'div.chooserdialogue',
|
||||||
CHOOSERHEADER: 'div.choosertitle',
|
CHOOSERHEADER: 'div.choosertitle'
|
||||||
QBANKCATEGORY: '#qbankcategory'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function Chooser() {
|
function Chooser() {
|
||||||
@ -14,7 +13,11 @@ function Chooser() {
|
|||||||
|
|
||||||
Y.extend(Chooser, M.core.chooserdialogue, {
|
Y.extend(Chooser, M.core.chooserdialogue, {
|
||||||
initializer: function() {
|
initializer: function() {
|
||||||
Y.one(SELECTORS.CREATENEWQUESTIONFORM).on('submit', this.displayQuestionChooser, this);
|
Y.all('form').each(function(node) {
|
||||||
|
if (/question\/addquestion\.php/.test(node.getAttribute('action'))) {
|
||||||
|
node.on('submit', this.displayQuestionChooser, this);
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
},
|
},
|
||||||
displayQuestionChooser: function(e) {
|
displayQuestionChooser: function(e) {
|
||||||
var dialogue = Y.one(SELECTORS.CREATENEWQUESTION + ' ' + SELECTORS.CHOOSERDIALOGUE),
|
var dialogue = Y.one(SELECTORS.CREATENEWQUESTION + ' ' + SELECTORS.CHOOSERDIALOGUE),
|
||||||
@ -26,10 +29,17 @@ Y.extend(Chooser, M.core.chooserdialogue, {
|
|||||||
this.prepare_chooser();
|
this.prepare_chooser();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the category ID in the form - this may have been updated since the dialogue
|
// Update all of the hidden fields within the questionbank form.
|
||||||
// was previously displayed so we must update it here.
|
var originForm = e.target.ancestor('form', true),
|
||||||
this.container.one(SELECTORS.QBANKCATEGORY).set('value',
|
targetForm = this.container.one('form'),
|
||||||
Y.one(SELECTORS.CREATENEWQUESTIONFORM).get('category').get('value'));
|
hiddenElements = originForm.all('input[type="hidden"]');
|
||||||
|
|
||||||
|
targetForm.all('input.customfield').remove();
|
||||||
|
hiddenElements.each(function(field) {
|
||||||
|
targetForm.appendChild(field.cloneNode())
|
||||||
|
.removeAttribute('id')
|
||||||
|
.addClass('customfield');
|
||||||
|
});
|
||||||
|
|
||||||
// Display the chooser dialogue.
|
// Display the chooser dialogue.
|
||||||
this.display_chooser(e);
|
this.display_chooser(e);
|
||||||
|
24
question/yui/src/chooser/js/chooser.js
vendored
24
question/yui/src/chooser/js/chooser.js
vendored
@ -2,8 +2,7 @@ var SELECTORS = {
|
|||||||
CREATENEWQUESTION: 'div.createnewquestion',
|
CREATENEWQUESTION: 'div.createnewquestion',
|
||||||
CREATENEWQUESTIONFORM: 'div.createnewquestion form',
|
CREATENEWQUESTIONFORM: 'div.createnewquestion form',
|
||||||
CHOOSERDIALOGUE: 'div.chooserdialogue',
|
CHOOSERDIALOGUE: 'div.chooserdialogue',
|
||||||
CHOOSERHEADER: 'div.choosertitle',
|
CHOOSERHEADER: 'div.choosertitle'
|
||||||
QBANKCATEGORY: '#qbankcategory'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function Chooser() {
|
function Chooser() {
|
||||||
@ -12,7 +11,11 @@ function Chooser() {
|
|||||||
|
|
||||||
Y.extend(Chooser, M.core.chooserdialogue, {
|
Y.extend(Chooser, M.core.chooserdialogue, {
|
||||||
initializer: function() {
|
initializer: function() {
|
||||||
Y.one(SELECTORS.CREATENEWQUESTIONFORM).on('submit', this.displayQuestionChooser, this);
|
Y.all('form').each(function(node) {
|
||||||
|
if (/question\/addquestion\.php/.test(node.getAttribute('action'))) {
|
||||||
|
node.on('submit', this.displayQuestionChooser, this);
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
},
|
},
|
||||||
displayQuestionChooser: function(e) {
|
displayQuestionChooser: function(e) {
|
||||||
var dialogue = Y.one(SELECTORS.CREATENEWQUESTION + ' ' + SELECTORS.CHOOSERDIALOGUE),
|
var dialogue = Y.one(SELECTORS.CREATENEWQUESTION + ' ' + SELECTORS.CHOOSERDIALOGUE),
|
||||||
@ -24,10 +27,17 @@ Y.extend(Chooser, M.core.chooserdialogue, {
|
|||||||
this.prepare_chooser();
|
this.prepare_chooser();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the category ID in the form - this may have been updated since the dialogue
|
// Update all of the hidden fields within the questionbank form.
|
||||||
// was previously displayed so we must update it here.
|
var originForm = e.target.ancestor('form', true),
|
||||||
this.container.one(SELECTORS.QBANKCATEGORY).set('value',
|
targetForm = this.container.one('form'),
|
||||||
Y.one(SELECTORS.CREATENEWQUESTIONFORM).get('category').get('value'));
|
hiddenElements = originForm.all('input[type="hidden"]');
|
||||||
|
|
||||||
|
targetForm.all('input.customfield').remove();
|
||||||
|
hiddenElements.each(function(field) {
|
||||||
|
targetForm.appendChild(field.cloneNode())
|
||||||
|
.removeAttribute('id')
|
||||||
|
.addClass('customfield');
|
||||||
|
});
|
||||||
|
|
||||||
// Display the chooser dialogue.
|
// Display the chooser dialogue.
|
||||||
this.display_chooser(e);
|
this.display_chooser(e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user