From 63e4df60f691727b68e578ec5c7d756280bcb33b Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Mon, 29 Aug 2016 14:57:46 +0800 Subject: [PATCH] MDL-55839 behat: Behat fixes for theme_noname This is a squash of many small fixes. The list of changes are: Initial set of behat selectors overrides required for new theme. set core behat selectors if not overridden by theme Remove pause Fix for checkboxes not saving properly Custom override for click in the user menu Fix for behat guessing the field type. Behat fix for guessing the correct field type. Fix for missing closeElementBefore mforms mess. Fix for textareas not displaying their contents. Fix availability form element Fix action menu selectors for activities in a course page Fix textareas not retaining their values Fix selector for blocks I had to change the single select template to use an input instead of a button because of a behat bug we have not tracked down yet. Fix for frozen attribute in form elements Use input instead of button while behat is still broken Fix for navigation selector override Behat selector fixes and multi-select fixes for templated select Fix for configure blocks selector + booleans for autocomplete Fixes for course_summary behat tests Allow optgroups in single_select Behat fixes for block_navigation Fixes for url form element and activity chooser selectors blocks_social - fix specific selector for behat Fix export_for_template for selectgroups element. Dont set empty id on the form Fix direct call to behat_navigation in backup context Checkbox empty value fix Fix for assign grading panel popouts file picker overrides to find a file manager in the page Fix chat tests to use element name Make selectors in mod_data behat less specific MDL-55839: recent activity behat test relies on time() SQUASH Honour mform element "class" attribute on the container SQUASH Fixes for behat in mod_forum SQUASH search form template showing value as text next to the button SQUASH undo double selectgroup fix SQUASH - The slightly different structure to action menus breaks course drag and drop SQUASH Wrap loading icon in a span so the selector still works. SQUASH Fix fragile javascript in report_loglive SQUASH Fix tabtree, and selectgroups for mod_feedback Also - do-not enhance the action menu - we are dropping support for this. SQUASH Fix filemanager selector and pix_icon template for mod_forum tests. SQUASH Fixes to breadcrumb and add formid to single select (fixes mod_glossary tests) SQUASH lesson behat fixes. 95% of lesson styles were rubbish so they were disgarded. SQUASH Fix lti behat tests - they were cheating and using a context step from quiz SQUASH Behat fixes for quiz with new theme SQUASH behat fixes for mod_wiki SQUASH Workshop behat fixes SQUASH Frozen form elements cannot use a readonly form element because it screws with the form JS "disabledIf" stuff. SQUASH Fixes for grades behat tests SQUASH behat fixes for groups SQUASH blacklist action menu tests SQUASH Fix for tag form element missing "manage standard tags" link SQUASH Incomplete fixes for course behat tests SQUASH behat fixes for badges SQUASH Tags fixes for behat SQUASH filepicker fixes for behat SQUASH Abort guessing field type when we hit 'html' SQUASH Fix for admin/tool/behat tests SQUASH fix for admin tool behat tests SQUASH fix for availabilty conditions hiding "aria-hidden" elements SQUASH give the blocks more room. We get behat files because nav tree nodes are not in view SQUASH Blocks fixed Fix behaviour of unchecked checkboxes SQUASH Remove incorrect step in user test SQUASH behat fixes for course tests Part of MDL-55071 --- .../behat/tests/behat/data_generators.feature | 2 +- ...odle-availability_completion-form-debug.js | 2 +- ...moodle-availability_completion-form-min.js | 2 +- .../moodle-availability_completion-form.js | 2 +- .../completion/yui/src/form/js/form.js | 2 +- .../moodle-availability_date-form-debug.js | 2 +- .../moodle-availability_date-form-min.js | 2 +- .../moodle-availability_date-form.js | 2 +- .../condition/date/yui/src/form/js/form.js | 2 +- .../moodle-availability_grade-form-debug.js | 2 +- .../moodle-availability_grade-form-min.js | 2 +- .../moodle-availability_grade-form.js | 2 +- .../condition/grade/yui/src/form/js/form.js | 2 +- .../moodle-availability_group-form-debug.js | 2 +- .../moodle-availability_group-form-min.js | 2 +- .../moodle-availability_group-form.js | 2 +- .../condition/group/yui/src/form/js/form.js | 2 +- ...moodle-availability_grouping-form-debug.js | 2 +- .../moodle-availability_grouping-form-min.js | 2 +- .../moodle-availability_grouping-form.js | 2 +- .../grouping/yui/src/form/js/form.js | 2 +- .../moodle-availability_profile-form-debug.js | 2 +- .../moodle-availability_profile-form-min.js | 2 +- .../moodle-availability_profile-form.js | 2 +- .../condition/profile/yui/src/form/js/form.js | 2 +- .../moodle-core_availability-form-debug.js | 12 +- .../moodle-core_availability-form-min.js | 2 +- .../moodle-core_availability-form.js | 12 +- availability/yui/src/form/meta/form.json | 1 + badges/tests/behat/award_badge.feature | 4 +- .../tests/behat/behat_block_comments.php | 2 +- .../behat/block_course_summary_course.feature | 2 +- .../block_course_summary_frontpage.feature | 2 +- .../tests/behat/structural_changes.feature | 7 + .../tests/behat/edit_activities.feature | 2 +- .../tests/behat/edit_activities.feature | 2 +- .../configure_block_throughout_site.feature | 2 +- blocks/tests/behat/manage_blocks.feature | 10 +- blocks/tests/behat/move_blocks.feature | 49 +++ course/classes/management_renderer.php | 6 + course/tests/behat/course_controls.feature | 4 +- course/tests/behat/course_resort.feature | 2 +- .../moodle-course-dragdrop-debug.js | 9 +- .../moodle-course-dragdrop-min.js | 4 +- .../moodle-course-dragdrop.js | 9 +- .../moodle-course-modchooser-debug.js | 2 +- .../moodle-course-modchooser-min.js | 2 +- .../moodle-course-modchooser.js | 2 +- course/yui/src/dragdrop/js/section.js | 9 +- course/yui/src/modchooser/js/modchooser.js | 2 +- grade/edit/tree/lib.php | 1 - .../tests/behat/bulk_insert_grades.feature | 4 +- .../grade_calculated_grade_items.feature | 2 +- ...de_calculated_grade_items_20150627.feature | 2 +- .../behat/grade_category_validation.feature | 4 +- .../tests/behat/grade_item_validation.feature | 4 +- .../tests/behat/grade_letter_boundary.feature | 2 +- .../grade_letter_boundary_20160518.feature | 2 +- grade/tests/behat/grade_to_pass.feature | 4 +- lib/amd/build/tag.min.js | 2 +- lib/amd/src/tag.js | 10 +- lib/behat/behat_base.php | 4 + lib/behat/behat_field_manager.php | 15 +- lib/behat/behat_files.php | 5 +- lib/behat/classes/behat_selectors.php | 16 +- .../form_field/behat_form_filemanager.php | 3 +- lib/form/advcheckbox.php | 14 +- lib/form/autocomplete.php | 6 +- lib/form/cancel.php | 8 - lib/form/editor.php | 4 +- lib/form/form.js | 2 +- lib/form/group.php | 4 +- lib/form/select.php | 4 + lib/form/tags.php | 13 + lib/form/templatable_form_element.php | 12 +- lib/form/templates/editor_textarea.mustache | 4 +- lib/form/textarea.php | 11 +- lib/form/url.php | 2 +- lib/formslib.php | 22 +- lib/javascript-static.js | 4 +- lib/outputcomponents.php | 30 +- lib/templates/action_link.mustache | 2 +- lib/tests/behat/behat_action_menu.php | 77 +++++ lib/tests/behat/behat_deprecated.php | 10 + lib/tests/behat/behat_hooks.php | 2 +- mod/assign/amd/build/grading_panel.min.js | 2 +- mod/assign/amd/src/grading_panel.js | 6 +- .../tests/behat/chat_course_reset.feature | 4 +- mod/data/tests/behat/required_entries.feature | 46 +-- mod/feedback/classes/complete_form.php | 1 - mod/feedback/styles.css | 86 ----- .../tests/behat/coursemapping.feature | 8 +- mod/feedback/tests/behat/multichoice.feature | 15 +- mod/feedback/yui/dragdrop/dragdrop.js | 6 +- mod/lesson/locallib.php | 2 +- mod/lesson/mod_form.php | 2 +- mod/lesson/styles.css | 79 ----- .../tests/behat/lesson_student_resume.feature | 2 +- .../tests/behat/questions_images.feature | 4 +- mod/lti/tests/behat/addtool.feature | 2 +- mod/lti/tests/behat/addtype.feature | 8 +- mod/quiz/renderer.php | 2 +- mod/quiz/tests/behat/behat_mod_quiz.php | 14 - mod/quiz/tests/behat/editing_add.feature | 4 +- .../tests/behat/editing_move_by_click.feature | 2 +- .../tests/behat/editing_repaginate.feature | 2 +- .../behat/editing_section_headings.feature | 10 +- .../moodle-mod_quiz-util-page-debug.js | 4 +- .../moodle-mod_quiz-util-page-min.js | 2 +- .../moodle-mod_quiz-util-page.js | 4 +- mod/quiz/yui/src/util/js/page.js | 4 +- mod/quiz/yui/src/util/meta/util.json | 2 +- mod/wiki/editors/wikieditor.php | 13 + mod/wiki/tests/behat/wiki_formats.feature | 2 +- .../tests/behat/behat_mod_workshop.php | 2 +- .../tests/behat/workshop_assessment.feature | 1 - report/loglive/classes/renderer.php | 4 +- .../moodle-report_loglive-fetchlogs-debug.js | 4 +- .../moodle-report_loglive-fetchlogs-min.js | 2 +- .../moodle-report_loglive-fetchlogs.js | 4 +- .../loglive/yui/src/fetchlogs/js/fetchlogs.js | 4 +- .../tests/behat/cancel_add_file.feature | 2 +- .../tests/behat/behat_repository_upload.php | 2 +- tag/classes/collections_table.php | 6 +- theme/bootstrapbase/less/moodle/modules.less | 168 ++++++++++ theme/bootstrapbase/style/moodle.css | 71 ++++ theme/noname/classes/output/core_renderer.php | 24 ++ theme/noname/layout/columns2.php | 4 +- theme/noname/scss/moodle/course.scss | 35 -- theme/noname/scss/moodle/forms.scss | 10 +- theme/noname/scss/moodle/modules.scss | 45 ++- .../block_settings/search_form.mustache | 2 +- theme/noname/templates/columns2.mustache | 2 +- theme/noname/templates/core/block.mustache | 1 + .../filemanager_page_generallayout.mustache | 2 +- theme/noname/templates/core/navbar.mustache | 2 +- theme/noname/templates/core/pix_icon.mustache | 3 +- .../templates/core/single_button.mustache | 2 +- .../templates/core/single_select.mustache | 15 +- theme/noname/templates/core/tabtree.mustache | 2 +- .../noname/templates/core/url_select.mustache | 4 +- .../core_form/editor_textarea.mustache | 4 +- .../element-advcheckbox-inline.mustache | 30 +- .../core_form/element-advcheckbox.mustache | 32 +- .../element-autocomplete-inline.mustache | 35 ++ .../core_form/element-autocomplete.mustache | 16 +- .../core_form/element-button-inline.mustache | 8 +- .../core_form/element-button.mustache | 6 +- .../element-checkbox-inline.mustache | 18 +- .../core_form/element-checkbox.mustache | 19 +- .../core_form/element-date_selector.mustache | 2 +- ...element-date_time_selector-inline.mustache | 2 +- .../element-date_time_selector.mustache | 2 +- .../element-duration-inline.mustache | 2 +- .../core_form/element-duration.mustache | 2 +- .../core_form/element-editor.mustache | 2 +- .../core_form/element-filemanager.mustache | 2 +- .../core_form/element-filepicker.mustache | 2 +- .../core_form/element-grading.mustache | 2 +- .../core_form/element-group-inline.mustache | 2 +- .../core_form/element-group.mustache | 2 +- .../core_form/element-modgrade.mustache | 2 +- .../core_form/element-modvisible.mustache | 2 +- .../core_form/element-password.mustache | 3 +- .../core_form/element-passwordunmask.mustache | 2 + .../element-questioncategory-inline.mustache | 2 +- .../element-questioncategory.mustache | 2 +- .../core_form/element-radio-inline.mustache | 8 +- .../core_form/element-radio.mustache | 8 +- .../core_form/element-recaptcha.mustache | 2 +- .../core_form/element-select-inline.mustache | 10 +- .../core_form/element-select.mustache | 12 +- .../element-selectgroups-inline.mustache | 26 +- .../core_form/element-selectgroups.mustache | 18 +- .../core_form/element-selectwithlink.mustache | 8 +- .../element-selectyesno-inline.mustache | 2 +- .../core_form/element-selectyesno.mustache | 2 +- .../core_form/element-static.mustache | 2 +- .../core_form/element-submit-inline.mustache | 6 +- .../core_form/element-submit.mustache | 4 +- .../core_form/element-tags-inline.mustache | 38 +++ .../templates/core_form/element-tags.mustache | 38 +++ .../element-template-inline.mustache | 4 +- .../core_form/element-template.mustache | 18 +- .../core_form/element-text-inline.mustache | 6 +- .../templates/core_form/element-text.mustache | 6 +- .../core_form/element-textarea.mustache | 8 +- .../templates/core_form/element-url.mustache | 8 +- .../core_form/element-wikieditor.mustache | 5 + .../behat_theme_noname_behat_action_menu.php | 60 ++++ .../behat/behat_theme_noname_behat_admin.php | 106 ++++++ .../behat/behat_theme_noname_behat_auth.php | 57 ++++ .../behat/behat_theme_noname_behat_backup.php | 48 +++ .../behat/behat_theme_noname_behat_blocks.php | 70 ++++ .../behat/behat_theme_noname_behat_course.php | 245 ++++++++++++++ .../behat_theme_noname_behat_filepicker.php | 302 ++++++++++++++++++ .../behat/behat_theme_noname_behat_files.php | 65 ++++ .../behat/behat_theme_noname_behat_grade.php | 143 +++++++++ .../behat_theme_noname_behat_mod_quiz.php | 89 ++++++ .../behat_theme_noname_behat_navigation.php | 91 ++++++ ...t_theme_noname_behat_repository_upload.php | 134 ++++++++ theme/noname/tests/behat/blacklist.json | 8 + user/tests/behat/reset_page.feature | 1 - 203 files changed, 2592 insertions(+), 551 deletions(-) create mode 100644 blocks/tests/behat/move_blocks.feature create mode 100644 lib/tests/behat/behat_action_menu.php delete mode 100644 mod/lesson/styles.css create mode 100644 theme/noname/templates/core_form/element-autocomplete-inline.mustache create mode 100644 theme/noname/templates/core_form/element-tags-inline.mustache create mode 100644 theme/noname/templates/core_form/element-tags.mustache create mode 100644 theme/noname/templates/core_form/element-wikieditor.mustache create mode 100644 theme/noname/tests/behat/behat_theme_noname_behat_action_menu.php create mode 100644 theme/noname/tests/behat/behat_theme_noname_behat_admin.php create mode 100644 theme/noname/tests/behat/behat_theme_noname_behat_auth.php create mode 100644 theme/noname/tests/behat/behat_theme_noname_behat_backup.php create mode 100644 theme/noname/tests/behat/behat_theme_noname_behat_blocks.php create mode 100644 theme/noname/tests/behat/behat_theme_noname_behat_course.php create mode 100644 theme/noname/tests/behat/behat_theme_noname_behat_filepicker.php create mode 100644 theme/noname/tests/behat/behat_theme_noname_behat_files.php create mode 100644 theme/noname/tests/behat/behat_theme_noname_behat_grade.php create mode 100644 theme/noname/tests/behat/behat_theme_noname_behat_mod_quiz.php create mode 100644 theme/noname/tests/behat/behat_theme_noname_behat_navigation.php create mode 100644 theme/noname/tests/behat/behat_theme_noname_behat_repository_upload.php create mode 100644 theme/noname/tests/behat/blacklist.json diff --git a/admin/tool/behat/tests/behat/data_generators.feature b/admin/tool/behat/tests/behat/data_generators.feature index 0f3e3afc8ee..cac5f633456 100644 --- a/admin/tool/behat/tests/behat/data_generators.feature +++ b/admin/tool/behat/tests/behat/data_generators.feature @@ -439,7 +439,7 @@ Feature: Set up contextual data for tests And I follow "Edit Test Outcome Grade Item 1" And the field "Outcome" matches value "Grade outcome 1" And I expand all fieldsets - And "//div[contains(@class, 'fitem')]/div[contains(@class, 'fitemtitle')]/div[contains(@class, fstaticlabel) and contains(., 'Grade category')]/../../div[contains(@class, 'felement') and contains(., 'Grade category 1')]" "xpath_element" should exist + And I should see "Grade category 1" in the "Grade category" "form_row" And I press "Cancel" Scenario: Add a block diff --git a/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-debug.js b/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-debug.js index 6d7ad52ad9f..41d64eaa381 100644 --- a/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-debug.js +++ b/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-debug.js @@ -56,7 +56,7 @@ M.availability_completion.form.getNode = function(json) { // Add event handlers (first time only). if (!M.availability_completion.form.addedEvents) { M.availability_completion.form.addedEvents = true; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { // Whichever dropdown changed, just update the form. M.core_availability.form.update(); diff --git a/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-min.js b/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-min.js index 17f1813fa3d..e780555c04a 100644 --- a/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-min.js +++ b/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-min.js @@ -1 +1 @@ -YUI.add("moodle-availability_completion-form",function(e,t){M.availability_completion=M.availability_completion||{},M.availability_completion.form=e.Object(M.core_availability.plugin),M.availability_completion.form.initInner=function(e){this.cms=e},M.availability_completion.form.getNode=function(t){var n=M.util.get_string("title","availability_completion")+' ";var s=e.Node.create(""+n+"");t.cm!==undefined&&s.one("select[name=cm] > option[value="+t.cm+"]")&&s.one("select[name=cm]").set("value",""+t.cm),t.e!==undefined&&s.one("select[name=e]").set("value",""+t.e);if(!M.availability_completion.form.addedEvents){M.availability_completion.form.addedEvents=!0;var o=e.one("#fitem_id_availabilityconditionsjson");o.delegate("change",function(){M.core_availability.form.update()},".availability_completion select")}return s},M.availability_completion.form.fillValue=function(e,t){e.cm=parseInt(t.one("select[name=cm]").get("value"),10),e.e=parseInt(t.one("select[name=e]").get("value"),10)},M.availability_completion.form.fillErrors=function(e,t){var n=parseInt(t.one("select[name=cm]").get("value"),10);n===0&&e.push("availability_completion:error_selectcmid")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]}); +YUI.add("moodle-availability_completion-form",function(e,t){M.availability_completion=M.availability_completion||{},M.availability_completion.form=e.Object(M.core_availability.plugin),M.availability_completion.form.initInner=function(e){this.cms=e},M.availability_completion.form.getNode=function(t){var n=M.util.get_string("title","availability_completion")+' ";var s=e.Node.create(""+n+"");t.cm!==undefined&&s.one("select[name=cm] > option[value="+t.cm+"]")&&s.one("select[name=cm]").set("value",""+t.cm),t.e!==undefined&&s.one("select[name=e]").set("value",""+t.e);if(!M.availability_completion.form.addedEvents){M.availability_completion.form.addedEvents=!0;var o=e.one(".availability-field");o.delegate("change",function(){M.core_availability.form.update()},".availability_completion select")}return s},M.availability_completion.form.fillValue=function(e,t){e.cm=parseInt(t.one("select[name=cm]").get("value"),10),e.e=parseInt(t.one("select[name=e]").get("value"),10)},M.availability_completion.form.fillErrors=function(e,t){var n=parseInt(t.one("select[name=cm]").get("value"),10);n===0&&e.push("availability_completion:error_selectcmid")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]}); diff --git a/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form.js b/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form.js index 6d7ad52ad9f..41d64eaa381 100644 --- a/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form.js +++ b/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form.js @@ -56,7 +56,7 @@ M.availability_completion.form.getNode = function(json) { // Add event handlers (first time only). if (!M.availability_completion.form.addedEvents) { M.availability_completion.form.addedEvents = true; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { // Whichever dropdown changed, just update the form. M.core_availability.form.update(); diff --git a/availability/condition/completion/yui/src/form/js/form.js b/availability/condition/completion/yui/src/form/js/form.js index be694ed49ad..89b1058e2b5 100644 --- a/availability/condition/completion/yui/src/form/js/form.js +++ b/availability/condition/completion/yui/src/form/js/form.js @@ -54,7 +54,7 @@ M.availability_completion.form.getNode = function(json) { // Add event handlers (first time only). if (!M.availability_completion.form.addedEvents) { M.availability_completion.form.addedEvents = true; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { // Whichever dropdown changed, just update the form. M.core_availability.form.update(); diff --git a/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form-debug.js b/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form-debug.js index e338aac9c7e..7530a28bf2b 100644 --- a/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form-debug.js +++ b/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form-debug.js @@ -72,7 +72,7 @@ M.availability_date.form.getNode = function(json) { if (!M.availability_date.form.addedEvents) { M.availability_date.form.addedEvents = true; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { // For the direction, just update the form fields. M.core_availability.form.update(); diff --git a/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form-min.js b/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form-min.js index eeb12a37229..8a9bd5d3142 100644 --- a/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form-min.js +++ b/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form-min.js @@ -1 +1 @@ -YUI.add("moodle-availability_date-form",function(e,t){M.availability_date=M.availability_date||{},M.availability_date.form=e.Object(M.core_availability.plugin),M.availability_date.form.initInner=function(e,t){this.html=e,this.defaultTime=t},M.availability_date.form.getNode=function(t){var n=M.util.get_string("direction_before","availability_date")+' '+' "+this.html,r=e.Node.create(""+n+"");if(t.t!==undefined){r.setData("time",t.t),r.all("select:not([name=direction])").each(function(e){e.set("disabled",!0)});var i=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=fromtime"+"&time="+t.t;e.io(i,{on:{success:function(t,n){var i=e.JSON.parse(n.responseText);for(var s in i){var o=r.one("select[name=x\\["+s+"\\]]");o.set("value",""+i[s]),o.set("disabled",!1)}},failure:function(){window.alert(M.util.get_string("ajaxerror","availability_date"))}}})}else r.setData("time",this.defaultTime);t.d!==undefined&&r.one("select[name=direction]").set("value",t.d);if(!M.availability_date.form.addedEvents){M.availability_date.form.addedEvents=!0;var s=e.one("#fitem_id_availabilityconditionsjson");s.delegate("change",function(){M.core_availability.form.update()},".availability_date select[name=direction]"),s.delegate("change",function(){M.availability_date.form.updateTime(this.ancestor("span.availability_date"))},".availability_date select:not([name=direction])")}if(r.one("a[href=#]")){M.form.dateselector.init_single_date_selector(r);var o=r.one("select[name=x\\[year\\]]"),u=o.set;o.set=function(e,t){u.call(o,e,t),e==="selectedIndex"&&setTimeout(function(){M.availability_date.form.updateTime(r)},0)}}return r},M.availability_date.form.updateTime=function(t){var n=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=totime"+"&year="+t.one("select[name=x\\[year\\]]").get("value")+"&month="+t.one("select[name=x\\[month\\]]").get("value")+"&day="+t.one("select[name=x\\[day\\]]").get("value")+"&hour="+t.one("select[name=x\\[hour\\]]").get("value")+"&minute="+t.one("select[name=x\\[minute\\]]").get("value");e.io(n,{on:{success:function(e,n){t.setData("time",n.responseText),M.core_availability.form.update()},failure:function(){window.alert(M.util.get_string("ajaxerror","availability_date"))}}})},M.availability_date.form.fillValue=function(e,t){e.d=t.one("select[name=direction]").get("value"),e.t=parseInt(t.getData("time"),10)}},"@VERSION@",{requires:["base","node","event","io","moodle-core_availability-form"]}); +YUI.add("moodle-availability_date-form",function(e,t){M.availability_date=M.availability_date||{},M.availability_date.form=e.Object(M.core_availability.plugin),M.availability_date.form.initInner=function(e,t){this.html=e,this.defaultTime=t},M.availability_date.form.getNode=function(t){var n=M.util.get_string("direction_before","availability_date")+' '+' "+this.html,r=e.Node.create(""+n+"");if(t.t!==undefined){r.setData("time",t.t),r.all("select:not([name=direction])").each(function(e){e.set("disabled",!0)});var i=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=fromtime"+"&time="+t.t;e.io(i,{on:{success:function(t,n){var i=e.JSON.parse(n.responseText);for(var s in i){var o=r.one("select[name=x\\["+s+"\\]]");o.set("value",""+i[s]),o.set("disabled",!1)}},failure:function(){window.alert(M.util.get_string("ajaxerror","availability_date"))}}})}else r.setData("time",this.defaultTime);t.d!==undefined&&r.one("select[name=direction]").set("value",t.d);if(!M.availability_date.form.addedEvents){M.availability_date.form.addedEvents=!0;var s=e.one(".availability-field");s.delegate("change",function(){M.core_availability.form.update()},".availability_date select[name=direction]"),s.delegate("change",function(){M.availability_date.form.updateTime(this.ancestor("span.availability_date"))},".availability_date select:not([name=direction])")}if(r.one("a[href=#]")){M.form.dateselector.init_single_date_selector(r);var o=r.one("select[name=x\\[year\\]]"),u=o.set;o.set=function(e,t){u.call(o,e,t),e==="selectedIndex"&&setTimeout(function(){M.availability_date.form.updateTime(r)},0)}}return r},M.availability_date.form.updateTime=function(t){var n=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=totime"+"&year="+t.one("select[name=x\\[year\\]]").get("value")+"&month="+t.one("select[name=x\\[month\\]]").get("value")+"&day="+t.one("select[name=x\\[day\\]]").get("value")+"&hour="+t.one("select[name=x\\[hour\\]]").get("value")+"&minute="+t.one("select[name=x\\[minute\\]]").get("value");e.io(n,{on:{success:function(e,n){t.setData("time",n.responseText),M.core_availability.form.update()},failure:function(){window.alert(M.util.get_string("ajaxerror","availability_date"))}}})},M.availability_date.form.fillValue=function(e,t){e.d=t.one("select[name=direction]").get("value"),e.t=parseInt(t.getData("time"),10)}},"@VERSION@",{requires:["base","node","event","io","moodle-core_availability-form"]}); diff --git a/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form.js b/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form.js index e338aac9c7e..7530a28bf2b 100644 --- a/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form.js +++ b/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form.js @@ -72,7 +72,7 @@ M.availability_date.form.getNode = function(json) { if (!M.availability_date.form.addedEvents) { M.availability_date.form.addedEvents = true; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { // For the direction, just update the form fields. M.core_availability.form.update(); diff --git a/availability/condition/date/yui/src/form/js/form.js b/availability/condition/date/yui/src/form/js/form.js index 2c5df1e523f..e1ee836d225 100644 --- a/availability/condition/date/yui/src/form/js/form.js +++ b/availability/condition/date/yui/src/form/js/form.js @@ -70,7 +70,7 @@ M.availability_date.form.getNode = function(json) { if (!M.availability_date.form.addedEvents) { M.availability_date.form.addedEvents = true; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { // For the direction, just update the form fields. M.core_availability.form.update(); diff --git a/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form-debug.js b/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form-debug.js index f5c41def5cb..734994e22a5 100644 --- a/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form-debug.js +++ b/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form-debug.js @@ -86,7 +86,7 @@ M.availability_grade.form.getNode = function(json) { if (!M.availability_grade.form.addedEvents) { M.availability_grade.form.addedEvents = true; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { // For the grade item, just update the form fields. M.core_availability.form.update(); diff --git a/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form-min.js b/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form-min.js index c7467b5fdd6..4d4a50c63bf 100644 --- a/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form-min.js +++ b/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form-min.js @@ -1 +1 @@ -YUI.add("moodle-availability_grade-form",function(e,t){M.availability_grade=M.availability_grade||{},M.availability_grade.form=e.Object(M.core_availability.plugin),M.availability_grade.form.grades=null,M.availability_grade.form.initInner=function(e){this.grades=e,this.nodesSoFar=0},M.availability_grade.form.getNode=function(t){this.nodesSoFar++;var n=" %'+''+' %';var s=e.Node.create(""+n+"");t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")&&s.one("select[name=id]").set("value",""+t.id),t.min!==undefined&&(s.one("input[name=min]").set("checked",!0),s.one("input[name=minval]").set("value",t.min)),t.max!==undefined&&(s.one("input[name=max]").set("checked",!0),s.one("input[name=maxval]").set("value",t.max));var o=function(e,t){var n=e.ancestor("label").next("label").one("input"),r=e.get("checked");return n.set("disabled",!r),t&&r&&n.focus(),r};s.all("input[type=checkbox]").each(o);if(!M.availability_grade.form.addedEvents){M.availability_grade.form.addedEvents=!0;var u=e.one("#fitem_id_availabilityconditionsjson");u.delegate("change",function(){M.core_availability.form.update()},".availability_grade select[name=id]"),u.delegate("click",function(){o(this,!0),M.core_availability.form.update()},".availability_grade input[type=checkbox]"),u.delegate("valuechange",function(){M.core_availability.form.update()},".availability_grade input[type=text]")}return s},M.availability_grade.form.fillValue=function(e,t){e.id=parseInt(t.one("select[name=id]").get("value"),10),t.one("input[name=min]").get("checked")&&(e.min=this.getValue("minval",t)),t.one("input[name=max]").get("checked")&&(e.max=this.getValue("maxval",t))},M.availability_grade.form.getValue=function(e,t){var n=t.one("input[name="+e+"]").get("value");if(!/^[0-9]+([.,][0-9]+)?$/.test(n))return n;var r=parseFloat(n.replace(",","."));return r<0||r>100?n:r},M.availability_grade.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id===0&&e.push("availability_grade:error_selectgradeid"),n.min!==undefined&&typeof n.min=="string"||n.max!==undefined&&typeof n.max=="string"?e.push("availability_grade:error_invalidnumber"):n.min!==undefined&&n.max!==undefined&&n.min>=n.max&&e.push("availability_grade:error_backwardrange")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]}); +YUI.add("moodle-availability_grade-form",function(e,t){M.availability_grade=M.availability_grade||{},M.availability_grade.form=e.Object(M.core_availability.plugin),M.availability_grade.form.grades=null,M.availability_grade.form.initInner=function(e){this.grades=e,this.nodesSoFar=0},M.availability_grade.form.getNode=function(t){this.nodesSoFar++;var n=" %'+''+' %';var s=e.Node.create(""+n+"");t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")&&s.one("select[name=id]").set("value",""+t.id),t.min!==undefined&&(s.one("input[name=min]").set("checked",!0),s.one("input[name=minval]").set("value",t.min)),t.max!==undefined&&(s.one("input[name=max]").set("checked",!0),s.one("input[name=maxval]").set("value",t.max));var o=function(e,t){var n=e.ancestor("label").next("label").one("input"),r=e.get("checked");return n.set("disabled",!r),t&&r&&n.focus(),r};s.all("input[type=checkbox]").each(o);if(!M.availability_grade.form.addedEvents){M.availability_grade.form.addedEvents=!0;var u=e.one(".availability-field");u.delegate("change",function(){M.core_availability.form.update()},".availability_grade select[name=id]"),u.delegate("click",function(){o(this,!0),M.core_availability.form.update()},".availability_grade input[type=checkbox]"),u.delegate("valuechange",function(){M.core_availability.form.update()},".availability_grade input[type=text]")}return s},M.availability_grade.form.fillValue=function(e,t){e.id=parseInt(t.one("select[name=id]").get("value"),10),t.one("input[name=min]").get("checked")&&(e.min=this.getValue("minval",t)),t.one("input[name=max]").get("checked")&&(e.max=this.getValue("maxval",t))},M.availability_grade.form.getValue=function(e,t){var n=t.one("input[name="+e+"]").get("value");if(!/^[0-9]+([.,][0-9]+)?$/.test(n))return n;var r=parseFloat(n.replace(",","."));return r<0||r>100?n:r},M.availability_grade.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id===0&&e.push("availability_grade:error_selectgradeid"),n.min!==undefined&&typeof n.min=="string"||n.max!==undefined&&typeof n.max=="string"?e.push("availability_grade:error_invalidnumber"):n.min!==undefined&&n.max!==undefined&&n.min>=n.max&&e.push("availability_grade:error_backwardrange")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]}); diff --git a/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form.js b/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form.js index f5c41def5cb..734994e22a5 100644 --- a/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form.js +++ b/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form.js @@ -86,7 +86,7 @@ M.availability_grade.form.getNode = function(json) { if (!M.availability_grade.form.addedEvents) { M.availability_grade.form.addedEvents = true; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { // For the grade item, just update the form fields. M.core_availability.form.update(); diff --git a/availability/condition/grade/yui/src/form/js/form.js b/availability/condition/grade/yui/src/form/js/form.js index 7a51507e37c..0286eb7a57f 100644 --- a/availability/condition/grade/yui/src/form/js/form.js +++ b/availability/condition/grade/yui/src/form/js/form.js @@ -84,7 +84,7 @@ M.availability_grade.form.getNode = function(json) { if (!M.availability_grade.form.addedEvents) { M.availability_grade.form.addedEvents = true; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { // For the grade item, just update the form fields. M.core_availability.form.update(); diff --git a/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form-debug.js b/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form-debug.js index a1b8a652531..9ddaa663918 100644 --- a/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form-debug.js +++ b/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form-debug.js @@ -58,7 +58,7 @@ M.availability_group.form.getNode = function(json) { // Add event handlers (first time only). if (!M.availability_group.form.addedEvents) { M.availability_group.form.addedEvents = true; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { // Just update the form fields. M.core_availability.form.update(); diff --git a/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form-min.js b/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form-min.js index 39491185315..040d3951568 100644 --- a/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form-min.js +++ b/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form-min.js @@ -1 +1 @@ -YUI.add("moodle-availability_group-form",function(e,t){M.availability_group=M.availability_group||{},M.availability_group.form=e.Object(M.core_availability.plugin),M.availability_group.form.groups=null,M.availability_group.form.initInner=function(e){this.groups=e},M.availability_group.form.getNode=function(t){var n="";var s=e.Node.create(""+n+"");t.creating===undefined&&(t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")?s.one("select[name=id]").set("value",""+t.id):t.id===undefined&&s.one("select[name=id]").set("value","any"));if(!M.availability_group.form.addedEvents){M.availability_group.form.addedEvents=!0;var o=e.one("#fitem_id_availabilityconditionsjson");o.delegate("change",function(){M.core_availability.form.update()},".availability_group select")}return s},M.availability_group.form.fillValue=function(e,t){var n=t.one("select[name=id]").get("value");n==="choose"?e.id="choose":n!=="any"&&(e.id=parseInt(n,10))},M.availability_group.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id&&n.id==="choose"&&e.push("availability_group:error_selectgroup")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]}); +YUI.add("moodle-availability_group-form",function(e,t){M.availability_group=M.availability_group||{},M.availability_group.form=e.Object(M.core_availability.plugin),M.availability_group.form.groups=null,M.availability_group.form.initInner=function(e){this.groups=e},M.availability_group.form.getNode=function(t){var n="";var s=e.Node.create(""+n+"");t.creating===undefined&&(t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")?s.one("select[name=id]").set("value",""+t.id):t.id===undefined&&s.one("select[name=id]").set("value","any"));if(!M.availability_group.form.addedEvents){M.availability_group.form.addedEvents=!0;var o=e.one(".availability-field");o.delegate("change",function(){M.core_availability.form.update()},".availability_group select")}return s},M.availability_group.form.fillValue=function(e,t){var n=t.one("select[name=id]").get("value");n==="choose"?e.id="choose":n!=="any"&&(e.id=parseInt(n,10))},M.availability_group.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id&&n.id==="choose"&&e.push("availability_group:error_selectgroup")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]}); diff --git a/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form.js b/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form.js index a1b8a652531..9ddaa663918 100644 --- a/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form.js +++ b/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form.js @@ -58,7 +58,7 @@ M.availability_group.form.getNode = function(json) { // Add event handlers (first time only). if (!M.availability_group.form.addedEvents) { M.availability_group.form.addedEvents = true; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { // Just update the form fields. M.core_availability.form.update(); diff --git a/availability/condition/group/yui/src/form/js/form.js b/availability/condition/group/yui/src/form/js/form.js index f9ec44f1052..84eaa3391b1 100644 --- a/availability/condition/group/yui/src/form/js/form.js +++ b/availability/condition/group/yui/src/form/js/form.js @@ -56,7 +56,7 @@ M.availability_group.form.getNode = function(json) { // Add event handlers (first time only). if (!M.availability_group.form.addedEvents) { M.availability_group.form.addedEvents = true; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { // Just update the form fields. M.core_availability.form.update(); diff --git a/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form-debug.js b/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form-debug.js index f3d616a5206..c60c6816e51 100644 --- a/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form-debug.js +++ b/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form-debug.js @@ -53,7 +53,7 @@ M.availability_grouping.form.getNode = function(json) { // Add event handlers (first time only). if (!M.availability_grouping.form.addedEvents) { M.availability_grouping.form.addedEvents = true; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { // Just update the form fields. M.core_availability.form.update(); diff --git a/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form-min.js b/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form-min.js index 34c9759f0cc..5f1bcbc4abc 100644 --- a/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form-min.js +++ b/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form-min.js @@ -1 +1 @@ -YUI.add("moodle-availability_grouping-form",function(e,t){M.availability_grouping=M.availability_grouping||{},M.availability_grouping.form=e.Object(M.core_availability.plugin),M.availability_grouping.form.groupings=null,M.availability_grouping.form.initInner=function(e){this.groupings=e},M.availability_grouping.form.getNode=function(t){var n="";var s=e.Node.create(""+n+"");t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")&&s.one("select[name=id]").set("value",""+t.id);if(!M.availability_grouping.form.addedEvents){M.availability_grouping.form.addedEvents=!0;var o=e.one("#fitem_id_availabilityconditionsjson");o.delegate("change",function(){M.core_availability.form.update()},".availability_grouping select")}return s},M.availability_grouping.form.fillValue=function(e,t){var n=t.one("select[name=id]").get("value");n==="choose"?e.id="choose":e.id=parseInt(n,10)},M.availability_grouping.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id==="choose"&&e.push("availability_grouping:error_selectgrouping")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]}); +YUI.add("moodle-availability_grouping-form",function(e,t){M.availability_grouping=M.availability_grouping||{},M.availability_grouping.form=e.Object(M.core_availability.plugin),M.availability_grouping.form.groupings=null,M.availability_grouping.form.initInner=function(e){this.groupings=e},M.availability_grouping.form.getNode=function(t){var n="";var s=e.Node.create(""+n+"");t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")&&s.one("select[name=id]").set("value",""+t.id);if(!M.availability_grouping.form.addedEvents){M.availability_grouping.form.addedEvents=!0;var o=e.one(".availability-field");o.delegate("change",function(){M.core_availability.form.update()},".availability_grouping select")}return s},M.availability_grouping.form.fillValue=function(e,t){var n=t.one("select[name=id]").get("value");n==="choose"?e.id="choose":e.id=parseInt(n,10)},M.availability_grouping.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id==="choose"&&e.push("availability_grouping:error_selectgrouping")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]}); diff --git a/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form.js b/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form.js index f3d616a5206..c60c6816e51 100644 --- a/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form.js +++ b/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form.js @@ -53,7 +53,7 @@ M.availability_grouping.form.getNode = function(json) { // Add event handlers (first time only). if (!M.availability_grouping.form.addedEvents) { M.availability_grouping.form.addedEvents = true; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { // Just update the form fields. M.core_availability.form.update(); diff --git a/availability/condition/grouping/yui/src/form/js/form.js b/availability/condition/grouping/yui/src/form/js/form.js index b0fd7c969a4..ad3135e3aae 100644 --- a/availability/condition/grouping/yui/src/form/js/form.js +++ b/availability/condition/grouping/yui/src/form/js/form.js @@ -51,7 +51,7 @@ M.availability_grouping.form.getNode = function(json) { // Add event handlers (first time only). if (!M.availability_grouping.form.addedEvents) { M.availability_grouping.form.addedEvents = true; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { // Just update the form fields. M.core_availability.form.update(); diff --git a/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form-debug.js b/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form-debug.js index be46a7e9a87..9909ea23649 100644 --- a/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form-debug.js +++ b/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form-debug.js @@ -91,7 +91,7 @@ M.availability_profile.form.getNode = function(json) { ancestorNode.one('input[name=value]').set('disabled', novalue); M.core_availability.form.update(); }; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { updateForm(this); }, '.availability_profile select'); diff --git a/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form-min.js b/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form-min.js index 63a87d32db6..303b419e58a 100644 --- a/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form-min.js +++ b/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form-min.js @@ -1 +1 @@ -YUI.add("moodle-availability_profile-form",function(e,t){M.availability_profile=M.availability_profile||{},M.availability_profile.form=e.Object(M.core_availability.plugin),M.availability_profile.form.profiles=null,M.availability_profile.form.initInner=function(e,t){this.standardFields=e,this.customFields=t},M.availability_profile.form.getNode=function(t){var n=' ';var o=e.Node.create(""+n+"");t.sf!==undefined&&o.one("select[name=field] > option[value=sf_"+t.sf+"]")?o.one("select[name=field]").set("value","sf_"+t.sf):t.cf!==undefined&&o.one("select[name=field] > option[value=cf_"+t.cf+"]")&&o.one("select[name=field]").set("value","cf_"+t.cf),t.op!==undefined&&o.one("select[name=op] > option[value="+t.op+"]")&&(o.one("select[name=op]").set("value",t.op),(t.op==="isempty"||t.op==="isnotempty")&&o.one("input[name=value]").set("disabled",!0)),t.v!==undefined&&o.one("input").set("value",t.v);if(!M.availability_profile.form.addedEvents){M.availability_profile.form.addedEvents=!0;var u=function(e){var t=e.ancestor("span.availability_profile"),n=t.one("select[name=op]"),r=n.get("value")==="isempty"||n.get("value")==="isnotempty";t.one("input[name=value]").set("disabled",r),M.core_availability.form.update()},a=e.one("#fitem_id_availabilityconditionsjson");a.delegate("change",function(){u(this)},".availability_profile select"),a.delegate("change",function(){u(this)},".availability_profile input[name=value]")}return o},M.availability_profile.form.fillValue=function(e,t){var n=t.one("select[name=field]").get("value");n.substr(0,3)==="sf_"?e.sf=n.substr(3):n.substr(0,3)==="cf_"&&(e.cf=n.substr(3)),e.op=t.one("select[name=op]").get("value");var r=t.one("input[name=value]");r.get("disabled")||(e.v=r.get("value"))},M.availability_profile.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.sf===undefined&&n.cf===undefined&&e.push("availability_profile:error_selectfield"),n.v!==undefined&&/^\s*$/.test(n.v)&&e.push("availability_profile:error_setvalue")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]}); +YUI.add("moodle-availability_profile-form",function(e,t){M.availability_profile=M.availability_profile||{},M.availability_profile.form=e.Object(M.core_availability.plugin),M.availability_profile.form.profiles=null,M.availability_profile.form.initInner=function(e,t){this.standardFields=e,this.customFields=t},M.availability_profile.form.getNode=function(t){var n=' ';var o=e.Node.create(""+n+"");t.sf!==undefined&&o.one("select[name=field] > option[value=sf_"+t.sf+"]")?o.one("select[name=field]").set("value","sf_"+t.sf):t.cf!==undefined&&o.one("select[name=field] > option[value=cf_"+t.cf+"]")&&o.one("select[name=field]").set("value","cf_"+t.cf),t.op!==undefined&&o.one("select[name=op] > option[value="+t.op+"]")&&(o.one("select[name=op]").set("value",t.op),(t.op==="isempty"||t.op==="isnotempty")&&o.one("input[name=value]").set("disabled",!0)),t.v!==undefined&&o.one("input").set("value",t.v);if(!M.availability_profile.form.addedEvents){M.availability_profile.form.addedEvents=!0;var u=function(e){var t=e.ancestor("span.availability_profile"),n=t.one("select[name=op]"),r=n.get("value")==="isempty"||n.get("value")==="isnotempty";t.one("input[name=value]").set("disabled",r),M.core_availability.form.update()},a=e.one(".availability-field");a.delegate("change",function(){u(this)},".availability_profile select"),a.delegate("change",function(){u(this)},".availability_profile input[name=value]")}return o},M.availability_profile.form.fillValue=function(e,t){var n=t.one("select[name=field]").get("value");n.substr(0,3)==="sf_"?e.sf=n.substr(3):n.substr(0,3)==="cf_"&&(e.cf=n.substr(3)),e.op=t.one("select[name=op]").get("value");var r=t.one("input[name=value]");r.get("disabled")||(e.v=r.get("value"))},M.availability_profile.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.sf===undefined&&n.cf===undefined&&e.push("availability_profile:error_selectfield"),n.v!==undefined&&/^\s*$/.test(n.v)&&e.push("availability_profile:error_setvalue")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]}); diff --git a/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form.js b/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form.js index be46a7e9a87..9909ea23649 100644 --- a/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form.js +++ b/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form.js @@ -91,7 +91,7 @@ M.availability_profile.form.getNode = function(json) { ancestorNode.one('input[name=value]').set('disabled', novalue); M.core_availability.form.update(); }; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { updateForm(this); }, '.availability_profile select'); diff --git a/availability/condition/profile/yui/src/form/js/form.js b/availability/condition/profile/yui/src/form/js/form.js index 5336589fe10..db73335bdca 100644 --- a/availability/condition/profile/yui/src/form/js/form.js +++ b/availability/condition/profile/yui/src/form/js/form.js @@ -89,7 +89,7 @@ M.availability_profile.form.getNode = function(json) { ancestorNode.one('input[name=value]').set('disabled', novalue); M.core_availability.form.update(); }; - var root = Y.one('#fitem_id_availabilityconditionsjson'); + var root = Y.one('.availability-field'); root.delegate('change', function() { updateForm(this); }, '.availability_profile select'); diff --git a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-debug.js b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-debug.js index c75e14aa9d5..40b36ad0e46 100644 --- a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-debug.js +++ b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-debug.js @@ -1154,4 +1154,14 @@ M.core_availability.DeleteIcon = function(toDelete) { M.core_availability.DeleteIcon.prototype.span = null; -}, '@VERSION@', {"requires": ["base", "node", "event", "panel", "moodle-core-notification-dialogue", "json"]}); +}, '@VERSION@', { + "requires": [ + "base", + "node", + "event", + "event-delegate", + "panel", + "moodle-core-notification-dialogue", + "json" + ] +}); diff --git a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-min.js b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-min.js index 76c433953ca..2668730afad 100644 --- a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-min.js +++ b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-min.js @@ -1,3 +1,3 @@ YUI.add("moodle-core_availability-form",function(e,t){M.core_availability=M.core_availability||{},M.core_availability.form={plugins:{},field:null,mainDiv:null,rootList:null,idCounter:0,restrictByGroup:null,init:function(t){for(var n in t){var r=t[n],i=M[r[0]].form;i.init.apply(i,r)}this.field=e.one("#id_availabilityconditionsjson"),this.field.setAttribute("aria-hidden","true"),this.mainDiv=e.Node.create(''),this.field.insert(this.mainDiv,"after");var s=this.field.get("value"),o=null;if(s!=="")try{o=e.JSON.parse(s)}catch(u){this.field.set("value","")}this.rootList=new M.core_availability.List(o,!0),this.mainDiv.appendChild(this.rootList.node),this.update(),this.rootList.renumber(),this.mainDiv.setAttribute("aria-live","polite"),this.field.ancestor("form").on("submit",function(){this.mainDiv.all("input,textarea,select").set("disabled",!0)},this),this.restrictByGroup=e.one("#restrictbygroup");if(this.restrictByGroup){this.restrictByGroup.on("click",this.addRestrictByGroup,this);var a=e.one("#id_groupmode"),f=e.one("#id_groupingid");a&&a.on("change",this.updateRestrictByGroup,this),f&&f.on("change",this.updateRestrictByGroup,this),this.updateRestrictByGroup()}},update:function(){var t=this.rootList.getValue(),n=[];this.rootList.fillErrors(n),n.length!==0&&(t.errors=n),this.field.set("value",e.JSON.stringify(t)),this.updateRestrictByGroup()},updateRestrictByGroup:function(){if(!this.restrictByGroup)return;if(this.rootList.getValue().op!=="&"){this.restrictByGroup.set("disabled",!0);return}var t=this.rootList.hasItemOfType("group")||this.rootList.hasItemOfType("grouping");if(t){this.restrictByGroup.set("disabled",!0);return}var n=e.one("#id_groupmode"),r=e.one("#id_groupingid");if((!n||Number(n.get("value"))===0)&&(!r||Number(r.get("value"))===0)){this.restrictByGroup.set("disabled",!0);return}this.restrictByGroup.set("disabled",!1)},addRestrictByGroup:function(t){t.preventDefault();var n=e.one("#id_groupingid"),r;n&&Number(n.get("value"))!==0?r=new M.core_availability.Item({type:"grouping",id:Number(n.get("value"))},!0):r=new M.core_availability.Item({type:"group"},!0),this.rootList.addChild(r),this.update(),this.rootList.renumber(),this.rootList.updateHtml()}},M.core_availability.plugin={allowAdd:!1,init:function(e,t,n){var r=e.replace(/^availability_/,"");this.allowAdd=t,M.core_availability.form.plugins[r]=this,this.initInner.apply(this,n)},initInner:function(){},getNode:function(){throw"getNode not implemented"},fillValue:function(){throw"fillValue not implemented"},fillErrors:function(){},focusAfterAdd:function(e){var t=e.one("input:not([disabled]),select:not([disabled])");t.focus()}},M.core_availability.List=function(t,n,r){this.children=[],n!==undefined&&(this.root=n),this.node=e.Node.create('

'+M.util.get_string("listheader_sign_before","availability")+' "+''+M.util.get_string("listheader_single","availability")+""+''+M.util.get_string("listheader_multi_before","availability")+' "+M.util.get_string("listheader_multi_after","availability")+"
"+'
'+'
'+M.util.get_string("none","moodle")+"
"+'
'),n||this.node.addClass("availability-childlist"),this.inner=this.node.one("> .availability-inner");var i=!0;n?(t&&t.show!==undefined&&(i=t.show),this.eyeIcon=new M.core_availability.EyeIcon(!1,i),this.node.one(".availability-header").get("firstChild").insert(this.eyeIcon.span,"before")):r&&(t&&t.showc!==undefined&&(i=t.showc),this.eyeIcon=new M.core_availability.EyeIcon(!1,i),this.inner.insert(this.eyeIcon.span,"before"));if(!n){var s=new M.core_availability.DeleteIcon(this),o=this.node.one(".availability-none");o.appendChild(document.createTextNode(" ")),o.appendChild(s.span),o.appendChild(e.Node.create(''+M.util.get_string("invalid","availability")+""))}var u=e.Node.create('");u.on("click",function(){this.clickAdd()},this),this.node.one("div.availability-button").appendChild(u);if(t){switch(t.op){case"&":case"|":this.node.one(".availability-neg").set("value","");break;case"!&":case"!|":this.node.one(".availability-neg").set("value","!")}switch(t.op){case"&":case"!&":this.node.one(".availability-op").set("value","&");break;case"|":case"!|":this.node.one(".availability-op").set("value","|")}for(var a=0;a0&&this.inner.one(".availability-children").appendChild(e.Node.create('
')),this.children.push(t),this.inner.one(".availability-children").appendChild(t.node)},M.core_availability.List.prototype.focusAfterAdd=function(){this.inner.one("button").focus()},M.core_availability.List.prototype.isIndividualShowIcons=function(){if(!this.root)throw"Can only call this on root list";var e=this.node.one(".availability-neg").get("value")==="!",t=this.node.one(".availability-op").get("value")==="|";return!e&&!t||e&&t},M.core_availability.List.prototype.renumber=function(e){var t={count:this.children.length},n;e===undefined?(t.number="",n=""):(t.number=e+":",n=e+".");var r=M.util.get_string("setheading","availability",t);this.node.one("> h3").set("innerHTML",r);for(var i=0;i0?(this.inner.one("> .availability-children").removeAttribute("aria-hidden"),this.inner.one("> .availability-none").setAttribute("aria-hidden","true"),this.inner.one("> .availability-header").removeAttribute("aria-hidden"),this.children.length>1?(this.inner.one(".availability-single").setAttribute("aria-hidden","true"),this.inner.one(".availability-multi").removeAttribute("aria-hidden")):(this.inner.one(".availability-single").removeAttribute("aria-hidden"),this.inner.one(".availability-multi").setAttribute("aria-hidden","true"))):(this.inner.one("> .availability-children").setAttribute("aria-hidden","true"),this.inner.one("> .availability-none").removeAttribute("aria-hidden"),this.inner.one("> .availability-header").setAttribute("aria-hidden","true"));if(this.root){var e=this.isIndividualShowIcons();for(var t=0;t .availability-children > .availability-connector span.label").each(function(e){e.set("innerHTML",r)})},M.core_availability.List.prototype.deleteDescendant=function(e){for(var t=0;t0&&(r.previous(".availability-connector")?r.previous(".availability-connector").remove():r.next(".availability-connector").remove()),this.inner.one("> .availability-children").removeChild(r),M.core_availability.form.update(),this.updateHtml(),this.inner.one("> .availability-button").one("button").focus(),!0}if(n instanceof M.core_availability.List){var i=n.deleteDescendant(e);if(i)return!0}}return!1},M.core_availability.List.prototype.clickAdd=function(){var t=e.Node.create('
    "),n=t.one("button"),r={dialog:null},i=t.one("ul"),s,o,u,a;for(var f in M.core_availability.form.plugins){if(!M.core_availability.form.plugins[f].allowAdd)continue;s=e.Node.create('
  • '),o="availability_addrestriction_"+f,u=e.Node.create('"),u.on("click",this.getAddHandler(f,r),this),s.appendChild(u),a=e.Node.create('"),s.appendChild(a),i.appendChild(s)}s=e.Node.create('
  • '),o="availability_addrestriction_list_",u=e.Node.create('"),u.on("click",this.getAddHandler(null,r),this),s.appendChild(u),a=e.Node.create('"),s.appendChild(a),i.appendChild(s);var l={headerContent:M.util.get_string("addrestriction","availability"),bodyContent:t,additionalBaseClass:"availability-dialogue",draggable:!0,modal:!0,closeButton:!1,width:"450px"};r.dialog=new M.core.dialogue(l),r.dialog.show(),n.on("click",function(){r.dialog.destroy(),this.inner.one("> .availability-button").one("button").focus()},this)},M.core_availability.List.prototype.getAddHandler=function(e,t){return function(){var n;e?n=new M.core_availability.Item({type:e,creating:!0},this.root):n=new M.core_availability.List({c:[],showc:!0},!1,this.root),this.addChild(n),M.core_availability.form.update(),M.core_availability.form.rootList.renumber(),this.updateHtml(),t.dialog.destroy(),n.focusAfterAdd()}},M.core_availability.List.prototype.getValue=function(){var e={};e.op=this.node.one(".availability-neg").get("value")+this.node.one(".availability-op").get("value"),e.c=[];var t;for(t=0;t'+M.util.get_string("missingplugin","availability")+"")):(this.plugin=M.core_availability.form.plugins[t.type],this.pluginNode=this.plugin.getNode(t),this.pluginNode.addClass("availability_"+t.type)),this.node=e.Node.create('

    ');if(n){var r=!0;t.showc!==undefined&&(r=t.showc),this.eyeIcon=new M.core_availability.EyeIcon(!0,r),this.node.appendChild(this.eyeIcon.span)}this.pluginNode.addClass("availability-plugincontrols"),this.node.appendChild(this.pluginNode);var i=new M.core_availability.DeleteIcon(this);this.node.appendChild(i.span),this.node.appendChild(document.createTextNode(" ")),this.node.appendChild(e.Node.create(''))},M.core_availability.Item.prototype.getValue=function(){var e={type:this.pluginType};return this.plugin&&this.plugin.fillValue(e,this.pluginNode),e},M.core_availability.Item.prototype.fillErrors=function(e){var t=e.length;this.plugin?this.plugin.fillErrors(e,this.pluginNode):e.push("core_availability:item_unknowntype");var n=this.node.one("> .label-warning");e.length!==t&&!n.get("firstChild")?n.appendChild(document.createTextNode(M.util.get_string("invalid","availability"))):e.length===t&&n.get("firstChild")&&n.get("firstChild").remove()},M.core_availability.Item.prototype.renumber=function(e){var t={number:e};this.plugin?t.type=M.util.get_string("title","availability_"+this.pluginType):t.type="["+this.pluginType+"]",t.number=e+":";var n=M.util.get_string("itemheading","availability",t);this.node.one("> h3").set("innerHTML",n)},M.core_availability.Item.prototype.focusAfterAdd=function(){this.plugin.focusAfterAdd(this.pluginNode)},M.core_availability.Item.prototype.pluginType=null,M.core_availability.Item.prototype.plugin=null,M.core_availability.Item.prototype.eyeIcon=null,M.core_availability.Item.prototype.node=null,M.core_availability.Item.prototype.pluginNode=null,M.core_availability.EyeIcon=function(t,n){this.individual=t,this.span=e.Node.create('');var r=e.Node.create("");this.span.appendChild(r);var i=t?"_individual":"_all",s=function(){var e=M.util.get_string("hidden"+i,"availability");r.set("src",M.util.image_url("i/show","core")),r.set("alt",e),this.span.set("title",e+" \u2022 "+M.util.get_string("show_verb","availability"))},o=function(){var e=M.util.get_string("shown"+i,"availability");r.set("src",M.util.image_url("i/hide","core")),r.set("alt",e),this.span.set("title",e+" \u2022 "+M.util.get_string("hide_verb","availability"))};n?o.call(this):s.call(this);var u=function(e){e.preventDefault(),this.isHidden()?o.call(this):s.call(this),M.core_availability.form.update()};this.span.on("click",u,this),this.span.on("key",u,"up:32",this),this.span.on("key",function(e){e.preventDefault()},"down:32",this)},M.core_availability.EyeIcon.prototype.individual=!1,M.core_availability.EyeIcon.prototype.span=null,M.core_availability.EyeIcon.prototype.isHidden=function(){var e=this.individual?"_individual":"_all",t=M.util.get_string("hidden"+e,"availability");return this.span.one("img").get("alt")===t},M.core_availability.DeleteIcon=function(t){this.span=e.Node.create('');var n=e.Node.create(''+M.util.get_string(');this.span.appendChild(n);var r=function(e){e.preventDefault(),M.core_availability.form.rootList.deleteDescendant(t),M.core_availability.form.rootList.renumber()};this.span.on("click",r,this),this.span.on("key",r,"up:32",this),this.span.on("key",function(e){e.preventDefault()},"down:32",this)},M.core_availability.DeleteIcon.prototype.span=null},"@VERSION@",{requires:["base","node","event","panel","moodle-core-notification-dialogue","json"]}); +.List.prototype.inner=null,M.core_availability.Item=function(t,n){this.pluginType=t.type,M.core_availability.form.plugins[t.type]===undefined?(this.plugin=null,this.pluginNode=e.Node.create('
    '+M.util.get_string("missingplugin","availability")+"
    ")):(this.plugin=M.core_availability.form.plugins[t.type],this.pluginNode=this.plugin.getNode(t),this.pluginNode.addClass("availability_"+t.type)),this.node=e.Node.create('

    ');if(n){var r=!0;t.showc!==undefined&&(r=t.showc),this.eyeIcon=new M.core_availability.EyeIcon(!0,r),this.node.appendChild(this.eyeIcon.span)}this.pluginNode.addClass("availability-plugincontrols"),this.node.appendChild(this.pluginNode);var i=new M.core_availability.DeleteIcon(this);this.node.appendChild(i.span),this.node.appendChild(document.createTextNode(" ")),this.node.appendChild(e.Node.create(''))},M.core_availability.Item.prototype.getValue=function(){var e={type:this.pluginType};return this.plugin&&this.plugin.fillValue(e,this.pluginNode),e},M.core_availability.Item.prototype.fillErrors=function(e){var t=e.length;this.plugin?this.plugin.fillErrors(e,this.pluginNode):e.push("core_availability:item_unknowntype");var n=this.node.one("> .label-warning");e.length!==t&&!n.get("firstChild")?n.appendChild(document.createTextNode(M.util.get_string("invalid","availability"))):e.length===t&&n.get("firstChild")&&n.get("firstChild").remove()},M.core_availability.Item.prototype.renumber=function(e){var t={number:e};this.plugin?t.type=M.util.get_string("title","availability_"+this.pluginType):t.type="["+this.pluginType+"]",t.number=e+":";var n=M.util.get_string("itemheading","availability",t);this.node.one("> h3").set("innerHTML",n)},M.core_availability.Item.prototype.focusAfterAdd=function(){this.plugin.focusAfterAdd(this.pluginNode)},M.core_availability.Item.prototype.pluginType=null,M.core_availability.Item.prototype.plugin=null,M.core_availability.Item.prototype.eyeIcon=null,M.core_availability.Item.prototype.node=null,M.core_availability.Item.prototype.pluginNode=null,M.core_availability.EyeIcon=function(t,n){this.individual=t,this.span=e.Node.create('
    ');var r=e.Node.create("");this.span.appendChild(r);var i=t?"_individual":"_all",s=function(){var e=M.util.get_string("hidden"+i,"availability");r.set("src",M.util.image_url("i/show","core")),r.set("alt",e),this.span.set("title",e+" \u2022 "+M.util.get_string("show_verb","availability"))},o=function(){var e=M.util.get_string("shown"+i,"availability");r.set("src",M.util.image_url("i/hide","core")),r.set("alt",e),this.span.set("title",e+" \u2022 "+M.util.get_string("hide_verb","availability"))};n?o.call(this):s.call(this);var u=function(e){e.preventDefault(),this.isHidden()?o.call(this):s.call(this),M.core_availability.form.update()};this.span.on("click",u,this),this.span.on("key",u,"up:32",this),this.span.on("key",function(e){e.preventDefault()},"down:32",this)},M.core_availability.EyeIcon.prototype.individual=!1,M.core_availability.EyeIcon.prototype.span=null,M.core_availability.EyeIcon.prototype.isHidden=function(){var e=this.individual?"_individual":"_all",t=M.util.get_string("hidden"+e,"availability");return this.span.one("img").get("alt")===t},M.core_availability.DeleteIcon=function(t){this.span=e.Node.create('');var n=e.Node.create(''+M.util.get_string(');this.span.appendChild(n);var r=function(e){e.preventDefault(),M.core_availability.form.rootList.deleteDescendant(t),M.core_availability.form.rootList.renumber()};this.span.on("click",r,this),this.span.on("key",r,"up:32",this),this.span.on("key",function(e){e.preventDefault()},"down:32",this)},M.core_availability.DeleteIcon.prototype.span=null},"@VERSION@",{requires:["base","node","event","event-delegate","panel","moodle-core-notification-dialogue","json"]}); diff --git a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form.js b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form.js index c75e14aa9d5..40b36ad0e46 100644 --- a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form.js +++ b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form.js @@ -1154,4 +1154,14 @@ M.core_availability.DeleteIcon = function(toDelete) { M.core_availability.DeleteIcon.prototype.span = null; -}, '@VERSION@', {"requires": ["base", "node", "event", "panel", "moodle-core-notification-dialogue", "json"]}); +}, '@VERSION@', { + "requires": [ + "base", + "node", + "event", + "event-delegate", + "panel", + "moodle-core-notification-dialogue", + "json" + ] +}); diff --git a/availability/yui/src/form/meta/form.json b/availability/yui/src/form/meta/form.json index 7905db3a714..8da9cad7f4c 100644 --- a/availability/yui/src/form/meta/form.json +++ b/availability/yui/src/form/meta/form.json @@ -4,6 +4,7 @@ "base", "node", "event", + "event-delegate", "panel", "moodle-core-notification-dialogue", "json" diff --git a/badges/tests/behat/award_badge.feature b/badges/tests/behat/award_badge.feature index 508fd420c1e..206ac426cbd 100644 --- a/badges/tests/behat/award_badge.feature +++ b/badges/tests/behat/award_badge.feature @@ -31,7 +31,7 @@ Feature: Award badges And I press "Enable access" And I press "Continue" And I click on "Admin User" "link" - And I follow "Profile" in the open menu + And I choose "Profile" in the open action menu And I follow "Edit profile" And I expand all fieldsets And I set the field "Phone" to "123456789" @@ -204,7 +204,7 @@ Feature: Award badges And I upload "badges/tests/behat/badge.png" file to "Image" filemanager And I press "Create badge" And I set the field "type" to "Course completion" - And I set the field with xpath "//fieldset/input[1]" to "0" + And I set the field with xpath ".//*[contains(., 'Minimum grade required')]/ancestor::*[contains(concat(' ', @class, ' '), ' fitem ')]//input[1]" to "0" And I press "Save" And I press "Enable access" When I press "Continue" diff --git a/blocks/comments/tests/behat/behat_block_comments.php b/blocks/comments/tests/behat/behat_block_comments.php index ff5b2664a43..210a163535f 100644 --- a/blocks/comments/tests/behat/behat_block_comments.php +++ b/blocks/comments/tests/behat/behat_block_comments.php @@ -94,7 +94,7 @@ class behat_block_comments extends behat_base { // Using xpath liternal to avoid possible problems with comments containing quotes. $commentliteral = behat_context_helper::escape($comment); - $commentxpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' block_comments ')]" . + $commentxpath = "//*[contains(concat(' ', normalize-space(@class), ' '), ' block_comments ')]" . "/descendant::div[@class='comment-message'][contains(., $commentliteral)]"; $commentnode = $this->find('xpath', $commentxpath, $exception); diff --git a/blocks/course_summary/tests/behat/block_course_summary_course.feature b/blocks/course_summary/tests/behat/block_course_summary_course.feature index 65e7d9a2456..a33f66ec9c4 100644 --- a/blocks/course_summary/tests/behat/block_course_summary_course.feature +++ b/blocks/course_summary/tests/behat/block_course_summary_course.feature @@ -35,7 +35,7 @@ Feature: Course summary block used in a course And I turn editing mode on Then I should see "Proved the course summary block works!" in the "Course summary" "block" And I should see "Course summary" in the "Course summary" "block" - And I click on "Edit" "link" in the "Course summary" "block" + And I click on ".editbutton a" "css_element" in the "Course summary" "block" Then I should see "Edit course settings" in the "h2" "css_element" Scenario: Teacher can not see edit icon when edit mode is off diff --git a/blocks/course_summary/tests/behat/block_course_summary_frontpage.feature b/blocks/course_summary/tests/behat/block_course_summary_frontpage.feature index 0655dc397d3..e8980b0ad5c 100644 --- a/blocks/course_summary/tests/behat/block_course_summary_frontpage.feature +++ b/blocks/course_summary/tests/behat/block_course_summary_frontpage.feature @@ -26,7 +26,7 @@ Feature: Course summary block used on the frontpage And I follow "Turn editing on" Then I should see "Proved the summary block works!" in the "Course/site summary" "block" And I should not see "Course summary" in the "Course/site summary" "block" - And I click on "Edit" "link" in the "Course/site summary" "block" + And I click on ".editbutton a" "css_element" in the "Course/site summary" "block" Then I should see "Front page settings" in the "h2" "css_element" Scenario: Admin can not see edit icon when edit mode is off diff --git a/blocks/recent_activity/tests/behat/structural_changes.feature b/blocks/recent_activity/tests/behat/structural_changes.feature index 9f6d8da8109..380ea1e9c78 100644 --- a/blocks/recent_activity/tests/behat/structural_changes.feature +++ b/blocks/recent_activity/tests/behat/structural_changes.feature @@ -151,6 +151,7 @@ Feature: View structural changes in recent activity block Then I should see "Added Forum" in the "Recent activity" "block" And I should see "ForumNew" in the "Recent activity" "block" And I log out + And I wait "1" seconds And I log in as "student1" And I follow "Course 1" And I should see "Added Forum" in the "Recent activity" "block" @@ -158,6 +159,7 @@ Feature: View structural changes in recent activity block And I log out # Update forum as a teacher after a second to ensure we have a new timestamp for recent activity. And I wait "1" seconds + # Update forum as a teacher And I log in as "teacher1" And I follow "Course 1" And I follow "ForumNew" @@ -166,6 +168,7 @@ Feature: View structural changes in recent activity block | name | ForumUpdated | And I press "Save and return to course" And I log out + And I wait "1" seconds # Student 1 already saw that forum was created, now he can see that forum was updated And I log in as "student1" And I follow "Course 1" @@ -174,6 +177,7 @@ Feature: View structural changes in recent activity block And I should see "Updated Forum" in the "Recent activity" "block" And I should see "ForumUpdated" in the "Recent activity" "block" And I log out + And I wait "1" seconds # Student 2 has bigger interval and he can see one entry that forum was created but with the new name And I log in as "student2" And I follow "Course 1" @@ -182,12 +186,14 @@ Feature: View structural changes in recent activity block And I should not see "Updated Forum" in the "Recent activity" "block" And I should see "ForumUpdated" in the "Recent activity" "block" And I log out + And I wait "1" seconds # Delete forum as a teacher And I log in as "teacher1" And I follow "Course 1" And I turn editing mode on And I delete "ForumUpdated" activity And I log out + And I wait "1" seconds # Students 1 and 2 see that forum was deleted And I log in as "student1" And I follow "Course 1" @@ -197,6 +203,7 @@ Feature: View structural changes in recent activity block And I should not see "ForumUpdated" in the "Recent activity" "block" And I should see "Deleted Forum" in the "Recent activity" "block" And I log out + And I wait "1" seconds # Student 3 never knew that forum was created, so he does not see anything And I log in as "student3" And I follow "Course 1" diff --git a/blocks/site_main_menu/tests/behat/edit_activities.feature b/blocks/site_main_menu/tests/behat/edit_activities.feature index 1569419d25a..dc73b9d1f7b 100644 --- a/blocks/site_main_menu/tests/behat/edit_activities.feature +++ b/blocks/site_main_menu/tests/behat/edit_activities.feature @@ -11,7 +11,7 @@ Feature: Edit activities in main menu block And I navigate to "Turn editing on" node in "Front page settings" When I add a "Forum" to section "0" and I fill the form with: | Forum name | My forum name | - And I click on "Edit title" "link" in the "//div[contains(@class,'block_site_main_menu')]//li[contains(.,'My forum name')]" "xpath_element" + And I click on "Edit title" "link" in the "//*[contains(@class,'block_site_main_menu')]//li[contains(.,'My forum name')]" "xpath_element" And I set the field "New name for activity My forum name" to "New forum name" And I press key "13" in the field "New name for activity My forum name" Then I should not see "My forum name" diff --git a/blocks/social_activities/tests/behat/edit_activities.feature b/blocks/social_activities/tests/behat/edit_activities.feature index 9433996cac5..07b58e391e0 100644 --- a/blocks/social_activities/tests/behat/edit_activities.feature +++ b/blocks/social_activities/tests/behat/edit_activities.feature @@ -21,7 +21,7 @@ Feature: Edit activities in social activities block And I set the field "Add an activity to section 'section 0'" to "Forum" And I set the field "Forum name" to "My forum name" And I press "Save and return to course" - And I click on "Edit title" "link" in the "//div[contains(@class,'block_social_activities')]//li[contains(.,'My forum name')]" "xpath_element" + And I click on "Edit title" "link" in the "//*[contains(@class,'block_social_activities')]//li[contains(.,'My forum name')]" "xpath_element" And I set the field "New name for activity My forum name" to "New forum name" And I press key "13" in the field "New name for activity My forum name" Then I should not see "My forum name" in the "Social activities" "block" diff --git a/blocks/tests/behat/configure_block_throughout_site.feature b/blocks/tests/behat/configure_block_throughout_site.feature index bf2e8b03df0..950fc3853d8 100644 --- a/blocks/tests/behat/configure_block_throughout_site.feature +++ b/blocks/tests/behat/configure_block_throughout_site.feature @@ -46,7 +46,7 @@ Feature: Add and configure blocks throughout the site And I press "Save changes" And I follow "Course 1" # The first block matching the pattern should be top-left block - And I should see "Comments" in the "//*[@id='region-pre' or @id='block-region-side-pre']/descendant::div[contains(concat(' ', normalize-space(@class), ' '), ' block ')]" "xpath_element" + And I should see "Comments" in the "//*[@id='region-pre' or @id='block-region-side-pre']/descendant::*[contains(concat(' ', normalize-space(@class), ' '), ' block ')]" "xpath_element" Scenario: Blocks on the dashboard page can have roles assigned to them Given I log in as "manager1" diff --git a/blocks/tests/behat/manage_blocks.feature b/blocks/tests/behat/manage_blocks.feature index 908825ae146..8cca1cf1b9a 100644 --- a/blocks/tests/behat/manage_blocks.feature +++ b/blocks/tests/behat/manage_blocks.feature @@ -52,7 +52,7 @@ Feature: Block appearances And I follow "Test survey name" And I should not see "Comments" - Scenario: Block settings can be modified so that a block can be hidden or moved + Scenario: Block settings can be modified so that a block can be hidden When I follow "Test book name" And I configure the "Comments" block And I set the following fields to these values: @@ -61,11 +61,3 @@ Feature: Block appearances And I follow "Turn editing off" And I follow "Test book name" Then I should not see "Comments" - And I expand "Course administration" node - And I follow "Turn editing on" - And I configure the "Comments" block - And I set the following fields to these values: - | Visible | Yes | - | Region | Right | - And I press "Save changes" - And I should see "Comments" in the "//*[@id='region-post' or @id='block-region-side-post']" "xpath_element" diff --git a/blocks/tests/behat/move_blocks.feature b/blocks/tests/behat/move_blocks.feature new file mode 100644 index 00000000000..8771a9fc787 --- /dev/null +++ b/blocks/tests/behat/move_blocks.feature @@ -0,0 +1,49 @@ +@core @core_block +Feature: Block region moving + In order to configure blocks appearance + As a teacher + I need to modify block region for the page + + Background: + Given the following "courses" exist: + | fullname | shortname | category | + | Course 1 | C1 | 0 | + And the following "users" exist: + | username | firstname | lastname | email | + | teacher1 | teacher | 1 | teacher1@example.com | + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + And I log in as "admin" + And I am on site homepage + And I follow "Course 1" + And I follow "Turn editing on" + And I add a "Survey" to section "1" and I fill the form with: + | Name | Test survey name | + | Survey type | ATTLS (20 item version) | + | Description | Test survey description | + And I add a "Book" to section "1" and I fill the form with: + | Name | Test book name | + | Description | Test book description | + And I follow "Test book name" + And I set the following fields to these values: + | Chapter title | Book title | + | Content | Book content test test | + And I press "Save changes" + And I log out + And I log in as "teacher1" + And I follow "Course 1" + And I follow "Turn editing on" + And I add the "Comments" block + And I configure the "Comments" block + And I set the following fields to these values: + | Display on page types | Any page | + And I press "Save changes" + + Scenario: Block settings can be modified so that a block can be moved + When I follow "Test book name" + And I configure the "Comments" block + And I set the following fields to these values: + | Region | Right | + And I press "Save changes" + And I should see "Comments" in the "//*[@id='region-post' or @id='block-region-side-post']" "xpath_element" diff --git a/course/classes/management_renderer.php b/course/classes/management_renderer.php index ed28b0322c7..9f0afc4debb 100644 --- a/course/classes/management_renderer.php +++ b/course/classes/management_renderer.php @@ -369,6 +369,12 @@ class core_course_management_renderer extends plugin_renderer_base { return $this->render($menu); } + public function render_action_menu($menu) { + global $OUTPUT; + + return $OUTPUT->render($menu); + } + /** * Renders bulk actions for categories. * diff --git a/course/tests/behat/course_controls.feature b/course/tests/behat/course_controls.feature index 8ce44783111..7dfb1c78b63 100644 --- a/course/tests/behat/course_controls.feature +++ b/course/tests/behat/course_controls.feature @@ -39,7 +39,7 @@ Feature: Course activity controls works as expected And I should see "Turn editing on" And "Turn editing on" "button" should exist And I turn editing mode on - And I click on "Actions" "link" in the "Recent activity" "block" + And I open the action menu in "Recent activity" "block" And I click on "Delete Recent activity block" "link" And I press "Yes" And "section" exist @@ -119,7 +119,7 @@ Feature: Course activity controls works as expected And I should see "Turn editing on" And "Turn editing on" "button" should exist And I turn editing mode on - And I click on "Actions" "link" in the "Recent activity" "block" + And I open the action menu in "Recent activity" "block" And I click on "Delete Recent activity block" "link" And I press "Yes" And "section" exist diff --git a/course/tests/behat/course_resort.feature b/course/tests/behat/course_resort.feature index f117146cad0..e8f9eb15bfd 100644 --- a/course/tests/behat/course_resort.feature +++ b/course/tests/behat/course_resort.feature @@ -172,4 +172,4 @@ Feature: Test we can resort course in the management interface. And I click to move course "C3" up one And a new page should not have loaded since I started watching And I should see course listing "Course 2" before "Course 3" - And I should see course listing "Course 3" before "Course 1" \ No newline at end of file + And I should see course listing "Course 3" before "Course 1" diff --git a/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-debug.js b/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-debug.js index 8aff8f7b101..b47c80f465f 100644 --- a/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-debug.js +++ b/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-debug.js @@ -113,8 +113,8 @@ Y.extend(DRAGSECTION, M.core.dragdrop, { moveup.next('br').remove(); } - if (moveup.ancestor('.section_action_menu')) { - moveup.ancestor('li').remove(); + if (moveup.ancestor('.section_action_menu') && moveup.ancestor().get('nodeName').toLowerCase() == 'li') { + moveup.ancestor().remove(); } else { moveup.remove(); } @@ -126,8 +126,9 @@ Y.extend(DRAGSECTION, M.core.dragdrop, { movedown.next('br').remove(); } - if (movedown.ancestor('.section_action_menu')) { - movedown.ancestor('li').remove(); + var movedownParentType = movedown.ancestor().get('nodeName').toLowerCase(); + if (movedown.ancestor('.section_action_menu') && movedownParentType == 'li') { + movedown.ancestor().remove(); } else { movedown.remove(); } diff --git a/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-min.js b/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-min.js index ba2426d363a..65266a54c03 100644 --- a/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-min.js +++ b/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-min.js @@ -1,2 +1,2 @@ -YUI.add("moodle-course-dragdrop",function(e,t){var n={ACTIONAREA:".actions",ACTIVITY:"activity",ACTIVITYINSTANCE:"activityinstance",CONTENT:"content",COURSECONTENT:"course-content",EDITINGMOVE:"editing_move",ICONCLASS:"iconsmall",JUMPMENU:"jumpmenu",LEFT:"left",LIGHTBOX:"lightbox",MOVEDOWN:"movedown",MOVEUP:"moveup",PAGECONTENT:"page-content",RIGHT:"right",SECTION:"section",SECTIONADDMENUS:"section_add_menus",SECTIONHANDLE:"section-handle",SUMMARY:"summary",SECTIONDRAGGABLE:"sectiondraggable"};M.course=M.course||{};var r=function(){r.superclass.constructor.apply(this,arguments)};e.extend(r,M.core.dragdrop,{sectionlistselector:null,initializer:function(){this.groups=[n.SECTIONDRAGGABLE],this.samenodeclass=M.course.format.get_sectionwrapperclass(),this.parentnodeclass=M.course.format.get_containerclass();if(e.Node.one("."+n.JUMPMENU))return!1;this.sectionlistselector=M.course.format.get_section_wrapper(e);if(this.sectionlistselector){this.sectionlistselector="."+n.COURSECONTENT+" "+this.sectionlistselector,this.setup_for_section(this.sectionlistselector);var t=new e.DD.Delegate({container:"."+n.COURSECONTENT,nodes:"."+n.SECTIONDRAGGABLE,target:!0,handles:["."+n.LEFT],dragConfig:{groups:this.groups}});t.dd.plug(e.Plugin.DDProxy,{moveOnEnd:!1}),t.dd.plug(e.Plugin.DDConstrained,{constrain:"#"+n.PAGECONTENT,stickY:!0}),t.dd.plug(e.Plugin.DDWinScroll)}},setup_for_section:function(t){e.Node.all(t).each(function(t){var r=e.Moodle.core_course.util.section.getId(t);if(r>0){var i=t.one("."+n.RIGHT+" a."+n.MOVEDOWN),s=t.one("."+n.RIGHT+" a."+n.MOVEUP),o=M.util.get_string("movesection","moodle",r),u=t.one("."+n.LEFT);(i||s)&&u&&(u.setStyle("cursor","move"),u.appendChild(this.get_drag_handle(o,n.SECTIONHANDLE,"icon",!0)),s&&(s.previous("br")?s.previous("br").remove():s.next("br")&&s.next("br").remove(),s.ancestor(".section_action_menu")?s.ancestor("li").remove():s.remove()),i&&(i.previous("br")?i.previous("br").remove():i.next("br")&&i.next("br").remove(),i.ancestor(".section_action_menu")?i.ancestor("li").remove():i.remove()),t.addClass(n.SECTIONDRAGGABLE))}},this)},drag_start:function(t){var r=t.target,i=e.Node.create("<"+M.course.format.get_containernode()+">");i.addClass(M.course.format.get_containerclass());var s=e.Node.create("<"+M.course.format.get_sectionwrappernode()+">");s.addClass(M.course.format.get_sectionwrapperclass()),s.setStyle("margin",0),s.setContent(r.get("node").get("innerHTML")),i.appendChild(s),r.get("dragNode").setContent(i),r.get("dragNode").addClass(n.COURSECONTENT)},drag_dropmiss:function(e){this.drop_hit(e)},get_section_index:function(t){var r="."+n.COURSECONTENT+" "+M.course.format.get_section_selector(e),i=e.all(r),s=i.indexOf(t),o=i.indexOf(e.one("#section-0"));return s-o},drop_hit:function(t){var r=t.drag,i=r.get("node"),s=e.Moodle.core_course.util.section.getId(i),o=s,u=this.get_section_index(i),a=u;if(s===u)return;o>a&&(o=u,a=s),r.get("dragNode").removeClass(n.COURSECONTENT);var f=e.Node.all(this.sectionlistselector),l=M.util.add_lightbox(e,i),c={},h=this.get("config").pageparams,p;for(p in h){if(!h.hasOwnProperty(p))continue;c[p]=h[p]}c.sesskey=M.cfg.sesskey,c.courseId=this.get("courseid"),c["class"]="section",c.field="move",c.id=s,c.value=u;var d=M.cfg.wwwroot+this.get("ajaxurl");e.io(d,{method:"POST",data:c,on:{start:function(){l.show()},success:function(t,n){try{var r=e.JSON.parse(n.responseText);r.error&&new M.core.ajaxException(r),M.course.format.process_sections(e,f,r,o,a)}catch(i){}var s,u=!1;do{u=!1;for(s=o;s<=a;s++)if(e.Moodle.core_course.util.section.getId(f.item(s-1))>e.Moodle.core_course.util.section.getId(f.item(s))){var c=f.item(s-1).get("id");f.item(s-1).set("id",f.item(s).get("id")),f.item(s).set("id",c),M.course.format.swap_sections(e,s-1,s),u=!0}a-=1}while(u);window.setTimeout(function(){l.hide()},250)},failure:function(e,t){this.ajax_failure(t),l.hide()}},context:this})}},{NAME:"course-dragdrop-section",ATTRS:{courseid:{value:null},ajaxurl:{value:0},config:{value:0}}}),M.course=M.course||{},M.course.init_section_dragdrop=function(e){new r(e)};var i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,M.core.dragdrop,{initializer:function(){this.groups=["resource"],this.samenodeclass=n.ACTIVITY,this.parentnodeclass=n.SECTION,this.resourcedraghandle=this.get_drag_handle(M.util.get_string("movecoursemodule","moodle"),n.EDITINGMOVE,n.ICONCLASS,!0),this.samenodelabel={identifier:"afterresource",component:"moodle"},this.parentnodelabel={identifier:"totopofsection",component:"moodle"};var t=M.course.format.get_section_selector(e);if(t){t="."+n.COURSECONTENT+" "+t,this.setup_for_section(t);var r=t.slice(n.COURSECONTENT.length+2)+" li."+n.ACTIVITY,i=new e.DD.Delegate({container:"."+n.COURSECONTENT,nodes:r,target:!0,handles:["."+n.EDITINGMOVE],dragConfig:{groups:this.groups}});i.dd.plug(e.Plugin.DDProxy,{moveOnEnd:!1,cloneNode:!0}),i.dd.plug(e.Plugin.DDConstrained,{constrain:"#"+n.PAGECONTENT}),i.dd.plug(e.Plugin.DDWinScroll),M.course.coursebase.register_module(this),M.course.dragres=this}},setup_for_section:function(t){e.Node.all(t).each(function(t){var r=t.one("."+n.CONTENT+" ul."+n.SECTION);r||(r=e.Node.create("
      "),r.addClass(n.SECTION),t.one("."+n.CONTENT+" div."+n.SUMMARY).insert(r,"after")),r.setAttribute("data-draggroups",this.groups.join(" ")),new e.DD.Drop({node:r,groups:this.groups,padding:"20 0 20 0"}),this.setup_for_resource("#"+t.get("id")+" li."+n.ACTIVITY)},this)},setup_for_resource:function(t){e.Node.all(t).each(function(t){var r=t.getData("draggroups");r||(t.setAttribute("data-draggroups",this.groups.join(" ")),new e.DD.Drop({node:t,groups:this.groups,padding:"20 0 20 0"}));var i=t.one("a."+n.EDITINGMOVE);i&&i.replace(this.resourcedraghandle.cloneNode(!0))},this)},drag_start:function(e){var t=e.target;t.get("dragNode").setContent(t.get("node").get("innerHTML")),t.get("dragNode").all("img.iconsmall").setStyle("vertical-align","baseline" -)},drag_dropmiss:function(e){this.drop_hit(e)},drop_hit:function(t){var r=t.drag,i=r.get("node"),s=t.drop.get("node"),o=i.one(n.ACTIONAREA),u=M.util.add_spinner(e,o),a={},f=this.get("config").pageparams,l;for(l in f)a[l]=f[l];a.sesskey=M.cfg.sesskey,a.courseId=this.get("courseid"),a["class"]="resource",a.field="move",a.id=Number(e.Moodle.core_course.util.cm.getId(i)),a.sectionId=e.Moodle.core_course.util.section.getId(s.ancestor(M.course.format.get_section_wrapper(e),!0)),i.next()&&(a.beforeId=Number(e.Moodle.core_course.util.cm.getId(i.next())));var c=M.cfg.wwwroot+this.get("ajaxurl");e.io(c,{method:"POST",data:a,on:{start:function(){this.lock_drag_handle(r,n.EDITINGMOVE),u.show()},success:function(t,s){var o=e.JSON.parse(s.responseText),a={element:i,visible:o.visible};M.course.coursebase.invoke_function("set_visibility_resource_ui",a),this.unlock_drag_handle(r,n.EDITINGMOVE),window.setTimeout(function(){u.hide()},250)},failure:function(e,t){this.ajax_failure(t),this.unlock_drag_handle(r,n.SECTIONHANDLE),u.hide()}},context:this})}},{NAME:"course-dragdrop-resource",ATTRS:{courseid:{value:null},ajaxurl:{value:0},config:{value:0}}}),M.course=M.course||{},M.course.init_resource_dragdrop=function(e){new i(e)}},"@VERSION@",{requires:["base","node","io","dom","dd","dd-scroll","moodle-core-dragdrop","moodle-core-notification","moodle-course-coursebase","moodle-course-util"]}); +YUI.add("moodle-course-dragdrop",function(e,t){var n={ACTIONAREA:".actions",ACTIVITY:"activity",ACTIVITYINSTANCE:"activityinstance",CONTENT:"content",COURSECONTENT:"course-content",EDITINGMOVE:"editing_move",ICONCLASS:"iconsmall",JUMPMENU:"jumpmenu",LEFT:"left",LIGHTBOX:"lightbox",MOVEDOWN:"movedown",MOVEUP:"moveup",PAGECONTENT:"page-content",RIGHT:"right",SECTION:"section",SECTIONADDMENUS:"section_add_menus",SECTIONHANDLE:"section-handle",SUMMARY:"summary",SECTIONDRAGGABLE:"sectiondraggable"};M.course=M.course||{};var r=function(){r.superclass.constructor.apply(this,arguments)};e.extend(r,M.core.dragdrop,{sectionlistselector:null,initializer:function(){this.groups=[n.SECTIONDRAGGABLE],this.samenodeclass=M.course.format.get_sectionwrapperclass(),this.parentnodeclass=M.course.format.get_containerclass();if(e.Node.one("."+n.JUMPMENU))return!1;this.sectionlistselector=M.course.format.get_section_wrapper(e);if(this.sectionlistselector){this.sectionlistselector="."+n.COURSECONTENT+" "+this.sectionlistselector,this.setup_for_section(this.sectionlistselector);var t=new e.DD.Delegate({container:"."+n.COURSECONTENT,nodes:"."+n.SECTIONDRAGGABLE,target:!0,handles:["."+n.LEFT],dragConfig:{groups:this.groups}});t.dd.plug(e.Plugin.DDProxy,{moveOnEnd:!1}),t.dd.plug(e.Plugin.DDConstrained,{constrain:"#"+n.PAGECONTENT,stickY:!0}),t.dd.plug(e.Plugin.DDWinScroll)}},setup_for_section:function(t){e.Node.all(t).each(function(t){var r=e.Moodle.core_course.util.section.getId(t);if(r>0){var i=t.one("."+n.RIGHT+" a."+n.MOVEDOWN),s=t.one("."+n.RIGHT+" a."+n.MOVEUP),o=M.util.get_string("movesection","moodle",r),u=t.one("."+n.LEFT);if((i||s)&&u){u.setStyle("cursor","move"),u.appendChild(this.get_drag_handle(o,n.SECTIONHANDLE,"icon",!0)),s&&(s.previous("br")?s.previous("br").remove():s.next("br")&&s.next("br").remove(),s.ancestor(".section_action_menu")&&s.ancestor().get("nodeName").toLowerCase()=="li"?s.ancestor().remove():s.remove());if(i){i.previous("br")?i.previous("br").remove():i.next("br")&&i.next("br").remove();var a=i.ancestor().get("nodeName").toLowerCase();i.ancestor(".section_action_menu")&&a=="li"?i.ancestor().remove():i.remove()}t.addClass(n.SECTIONDRAGGABLE)}}},this)},drag_start:function(t){var r=t.target,i=e.Node.create("<"+M.course.format.get_containernode()+">");i.addClass(M.course.format.get_containerclass());var s=e.Node.create("<"+M.course.format.get_sectionwrappernode()+">");s.addClass(M.course.format.get_sectionwrapperclass()),s.setStyle("margin",0),s.setContent(r.get("node").get("innerHTML")),i.appendChild(s),r.get("dragNode").setContent(i),r.get("dragNode").addClass(n.COURSECONTENT)},drag_dropmiss:function(e){this.drop_hit(e)},get_section_index:function(t){var r="."+n.COURSECONTENT+" "+M.course.format.get_section_selector(e),i=e.all(r),s=i.indexOf(t),o=i.indexOf(e.one("#section-0"));return s-o},drop_hit:function(t){var r=t.drag,i=r.get("node"),s=e.Moodle.core_course.util.section.getId(i),o=s,u=this.get_section_index(i),a=u;if(s===u)return;o>a&&(o=u,a=s),r.get("dragNode").removeClass(n.COURSECONTENT);var f=e.Node.all(this.sectionlistselector),l=M.util.add_lightbox(e,i),c={},h=this.get("config").pageparams,p;for(p in h){if(!h.hasOwnProperty(p))continue;c[p]=h[p]}c.sesskey=M.cfg.sesskey,c.courseId=this.get("courseid"),c["class"]="section",c.field="move",c.id=s,c.value=u;var d=M.cfg.wwwroot+this.get("ajaxurl");e.io(d,{method:"POST",data:c,on:{start:function(){l.show()},success:function(t,n){try{var r=e.JSON.parse(n.responseText);r.error&&new M.core.ajaxException(r),M.course.format.process_sections(e,f,r,o,a)}catch(i){}var s,u=!1;do{u=!1;for(s=o;s<=a;s++)if(e.Moodle.core_course.util.section.getId(f.item(s-1))>e.Moodle.core_course.util.section.getId(f.item(s))){var c=f.item(s-1).get("id");f.item(s-1).set("id",f.item(s).get("id")),f.item(s).set("id",c),M.course.format.swap_sections(e,s-1,s),u=!0}a-=1}while(u);window.setTimeout(function(){l.hide()},250)},failure:function(e,t){this.ajax_failure(t),l.hide()}},context:this})}},{NAME:"course-dragdrop-section",ATTRS:{courseid:{value:null},ajaxurl:{value:0},config:{value:0}}}),M.course=M.course||{},M.course.init_section_dragdrop=function(e){new r(e)};var i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,M.core.dragdrop,{initializer:function(){this.groups=["resource"],this.samenodeclass=n.ACTIVITY,this.parentnodeclass=n.SECTION,this.resourcedraghandle=this.get_drag_handle(M.util.get_string("movecoursemodule","moodle"),n.EDITINGMOVE,n.ICONCLASS,!0),this.samenodelabel={identifier:"afterresource",component:"moodle"},this.parentnodelabel={identifier:"totopofsection",component:"moodle"};var t=M.course.format.get_section_selector(e);if(t){t="."+n.COURSECONTENT+" "+t,this.setup_for_section(t);var r=t.slice(n.COURSECONTENT.length+2)+" li."+n.ACTIVITY,i=new e.DD.Delegate({container:"."+n.COURSECONTENT,nodes:r,target:!0,handles:["."+n.EDITINGMOVE],dragConfig:{groups:this.groups}});i.dd.plug(e.Plugin.DDProxy,{moveOnEnd:!1,cloneNode:!0}),i.dd.plug(e.Plugin.DDConstrained,{constrain:"#"+n.PAGECONTENT}),i.dd.plug(e.Plugin.DDWinScroll),M.course.coursebase.register_module(this),M.course.dragres=this}},setup_for_section:function(t){e.Node.all(t).each(function(t){var r=t.one("."+n.CONTENT+" ul."+n.SECTION);r||(r=e.Node.create("
        "),r.addClass(n.SECTION),t.one("."+n.CONTENT+" div."+n.SUMMARY).insert(r,"after")),r.setAttribute("data-draggroups",this.groups.join(" ")),new e.DD.Drop({node:r,groups:this.groups,padding:"20 0 20 0"}),this.setup_for_resource("#"+t.get("id")+" li."+n.ACTIVITY)},this)},setup_for_resource:function(t){e.Node.all(t).each(function(t){var r=t.getData("draggroups");r||(t.setAttribute("data-draggroups",this.groups.join(" ")),new e.DD.Drop({node:t,groups:this.groups,padding:"20 0 20 0"}));var i=t.one("a."+n.EDITINGMOVE);i&&i.replace(this.resourcedraghandle.cloneNode(!0))},this)},drag_start:function(e){var t=e.target;t.get("dragNode").setContent( +t.get("node").get("innerHTML")),t.get("dragNode").all("img.iconsmall").setStyle("vertical-align","baseline")},drag_dropmiss:function(e){this.drop_hit(e)},drop_hit:function(t){var r=t.drag,i=r.get("node"),s=t.drop.get("node"),o=i.one(n.ACTIONAREA),u=M.util.add_spinner(e,o),a={},f=this.get("config").pageparams,l;for(l in f)a[l]=f[l];a.sesskey=M.cfg.sesskey,a.courseId=this.get("courseid"),a["class"]="resource",a.field="move",a.id=Number(e.Moodle.core_course.util.cm.getId(i)),a.sectionId=e.Moodle.core_course.util.section.getId(s.ancestor(M.course.format.get_section_wrapper(e),!0)),i.next()&&(a.beforeId=Number(e.Moodle.core_course.util.cm.getId(i.next())));var c=M.cfg.wwwroot+this.get("ajaxurl");e.io(c,{method:"POST",data:a,on:{start:function(){this.lock_drag_handle(r,n.EDITINGMOVE),u.show()},success:function(t,s){var o=e.JSON.parse(s.responseText),a={element:i,visible:o.visible};M.course.coursebase.invoke_function("set_visibility_resource_ui",a),this.unlock_drag_handle(r,n.EDITINGMOVE),window.setTimeout(function(){u.hide()},250)},failure:function(e,t){this.ajax_failure(t),this.unlock_drag_handle(r,n.SECTIONHANDLE),u.hide()}},context:this})}},{NAME:"course-dragdrop-resource",ATTRS:{courseid:{value:null},ajaxurl:{value:0},config:{value:0}}}),M.course=M.course||{},M.course.init_resource_dragdrop=function(e){new i(e)}},"@VERSION@",{requires:["base","node","io","dom","dd","dd-scroll","moodle-core-dragdrop","moodle-core-notification","moodle-course-coursebase","moodle-course-util"]}); diff --git a/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop.js b/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop.js index 956f3e337e3..bd057c87b34 100644 --- a/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop.js +++ b/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop.js @@ -113,8 +113,8 @@ Y.extend(DRAGSECTION, M.core.dragdrop, { moveup.next('br').remove(); } - if (moveup.ancestor('.section_action_menu')) { - moveup.ancestor('li').remove(); + if (moveup.ancestor('.section_action_menu') && moveup.ancestor().get('nodeName').toLowerCase() == 'li') { + moveup.ancestor().remove(); } else { moveup.remove(); } @@ -126,8 +126,9 @@ Y.extend(DRAGSECTION, M.core.dragdrop, { movedown.next('br').remove(); } - if (movedown.ancestor('.section_action_menu')) { - movedown.ancestor('li').remove(); + var movedownParentType = movedown.ancestor().get('nodeName').toLowerCase(); + if (movedown.ancestor('.section_action_menu') && movedownParentType == 'li') { + movedown.ancestor().remove(); } else { movedown.remove(); } diff --git a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-debug.js b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-debug.js index 84040908216..f530680b8c0 100644 --- a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-debug.js +++ b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-debug.js @@ -10,7 +10,7 @@ var CSS = { PAGECONTENT: 'body', SECTION: null, SECTIONMODCHOOSER: 'span.section-modchooser-link', - SITEMENU: 'div.block_site_main_menu', + SITEMENU: '.block_site_main_menu', SITETOPIC: 'div.sitetopic' }; diff --git a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-min.js b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-min.js index a690c8a44c7..703d3381254 100644 --- a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-min.js +++ b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-min.js @@ -1 +1 @@ -YUI.add("moodle-course-modchooser",function(e,t){var n={PAGECONTENT:"body",SECTION:null,SECTIONMODCHOOSER:"span.section-modchooser-link",SITEMENU:"div.block_site_main_menu",SITETOPIC:"div.sitetopic"},r="course-modchooser",i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,M.core.chooserdialogue,{sectionid:null,initializer:function(){var t=M.course.format.get_sectionwrapperclass();t&&(n.SECTION="."+t);var r=e.one(".chooserdialoguebody"),i=e.one(".choosertitle"),s={};this.setup_chooser_dialogue(r,i,s),this.setup_for_section(),M.course.coursebase.register_module(this)},setup_for_section:function(t){t||(t=n.PAGECONTENT),e.one(t).all(n.SITETOPIC).each(function(e){this._setup_for_section(e)},this),n.SECTION&&e.one(t).all(n.SECTION).each(function(e){this._setup_for_section(e)},this),e.one(t).all(n.SITEMENU).each(function(e){this._setup_for_section(e)},this)},_setup_for_section:function(t){var r=t.one(n.SECTIONMODCHOOSER);if(!r)return;var i=e.Node.create("
        ");r.get("children").each(function(e){i.appendChild(e)}),r.insertBefore(i),i.on("click",this.display_mod_chooser,this)},display_mod_chooser:function(e){if(e.target.ancestor(n.SITETOPIC))this.sectionid=1;else if(e.target.ancestor(n.SECTION)){var t=e.target.ancestor(n.SECTION);this.sectionid=t.get("id").replace("section-","")}else e.target.ancestor(n.SITEMENU)&&(this.sectionid=0);this.display_chooser(e)},option_selected:function(e){this.hiddenRadioValue.setAttrs({name:"jump",value:e.get("value")+"§ion="+this.sectionid})}},{NAME:r,ATTRS:{maxheight:{value:800}}}),M.course=M.course||{},M.course.init_chooser=function(e){return new i(e)}},"@VERSION@",{requires:["moodle-core-chooserdialogue","moodle-course-coursebase"]}); +YUI.add("moodle-course-modchooser",function(e,t){var n={PAGECONTENT:"body",SECTION:null,SECTIONMODCHOOSER:"span.section-modchooser-link",SITEMENU:".block_site_main_menu",SITETOPIC:"div.sitetopic"},r="course-modchooser",i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,M.core.chooserdialogue,{sectionid:null,initializer:function(){var t=M.course.format.get_sectionwrapperclass();t&&(n.SECTION="."+t);var r=e.one(".chooserdialoguebody"),i=e.one(".choosertitle"),s={};this.setup_chooser_dialogue(r,i,s),this.setup_for_section(),M.course.coursebase.register_module(this)},setup_for_section:function(t){t||(t=n.PAGECONTENT),e.one(t).all(n.SITETOPIC).each(function(e){this._setup_for_section(e)},this),n.SECTION&&e.one(t).all(n.SECTION).each(function(e){this._setup_for_section(e)},this),e.one(t).all(n.SITEMENU).each(function(e){this._setup_for_section(e)},this)},_setup_for_section:function(t){var r=t.one(n.SECTIONMODCHOOSER);if(!r)return;var i=e.Node.create("");r.get("children").each(function(e){i.appendChild(e)}),r.insertBefore(i),i.on("click",this.display_mod_chooser,this)},display_mod_chooser:function(e){if(e.target.ancestor(n.SITETOPIC))this.sectionid=1;else if(e.target.ancestor(n.SECTION)){var t=e.target.ancestor(n.SECTION);this.sectionid=t.get("id").replace("section-","")}else e.target.ancestor(n.SITEMENU)&&(this.sectionid=0);this.display_chooser(e)},option_selected:function(e){this.hiddenRadioValue.setAttrs({name:"jump",value:e.get("value")+"§ion="+this.sectionid})}},{NAME:r,ATTRS:{maxheight:{value:800}}}),M.course=M.course||{},M.course.init_chooser=function(e){return new i(e)}},"@VERSION@",{requires:["moodle-core-chooserdialogue","moodle-course-coursebase"]}); diff --git a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser.js b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser.js index 84040908216..f530680b8c0 100644 --- a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser.js +++ b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser.js @@ -10,7 +10,7 @@ var CSS = { PAGECONTENT: 'body', SECTION: null, SECTIONMODCHOOSER: 'span.section-modchooser-link', - SITEMENU: 'div.block_site_main_menu', + SITEMENU: '.block_site_main_menu', SITETOPIC: 'div.sitetopic' }; diff --git a/course/yui/src/dragdrop/js/section.js b/course/yui/src/dragdrop/js/section.js index 452e410c94c..efbb73e48f2 100644 --- a/course/yui/src/dragdrop/js/section.js +++ b/course/yui/src/dragdrop/js/section.js @@ -81,8 +81,8 @@ Y.extend(DRAGSECTION, M.core.dragdrop, { moveup.next('br').remove(); } - if (moveup.ancestor('.section_action_menu')) { - moveup.ancestor('li').remove(); + if (moveup.ancestor('.section_action_menu') && moveup.ancestor().get('nodeName').toLowerCase() == 'li') { + moveup.ancestor().remove(); } else { moveup.remove(); } @@ -94,8 +94,9 @@ Y.extend(DRAGSECTION, M.core.dragdrop, { movedown.next('br').remove(); } - if (movedown.ancestor('.section_action_menu')) { - movedown.ancestor('li').remove(); + var movedownParentType = movedown.ancestor().get('nodeName').toLowerCase(); + if (movedown.ancestor('.section_action_menu') && movedownParentType == 'li') { + movedown.ancestor().remove(); } else { movedown.remove(); } diff --git a/course/yui/src/modchooser/js/modchooser.js b/course/yui/src/modchooser/js/modchooser.js index 4ea2619a019..6c75c604149 100644 --- a/course/yui/src/modchooser/js/modchooser.js +++ b/course/yui/src/modchooser/js/modchooser.js @@ -8,7 +8,7 @@ var CSS = { PAGECONTENT: 'body', SECTION: null, SECTIONMODCHOOSER: 'span.section-modchooser-link', - SITEMENU: 'div.block_site_main_menu', + SITEMENU: '.block_site_main_menu', SITETOPIC: 'div.sitetopic' }; diff --git a/grade/edit/tree/lib.php b/grade/edit/tree/lib.php index a7b7d064b75..f1b78f00658 100644 --- a/grade/edit/tree/lib.php +++ b/grade/edit/tree/lib.php @@ -128,7 +128,6 @@ class grade_edit_tree { $moveaction = ''; $actionsmenu = new action_menu(); - $actionsmenu->initialise_js($PAGE); $actionsmenu->set_menu_trigger(get_string('edit')); $actionsmenu->set_owner_selector('grade-item-' . $eid); $actionsmenu->set_alignment(action_menu::TL, action_menu::BL); diff --git a/grade/report/singleview/tests/behat/bulk_insert_grades.feature b/grade/report/singleview/tests/behat/bulk_insert_grades.feature index ce9905d498a..9b40f473022 100644 --- a/grade/report/singleview/tests/behat/bulk_insert_grades.feature +++ b/grade/report/singleview/tests/behat/bulk_insert_grades.feature @@ -82,8 +82,8 @@ Feature: We can bulk insert grades for students in a course And I press "Ok" And I follow "Edit settings" And I follow "View gradebook" - And I click on "input[title='Dock Navigation block']" "css_element" - And I click on "input[title='Dock Administration block']" "css_element" + # And I click on "input[title='Dock Navigation block']" "css_element" + # And I click on "input[title='Dock Administration block']" "css_element" And I follow "Single view for Test assignment two" And I select "Student 1" from the "Select user..." singleselect Then the field "Grade for Test assignment two" matches value "50.00" diff --git a/grade/tests/behat/grade_calculated_grade_items.feature b/grade/tests/behat/grade_calculated_grade_items.feature index aa07eab4f5f..3eb9dfe6133 100644 --- a/grade/tests/behat/grade_calculated_grade_items.feature +++ b/grade/tests/behat/grade_calculated_grade_items.feature @@ -162,4 +162,4 @@ Feature: Calculated grade items can be used in the gradebook | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total | | grade item 1 | 71.43 % | 65.00 | 0–100 | 65.00 % | 46.43 % | | calc item | 28.57 % | 32.50 | 0–40 | 81.25 % | 23.21 % | - | Course total | - | 97.50 | 0–140 | 69.64 % | - | \ No newline at end of file + | Course total | - | 97.50 | 0–140 | 69.64 % | - | diff --git a/grade/tests/behat/grade_calculated_grade_items_20150627.feature b/grade/tests/behat/grade_calculated_grade_items_20150627.feature index 87eeb8f8bc4..1199365a985 100644 --- a/grade/tests/behat/grade_calculated_grade_items_20150627.feature +++ b/grade/tests/behat/grade_calculated_grade_items_20150627.feature @@ -163,4 +163,4 @@ Feature: Gradebook calculations for calculated grade items before the fix 201506 | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total | | grade item 1 | 50.00 % | 65.00 | 0–100 | 65.00 % | 32.50 % | | calc item | 50.00 % | 32.50 | 0–100 | 32.50 % | 16.25 % | - | Course total | - | 97.50 | 0–200 | 48.75 % | - | \ No newline at end of file + | Course total | - | 97.50 | 0–200 | 48.75 % | - | diff --git a/grade/tests/behat/grade_category_validation.feature b/grade/tests/behat/grade_category_validation.feature index 0388b883763..9f2e0f13261 100644 --- a/grade/tests/behat/grade_category_validation.feature +++ b/grade/tests/behat/grade_category_validation.feature @@ -77,7 +77,7 @@ Feature: Editing a grade item And I click on "Edit" "link" in the "Cat 1" "table_row" When I click on "Edit settings" "link" in the "Cat 1" "table_row" Then I should see "This category has associated grade items which have been overridden. Therefore some grades have already been awarded, so the grade type cannot be changed. If you wish to change the maximum grade, you must first choose whether or not to rescale existing grades." - And "//div[contains(concat(' ', normalize-space(@class), ' '), 'fstatic') and contains(text(), 'Value')]" "xpath_element" should exist + And "//div[contains(concat(' ', normalize-space(@class), ' '), 'felement') and contains(text(), 'Value')]" "xpath_element" should exist Scenario: Attempting to change a category item's scale when overridden grades already exist Given I click on "Edit" "link" in the "Cat 1" "table_row" @@ -93,7 +93,7 @@ Feature: Editing a grade item And I click on "Edit" "link" in the "Cat 1" "table_row" When I click on "Edit settings" "link" in the "Cat 1" "table_row" Then I should see "This category has associated grade items which have been overridden. Therefore some grades have already been awarded, so the grade type and scale cannot be changed." - And "//div[contains(concat(' ', normalize-space(@class), ' '), 'fstatic') and contains(text(), 'ABCDEF')]" "xpath_element" should exist + And "//div[contains(concat(' ', normalize-space(@class), ' '), 'felement') and contains(text(), 'ABCDEF')]" "xpath_element" should exist Scenario: Attempting to change a category item's maximum grade when no rescaling option has been chosen Given I navigate to "Grader report" node in "Grade administration" diff --git a/grade/tests/behat/grade_item_validation.feature b/grade/tests/behat/grade_item_validation.feature index 541922f507c..d9b19c9fcc9 100644 --- a/grade/tests/behat/grade_item_validation.feature +++ b/grade/tests/behat/grade_item_validation.feature @@ -62,7 +62,7 @@ Feature: Editing a grade item And I click on "Edit" "link" in the "MI 1" "table_row" When I click on "Edit settings" "link" in the "MI 1" "table_row" Then I should see "Some grades have already been awarded, so the grade type cannot be changed. If you wish to change the maximum grade, you must first choose whether or not to rescale existing grades." - And "//div[contains(concat(' ', normalize-space(@class), ' '), 'fstatic') and contains(text(), 'Value')]" "xpath_element" should exist + And "//div[contains(concat(' ', normalize-space(@class), ' '), 'felement') and contains(text(), 'Value')]" "xpath_element" should exist Scenario: Attempting to change a manual item's scale when grades already exist Given I click on "Edit" "link" in the "MI 1" "table_row" @@ -78,7 +78,7 @@ Feature: Editing a grade item And I click on "Edit" "link" in the "MI 1" "table_row" When I click on "Edit settings" "link" in the "MI 1" "table_row" Then I should see "Some grades have already been awarded, so the grade type and scale cannot be changed." - And "//div[contains(concat(' ', normalize-space(@class), ' '), 'fstatic') and contains(text(), 'ABCDEF')]" "xpath_element" should exist + And "//div[contains(concat(' ', normalize-space(@class), ' '), 'felement') and contains(text(), 'ABCDEF')]" "xpath_element" should exist Scenario: Attempting to change a manual item's maximum grade when no rescaling option has been chosen Given I navigate to "Grader report" node in "Grade administration" diff --git a/grade/tests/behat/grade_letter_boundary.feature b/grade/tests/behat/grade_letter_boundary.feature index 210732ae9a8..73c04f1e225 100644 --- a/grade/tests/behat/grade_letter_boundary.feature +++ b/grade/tests/behat/grade_letter_boundary.feature @@ -40,4 +40,4 @@ Feature: We can customise the letter boundary of a course. And I press "Turn editing off" Then the following should exist in the "user-grades" table: | -1- | -4- | -5- | - | Student 1 | D | D | \ No newline at end of file + | Student 1 | D | D | diff --git a/grade/tests/behat/grade_letter_boundary_20160518.feature b/grade/tests/behat/grade_letter_boundary_20160518.feature index 47fcb565231..e451824f76e 100644 --- a/grade/tests/behat/grade_letter_boundary_20160518.feature +++ b/grade/tests/behat/grade_letter_boundary_20160518.feature @@ -41,4 +41,4 @@ Feature: We can customise the letter boundary of a course. And I press "Turn editing off" Then the following should exist in the "user-grades" table: | -1- | -4- | -5- | - | Student 1 | F | F | \ No newline at end of file + | Student 1 | F | F | diff --git a/grade/tests/behat/grade_to_pass.feature b/grade/tests/behat/grade_to_pass.feature index 7125b6232b2..55ec7b4d799 100644 --- a/grade/tests/behat/grade_to_pass.feature +++ b/grade/tests/behat/grade_to_pass.feature @@ -134,8 +134,8 @@ Feature: We can set the grade to pass value | Submission grade to pass | 90 | | gradinggrade | 20 | | Assessment grade to pass | 30 | - Then "The grade to pass can not be greater than the maximum possible grade 80" "text" should exist in the "#fitem_id_submissiongradepass .error" "css_element" - Then "The grade to pass can not be greater than the maximum possible grade 20" "text" should exist in the "#fitem_id_gradinggradepass .error" "css_element" + Then "The grade to pass can not be greater than the maximum possible grade 80" "text" should exist in the "Submission grade to pass" "form_row" + Then "The grade to pass can not be greater than the maximum possible grade 20" "text" should exist in the "Assessment grade to pass" "form_row" Scenario: Set a valid grade to pass for quiz activity When I turn editing mode on diff --git a/lib/amd/build/tag.min.js b/lib/amd/build/tag.min.js index 947356017ea..b87b6ecfd25 100644 --- a/lib/amd/build/tag.min.js +++ b/lib/amd/build/tag.min.js @@ -1 +1 @@ -define(["jquery","core/ajax","core/templates","core/notification","core/str"],function(a,b,c,d,e){return{initTagindexPage:function(){a("body").delegate(".tagarea[data-ta] a[data-quickload=1]","click",function(d){d.preventDefault();var e=a(this),f=e[0].search.replace(/^\?/,""),g=e.closest(".tagarea[data-ta]"),h=f.split("&").reduce(function(a,b){var c=b.split("=");return a[c[0]]=decodeURIComponent(c[1]),a},{}),i=b.call([{methodname:"core_tag_get_tagindex",args:{tagindex:h}}],!0);a.when.apply(a,i).done(function(a){c.render("core_tag/index",a).done(function(a){g.replaceWith(a)})})})},initManagePage:function(){a("body").on("updated","[data-inplaceeditable]",function(b){if(e.get_string("now").done(function(c){a(b.target).closest("tr").find("td.col-timemodified").html(c)}),"tagflag"===b.ajaxreturn.itemtype){var c=a(b.target).closest("tr");"0"===b.ajaxreturn.value?c.removeClass("flagged-tag"):c.addClass("flagged-tag")}}),a(".tag-management-table").delegate("a.tagdelete","click",function(b){b.preventDefault();var c=a(this).attr("href");e.get_strings([{key:"delete"},{key:"confirmdeletetag",component:"tag"},{key:"yes"},{key:"no"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],function(){window.location.href=c})})}),a("#tag-management-delete").click(function(b){var c=a(this).closest("form").get(0),f=a(c).find("input[type=checkbox]:checked").length;if(f){var g=a("").attr("name",this.name);b.preventDefault(),e.get_strings([{key:"delete"},{key:"confirmdeletetags",component:"tag"},{key:"yes"},{key:"no"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],function(){g.appendTo(c),c.submit()})})}}),a("#tag-management-combine").click(function(b){b.preventDefault();var c=a(this).closest("form").get(0),f=a(c).find("input[type=checkbox]:checked");if(f.length<=1)return void e.get_strings([{key:"combineselected",component:"tag"},{key:"selectmultipletags",component:"tag"},{key:"ok"}]).done(function(a){d.alert(a[0],a[1],a[2])});var g=a("").attr("name",this.name);e.get_strings([{key:"combineselected",component:"tag"},{key:"selectmaintag",component:"tag"},{key:"continue"},{key:"cancel"}]).done(function(b){var d=a('

        ');d.find(".description").html(b[1]),d.find("#combinetags_submit").attr("value",b[2]),d.find("#combinetags_cancel").attr("value",b[3]);var e=d.find(".options");f.each(function(){var b=a(this).val(),c=a(".inplaceeditable[data-itemtype=tagname][data-itemid="+b+"]").attr("data-value");e.append(a('
        "))});var h=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,headerContent:b[0],bodyContent:d.html()});h.show(),a("#combinetags_form input[type=radio]").first().focus().prop("checked",!0),a("#combinetags_form #combinetags_cancel").on("click",function(){h.destroy()}),a("#combinetags_form").on("submit",function(){g.appendTo(c);var b=a("input[name=maintag]:checked","#combinetags_form").val();return a("").attr("name","maintag").attr("value",b).appendTo(c),c.submit(),!1})})}),a("body").on("updatefailed","[data-inplaceeditable][data-itemtype=tagname]",function(b){var c=b.exception,f=b.newvalue,g=a(b.target).attr("data-itemid");"namesalreadybeeingused"===c.errorcode&&(b.preventDefault(),e.get_strings([{key:"nameuseddocombine",component:"tag"},{key:"yes"},{key:"cancel"}]).done(function(a){d.confirm(b.message,a[0],a[1],a[2],function(){window.location.href=window.location.href+"&newname="+encodeURIComponent(f)+"&tagid="+encodeURIComponent(g)+"&action=renamecombine&sesskey="+M.cfg.sesskey})}))}),a("body").on("click","a[data-action=addstandardtag]",function(b){b.preventDefault(),e.get_strings([{key:"addotags",component:"tag"},{key:"inputstandardtags",component:"tag"},{key:"continue"},{key:"cancel"}]).done(function(b){var c=a('

        ');c.find("#addtags_form").attr("action",window.location.href),c.find("#addtags_submit").attr("value",b[2]),c.find("#addtags_cancel").attr("value",b[3]);var d=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,headerContent:b[0],bodyContent:c.html()});d.show(),a("#addtags_form input[type=text]").focus(),a("#addtags_form #addtags_cancel").on("click",function(){d.destroy()})})})},initManageCollectionsPage:function(){a("body").on("updated","[data-inplaceeditable]",function(b){var c,d,e,f=b.ajaxreturn;"core_tag"===f.component&&"tagareaenable"===f.itemtype&&(c=a(this).attr("data-itemid"),a(".tag-collections-table ul[data-collectionid] li[data-areaid="+c+"]").addClass("hidden"),e=f.value,"1"===e?(a(this).closest("tr").removeClass("dimmed_text"),d=a(this).closest("tr").find('[data-itemtype="tagareacollection"]').attr("data-value"),a(".tag-collections-table ul[data-collectionid="+d+"] li[data-areaid="+c+"]").removeClass("hidden")):a(this).closest("tr").addClass("dimmed_text")),"core_tag"===f.component&&"tagareacollection"===f.itemtype&&(c=a(this).attr("data-itemid"),a(".tag-collections-table ul[data-collectionid] li[data-areaid="+c+"]").addClass("hidden"),d=a(this).attr("data-value"),e=a(this).closest("tr").find('[data-itemtype="tagareaenable"]').attr("data-value"),"1"===e&&a(".tag-collections-table ul[data-collectionid="+d+"] li[data-areaid="+c+"]").removeClass("hidden"))}),a("body").on("click",".addtagcoll > a",function(b){b.preventDefault();var c=a(this).attr("data-url")+"&sesskey="+M.cfg.sesskey;e.get_strings([{key:"addtagcoll",component:"tag"},{key:"name"},{key:"searchable",component:"tag"},{key:"create"},{key:"cancel"}]).done(function(b){var d=a('

        :

        :

        ');d.find('label[for="addtagcoll_name"]').html(b[1]),d.find('label[for="addtagcoll_searchable"]').html(b[2]),d.find("#addtagcoll_submit").attr("value",b[3]),d.find("#addtagcoll_cancel").attr("value",b[4]);var e=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,headerContent:b[0],bodyContent:d.html()});e.show(),a("#addtagcoll_form #addtagcoll_name").focus(),a("#addtagcoll_form #addtagcoll_cancel").on("click",function(){e.destroy()}),a("#addtagcoll_form").on("submit",function(){var b=a("#addtagcoll_form #addtagcoll_name").val(),d=a("#addtagcoll_form #addtagcoll_searchable").prop("checked")?1:0;return String(b).length>0&&(window.location.href=c+"&name="+encodeURIComponent(b)+"&searchable="+d),!1})})}),a("body").on("click",".tag-collections-table .action_delete",function(b){b.preventDefault();var c=a(this).attr("data-url")+"&sesskey="+M.cfg.sesskey;e.get_strings([{key:"delete"},{key:"suredeletecoll",component:"tag",param:a(this).attr("data-collname")},{key:"yes"},{key:"no"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],function(){window.location.href=c})})})}}}); \ No newline at end of file +define(["jquery","core/ajax","core/templates","core/notification","core/str"],function(a,b,c,d,e){return{initTagindexPage:function(){a("body").delegate(".tagarea[data-ta] a[data-quickload=1]","click",function(d){d.preventDefault();var e=a(this),f=e[0].search.replace(/^\?/,""),g=e.closest(".tagarea[data-ta]"),h=f.split("&").reduce(function(a,b){var c=b.split("=");return a[c[0]]=decodeURIComponent(c[1]),a},{}),i=b.call([{methodname:"core_tag_get_tagindex",args:{tagindex:h}}],!0);a.when.apply(a,i).done(function(a){c.render("core_tag/index",a).done(function(a){g.replaceWith(a)})})})},initManagePage:function(){a("body").on("updated","[data-inplaceeditable]",function(b){if(e.get_string("now").done(function(c){a(b.target).closest("tr").find("td.col-timemodified").html(c)}),"tagflag"===b.ajaxreturn.itemtype){var c=a(b.target).closest("tr");"0"===b.ajaxreturn.value?c.removeClass("flagged-tag"):c.addClass("flagged-tag")}}),a(".tag-management-table").delegate("a.tagdelete","click",function(b){b.preventDefault();var c=a(this).attr("href");e.get_strings([{key:"delete"},{key:"confirmdeletetag",component:"tag"},{key:"yes"},{key:"no"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],function(){window.location.href=c})})}),a("#tag-management-delete").click(function(b){var c=a(this).closest("form").get(0),f=a(c).find("input[type=checkbox]:checked").length;if(f){var g=a("").attr("name",this.name);b.preventDefault(),e.get_strings([{key:"delete"},{key:"confirmdeletetags",component:"tag"},{key:"yes"},{key:"no"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],function(){g.appendTo(c),c.submit()})})}}),a("#tag-management-combine").click(function(b){b.preventDefault();var c=a(this).closest("form").get(0),f=a(c).find("input[type=checkbox]:checked");if(f.length<=1)return void e.get_strings([{key:"combineselected",component:"tag"},{key:"selectmultipletags",component:"tag"},{key:"ok"}]).done(function(a){d.alert(a[0],a[1],a[2])});var g=a("").attr("name",this.name);e.get_strings([{key:"combineselected",component:"tag"},{key:"selectmaintag",component:"tag"},{key:"continue"},{key:"cancel"}]).done(function(b){var d=a('

        ');d.find(".description").html(b[1]),d.find("#combinetags_submit").attr("value",b[2]),d.find("#combinetags_cancel").attr("value",b[3]);var e=d.find(".options");f.each(function(){var b=a(this).val(),c=a(".inplaceeditable[data-itemtype=tagname][data-itemid="+b+"]").attr("data-value");e.append(a('
        "))});var h=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,headerContent:b[0],bodyContent:d.html()});h.show(),a("#combinetags_form input[type=radio]").first().focus().prop("checked",!0),a("#combinetags_form #combinetags_cancel").on("click",function(){h.destroy()}),a("#combinetags_form").on("submit",function(){g.appendTo(c);var b=a("input[name=maintag]:checked","#combinetags_form").val();return a("").attr("name","maintag").attr("value",b).appendTo(c),c.submit(),!1})})}),a("body").on("updatefailed","[data-inplaceeditable][data-itemtype=tagname]",function(b){var c=b.exception,f=b.newvalue,g=a(b.target).attr("data-itemid");"namesalreadybeeingused"===c.errorcode&&(b.preventDefault(),e.get_strings([{key:"nameuseddocombine",component:"tag"},{key:"yes"},{key:"cancel"}]).done(function(a){d.confirm(b.message,a[0],a[1],a[2],function(){window.location.href=window.location.href+"&newname="+encodeURIComponent(f)+"&tagid="+encodeURIComponent(g)+"&action=renamecombine&sesskey="+M.cfg.sesskey})}))}),a("body").on("click","a[data-action=addstandardtag]",function(b){b.preventDefault(),e.get_strings([{key:"addotags",component:"tag"},{key:"inputstandardtags",component:"tag"},{key:"continue"},{key:"cancel"}]).done(function(b){var c=a('

        ');c.find("#addtags_form").attr("action",window.location.href),c.find("#addtags_submit").attr("value",b[2]),c.find("#addtags_cancel").attr("value",b[3]);var d=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,headerContent:b[0],bodyContent:c.html()});d.show(),a("#addtags_form input[type=text]").focus(),a("#addtags_form #addtags_cancel").on("click",function(){d.destroy()})})})},initManageCollectionsPage:function(){a("body").on("updated","[data-inplaceeditable]",function(b){var c,d,e,f=b.ajaxreturn;"core_tag"===f.component&&"tagareaenable"===f.itemtype&&(c=a(this).attr("data-itemid"),a(".tag-collections-table ul[data-collectionid] li[data-areaid="+c+"]").hide(),e=f.value,"1"===e?(a(this).closest("tr").removeClass("dimmed_text"),d=a(this).closest("tr").find('[data-itemtype="tagareacollection"]').attr("data-value"),a(".tag-collections-table ul[data-collectionid="+d+"] li[data-areaid="+c+"]").show()):a(this).closest("tr").addClass("dimmed_text")),"core_tag"===f.component&&"tagareacollection"===f.itemtype&&(c=a(this).attr("data-itemid"),a(".tag-collections-table ul[data-collectionid] li[data-areaid="+c+"]").hide(),d=a(this).attr("data-value"),e=a(this).closest("tr").find('[data-itemtype="tagareaenable"]').attr("data-value"),"1"===e&&a(".tag-collections-table ul[data-collectionid="+d+"] li[data-areaid="+c+"]").show())}),a("body").on("click",".addtagcoll > a",function(b){b.preventDefault();var c=a(this).attr("data-url")+"&sesskey="+M.cfg.sesskey;e.get_strings([{key:"addtagcoll",component:"tag"},{key:"name"},{key:"searchable",component:"tag"},{key:"create"},{key:"cancel"}]).done(function(b){var d=a('

        :

        :

        ');d.find('label[for="addtagcoll_name"]').html(b[1]),d.find('label[for="addtagcoll_searchable"]').html(b[2]),d.find("#addtagcoll_submit").attr("value",b[3]),d.find("#addtagcoll_cancel").attr("value",b[4]);var e=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,headerContent:b[0],bodyContent:d.html()});e.show(),a("#addtagcoll_form #addtagcoll_name").focus(),a("#addtagcoll_form #addtagcoll_cancel").on("click",function(){e.destroy()}),a("#addtagcoll_form").on("submit",function(){var b=a("#addtagcoll_form #addtagcoll_name").val(),d=a("#addtagcoll_form #addtagcoll_searchable").prop("checked")?1:0;return String(b).length>0&&(window.location.href=c+"&name="+encodeURIComponent(b)+"&searchable="+d),!1})})}),a("body").on("click",".tag-collections-table .action_delete",function(b){b.preventDefault();var c=a(this).attr("data-url")+"&sesskey="+M.cfg.sesskey;e.get_strings([{key:"delete"},{key:"suredeletecoll",component:"tag",param:a(this).attr("data-collname")},{key:"yes"},{key:"no"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],function(){window.location.href=c})})})}}}); \ No newline at end of file diff --git a/lib/amd/src/tag.js b/lib/amd/src/tag.js index 7d0c27bb2d1..68324fc81b1 100644 --- a/lib/amd/src/tag.js +++ b/lib/amd/src/tag.js @@ -248,25 +248,23 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str' areaid, collid, isenabled; if (ajaxreturn.component === 'core_tag' && ajaxreturn.itemtype === 'tagareaenable') { areaid = $(this).attr('data-itemid'); - $(".tag-collections-table ul[data-collectionid] li[data-areaid=" + areaid + "]").addClass('hidden'); + $(".tag-collections-table ul[data-collectionid] li[data-areaid=" + areaid + "]").hide(); isenabled = ajaxreturn.value; if (isenabled === '1') { $(this).closest('tr').removeClass('dimmed_text'); collid = $(this).closest('tr').find('[data-itemtype="tagareacollection"]').attr("data-value"); - $(".tag-collections-table ul[data-collectionid=" + collid + "] li[data-areaid=" + areaid + "]") - .removeClass('hidden'); + $(".tag-collections-table ul[data-collectionid=" + collid + "] li[data-areaid=" + areaid + "]").show(); } else { $(this).closest('tr').addClass('dimmed_text'); } } if (ajaxreturn.component === 'core_tag' && ajaxreturn.itemtype === 'tagareacollection') { areaid = $(this).attr('data-itemid'); - $(".tag-collections-table ul[data-collectionid] li[data-areaid=" + areaid + "]").addClass('hidden'); + $(".tag-collections-table ul[data-collectionid] li[data-areaid=" + areaid + "]").hide(); collid = $(this).attr('data-value'); isenabled = $(this).closest('tr').find('[data-itemtype="tagareaenable"]').attr("data-value"); if (isenabled === "1") { - $(".tag-collections-table ul[data-collectionid=" + collid + "] li[data-areaid=" + areaid + "]") - .removeClass('hidden'); + $(".tag-collections-table ul[data-collectionid=" + collid + "] li[data-areaid=" + areaid + "]").show(); } } }); diff --git a/lib/behat/behat_base.php b/lib/behat/behat_base.php index 3fd7d2b6b39..afdd4f618a3 100644 --- a/lib/behat/behat_base.php +++ b/lib/behat/behat_base.php @@ -783,6 +783,10 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext { // Getting the debugging info and the backtrace. $errorinfoboxes = $this->getSession()->getPage()->findAll('css', 'div.alert-error'); + // If errorinfoboxes is empty, try find alert-danger (bootstrap4) class. + if (empty($errorinfoboxes)) { + $errorinfoboxes = $this->getSession()->getPage()->findAll('css', 'div.alert-danger'); + } // If errorinfoboxes is empty, try find notifytiny (original) class. if (empty($errorinfoboxes)) { $errorinfoboxes = $this->getSession()->getPage()->findAll('css', 'div.notifytiny'); diff --git a/lib/behat/behat_field_manager.php b/lib/behat/behat_field_manager.php index 1fb764294bb..31701e92d82 100644 --- a/lib/behat/behat_field_manager.php +++ b/lib/behat/behat_field_manager.php @@ -204,7 +204,6 @@ class behat_field_manager { // We already waited when getting the NodeElement and we don't want an exception if it's not part of a moodleform. $parentformfound = $fieldnode->find('xpath', - "/ancestor::fieldset" . "/ancestor::form[contains(concat(' ', normalize-space(@class), ' '), ' mform ')]" ); @@ -228,11 +227,19 @@ class behat_field_manager { return 'availability'; } - // We look for a parent node with 'felement' class or data-fieldtype attribute. - if ($fieldtype = $fieldnode->getParent()->getAttribute('data-fieldtype')) { - return $fieldtype; + if ($fieldnode->getTagName() == 'html') { + return false; } + // If the type is explictly set on the element pointed to by the label - use it. + if ($type = $fieldnode->getParent()->getAttribute('data-fieldtype')) { + if ($type == 'tags') { + return 'autocomplete'; + } + return $type; + } + + // We look for a parent node with 'felement' class. if ($class = $fieldnode->getParent()->getAttribute('class')) { if (strstr($class, 'felement') != false) { diff --git a/lib/behat/behat_files.php b/lib/behat/behat_files.php index 8e1e9a93ef5..43ed54f7ff6 100644 --- a/lib/behat/behat_files.php +++ b/lib/behat/behat_files.php @@ -124,9 +124,10 @@ class behat_files extends behat_base { if ($filemanagerelement) { $containernode = $this->get_filepicker_node($filemanagerelement); $exceptionmsg = 'The "'.$filemanagerelement.'" filemanager ' . $exceptionmsg; - $locatorprefix = "//div[@class='fp-content']"; + $locatorprefix = "//div[contains(concat(' ', normalize-space(@class), ' '), ' fp-content ')]"; } else { - $locatorprefix = "//div[contains(concat(' ', normalize-space(@class), ' '), ' fp-repo-items ')]//descendant::div[@class='fp-content']"; + $locatorprefix = "//div[contains(concat(' ', normalize-space(@class), ' '), ' fp-repo-items ')]" . + "//descendant::div[contains(concat(' ', normalize-space(@class), ' '), ' fp-content ')]"; } $exception = new ExpectationException($exceptionmsg, $this->getSession()); diff --git a/lib/behat/classes/behat_selectors.php b/lib/behat/classes/behat_selectors.php index c29ed085991..5d052001394 100644 --- a/lib/behat/classes/behat_selectors.php +++ b/lib/behat/classes/behat_selectors.php @@ -50,6 +50,7 @@ class behat_selectors { 'table' => 'table', 'table_row' => 'table_row', 'xpath_element' => 'xpath_element', + 'form_row' => 'form_row' ); /** @@ -79,7 +80,8 @@ class behat_selectors { 'table' => 'table', 'table_row' => 'table_row', 'text' => 'text', - 'xpath_element' => 'xpath_element' + 'xpath_element' => 'xpath_element', + 'form_row' => 'form_row' ); /** @@ -95,10 +97,9 @@ class behat_selectors { .//li[contains(concat(' ', normalize-space(@class), ' '), ' activity ')][normalize-space(.) = %locator% ] XPATH , 'block' => << << << << << <<export_for_template_base($output); + + $context['selectedvalue'] = $this->_values[1]; + $context['deselectedvalue'] = $this->_values[0]; + + return $context; + } + } diff --git a/lib/form/autocomplete.php b/lib/form/autocomplete.php index 876cb5e0964..787db398507 100644 --- a/lib/form/autocomplete.php +++ b/lib/form/autocomplete.php @@ -210,11 +210,11 @@ class MoodleQuickForm_autocomplete extends MoodleQuickForm_select { $this->_generateId(); $context = parent::export_for_template($output); - $context['tags'] = $this->tags; + $context['tags'] = !empty($this->tags); $context['ajax'] = $this->ajax; $context['placeholder'] = $this->placeholder; - $context['casesensitive'] = $this->casesensitive; - $context['showsuggestions'] = $this->showsuggestions; + $context['casesensitive'] = !empty($this->casesensitive); + $context['showsuggestions'] = !empty($this->showsuggestions); $context['noselectionstring'] = $this->noselectionstring; return $context; diff --git a/lib/form/cancel.php b/lib/form/cancel.php index 2a5764f009b..aebf1c0f6fd 100644 --- a/lib/form/cancel.php +++ b/lib/form/cancel.php @@ -110,12 +110,4 @@ class MoodleQuickForm_cancel extends MoodleQuickForm_submit return HTML_QuickForm_submit::getFrozenHtml(); } - /** - * Freeze the element so that only its value is returned - * - * @return bool - */ - function freeze(){ - return HTML_QuickForm_submit::freeze(); - } } diff --git a/lib/form/editor.php b/lib/form/editor.php index 0488286fbdf..0d832948eeb 100644 --- a/lib/form/editor.php +++ b/lib/form/editor.php @@ -408,8 +408,8 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element implements templatab } $context['hasformats'] = count($formats) > 1; $context['formats'] = []; - foreach ($formats as $value => $text) { - $context['formats'][] = ['value' => $value, 'text' => $text, 'selected' => ($value == $format)]; + foreach ($formats as $formatvalue => $formattext) { + $context['formats'][] = ['value' => $formatvalue, 'text' => $formattext, 'selected' => ($formatvalue == $format)]; } $context['id'] = $id; $context['value'] = $text; diff --git a/lib/form/form.js b/lib/form/form.js index 268fba2143c..530132f8545 100644 --- a/lib/form/form.js +++ b/lib/form/form.js @@ -277,7 +277,7 @@ if (typeof M.form.dependencyManager === 'undefined') { isFilePicker: function(el) { if (!this._fileinputs) { var fileinputs = {}; - var els = this.get('form').all('.fitem.fitem_ffilepicker input,.fitem.fitem_ffilemanager input'); + var els = this.get('form').all('.fitem [data-fieldtype="filepicker"] input,.fitem [data-fieldtype="filemanager"] input'); els.each(function(node) { fileinputs[node.getAttribute('name')] = true; }); diff --git a/lib/form/group.php b/lib/form/group.php index b06094878ec..ee0790bc550 100644 --- a/lib/form/group.php +++ b/lib/form/group.php @@ -165,9 +165,8 @@ class MoodleQuickForm_group extends HTML_QuickForm_group implements templatable include_once('HTML/QuickForm/Renderer/Default.php'); $elements = []; + $name = $this->getName(); foreach ($this->_elements as $key => $element) { - $element->_generateId(); - $name = $this->getName(); $elementname = ''; if ($this->_appendName) { $elementname = $element->getName(); @@ -177,6 +176,7 @@ class MoodleQuickForm_group extends HTML_QuickForm_group implements templatable $element->setName($name); } } + $element->_generateId(); $out = $OUTPUT->mform_element($element, false, false, '', true); diff --git a/lib/form/select.php b/lib/form/select.php index 219d4ee0a02..d0a03dc7907 100644 --- a/lib/form/select.php +++ b/lib/form/select.php @@ -213,6 +213,10 @@ class MoodleQuickForm_select extends HTML_QuickForm_select implements templatabl } $context['options'] = $options; + if ($this->getAttribute('multiple')) { + $context['name'] = $context['name'] . '[]'; + } + return $context; } } diff --git a/lib/form/tags.php b/lib/form/tags.php index 7f9bab6b74a..b62eaf97f66 100644 --- a/lib/form/tags.php +++ b/lib/form/tags.php @@ -115,7 +115,9 @@ class MoodleQuickForm_tags extends MoodleQuickForm_autocomplete { $attributes['showsuggestions'] = $this->showstandard; } + parent::__construct($elementName, $elementLabel, $validoptions, $attributes); + $this->_type = 'tags'; } /** @@ -247,4 +249,15 @@ class MoodleQuickForm_tags extends MoodleQuickForm_autocomplete { return parent::exportValue($submitValues, $assoc); } + + public function export_for_template(renderer_base $output) { + + $context = parent::export_for_template($output); + if (has_capability('moodle/tag:manage', context_system::instance()) && $this->showstandard) { + $url = new moodle_url('/tag/manage.php', array('tc' => $this->get_tag_collection())); + $context['managestandardtagsurl'] = $url->out(false); + } + + return $context; + } } diff --git a/lib/form/templatable_form_element.php b/lib/form/templatable_form_element.php index 2fa96ab6d73..2f27d2b341b 100644 --- a/lib/form/templatable_form_element.php +++ b/lib/form/templatable_form_element.php @@ -52,7 +52,7 @@ trait templatable_form_element { // Not all elements have all of these attributes - but they are common enough to be valid for a few. $standardattributes = ['id', 'name', 'label', 'multiple', 'checked', 'error', 'size', 'value']; - $standardproperties = ['frozen', 'helpbutton', 'hiddenLabel']; + $standardproperties = ['helpbutton', 'hiddenLabel']; // Standard attributes. foreach ($standardattributes as $attrname) { @@ -65,16 +65,22 @@ trait templatable_form_element { $classpropname = '_' . $propname; $context[strtolower($propname)] = isset($this->$classpropname) ? $this->$classpropname : false; } + $extraclasses = $this->getAttribute('class'); + + // Special wierd named property. + $context['frozen'] = !empty($this->_flagFrozen); // Other attributes. $otherattributes = []; foreach ($this->getAttributes() as $attr => $value) { - if (!in_array($attr, $standardattributes)) { + if (!in_array($attr, $standardattributes) && $attr != 'class') { $otherattributes[] = $attr . '="' . s($value) . '"'; } } + $context['extraclasses'] = $extraclasses; + $context['type'] = $this->getType(); $context['attributes'] = implode(' ', $otherattributes); return $context; } -} \ No newline at end of file +} diff --git a/lib/form/templates/editor_textarea.mustache b/lib/form/templates/editor_textarea.mustache index fbec7d1a41f..22e8a1ec803 100644 --- a/lib/form/templates/editor_textarea.mustache +++ b/lib/form/templates/editor_textarea.mustache @@ -1,6 +1,6 @@
        + onchange="{{onchange}}" {{/changelistener}}>{{value}}
        {{^onlyoneformat}} @@ -13,4 +13,4 @@ {{#onlyoneformat}} {{/onlyoneformat}} -
        \ No newline at end of file + diff --git a/lib/form/textarea.php b/lib/form/textarea.php index 0a1da1d4c24..e8b7682ce47 100644 --- a/lib/form/textarea.php +++ b/lib/form/textarea.php @@ -39,7 +39,9 @@ require_once('templatable_form_element.php'); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class MoodleQuickForm_textarea extends HTML_QuickForm_textarea implements templatable { - use templatable_form_element; + use templatable_form_element { + export_for_template as export_for_template_base; + } /** @var string Need to store id of form as we may need it for helpbutton */ var $_formid = ''; @@ -166,4 +168,11 @@ class MoodleQuickForm_textarea extends HTML_QuickForm_textarea implements templa public function set_force_ltr($value) { $this->forceltr = (bool) $value; } + + public function export_for_template(renderer_base $output) { + $context = $this->export_for_template_base($output); + $context['value'] = $this->getValue(); + + return $context; + } } diff --git a/lib/form/url.php b/lib/form/url.php index ec6165624e8..925c94a3336 100644 --- a/lib/form/url.php +++ b/lib/form/url.php @@ -186,7 +186,7 @@ EOD; public function export_for_template(renderer_base $output) { $context = $this->export_for_template_base($output); - $context['filepickerhtml'] = $this->toHtml(); + $context['filepickerhtml'] = $this->getFilePickerHTML(); return $context; } diff --git a/lib/formslib.php b/lib/formslib.php index 04252c15fef..3692839ebbe 100644 --- a/lib/formslib.php +++ b/lib/formslib.php @@ -2692,15 +2692,15 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ */ public function __construct() { // switch next two lines for ol li containers for form items. - // $this->_elementTemplates=array('default'=>"\n\t\t".'
      • {error}
        {element}
      • '); + // $this->_elementTemplates=array('default'=>"\n\t\t".'
      • {error}
        {element}
      • '); $this->_elementTemplates = array( - 'default'=>"\n\t\t".'
        {help}
        {error}
        {element}
        ', + 'default'=>"\n\t\t".'
        {help}
        {error}
        {element}
        ', - 'actionbuttons'=>"\n\t\t".'
        {element}
        ', + 'actionbuttons'=>"\n\t\t".'
        {element}
        ', - 'fieldset'=>"\n\t\t".'
        {help}
        {error}
        {element}
        ', + 'fieldset'=>"\n\t\t".'
        {help}
        {error}
        {element}
        ', - 'static'=>"\n\t\t".'
        {label}{req}{advancedimg} {help}
        {error}
        {element}
        ', + 'static'=>"\n\t\t".'
        {label}{req}{advancedimg} {help}
        {error}
        {element}
        ', 'warning'=>"\n\t\t".'
        {element}
        ', @@ -2825,7 +2825,8 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ } $html = str_replace('{id}', $group->getAttribute('id'), $html); $html = str_replace('{name}', $group->getName(), $html); - $html = str_replace('{type}', 'fgroup', $html); + $html = str_replace('{typeclass}', 'fgroup', $html); + $html = str_replace('{type}', 'group', $html); $html = str_replace('{class}', $group->getAttribute('class'), $html); $emptylabel = ''; if ($group->getLabel() == '') { @@ -2888,7 +2889,8 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ $html = str_replace('{advancedimg}', '', $html); } $html = str_replace('{id}', 'fitem_' . $element->getAttribute('id'), $html); - $html = str_replace('{type}', 'f' . $element->getType(), $html); + $html = str_replace('{typeclass}', 'f' . $element->getType(), $html); + $html = str_replace('{type}', $element->getType(), $html); $html = str_replace('{name}', $element->getName(), $html); $html = str_replace('{class}', $element->getAttribute('class'), $html); $emptylabel = ''; @@ -2914,7 +2916,11 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ if (!$fromtemplate) { parent::renderElement($element, $required, $error); - } else { // CRAZZY! + } else { + if (in_array($element->getName(), $this->_stopFieldsetElements) && $this->_fieldsetsOpen > 0) { + $this->_html .= $this->_closeFieldsetTemplate; + $this->_fieldsetsOpen--; + } $this->_html .= $html; } } diff --git a/lib/javascript-static.js b/lib/javascript-static.js index 4cbbefceee5..e0438e69198 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -283,7 +283,7 @@ M.util.show_confirm_dialog = function(e, args) { } else if ((targetancestor = target.ancestor('a')) !== null) { window.location = targetancestor.get('href'); - } else if (target.test('input')) { + } else if (target.test('input') || target.test('button')) { targetform = target.ancestor('form', true); if (!targetform) { return; @@ -299,7 +299,7 @@ M.util.show_confirm_dialog = function(e, args) { } else { Y.log("Element of type " + target.get('tagName') + - " is not supported by the M.util.show_confirm_dialog function. Use A, INPUT, or FORM", + " is not supported by the M.util.show_confirm_dialog function. Use A, INPUT, BUTTON or FORM", 'warn', 'javascript-static'); } }, this); diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index 80f614d6691..34eedaf4a6a 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -936,6 +936,7 @@ class single_select implements renderable, templatable { $data->label = $this->label; $data->disabled = $this->disabled; $data->title = $this->tooltip; + $data->formid = $this->formid; $data->id = !empty($attributes['id']) ? $attributes['id'] : html_writer::random_id('single_select'); unset($attributes['id']); @@ -971,11 +972,30 @@ class single_select implements renderable, templatable { $data->nothingkey = $hasnothing ? key($nothing) : false; foreach ($options as $value => $name) { - $data->options[] = [ - 'value' => $value, - 'name' => $options[$value], - 'selected' => $this->selected == $value - ]; + if (is_array($options[$value])) { + foreach ($options[$value] as $optgroupname => $optgroupvalues) { + $sublist = []; + foreach ($optgroupvalues as $optvalue => $optname) { + $sublist[] = [ + 'value' => $optvalue, + 'name' => $optname, + 'selected' => strval($this->selected) === strval($optvalue), + ]; + } + $data->options[] = [ + 'name' => $optgroupname, + 'optgroup' => true, + 'options' => $sublist + ]; + } + } else { + $data->options[] = [ + 'value' => $value, + 'name' => $options[$value], + 'selected' => strval($this->selected) === strval($value), + 'optgroup' => false + ]; + } } // Label attributes. diff --git a/lib/templates/action_link.mustache b/lib/templates/action_link.mustache index c3a3bb5f6d9..43421a67de1 100644 --- a/lib/templates/action_link.mustache +++ b/lib/templates/action_link.mustache @@ -18,7 +18,7 @@ Action link. }} {{^disabled}} -
        {{#icon}}{{>core/pix_icon}}{{/icon}}{{{text}}} + {{#icon}}{{>core/pix_icon}}{{/icon}}{{{text}}} {{#hasactions}} {{> core/actions }} {{/hasactions}} diff --git a/lib/tests/behat/behat_action_menu.php b/lib/tests/behat/behat_action_menu.php new file mode 100644 index 00000000000..de892ecf55d --- /dev/null +++ b/lib/tests/behat/behat_action_menu.php @@ -0,0 +1,77 @@ +. + +/** + * Steps definitions to open and close action menus. + * + * @package core + * @category test + * @copyright 2016 Damyon Wiese + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php. + +require_once(__DIR__ . '/../../behat/behat_base.php'); + +use Behat\Mink\Exception\ExpectationException as ExpectationException; +use Behat\Mink\Exception\DriverException as DriverException; + +/** + * Steps definitions to open and close action menus. + * + * @package core + * @category test + * @copyright 2016 Damyon Wiese + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class behat_action_menu extends behat_base { + + /** + * Open the action menu in + * + * @Given /^I open the action menu in "(?P(?:[^"]|\\")*)" "(?P[^"]*)"$/ + * @param string $element + * @param string $selector + * @return void + */ + public function i_open_the_action_menu_in($element, $selectortype) { + if (!$this->running_javascript()) { + throw new DriverException('Open the action menu step is not available with Javascript disabled'); + } + // Gets the node based on the requested selector type and locator. + $node = $this->get_node_in_container("css_element", "[role=menuitem][aria-haspopup=true]", $selectortype, $element); + $this->ensure_node_is_visible($node); + $node->click(); + } + + /** + * When an action menu is open, follow one of the items in it. + * + * @Given /^I choose "(?P(?:[^"]|\\")*)" in the open action menu$/ + * @param string $linkstring + * @return void + */ + public function i_choose_in_the_open_action_menu($linkstring) { + if (!$this->running_javascript()) { + throw new DriverException('Action menu steps are not available with Javascript disabled'); + } + // Gets the node based on the requested selector type and locator. + $node = $this->get_node_in_container("link", $linkstring, "css_element", ".moodle-actionmenu [role=menu][aria-hidden=false]"); + $this->ensure_node_is_visible($node); + $node->click(); + } +} diff --git a/lib/tests/behat/behat_deprecated.php b/lib/tests/behat/behat_deprecated.php index b257482168c..46493eaf9c3 100644 --- a/lib/tests/behat/behat_deprecated.php +++ b/lib/tests/behat/behat_deprecated.php @@ -287,6 +287,16 @@ class behat_deprecated extends behat_base { $this->execute('behat_forms::i_set_the_field_to_multiline', array($field, $value)); } + /** + * Click on a given link in the moodle-actionmenu that is currently open. + * @Given /^I follow "(?P(?:[^"]|\\")*)" in the open menu$/ + * @param string $linkstring the text (or id, etc.) of the link to click. + */ + public function i_follow_in_the_open_menu($linkstring) { + $alternative = 'I choose "' . $this->escape($linkstring) . '" from the open action menu'; + $this->deprecated_message($alternative, true); + } + /** * Throws an exception if $CFG->behat_usedeprecated is not allowed. * diff --git a/lib/tests/behat/behat_hooks.php b/lib/tests/behat/behat_hooks.php index 5398e0a0aad..6b0b8e8726c 100644 --- a/lib/tests/behat/behat_hooks.php +++ b/lib/tests/behat/behat_hooks.php @@ -613,4 +613,4 @@ class behat_hooks extends behat_base { * @copyright 2016 Rajesh Taneja * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class behat_stop_exception extends \Exception{} \ No newline at end of file +class behat_stop_exception extends \Exception{} diff --git a/mod/assign/amd/build/grading_panel.min.js b/mod/assign/amd/build/grading_panel.min.js index 012556a6e1e..3bd700c25ed 100644 --- a/mod/assign/amd/build/grading_panel.min.js +++ b/mod/assign/amd/build/grading_panel.min.js @@ -1 +1 @@ -define(["jquery","core/notification","core/templates","core/fragment","core/ajax","core/str","mod_assign/grading_form_change_checker","mod_assign/grading_events"],function(a,b,c,d,e,f,g,h){var i=function(b){this._regionSelector=b,this._region=a(b),this._userCache=[],this.registerEventListeners()};return i.prototype._regionSelector=null,i.prototype._lastUserId=0,i.prototype._lastAttemptNumber=-1,i.prototype._region=null,i.prototype._niceReplaceNodeContents=function(b,d,e){var f=a.Deferred();return b.fadeOut("fast",function(){c.replaceNodeContents(b,d,e),b.fadeIn("fast",function(){f.resolve()})}),f.promise()},i.prototype._saveFormState=function(){"undefined"!=typeof window.tinyMCE&&window.tinyMCE.triggerSave();var b=a('[data-region="grading-actions-form"] [name="sendstudentnotifications"]').val();a('.gradeform [name="sendstudentnotifications"]').val(b)},i.prototype._submitForm=function(c,d){var f=a(this._region.find("form.gradeform"));a('[data-region="overlay"]').show(),f.trigger("save-form-state");var g=f.serialize(),h=this._region.attr("data-assignmentid");e.call([{methodname:"mod_assign_submit_grading_form",args:{assignmentid:h,userid:this._lastUserId,jsonformdata:JSON.stringify(g)},done:this._handleFormSubmissionResponse.bind(this,g,d),fail:b.exception}])},i.prototype._handleFormSubmissionResponse=function(c,d,e){"undefined"==typeof d&&(d=this._lastUserId),e.length?a(document).trigger("reset",[this._lastUserId,c]):(f.get_strings([{key:"changessaved",component:"core"},{key:"gradechangessaveddetail",component:"mod_assign"}]).done(function(a){b.alert(a[0],a[1])}).fail(b.exception),d==this._lastUserId?a(document).trigger("reset",d):a(document).trigger("user-changed",d)),a('[data-region="overlay"]').hide()},i.prototype._resetForm=function(b,c,d){var e=a.Event("custom");"undefined"==typeof c&&(c=this._lastUserId),this._lastUserId=0,this._refreshGradingPanel(e,c,d)},i.prototype._chooseAttempt=function(c){var d=a(c.target),e=d.data("submissions"),g=a(document.getElementById(e)),h=g.clone(),i=h.wrap(a("
        ")).html();f.get_strings([{key:"viewadifferentattempt",component:"mod_assign"},{key:"view",component:"core"},{key:"cancel",component:"core"}]).done(function(c){b.confirm(c[0],i,c[1],c[2],function(){var b=a("input:radio[name='select-attemptnumber']:checked").val();this._refreshGradingPanel(null,this._lastUserId,"",b)}.bind(this))}.bind(this)).fail(b.exception)},i.prototype._addPopoutButtons=function(d){var e=a(d);c.render("mod_assign/popout_button",{}).done(function(a){e.find(".fitem_ffilemanager .fitemtitle").append(a),e.find(".fitem_feditor .fitemtitle").append(a),e.find(".fitem_f .fitemtitle").append(a),e.on("click",'[data-region="popout-button"]',this._togglePopout.bind(this))}.bind(this)).fail(b.exception)},i.prototype._togglePopout=function(b){b.preventDefault();var c=a(b.target).closest(".fitem");c.hasClass("popout")?a(".popout").removeClass("popout"):(a(".popout").removeClass("popout"),c.addClass("popout"),c.addClass("moodle-has-zindex"))},i.prototype._refreshGradingPanel=function(e,f,h,i){var j=this._region.attr("data-contextid");"undefined"==typeof h&&(h=""),"undefined"==typeof i&&(i=-1),this._lastUserId==f&&this._lastAttemptNumber==i&&""===h||(this._lastUserId=f,this._lastAttemptNumber=i,a(document).trigger("start-loading-user"),window.M.util.js_pending("mod-assign-loading-user"),c.render("mod_assign/loading",{}).done(function(c,e){this._niceReplaceNodeContents(this._region,c,e).done(function(){if(f>0){this._region.show();var c={userid:f,attemptnumber:i,jsonformdata:JSON.stringify(h)};d.loadFragment("mod_assign","gradingpanel",j,c).done(function(c,d){this._niceReplaceNodeContents(this._region,c,d).done(function(){g.saveFormState('[data-region="grade-panel"] .gradeform'),a(document).on("editor-content-restored",function(){g.saveFormState('[data-region="grade-panel"] .gradeform')}),a('[data-region="attempt-chooser"]').on("click",this._chooseAttempt.bind(this)),this._addPopoutButtons('[data-region="grade-panel"] .gradeform'),a(document).trigger("finish-loading-user"),window.M.util.js_complete("mod-assign-loading-user")}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)}else{this._region.hide();var e=a('[data-region="review-panel"]');e.length&&this._niceReplaceNodeContents(e,"",""),a(document).trigger("finish-loading-user"),window.M.util.js_complete("mod-assign-loading-user")}}.bind(this))}.bind(this)).fail(b.exception))},i.prototype.getPanelElement=function(){return a('[data-region="grade-panel"]')},i.prototype.collapsePanel=function(){this.getPanelElement().addClass("collapsed")},i.prototype.expandPanel=function(){this.getPanelElement().removeClass("collapsed")},i.prototype.registerEventListeners=function(){var b=a(document);b.on("user-changed",this._refreshGradingPanel.bind(this)),b.on("save-changes",this._submitForm.bind(this)),b.on("reset",this._resetForm.bind(this)),b.on("save-form-state",this._saveFormState.bind(this)),b.on(h.COLLAPSE_GRADE_PANEL,function(){this.collapsePanel()}.bind(this)),b.on(h.COLLAPSE_REVIEW_PANEL,function(){this.expandPanel()}.bind(this)),b.on(h.EXPAND_GRADE_PANEL,function(){this.expandPanel()}.bind(this))},i}); \ No newline at end of file +define(["jquery","core/notification","core/templates","core/fragment","core/ajax","core/str","mod_assign/grading_form_change_checker","mod_assign/grading_events"],function(a,b,c,d,e,f,g,h){var i=function(b){this._regionSelector=b,this._region=a(b),this._userCache=[],this.registerEventListeners()};return i.prototype._regionSelector=null,i.prototype._lastUserId=0,i.prototype._lastAttemptNumber=-1,i.prototype._region=null,i.prototype._niceReplaceNodeContents=function(b,d,e){var f=a.Deferred();return b.fadeOut("fast",function(){c.replaceNodeContents(b,d,e),b.fadeIn("fast",function(){f.resolve()})}),f.promise()},i.prototype._saveFormState=function(){"undefined"!=typeof window.tinyMCE&&window.tinyMCE.triggerSave();var b=a('[data-region="grading-actions-form"] [name="sendstudentnotifications"]').val();a('.gradeform [name="sendstudentnotifications"]').val(b)},i.prototype._submitForm=function(c,d){var f=a(this._region.find("form.gradeform"));a('[data-region="overlay"]').show(),f.trigger("save-form-state");var g=f.serialize(),h=this._region.attr("data-assignmentid");e.call([{methodname:"mod_assign_submit_grading_form",args:{assignmentid:h,userid:this._lastUserId,jsonformdata:JSON.stringify(g)},done:this._handleFormSubmissionResponse.bind(this,g,d),fail:b.exception}])},i.prototype._handleFormSubmissionResponse=function(c,d,e){"undefined"==typeof d&&(d=this._lastUserId),e.length?a(document).trigger("reset",[this._lastUserId,c]):(f.get_strings([{key:"changessaved",component:"core"},{key:"gradechangessaveddetail",component:"mod_assign"}]).done(function(a){b.alert(a[0],a[1])}).fail(b.exception),d==this._lastUserId?a(document).trigger("reset",d):a(document).trigger("user-changed",d)),a('[data-region="overlay"]').hide()},i.prototype._resetForm=function(b,c,d){var e=a.Event("custom");"undefined"==typeof c&&(c=this._lastUserId),this._lastUserId=0,this._refreshGradingPanel(e,c,d)},i.prototype._chooseAttempt=function(c){var d=a(c.target),e=d.data("submissions"),g=a(document.getElementById(e)),h=g.clone(),i=h.wrap(a("")).html();f.get_strings([{key:"viewadifferentattempt",component:"mod_assign"},{key:"view",component:"core"},{key:"cancel",component:"core"}]).done(function(c){b.confirm(c[0],i,c[1],c[2],function(){var b=a("input:radio[name='select-attemptnumber']:checked").val();this._refreshGradingPanel(null,this._lastUserId,"",b)}.bind(this))}.bind(this)).fail(b.exception)},i.prototype._addPopoutButtons=function(d){var e=a(d);c.render("mod_assign/popout_button",{}).done(function(a){var b=e.find('[data-fieldtype="filemanager"],[data-fieldtype="editor"],[data-fieldtype="grading"]').closest(".fitem");b.addClass("has-popout").find("label").parent().append(a),e.on("click",'[data-region="popout-button"]',this._togglePopout.bind(this))}.bind(this)).fail(b.exception)},i.prototype._togglePopout=function(b){b.preventDefault();var c=a(b.target).closest(".fitem");c.hasClass("popout")?a(".popout").removeClass("popout"):(a(".popout").removeClass("popout"),c.addClass("popout"),c.addClass("moodle-has-zindex"))},i.prototype._refreshGradingPanel=function(e,f,h,i){var j=this._region.attr("data-contextid");"undefined"==typeof h&&(h=""),"undefined"==typeof i&&(i=-1),this._lastUserId==f&&this._lastAttemptNumber==i&&""===h||(this._lastUserId=f,this._lastAttemptNumber=i,a(document).trigger("start-loading-user"),window.M.util.js_pending("mod-assign-loading-user"),c.render("mod_assign/loading",{}).done(function(c,e){this._niceReplaceNodeContents(this._region,c,e).done(function(){if(f>0){this._region.show();var c={userid:f,attemptnumber:i,jsonformdata:JSON.stringify(h)};d.loadFragment("mod_assign","gradingpanel",j,c).done(function(c,d){this._niceReplaceNodeContents(this._region,c,d).done(function(){g.saveFormState('[data-region="grade-panel"] .gradeform'),a(document).on("editor-content-restored",function(){g.saveFormState('[data-region="grade-panel"] .gradeform')}),a('[data-region="attempt-chooser"]').on("click",this._chooseAttempt.bind(this)),this._addPopoutButtons('[data-region="grade-panel"] .gradeform'),a(document).trigger("finish-loading-user"),window.M.util.js_complete("mod-assign-loading-user")}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)}else{this._region.hide();var e=a('[data-region="review-panel"]');e.length&&this._niceReplaceNodeContents(e,"",""),a(document).trigger("finish-loading-user"),window.M.util.js_complete("mod-assign-loading-user")}}.bind(this))}.bind(this)).fail(b.exception))},i.prototype.getPanelElement=function(){return a('[data-region="grade-panel"]')},i.prototype.collapsePanel=function(){this.getPanelElement().addClass("collapsed")},i.prototype.expandPanel=function(){this.getPanelElement().removeClass("collapsed")},i.prototype.registerEventListeners=function(){var b=a(document);b.on("user-changed",this._refreshGradingPanel.bind(this)),b.on("save-changes",this._submitForm.bind(this)),b.on("reset",this._resetForm.bind(this)),b.on("save-form-state",this._saveFormState.bind(this)),b.on(h.COLLAPSE_GRADE_PANEL,function(){this.collapsePanel()}.bind(this)),b.on(h.COLLAPSE_REVIEW_PANEL,function(){this.expandPanel()}.bind(this)),b.on(h.EXPAND_GRADE_PANEL,function(){this.expandPanel()}.bind(this))},i}); \ No newline at end of file diff --git a/mod/assign/amd/src/grading_panel.js b/mod/assign/amd/src/grading_panel.js index 7cb42fb58d6..4f380b814e4 100644 --- a/mod/assign/amd/src/grading_panel.js +++ b/mod/assign/amd/src/grading_panel.js @@ -216,9 +216,9 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment', var region = $(selector); templates.render('mod_assign/popout_button', {}).done(function(html) { - region.find('.fitem_ffilemanager .fitemtitle').append(html); - region.find('.fitem_feditor .fitemtitle').append(html); - region.find('.fitem_f .fitemtitle').append(html); + var parents = region.find('[data-fieldtype="filemanager"],[data-fieldtype="editor"],[data-fieldtype="grading"]') + .closest('.fitem'); + parents.addClass('has-popout').find('label').parent().append(html); region.on('click', '[data-region="popout-button"]', this._togglePopout.bind(this)); }.bind(this)).fail(notification.exception); diff --git a/mod/chat/tests/behat/chat_course_reset.feature b/mod/chat/tests/behat/chat_course_reset.feature index 89ea3f23439..bbb4a5be90d 100644 --- a/mod/chat/tests/behat/chat_course_reset.feature +++ b/mod/chat/tests/behat/chat_course_reset.feature @@ -41,7 +41,7 @@ Feature: Chat reset And I press "Save and display" When I navigate to "Reset" node in "Course administration" And I set the following fields to these values: - | id_reset_start_date_enabled | 1 | + | reset_start_date[enabled] | 1 | | reset_start_date[day] | 1 | | reset_start_date[month] | January | | reset_start_date[year] | 2030 | @@ -52,4 +52,4 @@ Feature: Chat reset And I follow "Test chat name" And I navigate to "Edit settings" node in "Chat administration" And I expand all fieldsets - And the "id_chattime_year" select box should contain "2030" + And the "chattime[year]" select box should contain "2030" diff --git a/mod/data/tests/behat/required_entries.feature b/mod/data/tests/behat/required_entries.feature index 39d34232fec..f10f83dd92c 100644 --- a/mod/data/tests/behat/required_entries.feature +++ b/mod/data/tests/behat/required_entries.feature @@ -129,26 +129,26 @@ Feature: Users can be required to specify certain fields when adding entries to And I add an entry to "Test database name" database with: | Base Text input | Some input to allow us to submit the otherwise empty form | And I press "Save and view" - Then ".alert.alert-error" "css_element" should exist in the "Required Checkbox" "table_row" - And ".alert.alert-error" "css_element" should exist in the "Required Two-Option Checkbox" "table_row" - And ".alert.alert-error" "css_element" should exist in the "Required Latlong" "table_row" - And ".alert.alert-error" "css_element" should exist in the "Required Menu" "table_row" - And ".alert.alert-error" "css_element" should exist in the "Required Number" "table_row" - And ".alert.alert-error" "css_element" should exist in the "Required Radio" "table_row" - And ".alert.alert-error" "css_element" should exist in the "Required Text input" "table_row" - And ".alert.alert-error" "css_element" should exist in the "Required Text area" "table_row" - And ".alert.alert-error" "css_element" should exist in the "Required URL" "table_row" - And ".alert.alert-error" "css_element" should exist in the "Required Multimenu" "table_row" - And ".alert.alert-error" "css_element" should exist in the "Required Two-Option Multimenu" "table_row" - And ".alert.alert-error" "css_element" should not exist in the "Not required Checkbox" "table_row" - And ".alert.alert-error" "css_element" should not exist in the "Not required Latlong" "table_row" - And ".alert.alert-error" "css_element" should not exist in the "Not required Menu" "table_row" - And ".alert.alert-error" "css_element" should not exist in the "Not required Number" "table_row" - And ".alert.alert-error" "css_element" should not exist in the "Not required Radio" "table_row" - And ".alert.alert-error" "css_element" should not exist in the "Not required Text input" "table_row" - And ".alert.alert-error" "css_element" should not exist in the "Not required Text area" "table_row" - And ".alert.alert-error" "css_element" should not exist in the "Not required URL" "table_row" - And ".alert.alert-error" "css_element" should not exist in the "Not required Multimenu" "table_row" + Then ".alert" "css_element" should exist in the "Required Checkbox" "table_row" + And ".alert" "css_element" should exist in the "Required Two-Option Checkbox" "table_row" + And ".alert" "css_element" should exist in the "Required Latlong" "table_row" + And ".alert" "css_element" should exist in the "Required Menu" "table_row" + And ".alert" "css_element" should exist in the "Required Number" "table_row" + And ".alert" "css_element" should exist in the "Required Radio" "table_row" + And ".alert" "css_element" should exist in the "Required Text input" "table_row" + And ".alert" "css_element" should exist in the "Required Text area" "table_row" + And ".alert" "css_element" should exist in the "Required URL" "table_row" + And ".alert" "css_element" should exist in the "Required Multimenu" "table_row" + And ".alert" "css_element" should exist in the "Required Two-Option Multimenu" "table_row" + And ".alert" "css_element" should not exist in the "Not required Checkbox" "table_row" + And ".alert" "css_element" should not exist in the "Not required Latlong" "table_row" + And ".alert" "css_element" should not exist in the "Not required Menu" "table_row" + And ".alert" "css_element" should not exist in the "Not required Number" "table_row" + And ".alert" "css_element" should not exist in the "Not required Radio" "table_row" + And ".alert" "css_element" should not exist in the "Not required Text input" "table_row" + And ".alert" "css_element" should not exist in the "Not required Text area" "table_row" + And ".alert" "css_element" should not exist in the "Not required URL" "table_row" + And ".alert" "css_element" should not exist in the "Not required Multimenu" "table_row" And I follow "View list" And I should see "No entries in database" @@ -221,8 +221,8 @@ Feature: Users can be required to specify certain fields when adding entries to | Required Two-Option Multimenu | 1 | And I set the field with xpath "//div[@title='Not required Latlong']//tr[td/label[normalize-space(.)='Latitude']]/td/input" to "20" And I press "Save and view" - Then ".alert.alert-error" "css_element" should exist in the "Required Latlong" "table_row" - And ".alert.alert-error" "css_element" should exist in the "Not required Latlong" "table_row" + Then ".alert" "css_element" should exist in the "Required Latlong" "table_row" + And ".alert" "css_element" should exist in the "Not required Latlong" "table_row" Scenario: A student filling in number and text fields with zero will not see an error. Given I log in as "student1" @@ -244,4 +244,4 @@ Feature: Users can be required to specify certain fields when adding entries to And I press "Save and view" And I follow "View list" Then I should not see "No entries in database" - And I should see "Some input to allow us to submit the otherwise empty form" \ No newline at end of file + And I should see "Some input to allow us to submit the otherwise empty form" diff --git a/mod/feedback/classes/complete_form.php b/mod/feedback/classes/complete_form.php index 9573a64f611..48a0b6acd5c 100644 --- a/mod/feedback/classes/complete_form.php +++ b/mod/feedback/classes/complete_form.php @@ -446,7 +446,6 @@ class mod_feedback_complete_form extends moodleform { $menu->set_constraint('.feedback_form'); $menu->set_alignment(action_menu::TR, action_menu::BR); $menu->set_menu_trigger(get_string('edit')); - $menu->do_not_enhance(); $menu->prioritise = true; $itemobj = feedback_get_item_class($item->typ); diff --git a/mod/feedback/styles.css b/mod/feedback/styles.css index 1a4e4458bc5..4cb2aef6f57 100644 --- a/mod/feedback/styles.css +++ b/mod/feedback/styles.css @@ -33,92 +33,6 @@ .path-mod-feedback #analysis-form label { display: inline; } -.path-mod-feedback .mform.feedback_form .fitem .fitemtitle { - display: block; - margin-top: 4px; - margin-bottom: 4px; - text-align: left; - width: 100%; -} - -.path-mod-feedback .mform.feedback_form .fitem .felement { - margin-left: 0; - width: 100%; - float: left; - padding-left: 0; - padding-right: 0; -} - -.path-mod-feedback .mform.feedback_form .fitem .fstatic:empty { - display: none; -} - -.path-mod-feedback .mform.feedback_form .fitem .fcheckbox > span, -.path-mod-feedback .mform.feedback_form .fitem .fradio > span, -.path-mod-feedback .mform.feedback_form .fitem .fgroup > span { - margin-top: 4px; -} - -body.path-mod-feedback #region-main .mform.feedback_form .femptylabel .fitemtitle { - display: inline-block; - width: auto; - margin-right: 0; -} - -.path-mod-feedback .mform.feedback_form .femptylabel .felement { - display: inline-block; - margin-top: 4px; - padding-top: 5px; - width: auto; -} - -body.path-mod-feedback #region-main .mform.feedback_form .feedback-item-pagebreak .felement { - width: 100%; -} - -.path-mod-feedback .mform.feedback_form .fitem_fcheckbox .fitemtitle, -.path-mod-feedback .mform.feedback_form .fitem_fcheckbox .felement { - display: inline-block; - width: auto; -} - -.path-mod-feedback .mform.feedback_form .fitem_fcheckbox .felement { - padding: 6px; -} - -.path-mod-feedback .mform.feedback_form#feedback_viewresponse_form .fitem.feedback_hasvalue:not(.feedback-item-captcha) .felement { - background: #FBFBF1; - min-height: 1em; - box-sizing: border-box; - padding: 3px; - border: 1px solid #ddd -} - -.path-mod-feedback .mform.feedback_form .fitem.feedback_hasvalue .fstatic:empty { - display: inherit; -} - -.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem:hover { - background: #f5f5f5; -} - -.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle label { - width: 100%; -} - -.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle { - position: relative; - width: 100%; -} - -.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle .itemdd, -.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle .itemname { - float: left; -} - -.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle .itemactions { - float: right; -} .path-mod-feedback .templateslist td.cell.action, .path-mod-feedback .templateslist th.header.action { diff --git a/mod/feedback/tests/behat/coursemapping.feature b/mod/feedback/tests/behat/coursemapping.feature index 047a35e9b4b..8943c07550b 100644 --- a/mod/feedback/tests/behat/coursemapping.feature +++ b/mod/feedback/tests/behat/coursemapping.feature @@ -115,7 +115,7 @@ Feature: Mapping courses in a feedback And I follow "Course feedback" And I follow "Analysis" - And I should see "All courses" in the "#feedback_course_filter .fautocomplete .label" "css_element" + And I should see "All courses" in the "#feedback_course_filter [data-fieldtype=autocomplete] .form-autocomplete-selection [role=listitem]" "css_element" And I show chart data for the "multichoicerated" feedback And I should see "1 (33.33 %)" in the "option a" "table_row" And I should see "1 (33.33 %)" in the "option b" "table_row" @@ -127,7 +127,7 @@ Feature: Mapping courses in a feedback And I follow "Back" And I set the field "Filter by course" to "Course 1" And I press "Filter" - And I should see "Course 1" in the "#feedback_course_filter .fautocomplete .label" "css_element" + And I should see "Course 1" in the "#feedback_course_filter [data-fieldtype=autocomplete] .form-autocomplete-selection [role=listitem]" "css_element" And I show chart data for the "multichoicerated" feedback And I should see "0" in the "option a" "table_row" And I should see "1 (50.00 %)" in the "option b" "table_row" @@ -198,7 +198,7 @@ Feature: Mapping courses in a feedback And I am on site homepage And I follow "Course feedback" And I follow "Analysis" - And I should see "All courses" in the "#feedback_course_filter .fautocomplete .label" "css_element" + And I should see "All courses" in the "#feedback_course_filter [data-fieldtype=autocomplete] .form-autocomplete-selection [role=listitem]" "css_element" And I show chart data for the "multichoicerated" feedback And I should see "0" in the "option a" "table_row" And I should see "1 (33.33 %)" in the "option b" "table_row" @@ -236,7 +236,7 @@ Feature: Mapping courses in a feedback And I am on site homepage And I follow "Turn editing on" And I add the "Feedback" block - And I click on "Delete" "link" in the "//div[contains(@class,'block_site_main_menu')]//li[contains(.,'Course feedback')]" "xpath_element" + And I click on "Delete" "link" in the "//*[contains(@class,'block_site_main_menu')]//li[contains(.,'Course feedback')]" "xpath_element" And I press "Yes" And I follow "Turn editing off" And I am on site homepage diff --git a/mod/feedback/tests/behat/multichoice.feature b/mod/feedback/tests/behat/multichoice.feature index 0a672a1af24..dc20d35562d 100644 --- a/mod/feedback/tests/behat/multichoice.feature +++ b/mod/feedback/tests/behat/multichoice.feature @@ -86,7 +86,7 @@ Feature: Testing multichoice questions in feedback And I should not see "this is the third page of the feedback" And I press "Next page" # We are still on the second page because the field is required - And I should see "Required" in the ".error" "css_element" + And I should see "Required" in the "form" "css_element" And I should see "this is the second page of the feedback" And I set the field "option e" to "1" And the following fields match these values: @@ -158,7 +158,8 @@ Feature: Testing multichoice questions in feedback And I should see "1 (100.00 %)" in the "option i" "table_row" # Change the settings so we don't analyse empty submits And I follow "Edit questions" - And I click on "Edit question" "link" in the "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element" + And I open the action menu in "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element" + And I choose "Edit question" in the open action menu And I set the field "Do not analyse empty submits" to "Yes" And I press "Save changes to question" And I follow "Analysis" @@ -228,7 +229,7 @@ Feature: Testing multichoice questions in feedback And I should not see "this is the third page of the feedback" And I press "Next page" # We are still on the second page because the field is required - And I should see "Required" in the ".error" "css_element" + And I should see "Required" in the "form" "css_element" And I should see "this is the second page of the feedback" And I set the field "option e" to "1" And I set the field "option f" to "1" @@ -301,7 +302,8 @@ Feature: Testing multichoice questions in feedback And I should see "1 (100.00 %)" in the "option i" "table_row" # Change the settings so we don't analyse empty submits And I follow "Edit questions" - And I click on "Edit question" "link" in the "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element" + And I open the action menu in "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element" + And I choose "Edit question" in the open action menu And I set the field "Do not analyse empty submits" to "Yes" And I press "Save changes to question" And I follow "Analysis" @@ -363,7 +365,7 @@ Feature: Testing multichoice questions in feedback And I should not see "this is the third page of the feedback" And I press "Next page" # We are still on the second page because the field is required - And I should see "Required" in the ".error" "css_element" + And I should see "Required" in the "form" "css_element" And I should see "this is the second page of the feedback" And I set the field "this is a multiple choice 2" to "option e" And I press "Next page" @@ -423,7 +425,8 @@ Feature: Testing multichoice questions in feedback And I should see "1 (100.00 %)" in the "option i" "table_row" # Change the settings so we don't analyse empty submits And I follow "Edit questions" - And I click on "Edit question" "link" in the "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element" + And I open the action menu in "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element" + And I choose "Edit question" in the open action menu And I set the field "Do not analyse empty submits" to "Yes" And I press "Save changes to question" And I follow "Analysis" diff --git a/mod/feedback/yui/dragdrop/dragdrop.js b/mod/feedback/yui/dragdrop/dragdrop.js index 7ade1ea9562..532f7729200 100644 --- a/mod/feedback/yui/dragdrop/dragdrop.js +++ b/mod/feedback/yui/dragdrop/dragdrop.js @@ -4,8 +4,7 @@ YUI.add('moodle-mod_feedback-dragdrop', function(Y) { DRAGAREA : '#feedback_dragarea', DRAGITEMCLASS : 'feedback_itemlist', DRAGITEM : 'div.feedback_itemlist', - DRAGLIST : '#feedback_dragarea form > fieldset > div', - ITEMBOX : '#feedback_item_box_', + DRAGLIST : '#feedback_dragarea form', DRAGHANDLE : 'itemhandle' }; @@ -29,8 +28,7 @@ YUI.add('moodle-mod_feedback-dragdrop', function(Y) { basenode = Y.Node.one(CSS.DRAGLIST); listitems = basenode.all(CSS.DRAGITEM).each(function(v) { var item_id = this.get_node_id(v.get('id')); //Get the id of the feedback item. - var item_box = Y.Node.one(CSS.ITEMBOX + item_id); //Get the current item box so we can add the drag handle. - item_box.append(this.mydraghandle.cloneNode(true)); // Insert the new handle into the item box. + v.append(this.mydraghandle.cloneNode(true)); // Insert the new handle into the item box. }, this); //We use a delegate to make all items draggable diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index b49e3f655fc..a1eec3bf89e 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -536,7 +536,7 @@ function lesson_menu_block_contents($cmid, $lesson) { return null; } - $content = '\n
        \n
          \n"; + $content = ''.get_string('skip', 'lesson')."\n
          \n
            \n"; while ($pageid != 0) { $page = $pages[$pageid]; diff --git a/mod/lesson/mod_form.php b/mod/lesson/mod_form.php index f0fa12e3f3a..9c9df170a5f 100644 --- a/mod/lesson/mod_form.php +++ b/mod/lesson/mod_form.php @@ -396,7 +396,7 @@ class mod_lesson_mod_form extends moodleform_mod { $group = array(); $group[] =& $mform->createElement('checkbox', 'completiontimespentenabled', '', get_string('completiontimespent', 'lesson')); - $group[] =& $mform->createElement('duration', 'completiontimespent', array('optional' => true)); + $group[] =& $mform->createElement('duration', 'completiontimespent', '', array('optional' => false)); $mform->addGroup($group, 'completiontimespentgroup', get_string('completiontimespentgroup', 'lesson'), array(' '), false); $mform->disabledIf('completiontimespent[number]', 'completiontimespentenabled', 'notchecked'); $mform->disabledIf('completiontimespent[timeunit]', 'completiontimespentenabled', 'notchecked'); diff --git a/mod/lesson/styles.css b/mod/lesson/styles.css deleted file mode 100644 index 4c5bc069c70..00000000000 --- a/mod/lesson/styles.css +++ /dev/null @@ -1,79 +0,0 @@ -/** General styles (scope: all of lesson) **/ -.path-mod-lesson .contents, -.path-mod-lesson .standardtable, -.path-mod-lesson .mform .box.contents, -.path-mod-lesson .invisiblefieldset.fieldsetfix tr {text-align: left;} -.path-mod-lesson #layout-table {width: 100%;} -.path-mod-lesson .edit_buttons form, -.path-mod-lesson .edit_buttons input {display: inline;} -.path-mod-lesson .userinfotable .cell, -.path-mod-lesson .userinfotable .userpicture {vertical-align: middle;} -.path-mod-lesson .invisiblefieldset.fieldsetfix {display: block;} -.path-mod-lesson .slideshow {overflow: auto;padding: 15px;} -.path-mod-lesson .menu .menuwrapper {max-height: 400px;overflow: auto;vertical-align: top;margin-bottom: 10px;} -.path-mod-lesson .menu ul {list-style: none;padding: 5px 0px 0px 5px;margin: 0px;} -.path-mod-lesson .menu ul li {padding-bottom: 5px;} -.path-mod-lesson .skip {position: absolute;top: -1000em;width: 20em;} -.path-mod-lesson .branchbuttoncontainer.horizontal div, -.path-mod-lesson .branchbuttoncontainer.horizontal form {display: inline;} -.path-mod-lesson .firstpageoptions {width:30%;margin-left:35%;margin-top:1em;} -.path-mod-lesson .progress_bar_table, -.path-mod-lesson .progress_bar_completed, -.path-mod-lesson .progress_bar_todo {padding: 0;margin: 0;} -.path-mod-lesson .progress_bar_token {height: 20px;width: 5px;padding: 0;margin: 0;} -.path-mod-lesson .edit_pages_box .addlinks {margin:0;margin-bottom:1em;} -.path-mod-lesson .progress_bar_completed {background-color:green; text-align:right; vertical-align:middle; color:#FFF;} - -.path-mod-lesson .resourcecontent {text-align: center;} - -.path-mod-lesson .answeroption .fcheckbox > span { - position: relative; - float: left; -} - -.path-mod-lesson .answeroptiongroup .fgroup > span { - position: relative; - width: 100%; -} - -.path-mod-lesson .answeroption .fcheckbox input, -.path-mod-lesson .answeroptiongroup input { - position: absolute; - top: 2px; - margin-top: 0px; - left: 0; -} - -.path-mod-lesson .answeroption .fcheckbox label, -.path-mod-lesson .mform .fitem.answeroptiongroup fieldset.fgroup label { - padding-left: 20px; - float: left; -} - -.path-mod-lesson .answeroption .felement label p:last-child, -.path-mod-lesson .answeroptiongroup .felement label p:last-child { - margin-bottom: 0px; -} - -/** - * Style for view.php - **/ -#page-mod-lesson-view .password-form .submitbutton {display: inline;} -.path-mod-lesson .reviewessay {width:40%; border:1px solid #DDDDDD; background-color: #EEEEEE;} - -/* Countdown timer. */ -#lesson-timer { - text-align: center; -} - -.path-mod-lesson .essayungraded { - background-color: #efcfcf; -} - -.path-mod-lesson .essaygraded { - background-color: #efefcf; -} - -.path-mod-lesson .essaysent { - background-color: #cfefcf; -} diff --git a/mod/lesson/tests/behat/lesson_student_resume.feature b/mod/lesson/tests/behat/lesson_student_resume.feature index 946c5905513..e4d5234f8c5 100644 --- a/mod/lesson/tests/behat/lesson_student_resume.feature +++ b/mod/lesson/tests/behat/lesson_student_resume.feature @@ -414,4 +414,4 @@ Feature: In a lesson activity a student should | True | 1 | And I press "Submit" And I press "Continue" - And I should see "Congratulations - end of lesson reached" \ No newline at end of file + And I should see "Congratulations - end of lesson reached" diff --git a/mod/lesson/tests/behat/questions_images.feature b/mod/lesson/tests/behat/questions_images.feature index 9ebc9c25351..c83a7c529a1 100644 --- a/mod/lesson/tests/behat/questions_images.feature +++ b/mod/lesson/tests/behat/questions_images.feature @@ -47,7 +47,7 @@ Feature: In a lesson activity, teacher can add embedded images in questions answ | id_score_2 | 0 | # Atto needs focus to add image, select empty p tag to do so. And I select the text in the "id_answer_editor_2" Atto editor - And I click on "Image" "button" in the "#fitem_id_answer_editor_2" "css_element" + And I click on "Image" "button" in the "//*[@data-fieldtype='editor']/*[descendant::*[@id='id_answer_editor_2']]" "xpath_element" And I click on "Browse repositories..." "button" And I click on "Private files" "link" And I click on "moodle_logo.jpg" "link" @@ -69,7 +69,7 @@ Feature: In a lesson activity, teacher can add embedded images in questions answ | id_jumpto_1 | This page | # Atto needs focus to add image, select empty p tag to do so. And I select the text in the "id_response_editor_0" Atto editor - And I click on "Image" "button" in the "#fitem_id_response_editor_0" "css_element" + And I click on "Image" "button" in the "//*[@data-fieldtype='editor']/*[descendant::*[@id='id_response_editor_0']]" "xpath_element" And I click on "Browse repositories..." "button" And I click on "Private files" "link" And I click on "moodle_logo.jpg" "link" diff --git a/mod/lti/tests/behat/addtool.feature b/mod/lti/tests/behat/addtool.feature index 27336fca35f..8e51ddd95ba 100644 --- a/mod/lti/tests/behat/addtool.feature +++ b/mod/lti/tests/behat/addtool.feature @@ -34,5 +34,5 @@ Feature: Add tools | Activity name | Test tool activity 1 | | Launch container | Embed | And I open "Test tool activity 1" actions menu - And I follow "Edit settings" in the open menu + And I choose "Edit settings" in the open action menu Then the field "Preconfigured tool" matches value "Teaching Tool 1" diff --git a/mod/lti/tests/behat/addtype.feature b/mod/lti/tests/behat/addtype.feature index 3d1058694f6..88e0301f900 100644 --- a/mod/lti/tests/behat/addtype.feature +++ b/mod/lti/tests/behat/addtype.feature @@ -23,11 +23,11 @@ Feature: Add preconfigured tools via teacher interface And I add a "External tool" to section "1" and I fill the form with: | Activity name | Test tool activity 1 | And I open "Test tool activity 1" actions menu - And I follow "Edit settings" in the open menu + And I choose "Edit settings" in the open action menu And I set the field "Launch/cartridge URL" to local url "/mod/lti/tests/fixtures/ims_cartridge_basic_lti_link.xml" And I press "Save and return to course" And I open "Test tool activity 1" actions menu - And I follow "Edit settings" in the open menu + And I choose "Edit settings" in the open action menu And I expand all fieldsets Then the field "Launch/cartridge URL" matches value "http://www.example.com/lti/provider.php" And the field "Secure launch URL" matches value "https://www.example.com/lti/provider.php" @@ -42,7 +42,7 @@ Feature: Add preconfigured tools via teacher interface And I add a "External tool" to section "1" and I fill the form with: | Activity name | Test tool activity 1 | And I open "Test tool activity 1" actions menu - And I follow "Edit settings" in the open menu + And I choose "Edit settings" in the open action menu And I follow "Add preconfigured tool" And I switch to "add_tool" window And I set the field "Tool name" to "Placeholder" @@ -66,7 +66,7 @@ Feature: Add preconfigured tools via teacher interface And I add a "External tool" to section "1" and I fill the form with: | Activity name | Test tool activity 1 | And I open "Test tool activity 1" actions menu - And I follow "Edit settings" in the open menu + And I choose "Edit settings" in the open action menu And I set the field "Launch/cartridge URL" to local url "/mod/lti/tests/fixtures/tool_provider.php" And I press "Save and return to course" And I follow "Test tool activity 1" diff --git a/mod/quiz/renderer.php b/mod/quiz/renderer.php index 526f2f581f4..5135ab4d22e 100644 --- a/mod/quiz/renderer.php +++ b/mod/quiz/renderer.php @@ -851,7 +851,7 @@ class mod_quiz_renderer extends plugin_renderer_base { } $this->page->requires->js_call_amd('mod_quiz/preflightcheck', 'init', - array('.quizstartbuttondiv input[type=submit]', get_string('startattempt', 'quiz'), + array('.quizstartbuttondiv [type=submit]', get_string('startattempt', 'quiz'), '#mod_quiz_preflight_form', $popupjsoptions)); return $this->render($button) . $checkform; diff --git a/mod/quiz/tests/behat/behat_mod_quiz.php b/mod/quiz/tests/behat/behat_mod_quiz.php index 04307509479..c18fea9e7fb 100644 --- a/mod/quiz/tests/behat/behat_mod_quiz.php +++ b/mod/quiz/tests/behat/behat_mod_quiz.php @@ -297,20 +297,6 @@ class behat_mod_quiz extends behat_question_base { $this->find('xpath', $xpath)->click(); } - /** - * Click on a given link in the moodle-actionmenu that is currently open. - * @Given /^I follow "(?P(?:[^"]|\\")*)" in the open menu$/ - * @param string $linkstring the text (or id, etc.) of the link to click. - */ - public function i_follow_in_the_open_menu($linkstring) { - $openmenuxpath = "//div[contains(@class, 'moodle-actionmenu') and contains(@class, 'show')]"; - - $this->execute('behat_general::i_click_on_in_the', - array($linkstring, "link", $openmenuxpath, "xpath_element") - ); - - } - /** * Check whether a particular question is on a particular page of the quiz on the Edit quiz page. * @Given /^I should see "(?P(?:[^"]|\\")*)" on quiz page "(?P\d+)"$/ diff --git a/mod/quiz/tests/behat/editing_add.feature b/mod/quiz/tests/behat/editing_add.feature index 6e39c98f09a..43097619746 100644 --- a/mod/quiz/tests/behat/editing_add.feature +++ b/mod/quiz/tests/behat/editing_add.feature @@ -88,7 +88,7 @@ Feature: Edit quiz page - adding things # Add a question to page 2. When I open the "Page 2" add to quiz menu - And I follow "a new question" in the open menu + And I choose "a new question" in the open action menu And I set the field "qtype_qtype_essay" to "1" And I press "submitbutton" Then I should see "Adding an Essay question" @@ -241,7 +241,7 @@ Feature: Edit quiz page - adding things # Add a random question to page 4. And I open the "Page 4" add to quiz menu - And I follow "a new question" in the open menu + And I choose "a new question" in the open action menu And I set the field "qtype_qtype_essay" to "1" And I press "submitbutton" Then I should see "Adding an Essay question" diff --git a/mod/quiz/tests/behat/editing_move_by_click.feature b/mod/quiz/tests/behat/editing_move_by_click.feature index 923d6040200..11442c560d6 100644 --- a/mod/quiz/tests/behat/editing_move_by_click.feature +++ b/mod/quiz/tests/behat/editing_move_by_click.feature @@ -69,7 +69,7 @@ Feature: Edit quiz page - drag-and-drop When I click on the "Add" page break icon after question "Question A" When I open the "Page 2" add to quiz menu - And I follow "a new question" in the open menu + And I choose "a new question" in the open action menu And I set the field "qtype_qtype_description" to "1" And I press "submitbutton" Then I should see "Adding a description" diff --git a/mod/quiz/tests/behat/editing_repaginate.feature b/mod/quiz/tests/behat/editing_repaginate.feature index f639bf21406..fb9148a2bde 100644 --- a/mod/quiz/tests/behat/editing_repaginate.feature +++ b/mod/quiz/tests/behat/editing_repaginate.feature @@ -116,7 +116,7 @@ Feature: Edit quiz page - pagination # Add the forth Essay question in a new page (Page 4). When I open the "Page 3" add to quiz menu - And I follow "a new question" in the open menu + And I choose "a new question" in the open action menu And I set the field "qtype_qtype_essay" to "1" And I press "submitbutton" Then I should see "Adding an Essay question" diff --git a/mod/quiz/tests/behat/editing_section_headings.feature b/mod/quiz/tests/behat/editing_section_headings.feature index 94bb0be4aa1..59380e761c5 100644 --- a/mod/quiz/tests/behat/editing_section_headings.feature +++ b/mod/quiz/tests/behat/editing_section_headings.feature @@ -349,17 +349,17 @@ Feature: Edit quiz page - section headings And I follow "Edit quiz" And I click on the "Add" page break icon after question "TF1" And I click on "Add" "link" in the "Page 1" "list_item" - Then "a new section heading" "list_item" in the "Page 1" "list_item" should not be visible + Then "a new section heading" "link" in the "Page 1" "list_item" should not be visible # Click away to close the menu. And I click on ".numberofquestions" "css_element" And I click on "Add" "link" in the "Page 2" "list_item" - And "a new section heading" "list_item" in the "Page 2" "list_item" should be visible + And "a new section heading" "link" in the "Page 2" "list_item" should be visible And I click on ".numberofquestions" "css_element" And I click on "Add" "link" in the "Page 3" "list_item" - And "a new section heading" "list_item" in the "Page 3" "list_item" should be visible + And "a new section heading" "link" in the "Page 3" "list_item" should be visible And I click on ".numberofquestions" "css_element" And I click on "Add" "link" in the ".last-add-menu" "css_element" - And "a new section heading" "list_item" in the ".last-add-menu" "css_element" should not be visible + And "a new section heading" "link" in the ".last-add-menu" "css_element" should not be visible @javascript Scenario: Verify sections are added in the right place afte ajax changes @@ -384,5 +384,5 @@ Feature: Edit quiz page - section headings And I follow "Edit quiz" And I click on the "Remove" page break icon after question "TF1" And I open the "Page 2" add to quiz menu - And I follow "a new section heading" in the open menu + And I choose "a new section heading" in the open action menu Then "TF3" "list_item" should exist in the "Section heading ..." "list_item" diff --git a/mod/quiz/yui/build/moodle-mod_quiz-util-page/moodle-mod_quiz-util-page-debug.js b/mod/quiz/yui/build/moodle-mod_quiz-util-page/moodle-mod_quiz-util-page-debug.js index affa8a8ed1c..fe14f7be123 100644 --- a/mod/quiz/yui/build/moodle-mod_quiz-util-page/moodle-mod_quiz-util-page-debug.js +++ b/mod/quiz/yui/build/moodle-mod_quiz-util-page/moodle-mod_quiz-util-page-debug.js @@ -209,7 +209,9 @@ Y.Moodle.mod_quiz.util.page = { beforenode.insert(page, 'after'); // Enhance the add menu to make if fully visible and clickable. - M.core.actionmenu.newDOMNode(page); + if (typeof M.core.actionmenu !== "undefined") { + M.core.actionmenu.newDOMNode(page); + } return page; }, diff --git a/mod/quiz/yui/build/moodle-mod_quiz-util-page/moodle-mod_quiz-util-page-min.js b/mod/quiz/yui/build/moodle-mod_quiz-util-page/moodle-mod_quiz-util-page-min.js index beb77e3ac52..48fb0cdf498 100644 --- a/mod/quiz/yui/build/moodle-mod_quiz-util-page/moodle-mod_quiz-util-page-min.js +++ b/mod/quiz/yui/build/moodle-mod_quiz-util-page/moodle-mod_quiz-util-page-min.js @@ -1 +1 @@ -YUI.add("moodle-mod_quiz-util-page",function(e,t){e.namespace("Moodle.mod_quiz.util.page"),e.Moodle.mod_quiz.util.page={CSS:{PAGE:"page"},CONSTANTS:{ACTIONMENUIDPREFIX:"action-menu-",ACTIONMENUBARIDSUFFIX:"-menubar",ACTIONMENUMENUIDSUFFIX:"-menu",PAGEIDPREFIX:"page-",PAGENUMBERPREFIX:M.util.get_string("page","moodle")+" "},SELECTORS:{ACTIONMENU:"div.moodle-actionmenu",ACTIONMENUBAR:".menubar",ACTIONMENUMENU:".menu",ADDASECTION:'[data-action="addasection"]',PAGE:"li.page",INSTANCENAME:".instancename",NUMBER:"h4"},getPageFromComponent:function(t){return e.one(t).ancestor(this.SELECTORS.PAGE,!0)},getPageFromSlot:function(t){return e.one(t).previous(this.SELECTORS.PAGE)},getId:function(e){var t=e.get("id").replace(this.CONSTANTS.PAGEIDPREFIX,"");return t=parseInt(t,10),typeof t=="number"&&isFinite(t)?t:!1},setId:function(e,t){e.set("id",this.CONSTANTS.PAGEIDPREFIX+t)},getName:function(e){var t=e.one(this.SELECTORS.INSTANCENAME);return t?t.get("firstChild").get("data"):null},getNumber:function(e){var t=e.one(this.SELECTORS.NUMBER).get("text").replace(this.CONSTANTS.PAGENUMBERPREFIX,"");return t=parseInt(t,10),typeof t=="number"&&isFinite(t)?t:!1},setNumber:function(e,t){e.one(this.SELECTORS.NUMBER).set("text",this.CONSTANTS.PAGENUMBERPREFIX+t)},getPages:function(){return e.all(e.Moodle.mod_quiz.util.slot.SELECTORS.PAGECONTENT+" "+e.Moodle.mod_quiz.util.slot.SELECTORS.SECTIONUL+" "+this.SELECTORS.PAGE)},isPage:function(e){return e?e.hasClass(this.CSS.PAGE):!1},isEmpty:function(e){var t=e.next("li.activity");return t?!t.hasClass("slot"):!0},add:function(t){var n=this.getNumber(this.getPageFromSlot(t))+1,r=M.mod_quiz.resource_toolbox.get("config").pagehtml;r=r.replace(/%%PAGENUMBER%%/g,n);var i=e.Node.create(r);return YUI().use("dd-drop",function(e){var t=new e.DD.Drop({node:i,groups:M.mod_quiz.dragres.groups});i.drop=t}),t.insert(i,"after"),M.core.actionmenu.newDOMNode(i),i},remove:function(t,n){var r=t.previous(e.Moodle.mod_quiz.util.slot.SELECTORS.SLOT);!n&&r&&e.Moodle.mod_quiz.util.slot.removePageBreak(r),t.remove()},reorderPages:function(){var e=this.getPages(),t=0;e.each(function(e){if(this.isEmpty(e)){var n=e.next("li.slot")?!0:!1;this.remove(e,n);return}t++,this.setNumber(e,t),this.setId(e,t)},this),this.reorderActionMenus()},reorderActionMenus:function(){var e=this.getActionMenus();e.each(function(t,n){var r=e.item(n-1),i=0;r&&(i=this.getActionMenuId(r));var s=i+1;this.setActionMenuId(t,s);var o=t.one(this.SELECTORS.ACTIONMENUBAR);o.set("id",this.CONSTANTS.ACTIONMENUIDPREFIX+s+this.CONSTANTS.ACTIONMENUBARIDSUFFIX);var u=t.one(this.SELECTORS.ACTIONMENUMENU);u.set("id",this.CONSTANTS.ACTIONMENUIDPREFIX+s+this.CONSTANTS.ACTIONMENUMENUIDSUFFIX),u.one(this.SELECTORS.ADDASECTION).set("href",u.one(this.SELECTORS.ADDASECTION).get("href").replace(/\baddsectionatpage=\d/,"addsectionatpage="+s))},this)},getActionMenus:function(){return e.all(e.Moodle.mod_quiz.util.slot.SELECTORS.PAGECONTENT+" "+e.Moodle.mod_quiz.util.slot.SELECTORS.SECTIONUL+" "+this.SELECTORS.ACTIONMENU)},getActionMenuId:function(e){var t=e.get("id").replace(this.CONSTANTS.ACTIONMENUIDPREFIX,"");return t=parseInt(t,10),typeof t=="number"&&isFinite(t)?t:!1},setActionMenuId:function(e,t){e.set("id",this.CONSTANTS.ACTIONMENUIDPREFIX+t)}}},"@VERSION@",{requires:["node","moodle-mod_quiz-util-base"]}); +YUI.add("moodle-mod_quiz-util-page",function(e,t){e.namespace("Moodle.mod_quiz.util.page"),e.Moodle.mod_quiz.util.page={CSS:{PAGE:"page"},CONSTANTS:{ACTIONMENUIDPREFIX:"action-menu-",ACTIONMENUBARIDSUFFIX:"-menubar",ACTIONMENUMENUIDSUFFIX:"-menu",PAGEIDPREFIX:"page-",PAGENUMBERPREFIX:M.util.get_string("page","moodle")+" "},SELECTORS:{ACTIONMENU:"div.moodle-actionmenu",ACTIONMENUBAR:".menubar",ACTIONMENUMENU:".menu",ADDASECTION:'[data-action="addasection"]',PAGE:"li.page",INSTANCENAME:".instancename",NUMBER:"h4"},getPageFromComponent:function(t){return e.one(t).ancestor(this.SELECTORS.PAGE,!0)},getPageFromSlot:function(t){return e.one(t).previous(this.SELECTORS.PAGE)},getId:function(e){var t=e.get("id").replace(this.CONSTANTS.PAGEIDPREFIX,"");return t=parseInt(t,10),typeof t=="number"&&isFinite(t)?t:!1},setId:function(e,t){e.set("id",this.CONSTANTS.PAGEIDPREFIX+t)},getName:function(e){var t=e.one(this.SELECTORS.INSTANCENAME);return t?t.get("firstChild").get("data"):null},getNumber:function(e){var t=e.one(this.SELECTORS.NUMBER).get("text").replace(this.CONSTANTS.PAGENUMBERPREFIX,"");return t=parseInt(t,10),typeof t=="number"&&isFinite(t)?t:!1},setNumber:function(e,t){e.one(this.SELECTORS.NUMBER).set("text",this.CONSTANTS.PAGENUMBERPREFIX+t)},getPages:function(){return e.all(e.Moodle.mod_quiz.util.slot.SELECTORS.PAGECONTENT+" "+e.Moodle.mod_quiz.util.slot.SELECTORS.SECTIONUL+" "+this.SELECTORS.PAGE)},isPage:function(e){return e?e.hasClass(this.CSS.PAGE):!1},isEmpty:function(e){var t=e.next("li.activity");return t?!t.hasClass("slot"):!0},add:function(t){var n=this.getNumber(this.getPageFromSlot(t))+1,r=M.mod_quiz.resource_toolbox.get("config").pagehtml;r=r.replace(/%%PAGENUMBER%%/g,n);var i=e.Node.create(r);return YUI().use("dd-drop",function(e){var t=new e.DD.Drop({node:i,groups:M.mod_quiz.dragres.groups});i.drop=t}),t.insert(i,"after"),typeof M.core.actionmenu!="undefined"&&M.core.actionmenu.newDOMNode(i),i},remove:function(t,n){var r=t.previous(e.Moodle.mod_quiz.util.slot.SELECTORS.SLOT);!n&&r&&e.Moodle.mod_quiz.util.slot.removePageBreak(r),t.remove()},reorderPages:function(){var e=this.getPages(),t=0;e.each(function(e){if(this.isEmpty(e)){var n=e.next("li.slot")?!0:!1;this.remove(e,n);return}t++,this.setNumber(e,t),this.setId(e,t)},this),this.reorderActionMenus()},reorderActionMenus:function(){var e=this.getActionMenus();e.each(function(t,n){var r=e.item(n-1),i=0;r&&(i=this.getActionMenuId(r));var s=i+1;this.setActionMenuId(t,s);var o=t.one(this.SELECTORS.ACTIONMENUBAR);o.set("id",this.CONSTANTS.ACTIONMENUIDPREFIX+s+this.CONSTANTS.ACTIONMENUBARIDSUFFIX);var u=t.one(this.SELECTORS.ACTIONMENUMENU);u.set("id",this.CONSTANTS.ACTIONMENUIDPREFIX+s+this.CONSTANTS.ACTIONMENUMENUIDSUFFIX),u.one(this.SELECTORS.ADDASECTION).set("href",u.one(this.SELECTORS.ADDASECTION).get("href").replace(/\baddsectionatpage=\d/,"addsectionatpage="+s))},this)},getActionMenus:function(){return e.all(e.Moodle.mod_quiz.util.slot.SELECTORS.PAGECONTENT+" "+e.Moodle.mod_quiz.util.slot.SELECTORS.SECTIONUL+" "+this.SELECTORS.ACTIONMENU)},getActionMenuId:function(e){var t=e.get("id").replace(this.CONSTANTS.ACTIONMENUIDPREFIX,"");return t=parseInt(t,10),typeof t=="number"&&isFinite(t)?t:!1},setActionMenuId:function(e,t){e.set("id",this.CONSTANTS.ACTIONMENUIDPREFIX+t)}}},"@VERSION@",{requires:["node","moodle-mod_quiz-util-base"]}); diff --git a/mod/quiz/yui/build/moodle-mod_quiz-util-page/moodle-mod_quiz-util-page.js b/mod/quiz/yui/build/moodle-mod_quiz-util-page/moodle-mod_quiz-util-page.js index affa8a8ed1c..fe14f7be123 100644 --- a/mod/quiz/yui/build/moodle-mod_quiz-util-page/moodle-mod_quiz-util-page.js +++ b/mod/quiz/yui/build/moodle-mod_quiz-util-page/moodle-mod_quiz-util-page.js @@ -209,7 +209,9 @@ Y.Moodle.mod_quiz.util.page = { beforenode.insert(page, 'after'); // Enhance the add menu to make if fully visible and clickable. - M.core.actionmenu.newDOMNode(page); + if (typeof M.core.actionmenu !== "undefined") { + M.core.actionmenu.newDOMNode(page); + } return page; }, diff --git a/mod/quiz/yui/src/util/js/page.js b/mod/quiz/yui/src/util/js/page.js index 4088a05b434..f48507a0c19 100644 --- a/mod/quiz/yui/src/util/js/page.js +++ b/mod/quiz/yui/src/util/js/page.js @@ -207,7 +207,9 @@ Y.Moodle.mod_quiz.util.page = { beforenode.insert(page, 'after'); // Enhance the add menu to make if fully visible and clickable. - M.core.actionmenu.newDOMNode(page); + if (typeof M.core.actionmenu !== "undefined") { + M.core.actionmenu.newDOMNode(page); + } return page; }, diff --git a/mod/quiz/yui/src/util/meta/util.json b/mod/quiz/yui/src/util/meta/util.json index 4dca54b340b..ba442abd66a 100644 --- a/mod/quiz/yui/src/util/meta/util.json +++ b/mod/quiz/yui/src/util/meta/util.json @@ -1,7 +1,7 @@ { "moodle-mod_quiz-util": { "requires": [ - "node" + "node", "moodle-core-actionmenu" ], "use": [ "moodle-mod_quiz-util-base" diff --git a/mod/wiki/editors/wikieditor.php b/mod/wiki/editors/wikieditor.php index 187c34199e7..44d3c3bf4ae 100644 --- a/mod/wiki/editors/wikieditor.php +++ b/mod/wiki/editors/wikieditor.php @@ -28,8 +28,12 @@ require_once($CFG->dirroot.'/lib/formslib.php'); require_once($CFG->dirroot.'/lib/form/textarea.php'); +require_once($CFG->dirroot.'/lib/form/templatable_form_element.php'); class MoodleQuickForm_wikieditor extends MoodleQuickForm_textarea { + use templatable_form_element { + export_for_template as export_for_template_base; + } private $files; @@ -50,7 +54,9 @@ class MoodleQuickForm_wikieditor extends MoodleQuickForm_textarea { unset($attributes['files']); } + parent::__construct($elementName, $elementLabel, $attributes); + $this->_type = 'wikieditor'; } /** @@ -169,6 +175,13 @@ class MoodleQuickForm_wikieditor extends MoodleQuickForm_textarea { private function escapeToken(&$token) { $token = urlencode(str_replace("'", "\'", $token)); } + + public function export_for_template(renderer_base $output) { + $context = $this->export_for_template_base($output); + $context['html'] = $this->toHtml(); + + return $context; + } } //register wikieditor diff --git a/mod/wiki/tests/behat/wiki_formats.feature b/mod/wiki/tests/behat/wiki_formats.feature index c815f2b323e..5fd082ba1c7 100644 --- a/mod/wiki/tests/behat/wiki_formats.feature +++ b/mod/wiki/tests/behat/wiki_formats.feature @@ -67,7 +67,7 @@ Feature: There is a choice of formats for editing a wiki page When I set the following fields to these values: | HTML format | 1 | And I press "Create page" - Then "#fitem_id_newcontent_editor" "css_element" should exist + Then "#id_newcontent_editor" "css_element" should exist And I set the following fields to these values: | HTML format | I'm a text | And I press "Save" diff --git a/mod/workshop/tests/behat/behat_mod_workshop.php b/mod/workshop/tests/behat/behat_mod_workshop.php index e1ea3dce27b..ec539b264e2 100644 --- a/mod/workshop/tests/behat/behat_mod_workshop.php +++ b/mod/workshop/tests/behat/behat_mod_workshop.php @@ -71,7 +71,7 @@ class behat_mod_workshop extends behat_base { public function i_add_a_submission_in_workshop_as($workshopname, $table) { $workshopname = $this->escape($workshopname); $savechanges = $this->escape(get_string('savechanges')); - $xpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' ownsubmission ')]/descendant::input[@type='submit']"; + $xpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' ownsubmission ')]/descendant::*[@type='submit']"; $this->execute('behat_general::click_link', $workshopname); diff --git a/mod/workshop/tests/behat/workshop_assessment.feature b/mod/workshop/tests/behat/workshop_assessment.feature index e8b99574218..81637af23dc 100644 --- a/mod/workshop/tests/behat/workshop_assessment.feature +++ b/mod/workshop/tests/behat/workshop_assessment.feature @@ -153,4 +153,3 @@ Feature: Workshop submission and assessment @javascript Scenario: Add and assess submissions in workshop with javascript enabled - Scenario: Add and assess submissions in workshop with javascript disabled diff --git a/report/loglive/classes/renderer.php b/report/loglive/classes/renderer.php index 5dcf50cd22f..c65e78e72cf 100644 --- a/report/loglive/classes/renderer.php +++ b/report/loglive/classes/renderer.php @@ -92,7 +92,7 @@ class report_loglive_renderer extends plugin_renderer_base { if ($reportloglive->page == 0 && $reportloglive->selectedlogreader) { echo html_writer::tag('button' , get_string('pause', 'report_loglive'), array('id' => 'livelogs-pause-button')); $icon = new pix_icon('i/loading_small', 'loading', 'moodle', array('class' => 'spinner')); - return $this->output->render($icon); + return html_writer::tag('span', $this->output->render($icon), array('class' => 'spinner')); } return ''; } @@ -114,4 +114,4 @@ class report_loglive_renderer extends plugin_renderer_base { return $o; } -} \ No newline at end of file +} diff --git a/report/loglive/yui/build/moodle-report_loglive-fetchlogs/moodle-report_loglive-fetchlogs-debug.js b/report/loglive/yui/build/moodle-report_loglive-fetchlogs/moodle-report_loglive-fetchlogs-debug.js index edc7159c251..2f0d62cafce 100644 --- a/report/loglive/yui/build/moodle-report_loglive-fetchlogs/moodle-report_loglive-fetchlogs-debug.js +++ b/report/loglive/yui/build/moodle-report_loglive-fetchlogs/moodle-report_loglive-fetchlogs-debug.js @@ -63,7 +63,7 @@ Y.extend(FetchLogs, Y.Base, { /** * Initializer. - * Basic setup and delegations. + * Basic setup and event listeners. * * @method initializer */ @@ -76,7 +76,7 @@ Y.extend(FetchLogs, Y.Base, { this.spinner = Y.one(SELECTORS.SPINNER); this.pauseButton = Y.one(SELECTORS.PAUSEBUTTON); this.spinner.hide(); - Y.delegate('click', this.toggleUpdate, 'button', SELECTORS.PAUSEBUTTON, this); + Y.one(SELECTORS.PAUSEBUTTON).on('click', this.toggleUpdate, this); }, /** diff --git a/report/loglive/yui/build/moodle-report_loglive-fetchlogs/moodle-report_loglive-fetchlogs-min.js b/report/loglive/yui/build/moodle-report_loglive-fetchlogs/moodle-report_loglive-fetchlogs-min.js index 7963b2c0557..4ceb1a7b57e 100644 --- a/report/loglive/yui/build/moodle-report_loglive-fetchlogs/moodle-report_loglive-fetchlogs-min.js +++ b/report/loglive/yui/build/moodle-report_loglive-fetchlogs/moodle-report_loglive-fetchlogs-min.js @@ -1 +1 @@ -YUI.add("moodle-report_loglive-fetchlogs",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}var r={NEWROW:"newrow",SPINNER:"spinner",ICONSMALL:"iconsmall"},i={NEWROW:"."+r.NEWROW,TBODY:".flexible tbody",PAUSEBUTTON:"#livelogs-pause-button",SPINNER:"."+r.SPINNER};e.extend(n,e.Base,{callBack:{},spinner:{},pauseButton:{},initializer:function(){this.get("page")===0&&(this.callBack=e.later(this.get("interval")*1e3,this,this.fetchRecentLogs,null,!0)),this.spinner=e.one(i.SPINNER),this.pauseButton=e.one(i.PAUSEBUTTON),this.spinner.hide(),e.delegate("click",this.toggleUpdate,"button",i.PAUSEBUTTON,this)},fetchRecentLogs:function(){this.spinner.show();var t={logreader:this.get("logreader"),since:this.get("since"),page:this.get("page"),id:this.get("courseid")},n={method:"get",context:this,on:{complete:this.updateLogTable},data:t},r=M.cfg.wwwroot+"/report/loglive/loglive_ajax.php";e.io(r,n)},updateLogTable:function(t,n){e.later(600,this,"hideLoadingIcon");var r;try{r=e.JSON.parse(n.responseText);if(r.error)return e.use("moodle-core-notification-ajaxexception",function(){return new M.core.ajaxException(r)}),this}catch(s){return e.use("moodle-core-notification-exception",function(){return new M.core.exception(s)}),this}this.set("since",r.until);var o=r.logs,u=e.one(i.TBODY),a=null;if(u&&o){a=u.get("firstChild"),a&&u.insertBefore(o,a);var f=u.get("children").slice(this.get("perpage"));f.remove(),e.later(5e3,this,"removeHighlight",r.until)}},removeHighlight:function(t){e.all(".time"+t).removeClass(r.NEWROW)},hideLoadingIcon:function(){this.spinner.hide()},toggleUpdate:function(){this.callBack?(this.callBack.cancel(),this.callBack="",this.pauseButton.setContent(M.util.get_string("resume","report_loglive"))):(this.callBack=e.later(this.get("interval")*1e3,this,this.fetchRecentLogs,null,!0),this.pauseButton.setContent(M.util.get_string("pause","report_loglive")))}},{NAME:"fetchLogs",ATTRS:{since:null,courseid:0,page:0,perpage:100,interval:60,logreader:"logstore_standard"}}),e.namespace("M.report_loglive.FetchLogs").init=function(e){return new n(e)}},"@VERSION@",{requires:["base","event","node","io","node-event-delegate"]}); +YUI.add("moodle-report_loglive-fetchlogs",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}var r={NEWROW:"newrow",SPINNER:"spinner",ICONSMALL:"iconsmall"},i={NEWROW:"."+r.NEWROW,TBODY:".flexible tbody",PAUSEBUTTON:"#livelogs-pause-button",SPINNER:"."+r.SPINNER};e.extend(n,e.Base,{callBack:{},spinner:{},pauseButton:{},initializer:function(){this.get("page")===0&&(this.callBack=e.later(this.get("interval")*1e3,this,this.fetchRecentLogs,null,!0)),this.spinner=e.one(i.SPINNER),this.pauseButton=e.one(i.PAUSEBUTTON),this.spinner.hide(),e.one(i.PAUSEBUTTON).on("click",this.toggleUpdate,this)},fetchRecentLogs:function(){this.spinner.show();var t={logreader:this.get("logreader"),since:this.get("since"),page:this.get("page"),id:this.get("courseid")},n={method:"get",context:this,on:{complete:this.updateLogTable},data:t},r=M.cfg.wwwroot+"/report/loglive/loglive_ajax.php";e.io(r,n)},updateLogTable:function(t,n){e.later(600,this,"hideLoadingIcon");var r;try{r=e.JSON.parse(n.responseText);if(r.error)return e.use("moodle-core-notification-ajaxexception",function(){return new M.core.ajaxException(r)}),this}catch(s){return e.use("moodle-core-notification-exception",function(){return new M.core.exception(s)}),this}this.set("since",r.until);var o=r.logs,u=e.one(i.TBODY),a=null;if(u&&o){a=u.get("firstChild"),a&&u.insertBefore(o,a);var f=u.get("children").slice(this.get("perpage"));f.remove(),e.later(5e3,this,"removeHighlight",r.until)}},removeHighlight:function(t){e.all(".time"+t).removeClass(r.NEWROW)},hideLoadingIcon:function(){this.spinner.hide()},toggleUpdate:function(){this.callBack?(this.callBack.cancel(),this.callBack="",this.pauseButton.setContent(M.util.get_string("resume","report_loglive"))):(this.callBack=e.later(this.get("interval")*1e3,this,this.fetchRecentLogs,null,!0),this.pauseButton.setContent(M.util.get_string("pause","report_loglive")))}},{NAME:"fetchLogs",ATTRS:{since:null,courseid:0,page:0,perpage:100,interval:60,logreader:"logstore_standard"}}),e.namespace("M.report_loglive.FetchLogs").init=function(e){return new n(e)}},"@VERSION@",{requires:["base","event","node","io","node-event-delegate"]}); diff --git a/report/loglive/yui/build/moodle-report_loglive-fetchlogs/moodle-report_loglive-fetchlogs.js b/report/loglive/yui/build/moodle-report_loglive-fetchlogs/moodle-report_loglive-fetchlogs.js index edc7159c251..2f0d62cafce 100644 --- a/report/loglive/yui/build/moodle-report_loglive-fetchlogs/moodle-report_loglive-fetchlogs.js +++ b/report/loglive/yui/build/moodle-report_loglive-fetchlogs/moodle-report_loglive-fetchlogs.js @@ -63,7 +63,7 @@ Y.extend(FetchLogs, Y.Base, { /** * Initializer. - * Basic setup and delegations. + * Basic setup and event listeners. * * @method initializer */ @@ -76,7 +76,7 @@ Y.extend(FetchLogs, Y.Base, { this.spinner = Y.one(SELECTORS.SPINNER); this.pauseButton = Y.one(SELECTORS.PAUSEBUTTON); this.spinner.hide(); - Y.delegate('click', this.toggleUpdate, 'button', SELECTORS.PAUSEBUTTON, this); + Y.one(SELECTORS.PAUSEBUTTON).on('click', this.toggleUpdate, this); }, /** diff --git a/report/loglive/yui/src/fetchlogs/js/fetchlogs.js b/report/loglive/yui/src/fetchlogs/js/fetchlogs.js index c367701d967..a4efb8ef4cb 100644 --- a/report/loglive/yui/src/fetchlogs/js/fetchlogs.js +++ b/report/loglive/yui/src/fetchlogs/js/fetchlogs.js @@ -61,7 +61,7 @@ Y.extend(FetchLogs, Y.Base, { /** * Initializer. - * Basic setup and delegations. + * Basic setup and event listeners. * * @method initializer */ @@ -74,7 +74,7 @@ Y.extend(FetchLogs, Y.Base, { this.spinner = Y.one(SELECTORS.SPINNER); this.pauseButton = Y.one(SELECTORS.PAUSEBUTTON); this.spinner.hide(); - Y.delegate('click', this.toggleUpdate, 'button', SELECTORS.PAUSEBUTTON, this); + Y.one(SELECTORS.PAUSEBUTTON).on('click', this.toggleUpdate, this); }, /** diff --git a/repository/tests/behat/cancel_add_file.feature b/repository/tests/behat/cancel_add_file.feature index 294d5cdde94..3207b097f14 100644 --- a/repository/tests/behat/cancel_add_file.feature +++ b/repository/tests/behat/cancel_add_file.feature @@ -21,7 +21,7 @@ Feature: A selected file can be cancelled | Name | Folder name | | Description | Folder description | And I upload "lib/tests/fixtures/upload_users.csv" file to "Files" filemanager - And I click on "#fitem_id_files .fp-btn-add a" "css_element" + And I click on "//label[contains(., 'Files')]/ancestor::div[contains(concat(' ', @class, ' '), ' fitem ')]//*[contains(@title, 'Add...')]" "xpath_element" And I click on "Recent files" "link" in the ".fp-repo-area" "css_element" And I click on "//a[contains(concat(' ', normalize-space(@class), ' '), ' fp-file ')][normalize-space(.)='empty.txt']" "xpath_element" And I click on ".moodle-dialogue-focused .fp-select .fp-select-cancel" "css_element" diff --git a/repository/upload/tests/behat/behat_repository_upload.php b/repository/upload/tests/behat/behat_repository_upload.php index 693814dfc80..35d723eff5e 100644 --- a/repository/upload/tests/behat/behat_repository_upload.php +++ b/repository/upload/tests/behat/behat_repository_upload.php @@ -118,7 +118,7 @@ class behat_repository_upload extends behat_files { 'xpath', "//div[contains(concat(' ', normalize-space(@class), ' '), ' file-picker ')]" . "[contains(concat(' ', normalize-space(@class), ' '), ' repository_upload ')]" . - "/descendant::div[@class='fp-content']" . + "/descendant::div[contains(concat(' ', normalize-space(@class), ' '), ' fp-content ')]" . "/descendant::div[contains(concat(' ', normalize-space(@class), ' '), ' fp-upload-form ')]" . "/descendant::form", $noformexception diff --git a/tag/classes/collections_table.php b/tag/classes/collections_table.php index 90028edb594..5e6d23e30a6 100644 --- a/tag/classes/collections_table.php +++ b/tag/classes/collections_table.php @@ -77,7 +77,7 @@ class core_tag_collections_table extends html_table { // Delete. $url->param('action', 'colldelete'); $actions .= $OUTPUT->action_icon('#', new pix_icon('t/delete', get_string('delete')), null, - array('data-url' => $url, 'data-collname' => $name, + array('data-url' => $url->out(false), 'data-collname' => $name, 'class' => 'action-icon action_delete')); } $component = ''; @@ -89,7 +89,7 @@ class core_tag_collections_table extends html_table { $validareas = core_tag_collection::get_areas_names($tagcoll->id); $areaslist = array_map(function($key) use ($allareas, $validareas) { return "
          • {$allareas[$key]}
          • "; }, array_keys($allareas)); $displayname = new \core_tag\output\tagcollname($tagcoll); @@ -104,4 +104,4 @@ class core_tag_collections_table extends html_table { } } -} \ No newline at end of file +} diff --git a/theme/bootstrapbase/less/moodle/modules.less b/theme/bootstrapbase/less/moodle/modules.less index cb1ac11116a..58460f21151 100644 --- a/theme/bootstrapbase/less/moodle/modules.less +++ b/theme/bootstrapbase/less/moodle/modules.less @@ -9,6 +9,94 @@ select { width: auto; } +// Feedback module +.path-mod-feedback .mform.feedback_form .fitem .fitemtitle { + display: block; + margin-top: 4px; + margin-bottom: 4px; + text-align: left; + width: 100%; +} + +.path-mod-feedback .mform.feedback_form .fitem .felement { + margin-left: 0; + width: 100%; + float: left; + padding-left: 0; + padding-right: 0; +} + +.path-mod-feedback .mform.feedback_form .fitem .fstatic:empty { + display: none; +} + +.path-mod-feedback .mform.feedback_form .fitem .fcheckbox > span, +.path-mod-feedback .mform.feedback_form .fitem .fradio > span, +.path-mod-feedback .mform.feedback_form .fitem .fgroup > span { + margin-top: 4px; +} + +body.path-mod-feedback #region-main .mform.feedback_form .femptylabel .fitemtitle { + display: inline-block; + width: auto; + margin-right: 0; +} + +.path-mod-feedback .mform.feedback_form .femptylabel .felement { + display: inline-block; + margin-top: 4px; + padding-top: 5px; + width: auto; +} + +body.path-mod-feedback #region-main .mform.feedback_form .feedback-item-pagebreak .felement { + width: 100%; +} + +.path-mod-feedback .mform.feedback_form .fitem_fcheckbox .fitemtitle, +.path-mod-feedback .mform.feedback_form .fitem_fcheckbox .felement { + display: inline-block; + width: auto; +} + +.path-mod-feedback .mform.feedback_form .fitem_fcheckbox .felement { + padding: 6px; +} + +.path-mod-feedback .mform.feedback_form#feedback_viewresponse_form .fitem.feedback_hasvalue:not(.feedback-item-captcha) .felement { + background: #FBFBF1; + min-height: 1em; + box-sizing: border-box; + padding: 3px; + border: 1px solid #ddd +} + +.path-mod-feedback .mform.feedback_form .fitem.feedback_hasvalue .fstatic:empty { + display: inherit; +} + +.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem:hover { + background: #f5f5f5; +} + +.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle label { + width: 100%; +} + +.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle { + position: relative; + width: 100%; +} + +.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle .itemdd, +.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle .itemname { + float: left; +} + +.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle .itemactions { + float: right; +} + // Forum module .path-mod-forum .forumsearch { @@ -228,6 +316,86 @@ div#dock { text-align: center; } +/** General styles (scope: all of lesson) **/ +.path-mod-lesson .contents, +.path-mod-lesson .standardtable, +.path-mod-lesson .mform .box.contents, +.path-mod-lesson .invisiblefieldset.fieldsetfix tr {text-align: left;} +.path-mod-lesson #layout-table {width: 100%;} +.path-mod-lesson .edit_buttons form, +.path-mod-lesson .edit_buttons input {display: inline;} +.path-mod-lesson .userinfotable .cell, +.path-mod-lesson .userinfotable .userpicture {vertical-align: middle;} +.path-mod-lesson .invisiblefieldset.fieldsetfix {display: block;} +.path-mod-lesson .slideshow {overflow: auto;padding: 15px;} +.path-mod-lesson .menu .menuwrapper {max-height: 400px;overflow: auto;vertical-align: top;margin-bottom: 10px;} +.path-mod-lesson .menu ul {list-style: none;padding: 5px 0px 0px 5px;margin: 0px;} +.path-mod-lesson .menu ul li {padding-bottom: 5px;} +.path-mod-lesson .skip {position: absolute;top: -1000em;width: 20em;} +.path-mod-lesson .branchbuttoncontainer.horizontal div, +.path-mod-lesson .branchbuttoncontainer.horizontal form {display: inline;} +.path-mod-lesson .firstpageoptions {width:30%;margin-left:35%;margin-top:1em;} +.path-mod-lesson .progress_bar_table, +.path-mod-lesson .progress_bar_completed, +.path-mod-lesson .progress_bar_todo {padding: 0;margin: 0;} +.path-mod-lesson .progress_bar_token {height: 20px;width: 5px;padding: 0;margin: 0;} +.path-mod-lesson .edit_pages_box .addlinks {margin:0;margin-bottom:1em;} +.path-mod-lesson .progress_bar_completed {background-color:green; text-align:right; vertical-align:middle; color:#FFF;} + +.path-mod-lesson .resourcecontent {text-align: center;} + +.path-mod-lesson .answeroption .fcheckbox > span { + position: relative; + float: left; +} + +.path-mod-lesson .answeroptiongroup .fgroup > span { + position: relative; + width: 100%; +} + +.path-mod-lesson .answeroption .fcheckbox input, +.path-mod-lesson .answeroptiongroup input { + position: absolute; + top: 2px; + margin-top: 0px; + left: 0; +} + +.path-mod-lesson .answeroption .fcheckbox label, +.path-mod-lesson .mform .fitem.answeroptiongroup fieldset.fgroup label { + padding-left: 20px; + float: left; +} + +.path-mod-lesson .answeroption .felement label p:last-child, +.path-mod-lesson .answeroptiongroup .felement label p:last-child { + margin-bottom: 0px; +} + +/** + * Style for view.php + **/ +#page-mod-lesson-view .password-form .submitbutton {display: inline;} +.path-mod-lesson .reviewessay {width:40%; border:1px solid #DDDDDD; background-color: #EEEEEE;} + +/* Countdown timer. */ +#lesson-timer { + text-align: center; +} + +.path-mod-lesson .essayungraded { + background-color: #efcfcf; +} + +.path-mod-lesson .essaygraded { + background-color: #efefcf; +} + +.path-mod-lesson .essaysent { + background-color: #cfefcf; +} + .path-mod-wiki .wiki_headingtitle, .path-mod-wiki .midpad, .path-mod-wiki .wiki_headingtime { diff --git a/theme/bootstrapbase/style/moodle.css b/theme/bootstrapbase/style/moodle.css index 48c1c72644b..1334be72582 100644 --- a/theme/bootstrapbase/style/moodle.css +++ b/theme/bootstrapbase/style/moodle.css @@ -13458,6 +13458,77 @@ body.modal-open { select { width: auto; } +.path-mod-feedback .mform.feedback_form .fitem .fitemtitle { + display: block; + margin-top: 4px; + margin-bottom: 4px; + text-align: left; + width: 100%; +} +.path-mod-feedback .mform.feedback_form .fitem .felement { + margin-left: 0; + width: 100%; + float: left; + padding-left: 0; + padding-right: 0; +} +.path-mod-feedback .mform.feedback_form .fitem .fstatic:empty { + display: none; +} +.path-mod-feedback .mform.feedback_form .fitem .fcheckbox > span, +.path-mod-feedback .mform.feedback_form .fitem .fradio > span, +.path-mod-feedback .mform.feedback_form .fitem .fgroup > span { + margin-top: 4px; +} +body.path-mod-feedback #region-main .mform.feedback_form .femptylabel .fitemtitle { + display: inline-block; + width: auto; + margin-right: 0; +} +.path-mod-feedback .mform.feedback_form .femptylabel .felement { + display: inline-block; + margin-top: 4px; + padding-top: 5px; + width: auto; +} +body.path-mod-feedback #region-main .mform.feedback_form .feedback-item-pagebreak .felement { + width: 100%; +} +.path-mod-feedback .mform.feedback_form .fitem_fcheckbox .fitemtitle, +.path-mod-feedback .mform.feedback_form .fitem_fcheckbox .felement { + display: inline-block; + width: auto; +} +.path-mod-feedback .mform.feedback_form .fitem_fcheckbox .felement { + padding: 6px; +} +.path-mod-feedback .mform.feedback_form#feedback_viewresponse_form .fitem.feedback_hasvalue:not(.feedback-item-captcha) .felement { + background: #FBFBF1; + min-height: 1em; + box-sizing: border-box; + padding: 3px; + border: 1px solid #ddd; +} +.path-mod-feedback .mform.feedback_form .fitem.feedback_hasvalue .fstatic:empty { + display: inherit; +} +.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem:hover { + background: #f5f5f5; +} +.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle label { + width: 100%; +} +.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle { + position: relative; + width: 100%; +} +.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle .itemdd, +.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle .itemname { + float: left; +} +.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle .itemactions { + float: right; +} .path-mod-forum .forumsearch input, .path-mod-forum .forumsearch .helptooltip { margin: 0 3px; diff --git a/theme/noname/classes/output/core_renderer.php b/theme/noname/classes/output/core_renderer.php index 984e05a1196..315c5ac383b 100644 --- a/theme/noname/classes/output/core_renderer.php +++ b/theme/noname/classes/output/core_renderer.php @@ -59,6 +59,9 @@ class core_renderer extends \core_renderer { * @return string the HTML to output. */ public function box_start($classes = 'generalbox', $id = null, $attributes = array()) { + if (is_array($classes)) { + $classes = implode(' ', $classes); + } return parent::box_start($classes . ' p-a-1', $id, $attributes); } @@ -435,4 +438,25 @@ class core_renderer extends \core_renderer { protected function render_url_select(url_select $select) { return $this->render_from_template('core/url_select', $select->export_for_template($this)); } + + /** + * Renders a pix_icon widget and returns the HTML to display it. + * + * @param pix_icon $icon + * @return string HTML fragment + */ + protected function render_pix_icon(pix_icon $icon) { + $data = $icon->export_for_template($this); + foreach ($data['attributes'] as $key => $item) { + $name = $item['name']; + $value = $item['value']; + if ($name == 'class') { + $data['extraclasses'] = $value; + unset($data['attributes'][$key]); + $data['attributes'] = array_values($data['attributes']); + break; + } + } + return $this->render_from_template('core/pix_icon', $data); + } } diff --git a/theme/noname/layout/columns2.php b/theme/noname/layout/columns2.php index 2d54945d9c5..38ac0414d9e 100644 --- a/theme/noname/layout/columns2.php +++ b/theme/noname/layout/columns2.php @@ -24,7 +24,7 @@ $templatecontext = [ 'sitename' => format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID))), 'output' => $OUTPUT, - 'sidepreblocks' => $OUTPUT->blocks('side-pre', 'col-md-3 pull-md-9'), + 'sidepreblocks' => $OUTPUT->blocks('side-pre', 'col-md-4 pull-md-8'), ]; -echo $OUTPUT->render_from_template('theme_noname/columns2', $templatecontext); \ No newline at end of file +echo $OUTPUT->render_from_template('theme_noname/columns2', $templatecontext); diff --git a/theme/noname/scss/moodle/course.scss b/theme/noname/scss/moodle/course.scss index 79d451c3278..7cb643a56eb 100644 --- a/theme/noname/scss/moodle/course.scss +++ b/theme/noname/scss/moodle/course.scss @@ -710,48 +710,13 @@ span.editinstructions { white-space:nowrap; } - .moodle-actionmenu[data-enhance] { - .toggle-display { - img { - width: auto; - } - &.textmenu { - padding-right: 4px; - - .caret { - margin-top: 12px; - } - } - } - } - .listing-actions { text-align:center; padding:0.4rem 0.3rem 0.3rem; line-height:2.2em; - > a, > .moodle-actionmenu { display:inline-block; } - > .moodle-actionmenu .menu a { - padding-left:1rem; - } - .moodle-actionmenu:not([data-enhanced]) { - li {line-height:normal;} - > .menubar a { - color:inherit; - display:inline-block; - > img { - display:none; - } - .caret { - display: none; - } - } - > .menu .menu-action-text { - display:inline-block; - } - } } ul.ml { list-style: none; diff --git a/theme/noname/scss/moodle/forms.scss b/theme/noname/scss/moodle/forms.scss index 3ef94811f73..c56fcb9ec09 100644 --- a/theme/noname/scss/moodle/forms.scss +++ b/theme/noname/scss/moodle/forms.scss @@ -189,10 +189,12 @@ fieldset.coursesearchbox label { /* Section and module editing forms contain special JS components for the availability system (if enabled). */ -#fitem_id_availabilityconditionsjson { - *[aria-hidden=true] { - display: none; - } +#id_availabilityconditionsjson[aria-hidden=true], +.availability-field [aria-hidden=true] { + display: none; +} + +.availability-field { select, input[type=text] { position:relative; diff --git a/theme/noname/scss/moodle/modules.scss b/theme/noname/scss/moodle/modules.scss index 587cc03934d..665c126d52c 100644 --- a/theme/noname/scss/moodle/modules.scss +++ b/theme/noname/scss/moodle/modules.scss @@ -9,6 +9,17 @@ select { width: auto; } +// Feedback module +.path-mod-feedback .feedback_form .col-md-9, +.path-mod-feedback .feedback_form .col-md-3, +.path-mod-feedback .feedback_form .col-md-3 label { + width: 100%; +} +.path-mod-feedback .feedback_form .col-md-9 { + margin-left: 1rem; + margin-bottom: -2rem; +} + // Forum module .path-mod-forum .forumsearch { @@ -200,16 +211,8 @@ div#dock { // Lesson module -.path-mod-lesson .firstpageoptions { - margin: auto; - min-width: 280px; - width: 60%; -} - -.path-mod-lesson .centerpadded { - padding: 5px; - text-align: center; -} +/** General styles (scope: all of lesson) **/ +.path-mod-lesson .invisiblefieldset.fieldsetfix {display: block;} .path-mod-wiki .wiki_headingtitle, .path-mod-wiki .midpad, @@ -548,6 +551,27 @@ div#dock { .path-mod-assign [data-region="grade-actions-panel"] [data-region="grade-actions"] .collapse-buttons { top: auto; } +.path-mod-assign [data-region="grade-panel"] .has-popout { + background-color: $card-bg; + @include border-radius($card-border-radius); + border: $card-border-width solid $card-border-color; +} +.path-mod-assign [data-region="grade-panel"] .popout { + background-color: $modal-content-bg; +} +.path-mod-assign [data-region="grade-panel"] .col-md-3 { + width: 100%; +} +.path-mod-assign [data-region="grade-panel"] .popout > .col-md-3 { + @extend .modal-header; + font-size: 1.5rem; +} +.path-mod-assign [data-region="grade-panel"] [data-region="popout-button"] { + margin-top: 0.5rem; +} +.path-mod-assign [data-region="grade-panel"] .popout [data-region="popout-button"] { + margin-top: 0; +} .path-mod-assign [data-region="grade-panel"] h3 { margin: 10px 0; line-height: 40px; @@ -589,3 +613,4 @@ div#dock { .assignfeedback_editpdf_menu { padding: 0; } + diff --git a/theme/noname/templates/block_settings/search_form.mustache b/theme/noname/templates/block_settings/search_form.mustache index facd316e7ac..765122a88e8 100644 --- a/theme/noname/templates/block_settings/search_form.mustache +++ b/theme/noname/templates/block_settings/search_form.mustache @@ -3,5 +3,5 @@
          - + diff --git a/theme/noname/templates/columns2.mustache b/theme/noname/templates/columns2.mustache index 31541edfdbf..ec345552731 100644 --- a/theme/noname/templates/columns2.mustache +++ b/theme/noname/templates/columns2.mustache @@ -19,7 +19,7 @@ {{{ output.full_header }}}
          -
          +
          {{{ output.course_content_header }}} diff --git a/theme/noname/templates/core/block.mustache b/theme/noname/templates/core/block.mustache index c4aa60b111e..418bddf2393 100644 --- a/theme/noname/templates/core/block.mustache +++ b/theme/noname/templates/core/block.mustache @@ -7,6 +7,7 @@
          {{/element}} -{{/ core_form/element-template }} \ No newline at end of file +{{/ core_form/element-template }} diff --git a/theme/noname/templates/core_form/element-duration-inline.mustache b/theme/noname/templates/core_form/element-duration-inline.mustache index 741703eb05b..4acfd0cc008 100644 --- a/theme/noname/templates/core_form/element-duration-inline.mustache +++ b/theme/noname/templates/core_form/element-duration-inline.mustache @@ -1 +1 @@ -{{> core_form/element-group-inline }} \ No newline at end of file +{{> core_form/element-group-inline }} diff --git a/theme/noname/templates/core_form/element-duration.mustache b/theme/noname/templates/core_form/element-duration.mustache index 7e804bb54e0..9a4e5cbe565 100644 --- a/theme/noname/templates/core_form/element-duration.mustache +++ b/theme/noname/templates/core_form/element-duration.mustache @@ -1 +1 @@ -{{> core_form/element-group }} \ No newline at end of file +{{> core_form/element-group }} diff --git a/theme/noname/templates/core_form/element-editor.mustache b/theme/noname/templates/core_form/element-editor.mustache index 900613747b4..6f02ca05f26 100644 --- a/theme/noname/templates/core_form/element-editor.mustache +++ b/theme/noname/templates/core_form/element-editor.mustache @@ -2,4 +2,4 @@ {{$element}} {{{element.html}}} {{/element}} -{{/ core_form/element-template }} \ No newline at end of file +{{/ core_form/element-template }} diff --git a/theme/noname/templates/core_form/element-filemanager.mustache b/theme/noname/templates/core_form/element-filemanager.mustache index 900613747b4..6f02ca05f26 100644 --- a/theme/noname/templates/core_form/element-filemanager.mustache +++ b/theme/noname/templates/core_form/element-filemanager.mustache @@ -2,4 +2,4 @@ {{$element}} {{{element.html}}} {{/element}} -{{/ core_form/element-template }} \ No newline at end of file +{{/ core_form/element-template }} diff --git a/theme/noname/templates/core_form/element-filepicker.mustache b/theme/noname/templates/core_form/element-filepicker.mustache index 900613747b4..6f02ca05f26 100644 --- a/theme/noname/templates/core_form/element-filepicker.mustache +++ b/theme/noname/templates/core_form/element-filepicker.mustache @@ -2,4 +2,4 @@ {{$element}} {{{element.html}}} {{/element}} -{{/ core_form/element-template }} \ No newline at end of file +{{/ core_form/element-template }} diff --git a/theme/noname/templates/core_form/element-grading.mustache b/theme/noname/templates/core_form/element-grading.mustache index 900613747b4..6f02ca05f26 100644 --- a/theme/noname/templates/core_form/element-grading.mustache +++ b/theme/noname/templates/core_form/element-grading.mustache @@ -2,4 +2,4 @@ {{$element}} {{{element.html}}} {{/element}} -{{/ core_form/element-template }} \ No newline at end of file +{{/ core_form/element-template }} diff --git a/theme/noname/templates/core_form/element-group-inline.mustache b/theme/noname/templates/core_form/element-group-inline.mustache index c7ff92d6b18..5c112ee3b7c 100644 --- a/theme/noname/templates/core_form/element-group-inline.mustache +++ b/theme/noname/templates/core_form/element-group-inline.mustache @@ -4,4 +4,4 @@ {{{.}}} {{/element.elements}} {{/element}} -{{/ core_form/element-template-inline }} \ No newline at end of file +{{/ core_form/element-template-inline }} diff --git a/theme/noname/templates/core_form/element-group.mustache b/theme/noname/templates/core_form/element-group.mustache index 388e80b2dbf..0eca0f5e756 100644 --- a/theme/noname/templates/core_form/element-group.mustache +++ b/theme/noname/templates/core_form/element-group.mustache @@ -4,4 +4,4 @@ {{{.}}} {{/element.elements}} {{/element}} -{{/ core_form/element-template }} \ No newline at end of file +{{/ core_form/element-template }} diff --git a/theme/noname/templates/core_form/element-modgrade.mustache b/theme/noname/templates/core_form/element-modgrade.mustache index 7e804bb54e0..9a4e5cbe565 100644 --- a/theme/noname/templates/core_form/element-modgrade.mustache +++ b/theme/noname/templates/core_form/element-modgrade.mustache @@ -1 +1 @@ -{{> core_form/element-group }} \ No newline at end of file +{{> core_form/element-group }} diff --git a/theme/noname/templates/core_form/element-modvisible.mustache b/theme/noname/templates/core_form/element-modvisible.mustache index 5878ca97962..e918676a60d 100644 --- a/theme/noname/templates/core_form/element-modvisible.mustache +++ b/theme/noname/templates/core_form/element-modvisible.mustache @@ -1 +1 @@ -{{> core_form/element-select }} \ No newline at end of file +{{> core_form/element-select }} diff --git a/theme/noname/templates/core_form/element-password.mustache b/theme/noname/templates/core_form/element-password.mustache index ac1da19d34b..a5c734e62d3 100644 --- a/theme/noname/templates/core_form/element-password.mustache +++ b/theme/noname/templates/core_form/element-password.mustache @@ -1,7 +1,7 @@ {{< core_form/element-template }} {{$element}} + {{^element.frozen}} + {{/element.frozen}} {{/element}} {{/ core_form/element-template }} diff --git a/theme/noname/templates/core_form/element-passwordunmask.mustache b/theme/noname/templates/core_form/element-passwordunmask.mustache index 66eb5c737c8..a759af1a5ef 100644 --- a/theme/noname/templates/core_form/element-passwordunmask.mustache +++ b/theme/noname/templates/core_form/element-passwordunmask.mustache @@ -1,4 +1,5 @@ {{> core_form/element-password }} +{{^element.frozen}} {{#js}} require(['core/yui'], function(Y) { Y.use('moodle-form-passwordunmask', function() { @@ -8,3 +9,4 @@ require(['core/yui'], function(Y) { }); }); {{/js}} +{{/element.frozen}} diff --git a/theme/noname/templates/core_form/element-questioncategory-inline.mustache b/theme/noname/templates/core_form/element-questioncategory-inline.mustache index b46bf08dfe2..d9b9025b598 100644 --- a/theme/noname/templates/core_form/element-questioncategory-inline.mustache +++ b/theme/noname/templates/core_form/element-questioncategory-inline.mustache @@ -1 +1 @@ -{{> core_form/element-selectgroups-inline }} \ No newline at end of file +{{> core_form/element-selectgroups-inline }} diff --git a/theme/noname/templates/core_form/element-questioncategory.mustache b/theme/noname/templates/core_form/element-questioncategory.mustache index b98d62ab1ee..8d7f75c5451 100644 --- a/theme/noname/templates/core_form/element-questioncategory.mustache +++ b/theme/noname/templates/core_form/element-questioncategory.mustache @@ -1 +1 @@ -{{> core_form/element-selectgroups }} \ No newline at end of file +{{> core_form/element-selectgroups }} diff --git a/theme/noname/templates/core_form/element-radio-inline.mustache b/theme/noname/templates/core_form/element-radio-inline.mustache index 465597a2e43..0828fed4037 100644 --- a/theme/noname/templates/core_form/element-radio-inline.mustache +++ b/theme/noname/templates/core_form/element-radio-inline.mustache @@ -1,18 +1,22 @@ +{{^element.frozen}} {{#js}} require(['theme_noname/form-display-errors'], function(module) { module.enhance({{#quote}}{{element.id}}{{/quote}}); }); -{{/js}} \ No newline at end of file +{{/js}} +{{/element.frozen}} diff --git a/theme/noname/templates/core_form/element-radio.mustache b/theme/noname/templates/core_form/element-radio.mustache index b83155f53f4..ad0b32dd0cd 100644 --- a/theme/noname/templates/core_form/element-radio.mustache +++ b/theme/noname/templates/core_form/element-radio.mustache @@ -1,12 +1,14 @@
          +{{^element.frozen}} {{#js}} require(['theme_noname/form-display-errors'], function(module) { module.enhance({{#quote}}{{element.id}}{{/quote}}); }); -{{/js}} \ No newline at end of file +{{/js}} +{{/element.frozen}} diff --git a/theme/noname/templates/core_form/element-recaptcha.mustache b/theme/noname/templates/core_form/element-recaptcha.mustache index 900613747b4..6f02ca05f26 100644 --- a/theme/noname/templates/core_form/element-recaptcha.mustache +++ b/theme/noname/templates/core_form/element-recaptcha.mustache @@ -2,4 +2,4 @@ {{$element}} {{{element.html}}} {{/element}} -{{/ core_form/element-template }} \ No newline at end of file +{{/ core_form/element-template }} diff --git a/theme/noname/templates/core_form/element-select-inline.mustache b/theme/noname/templates/core_form/element-select-inline.mustache index fb8063b95d7..8f542d2076b 100644 --- a/theme/noname/templates/core_form/element-select-inline.mustache +++ b/theme/noname/templates/core_form/element-select-inline.mustache @@ -1,9 +1,9 @@ {{< core_form/element-template-inline }} {{$element}} + {{^element.frozen}} + {{/element.frozen}} + {{#element.frozen}} + {{#element.options}} + {{#selected}}{{text}}{{/selected}} + {{/element.options}} + {{/element.frozen}} {{/element}} -{{/ core_form/element-template-inline }} \ No newline at end of file +{{/ core_form/element-template-inline }} diff --git a/theme/noname/templates/core_form/element-select.mustache b/theme/noname/templates/core_form/element-select.mustache index d556fa53faa..b9ef1ecf611 100644 --- a/theme/noname/templates/core_form/element-select.mustache +++ b/theme/noname/templates/core_form/element-select.mustache @@ -1,9 +1,9 @@ {{< core_form/element-template }} {{$element}} + {{^element.frozen}} + {{/element.frozen}} + {{#element.frozen}} + {{#element.options}} + {{#selected}} + {{text}} + {{/selected}} + {{/element.options}} + {{/element.frozen}} {{/element}} -{{/ core_form/element-template }} \ No newline at end of file +{{/ core_form/element-template }} diff --git a/theme/noname/templates/core_form/element-selectgroups-inline.mustache b/theme/noname/templates/core_form/element-selectgroups-inline.mustache index f08d6db94d0..3889a8714d7 100644 --- a/theme/noname/templates/core_form/element-selectgroups-inline.mustache +++ b/theme/noname/templates/core_form/element-selectgroups-inline.mustache @@ -1,16 +1,32 @@ {{< core_form/element-template-inline }} {{$element}} + {{^element.frozen}} + {{/element.frozen}} + {{#element.frozen}} + {{#element.optiongroups}} + {{#options}} + {{#selected}}{{{text}}}{{/selected}} + {{/options}} + {{/element.optiongroups}} + {{/element.frozen}} {{/element}} -{{/ core_form/element-template-inline }} \ No newline at end of file +{{/ core_form/element-template-inline }} diff --git a/theme/noname/templates/core_form/element-selectgroups.mustache b/theme/noname/templates/core_form/element-selectgroups.mustache index 7390e5e8f81..99b93e2c497 100644 --- a/theme/noname/templates/core_form/element-selectgroups.mustache +++ b/theme/noname/templates/core_form/element-selectgroups.mustache @@ -1,20 +1,32 @@ {{< core_form/element-template }} {{$element}} + {{^element.frozen}} + {{/element.frozen}} + {{#element.frozen}} + {{#element.optiongroups}} + {{#options}} + {{#selected}}{{{text}}}{{/selected}} + {{/options}} + {{/element.optiongroups}} + {{/element.frozen}} {{/element}} -{{/ core_form/element-template }} \ No newline at end of file +{{/ core_form/element-template }} diff --git a/theme/noname/templates/core_form/element-selectwithlink.mustache b/theme/noname/templates/core_form/element-selectwithlink.mustache index 5731fec75ec..f561e5ade1d 100644 --- a/theme/noname/templates/core_form/element-selectwithlink.mustache +++ b/theme/noname/templates/core_form/element-selectwithlink.mustache @@ -1,9 +1,9 @@ {{< core_form/element-template }} {{$element}} + {{^element.frozen}} + {{/element.frozen}} + {{#element.frozen}} + {{#element.options}} + {{#selected}}{{text}}{{/selected}} + {{/element.options}} + {{/element.frozen}} {{element.linklabel}} {{/element}} {{/ core_form/element-template }} diff --git a/theme/noname/templates/core_form/element-selectyesno-inline.mustache b/theme/noname/templates/core_form/element-selectyesno-inline.mustache index de47adee9ae..f2366e02ce2 100644 --- a/theme/noname/templates/core_form/element-selectyesno-inline.mustache +++ b/theme/noname/templates/core_form/element-selectyesno-inline.mustache @@ -1 +1 @@ -{{> core_form/element-select-inline }} \ No newline at end of file +{{> core_form/element-select-inline }} diff --git a/theme/noname/templates/core_form/element-selectyesno.mustache b/theme/noname/templates/core_form/element-selectyesno.mustache index 5878ca97962..e918676a60d 100644 --- a/theme/noname/templates/core_form/element-selectyesno.mustache +++ b/theme/noname/templates/core_form/element-selectyesno.mustache @@ -1 +1 @@ -{{> core_form/element-select }} \ No newline at end of file +{{> core_form/element-select }} diff --git a/theme/noname/templates/core_form/element-static.mustache b/theme/noname/templates/core_form/element-static.mustache index 900613747b4..6f02ca05f26 100644 --- a/theme/noname/templates/core_form/element-static.mustache +++ b/theme/noname/templates/core_form/element-static.mustache @@ -2,4 +2,4 @@ {{$element}} {{{element.html}}} {{/element}} -{{/ core_form/element-template }} \ No newline at end of file +{{/ core_form/element-template }} diff --git a/theme/noname/templates/core_form/element-submit-inline.mustache b/theme/noname/templates/core_form/element-submit-inline.mustache index f29ca3d718f..1f233f94ca4 100644 --- a/theme/noname/templates/core_form/element-submit-inline.mustache +++ b/theme/noname/templates/core_form/element-submit-inline.mustache @@ -1,6 +1,7 @@ {{< core_form/element-template-inline }} {{$element}} - + {{/element.frozen}} {{/element}} -{{/ core_form/element-template-inline }} \ No newline at end of file +{{/ core_form/element-template-inline }} diff --git a/theme/noname/templates/core_form/element-submit.mustache b/theme/noname/templates/core_form/element-submit.mustache index 25f53e7cb45..eca4f2bbb43 100644 --- a/theme/noname/templates/core_form/element-submit.mustache +++ b/theme/noname/templates/core_form/element-submit.mustache @@ -1,6 +1,7 @@ {{< core_form/element-template }} {{$element}} - + {{/element.frozen}} {{/element}} {{/ core_form/element-template }} diff --git a/theme/noname/templates/core_form/element-tags-inline.mustache b/theme/noname/templates/core_form/element-tags-inline.mustache new file mode 100644 index 00000000000..315440c0cfd --- /dev/null +++ b/theme/noname/templates/core_form/element-tags-inline.mustache @@ -0,0 +1,38 @@ +{{< core_form/element-template-inline }} + {{$element}} + {{^element.frozen}} + + {{/element.frozen}} + {{#element.frozen}} + {{#element.options}} + {{#selected}}{{text}}{{/selected}} + {{/element.options}} + {{/element.frozen}} + {{#element.managestandardtagsurl}} + {{#str}}managestandardtags, core_tag{{/str}} + {{/element.managestandardtagsurl}} + {{/element}} +{{/ core_form/element-template-inline }} +{{^element.frozen}} +{{#js}} +require(['core/form-autocomplete'], function(module) { + module.enhance({{#quote}}#{{element.id}}{{/quote}}, + {{element.tags}}, + {{#quote}}{{element.ajax}}{{/quote}}, + {{#quote}}{{element.placeholder}}{{/quote}}, + {{element.casesensitive}}, + {{element.showsuggestions}}, + {{#quote}}{{element.noselectionstring}}{{/quote}}); +}); +{{/js}} +{{/element.frozen}} diff --git a/theme/noname/templates/core_form/element-tags.mustache b/theme/noname/templates/core_form/element-tags.mustache new file mode 100644 index 00000000000..4185ba6c9bb --- /dev/null +++ b/theme/noname/templates/core_form/element-tags.mustache @@ -0,0 +1,38 @@ +{{< core_form/element-template }} + {{$element}} + {{^element.frozen}} + + {{/element.frozen}} + {{#element.frozen}} + {{#element.options}} + {{#selected}}{{text}}{{/selected}} + {{/element.options}} + {{/element.frozen}} + {{#element.managestandardtagsurl}} + {{#str}}managestandardtags, core_tag{{/str}} + {{/element.managestandardtagsurl}} + {{/element}} +{{/ core_form/element-template }} +{{^element.frozen}} +{{#js}} +require(['core/form-autocomplete'], function(module) { + module.enhance({{#quote}}#{{element.id}}{{/quote}}, + {{element.tags}}, + {{#quote}}{{element.ajax}}{{/quote}}, + {{#quote}}{{element.placeholder}}{{/quote}}, + {{element.casesensitive}}, + {{element.showsuggestions}}, + {{#quote}}{{element.noselectionstring}}{{/quote}}); +}); +{{/js}} +{{/element.frozen}} diff --git a/theme/noname/templates/core_form/element-template-inline.mustache b/theme/noname/templates/core_form/element-template-inline.mustache index bc20a80cc66..d2ef2da24f5 100644 --- a/theme/noname/templates/core_form/element-template-inline.mustache +++ b/theme/noname/templates/core_form/element-template-inline.mustache @@ -1,12 +1,14 @@ -
          +
          + {{$ element }} {{/ element }} + diff --git a/theme/noname/templates/core_form/element-template.mustache b/theme/noname/templates/core_form/element-template.mustache index 1411c42d721..c06100f6d9d 100644 --- a/theme/noname/templates/core_form/element-template.mustache +++ b/theme/noname/templates/core_form/element-template.mustache @@ -1,13 +1,15 @@ -
          -