diff --git a/admin/tool/availabilityconditions/tests/behat/manage_conditions.feature b/admin/tool/availabilityconditions/tests/behat/manage_conditions.feature index b028da9fcad94..c0107b3e875a4 100644 --- a/admin/tool/availabilityconditions/tests/behat/manage_conditions.feature +++ b/admin/tool/availabilityconditions/tests/behat/manage_conditions.feature @@ -37,18 +37,18 @@ Feature: Manage availability conditions When I navigate to "Manage restrictions" node in "Site administration > Plugins > Availability restrictions" # Check the icon is there (it should be a Hide icon, meaning is currently visible). - Then "input[title=Hide]" "css_element" should exist in the "Restriction by date" "table_row" + Then "Hide" "icon" should exist in the "Restriction by date" "table_row" # Click the icon. It should toggle to hidden (title=Show). - And I click on "input[title=Hide]" "css_element" in the "Restriction by date" "table_row" - And "input[title=Show]" "css_element" should exist in the "Restriction by date" "table_row" + And I click on "Hide" "icon" in the "Restriction by date" "table_row" + And "Show" "icon" should exist in the "Restriction by date" "table_row" # Toggle it back to visible (title=Hide). - And I click on "input[title=Show]" "css_element" in the "Restriction by date" "table_row" - And "input[title=Hide]" "css_element" should exist in the "Restriction by date" "table_row" + And I click on "Show" "icon" in the "Restriction by date" "table_row" + And "Hide" "icon" should exist in the "Restriction by date" "table_row" # OK, toggling works. Set the grade one to Hide and we'll go see if it actually worked. - And I click on "input[title=Hide]" "css_element" in the "Restriction by grade" "table_row" + And I click on "Hide" "icon" in the "Restriction by grade" "table_row" And I am on site homepage And I follow "Course 1" And I turn editing mode on diff --git a/admin/tool/filetypes/classes/utils.php b/admin/tool/filetypes/classes/utils.php index 45a1c6b2790c9..6b747136f1927 100644 --- a/admin/tool/filetypes/classes/utils.php +++ b/admin/tool/filetypes/classes/utils.php @@ -97,7 +97,7 @@ public static function get_icons_from_path($path) { if ($handle = @opendir($path)) { while (($file = readdir($handle)) !== false) { $matches = array(); - if (preg_match('~(.+?)(?:-24|-32|-48|-64|-72|-80|-96|-128|-256)?\.(?:gif|png)$~', + if (preg_match('~(.+?)(?:-24|-32|-48|-64|-72|-80|-96|-128|-256)?\.(?:svg|gif|png)$~', $file, $matches)) { $key = $matches[1]; $icons[$key] = $key; diff --git a/admin/tool/filetypes/renderer.php b/admin/tool/filetypes/renderer.php index dee5281585f4c..238f6861eccd2 100644 --- a/admin/tool/filetypes/renderer.php +++ b/admin/tool/filetypes/renderer.php @@ -116,7 +116,7 @@ public function edit_table(array $filetypes, array $deleted, $restricted) { $editurl = new \moodle_url('/admin/tool/filetypes/edit.php', array('oldextension' => $extension)); $editbutton = html_writer::link($editurl, $this->pix_icon('t/edit', - get_string('edita', '', s($extension)))); + get_string('edita', 'moodle', s($extension)))); $deleteurl = new \moodle_url('/admin/tool/filetypes/delete.php', array('extension' => $extension)); $deletebutton = html_writer::link($deleteurl, $this->pix_icon('t/delete', diff --git a/admin/tool/filetypes/tests/behat/add_filetypes.feature b/admin/tool/filetypes/tests/behat/add_filetypes.feature index 3710f0ca30665..0a9f39f712e8c 100644 --- a/admin/tool/filetypes/tests/behat/add_filetypes.feature +++ b/admin/tool/filetypes/tests/behat/add_filetypes.feature @@ -21,7 +21,6 @@ Feature: Add customised file types Then I should see "Froggy file" in the "application/x-frog" "table_row" And I should see "document" in the "application/x-frog" "table_row" And I should see "frog" in the "application/x-frog" "table_row" - And "//img[contains(@src, 'archive')]" "xpath_element" should exist in the "application/x-frog" "table_row" Scenario: Update an existing file type Given I log in as "admin" @@ -99,11 +98,11 @@ Feature: Add customised file types And I navigate to "File types" node in "Site administration > Server" And I click on "Edit 7z" "link" And I set the following fields to these values: - | File icon | document | + | Type groups | document | And I press "Save changes" - When I follow "Restore 7z to Moodle defaults" + And I follow "Restore 7z to Moodle defaults" And I press "Yes" - Then "//img[contains(@src, 'archive')]" "xpath_element" should exist in the "7z" "table_row" + Then "//*[contains(text(), 'archive')]" "xpath_element" should exist in the "7z" "table_row" @javascript @_file_upload Scenario: Create a resource activity which contains a customised file type @@ -133,4 +132,3 @@ Feature: Add customised file types And I set the field "Show type" to "1" And I press "Save and return to course" Then I should see "Froggy file" - And the "src" attribute of ".modtype_resource a img" "css_element" should contain "archive" diff --git a/admin/tool/lp/tests/behat/plan_crud.feature b/admin/tool/lp/tests/behat/plan_crud.feature index 71086f3a8869f..456e32b3663c2 100644 --- a/admin/tool/lp/tests/behat/plan_crud.feature +++ b/admin/tool/lp/tests/behat/plan_crud.feature @@ -94,6 +94,7 @@ Feature: Manage plearning plan And I click on "Delete" of edit menu in the "comp1" row And "Confirm" "dialogue" should be visible And I click on "Confirm" "button" + And I wait until the page is ready And "comp1" "table_row" should not exist Scenario: Edit a learning plan @@ -125,4 +126,5 @@ Feature: Manage plearning plan And I click on "Delete" of edit menu in the "Science plan Year-4" row And "Confirm" "dialogue" should be visible When I click on "Delete" "button" + And I wait until the page is ready Then I should not see "Science plan Year-4" diff --git a/admin/tool/lp/tests/behat/plan_workflow.feature b/admin/tool/lp/tests/behat/plan_workflow.feature index c98314e0566ca..5410f2ab2e9e1 100644 --- a/admin/tool/lp/tests/behat/plan_workflow.feature +++ b/admin/tool/lp/tests/behat/plan_workflow.feature @@ -171,6 +171,7 @@ Feature: Manage plan workflow And I follow "Learning plans" When I click on "Complete this learning plan" of edit menu in the "Test-Plan3" row And I click on "Complete this learning plan" "button" in the "Confirm" "dialogue" + And I wait until the page is ready And I follow "Test-Plan4" And I follow "Complete this learning plan" And I click on "Complete this learning plan" "button" in the "Confirm" "dialogue" diff --git a/admin/tool/lp/tests/behat/template_crud.feature b/admin/tool/lp/tests/behat/template_crud.feature index 1479fcfbcd8a7..e2f806ffa44b8 100644 --- a/admin/tool/lp/tests/behat/template_crud.feature +++ b/admin/tool/lp/tests/behat/template_crud.feature @@ -56,4 +56,5 @@ Feature: Manage plearning plan templates And I click on "Delete" of edit menu in the "Science template Year-4" row And "Confirm" "dialogue" should be visible When I click on "Delete" "button" + And I wait until the page is ready Then I should not see "Science template Year-4" diff --git a/admin/tool/lp/tests/behat/user_evidence_comp_link.feature b/admin/tool/lp/tests/behat/user_evidence_comp_link.feature index 779ece3bfced6..8d8dd5f1c6931 100644 --- a/admin/tool/lp/tests/behat/user_evidence_comp_link.feature +++ b/admin/tool/lp/tests/behat/user_evidence_comp_link.feature @@ -67,5 +67,6 @@ Feature: Manage competencies linked to evidence of prior learning And I should see "Test-Comp1" And I should see "Test-Comp2" When I click on "Delete" "link" in the "Test-Comp1" "table_row" + And I wait until the page is ready Then I should not see "Test-Comp1" And I should see "Test-Comp2" diff --git a/admin/tool/lp/tests/behat/user_evidence_crud.feature b/admin/tool/lp/tests/behat/user_evidence_crud.feature index 35dbd2bfae64e..e39707a34cb9f 100644 --- a/admin/tool/lp/tests/behat/user_evidence_crud.feature +++ b/admin/tool/lp/tests/behat/user_evidence_crud.feature @@ -57,6 +57,7 @@ Feature: Manage evidence of prior learning And I click on "Delete" of edit menu in the "Evidence-4" row And "Confirm" "dialogue" should be visible When I click on "Delete" "button" + And I wait until the page is ready Then I should not see "Evidence-4" Scenario: List evidences of prior learning diff --git a/admin/tool/recyclebin/tests/behat/basic_functionality.feature b/admin/tool/recyclebin/tests/behat/basic_functionality.feature index 6b4ea5bf2e564..5ede455958515 100644 --- a/admin/tool/recyclebin/tests/behat/basic_functionality.feature +++ b/admin/tool/recyclebin/tests/behat/basic_functionality.feature @@ -23,6 +23,7 @@ Feature: Basic recycle bin functionality | categorybinexpiry | 1209600 | tool_recyclebin | | autohide | 0 | tool_recyclebin | + @javascript Scenario: Restore a deleted assignment Given I log in as "teacher1" And I follow "Course 1" @@ -31,6 +32,7 @@ Feature: Basic recycle bin functionality | Assignment name | Test assign | | Description | Test | And I delete "Test assign" activity + And I run all adhoc tasks When I navigate to "Recycle bin" node in "Course administration" Then I should see "Test assign" And I should see "Contents will be permanently deleted after 7 days" diff --git a/availability/condition/completion/tests/behat/availability_completion.feature b/availability/condition/completion/tests/behat/availability_completion.feature index 507ba1bb6c7da..9ac9f370c7aab 100644 --- a/availability/condition/completion/tests/behat/availability_completion.feature +++ b/availability/condition/completion/tests/behat/availability_completion.feature @@ -55,5 +55,5 @@ Feature: availability_completion Then I should not see "Page 2" in the "region-main" "region" # Mark page 1 complete - When I click on ".togglecompletion input[type=image]" "css_element" + When I click on ".togglecompletion .icon" "css_element" Then I should see "Page 2" in the "region-main" "region" diff --git a/availability/condition/profile/tests/behat/availability_profile.feature b/availability/condition/profile/tests/behat/availability_profile.feature index 8e324bb1c2170..a5b01b7cfa9aa 100644 --- a/availability/condition/profile/tests/behat/availability_profile.feature +++ b/availability/condition/profile/tests/behat/availability_profile.feature @@ -76,7 +76,7 @@ Feature: availability_profile # Set field value for user. And I navigate to "Browse list of users" node in "Site administration > Users > Accounts" - And I click on "a[title=Edit]" "css_element" in the "s@example.com" "table_row" + And I click on ".icon[title=Edit]" "css_element" in the "s@example.com" "table_row" And I expand all fieldsets And I set the field "Super field" to "Bananaman" And I click on "Update profile" "button" diff --git a/backup/util/ui/tests/behat/backup_courses.feature b/backup/util/ui/tests/behat/backup_courses.feature index 72144a90847fd..6cf6563f41ee2 100644 --- a/backup/util/ui/tests/behat/backup_courses.feature +++ b/backup/util/ui/tests/behat/backup_courses.feature @@ -23,6 +23,7 @@ Feature: Backup Moodle courses And I should see "URL of backup" And I should see "Anonymize user information" + @javascript Scenario: Backup a course with default options When I backup "Course 1" course using this options: | Initial | Include calendar events | 0 | @@ -34,7 +35,7 @@ Feature: Backup Moodle courses And I should not see "Section 3" And I press "Continue" And I click on "Continue" "button" in the ".bcs-current-course" "css_element" - And "//div[contains(concat(' ', normalize-space(@class), ' '), ' fitem ')][contains(., 'Include calendar events')]/descendant::img" "xpath_element" should exist + And "No" "icon" should exist in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' fitem ')][contains(., 'Include calendar events')]" "xpath_element" And "Include course logs" "checkbox" should exist And I press "Next" diff --git a/badges/tests/behat/award_badge.feature b/badges/tests/behat/award_badge.feature index 2b0c928608e33..a1d2fb4a63ed0 100644 --- a/badges/tests/behat/award_badge.feature +++ b/badges/tests/behat/award_badge.feature @@ -158,7 +158,7 @@ Feature: Award badges Then I should not see "badges" And I am on homepage And I follow "Course 1" - And I press "Mark as complete: Test assignment name" + And I click on "Not completed: Test assignment name. Select to mark as complete." "icon" And I follow "Profile" in the user menu And I click on "Course 1" "link" in the "region-main" "region" Then I should see "Course Badge" @@ -213,7 +213,7 @@ Feature: Award badges Then I should not see "badges" And I am on homepage And I follow "Course 1" - And I press "Mark as complete: Test assignment name" + And I click on "Not completed: Test assignment name. Select to mark as complete." "icon" And I log out # Completion cron won't mark the whole course completed unless the # individual criteria was marked completed more than a second ago. So diff --git a/blocks/comments/tests/behat/behat_block_comments.php b/blocks/comments/tests/behat/behat_block_comments.php index 210a163535f82..07285e92063f8 100644 --- a/blocks/comments/tests/behat/behat_block_comments.php +++ b/blocks/comments/tests/behat/behat_block_comments.php @@ -99,9 +99,9 @@ public function i_delete_comment_from_comments_block($comment) { $commentnode = $this->find('xpath', $commentxpath, $exception); // Click on delete icon. - $deleteexception = new ExpectationException('"' . $comment . '" comment can not be deleted', $this->getSession()); - $deleteicon = $this->find('css', '.comment-delete a img', $deleteexception, $commentnode); - $deleteicon->click(); + $this->execute('behat_general::i_click_on_in_the', + array(get_string('deletecomment'), "icon", $this->escape($commentxpath), "xpath_element") + ); // Wait for the animation to finish, in theory is just 1 sec, adding 4 just in case. $this->getSession()->wait(4 * 1000, false); diff --git a/comment/comment.js b/comment/comment.js index eda542f3536e7..446e4f9e8a77e 100644 --- a/comment/comment.js +++ b/comment/comment.js @@ -200,7 +200,7 @@ M.core_comment = { list[i].content = '
' + '' + - '' + + '' + '' + '
' + list[i].content; } @@ -334,6 +334,13 @@ M.core_comment = { // 13 and 32 are the keycodes for space and enter. } ); + + require(['core/templates', 'core/notification'], function(Templates, Notification) { + Templates.renderPix('t/delete', 'core', M.util.get_string('deletecomment', 'moodle')).then(function(html) { + Y.all('div.comment-delete a').set('innerHTML', html); + }).catch(Notification.exception); + + }); }, register_pagination: function() { var scope = this; diff --git a/completion/tests/behat/behat_completion.php b/completion/tests/behat/behat_completion.php index c85f83d2e0d49..61582abe2b0d6 100644 --- a/completion/tests/behat/behat_completion.php +++ b/completion/tests/behat/behat_completion.php @@ -49,13 +49,12 @@ class behat_completion extends behat_base { public function user_has_completed_activity($userfullname, $activityname) { // Will throw an exception if the element can not be hovered. - $titleliteral = behat_context_helper::escape($userfullname . ", " . $activityname . ": Completed"); - $xpath = "//table[@id='completion-progress']" . - "/descendant::img[contains(@title, $titleliteral)]"; + $titleliteral = $userfullname . ", " . $activityname . ": Completed"; + $xpath = "//table[@id='completion-progress']"; $this->execute("behat_completion::go_to_the_current_course_activity_completion_report"); - $this->execute("behat_general::should_exist", - array($this->escape($xpath), "xpath_element") + $this->execute("behat_general::should_exist_in_the", + array($titleliteral, "icon", $xpath, "xpath_element") ); } @@ -69,12 +68,13 @@ public function user_has_completed_activity($userfullname, $activityname) { public function user_has_not_completed_activity($userfullname, $activityname) { // Will throw an exception if the element can not be hovered. - $titleliteral = behat_context_helper::escape($userfullname . ", " . $activityname . ": Not completed"); - $xpath = "//table[@id='completion-progress']" . - "/descendant::img[contains(@title, $titleliteral)]"; + $titleliteral = $userfullname . ", " . $activityname . ": Not completed"; + $xpath = "//table[@id='completion-progress']"; $this->execute("behat_completion::go_to_the_current_course_activity_completion_report"); - $this->execute("behat_general::should_exist", array($this->escape($xpath), "xpath_element")); + $this->execute("behat_general::should_exist_in_the", + array($titleliteral, "icon", $xpath, "xpath_element") + ); } /** @@ -121,16 +121,14 @@ public function completion_is_toggled_in_course($completionstatus) { public function activity_marked_as_complete($activityname, $activitytype, $completiontype) { if ($completiontype == "manual") { $imgalttext = get_string("completion-alt-manual-y", 'core_completion', $activityname); - $xpathtocheck = "//input[@type='image'][contains(@alt, '$imgalttext')]"; } else { $imgalttext = get_string("completion-alt-auto-y", 'core_completion', $activityname); - $xpathtocheck = "//img[contains(@alt, '$imgalttext')]"; } $activityxpath = "//li[contains(concat(' ', @class, ' '), ' modtype_" . strtolower($activitytype) . " ')]"; $activityxpath .= "[descendant::*[contains(text(), '" . $activityname . "')]]"; $this->execute("behat_general::should_exist_in_the", - array($xpathtocheck, "xpath_element", $activityxpath, "xpath_element") + array($imgalttext, "icon", $activityxpath, "xpath_element") ); } @@ -143,16 +141,14 @@ public function activity_marked_as_complete($activityname, $activitytype, $compl public function activity_marked_as_not_complete($activityname, $activitytype, $completiontype) { if ($completiontype == "manual") { $imgalttext = get_string("completion-alt-manual-n", 'core_completion', $activityname); - $xpathtocheck = "//input[@type='image'][contains(@alt, '$imgalttext')]"; } else { $imgalttext = get_string("completion-alt-auto-n", 'core_completion', $activityname); - $xpathtocheck = "//img[contains(@alt, '$imgalttext')]"; } $activityxpath = "//li[contains(concat(' ', @class, ' '), ' modtype_" . strtolower($activitytype) . " ')]"; $activityxpath .= "[descendant::*[contains(text(), '" . $activityname . "')]]"; $this->execute("behat_general::should_exist_in_the", - array($xpathtocheck, "xpath_element", $activityxpath, "xpath_element") + array($imgalttext, "icon", $activityxpath, "xpath_element") ); } } diff --git a/completion/tests/behat/enable_manual_complete_mark.feature b/completion/tests/behat/enable_manual_complete_mark.feature index 443dc220e57e0..848b3155566c9 100644 --- a/completion/tests/behat/enable_manual_complete_mark.feature +++ b/completion/tests/behat/enable_manual_complete_mark.feature @@ -33,7 +33,7 @@ Feature: Allow students to manually mark an activity as complete And I log in as "student1" And I am on site homepage And I follow "Course 1" - When I press "Mark as complete: Test forum name" + When I click on "Not completed: Test forum name. Select to mark as complete." "icon" Then the "Test forum name" "forum" activity with "manual" completion should be marked as complete And I log out And I log in as "teacher1" diff --git a/completion/tests/behat/restrict_section_availability.feature b/completion/tests/behat/restrict_section_availability.feature index c538bb2cd385d..f00c39f496046 100644 --- a/completion/tests/behat/restrict_section_availability.feature +++ b/completion/tests/behat/restrict_section_availability.feature @@ -48,7 +48,7 @@ Feature: Restrict sections availability through completion or grade conditions And I follow "Course 1" Then I should see "Not available unless: The activity Test label is marked complete" And I should not see "Test page name" - And I press "Not completed: Test label. Select to mark as complete." + And I click on "Not completed: Test label. Select to mark as complete." "icon" And I should see "Test page name" And I should not see "Not available unless: The activity Test label is marked complete" diff --git a/course/completion.js b/course/completion.js index eb548f3584a6d..58e5477cac690 100644 --- a/course/completion.js +++ b/course/completion.js @@ -20,22 +20,24 @@ M.core_completion.init = function(Y) { var current = args.state.get('value'); var modulename = args.modulename.get('value'), altstr, - titlestr; + iconkey; + + if (current == 1) { altstr = M.util.get_string('completion-alt-manual-y', 'completion', modulename); - titlestr = M.util.get_string('completion-title-manual-y', 'completion', modulename); + iconkey = 'i/completion-manual-y'; args.state.set('value', 0); - args.image.set('src', M.util.image_url('i/completion-manual-y', 'moodle')); - args.image.set('alt', altstr); - args.image.set('title', titlestr); } else { altstr = M.util.get_string('completion-alt-manual-n', 'completion', modulename); - titlestr = M.util.get_string('completion-title-manual-n', 'completion', modulename); + iconkey = 'i/completion-manual-n'; args.state.set('value', 1); - args.image.set('src', M.util.image_url('i/completion-manual-n', 'moodle')); - args.image.set('alt', altstr); - args.image.set('title', titlestr); } + + require(['core/templates', 'core/notification'], function(Templates, Notification) { + Templates.renderPix(iconkey, 'core', altstr).then(function(html) { + Templates.replaceNode(args.image.getDOMNode(), html, ''); + }).catch(Notification.exception); + }); } args.ajax.remove(); @@ -70,10 +72,8 @@ M.core_completion.init = function(Y) { modulename = Y.one(inputs[i]); break; } - if (inputs[i].type == 'image') { - image = Y.one(inputs[i]); - } } + image = form.one('button .icon'); // start spinning the ajax indicator var ajax = Y.Node.create('
'); diff --git a/course/format/renderer.php b/course/format/renderer.php index b9b06417e1ead..020d4b0d2a06b 100644 --- a/course/format/renderer.php +++ b/course/format/renderer.php @@ -116,11 +116,11 @@ protected function section_edit_control_menu($controls, $course, $section) { $icon = empty($value['icon']) ? '' : $value['icon']; $name = empty($value['name']) ? '' : $value['name']; $attr = empty($value['attr']) ? array() : $value['attr']; - $class = empty($item['pixattr']['class']) ? '' : $item['pixattr']['class']; - $alt = empty($item['pixattr']['alt']) ? '' : $item['pixattr']['alt']; + $class = empty($value['pixattr']['class']) ? '' : $value['pixattr']['class']; + $alt = empty($value['pixattr']['alt']) ? '' : $value['pixattr']['alt']; $al = new action_menu_link_secondary( new moodle_url($url), - new pix_icon($icon, $name, null, array('class' => "smallicon " . $class, 'alt' => $alt)), + new pix_icon($icon, $alt, null, array('class' => "smallicon " . $class)), $name, $attr ); diff --git a/course/renderer.php b/course/renderer.php index dd5307073d718..bee3fe78f7010 100644 --- a/course/renderer.php +++ b/course/renderer.php @@ -532,7 +532,7 @@ public function course_section_cm_completion($course, &$completioninfo, cm_info $output .= html_writer::empty_tag('input', array( 'type' => 'hidden', 'name' => 'completionstate', 'value' => $newstate)); $output .= html_writer::tag('button', - $this->output->pix_icon('i/completion-' . $completionicon, $imgalt)); + $this->output->pix_icon('i/completion-' . $completionicon, $imgalt), array('class' => 'btn btn-link')); $output .= html_writer::end_tag('div'); $output .= html_writer::end_tag('form'); } else { diff --git a/course/tests/behat/activities_group_icons.feature b/course/tests/behat/activities_group_icons.feature index dbb26da63e66e..4429b2a104071 100644 --- a/course/tests/behat/activities_group_icons.feature +++ b/course/tests/behat/activities_group_icons.feature @@ -27,19 +27,13 @@ Feature: Toggle activities groups mode from the course page | Force group mode | No | When I press "Save and display" Then "No groups (Click to change)" "link" should exist - And "//a/child::img[contains(@src, 'groupn')]" "xpath_element" should exist And I click on "No groups (Click to change)" "link" in the "Test forum name" activity And "Separate groups (Click to change)" "link" should exist - And "//a/child::img[contains(@src, 'groups')]" "xpath_element" should exist And I reload the page And "Separate groups (Click to change)" "link" should exist - And "//a/child::img[contains(@src, 'groups')]" "xpath_element" should exist And I click on "Separate groups (Click to change)" "link" in the "Test forum name" activity And "Visible groups (Click to change)" "link" should exist - And "//a/child::img[contains(@src, 'groupv')]" "xpath_element" should exist And I reload the page And "Visible groups (Click to change)" "link" should exist - And "//a/child::img[contains(@src, 'groupv')]" "xpath_element" should exist And I click on "Visible groups (Click to change)" "link" in the "Test forum name" activity And "No groups (Click to change)" "link" should exist - And "//a/child::img[contains(@src, 'groupn')]" "xpath_element" should exist diff --git a/course/tests/behat/behat_course.php b/course/tests/behat/behat_course.php index 237bc7ff62991..8cdeef6549272 100644 --- a/course/tests/behat/behat_course.php +++ b/course/tests/behat/behat_course.php @@ -337,7 +337,7 @@ public function i_turn_section_highlighting_off($sectionnumber) { * @param int $sectionnumber */ public function i_show_section($sectionnumber) { - $showlink = $this->show_section_icon_exists($sectionnumber); + $showlink = $this->show_section_link_exists($sectionnumber); // Ensure section edit menu is open before interacting with it. if ($this->running_javascript()) { @@ -358,13 +358,26 @@ public function i_show_section($sectionnumber) { * @param int $sectionnumber */ public function i_hide_section($sectionnumber) { - $hidelink = $this->hide_section_icon_exists($sectionnumber); + // Ensures the section exists. + $xpath = $this->section_exists($sectionnumber); - // Ensure section edit menu is open before interacting with it. + // We need to know the course format as the text strings depends on them. + $courseformat = $this->get_course_format(); + if (get_string_manager()->string_exists('hidefromothers', $courseformat)) { + $strhide = get_string('hidefromothers', $courseformat); + } else { + $strhide = get_string('hidesection'); + } + + // If javascript is on, link is inside a menu. if ($this->running_javascript()) { $this->i_open_section_edit_menu($sectionnumber); } - $hidelink->click(); + + // Click on delete link. + $this->execute('behat_general::i_click_on_in_the', + array($strhide, "link", $this->escape($xpath), "xpath_element") + ); if ($this->running_javascript()) { $this->getSession()->wait(self::TIMEOUT * 1000, self::PAGE_READY_JS); @@ -431,9 +444,7 @@ public function section_should_be_highlighted($sectionnumber) { $xpath = $this->section_exists($sectionnumber); // The important checking, we can not check the img. - $xpath = $xpath . "/descendant::img[contains(@src, 'marked')]"; - $exception = new ExpectationException('The "' . $sectionnumber . '" section is not highlighted', $this->getSession()); - $this->find('xpath', $xpath, $exception); + $this->execute('behat_general::should_exist_in_the', ['This topic is highlighted as the current topic', 'icon', $xpath, 'xpath_element']); } /** @@ -498,7 +509,7 @@ public function section_activities_should_be_hidden($sectionnumber) { if ($this->is_course_editor()) { // The section must be hidden. - $this->show_section_icon_exists($sectionnumber); + $this->show_section_link_exists($sectionnumber); // If there are activities they should be hidden and the visibility icon should not be available. if ($activities = $this->get_section_activities($sectionxpath)) { @@ -764,7 +775,7 @@ public function i_move_activity_to_section($activityname, $sectionnumber) { // Ensure the destination is valid. $sectionxpath = $this->section_exists($sectionnumber); - $activitynode = $this->get_activity_element('.editing_move img', 'css_element', $activityname); + $activitynode = $this->get_activity_element('Move', 'icon', $activityname); // JS enabled. if ($this->running_javascript()) { @@ -1144,7 +1155,7 @@ protected function section_exists($sectionnumber) { * @param int $sectionnumber * @return NodeElement */ - protected function show_section_icon_exists($sectionnumber) { + protected function show_section_link_exists($sectionnumber) { // Gets the section xpath and ensure it exists. $xpath = $this->section_exists($sectionnumber); @@ -1153,12 +1164,10 @@ protected function show_section_icon_exists($sectionnumber) { $courseformat = $this->get_course_format(); // Checking the show button alt text and show icon. - $showtext = behat_context_helper::escape(get_string('showfromothers', $courseformat)); - $linkxpath = $xpath . "/descendant::a[@title=$showtext]"; - $imgxpath = $linkxpath . "/descendant::img[contains(@src, 'show')]"; + $showtext = get_string('showfromothers', $courseformat); + $linkxpath = $xpath . "/descendant::a[@title=" . behat_context_helper::escape($showtext) . "]"; - $exception = new ElementNotFoundException($this->getSession(), 'Show section icon '); - $this->find('xpath', $imgxpath, $exception); + $exception = new ElementNotFoundException($this->getSession(), 'Show section link '); // Returing the link so both Non-JS and JS browsers can interact with it. return $this->find('xpath', $linkxpath, $exception); @@ -1171,7 +1180,7 @@ protected function show_section_icon_exists($sectionnumber) { * @param int $sectionnumber * @return NodeElement */ - protected function hide_section_icon_exists($sectionnumber) { + protected function hide_section_link_exists($sectionnumber) { // Gets the section xpath and ensure it exists. $xpath = $this->section_exists($sectionnumber); @@ -1182,10 +1191,9 @@ protected function hide_section_icon_exists($sectionnumber) { // Checking the hide button alt text and hide icon. $hidetext = behat_context_helper::escape(get_string('hidefromothers', $courseformat)); $linkxpath = $xpath . "/descendant::a[@title=$hidetext]"; - $imgxpath = $linkxpath . "/descendant::img[contains(@src, 'hide')]"; $exception = new ElementNotFoundException($this->getSession(), 'Hide section icon '); - $this->find('xpath', $imgxpath, $exception); + $this->find('icon', 'Hide', $exception); // Returing the link so both Non-JS and JS browsers can interact with it. return $this->find('xpath', $linkxpath, $exception); diff --git a/course/tests/behat/section_highlighting.feature b/course/tests/behat/section_highlighting.feature index eae3c3234f360..af8c941d2a84f 100644 --- a/course/tests/behat/section_highlighting.feature +++ b/course/tests/behat/section_highlighting.feature @@ -1,4 +1,4 @@ -@core @core_course @_cross_browser +@core @core_course @_cross_browser @javascript Feature: Topic's course sections highlighting In order to highlight parts of the course to students As a teacher @@ -30,6 +30,7 @@ Feature: Topic's course sections highlighting And section "2" should be highlighted And section "1" should not be highlighted And I turn section "2" highlighting off + And I wait until the page is ready And section "2" should not be highlighted And I reload the page And section "2" should not be highlighted diff --git a/course/view.php b/course/view.php index 6bb486561d6d5..81db3ce4280cc 100644 --- a/course/view.php +++ b/course/view.php @@ -217,8 +217,6 @@ $completion = new completion_info($course); if ($completion->is_enabled()) { - $PAGE->requires->string_for_js('completion-title-manual-y', 'completion'); - $PAGE->requires->string_for_js('completion-title-manual-n', 'completion'); $PAGE->requires->string_for_js('completion-alt-manual-y', 'completion'); $PAGE->requires->string_for_js('completion-alt-manual-n', 'completion'); diff --git a/course/yui/build/moodle-course-management/moodle-course-management-debug.js b/course/yui/build/moodle-course-management/moodle-course-management-debug.js index 060e1288b51d7..4e433dd7fb590 100644 --- a/course/yui/build/moodle-course-management/moodle-course-management-debug.js +++ b/course/yui/build/moodle-course-management/moodle-course-management-debug.js @@ -1348,10 +1348,14 @@ Category.prototype = { node.removeClass('collapsed').setAttribute('aria-expanded', 'true'); action.setAttribute('data-action', 'collapse').setAttrs({ title: M.util.get_string('collapsecategory', 'moodle', this.getName()) - }).one('img').setAttrs({ - src: M.util.image_url('t/switch_minus', 'moodle'), - alt: M.util.get_string('collapse', 'moodle') }); + + require(['core/templates', 'core/notification'], function(Templates, Notification) { + Templates.renderPix('t/switch_minus', 'core', M.util.get_string('collapse', 'moodle')).then(function(html) { + action.set('innerHTML', html); + }).fail(Notification.exception); + }); + if (ul) { ul.setAttribute('aria-hidden', 'false'); } diff --git a/course/yui/build/moodle-course-management/moodle-course-management-min.js b/course/yui/build/moodle-course-management/moodle-course-management-min.js index 6c1575a43178c..18045429fa880 100644 --- a/course/yui/build/moodle-course-management/moodle-course-management-min.js +++ b/course/yui/build/moodle-course-management/moodle-course-management-min.js @@ -1,4 +1,4 @@ YUI.add("moodle-course-management",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}function r(e){n.superclass.constructor.apply(this,[e])}function i(){i.superclass.constructor.apply(this,arguments)}function s(){s.superclass.constructor.apply(this,arguments)}function o(){o.superclass.constructor.apply(this,arguments)}n.NAME="moodle-course-management",n.CSS_PREFIX="management",n.ATTRS={element:{setter:function(t){return typeof t=="string"&&(t=e.one("#"+t)),t}},categorylisting:{value:null},courselisting:{value:null},coursedetails:{value:null},activecategoryid:{value:null},activecourseid:{value:null},categories:{setter:function(t,n){if(e.Lang.isArray(t))return t;var r=this.get(n);return r.push(t),r},value:[]},courses:{validator:function(t){return e.Lang.isArray(t)},value:[]},page:{getter:function(e,t){return e===null&&(e=this.get("element").getData(t),this.set(t,e)),e},value:null},totalpages:{getter:function(e,t){return e===null&&(e=this.get("element").getData(t),this.set(t,e)),e},value:null},totalcourses:{getter:function(e,t){return e===null&&(e=this.get("element").getData(t),this.set(t,e)),e},value:null},ajaxurl:{getter:function(e){return e===null&&(e=M.cfg.wwwroot+"/course/ajax/management.php"),e},value:null},dragdrop:{value:null}},n.prototype={categoriesinit:!1,initializer:function(){this.set("element","coursecat-management");var e=this.get("element"),t=e.one("#category-listing"),n=e.one("#course-listing"),i=null,s=null;t&&(i=t.one('.listitem[data-selected="1"]')),n&&(s=n.one('.listitem[data-selected="1"]')),this.set("categorylisting",t),this.set("courselisting",n),this.set("coursedetails",e.one("#course-detail")),i&&this.set("activecategoryid",i.getData("id")),s&&this.set("activecourseid",s.getData("id")),this.initialiseCategories(t),this.initialiseCourses(),n&&this.set("dragdrop",new r({console:this}))},initialiseCategories:function(e){var t=0;if(!e)return!1;var n=e.one("#menumovecategoriesto");n&&n.setAttribute("disabled",!0);var r=e.one("#menuresortcategoriesby");r&&r.setAttribute("disabled",!0);var i=e.one("#menuresortcoursesby");i&&i.setAttribute("disabled",!0),e.all(".listitem[data-id]").each(function(e){this.set("categories",new s({node:e,console:this})),t++},this),this.categoriesinit||(this.get("categorylisting").delegate("click",this.handleCategoryDelegation,"a[data-action]",this),this.get("categorylisting").delegate("click",this.handleCategoryDelegation,'input[name="bcat[]"]',this),this.get("categorylisting").delegate("click",this.handleBulkSortByaction,"#menuselectsortby",this),this.categoriesinit=!0)},initialiseCourses:function(){var e=this.getCategoryById(this.get("activecategoryid")),t=this.get("courselisting"),n=0;if(!t)return!1;var r=t.one("#menumovecoursesto");r&&r.setAttribute("disabled",!0),t.all(".listitem[data-id]").each(function(t){this.registerCourse(new o({node:t,console:this,category:e})),n++},this),t.delegate("click",this.handleCourseDelegation,"a[data-action]",this),t.delegate("click",this.handleCourseDelegation,'input[name="bc[]"]',this)},registerCourse:function(e){var t=this.get("courses");t.push(e),this.set("courses",t)},handleCourseDelegation:function(e){var t=e.currentTarget,n=t.getData("action"),r=t.ancestor(".listitem").getData("id"),i=this.getCourseById(r);i&&i.handle(n,e)},handleCategoryDelegation:function(e){var t=e.currentTarget,n=t.getData("action"),r=t.ancestor(".listitem").getData("id"),i=this.getCategoryById(r);i&&i.handle(n,e)},isCourseSelected:function(e){var t=!1;if(e&&e.get("checked"))t=!0;else{var n,r,i=this.get("courses"),s=i.length;for(n=0;n .course-listing"),s=r?r.one("ul.ml"):null,o=i?i.one("ul.ml"):null,u=i?i.getData("canmoveoutof"):!1,a=u?n:o;if(!o)return!1;o.all("> li").each(function(e){this.initCourseListing(e,a)},this),o.setData ("dd",new e.DD.Drop({node:o})),u&&s&&s.all("li > div").each(function(e){this.initCategoryListitem(e)},this),e.DD.DDM.on("drag:start",this.dragStart,this),e.DD.DDM.on("drag:end",this.dragEnd,this),e.DD.DDM.on("drag:drag",this.dragDrag,this),e.DD.DDM.on("drop:over",this.dropOver,this),e.DD.DDM.on("drop:enter",this.dropEnter,this),e.DD.DDM.on("drop:exit",this.dropExit,this),e.DD.DDM.on("drop:hit",this.dropHit,this)},initCourseListing:function(t,n){t.setData("dd",(new e.DD.Drag({node:t,target:{padding:"0 0 0 20"}})).addHandle(".drag-handle").plug(e.Plugin.DDProxy,{moveOnEnd:!1,borderStyle:!1}).plug(e.Plugin.DDConstrained,{constrain2node:n}))},initCategoryListitem:function(t){t.setData("dd",new e.DD.Drop({node:t}))},dragStart:function(e){var t=e.target,n=t.get("node"),r=t.get("dragNode");n.addClass("course-being-dragged"),r.addClass("course-being-dragged-proxy").set("innerHTML",n.one("a.coursename").get("innerHTML")),this.previoussibling=n.get("previousSibling")},dragEnd:function(e){var t=e.target,n=t.get("node");n.removeClass("course-being-dragged"),this.get("console").get("element").all("#category-listing li.highlight").removeClass("highlight")},dragDrag:function(e){var t=e.target.lastXY[1];t div a.action-moveup"),o=i.one(" > div a.action-movedown");if(!a||!o)s=i.one(" > div a.action-moveup"),f=u.one(" > div a.action-movedown"),!a&&!o?(l=e.Node.create(' '),f.replace(l),s.replace(f),l.replace(s),l.destroy()):o||s.insert(f,"after");s=i.one(" > div a.action-moveup"),s?s.focus():(o=i.one(" > div a.action-movedown"),o&&o.focus()),this.updated(!0)}else window.location.reload()},movedown:function(t,n,r){var i,s,o,u,a,f,l,c=this.checkAjaxResponse(t,n,r);if(c===!1)return!1;i=this.get("node"),s=i.next(".listitem");if(s){i.insert(s,"before"),f=s.one(" > div a.action-movedown"),o=i.one(" > div a.action-moveup");if(!f||!o)a=s.one(" > div a.action-moveup"),u=i.one(" > div a.action-movedown"),!f&&!o?(l=e.Node.create(' '),a.replace(l),u.replace(a),l.replace(u),l.destroy()):o||u.insert(a,"before");u=i.one(" > div a.action-movedown"),u?u.focus():(o=i.one(" > div a.action-moveup"),o&&o.focus()),this.updated(!0)}else window.location.reload()},show:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i;if(r===!1)return!1;this.markVisible(),i=this.get("node").one("a[data-action=hide]"),i&&i.focus(),this.updated()},markVisible:function(){return this.get("node").setAttribute("data-visible","1"),!0},hide:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i;if(r===!1)return!1;this.markHidden(),i=this.get("node").one("a[data-action=show]"),i&&i.focus(),this.updated()},markHidden:function(){return this.get("node").setAttribute("data-visible","0"),!0},updated:function(e){e&&this.highlight()},highlight:function(){var e=this.get("node");e.siblings(".highlight").removeClass("highlight"),e.addClass("highlight"),this.highlighttimeout&&window.clearTimeout(this.highlighttimeout),this.highlighttimeout=window.setTimeout(function(){e.removeClass("highlight")},2500)}},e.extend(i,e.Base,i.prototype),s.NAME="moodle-course-management-category",s.CSS_PREFIX="management-category",s.ATTRS={categoryid:{getter:function(e,t){return e===null&&(e=this.get("node").getData("id"),this.set(t,e)),e},value:null,writeOnce:!0},selected:{getter:function(e,t){return e===null&&(e=this.get("node").getData(t),e===null&&(e=!1),this.set(t,e)),e},value:null},courses:{validator:function(t){return e.Lang.isArray(t)},value:[]}},s.prototype={initializer:function(){this.set("itemname","category")},getName:function(){return this.get("node").one("a.categoryname").get("innerHTML")},registerCourse:function(e){var t=this.get("courses");t.push(e),this.set("courses",t)},handle:function(e,t){var n={categoryid:this.get("categoryid")},r=this.get("console").get("activecategoryid");r&&r!==n.categoryid&&(n.selectedcategory=r);switch(e){case"moveup":t.preventDefault(),this.get("console").performAjaxAction("movecategoryup",n,this.moveup,this);break;case"movedown":t.preventDefault(),this.get("console").performAjaxAction("movecategorydown",n,this.movedown,this);break;case"show":t.preventDefault(),this.get("console").performAjaxAction("showcategory",n,this -.show,this);break;case"hide":t.preventDefault(),this.get("console").performAjaxAction("hidecategory",n,this.hide,this);break;case"expand":t.preventDefault(),this.get("node").getData("expanded")==="0"&&(this.get("node").setAttribute("data-expanded","1").setData("expanded","true"),this.get("console").performAjaxAction("getsubcategorieshtml",n,this.loadSubcategories,this)),this.expand();break;case"collapse":t.preventDefault(),this.collapse();break;case"select":var i=this.get("console"),s=i.get("categorylisting").one("#menumovecategoriesto");s&&(i.isCategorySelected(t.currentTarget)&&i.get("categories").length>1?s.removeAttribute("disabled"):s.setAttribute("disabled",!0),i.handleBulkSortByaction());break;default:return!1}},expand:function(){var e=this.get("node"),t=e.one("a[data-action=expand]"),n=e.one("ul[role=group]");e.removeClass("collapsed").setAttribute("aria-expanded","true"),t.setAttribute("data-action","collapse").setAttrs({title:M.util.get_string("collapsecategory","moodle",this.getName())}).one("img").setAttrs({src:M.util.image_url("t/switch_minus","moodle"),alt:M.util.get_string("collapse","moodle")}),n&&n.setAttribute("aria-hidden","false"),this.get("console").performAjaxAction("expandcategory",{categoryid:this.get("categoryid")},null,this)},collapse:function(){var e=this.get("node"),t=e.one("a[data-action=collapse]"),n=e.one("ul[role=group]");e.addClass("collapsed").setAttribute("aria-expanded","false"),t.setAttribute("data-action","expand").setAttrs({title:M.util.get_string("expandcategory","moodle",this.getName())}).one("img").setAttrs({src:M.util.image_url("t/switch_plus","moodle"),alt:M.util.get_string("expand","moodle")}),n&&n.setAttribute("aria-hidden","true"),this.get("console").performAjaxAction("collapsecategory",{categoryid:this.get("categoryid")},null,this)},loadSubcategories:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i=this.get("node"),s=this.get("console"),o,u;return r===!1?!1:(i.append(r.html),s.initialiseCategories(i),M.core&&M.core.actionmenu&&M.core.actionmenu.newDOMNode&&M.core.actionmenu.newDOMNode(i),o=i.one("ul[role=group]"),u=i.one("a[data-action=collapse]"),o&&u&&u.setAttribute("aria-controls",o.generateID()),!0)},moveCourseTo:function(t){var n=this;e.use("moodle-core-notification-confirm",function(){var e=new M.core.confirm({title:M.util.get_string("confirm","moodle"),question:M.util.get_string("confirmcoursemove","moodle",{course:t.getName(),category:n.getName()}),yesLabel:M.util.get_string("move","moodle"),noLabel:M.util.get_string("cancel","moodle")});e.on("complete-yes",function(){e.hide(),e.destroy(),this.get("console").performAjaxAction("movecourseintocategory",{categoryid:this.get("categoryid"),courseid:t.get("courseid")},this.completeMoveCourse,this)},n),e.show()})},completeMoveCourse:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i=this.get("console"),s,o,u;return r===!1?!1:(o=i.getCourseById(n.courseid),o?(this.highlight(),o&&(r.paginationtotals&&(u=i.get("courselisting").one(".listing-pagination-totals"),u&&u.set("innerHTML",r.paginationtotals)),r.totalcatcourses!=="undefined"&&(u=this.get("node").one(".course-count span"),u&&u.set("innerHTML",u.get("innerHTML").replace(/^\d+/,r.totalcatcourses))),typeof r.fromcatcoursecount!="undefined"&&(s=i.get("activecategoryid"),s=i.getCategoryById(s),s&&(u=s.get("node").one(".course-count span"),u&&u.set("innerHTML",u.get("innerHTML").replace(/^\d+/,r.fromcatcoursecount)))),o.remove()),!0):!1)},show:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i;if(r===!1)return!1;this.markVisible(),i=this.get("node").one("a[data-action=hide]"),i&&i.focus(),r.categoryvisibility&&this.updateChildVisibility(r.categoryvisibility),r.coursevisibility&&this.updateCourseVisiblity(r.coursevisibility),this.updated()},hide:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i;if(r===!1)return!1;this.markHidden(),i=this.get("node").one("a[data-action=show]"),i&&i.focus(),r.categoryvisibility&&this.updateChildVisibility(r.categoryvisibility),r.coursevisibility&&this.updateCourseVisiblity(r.coursevisibility),this.updated()},updateCourseVisiblity:function(e){var t=this.get("console"),n,r;try{for(n in e)typeof e[n]=="object"&&(r=t.getCourseById(e[n].id),r&&(e[n].visible==="1"?r.markVisible():r.markHidden()))}catch(i){}return this},updateChildVisibility:function(e){var t=this.get("console"),n,r;try{for(n in e)typeof e[n]=="object"&&(r=t.getCategoryById(e[n].id),r&&(e[n].visible==="1"?r.markVisible():r.markHidden()))}catch(i){}return this}},e.extend(s,i,s.prototype),o.NAME="moodle-course-management-course",o.CSS_PREFIX="management-course",o.ATTRS={courseid:{},selected:{getter:function(e,t){return e===null&&(e=this.get("node").getData(t),this.set(t,e)),e},value:null},node:{},console:{writeOnce:"initOnly"},category:{writeOnce:"initOnly"}},o.prototype={initializer:function(){var e=this.get("node"),t=this.get("category");this.set("courseid",e.getData("id")),t&&t.registerCourse&&t.registerCourse(this),this.set("itemname","course")},getName:function(){return this.get("node").one("a.coursename").get("innerHTML")},handle:function(e,t){var n=this.get("console"),r={courseid:this.get("courseid")};switch(e){case"moveup":t.halt(),n.performAjaxAction("movecourseup",r,this.moveup,this);break;case"movedown":t.halt(),n.performAjaxAction("movecoursedown",r,this.movedown,this);break;case"show":t.halt(),n.performAjaxAction("showcourse",r,this.show,this);break;case"hide":t.halt(),n.performAjaxAction("hidecourse",r,this.hide,this);break;case"select":var i=this.get("console"),s=i.get("courselisting").one("#menumovecoursesto");s&&(i.isCourseSelected(t.currentTarget)?s.removeAttribute("disabled"):s.setAttribute("disabled",!0));break;default:return!1}},remove:function(){this.get("console").removeCourseById(this.get("courseid")),this.get("node").remove()},moveAfter:function(e,t){var n=this.get("console"),r={courseid:this.get("courseid"),moveafter:e,previous:t};n.performAjaxAction("movecourseafter",r,this.moveAfterResponse,this)},moveAfterResponse -:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i=this.get("node"),s;if(r===!1)return s=i.ancestor("ul").one("li[data-id="+n.previous+"]"),s?s.insertAfter(i,"after"):i.ancestor("ul").one("li").insert(i,"before"),!1;this.highlight()}},e.extend(o,i,o.prototype)},"@VERSION@",{requires:["base","node","io-base","moodle-core-notification-exception","json-parse","dd-constrain","dd-proxy","dd-drop","dd-delegate","node-event-delegate"]}); +.show,this);break;case"hide":t.preventDefault(),this.get("console").performAjaxAction("hidecategory",n,this.hide,this);break;case"expand":t.preventDefault(),this.get("node").getData("expanded")==="0"&&(this.get("node").setAttribute("data-expanded","1").setData("expanded","true"),this.get("console").performAjaxAction("getsubcategorieshtml",n,this.loadSubcategories,this)),this.expand();break;case"collapse":t.preventDefault(),this.collapse();break;case"select":var i=this.get("console"),s=i.get("categorylisting").one("#menumovecategoriesto");s&&(i.isCategorySelected(t.currentTarget)&&i.get("categories").length>1?s.removeAttribute("disabled"):s.setAttribute("disabled",!0),i.handleBulkSortByaction());break;default:return!1}},expand:function(){var e=this.get("node"),t=e.one("a[data-action=expand]"),n=e.one("ul[role=group]");e.removeClass("collapsed").setAttribute("aria-expanded","true"),t.setAttribute("data-action","collapse").setAttrs({title:M.util.get_string("collapsecategory","moodle",this.getName())}),require(["core/templates","core/notification"],function(e,n){e.renderPix("t/switch_minus","core",M.util.get_string("collapse","moodle")).then(function(e){t.set("innerHTML",e)}).fail(n.exception)}),n&&n.setAttribute("aria-hidden","false"),this.get("console").performAjaxAction("expandcategory",{categoryid:this.get("categoryid")},null,this)},collapse:function(){var e=this.get("node"),t=e.one("a[data-action=collapse]"),n=e.one("ul[role=group]");e.addClass("collapsed").setAttribute("aria-expanded","false"),t.setAttribute("data-action","expand").setAttrs({title:M.util.get_string("expandcategory","moodle",this.getName())}).one("img").setAttrs({src:M.util.image_url("t/switch_plus","moodle"),alt:M.util.get_string("expand","moodle")}),n&&n.setAttribute("aria-hidden","true"),this.get("console").performAjaxAction("collapsecategory",{categoryid:this.get("categoryid")},null,this)},loadSubcategories:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i=this.get("node"),s=this.get("console"),o,u;return r===!1?!1:(i.append(r.html),s.initialiseCategories(i),M.core&&M.core.actionmenu&&M.core.actionmenu.newDOMNode&&M.core.actionmenu.newDOMNode(i),o=i.one("ul[role=group]"),u=i.one("a[data-action=collapse]"),o&&u&&u.setAttribute("aria-controls",o.generateID()),!0)},moveCourseTo:function(t){var n=this;e.use("moodle-core-notification-confirm",function(){var e=new M.core.confirm({title:M.util.get_string("confirm","moodle"),question:M.util.get_string("confirmcoursemove","moodle",{course:t.getName(),category:n.getName()}),yesLabel:M.util.get_string("move","moodle"),noLabel:M.util.get_string("cancel","moodle")});e.on("complete-yes",function(){e.hide(),e.destroy(),this.get("console").performAjaxAction("movecourseintocategory",{categoryid:this.get("categoryid"),courseid:t.get("courseid")},this.completeMoveCourse,this)},n),e.show()})},completeMoveCourse:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i=this.get("console"),s,o,u;return r===!1?!1:(o=i.getCourseById(n.courseid),o?(this.highlight(),o&&(r.paginationtotals&&(u=i.get("courselisting").one(".listing-pagination-totals"),u&&u.set("innerHTML",r.paginationtotals)),r.totalcatcourses!=="undefined"&&(u=this.get("node").one(".course-count span"),u&&u.set("innerHTML",u.get("innerHTML").replace(/^\d+/,r.totalcatcourses))),typeof r.fromcatcoursecount!="undefined"&&(s=i.get("activecategoryid"),s=i.getCategoryById(s),s&&(u=s.get("node").one(".course-count span"),u&&u.set("innerHTML",u.get("innerHTML").replace(/^\d+/,r.fromcatcoursecount)))),o.remove()),!0):!1)},show:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i;if(r===!1)return!1;this.markVisible(),i=this.get("node").one("a[data-action=hide]"),i&&i.focus(),r.categoryvisibility&&this.updateChildVisibility(r.categoryvisibility),r.coursevisibility&&this.updateCourseVisiblity(r.coursevisibility),this.updated()},hide:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i;if(r===!1)return!1;this.markHidden(),i=this.get("node").one("a[data-action=show]"),i&&i.focus(),r.categoryvisibility&&this.updateChildVisibility(r.categoryvisibility),r.coursevisibility&&this.updateCourseVisiblity(r.coursevisibility),this.updated()},updateCourseVisiblity:function(e){var t=this.get("console"),n,r;try{for(n in e)typeof e[n]=="object"&&(r=t.getCourseById(e[n].id),r&&(e[n].visible==="1"?r.markVisible():r.markHidden()))}catch(i){}return this},updateChildVisibility:function(e){var t=this.get("console"),n,r;try{for(n in e)typeof e[n]=="object"&&(r=t.getCategoryById(e[n].id),r&&(e[n].visible==="1"?r.markVisible():r.markHidden()))}catch(i){}return this}},e.extend(s,i,s.prototype),o.NAME="moodle-course-management-course",o.CSS_PREFIX="management-course",o.ATTRS={courseid:{},selected:{getter:function(e,t){return e===null&&(e=this.get("node").getData(t),this.set(t,e)),e},value:null},node:{},console:{writeOnce:"initOnly"},category:{writeOnce:"initOnly"}},o.prototype={initializer:function(){var e=this.get("node"),t=this.get("category");this.set("courseid",e.getData("id")),t&&t.registerCourse&&t.registerCourse(this),this.set("itemname","course")},getName:function(){return this.get("node").one("a.coursename").get("innerHTML")},handle:function(e,t){var n=this.get("console"),r={courseid:this.get("courseid")};switch(e){case"moveup":t.halt(),n.performAjaxAction("movecourseup",r,this.moveup,this);break;case"movedown":t.halt(),n.performAjaxAction("movecoursedown",r,this.movedown,this);break;case"show":t.halt(),n.performAjaxAction("showcourse",r,this.show,this);break;case"hide":t.halt(),n.performAjaxAction("hidecourse",r,this.hide,this);break;case"select":var i=this.get("console"),s=i.get("courselisting").one("#menumovecoursesto");s&&(i.isCourseSelected(t.currentTarget)?s.removeAttribute("disabled"):s.setAttribute("disabled",!0));break;default:return!1}},remove:function(){this.get("console").removeCourseById(this.get("courseid")),this.get("node").remove()},moveAfter:function(e,t){var n=this.get("console"),r={courseid:this.get("courseid"),moveafter:e,previous:t};n +.performAjaxAction("movecourseafter",r,this.moveAfterResponse,this)},moveAfterResponse:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i=this.get("node"),s;if(r===!1)return s=i.ancestor("ul").one("li[data-id="+n.previous+"]"),s?s.insertAfter(i,"after"):i.ancestor("ul").one("li").insert(i,"before"),!1;this.highlight()}},e.extend(o,i,o.prototype)},"@VERSION@",{requires:["base","node","io-base","moodle-core-notification-exception","json-parse","dd-constrain","dd-proxy","dd-drop","dd-delegate","node-event-delegate"]}); diff --git a/course/yui/build/moodle-course-management/moodle-course-management.js b/course/yui/build/moodle-course-management/moodle-course-management.js index 15973a610d080..f2c006a5f5f1e 100644 --- a/course/yui/build/moodle-course-management/moodle-course-management.js +++ b/course/yui/build/moodle-course-management/moodle-course-management.js @@ -1321,10 +1321,14 @@ Category.prototype = { node.removeClass('collapsed').setAttribute('aria-expanded', 'true'); action.setAttribute('data-action', 'collapse').setAttrs({ title: M.util.get_string('collapsecategory', 'moodle', this.getName()) - }).one('img').setAttrs({ - src: M.util.image_url('t/switch_minus', 'moodle'), - alt: M.util.get_string('collapse', 'moodle') }); + + require(['core/templates', 'core/notification'], function(Templates, Notification) { + Templates.renderPix('t/switch_minus', 'core', M.util.get_string('collapse', 'moodle')).then(function(html) { + action.set('innerHTML', html); + }).fail(Notification.exception); + }); + if (ul) { ul.setAttribute('aria-hidden', 'false'); } diff --git a/course/yui/src/management/js/category.js b/course/yui/src/management/js/category.js index 371b3c5ecc680..70b62600ae623 100644 --- a/course/yui/src/management/js/category.js +++ b/course/yui/src/management/js/category.js @@ -169,10 +169,14 @@ Category.prototype = { node.removeClass('collapsed').setAttribute('aria-expanded', 'true'); action.setAttribute('data-action', 'collapse').setAttrs({ title: M.util.get_string('collapsecategory', 'moodle', this.getName()) - }).one('img').setAttrs({ - src: M.util.image_url('t/switch_minus', 'moodle'), - alt: M.util.get_string('collapse', 'moodle') }); + + require(['core/templates', 'core/notification'], function(Templates, Notification) { + Templates.renderPix('t/switch_minus', 'core', M.util.get_string('collapse', 'moodle')).then(function(html) { + action.set('innerHTML', html); + }).fail(Notification.exception); + }); + if (ul) { ul.setAttribute('aria-hidden', 'false'); } diff --git a/grade/tests/behat/behat_grade.php b/grade/tests/behat/behat_grade.php index bc1f2ead7237f..12e67895bfc09 100644 --- a/grade/tests/behat/behat_grade.php +++ b/grade/tests/behat/behat_grade.php @@ -94,7 +94,7 @@ public function i_set_the_following_settings_for_grade_item($gradeitem, TableNod /** * Hids a grade item or category. * - * Teacher must be either on the grade setup page or on the Grader report page with editing mode turned on. + * Teacher must be on the grade setup page. * * @Given /^I hide the grade item "(?P(?:[^"]|\\")*)"$/ * @param string $gradeitem @@ -110,10 +110,8 @@ public function i_hide_the_grade_item($gradeitem) { } } - $hide = behat_context_helper::escape(get_string('hide') . ' '); - $linkxpath = "//a[./img[starts-with(@title,$hide) and contains(@title,$gradeitem)]]"; - - $this->execute("behat_general::i_click_on", array($this->escape($linkxpath), "xpath_element")); + $this->execute("behat_general::i_click_on_in_the", array(get_string('hide'), 'link', + "//tr[descendant::*[text() = " . $this->escape($gradeitem) . "]]", 'xpath_element')); } /** diff --git a/lang/en/completion.php b/lang/en/completion.php index a876d64aa57ae..c19e306bb8bc0 100644 --- a/lang/en/completion.php +++ b/lang/en/completion.php @@ -54,8 +54,6 @@ $string['completion-fail'] = 'Completed (did not achieve pass grade)'; $string['completion-n'] = 'Not completed'; $string['completion-pass'] = 'Completed (achieved pass grade)'; -$string['completion-title-manual-n'] = 'Mark as complete: {$a}'; -$string['completion-title-manual-y'] = 'Mark as not complete: {$a}'; $string['completion-y'] = 'Completed'; $string['completion_automatic'] = 'Show activity as complete when conditions are met'; $string['completion_help'] = 'If enabled, activity completion is tracked, either manually or automatically, based on certain conditions. Multiple conditions may be set if desired. If so, the activity will only be considered complete when ALL conditions are met. @@ -182,3 +180,7 @@ $string['writingcompletiondata'] = 'Writing completion data'; $string['xdays'] = '{$a} days'; $string['yourprogress'] = 'Your progress'; + +// Deprecated since Moodle 3.3. +$string['completion-title-manual-n'] = 'Mark as complete: {$a}'; +$string['completion-title-manual-y'] = 'Mark as not complete: {$a}'; diff --git a/lib/amd/build/icon_system_standard.min.js b/lib/amd/build/icon_system_standard.min.js index c31281b8f78bf..d165a79845cbc 100644 --- a/lib/amd/build/icon_system_standard.min.js +++ b/lib/amd/build/icon_system_standard.min.js @@ -1 +1 @@ -define(["core/icon_system","core/url","core/mustache"],function(a,b,c){var d=function(){a.apply(this,arguments)};return d.prototype=Object.create(a.prototype),d.prototype.renderIcon=function(a,d,e,f){var g=b.imageUrl(a,d),h={attributes:[{name:"src",value:g},{name:"alt",value:e},{name:"title",value:e}]},i=c.render(f,h);return i.trim()},d}); \ No newline at end of file +define(["core/icon_system","core/url","core/mustache"],function(a,b,c){var d=function(){a.apply(this,arguments)};return d.prototype=Object.create(a.prototype),d.prototype.renderIcon=function(a,d,e,f){var g=b.imageUrl(a,d),h={attributes:[{name:"src",value:g},{name:"alt",value:e},{name:"title",value:e}]},i=c.render(f,h);return i.trim()},d.prototype.getTemplateName=function(){return"core/pix_icon"},d}); \ No newline at end of file diff --git a/lib/amd/src/icon_system_standard.js b/lib/amd/src/icon_system_standard.js index 579f87d1dff35..119a1865f7f29 100644 --- a/lib/amd/src/icon_system_standard.js +++ b/lib/amd/src/icon_system_standard.js @@ -56,6 +56,16 @@ define(['core/icon_system', 'core/url', 'core/mustache'], return result.trim(); }; + /** + * Get the name of the template to pre-cache for this icon system. + * + * @return {String} + * @method getTemplateName + */ + IconSystemStandard.prototype.getTemplateName = function() { + return 'core/pix_icon'; + }; + return /** @alias module:core/icon_system_standard */ IconSystemStandard; }); diff --git a/lib/behat/classes/exact_named_selector.php b/lib/behat/classes/exact_named_selector.php index 9868de5f037fc..4902075c27550 100644 --- a/lib/behat/classes/exact_named_selector.php +++ b/lib/behat/classes/exact_named_selector.php @@ -31,6 +31,16 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class behat_exact_named_selector extends \Behat\Mink\Selector\ExactNamedSelector { + + /** + * Creates selector instance. + */ + public function __construct() { + $this->registerReplacement('%iconMatch%', "(contains(concat(' ', @class, ' '), ' icon ') or name() = 'img')"); + $this->registerReplacement('%imgAltMatch%', './/*[%iconMatch% and (%altMatch% or %titleMatch%)]'); + parent::__construct(); + } + /** * @var Allowed types when using text selectors arguments. */ diff --git a/lib/behat/classes/partial_named_selector.php b/lib/behat/classes/partial_named_selector.php index 1e0276f3d8fb4..82aa8812ba360 100644 --- a/lib/behat/classes/partial_named_selector.php +++ b/lib/behat/classes/partial_named_selector.php @@ -45,7 +45,8 @@ public function __construct() { $this->registerNamedXpath($name, $xpath); } - // Call the constructor after adding any new selector or replacement values. + $this->registerReplacement('%iconMatch%', "(contains(concat(' ', @class, ' '), ' icon ') or name() = 'img')"); + $this->registerReplacement('%imgAltMatch%', './/*[%iconMatch% and (%altMatch% or %titleMatch%)]'); parent::__construct(); } @@ -58,6 +59,7 @@ public function __construct() { 'css_element' => 'css_element', 'dialogue' => 'dialogue', 'fieldset' => 'fieldset', + 'icon' => 'icon', 'list_item' => 'list_item', 'message_area_region' => 'message_area_region', 'message_area_region_content' => 'message_area_region_content', @@ -84,6 +86,7 @@ public function __construct() { 'fieldset' => 'fieldset', 'file' => 'file', 'filemanager' => 'filemanager', + 'icon' => 'icon', 'link' => 'link', 'link_or_button' => 'link_or_button', 'list_item' => 'list_item', @@ -128,6 +131,9 @@ public function __construct() { ]) = %locator%] | .//div[contains(concat(' ', normalize-space(@class), ' '), ' yui-dialog ') and normalize-space(descendant::div[@class='hd']) = %locator%] +XPATH + , 'icon' => << << 'fa-check-square', 'core:i/completion-manual-enabled' => 'fa-square-o', 'core:i/completion-manual-y' => 'fa-check-square', - 'core:i/completion-manual-n' => 'fa-minus-square', + 'core:i/completion-manual-n' => 'fa-square-o', 'core:i/completion-self' => 'fa-user-o', 'core:i/lock' => 'fa-lock', 'core:i/courseevent' => 'fa-calendar', @@ -265,10 +265,10 @@ public function get_core_icon_map() { 'core:i/grade_partiallycorrect' => 'fa-check-square', 'core:i/grades' => 'fa-graduation-cap', 'core:i/groupevent' => 'fa-group', - 'core:i/groupn' => 'fa-square-o', + 'core:i/groupn' => 'fa-user', 'core:i/group' => 'fa-users', - 'core:i/groups' => 'fa-object-ungroup', - 'core:i/groupv' => 'fa-object-group', + 'core:i/groups' => 'fa-user-circle', + 'core:i/groupv' => 'fa-user-circle-o', 'core:i/hide' => 'fa-eye', 'core:i/heirarchylock' => 'fa-lock', 'core:i/import' => 'fa-level-up', @@ -377,9 +377,9 @@ public function get_core_icon_map() { 'core:t/expanded' => 'fa-caret-down', 'core:t/go' => 'fa-play', 'core:t/grades' => 'fa-graduation-cap', - 'core:t/groupn' => 'fa-square-o', - 'core:t/groups' => 'fa-object-ungroup', - 'core:t/groupv' => 'fa-object-group', + 'core:t/groupn' => 'fa-user', + 'core:t/groups' => 'fa-user-circle', + 'core:t/groupv' => 'fa-user-circle-o', 'core:t/hide' => 'fa-eye', 'core:t/left' => 'fa-arrow-left', 'core:t/less' => 'fa-caret-up', diff --git a/lib/classes/output/icon_system_standard.php b/lib/classes/output/icon_system_standard.php index 3d38356d95642..064ec88761f75 100644 --- a/lib/classes/output/icon_system_standard.php +++ b/lib/classes/output/icon_system_standard.php @@ -43,6 +43,9 @@ public function render_pix_icon(renderer_base $output, pix_icon $icon) { return $output->render_from_template('core/pix_icon', $data); } + public function get_amd_name() { + return 'core/icon_system_standard'; + } } diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index 9ed4ac816ac7a..a28b763e1e17c 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -574,9 +574,9 @@ public function export_for_template(renderer_base $output) { $pixdata = $this->pixicon->export_for_template($output); - $title = isset($pixdata['attributes']['title']) ? $pixdata['attributes']['title'] : ''; + $title = isset($this->pixicon->attributes['title']) ? $this->pixicon->attributes['title'] : ''; if (empty($title)) { - $title = isset($pixdata['attributes']['alt']) ? $pixdata['attributes']['alt'] : ''; + $title = isset($this->pixicon->attributes['alt']) ? $this->pixicon->attributes['alt'] : ''; } $data = array( 'extraclasses' => $pixdata['extraclasses'], @@ -4441,12 +4441,9 @@ public function export_for_template(renderer_base $output) { unset($attributes['class']); // Handle text being a renderable. - $comparetoalt = $this->text; if ($this->text instanceof renderable) { $data->text = $this->render($this->text); - $comparetoalt = ''; } - $comparetoalt = (string) $comparetoalt; $data->showtext = (!$this->icon || $this->primary === false); @@ -4456,14 +4453,6 @@ public function export_for_template(renderer_base $output) { if ($this->primary || !$this->actionmenu->will_be_enhanced()) { $attributes['title'] = $data->text; } - if (!$this->primary && $this->actionmenu->will_be_enhanced()) { - if ((string) $icon->attributes['alt'] === $comparetoalt) { - $icon->attributes['alt'] = ''; - } - if (isset($icon->attributes['title']) && (string) $icon->attributes['title'] === $comparetoalt) { - unset($icon->attributes['title']); - } - } $data->icon = $icon ? $icon->export_for_pix() : null; } diff --git a/lib/outputlib.php b/lib/outputlib.php index db753acb1e62e..88b0d8c7d0781 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -1256,7 +1256,7 @@ public function get_icon_system() { return $parent_config->iconsystem; } } - return 'standard'; + return \core\output\icon_system::STANDARD; } /** diff --git a/lib/templates/pix_icon_fontawesome.mustache b/lib/templates/pix_icon_fontawesome.mustache index 096127f3ff7ff..708498e80b30f 100644 --- a/lib/templates/pix_icon_fontawesome.mustache +++ b/lib/templates/pix_icon_fontawesome.mustache @@ -40,4 +40,4 @@ } }} -{{title}} + diff --git a/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-debug.js b/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-debug.js index 8a864e4d873dd..076db63fb1100 100644 --- a/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-debug.js +++ b/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-debug.js @@ -180,7 +180,7 @@ Y.extend(DRAGDROP, Y.Base, { window.require(['core/templates'], function(Templates) { Templates.renderPix('i/move_2d', 'core').then(function(html) { var dragicon = Y.Node.create(html); - dragicon.addClass('moodle-core-dragdrop-draghandle').setStyle('cursor', 'move'); + dragicon.setStyle('cursor', 'move'); if (typeof iconclass != 'undefined') { dragicon.addClass(iconclass); } diff --git a/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-min.js b/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-min.js index d70fe1654b941..ac90c75a44306 100644 --- a/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-min.js +++ b/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-min.js @@ -1,2 +1,2 @@ -YUI.add("moodle-core-dragdrop",function(e,t){var n={pix:"i/move_2d",largepix:"i/dragdrop",component:"moodle",cssclass:"moodle-core-dragdrop-draghandle"},r=function(){r.superclass.constructor.apply(this,arguments)};e.extend(r,e.Base,{goingup:null,absgoingup:null,samenodeclass:null,parentnodeclass:null,samenodelabel:null,parentnodelabel:null,groups:[],lastdroptarget:null,listeners:null,initializer:function(){this.listeners=[],this.listeners.push(e.DD.DDM.on("drag:start",this.global_drag_start,this)),this.listeners.push(e.DD.DDM.on("drag:end",this.global_drag_end,this)),this.listeners.push(e.DD.DDM.on("drag:drag",this.global_drag_drag,this)),this.listeners.push(e.DD.DDM.on("drop:over",this.global_drop_over,this)),this.listeners.push(e.DD.DDM.on("drop:hit",this.global_drop_hit,this)),this.listeners.push(e.DD.DDM.on("drag:dropmiss",this.global_drag_dropmiss,this)),this.listeners.push(e.one(e.config.doc.body).delegate("key",this.global_keydown,"down:32, enter, esc","."+n.cssclass,this)),this.listeners.push(e.one(e.config.doc.body).delegate("click",this.global_keydown,"."+n.cssclass,this))},destructor:function(){(new e.EventHandle(this.listeners)).detach()},get_drag_handle:function(t,r,i){var s=e.Node.create("").addClass(r).setAttribute("title",t).setAttribute("tabIndex",0).setAttribute("data-draggroups",this.groups).setAttribute("role","button");return s.addClass(n.cssclass),window.require(["core/templates"],function(t){t.renderPix("i/move_2d","core").then(function(t){var n=e.Node.create(t);n.addClass("moodle-core-dragdrop-draghandle").setStyle("cursor","move"),typeof i!="undefined"&&n.addClass(i),s.appendChild(n)})}.bind(this)),s},lock_drag_handle:function(e,t){e.removeHandle("."+t)},unlock_drag_handle:function(e,t){e.addHandle("."+t),e.get("activeHandle").focus()},ajax_failure:function(e){var t={name:e.status+" "+e.statusText,message:e.responseText};return new M.core.exception(t)},in_group:function(t){var n=!1;return e.each(this.groups,function(e){t._groups[e]&&(n=!0)},this),n},global_drag_start:function(e){var t=e.target;if(!this.in_group(t))return;this.originalstyle=t.get("node").getAttribute("style"),t.get("node").setStyle("opacity",".25"),t.get("dragNode").setStyles({opacity:".75",borderColor:t.get("node").getStyle("borderColor"),backgroundColor:t.get("node").getStyle("backgroundColor")}),t.get("dragNode").empty(),this.drag_start(e)},global_drag_end:function(e){var t=e.target;if(!this.in_group(t))return;t.get("node").setAttribute("style",this.originalstyle),this.drag_end(e)},global_drag_drag:function(e){var t=e.target,n=e.info;if(!this.in_group(t))return;n.start[1]n.xy[1]&&(this.absgoingup=!1),n.delta[1]<0?this.goingup=!0:n.delta[1]>0&&(this.goingup=!1),this.drag_drag(e)},global_drop_over:function(e){if(!e.drop||!e.drop.inGroup(this.groups))return;var t=e.drag.get("node"),n=e.drop.get("node");this.lastdroptarget=e.drop;if(n.hasClass(this.samenodeclass)){var r;this.goingup?r="before":r="after",n.insert(t,r)}else(n.hasClass(this.parentnodeclass)||n.test('[data-droptarget="1"]'))&&!n.contains(t)&&(this.goingup?n.append(t):n.prepend(t));this.drop_over(e)},global_drag_dropmiss:function(e){e.drag=e.target,e.drop=this.lastdroptarget;if(!this.in_group(e.drag))return;if(!e.drop||!e.drop.inGroup(this.groups))return;this.drag_dropmiss(e)},global_drop_hit:function(e){if(!e.drop||!e.drop.inGroup(this.groups))return;this.drop_hit(e)},find_element_text:function(t){var n="";n=t.get("aria-label")||"";if(n.length>0)return n;var r=t.get("aria-labelledby");if(r){var i=e.one("#"+r);if(i&&i.get("text").length>0)return i.get("text")}var s=t.all("h2, h3, h4, h5, span:not(.actions):not(.menu-action-text), p, div.no-overflow, div.dimmed_text");return s.each(function(){n===""&&e.Lang.trim(this.get("text"))!==""&&(n=this.get("text"))}),n!==""?n:M.util.get_string("emptydragdropregion","moodle")},global_start_keyboard_drag:function(t,n,r){M.core.dragdrop.keydragcontainer=r,M.core.dragdrop.keydraghandle=n;var i=this.find_element_text(r),s=M.util.get_string("movecontent","moodle",i),o=e.Node.create("
    ");o.addClass("dragdrop-keyboard-drag");var u,a,f,l=e.all("."+this.samenodeclass+", ."+this.parentnodeclass);l.each(function(t){var n=!1,s=t,l=t.getAttribute("class").split(" ").join(", .");if(t.drop&&t.drop.inGroup(this.groups)&&t.drop.get("node")!==r&&t.next(l)!==r)n=!0;else{var c=t.getAttribute("data-draggroups").split(" "),h,p;for(h=0;h"),a=e.Node.create(""),i=this.find_element_text(s),this.samenodelabel&&t.hasClass(this.samenodeclass)?f=M.util.get_string(this.samenodelabel.identifier,this.samenodelabel.component,i):this.parentnodelabel&&t.hasClass(this.parentnodeclass)?f=M.util.get_string(this.parentnodelabel.identifier,this.parentnodelabel.component,i):f=M.util.get_string("tocontent","moodle",i),a.setContent(f),a.setAttribute("data-drop-target",t.get("id")),a.setAttribute("tabindex","0"),a.on("click",this.global_keyboard_drop,this),a.on("key",this.global_keyboard_drop,"down:enter,32",this),u.append(a),o.append(u))},this),M.core.dragdrop.dropui=new M.core.dialogue({headerContent:s,bodyContent:o,draggable:!0,visible:!0,center:!0,modal:!0}),M.core.dragdrop.dropui.after("visibleChange",function(e){e.prevVal&&!e.newVal&&this.global_cancel_keyboard_drag()},this),o.one("a")&&o.one("a").focus()},simulated_drag_drop_event:function(e,t){var n=function(e){this.node=e};n.prototype.get=function(e){return e==="node"||e==="dragNode"||e==="dropNode"?this.node:e==="activeHandle"?this.node.one(".editing_move"):null},n.prototype.inGroup=function(){return!0},n.prototype.addHandle=function(){},n.prototype.removeHandle=function(){},this.drop=new n(t),this.drag=new n(e),this.target=this.drop},global_keyboard_drop:function(t){var n=M.core.dragdrop.keydragcontainer,r=e.one("#"+t.target -.getAttribute("data-drop-target"));M.core.dragdrop.dropui.hide(),t.preventDefault();var i=new this.simulated_drag_drop_event(n,n),s=new this.simulated_drag_drop_event(n,r);this.drag_start(i),this.global_drop_over(s),r.hasClass(this.parentnodeclass)&&r.contains(n)&&r.prepend(n),this.global_drop_hit(s)},global_cancel_keyboard_drag:function(){M.core.dragdrop.keydragcontainer&&(M.core.dragdrop.keydraghandle.focus(),M.core.dragdrop.keydragcontainer=null),M.core.dragdrop.dropui&&M.core.dragdrop.dropui.destroy()},global_keydown:function(e){var t=e.target.ancestor("."+n.cssclass,!0),r,i;if(t===null)return;if(e.keyCode===27){this.global_cancel_keyboard_drag(),e.preventDefault();return}if(!t.hasClass(n.cssclass))return;if(e.keyCode!==13&&e.keyCode!==32&&e.type!=="click")return;i=t.getAttribute("data-draggroups").split(" ");var s,o,u=!1;for(s=0;s").addClass(r).setAttribute("title",t).setAttribute("tabIndex",0).setAttribute("data-draggroups",this.groups).setAttribute("role","button");return s.addClass(n.cssclass),window.require(["core/templates"],function(t){t.renderPix("i/move_2d","core").then(function(t){var n=e.Node.create(t);n.setStyle("cursor","move"),typeof i!="undefined"&&n.addClass(i),s.appendChild(n)})}.bind(this)),s},lock_drag_handle:function(e,t){e.removeHandle("."+t)},unlock_drag_handle:function(e,t){e.addHandle("."+t),e.get("activeHandle").focus()},ajax_failure:function(e){var t={name:e.status+" "+e.statusText,message:e.responseText};return new M.core.exception(t)},in_group:function(t){var n=!1;return e.each(this.groups,function(e){t._groups[e]&&(n=!0)},this),n},global_drag_start:function(e){var t=e.target;if(!this.in_group(t))return;this.originalstyle=t.get("node").getAttribute("style"),t.get("node").setStyle("opacity",".25"),t.get("dragNode").setStyles({opacity:".75",borderColor:t.get("node").getStyle("borderColor"),backgroundColor:t.get("node").getStyle("backgroundColor")}),t.get("dragNode").empty(),this.drag_start(e)},global_drag_end:function(e){var t=e.target;if(!this.in_group(t))return;t.get("node").setAttribute("style",this.originalstyle),this.drag_end(e)},global_drag_drag:function(e){var t=e.target,n=e.info;if(!this.in_group(t))return;n.start[1]n.xy[1]&&(this.absgoingup=!1),n.delta[1]<0?this.goingup=!0:n.delta[1]>0&&(this.goingup=!1),this.drag_drag(e)},global_drop_over:function(e){if(!e.drop||!e.drop.inGroup(this.groups))return;var t=e.drag.get("node"),n=e.drop.get("node");this.lastdroptarget=e.drop;if(n.hasClass(this.samenodeclass)){var r;this.goingup?r="before":r="after",n.insert(t,r)}else(n.hasClass(this.parentnodeclass)||n.test('[data-droptarget="1"]'))&&!n.contains(t)&&(this.goingup?n.append(t):n.prepend(t));this.drop_over(e)},global_drag_dropmiss:function(e){e.drag=e.target,e.drop=this.lastdroptarget;if(!this.in_group(e.drag))return;if(!e.drop||!e.drop.inGroup(this.groups))return;this.drag_dropmiss(e)},global_drop_hit:function(e){if(!e.drop||!e.drop.inGroup(this.groups))return;this.drop_hit(e)},find_element_text:function(t){var n="";n=t.get("aria-label")||"";if(n.length>0)return n;var r=t.get("aria-labelledby");if(r){var i=e.one("#"+r);if(i&&i.get("text").length>0)return i.get("text")}var s=t.all("h2, h3, h4, h5, span:not(.actions):not(.menu-action-text), p, div.no-overflow, div.dimmed_text");return s.each(function(){n===""&&e.Lang.trim(this.get("text"))!==""&&(n=this.get("text"))}),n!==""?n:M.util.get_string("emptydragdropregion","moodle")},global_start_keyboard_drag:function(t,n,r){M.core.dragdrop.keydragcontainer=r,M.core.dragdrop.keydraghandle=n;var i=this.find_element_text(r),s=M.util.get_string("movecontent","moodle",i),o=e.Node.create("
      ");o.addClass("dragdrop-keyboard-drag");var u,a,f,l=e.all("."+this.samenodeclass+", ."+this.parentnodeclass);l.each(function(t){var n=!1,s=t,l=t.getAttribute("class").split(" ").join(", .");if(t.drop&&t.drop.inGroup(this.groups)&&t.drop.get("node")!==r&&t.next(l)!==r)n=!0;else{var c=t.getAttribute("data-draggroups").split(" "),h,p;for(h=0;h"),a=e.Node.create(""),i=this.find_element_text(s),this.samenodelabel&&t.hasClass(this.samenodeclass)?f=M.util.get_string(this.samenodelabel.identifier,this.samenodelabel.component,i):this.parentnodelabel&&t.hasClass(this.parentnodeclass)?f=M.util.get_string(this.parentnodelabel.identifier,this.parentnodelabel.component,i):f=M.util.get_string("tocontent","moodle",i),a.setContent(f),a.setAttribute("data-drop-target",t.get("id")),a.setAttribute("tabindex","0"),a.on("click",this.global_keyboard_drop,this),a.on("key",this.global_keyboard_drop,"down:enter,32",this),u.append(a),o.append(u))},this),M.core.dragdrop.dropui=new M.core.dialogue({headerContent:s,bodyContent:o,draggable:!0,visible:!0,center:!0,modal:!0}),M.core.dragdrop.dropui.after("visibleChange",function(e){e.prevVal&&!e.newVal&&this.global_cancel_keyboard_drag()},this),o.one("a")&&o.one("a").focus()},simulated_drag_drop_event:function(e,t){var n=function(e){this.node=e};n.prototype.get=function(e){return e==="node"||e==="dragNode"||e==="dropNode"?this.node:e==="activeHandle"?this.node.one(".editing_move"):null},n.prototype.inGroup=function(){return!0},n.prototype.addHandle=function(){},n.prototype.removeHandle=function(){},this.drop=new n(t),this.drag=new n(e),this.target=this.drop},global_keyboard_drop:function(t){var n=M.core.dragdrop.keydragcontainer,r=e.one("#"+t.target.getAttribute("data-drop-target"));M.core +.dragdrop.dropui.hide(),t.preventDefault();var i=new this.simulated_drag_drop_event(n,n),s=new this.simulated_drag_drop_event(n,r);this.drag_start(i),this.global_drop_over(s),r.hasClass(this.parentnodeclass)&&r.contains(n)&&r.prepend(n),this.global_drop_hit(s)},global_cancel_keyboard_drag:function(){M.core.dragdrop.keydragcontainer&&(M.core.dragdrop.keydraghandle.focus(),M.core.dragdrop.keydragcontainer=null),M.core.dragdrop.dropui&&M.core.dragdrop.dropui.destroy()},global_keydown:function(e){var t=e.target.ancestor("."+n.cssclass,!0),r,i;if(t===null)return;if(e.keyCode===27){this.global_cancel_keyboard_drag(),e.preventDefault();return}if(!t.hasClass(n.cssclass))return;if(e.keyCode!==13&&e.keyCode!==32&&e.type!=="click")return;i=t.getAttribute("data-draggroups").split(" ");var s,o,u=!1;for(s=0;sexecute('behat_general::wait_until_the_page_is_ready'); + $this->execute('behat_forms::i_set_the_field_with_xpath_to', array("//textarea[@data-region='send-message-txt']", $this->escape($messagecontent)) ); diff --git a/mod/assign/feedback/editpdf/classes/renderer.php b/mod/assign/feedback/editpdf/classes/renderer.php index 9fdaf1e83d2a3..9b29adf1122ff 100644 --- a/mod/assign/feedback/editpdf/classes/renderer.php +++ b/mod/assign/feedback/editpdf/classes/renderer.php @@ -84,7 +84,7 @@ private function render_toolbar_button($icon, $tool, $accesskey = null, $disable } $iconalt = get_string('toolbarbutton', 'assignfeedback_editpdf', $alttext); - $iconhtml = $this->pix_icon($icon, $iconalt, 'assignfeedback_editpdf'); + $iconhtml = $this->activity_icon($icon, $iconalt, 'assignfeedback_editpdf'); $iconparams = array('data-tool'=>$tool, 'class'=>$tool . 'button'); if ($disabled) { $iconparams['disabled'] = 'true'; @@ -139,14 +139,14 @@ public function render_assignfeedback_editpdf_widget(assignfeedback_editpdf_widg } $iconalt = get_string('navigateprevious', 'assignfeedback_editpdf'); - $iconhtml = $this->pix_icon($nav_prev, $iconalt, 'assignfeedback_editpdf'); + $iconhtml = $this->activity_icon($nav_prev, $iconalt, 'assignfeedback_editpdf'); $navigation1 .= html_writer::tag('button', $iconhtml, array('disabled'=>'true', 'class'=>'navigate-previous-button', 'accesskey' => $this->get_shortcut('navigate-previous-button'))); $navigation1 .= html_writer::tag('select', null, array('disabled'=>'true', 'aria-label' => get_string('gotopage', 'assignfeedback_editpdf'), 'class'=>'navigate-page-select', 'accesskey' => $this->get_shortcut('navigate-page-select'))); $iconalt = get_string('navigatenext', 'assignfeedback_editpdf'); - $iconhtml = $this->pix_icon($nav_next, $iconalt, 'assignfeedback_editpdf'); + $iconhtml = $this->activity_icon($nav_next, $iconalt, 'assignfeedback_editpdf'); $navigation1 .= html_writer::tag('button', $iconhtml, array('disabled'=>'true', 'class'=>'navigate-next-button', 'accesskey' => $this->get_shortcut('navigate-next-button'))); diff --git a/mod/book/tests/behat/edit_navigation_options.feature b/mod/book/tests/behat/edit_navigation_options.feature index 396ba38dcd754..d0207a98b1c4e 100644 --- a/mod/book/tests/behat/edit_navigation_options.feature +++ b/mod/book/tests/behat/edit_navigation_options.feature @@ -45,9 +45,9 @@ Feature: In a book, change the navigation options And I navigate to "Edit settings" in current page administration And I set the field "Style of navigation" to "Images" And I press "Save and display" - And "//a/child::img[contains(@src, 'nav_next')]" "xpath_element" should exist + And "Next:" "icon" should exist And I click on "2. Test chapter 2" "link" in the "Table of contents" "block" - And "//a/child::img[contains(@src, 'nav_prev')]" "xpath_element" should exist + And "Previous:" "icon" should exist When I navigate to "Edit settings" in current page administration And I set the field "Style of navigation" to "Text" And I press "Save and display" diff --git a/mod/glossary/lang/en/glossary.php b/mod/glossary/lang/en/glossary.php index 7134f597e21c3..0eb9bf50f98e6 100644 --- a/mod/glossary/lang/en/glossary.php +++ b/mod/glossary/lang/en/glossary.php @@ -104,6 +104,7 @@ $string['definition'] = 'Definition'; $string['definitions'] = 'Definitions'; $string['deleteentry'] = 'Delete entry'; +$string['deleteentrya'] = 'Delete entry: {$a}'; $string['deletenotenrolled'] = 'Delete entries by users not enrolled'; $string['deletingcomment'] = 'Deleting comment'; $string['deletingnoneemptycategory'] = 'Deleting this category will not delete the entries it contains - they will be marked as uncategorised.'; @@ -137,6 +138,7 @@ $string['editalways_help'] = 'This setting specifies whether entries are always editable or whether students can only edit their entries during a configured editing time (usually 30 minutes).'; $string['editcategories'] = 'Edit categories'; $string['editentry'] = 'Edit entry'; +$string['editentrya'] = 'Edit entry: {$a}'; $string['editingcomment'] = 'Editing comment'; $string['entbypage'] = 'Entries shown per page'; $string['entries'] = 'Entries'; diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index 9558400fb35cf..e3ec1734a002b 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -1223,7 +1223,7 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$h $return = ''; // Differentiate links for each entry. - $altsuffix = ': '.strip_tags(format_text($entry->concept)); + $altsuffix = strip_tags(format_text($entry->concept)); if (!$entry->approved) { $output = true; @@ -1268,11 +1268,11 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$h $output = true; $url = "deleteentry.php?id=$cm->id&mode=delete&entry=$entry->id&prevmode=$mode&hook=".urlencode($hook); $return .= "" . $OUTPUT->pix_icon($icon, get_string('delete'), $iconcomponent) . ''; + "href=\"$url\">" . $OUTPUT->pix_icon($icon, get_string('deleteentrya', 'mod_glossary', $altsuffix), $iconcomponent) . ''; $url = "edit.php?cmid=$cm->id&id=$entry->id&mode=$mode&hook=".urlencode($hook); $return .= "" . - $OUTPUT->pix_icon('t/edit', get_string('edit')) . ''; + $OUTPUT->pix_icon('t/edit', get_string('editentrya', 'mod_glossary', $altsuffix)) . ''; } elseif ( $importedentry ) { $return .= "" . get_string("exportedentry","glossary") . ""; } diff --git a/mod/glossary/tests/behat/entries_always_editable.feature b/mod/glossary/tests/behat/entries_always_editable.feature index 7fce28a949c7a..6568164ce28b4 100644 --- a/mod/glossary/tests/behat/entries_always_editable.feature +++ b/mod/glossary/tests/behat/entries_always_editable.feature @@ -33,9 +33,9 @@ Feature: A teacher can set whether glossary entries are always editable or not When I add a glossary entry with the following data: | Concept | Test concept name | | Definition | Test concept description | - Then "Delete: Test concept name" "link" should exist - And "Edit: Test concept name" "link" should exist + Then "Delete entry: Test concept name" "link" should exist + And "Edit entry: Test concept name" "link" should exist And I wait "65" seconds And I reload the page - Then "Delete: Test concept name" "link" should not exist - And "Edit: Test concept name" "link" should not exist + Then "Delete entry: Test concept name" "link" should not exist + And "Edit entry: Test concept name" "link" should not exist diff --git a/mod/glossary/tests/behat/search_entries.feature b/mod/glossary/tests/behat/search_entries.feature index a9e0939bdd096..b23bce4ce135e 100644 --- a/mod/glossary/tests/behat/search_entries.feature +++ b/mod/glossary/tests/behat/search_entries.feature @@ -68,10 +68,10 @@ Feature: Glossary entries can be searched or browsed by alphabet, category, date Scenario: Browse by date When I follow "Browse by date" And I follow "By creation date" - Then "Delete: Eggplant" "link" should appear before "Delete: Cucumber" "link" + Then "Delete entry: Eggplant" "link" should appear before "Delete entry: Cucumber" "link" And I follow "By last update" And I follow "By last update change to descending" - And "Delete: Cucumber" "link" should appear before "Delete: Eggplant" "link" + And "Delete entry: Cucumber" "link" should appear before "Delete entry: Eggplant" "link" @javascript Scenario: Browse by author diff --git a/mod/quiz/classes/output/edit_renderer.php b/mod/quiz/classes/output/edit_renderer.php index cc4607be664f2..988c58ba55345 100644 --- a/mod/quiz/classes/output/edit_renderer.php +++ b/mod/quiz/classes/output/edit_renderer.php @@ -765,11 +765,11 @@ public function page_split_join_button($structure, $slot) { if ($insertpagebreak) { $title = get_string('addpagebreak', 'quiz'); - $image = $this->pix_icon('e/insert_page_break', $title); + $image = $this->activity_icon('e/insert_page_break', $title); $action = 'addpagebreak'; } else { $title = get_string('removepagebreak', 'quiz'); - $image = $this->pix_icon('e/remove_page_break', $title); + $image = $this->activity_icon('e/remove_page_break', $title); $action = 'removepagebreak'; } @@ -965,7 +965,7 @@ public function question_chooser() { * @return string HTML to output. */ public function question_bank_loading() { - return $this->pix_icon('i/loading', get_string('loading')); + return html_writer::div($this->pix_icon('i/loading', get_string('loading')), 'questionbankloading'); } /** diff --git a/mod/quiz/tests/behat/completion_condition_attempts_used.feature b/mod/quiz/tests/behat/completion_condition_attempts_used.feature index c3644001ca3fc..cd7a5b20a986d 100644 --- a/mod/quiz/tests/behat/completion_condition_attempts_used.feature +++ b/mod/quiz/tests/behat/completion_condition_attempts_used.feature @@ -48,9 +48,9 @@ Feature: Set a quiz to be marked complete when the student uses all attempts all And I press "Finish attempt ..." And I press "Submit all and finish" And I follow "C1" - Then "//img[contains(@alt, 'Completed: Test quiz name')]" "xpath_element" should exist in the "li.modtype_quiz" "css_element" + Then "Completed: Test quiz name" "icon" should exist in the "li.modtype_quiz" "css_element" And I log out And I log in as "teacher1" And I follow "Course 1" And I navigate to "Activity completion" node in "Course administration > Reports" - And "//img[contains(@title,'Test quiz name') and @alt='Completed']" "xpath_element" should exist in the "Student 1" "table_row" + And "Completed" "icon" should exist in the "Student 1" "table_row" diff --git a/mod/quiz/tests/behat/completion_condition_passing_grade.feature b/mod/quiz/tests/behat/completion_condition_passing_grade.feature index b47457e2faf37..5eb5d6fab3f9b 100644 --- a/mod/quiz/tests/behat/completion_condition_passing_grade.feature +++ b/mod/quiz/tests/behat/completion_condition_passing_grade.feature @@ -41,9 +41,9 @@ Feature: Set a quiz to be marked complete when the student passes And I press "Finish attempt ..." And I press "Submit all and finish" And I follow "C1" - Then "//img[contains(@alt, 'Completed: Test quiz name')]" "xpath_element" should exist in the "li.modtype_quiz" "css_element" + Then "Completed: Test quiz name" "icon" should exist in the "li.modtype_quiz" "css_element" And I log out And I log in as "teacher1" And I follow "Course 1" And I navigate to "Activity completion" node in "Course administration > Reports" - And "//img[contains(@title,'Test quiz name') and @alt='Completed']" "xpath_element" should exist in the "Student 1" "table_row" + And "Completed" "icon" should exist in the "Student 1" "table_row" diff --git a/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-debug.js b/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-debug.js index d0d3c5f214f49..69bf3145fa372 100644 --- a/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-debug.js +++ b/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-debug.js @@ -396,7 +396,7 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, { // Get our drag object var drag = e.target; drag.get('dragNode').setContent(drag.get('node').get('innerHTML')); - drag.get('dragNode').all('img.iconsmall').setStyle('vertical-align', 'baseline'); + drag.get('dragNode').all('.icon').setStyle('vertical-align', 'baseline'); }, drag_dropmiss: function(e) { diff --git a/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-min.js b/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-min.js index 0640ba0a9a8b1..d7e49f0396fe1 100644 --- a/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-min.js +++ b/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-min.js @@ -1,2 +1,2 @@ -YUI.add("moodle-mod_quiz-dragdrop",function(e,t){var n={ACTIONAREA:".actions",ACTIVITY:"activity",ACTIVITYINSTANCE:"activityinstance",CONTENT:"content",COURSECONTENT:"mod-quiz-edit-content",EDITINGMOVE:"editing_move",ICONCLASS:"iconsmall",JUMPMENU:"jumpmenu",LEFT:"left",LIGHTBOX:"lightbox",MOVEDOWN:"movedown",MOVEUP:"moveup",PAGE:"page",PAGECONTENT:"page-content",RIGHT:"right",SECTION:"slots",SECTIONADDMENUS:"section_add_menus",SECTIONHANDLE:"section-handle",SLOTS:"slots",SUMMARY:"summary",SECTIONDRAGGABLE:"sectiondraggable"},r={PAGE:"li.page",SLOT:"li.slot"},i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,M.core.dragdrop,{sectionlistselector:null,initializer:function(){this.groups=[n.SECTIONDRAGGABLE],this.samenodeclass="section",this.parentnodeclass="slots";if(e.Node.one("."+n.JUMPMENU))return!1;this.sectionlistselector="li.section";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.remove(),i&&i.remove(),t.addClass(n.SECTIONDRAGGABLE))}},this)},drag_start:function(t){var r=t.target,i=e.Node.create('
        '),s=e.Node.create('
          ');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+" li.section",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.quizid=this.get("quizid"),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.mod_quiz.edit.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.mod_quiz.edit.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:"mod_quiz-dragdrop-section",ATTRS:{courseid:{value:null},quizid:{value:null},ajaxurl:{value:0},config:{value:0}}}),M.mod_quiz=M.mod_quiz||{},M.mod_quiz.init_section_dragdrop=function(e){new i(e)};var s=function(){s.superclass.constructor.apply(this,arguments)};e.extend(s,M.core.dragdrop,{initializer:function(){this.groups=["resource"],this.samenodeclass=n.ACTIVITY,this.parentnodeclass=n.SECTION,this.samenodelabel={identifier:"dragtoafter",component:"quiz"},this.parentnodelabel={identifier:"dragtostart",component:"quiz"},this.setup_for_section();var t="li."+n.ACTIVITY,r=new e.DD.Delegate({container:"."+n.COURSECONTENT,nodes:t,target:!0,handles:["."+n.EDITINGMOVE],dragConfig:{groups:this.groups}});r.dd.plug(e.Plugin.DDProxy,{moveOnEnd:!1,cloneNode:!0}),r.dd.plug(e.Plugin.DDConstrained,{constrain:"#"+n.SLOTS}),r.dd.plug(e.Plugin.DDWinScroll),M.mod_quiz.quizbase.register_module(this),M.mod_quiz.dragres=this},setup_for_section:function(){e.Node.all(".mod-quiz-edit-content ul.slots ul.section").each(function(t){t.setAttribute("data-draggroups",this.groups.join(" ")),new e.DD.Drop({node:t,groups:this.groups,padding:"20 0 20 0"}),this.setup_for_resource("li.activity")},this)},setup_for_resource:function(t){e.Node.all(t).each(function(e){var t=e.one("a."+n.EDITINGMOVE);if(t){var r=this.get_drag_handle(M.util.get_string("move","moodle"),n.EDITINGMOVE,n.ICONCLASS,!0);t.replace(r)}},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 i=t.drag,s=i.get("node"),o=t.drop.get("node"),u=s.one(n.ACTIONAREA),a=M.util.add_spinner(e,u),f={},l=this.get("config").pageparams,c;for(c in l)f[c]=l[c];f.sesskey=M.cfg.sesskey,f.courseid=this.get("courseid"),f.quizid=this.get("quizid"),f["class"]="resource",f.field="move",f.id=Number(e.Moodle.mod_quiz.util.slot.getId(s)),f.sectionId=e.Moodle.core_course.util.section.getId(o.ancestor("li.section",!0));var h=s.previous(r.SLOT);h&&(f.previousid=Number(e.Moodle.mod_quiz.util.slot.getId(h)));var p=s.previous(r.PAGE);p&&(f.page=Number(e.Moodle.mod_quiz.util.page.getId(p)));var d=M.cfg.wwwroot+this.get("ajaxurl");e.io(d,{method:"POST",data:f,on:{start:function(){this.lock_drag_handle(i,n.EDITINGMOVE),a.show()},success:function(t,r){var o=e.JSON.parse(r.responseText),u={element:s,visible:o.visible};M.mod_quiz.quizbase.invoke_function("set_visibility_resource_ui",u),this.unlock_drag_handle(i,n.EDITINGMOVE),window.setTimeout(function(){a. -hide()},250),M.mod_quiz.resource_toolbox.reorganise_edit_page()},failure:function(e,t){this.ajax_failure(t),this.unlock_drag_handle(i,n.SECTIONHANDLE),a.hide(),window.location.reload(!0)}},context:this})},global_drop_over:function(e){if(!e.drop||!e.drop.inGroup(this.groups))return;var t=e.drag.get("node"),n=e.drop.get("node");this.lastdroptarget=e.drop;if(n.hasClass(this.samenodeclass)){var r;this.goingup?r="before":r="after",n.insert(t,r)}else(n.hasClass(this.parentnodeclass)||n.test('[data-droptarget="1"]'))&&!n.contains(t)&&(this.goingup?n.append(t):n.prepend(t));this.drop_over(e)}},{NAME:"mod_quiz-dragdrop-resource",ATTRS:{courseid:{value:null},quizid:{value:null},ajaxurl:{value:0},config:{value:0}}}),M.mod_quiz=M.mod_quiz||{},M.mod_quiz.init_resource_dragdrop=function(e){new s(e)}},"@VERSION@",{requires:["base","node","io","dom","dd","dd-scroll","moodle-core-dragdrop","moodle-core-notification","moodle-mod_quiz-quizbase","moodle-mod_quiz-util-base","moodle-mod_quiz-util-page","moodle-mod_quiz-util-slot","moodle-course-util"]}); +YUI.add("moodle-mod_quiz-dragdrop",function(e,t){var n={ACTIONAREA:".actions",ACTIVITY:"activity",ACTIVITYINSTANCE:"activityinstance",CONTENT:"content",COURSECONTENT:"mod-quiz-edit-content",EDITINGMOVE:"editing_move",ICONCLASS:"iconsmall",JUMPMENU:"jumpmenu",LEFT:"left",LIGHTBOX:"lightbox",MOVEDOWN:"movedown",MOVEUP:"moveup",PAGE:"page",PAGECONTENT:"page-content",RIGHT:"right",SECTION:"slots",SECTIONADDMENUS:"section_add_menus",SECTIONHANDLE:"section-handle",SLOTS:"slots",SUMMARY:"summary",SECTIONDRAGGABLE:"sectiondraggable"},r={PAGE:"li.page",SLOT:"li.slot"},i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,M.core.dragdrop,{sectionlistselector:null,initializer:function(){this.groups=[n.SECTIONDRAGGABLE],this.samenodeclass="section",this.parentnodeclass="slots";if(e.Node.one("."+n.JUMPMENU))return!1;this.sectionlistselector="li.section";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.remove(),i&&i.remove(),t.addClass(n.SECTIONDRAGGABLE))}},this)},drag_start:function(t){var r=t.target,i=e.Node.create('
            '),s=e.Node.create('
              ');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+" li.section",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.quizid=this.get("quizid"),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.mod_quiz.edit.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.mod_quiz.edit.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:"mod_quiz-dragdrop-section",ATTRS:{courseid:{value:null},quizid:{value:null},ajaxurl:{value:0},config:{value:0}}}),M.mod_quiz=M.mod_quiz||{},M.mod_quiz.init_section_dragdrop=function(e){new i(e)};var s=function(){s.superclass.constructor.apply(this,arguments)};e.extend(s,M.core.dragdrop,{initializer:function(){this.groups=["resource"],this.samenodeclass=n.ACTIVITY,this.parentnodeclass=n.SECTION,this.samenodelabel={identifier:"dragtoafter",component:"quiz"},this.parentnodelabel={identifier:"dragtostart",component:"quiz"},this.setup_for_section();var t="li."+n.ACTIVITY,r=new e.DD.Delegate({container:"."+n.COURSECONTENT,nodes:t,target:!0,handles:["."+n.EDITINGMOVE],dragConfig:{groups:this.groups}});r.dd.plug(e.Plugin.DDProxy,{moveOnEnd:!1,cloneNode:!0}),r.dd.plug(e.Plugin.DDConstrained,{constrain:"#"+n.SLOTS}),r.dd.plug(e.Plugin.DDWinScroll),M.mod_quiz.quizbase.register_module(this),M.mod_quiz.dragres=this},setup_for_section:function(){e.Node.all(".mod-quiz-edit-content ul.slots ul.section").each(function(t){t.setAttribute("data-draggroups",this.groups.join(" ")),new e.DD.Drop({node:t,groups:this.groups,padding:"20 0 20 0"}),this.setup_for_resource("li.activity")},this)},setup_for_resource:function(t){e.Node.all(t).each(function(e){var t=e.one("a."+n.EDITINGMOVE);if(t){var r=this.get_drag_handle(M.util.get_string("move","moodle"),n.EDITINGMOVE,n.ICONCLASS,!0);t.replace(r)}},this)},drag_start:function(e){var t=e.target;t.get("dragNode").setContent(t.get("node").get("innerHTML")),t.get("dragNode").all(".icon").setStyle("vertical-align","baseline")},drag_dropmiss:function(e){this.drop_hit(e)},drop_hit:function(t){var i=t.drag,s=i.get("node"),o=t.drop.get("node"),u=s.one(n.ACTIONAREA),a=M.util.add_spinner(e,u),f={},l=this.get("config").pageparams,c;for(c in l)f[c]=l[c];f.sesskey=M.cfg.sesskey,f.courseid=this.get("courseid"),f.quizid=this.get("quizid"),f["class"]="resource",f.field="move",f.id=Number(e.Moodle.mod_quiz.util.slot.getId(s)),f.sectionId=e.Moodle.core_course.util.section.getId(o.ancestor("li.section",!0));var h=s.previous(r.SLOT);h&&(f.previousid=Number(e.Moodle.mod_quiz.util.slot.getId(h)));var p=s.previous(r.PAGE);p&&(f.page=Number(e.Moodle.mod_quiz.util.page.getId(p)));var d=M.cfg.wwwroot+this.get("ajaxurl");e.io(d,{method:"POST",data:f,on:{start:function(){this.lock_drag_handle(i,n.EDITINGMOVE),a.show()},success:function(t,r){var o=e.JSON.parse(r.responseText),u={element:s,visible:o.visible};M.mod_quiz.quizbase.invoke_function("set_visibility_resource_ui",u),this.unlock_drag_handle(i,n.EDITINGMOVE),window.setTimeout(function(){a.hide()},250 +),M.mod_quiz.resource_toolbox.reorganise_edit_page()},failure:function(e,t){this.ajax_failure(t),this.unlock_drag_handle(i,n.SECTIONHANDLE),a.hide(),window.location.reload(!0)}},context:this})},global_drop_over:function(e){if(!e.drop||!e.drop.inGroup(this.groups))return;var t=e.drag.get("node"),n=e.drop.get("node");this.lastdroptarget=e.drop;if(n.hasClass(this.samenodeclass)){var r;this.goingup?r="before":r="after",n.insert(t,r)}else(n.hasClass(this.parentnodeclass)||n.test('[data-droptarget="1"]'))&&!n.contains(t)&&(this.goingup?n.append(t):n.prepend(t));this.drop_over(e)}},{NAME:"mod_quiz-dragdrop-resource",ATTRS:{courseid:{value:null},quizid:{value:null},ajaxurl:{value:0},config:{value:0}}}),M.mod_quiz=M.mod_quiz||{},M.mod_quiz.init_resource_dragdrop=function(e){new s(e)}},"@VERSION@",{requires:["base","node","io","dom","dd","dd-scroll","moodle-core-dragdrop","moodle-core-notification","moodle-mod_quiz-quizbase","moodle-mod_quiz-util-base","moodle-mod_quiz-util-page","moodle-mod_quiz-util-slot","moodle-course-util"]}); diff --git a/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop.js b/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop.js index abba2623c0a40..4c81466571c4e 100644 --- a/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop.js +++ b/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop.js @@ -390,7 +390,7 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, { // Get our drag object var drag = e.target; drag.get('dragNode').setContent(drag.get('node').get('innerHTML')); - drag.get('dragNode').all('img.iconsmall').setStyle('vertical-align', 'baseline'); + drag.get('dragNode').all('.icon').setStyle('vertical-align', 'baseline'); }, drag_dropmiss: function(e) { diff --git a/mod/quiz/yui/build/moodle-mod_quiz-quizbase/moodle-mod_quiz-quizbase-debug.js b/mod/quiz/yui/build/moodle-mod_quiz-quizbase/moodle-mod_quiz-quizbase-debug.js index 7b06189972626..fa05c333ad97d 100644 --- a/mod/quiz/yui/build/moodle-mod_quiz-quizbase/moodle-mod_quiz-quizbase-debug.js +++ b/mod/quiz/yui/build/moodle-mod_quiz-quizbase/moodle-mod_quiz-quizbase-debug.js @@ -101,7 +101,7 @@ M.mod_quiz.edit.process_sections = function(Y, sectionlist, response, sectionfro SECTIONNAME: 'sectionname' }, SELECTORS = { - SECTIONLEFTSIDE: '.left .section-handle img' + SECTIONLEFTSIDE: '.left .section-handle .icon' }; if (response.action === 'move') { diff --git a/mod/quiz/yui/build/moodle-mod_quiz-quizbase/moodle-mod_quiz-quizbase-min.js b/mod/quiz/yui/build/moodle-mod_quiz-quizbase/moodle-mod_quiz-quizbase-min.js index ffdd5dec4680e..7c786e02add9e 100644 --- a/mod/quiz/yui/build/moodle-mod_quiz-quizbase/moodle-mod_quiz-quizbase-min.js +++ b/mod/quiz/yui/build/moodle-mod_quiz-quizbase/moodle-mod_quiz-quizbase-min.js @@ -1 +1 @@ -YUI.add("moodle-mod_quiz-quizbase",function(e,t){var n="mod_quiz-quizbase",r=function(){r.superclass.constructor.apply(this,arguments)};e.extend(r,e.Base,{registermodules:[],register_module:function(e){return this.registermodules.push(e),this},invoke_function:function(e,t){var n;for(n in this.registermodules)e in this.registermodules[n]&&this.registermodules[n][e](t);return this}},{NAME:n,ATTRS:{}}),M.mod_quiz=M.mod_quiz||{},M.mod_quiz.quizbase=M.mod_quiz.quizbase||new r,M.mod_quiz.edit=M.mod_quiz.edit||{},M.mod_quiz.edit.swap_sections=function(e,t,n){var r={COURSECONTENT:"mod-quiz-edit-content",SECTIONADDMENUS:"section_add_menus"},i=e.Node.all("."+r.COURSECONTENT+" li.section");i.item(t).one("."+r.SECTIONADDMENUS).swap(i.item(n).one("."+r.SECTIONADDMENUS))},M.mod_quiz.edit.process_sections=function(e,t,n,r,i){var s={SECTIONNAME:"sectionname"},o={SECTIONLEFTSIDE:".left .section-handle img"};if(n.action==="move"){if(r>i){var u=i;i=r,r=u}var a,f,l,c;for(var h=r;h<=i;h++)t.item(h).one("."+s.SECTIONNAME).setContent(n.sectiontitles[h]),a=t.item(h).one(o.SECTIONLEFTSIDE),f=a.getAttribute("alt"),l=f.lastIndexOf(" "),c=f.substr(0,l+1)+h,a.setAttribute("alt",c),a.setAttribute("title",c),t.item(h).removeClass("current");n.current!==-1&&t.item(n.current).addClass("current")}}},"@VERSION@",{requires:["base","node"]}); +YUI.add("moodle-mod_quiz-quizbase",function(e,t){var n="mod_quiz-quizbase",r=function(){r.superclass.constructor.apply(this,arguments)};e.extend(r,e.Base,{registermodules:[],register_module:function(e){return this.registermodules.push(e),this},invoke_function:function(e,t){var n;for(n in this.registermodules)e in this.registermodules[n]&&this.registermodules[n][e](t);return this}},{NAME:n,ATTRS:{}}),M.mod_quiz=M.mod_quiz||{},M.mod_quiz.quizbase=M.mod_quiz.quizbase||new r,M.mod_quiz.edit=M.mod_quiz.edit||{},M.mod_quiz.edit.swap_sections=function(e,t,n){var r={COURSECONTENT:"mod-quiz-edit-content",SECTIONADDMENUS:"section_add_menus"},i=e.Node.all("."+r.COURSECONTENT+" li.section");i.item(t).one("."+r.SECTIONADDMENUS).swap(i.item(n).one("."+r.SECTIONADDMENUS))},M.mod_quiz.edit.process_sections=function(e,t,n,r,i){var s={SECTIONNAME:"sectionname"},o={SECTIONLEFTSIDE:".left .section-handle .icon"};if(n.action==="move"){if(r>i){var u=i;i=r,r=u}var a,f,l,c;for(var h=r;h<=i;h++)t.item(h).one("."+s.SECTIONNAME).setContent(n.sectiontitles[h]),a=t.item(h).one(o.SECTIONLEFTSIDE),f=a.getAttribute("alt"),l=f.lastIndexOf(" "),c=f.substr(0,l+1)+h,a.setAttribute("alt",c),a.setAttribute("title",c),t.item(h).removeClass("current");n.current!==-1&&t.item(n.current).addClass("current")}}},"@VERSION@",{requires:["base","node"]}); diff --git a/mod/quiz/yui/build/moodle-mod_quiz-quizbase/moodle-mod_quiz-quizbase.js b/mod/quiz/yui/build/moodle-mod_quiz-quizbase/moodle-mod_quiz-quizbase.js index 7b06189972626..fa05c333ad97d 100644 --- a/mod/quiz/yui/build/moodle-mod_quiz-quizbase/moodle-mod_quiz-quizbase.js +++ b/mod/quiz/yui/build/moodle-mod_quiz-quizbase/moodle-mod_quiz-quizbase.js @@ -101,7 +101,7 @@ M.mod_quiz.edit.process_sections = function(Y, sectionlist, response, sectionfro SECTIONNAME: 'sectionname' }, SELECTORS = { - SECTIONLEFTSIDE: '.left .section-handle img' + SECTIONLEFTSIDE: '.left .section-handle .icon' }; if (response.action === 'move') { diff --git a/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-debug.js b/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-debug.js index 1c701f95a668e..dbfae9bf4cb7f 100644 --- a/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-debug.js +++ b/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-debug.js @@ -45,10 +45,10 @@ var CSS = { COMMANDSPAN: '.commands', CONTENTAFTERLINK: 'div.contentafterlink', CONTENTWITHOUTLINK: 'div.contentwithoutlink', - DELETESECTIONICON: 'a.editing_delete img', + DELETESECTIONICON: 'a.editing_delete .icon', EDITMAXMARK: 'a.editing_maxmark', EDITSECTION: 'a.editing_section', - EDITSECTIONICON: 'a.editing_section img', + EDITSECTIONICON: 'a.editing_section .icon', EDITSHUFFLEQUESTIONSACTION: 'input.cm-edit-action[data-action]', EDITSHUFFLEAREA: '.instanceshufflequestions .shuffle-progress', HIDE: 'a.editing_hide', diff --git a/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-min.js b/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-min.js index 859fa0a332d6f..58bd27ce9bf9b 100644 --- a/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-min.js +++ b/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-min.js @@ -1,3 +1,3 @@ -YUI.add("moodle-mod_quiz-toolboxes",function(e,t){var n={ACTIVITYINSTANCE:"activityinstance",AVAILABILITYINFODIV:"div.availabilityinfo",CONTENTWITHOUTLINK:"contentwithoutlink",CONDITIONALHIDDEN:"conditionalhidden",DIMCLASS:"dimmed",DIMMEDTEXT:"dimmed_text",EDITINSTRUCTIONS:"editinstructions",EDITINGMAXMARK:"editor_displayed",HIDE:"hide",JOIN:"page_join",MODINDENTCOUNT:"mod-indent-",MODINDENTHUGE:"mod-indent-huge",PAGE:"page",SECTIONHIDDENCLASS:"hidden",SECTIONIDPREFIX:"section-",SLOT:"slot",SHOW:"editing_show",TITLEEDITOR:"titleeditor"},r={ACTIONAREA:".actions",ACTIONLINKTEXT:".actionlinktext",ACTIVITYACTION:"a.cm-edit-action[data-action], a.editing_maxmark, a.editing_section, input.shuffle_questions",ACTIVITYFORM:"span.instancemaxmarkcontainer form",ACTIVITYINSTANCE:"."+n.ACTIVITYINSTANCE,SECTIONINSTANCE:".sectioninstance",ACTIVITYLI:"li.activity, li.section",ACTIVITYMAXMARK:"input[name=maxmark]",COMMANDSPAN:".commands",CONTENTAFTERLINK:"div.contentafterlink",CONTENTWITHOUTLINK:"div.contentwithoutlink",DELETESECTIONICON:"a.editing_delete img",EDITMAXMARK:"a.editing_maxmark",EDITSECTION:"a.editing_section",EDITSECTIONICON:"a.editing_section img",EDITSHUFFLEQUESTIONSACTION:"input.cm-edit-action[data-action]",EDITSHUFFLEAREA:".instanceshufflequestions .shuffle-progress",HIDE:"a.editing_hide",HIGHLIGHT:"a.editing_highlight",INSTANCENAME:"span.instancename",INSTANCEMAXMARK:"span.instancemaxmark",INSTANCESECTION:"span.instancesection",INSTANCESECTIONAREA:"div.section-heading",MODINDENTDIV:".mod-indent",MODINDENTOUTER:".mod-indent-outer",NUMQUESTIONS:".numberofquestions",PAGECONTENT:"div#page-content",PAGELI:"li.page",SECTIONUL:"ul.section",SECTIONFORM:".instancesectioncontainer form",SECTIONINPUT:"input[name=section]",SHOW:"a."+n.SHOW,SLOTLI:"li.slot",SUMMARKS:".mod_quiz_summarks"},i=e.one(document.body);M.mod_quiz=M.mod_quiz||{};var s=function(){s.superclass.constructor.apply(this,arguments)};e.extend(s,e.Base,{send_request:function(t,n,i,s){t||(t={});var o=this.get("config").pageparams,u;for(u in o)t[u]=o[u];t.sesskey=M.cfg.sesskey,t.courseid=this.get("courseid"),t.quizid=this.get("quizid");var a=M.cfg.wwwroot+this.get("ajaxurl"),f=[],l={method:"POST",data:t,on:{success:function(t,s){try{f=e.JSON.parse(s.responseText),f.error&&new M.core.ajaxException(f)}catch(o){}f.hasOwnProperty("newsummarks")&&e.one(r.SUMMARKS).setHTML(f.newsummarks),f.hasOwnProperty("newnumquestions")&&e.one(r.NUMQUESTIONS).setHTML(M.util.get_string("numquestionsx","quiz",f.newnumquestions)),i&&e.bind(i,this,f)(),n&&window.setTimeout(function(){n.hide()},400)},failure:function(e,t){n&&n.hide(),new M.core.ajaxException(t)}},context:this};if(s)for(u in s)l[u]=s[u];return n&&n.show(),e.io(a,l),this}},{NAME:"mod_quiz-toolbox",ATTRS:{courseid:{value:0},quizid:{value:0},ajaxurl:{value:null},config:{value:{}}}});var o=function(){o.superclass.constructor.apply(this,arguments)};e.extend(o,s,{editmaxmarkevents:[],NODE_PAGE:1,NODE_SLOT:2,NODE_JOIN:3,initializer:function(){M.mod_quiz.quizbase.register_module(this),e.delegate("click",this.handle_data_action,i,r.ACTIVITYACTION,this),e.delegate("click",this.handle_data_action,i,r.DEPENDENCY_LINK,this)},handle_data_action:function(e){var t=e.target;t.test("a")||(t=t.ancestor(r.ACTIVITYACTION));var n=t.getData("action"),i=t.ancestor(r.ACTIVITYLI);if(!t.test("a")||!n||!i)return;switch(n){case"editmaxmark":this.edit_maxmark(e,t,i,n);break;case"delete":this.delete_with_confirmation(e,t,i,n);break;case"addpagebreak":case"removepagebreak":this.update_page_break(e,t,i,n);break;case"adddependency":case"removedependency":this.update_dependency(e,t,i,n);break;default:}},add_spinner:function(t){var n=t.one(r.ACTIONAREA);return n?M.util.add_spinner(e,n):null},delete_with_confirmation:function(t,n,r){t.preventDefault();var i=r,s="",o=M.util.get_string("pluginname","qtype_"+i.getAttribute("class").match(/qtype_([^\s]*)/)[1]);s=M.util.get_string("confirmremovequestion","quiz",o);var u=new M.core.confirm({question:s,modal:!0});return u.on("complete-yes",function(){var n=this.add_spinner(i),r={"class":"resource",action:"DELETE",id:e.Moodle.mod_quiz.util.slot.getId(i)};this.send_request(r,n,function(n){n.deleted&&(e.Moodle.mod_quiz.util.slot.remove(i),this.reorganise_edit_page(),M.core.actionmenu&&M.core.actionmenu.instance&&M.core.actionmenu.instance.hideMenu(t))})},this),this},edit_maxmark:function(t,i,s){var o=s.one(r.INSTANCEMAXMARK),u=s.one(r.ACTIVITYINSTANCE),a=o.get("firstChild"),f=a.get("data"),l=f,c,h=o,p={"class":"resource",field:"getmaxmark",id:e.Moodle.mod_quiz.util.slot.getId(s)};t.preventDefault(),this.send_request(p,null,function(r){M.core.actionmenu&&M.core.actionmenu.instance&&M.core.actionmenu.instance.hideMenu(t),r.instancemaxmark&&(l=r.instancemaxmark);var i=e.Node.create('
              '),o=e.Node.create('').set("innerHTML",M.util.get_string("edittitleinstructions","moodle")),a=e.Node.create('').setAttrs({value:l,autocomplete:"off","aria-describedby":"id_editinstructions",maxLength:"12",size:parseInt(this.get("config").questiondecimalpoints,10)+2});i.appendChild(a),i.setData("anchor",h),u.insert(o,"before"),h.replace(i),s.addClass(n.EDITINGMAXMARK),a.focus().select(),c=a.on("blur",this.edit_maxmark_cancel,this,s,!1),this.editmaxmarkevents.push(c),c=a.on("key",this.edit_maxmark_cancel,"esc",this,s,!0),this.editmaxmarkevents.push(c),c=i.on("submit",this.edit_maxmark_submit,this,s,f),this.editmaxmarkevents.push(c)})},edit_maxmark_submit:function(t,n,i){t.preventDefault();var s=e.Lang.trim(n.one(r.ACTIVITYFORM+" "+r.ACTIVITYMAXMARK).get("value")),o=this.add_spinner(n);this.edit_maxmark_clear(n),n.one(r.INSTANCEMAXMARK).setContent(s);if(s!==null&&s!==""&&s!==i){var u={"class":"resource",field:"updatemaxmark",maxmark:s,id:e.Moodle.mod_quiz.util.slot.getId(n)};this.send_request(u,o,function(e){e.instancemaxmark&&n.one(r.INSTANCEMAXMARK).setContent(e.instancemaxmark +YUI.add("moodle-mod_quiz-toolboxes",function(e,t){var n={ACTIVITYINSTANCE:"activityinstance",AVAILABILITYINFODIV:"div.availabilityinfo",CONTENTWITHOUTLINK:"contentwithoutlink",CONDITIONALHIDDEN:"conditionalhidden",DIMCLASS:"dimmed",DIMMEDTEXT:"dimmed_text",EDITINSTRUCTIONS:"editinstructions",EDITINGMAXMARK:"editor_displayed",HIDE:"hide",JOIN:"page_join",MODINDENTCOUNT:"mod-indent-",MODINDENTHUGE:"mod-indent-huge",PAGE:"page",SECTIONHIDDENCLASS:"hidden",SECTIONIDPREFIX:"section-",SLOT:"slot",SHOW:"editing_show",TITLEEDITOR:"titleeditor"},r={ACTIONAREA:".actions",ACTIONLINKTEXT:".actionlinktext",ACTIVITYACTION:"a.cm-edit-action[data-action], a.editing_maxmark, a.editing_section, input.shuffle_questions",ACTIVITYFORM:"span.instancemaxmarkcontainer form",ACTIVITYINSTANCE:"."+n.ACTIVITYINSTANCE,SECTIONINSTANCE:".sectioninstance",ACTIVITYLI:"li.activity, li.section",ACTIVITYMAXMARK:"input[name=maxmark]",COMMANDSPAN:".commands",CONTENTAFTERLINK:"div.contentafterlink",CONTENTWITHOUTLINK:"div.contentwithoutlink",DELETESECTIONICON:"a.editing_delete .icon",EDITMAXMARK:"a.editing_maxmark",EDITSECTION:"a.editing_section",EDITSECTIONICON:"a.editing_section .icon",EDITSHUFFLEQUESTIONSACTION:"input.cm-edit-action[data-action]",EDITSHUFFLEAREA:".instanceshufflequestions .shuffle-progress",HIDE:"a.editing_hide",HIGHLIGHT:"a.editing_highlight",INSTANCENAME:"span.instancename",INSTANCEMAXMARK:"span.instancemaxmark",INSTANCESECTION:"span.instancesection",INSTANCESECTIONAREA:"div.section-heading",MODINDENTDIV:".mod-indent",MODINDENTOUTER:".mod-indent-outer",NUMQUESTIONS:".numberofquestions",PAGECONTENT:"div#page-content",PAGELI:"li.page",SECTIONUL:"ul.section",SECTIONFORM:".instancesectioncontainer form",SECTIONINPUT:"input[name=section]",SHOW:"a."+n.SHOW,SLOTLI:"li.slot",SUMMARKS:".mod_quiz_summarks"},i=e.one(document.body);M.mod_quiz=M.mod_quiz||{};var s=function(){s.superclass.constructor.apply(this,arguments)};e.extend(s,e.Base,{send_request:function(t,n,i,s){t||(t={});var o=this.get("config").pageparams,u;for(u in o)t[u]=o[u];t.sesskey=M.cfg.sesskey,t.courseid=this.get("courseid"),t.quizid=this.get("quizid");var a=M.cfg.wwwroot+this.get("ajaxurl"),f=[],l={method:"POST",data:t,on:{success:function(t,s){try{f=e.JSON.parse(s.responseText),f.error&&new M.core.ajaxException(f)}catch(o){}f.hasOwnProperty("newsummarks")&&e.one(r.SUMMARKS).setHTML(f.newsummarks),f.hasOwnProperty("newnumquestions")&&e.one(r.NUMQUESTIONS).setHTML(M.util.get_string("numquestionsx","quiz",f.newnumquestions)),i&&e.bind(i,this,f)(),n&&window.setTimeout(function(){n.hide()},400)},failure:function(e,t){n&&n.hide(),new M.core.ajaxException(t)}},context:this};if(s)for(u in s)l[u]=s[u];return n&&n.show(),e.io(a,l),this}},{NAME:"mod_quiz-toolbox",ATTRS:{courseid:{value:0},quizid:{value:0},ajaxurl:{value:null},config:{value:{}}}});var o=function(){o.superclass.constructor.apply(this,arguments)};e.extend(o,s,{editmaxmarkevents:[],NODE_PAGE:1,NODE_SLOT:2,NODE_JOIN:3,initializer:function(){M.mod_quiz.quizbase.register_module(this),e.delegate("click",this.handle_data_action,i,r.ACTIVITYACTION,this),e.delegate("click",this.handle_data_action,i,r.DEPENDENCY_LINK,this)},handle_data_action:function(e){var t=e.target;t.test("a")||(t=t.ancestor(r.ACTIVITYACTION));var n=t.getData("action"),i=t.ancestor(r.ACTIVITYLI);if(!t.test("a")||!n||!i)return;switch(n){case"editmaxmark":this.edit_maxmark(e,t,i,n);break;case"delete":this.delete_with_confirmation(e,t,i,n);break;case"addpagebreak":case"removepagebreak":this.update_page_break(e,t,i,n);break;case"adddependency":case"removedependency":this.update_dependency(e,t,i,n);break;default:}},add_spinner:function(t){var n=t.one(r.ACTIONAREA);return n?M.util.add_spinner(e,n):null},delete_with_confirmation:function(t,n,r){t.preventDefault();var i=r,s="",o=M.util.get_string("pluginname","qtype_"+i.getAttribute("class").match(/qtype_([^\s]*)/)[1]);s=M.util.get_string("confirmremovequestion","quiz",o);var u=new M.core.confirm({question:s,modal:!0});return u.on("complete-yes",function(){var n=this.add_spinner(i),r={"class":"resource",action:"DELETE",id:e.Moodle.mod_quiz.util.slot.getId(i)};this.send_request(r,n,function(n){n.deleted&&(e.Moodle.mod_quiz.util.slot.remove(i),this.reorganise_edit_page(),M.core.actionmenu&&M.core.actionmenu.instance&&M.core.actionmenu.instance.hideMenu(t))})},this),this},edit_maxmark:function(t,i,s){var o=s.one(r.INSTANCEMAXMARK),u=s.one(r.ACTIVITYINSTANCE),a=o.get("firstChild"),f=a.get("data"),l=f,c,h=o,p={"class":"resource",field:"getmaxmark",id:e.Moodle.mod_quiz.util.slot.getId(s)};t.preventDefault(),this.send_request(p,null,function(r){M.core.actionmenu&&M.core.actionmenu.instance&&M.core.actionmenu.instance.hideMenu(t),r.instancemaxmark&&(l=r.instancemaxmark);var i=e.Node.create(''),o=e.Node.create('').set("innerHTML",M.util.get_string("edittitleinstructions","moodle")),a=e.Node.create('').setAttrs({value:l,autocomplete:"off","aria-describedby":"id_editinstructions",maxLength:"12",size:parseInt(this.get("config").questiondecimalpoints,10)+2});i.appendChild(a),i.setData("anchor",h),u.insert(o,"before"),h.replace(i),s.addClass(n.EDITINGMAXMARK),a.focus().select(),c=a.on("blur",this.edit_maxmark_cancel,this,s,!1),this.editmaxmarkevents.push(c),c=a.on("key",this.edit_maxmark_cancel,"esc",this,s,!0),this.editmaxmarkevents.push(c),c=i.on("submit",this.edit_maxmark_submit,this,s,f),this.editmaxmarkevents.push(c)})},edit_maxmark_submit:function(t,n,i){t.preventDefault();var s=e.Lang.trim(n.one(r.ACTIVITYFORM+" "+r.ACTIVITYMAXMARK).get("value")),o=this.add_spinner(n);this.edit_maxmark_clear(n),n.one(r.INSTANCEMAXMARK).setContent(s);if(s!==null&&s!==""&&s!==i){var u={"class":"resource",field:"updatemaxmark",maxmark:s,id:e.Moodle.mod_quiz.util.slot.getId(n)};this.send_request(u,o,function(e){e.instancemaxmark&&n.one(r.INSTANCEMAXMARK).setContent(e.instancemaxmark )})}},edit_maxmark_cancel:function(e,t,n){n&&e.preventDefault(),this.edit_maxmark_clear(t)},edit_maxmark_clear:function(t){(new e.EventHandle(this.editmaxmarkevents)).detach();var i=t.one(r.ACTIVITYFORM),s=t.one("#id_editinstructions");i&&i.replace(i.getData("anchor")),s&&s.remove(),t.removeClass(n.EDITINGMAXMARK),e.later(100,this,function(){t.one(r.EDITMAXMARK).focus()}),e.one("input[name=maxmark")||e.one("body").append('')},update_page_break:function(t,n,r,i){t.preventDefault();var s=r.next("li.activity.slot"),o=this.add_spinner(s),u=i==="removepagebreak"?1:2,a={"class":"resource",field:"updatepagebreak",id:e.Moodle.mod_quiz.util.slot.getId(s),value:u};return this.send_request(a,o,function(t){if(t.slots){if(i==="addpagebreak")e.Moodle.mod_quiz.util.page.add(r);else{var n=r.next(e.Moodle.mod_quiz.util.page.SELECTORS.PAGE);e.Moodle.mod_quiz.util.page.remove(n,!0)}this.reorganise_edit_page()}}),this},update_dependency:function(t,n,r,i){t.preventDefault();var s=this.add_spinner(r),o={"class":"resource",field:"updatedependency",id:e.Moodle.mod_quiz.util.slot.getId(r),value:i==="adddependency"?1:0};return this.send_request(o,s,function(t){t.hasOwnProperty("requireprevious")&&e.Moodle.mod_quiz.util.slot.updateDependencyIcon(r,t.requireprevious)}),this},reorganise_edit_page:function(){e.Moodle.mod_quiz.util.slot.reorderSlots(),e.Moodle.mod_quiz.util.slot.reorderPageBreaks(),e.Moodle.mod_quiz.util.page.reorderPages(),e.Moodle.mod_quiz.util.slot.updateOneSlotSections(),e.Moodle.mod_quiz.util.slot.updateAllDependencyIcons()},NAME:"mod_quiz-resource-toolbox",ATTRS:{courseid:{value:0},quizid:{value:0}}}),M.mod_quiz.resource_toolbox=null,M.mod_quiz.init_resource_toolbox=function(e){return M.mod_quiz.resource_toolbox=new o(e),M.mod_quiz.resource_toolbox};var u=function(){u.superclass.constructor.apply(this,arguments)};e.extend(u,s,{editsectionevents:[],initializer:function(){M.mod_quiz.quizbase.register_module(this),i.delegate("key",this.handle_data_action,"down:enter",r.ACTIVITYACTION,this),e.delegate("click",this.handle_data_action,i,r.ACTIVITYACTION,this),e.delegate("change",this.handle_data_action,i,r.EDITSHUFFLEQUESTIONSACTION,this)},handle_data_action:function(e){var t=e.target;!t.test("a")&&!t.test("input[data-action]")&&(t=t.ancestor(r.ACTIVITYACTION));var n=t.getData("action"),i=t.ancestor(r.ACTIVITYLI);if(!t.test("a")&&!t.test("input[data-action]")||!n||!i)return;switch(n){case"edit_section_title":this.edit_section_title(e,t,i,n);break;case"shuffle_questions":this.edit_shuffle_questions(e,t,i,n);break;case"deletesection":this.delete_section_with_confirmation(e,t,i,n);break;default:}},delete_section_with_confirmation:function(t,n,i){t.preventDefault();var s=new M.core.confirm({question:M.util.get_string("confirmremovesectionheading","quiz",i.get("aria-label")),modal:!0});s.on("complete-yes",function(){var t=M.util.add_spinner(e,i.one(r.ACTIONAREA)),n={"class":"section",action:"DELETE",id:i.get("id").replace("section-","")};this.send_request(n,t,function(e){e.deleted&&window.location.reload(!0)})},this)},edit_section_title:function(t,i,s){var o=s.get("id").replace("section-",""),u=s.one(r.INSTANCESECTION),a,f=u,l={"class":"section",field:"getsectiontitle",id:o};t.preventDefault(),this.send_request(l,null,function(t){var r=t.instancesection,i=e.Node.create(''),o=e.Node.create('').set("innerHTML",M.util.get_string("edittitleinstructions","moodle")),l=e.Node.create('').setAttrs({value:r,autocomplete:"off","aria-describedby":"id_editinstructions",maxLength:"255"});i.appendChild(l),i.setData("anchor",f),u.insert(o,"before"),f.replace(i),l.focus().select(),a=l.on("blur",this.edit_section_title_cancel,this,s,!1),this.editsectionevents.push(a),a=l.on("key",this.edit_section_title_cancel,"esc",this,s,!0),this.editsectionevents.push(a),a=i.on("submit",this.edit_section_title_submit,this,s,r),this.editsectionevents.push(a)})},edit_section_title_submit:function(t,n,i){t.preventDefault();var s=e.Lang.trim(n.one(r.SECTIONFORM+" "+r.SECTIONINPUT).get("value")),o=M.util.add_spinner(e,n.one(r.INSTANCESECTIONAREA));this.edit_section_title_clear(n);if(s!==null&&s!==i){n.one(r.INSTANCESECTION).setContent(s);var u={"class":"section",field:"updatesectiontitle",newheading:s,id:n.get("id").replace("section-","")};this.send_request(u,o,function(e){if(e){n.one(r.INSTANCESECTION).setContent(e.instancesection),n.one(r.EDITSECTIONICON).set("title",M.util.get_string("sectionheadingedit","quiz",e.instancesection)),n.one(r.EDITSECTIONICON).set("alt",M.util.get_string("sectionheadingedit","quiz",e.instancesection));var t=n.one(r.DELETESECTIONICON);t&&(t.set("title",M.util.get_string("sectionheadingremove","quiz",e.instancesection)),t.set("alt",M.util.get_string("sectionheadingremove","quiz",e.instancesection)))}})}},edit_section_title_cancel:function(e,t,n){n&&e.preventDefault(),this.edit_section_title_clear(t)},edit_section_title_clear:function(t){(new e.EventHandle(this.editsectionevents)).detach();var n=t.one(r.SECTIONFORM),i=t.one("#id_editinstructions");n&&n.replace(n.getData("anchor")),i&&i.remove(),e.later(100,this,function(){t.one(r.EDITSECTION).focus()}),e.one("input[name=section]")||e.one("body").append('')},edit_shuffle_questions:function(t,n,i){var s;i.one(r.EDITSHUFFLEQUESTIONSACTION).get("checked")?s=1:s=0;var o={"class":"section",field:"updateshufflequestions",id:i.get("id").replace("section-",""),newshuffle:s};t.preventDefault();var u=M.util.add_spinner(e,i.one(r.EDITSHUFFLEAREA));this.send_request(o,u)}},{NAME:"mod_quiz-section-toolbox",ATTRS:{courseid:{value:0},quizid:{value:0}}}),M.mod_quiz.init_section_toolbox=function(e){return new u(e)}},"@VERSION@",{requires:["base","node","event","event-key","io","moodle-mod_quiz-quizbase","moodle-mod_quiz-util-slot","moodle-core-notification-ajaxexception" ]}); diff --git a/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes.js b/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes.js index 1c701f95a668e..dbfae9bf4cb7f 100644 --- a/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes.js +++ b/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes.js @@ -45,10 +45,10 @@ var CSS = { COMMANDSPAN: '.commands', CONTENTAFTERLINK: 'div.contentafterlink', CONTENTWITHOUTLINK: 'div.contentwithoutlink', - DELETESECTIONICON: 'a.editing_delete img', + DELETESECTIONICON: 'a.editing_delete .icon', EDITMAXMARK: 'a.editing_maxmark', EDITSECTION: 'a.editing_section', - EDITSECTIONICON: 'a.editing_section img', + EDITSECTIONICON: 'a.editing_section .icon', EDITSHUFFLEQUESTIONSACTION: 'input.cm-edit-action[data-action]', EDITSHUFFLEAREA: '.instanceshufflequestions .shuffle-progress', HIDE: 'a.editing_hide', diff --git a/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot-debug.js b/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot-debug.js index e31af400d07a3..a450f15f3e60e 100644 --- a/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot-debug.js +++ b/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot-debug.js @@ -31,12 +31,12 @@ Y.Moodle.mod_quiz.util.slot = { NUMBER: 'span.slotnumber', PAGECONTENT: 'div#page-content', PAGEBREAK: 'span.page_split_join_wrapper', - ICON: 'img', + ICON: '.icon', QUESTIONTYPEDESCRIPTION: '.qtype_description', SECTIONUL: 'ul.section', DEPENDENCY_WRAPPER: '.question_dependency_wrapper', DEPENDENCY_LINK: '.question_dependency_wrapper .cm-edit-action', - DEPENDENCY_ICON: '.question_dependency_wrapper img' + DEPENDENCY_ICON: '.question_dependency_wrapper .icon' }, /** diff --git a/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot-min.js b/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot-min.js index 31f35359497c3..3881b844bd974 100644 --- a/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot-min.js +++ b/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot-min.js @@ -1 +1 @@ -YUI.add("moodle-mod_quiz-util-slot",function(e,t){e.namespace("Moodle.mod_quiz.util.slot"),e.Moodle.mod_quiz.util.slot={CSS:{SLOT:"slot",QUESTIONTYPEDESCRIPTION:"qtype_description",CANNOT_DEPEND:"question_dependency_cannot_depend"},CONSTANTS:{SLOTIDPREFIX:"slot-",QUESTION:M.util.get_string("question","moodle")},SELECTORS:{SLOT:"li.slot",INSTANCENAME:".instancename",NUMBER:"span.slotnumber",PAGECONTENT:"div#page-content",PAGEBREAK:"span.page_split_join_wrapper",ICON:"img",QUESTIONTYPEDESCRIPTION:".qtype_description",SECTIONUL:"ul.section",DEPENDENCY_WRAPPER:".question_dependency_wrapper",DEPENDENCY_LINK:".question_dependency_wrapper .cm-edit-action",DEPENDENCY_ICON:".question_dependency_wrapper img"},getSlotFromComponent:function(t){return e.one(t).ancestor(this.SELECTORS.SLOT,!0)},getId:function(e){var t=e.get("id").replace(this.CONSTANTS.SLOTIDPREFIX,"");return t=parseInt(t,10),typeof t=="number"&&isFinite(t)?t:!1},getName:function(e){var t=e.one(this.SELECTORS.INSTANCENAME);return t?t.get("firstChild").get("data"):null},getNumber:function(e){if(!e)return!1;var t=e.one(this.SELECTORS.NUMBER).get("text").replace(this.CONSTANTS.QUESTION,"");return t=parseInt(t,10),typeof t=="number"&&isFinite(t)?t:!1},setNumber:function(e,t){var n=e.one(this.SELECTORS.NUMBER);n.setHTML(''+this.CONSTANTS.QUESTION+" "+t)},getSlots:function(){return e.all(this.SELECTORS.PAGECONTENT+" "+this.SELECTORS.SECTIONUL+" "+this.SELECTORS.SLOT)},getNumberedSlots:function(){var t=this.SELECTORS.PAGECONTENT+" "+this.SELECTORS.SECTIONUL;return t+=" "+this.SELECTORS.SLOT+":not("+this.SELECTORS.QUESTIONTYPEDESCRIPTION+")",e.all(t)},getPrevious:function(e){return e.previous(this.SELECTORS.SLOT)},getPreviousNumbered:function(e){var t=e.previous(this.SELECTORS.SLOT+":not("+this.SELECTORS.QUESTIONTYPEDESCRIPTION+")");if(t)return t;var n=e.ancestor("li.section").previous("li.section");while(n){var r=n.all(this.SELECTORS.SLOT+":not("+this.SELECTORS.QUESTIONTYPEDESCRIPTION+")");if(r.size()>0)return r.item(r.size()-1);n=n.previous("li.section")}return!1},reorderSlots:function(){var t=this.getSlots();t.each(function(t){if(!e.Moodle.mod_quiz.util.page.getPageFromSlot(t)){var n=t.next(e.Moodle.mod_quiz.util.page.SELECTORS.PAGE);t.swap(n)}var r=this.getPreviousNumbered(t),i=0;if(t.hasClass(this.CSS.QUESTIONTYPEDESCRIPTION))return;r&&(i=this.getNumber(r)),this.setNumber(t,i+1)},this)},updateOneSlotSections:function(){e.all(".mod-quiz-edit-content ul.slots li.section").each(function(e){e.all(this.SELECTORS.SLOT).size()>1?e.removeClass("only-has-one-slot"):e.addClass("only-has-one-slot")},this)},remove:function(t){var n=e.Moodle.mod_quiz.util.page.getPageFromSlot(t);t.remove();if(!e.Moodle.mod_quiz.util.page.isEmpty(n))return;e.Moodle.mod_quiz.util.page.remove(n)},getPageBreaks:function(){var t=this.SELECTORS.PAGECONTENT+" "+this.SELECTORS.SECTIONUL;return t+=" "+this.SELECTORS.SLOT+this.SELECTORS.PAGEBREAK,e.all(t)},getPageBreak:function(t){return e.one(t).one(this.SELECTORS.PAGEBREAK)},addPageBreak:function(t){var n=M.mod_quiz.resource_toolbox.get("config").addpageiconhtml;n=n.replace("%%SLOT%%",this.getNumber(t));var r=e.Node.create(n);return t.one("div").insert(r,"after"),r},removePageBreak:function(e){var t=this.getPageBreak(e);return t?(t.remove(),!0):!1},reorderPageBreaks:function(){var t=this.getSlots(),n=0;t.each(function(r,i){n++;var s=this.getPageBreak(r),o=r.next("li.activity");if(!o)return;s||(s=this.addPageBreak(r)),s&&i===t.size()-1&&this.removePageBreak(r);var u=s.get("childNodes").item(0),a="",f="";e.Moodle.mod_quiz.util.page.isPage(o)?(a="removepagebreak",f="e/remove_page_break"):(a="addpagebreak",f="e/insert_page_break"),u.set("title",M.util.get_string(a,"quiz")),u.setData("action",a);var l=u.one(this.SELECTORS.ICON);l.set("title",M.util.get_string(a,"quiz")),l.set("alt",M.util.get_string(a,"quiz")),l.set("src",M.util.image_url(f));var c=e.QueryString.parse(u.get("href"));c.slot=n;var h="";for(var p in c)h.length&&(h+="&"),h+=p+"="+c[p];u.set("href",h)},this)},updateAllDependencyIcons:function(){var e=this.getSlots(),t=0,n=null;e.each(function(e){t++,t==1||n.getData("canfinish")==="0"?e.one(this.SELECTORS.DEPENDENCY_WRAPPER).addClass(this.CSS.CANNOT_DEPEND):e.one(this.SELECTORS.DEPENDENCY_WRAPPER).removeClass(this.CSS.CANNOT_DEPEND),this.updateDependencyIcon(e,null),n=e},this)},updateDependencyIcon:function(e,t){var n=e.one(this.SELECTORS.DEPENDENCY_LINK),r=e.one(this.SELECTORS.DEPENDENCY_ICON),i=this.getPrevious(e),s={thisq:this.getNumber(e)};i&&(s.previousq=this.getNumber(i)),t===null&&(t=n.getData("action")==="removedependency"),t?(n.set("title",M.util.get_string("questiondependencyremove","quiz",s)),n.setData("action","removedependency"),r.set("alt",M.util.get_string("questiondependsonprevious","quiz")),r.set("src",M.util.image_url("t/locked","moodle"))):(n.set("title",M.util.get_string("questiondependencyadd","quiz",s)),n.setData("action","adddependency"),r.set("alt",M.util.get_string("questiondependencyfree","quiz")),r.set("src",M.util.image_url("t/unlocked","moodle")))}}},"@VERSION@",{requires:["node","moodle-mod_quiz-util-base"]}); +YUI.add("moodle-mod_quiz-util-slot",function(e,t){e.namespace("Moodle.mod_quiz.util.slot"),e.Moodle.mod_quiz.util.slot={CSS:{SLOT:"slot",QUESTIONTYPEDESCRIPTION:"qtype_description",CANNOT_DEPEND:"question_dependency_cannot_depend"},CONSTANTS:{SLOTIDPREFIX:"slot-",QUESTION:M.util.get_string("question","moodle")},SELECTORS:{SLOT:"li.slot",INSTANCENAME:".instancename",NUMBER:"span.slotnumber",PAGECONTENT:"div#page-content",PAGEBREAK:"span.page_split_join_wrapper",ICON:".icon",QUESTIONTYPEDESCRIPTION:".qtype_description",SECTIONUL:"ul.section",DEPENDENCY_WRAPPER:".question_dependency_wrapper",DEPENDENCY_LINK:".question_dependency_wrapper .cm-edit-action",DEPENDENCY_ICON:".question_dependency_wrapper .icon"},getSlotFromComponent:function(t){return e.one(t).ancestor(this.SELECTORS.SLOT,!0)},getId:function(e){var t=e.get("id").replace(this.CONSTANTS.SLOTIDPREFIX,"");return t=parseInt(t,10),typeof t=="number"&&isFinite(t)?t:!1},getName:function(e){var t=e.one(this.SELECTORS.INSTANCENAME);return t?t.get("firstChild").get("data"):null},getNumber:function(e){if(!e)return!1;var t=e.one(this.SELECTORS.NUMBER).get("text").replace(this.CONSTANTS.QUESTION,"");return t=parseInt(t,10),typeof t=="number"&&isFinite(t)?t:!1},setNumber:function(e,t){var n=e.one(this.SELECTORS.NUMBER);n.setHTML(''+this.CONSTANTS.QUESTION+" "+t)},getSlots:function(){return e.all(this.SELECTORS.PAGECONTENT+" "+this.SELECTORS.SECTIONUL+" "+this.SELECTORS.SLOT)},getNumberedSlots:function(){var t=this.SELECTORS.PAGECONTENT+" "+this.SELECTORS.SECTIONUL;return t+=" "+this.SELECTORS.SLOT+":not("+this.SELECTORS.QUESTIONTYPEDESCRIPTION+")",e.all(t)},getPrevious:function(e){return e.previous(this.SELECTORS.SLOT)},getPreviousNumbered:function(e){var t=e.previous(this.SELECTORS.SLOT+":not("+this.SELECTORS.QUESTIONTYPEDESCRIPTION+")");if(t)return t;var n=e.ancestor("li.section").previous("li.section");while(n){var r=n.all(this.SELECTORS.SLOT+":not("+this.SELECTORS.QUESTIONTYPEDESCRIPTION+")");if(r.size()>0)return r.item(r.size()-1);n=n.previous("li.section")}return!1},reorderSlots:function(){var t=this.getSlots();t.each(function(t){if(!e.Moodle.mod_quiz.util.page.getPageFromSlot(t)){var n=t.next(e.Moodle.mod_quiz.util.page.SELECTORS.PAGE);t.swap(n)}var r=this.getPreviousNumbered(t),i=0;if(t.hasClass(this.CSS.QUESTIONTYPEDESCRIPTION))return;r&&(i=this.getNumber(r)),this.setNumber(t,i+1)},this)},updateOneSlotSections:function(){e.all(".mod-quiz-edit-content ul.slots li.section").each(function(e){e.all(this.SELECTORS.SLOT).size()>1?e.removeClass("only-has-one-slot"):e.addClass("only-has-one-slot")},this)},remove:function(t){var n=e.Moodle.mod_quiz.util.page.getPageFromSlot(t);t.remove();if(!e.Moodle.mod_quiz.util.page.isEmpty(n))return;e.Moodle.mod_quiz.util.page.remove(n)},getPageBreaks:function(){var t=this.SELECTORS.PAGECONTENT+" "+this.SELECTORS.SECTIONUL;return t+=" "+this.SELECTORS.SLOT+this.SELECTORS.PAGEBREAK,e.all(t)},getPageBreak:function(t){return e.one(t).one(this.SELECTORS.PAGEBREAK)},addPageBreak:function(t){var n=M.mod_quiz.resource_toolbox.get("config").addpageiconhtml;n=n.replace("%%SLOT%%",this.getNumber(t));var r=e.Node.create(n);return t.one("div").insert(r,"after"),r},removePageBreak:function(e){var t=this.getPageBreak(e);return t?(t.remove(),!0):!1},reorderPageBreaks:function(){var t=this.getSlots(),n=0;t.each(function(r,i){n++;var s=this.getPageBreak(r),o=r.next("li.activity");if(!o)return;s||(s=this.addPageBreak(r)),s&&i===t.size()-1&&this.removePageBreak(r);var u=s.get("childNodes").item(0),a="",f="";e.Moodle.mod_quiz.util.page.isPage(o)?(a="removepagebreak",f="e/remove_page_break"):(a="addpagebreak",f="e/insert_page_break"),u.set("title",M.util.get_string(a,"quiz")),u.setData("action",a);var l=u.one(this.SELECTORS.ICON);l.set("title",M.util.get_string(a,"quiz")),l.set("alt",M.util.get_string(a,"quiz")),l.set("src",M.util.image_url(f));var c=e.QueryString.parse(u.get("href"));c.slot=n;var h="";for(var p in c)h.length&&(h+="&"),h+=p+"="+c[p];u.set("href",h)},this)},updateAllDependencyIcons:function(){var e=this.getSlots(),t=0,n=null;e.each(function(e){t++,t==1||n.getData("canfinish")==="0"?e.one(this.SELECTORS.DEPENDENCY_WRAPPER).addClass(this.CSS.CANNOT_DEPEND):e.one(this.SELECTORS.DEPENDENCY_WRAPPER).removeClass(this.CSS.CANNOT_DEPEND),this.updateDependencyIcon(e,null),n=e},this)},updateDependencyIcon:function(e,t){var n=e.one(this.SELECTORS.DEPENDENCY_LINK),r=e.one(this.SELECTORS.DEPENDENCY_ICON),i=this.getPrevious(e),s={thisq:this.getNumber(e)};i&&(s.previousq=this.getNumber(i)),t===null&&(t=n.getData("action")==="removedependency"),t?(n.set("title",M.util.get_string("questiondependencyremove","quiz",s)),n.setData("action","removedependency"),r.set("alt",M.util.get_string("questiondependsonprevious","quiz")),r.set("src",M.util.image_url("t/locked","moodle"))):(n.set("title",M.util.get_string("questiondependencyadd","quiz",s)),n.setData("action","adddependency"),r.set("alt",M.util.get_string("questiondependencyfree","quiz")),r.set("src",M.util.image_url("t/unlocked","moodle")))}}},"@VERSION@",{requires:["node","moodle-mod_quiz-util-base"]}); diff --git a/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot.js b/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot.js index e31af400d07a3..a450f15f3e60e 100644 --- a/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot.js +++ b/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot.js @@ -31,12 +31,12 @@ Y.Moodle.mod_quiz.util.slot = { NUMBER: 'span.slotnumber', PAGECONTENT: 'div#page-content', PAGEBREAK: 'span.page_split_join_wrapper', - ICON: 'img', + ICON: '.icon', QUESTIONTYPEDESCRIPTION: '.qtype_description', SECTIONUL: 'ul.section', DEPENDENCY_WRAPPER: '.question_dependency_wrapper', DEPENDENCY_LINK: '.question_dependency_wrapper .cm-edit-action', - DEPENDENCY_ICON: '.question_dependency_wrapper img' + DEPENDENCY_ICON: '.question_dependency_wrapper .icon' }, /** diff --git a/mod/quiz/yui/src/dragdrop/js/resource.js b/mod/quiz/yui/src/dragdrop/js/resource.js index c23f835351905..f9ef84b3fab58 100644 --- a/mod/quiz/yui/src/dragdrop/js/resource.js +++ b/mod/quiz/yui/src/dragdrop/js/resource.js @@ -95,7 +95,7 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, { // Get our drag object var drag = e.target; drag.get('dragNode').setContent(drag.get('node').get('innerHTML')); - drag.get('dragNode').all('img.iconsmall').setStyle('vertical-align', 'baseline'); + drag.get('dragNode').all('.icon').setStyle('vertical-align', 'baseline'); }, drag_dropmiss: function(e) { diff --git a/mod/quiz/yui/src/quizbase/js/quizbase.js b/mod/quiz/yui/src/quizbase/js/quizbase.js index d73124bbe137c..050250f6eb52c 100644 --- a/mod/quiz/yui/src/quizbase/js/quizbase.js +++ b/mod/quiz/yui/src/quizbase/js/quizbase.js @@ -99,7 +99,7 @@ M.mod_quiz.edit.process_sections = function(Y, sectionlist, response, sectionfro SECTIONNAME: 'sectionname' }, SELECTORS = { - SECTIONLEFTSIDE: '.left .section-handle img' + SECTIONLEFTSIDE: '.left .section-handle .icon' }; if (response.action === 'move') { diff --git a/mod/quiz/yui/src/toolboxes/js/toolbox.js b/mod/quiz/yui/src/toolboxes/js/toolbox.js index 756180fdff46b..22f626898f7d8 100644 --- a/mod/quiz/yui/src/toolboxes/js/toolbox.js +++ b/mod/quiz/yui/src/toolboxes/js/toolbox.js @@ -43,10 +43,10 @@ var CSS = { COMMANDSPAN: '.commands', CONTENTAFTERLINK: 'div.contentafterlink', CONTENTWITHOUTLINK: 'div.contentwithoutlink', - DELETESECTIONICON: 'a.editing_delete img', + DELETESECTIONICON: 'a.editing_delete .icon', EDITMAXMARK: 'a.editing_maxmark', EDITSECTION: 'a.editing_section', - EDITSECTIONICON: 'a.editing_section img', + EDITSECTIONICON: 'a.editing_section .icon', EDITSHUFFLEQUESTIONSACTION: 'input.cm-edit-action[data-action]', EDITSHUFFLEAREA: '.instanceshufflequestions .shuffle-progress', HIDE: 'a.editing_hide', diff --git a/mod/quiz/yui/src/util/js/slot.js b/mod/quiz/yui/src/util/js/slot.js index 43cb88b27b1df..9588adc9b5923 100644 --- a/mod/quiz/yui/src/util/js/slot.js +++ b/mod/quiz/yui/src/util/js/slot.js @@ -29,12 +29,12 @@ Y.Moodle.mod_quiz.util.slot = { NUMBER: 'span.slotnumber', PAGECONTENT: 'div#page-content', PAGEBREAK: 'span.page_split_join_wrapper', - ICON: 'img', + ICON: '.icon', QUESTIONTYPEDESCRIPTION: '.qtype_description', SECTIONUL: 'ul.section', DEPENDENCY_WRAPPER: '.question_dependency_wrapper', DEPENDENCY_LINK: '.question_dependency_wrapper .cm-edit-action', - DEPENDENCY_ICON: '.question_dependency_wrapper img' + DEPENDENCY_ICON: '.question_dependency_wrapper .icon' }, /** diff --git a/mod/scorm/loadSCO.php b/mod/scorm/loadSCO.php index d4e1b6fc145e6..3a590e87e1fa2 100644 --- a/mod/scorm/loadSCO.php +++ b/mod/scorm/loadSCO.php @@ -142,7 +142,7 @@ function doredirect() { document.body.innerHTML = "

              " + " " + ".   " + - "pix_icon('wait', '', 'scorm'); ?>

              "; + "pix_icon('wait', '', 'scorm')); ?>

              "; var e = document.getElementById("countdown"); var cSeconds = parseInt(e.innerHTML); var timer = setInterval(function() { diff --git a/mod/workshop/tests/behat/behat_mod_workshop.php b/mod/workshop/tests/behat/behat_mod_workshop.php index 603d31b5eaef1..1d62d6b45342b 100644 --- a/mod/workshop/tests/behat/behat_mod_workshop.php +++ b/mod/workshop/tests/behat/behat_mod_workshop.php @@ -48,15 +48,15 @@ class behat_mod_workshop extends behat_base { public function i_change_phase_in_workshop_to($workshopname, $phase) { $workshopname = $this->escape($workshopname); $phaseliteral = behat_context_helper::escape($phase); - $switchphase = behat_context_helper::escape(get_string('switchphase', 'workshop')); - $xpath = "//*[@class='userplan']/descendant::div[./span[contains(.,$phaseliteral)]]/". - "descendant-or-self::a[./img[@alt=$switchphase]]"; + $xpath = "//*[@class='userplan']/descendant::div[./span[contains(.,$phaseliteral)]]"; $continue = $this->escape(get_string('continue')); $this->execute('behat_general::click_link', $workshopname); - $this->execute("behat_general::i_click_on", array($xpath, "xpath_element")); + $this->execute('behat_general::i_click_on_in_the', + array('a.action-icon', "css_element", $this->escape($xpath), "xpath_element") + ); $this->execute("behat_forms::press_button", $continue); } diff --git a/mod/workshop/view.php b/mod/workshop/view.php index d1db403ed004f..09dc0aef791a0 100644 --- a/mod/workshop/view.php +++ b/mod/workshop/view.php @@ -501,7 +501,7 @@ echo $output->render($btn); echo $output->help_icon('clearassessments', 'workshop'); - echo $OUTPUT->pix_icon('i/risk_dataloss', get_string('diskdatalossshort', 'admin')); + echo $OUTPUT->pix_icon('i/risk_dataloss', get_string('riskdatalossshort', 'admin')); echo $output->container_end(); echo $output->box_end(); diff --git a/question/type/ddmarker/renderer.php b/question/type/ddmarker/renderer.php index 5589c70b67f86..0b67e286a57e6 100644 --- a/question/type/ddmarker/renderer.php +++ b/question/type/ddmarker/renderer.php @@ -69,7 +69,7 @@ public function formulation_and_controls(question_attempt $qa, $classes[] = 'dragno'.$drag->noofdrags; } $targeticonhtml = - $OUTPUT->pix_icon('crosshairs', '', $componentname, array('class' => 'target')); + $OUTPUT->activity_icon('crosshairs', '', $componentname, array('class' => 'target')); $markertextattrs = array('class' => 'markertext'); $markertext = html_writer::tag('span', $drag->text, $markertextattrs); diff --git a/report/log/tests/behat/filter_log.feature b/report/log/tests/behat/filter_log.feature index 9499312c416c7..419a27f7af2a8 100644 --- a/report/log/tests/behat/filter_log.feature +++ b/report/log/tests/behat/filter_log.feature @@ -68,7 +68,7 @@ Feature: In a report, admin can filter log data And I follow "Course 1" And I follow "Home" And I follow "Course 1" - And I navigate to "Users > Enrolled users" in current page administration + And I navigate to course participants And I follow "Student 1" And I click on "Log in as" "link" And I press "Continue" diff --git a/theme/boost/tests/behat/behat_theme_boost_behat_grade.php b/theme/boost/tests/behat/behat_theme_boost_behat_grade.php index 1820f2cbc891f..fe803eae3f69d 100644 --- a/theme/boost/tests/behat/behat_theme_boost_behat_grade.php +++ b/theme/boost/tests/behat/behat_theme_boost_behat_grade.php @@ -44,7 +44,8 @@ public function i_set_the_following_settings_for_grade_item($gradeitem, TableNod $savechanges = get_string('savechanges', 'grades'); $edit = behat_context_helper::escape(get_string('edit') . ' '); - $linkxpath = "//a[./img[starts-with(@title,$edit) and contains(@title,$gradeitem)]]"; + $linkxpath = "//a[./*[contains(concat(' ', normalize-space(@class), ' '), ' icon ') " . + "and starts-with(@title,$edit) and contains(@title,$gradeitem)]]"; $this->execute("behat_general::i_click_on", array($this->escape($linkxpath), "xpath_element")); $this->execute("behat_forms::i_set_the_following_fields_to_these_values", $data); @@ -67,7 +68,8 @@ public function i_set_calculation_for_grade_item_with_idnumbers($calculation, $g // Going to edit calculation. $savechanges = get_string('savechanges', 'grades'); $edit = behat_context_helper::escape(get_string('editcalculation', 'grades')); - $linkxpath = "//a[./img[starts-with(@title,$edit) and contains(@title,$gradeitem)]]"; + $linkxpath = "//a[./*[contains(concat(' ', normalize-space(@class), ' '), ' icon ') " . + "and starts-with(@title,$edit) and contains(@title,$gradeitem)]]"; $this->execute("behat_general::i_click_on", array($this->escape($linkxpath), "xpath_element")); // Mapping names to idnumbers. @@ -106,7 +108,8 @@ public function i_set_calculation_for_grade_category_with_idnumbers($calculation // Going to edit calculation. $savechanges = get_string('savechanges', 'grades'); $edit = behat_context_helper::escape(get_string('editcalculation', 'grades')); - $linkxpath = "//a[./img[starts-with(@title,$edit) and contains(@title,$gradeitem)]]"; + $linkxpath = "//a[./*[contains(concat(' ', normalize-space(@class), ' '), ' icon ') " . + "and starts-with(@title,$edit) and contains(@title,$gradeitem)]]"; $this->execute("behat_general::i_click_on", array($this->escape($linkxpath), "xpath_element")); // Mapping names to idnumbers. diff --git a/theme/boost/tests/behat/behat_theme_boost_behat_navigation.php b/theme/boost/tests/behat/behat_theme_boost_behat_navigation.php index 3d2199e348cb5..670f3c05555ae 100644 --- a/theme/boost/tests/behat/behat_theme_boost_behat_navigation.php +++ b/theme/boost/tests/behat/behat_theme_boost_behat_navigation.php @@ -65,12 +65,12 @@ protected function get_top_navigation_node($nodetext) { "/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . "/ul/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . "[p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . - "/*[normalize-space(.)=" . $nodetextliteral ."]]" . + "/*[contains(normalize-space(.), " . $nodetextliteral .")]]" . "|" . "//div[contains(concat(' ', normalize-space(@class), ' '), ' card-text ')]/div" . "/ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" . "/li[p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . - "/*[normalize-space(.)=" . $nodetextliteral ."]]"; + "/*[contains(normalize-space(.), " . $nodetextliteral .")]]"; $node = $this->find('xpath', $xpath, $exception); @@ -154,7 +154,7 @@ protected function select_on_administration_page($nodelist) { // Check if there is a separate tab for this submenu of the page. If found go to it. if ($parentnodes) { $tabname = behat_context_helper::escape($parentnodes[0]); - $tabxpath = '//ul[@role=\'tablist\']/li/a[normalize-space(.)=' . $tabname . ']'; + $tabxpath = '//ul[@role=\'tablist\']/li/a[contains(normalize-space(.), ' . $tabname . ')]'; if ($node = $this->getSession()->getPage()->find('xpath', $tabxpath)) { if ($this->running_javascript()) { // Click on the tab and add 'active' tab to the xpath. @@ -178,7 +178,7 @@ protected function select_on_administration_page($nodelist) { // Find a link and click on it. $linkname = behat_context_helper::escape($lastnode); - $xpath .= '//a[normalize-space(.)=' . $linkname . ']'; + $xpath .= '//a[contains(normalize-space(.), ' . $linkname . ')]'; if (!$node = $this->getSession()->getPage()->find('xpath', $xpath)) { throw new ElementNotFoundException($this->getSession(), 'Link "' . join(' > ', $nodelist) . '"" not found on the page'); } @@ -258,7 +258,7 @@ protected function select_from_administration_menu($nodelist) { if (!$isheader || count($nodelist) == 1) { $lastnode = end($nodelist); $linkname = behat_context_helper::escape($lastnode); - $link = $this->getSession()->getPage()->find('xpath', $menuxpath . '//a[normalize-space(.)=' . $linkname . ']'); + $link = $this->getSession()->getPage()->find('xpath', $menuxpath . '//a[contains(normalize-space(.), ' . $linkname . ')]'); if ($link) { $link->click(); $this->wait_for_pending_js(); @@ -269,7 +269,7 @@ protected function select_from_administration_menu($nodelist) { if ($isheader) { // Course administration and Front page administration will have subnodes under "More...". $linkname = behat_context_helper::escape(get_string('morenavigationlinks')); - $link = $this->getSession()->getPage()->find('xpath', $menuxpath . '//a[normalize-space(.)=' . $linkname . ']'); + $link = $this->getSession()->getPage()->find('xpath', $menuxpath . '//a[contains(normalize-space(.), ' . $linkname . ')]'); if ($link) { $link->click(); $this->execute('behat_general::wait_until_the_page_is_ready');