From 65377780445bfbf00d31da113be60dae8e0a0bff Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Tue, 25 Aug 2015 22:05:33 +0800 Subject: [PATCH 1/2] MDL-49973 changed continue to delete on delete confirmations --- admin/user.php | 6 +++++- course/delete.php | 5 +++-- course/editsection.php | 2 +- question/classes/bank/view.php | 3 ++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/admin/user.php b/admin/user.php index b05838c9985..2dffa223490 100644 --- a/admin/user.php +++ b/admin/user.php @@ -78,8 +78,12 @@ echo $OUTPUT->header(); $fullname = fullname($user, true); echo $OUTPUT->heading(get_string('deleteuser', 'admin')); + $optionsyes = array('delete'=>$delete, 'confirm'=>md5($delete), 'sesskey'=>sesskey()); - echo $OUTPUT->confirm(get_string('deletecheckfull', '', "'$fullname'"), new moodle_url($returnurl, $optionsyes), $returnurl); + $deleteurl = new moodle_url($returnurl, $optionsyes); + $deletebutton = new single_button($deleteurl, get_string('delete'), 'post'); + + echo $OUTPUT->confirm(get_string('deletecheckfull', '', "'$fullname'"), $deletebutton, $returnurl); echo $OUTPUT->footer(); die; } else if (data_submitted() and !$user->deleted) { diff --git a/course/delete.php b/course/delete.php index 31d48176d40..1ddc12d8eaf 100644 --- a/course/delete.php +++ b/course/delete.php @@ -76,11 +76,12 @@ $strdeletecoursecheck = get_string("deletecoursecheck"); $message = "{$strdeletecoursecheck}

{$coursefullname} ({$courseshortname})"; $continueurl = new moodle_url('/course/delete.php', array('id' => $course->id, 'delete' => md5($course->timemodified))); +$continuebutton = new single_button($continueurl, get_string('delete'), 'post'); $PAGE->navbar->add($strdeletecheck); $PAGE->set_title("$SITE->shortname: $strdeletecheck"); $PAGE->set_heading($SITE->fullname); echo $OUTPUT->header(); -echo $OUTPUT->confirm($message, $continueurl, $categoryurl); +echo $OUTPUT->confirm($message, $continuebutton, $categoryurl); echo $OUTPUT->footer(); -exit; \ No newline at end of file +exit; diff --git a/course/editsection.php b/course/editsection.php index 76b49eb7eed..ea4724aecc1 100644 --- a/course/editsection.php +++ b/course/editsection.php @@ -66,7 +66,7 @@ if ($deletesection) { echo $OUTPUT->box_start('noticebox'); $optionsyes = array('id' => $id, 'confirm' => 1, 'delete' => 1, 'sesskey' => sesskey()); $deleteurl = new moodle_url('/course/editsection.php', $optionsyes); - $formcontinue = new single_button($deleteurl, get_string('continue')); + $formcontinue = new single_button($deleteurl, get_string('delete')); $formcancel = new single_button($cancelurl, get_string('cancel'), 'get'); echo $OUTPUT->confirm(get_string('confirmdeletesection', '', get_section_name($course, $sectioninfo)), $formcontinue, $formcancel); diff --git a/question/classes/bank/view.php b/question/classes/bank/view.php index 04e076d5385..42c17cf6504 100644 --- a/question/classes/bank/view.php +++ b/question/classes/bank/view.php @@ -923,7 +923,8 @@ class view { $deleteurl = new \moodle_url($baseurl, array('deleteselected' => $questionlist, 'confirm' => md5($questionlist), 'sesskey' => sesskey())); - echo $OUTPUT->confirm(get_string('deletequestionscheck', 'question', $questionnames), $deleteurl, $baseurl); + $continue = new \single_button($deleteurl, get_string('delete'), 'post'); + echo $OUTPUT->confirm(get_string('deletequestionscheck', 'question', $questionnames), $continue, $baseurl); return true; } From fdb5d62660ee7bacbf4c7a1fd97b832a7d1f85c7 Mon Sep 17 00:00:00 2001 From: Cameron Ball Date: Mon, 14 Sep 2015 17:46:35 +0800 Subject: [PATCH 2/2] MDL-49973 behat: Update delete button names --- .../topics/tests/behat/edit_delete_sections.feature | 8 ++++---- .../format/weeks/tests/behat/edit_delete_sections.feature | 8 ++++---- course/tests/behat/create_delete_course.feature | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/course/format/topics/tests/behat/edit_delete_sections.feature b/course/format/topics/tests/behat/edit_delete_sections.feature index 6b6cf0b090d..4b036d857be 100644 --- a/course/format/topics/tests/behat/edit_delete_sections.feature +++ b/course/format/topics/tests/behat/edit_delete_sections.feature @@ -43,7 +43,7 @@ Feature: Sections can be edited and deleted in topics format Scenario: Deleting the last section in topics format When I click on "Delete topic" "link" in the "li#section-5" "css_element" Then I should see "Are you absolutely sure you want to completely delete \"Topic 5\" and all the activities it contains?" - And I press "Continue" + And I press "Delete" And I should not see "Topic 5" And I navigate to "Edit settings" node in "Course administration" And I expand all fieldsets @@ -51,7 +51,7 @@ Feature: Sections can be edited and deleted in topics format Scenario: Deleting the middle section in topics format When I click on "Delete topic" "link" in the "li#section-4" "css_element" - And I press "Continue" + And I press "Delete" Then I should not see "Topic 5" And I should not see "Test chat name" And I should see "Test choice name" in the "li#section-4" "css_element" @@ -63,7 +63,7 @@ Feature: Sections can be edited and deleted in topics format When I follow "Reduce the number of sections" Then I should see "Orphaned activities (section 5)" in the "li#section-5" "css_element" And I click on "Delete topic" "link" in the "li#section-5" "css_element" - And I press "Continue" + And I press "Delete" And I should not see "Topic 5" And I should not see "Orphaned activities" And "li#section-5" "css_element" should not exist @@ -77,7 +77,7 @@ Feature: Sections can be edited and deleted in topics format And "li#section-5.orphaned" "css_element" should exist And "li#section-4.orphaned" "css_element" should not exist And I click on "Delete topic" "link" in the "li#section-1" "css_element" - And I press "Continue" + And I press "Delete" And I should not see "Test book name" And I should see "Orphaned activities (section 4)" in the "li#section-4" "css_element" And "li#section-5" "css_element" should not exist diff --git a/course/format/weeks/tests/behat/edit_delete_sections.feature b/course/format/weeks/tests/behat/edit_delete_sections.feature index 76d400426fb..c8b10222bed 100644 --- a/course/format/weeks/tests/behat/edit_delete_sections.feature +++ b/course/format/weeks/tests/behat/edit_delete_sections.feature @@ -45,7 +45,7 @@ Feature: Sections can be edited and deleted in weeks format Given I should see "29 May - 4 June" in the "li#section-5" "css_element" When I click on "Delete week" "link" in the "li#section-5" "css_element" Then I should see "Are you absolutely sure you want to completely delete \"29 May - 4 June\" and all the activities it contains?" - And I press "Continue" + And I press "Delete" And I should not see "29 May - 4 June" And I navigate to "Edit settings" node in "Course administration" And I expand all fieldsets @@ -54,7 +54,7 @@ Feature: Sections can be edited and deleted in weeks format Scenario: Deleting the middle section in weeks format Given I should see "29 May - 4 June" in the "li#section-5" "css_element" When I click on "Delete week" "link" in the "li#section-4" "css_element" - And I press "Continue" + And I press "Delete" Then I should not see "29 May - 4 June" And I should not see "Test chat name" And I should see "Test choice name" in the "li#section-4" "css_element" @@ -66,7 +66,7 @@ Feature: Sections can be edited and deleted in weeks format When I follow "Reduce the number of sections" Then I should see "Orphaned activities (section 5)" in the "li#section-5" "css_element" And I click on "Delete week" "link" in the "li#section-5" "css_element" - And I press "Continue" + And I press "Delete" And I should not see "29 May - 4 June" And I should not see "Orphaned activities" And "li#section-5" "css_element" should not exist @@ -80,7 +80,7 @@ Feature: Sections can be edited and deleted in weeks format And "li#section-5.orphaned" "css_element" should exist And "li#section-4.orphaned" "css_element" should not exist And I click on "Delete week" "link" in the "li#section-1" "css_element" - And I press "Continue" + And I press "Delete" And I should not see "Test book name" And I should see "Orphaned activities (section 4)" in the "li#section-4" "css_element" And "li#section-5" "css_element" should not exist diff --git a/course/tests/behat/create_delete_course.feature b/course/tests/behat/create_delete_course.feature index 1c74098666b..fba44ddcbb7 100644 --- a/course/tests/behat/create_delete_course.feature +++ b/course/tests/behat/create_delete_course.feature @@ -54,7 +54,7 @@ Feature: Test we can both create and delete a course. # Redirect And I should see "Delete TCCAC" And I should see "Test course: create a course (TCCAC)" - And I press "Continue" + And I press "Delete" # Redirect And I should see "Deleting TCCAC" And I should see "TCCAC has been completely deleted" @@ -93,7 +93,7 @@ Feature: Test we can both create and delete a course. # Redirect And I should see "Delete TCCAC" And I should see "Test course: create a course (TCCAC)" - And I press "Continue" + And I press "Delete" # Redirect And I should see "Deleting TCCAC" And I should see "TCCAC has been completely deleted"