diff --git a/classes/output/big_search_form.php b/classes/output/big_search_form.php index 33f559f9..0043aa4b 100644 --- a/classes/output/big_search_form.php +++ b/classes/output/big_search_form.php @@ -53,6 +53,7 @@ class big_search_form implements renderable, templatable { public $user; public $words; public $tags; + public $forumid; /** @var string The URL of the search form. */ public $actionurl; diff --git a/lang/en/hsuforum.php b/lang/en/hsuforum.php index eba01dd3..2301d11b 100644 --- a/lang/en/hsuforum.php +++ b/lang/en/hsuforum.php @@ -203,6 +203,7 @@ $string['exportdiscussion'] = 'Export whole discussion to portfolio'; $string['forcessubscribe'] = 'This forum forces everyone to be subscribed'; $string['forum'] = 'Forum'; +$string['from'] = 'From'; $string['gradingmethodpreview'] = 'Grading criteria'; $string['hsuforum:addinstance'] = 'Add a new forum'; $string['hsuforum:allowforcesubscribe'] = 'Allow force subscribe'; @@ -579,6 +580,7 @@ $string['timedposts'] = 'Timed posts'; $string['timedvisible'] = 'Timed status: Visible to all users'; $string['timestartenderror'] = 'Display end date cannot be earlier than the start date'; +$string['to'] = 'To'; $string['trackforum'] = 'Track unread posts'; $string['trackreadposts_header'] = 'Forum tracking'; $string['unread'] = 'New'; diff --git a/locallib.php b/locallib.php index c5110f9c..6bc2e064 100644 --- a/locallib.php +++ b/locallib.php @@ -40,6 +40,7 @@ class hsuforum_portfolio_caller extends portfolio_module_caller_base { private $discussion; private $posts; private $keyedfiles; // just using multifiles isn't enough if we're exporting a full thread + private $modcontext; /** * @return array diff --git a/mod_form.php b/mod_form.php index ebdb4ad1..1a26ca47 100644 --- a/mod_form.php +++ b/mod_form.php @@ -683,11 +683,11 @@ protected function add_hsuforum_rating_settings() { $mform->addElement('checkbox', 'ratingtime', get_string('ratingtime', 'rating')); $mform->hideIf('ratingtime', $assessedfieldname, 'eq', 0); - $mform->addElement('date_time_selector', 'assesstimestart', get_string('from')); + $mform->addElement('date_time_selector', 'assesstimestart', get_string('from', 'mod_hsuforum')); $mform->hideIf('assesstimestart', $assessedfieldname, 'eq', 0); $mform->hideIf('assesstimestart', 'ratingtime'); - $mform->addElement('date_time_selector', 'assesstimefinish', get_string('to')); + $mform->addElement('date_time_selector', 'assesstimefinish', get_string('to', 'mod_hsuforum')); $mform->hideIf('assesstimefinish', $assessedfieldname, 'eq', 0); $mform->hideIf('assesstimefinish', 'ratingtime'); } diff --git a/search.php b/search.php index d91dbf1d..f4104922 100644 --- a/search.php +++ b/search.php @@ -302,6 +302,8 @@ $options = new stdClass(); $options->trusted = $post->messagetrust; $modcontext = context_module::instance($cm->id); + $coursecontext = context_course::instance($course->id); + $options->context = $coursecontext; $post->message = highlight($strippedsearch, format_text( file_rewrite_pluginfile_urls( @@ -312,8 +314,7 @@ $post->id ), $post->messageformat, - $options, - $course->id), + $options), 0, '', ''); foreach ($searchterms as $searchterm) { diff --git a/tests/behat/accessibility_pin_button.feature b/tests/behat/accessibility_pin_button.feature index 0aba5f07..2090a8b3 100644 --- a/tests/behat/accessibility_pin_button.feature +++ b/tests/behat/accessibility_pin_button.feature @@ -36,7 +36,7 @@ Feature: When creating a new discussion the unpin option should exist as a butto | teacher1 | C1 | editingteacher | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add a "Open Forum" to section "1" and I fill the form with: + And I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Test forum name | | Forum type | Standard forum for general use | | Description | Test forum description | diff --git a/tests/behat/add_forum.feature b/tests/behat/add_forum.feature index cb4c75f4..8ce620d0 100644 --- a/tests/behat/add_forum.feature +++ b/tests/behat/add_forum.feature @@ -19,7 +19,7 @@ Feature: Add Open Forum activities and discussions | student1 | C1 | student | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add a "Open Forum" to section "1" and I fill the form with: + And I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Test forum name | | Forum type | Standard forum for general use | | Description | Test forum description | @@ -59,7 +59,7 @@ Feature: Add Open Forum activities and discussions | teacher1 | C1 | editingteacher | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add a "Open Forum" to section "1" and I fill the form with: + And I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Test forum name | | Forum type | Standard forum for general use | | Description | Test forum description | diff --git a/tests/behat/advanced_editor_pass_data_to_new_page.feature b/tests/behat/advanced_editor_pass_data_to_new_page.feature index 61a01041..3119a5a0 100644 --- a/tests/behat/advanced_editor_pass_data_to_new_page.feature +++ b/tests/behat/advanced_editor_pass_data_to_new_page.feature @@ -17,7 +17,7 @@ Feature: Users see their typed information in the advanced editor view when clic | enabletimedposts | 1 | hsuforum | And I log in as "admin" And I am on "Course 1" course homepage with editing mode on - And I add a "Open Forum" to section "1" and I fill the form with: + And I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Test forum name | | Forum type | Standard forum for general use | | Description | Test forum description | diff --git a/tests/behat/edit_post_student.feature b/tests/behat/edit_post_student.feature index a7ed2125..ea031667 100644 --- a/tests/behat/edit_post_student.feature +++ b/tests/behat/edit_post_student.feature @@ -51,7 +51,7 @@ Feature: Students can edit or delete their Open Forum posts within a set time li And I log out And I log in as "admin" And I am on "Course 1" course homepage with editing mode on - And I add a "Open Forum" to section "1" and I fill the form with: + And I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Test forum name | | Forum type | Standard forum for general use | | Description | Test forum description | diff --git a/tests/behat/edit_post_teacher.feature b/tests/behat/edit_post_teacher.feature index dedc60ad..37c85b41 100644 --- a/tests/behat/edit_post_teacher.feature +++ b/tests/behat/edit_post_teacher.feature @@ -18,7 +18,7 @@ Feature: Teachers can edit or delete any Open Forum post | student1 | C1 | student | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add a "Open Forum" to section "1" and I fill the form with: + And I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Test forum name | | Description | Test forum description | And I add a new discussion to "Test forum name" Open Forum with: diff --git a/tests/behat/forum_subscriptions_availability.feature b/tests/behat/forum_subscriptions_availability.feature index b8ad6382..eb092a3c 100644 --- a/tests/behat/forum_subscriptions_availability.feature +++ b/tests/behat/forum_subscriptions_availability.feature @@ -25,7 +25,7 @@ Feature: In Open Forums as a teacher I need to see an accurate list of subscribe @javascript Scenario: A forced forum lists all subscribers - When I add a "Open Forum" to section "1" and I fill the form with: + When I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Forced Forum 1 | | Forum type | Standard forum for general use | | Description | Test forum description | @@ -39,7 +39,7 @@ Feature: In Open Forums as a teacher I need to see an accurate list of subscribe @javascript Scenario: A forced forum does not allow to edit the subscribers - When I add a "Open Forum" to section "1" and I fill the form with: + When I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Forced Forum 2 | | Forum type | Standard forum for general use | | Description | Test forum description | @@ -55,7 +55,7 @@ Feature: In Open Forums as a teacher I need to see an accurate list of subscribe @javascript Scenario: A forced and hidden forum lists only teachers - When I add a "Open Forum" to section "1" and I fill the form with: + When I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Forced Forum 2 | | Forum type | Standard forum for general use | | Description | Test forum description | @@ -70,7 +70,7 @@ Feature: In Open Forums as a teacher I need to see an accurate list of subscribe @javascript Scenario: An automatic forum lists all subscribers - When I add a "Open Forum" to section "1" and I fill the form with: + When I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Forced Forum 1 | | Forum type | Standard forum for general use | | Description | Test forum description | diff --git a/tests/behat/grading_settings.feature b/tests/behat/grading_settings.feature index add22ae7..3e65b11e 100644 --- a/tests/behat/grading_settings.feature +++ b/tests/behat/grading_settings.feature @@ -39,7 +39,7 @@ Feature: While creating a new activity, the grade settings should remain in the | Grade category 1 | C1 | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add a "Open Forum" to section "1" and I fill the form with: + And I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Test forum name | | Forum type | Standard forum for general use | | Description | Test forum description | diff --git a/tests/behat/hsuforum_tags.feature b/tests/behat/hsuforum_tags.feature index 5744f2fc..faaffba4 100644 --- a/tests/behat/hsuforum_tags.feature +++ b/tests/behat/hsuforum_tags.feature @@ -37,7 +37,7 @@ Feature: Open forum posts and new discussions handle tags correctly, in order to | student1 | C1 | student | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add a "Open Forum" to section "1" and I fill the form with: + And I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Test forum name | | Description | Test forum description | And I add a new discussion to "Test forum name" Open Forum with: @@ -47,7 +47,7 @@ Feature: Open forum posts and new discussions handle tags correctly, in order to Given I log in as "admin" And I navigate to "Appearance > Manage tags" in site administration And I follow "Default collection" - And I follow "Add standard tags" + And I click on "Add standard tags" "button" And I set the field "Enter comma-separated list of new tags" to "OT1, OT2, OT3" And I press "Continue" And I log out diff --git a/tests/behat/inline_edit.feature b/tests/behat/inline_edit.feature index e8de4003..7247034f 100644 --- a/tests/behat/inline_edit.feature +++ b/tests/behat/inline_edit.feature @@ -17,7 +17,7 @@ Feature: Teachers and students can add discussions inline | enabletimedposts | 1 | hsuforum | And I log in as "admin" And I am on "Course 1" course homepage with editing mode on - And I add a "Open Forum" to section "1" and I fill the form with: + And I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Test forum name | | Forum type | Standard forum for general use | | Description | Test forum description | diff --git a/tests/behat/maintain_start_end_date.feature b/tests/behat/maintain_start_end_date.feature index e9631fdd..75d30dbf 100644 --- a/tests/behat/maintain_start_end_date.feature +++ b/tests/behat/maintain_start_end_date.feature @@ -17,7 +17,7 @@ Feature: In Open Forums users can change start and end date and the changes rema And the following config values are set as admin: | enabletimedposts | 1 | hsuforum | And I am on "Course 1" course homepage with editing mode on - And I add a "Open Forum" to section "1" and I fill the form with: + And I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Test forum name | | Description | Test forum description | And I add a new discussion to "Test forum name" Open Forum with: diff --git a/tests/behat/posts_ordering_blog.feature b/tests/behat/posts_ordering_blog.feature index ff6ff1b6..26a9f8eb 100644 --- a/tests/behat/posts_ordering_blog.feature +++ b/tests/behat/posts_ordering_blog.feature @@ -18,7 +18,7 @@ Feature: In Open Forums, blog posts are always displayed in reverse chronologica | student1 | C1 | student | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add a "Open Forum" to section "1" and I fill the form with: + And I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Course blog forum | | Description | Single discussion forum description | | Forum type | Standard forum displayed in a blog-like format | diff --git a/tests/behat/posts_ordering_general.feature b/tests/behat/posts_ordering_general.feature index 48f56882..2013f81f 100644 --- a/tests/behat/posts_ordering_general.feature +++ b/tests/behat/posts_ordering_general.feature @@ -18,7 +18,7 @@ Feature: New Open discussions and discussions with recently added replies are di | student1 | C1 | student | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add a "Open Forum" to section "1" and I fill the form with: + And I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Course general forum | | Description | Single discussion forum description | | Forum type | Standard forum for general use | diff --git a/tests/behat/rate_posts.feature b/tests/behat/rate_posts.feature index 07af4cbd..22d151a7 100644 --- a/tests/behat/rate_posts.feature +++ b/tests/behat/rate_posts.feature @@ -18,7 +18,7 @@ Feature: Users can rate other users forum posts | student1 | C1 | student | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add a "Open Forum" to section "1" and I fill the form with: + And I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Test forum name | | Description | Test forum description | | Aggregate type | Average of ratings | diff --git a/tests/behat/separate_group_single_group_discussions.feature b/tests/behat/separate_group_single_group_discussions.feature index e3b1d8ec..c7515480 100644 --- a/tests/behat/separate_group_single_group_discussions.feature +++ b/tests/behat/separate_group_single_group_discussions.feature @@ -40,13 +40,13 @@ Feature: In Open Forums, posting to groups in a separate group discussion when r | G2 | G2G1 | And I log in as "admin" And I am on "Course 1" course homepage with editing mode on - And I add a "Open Forum" to section "1" and I fill the form with: + And I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Multiple groups forum | | Forum type | Standard forum for general use | | Description | Standard forum description | | Group mode | Separate groups | | Grouping | G1 | - And I add a "Open Forum" to section "1" and I fill the form with: + And I add a "hsuforum" activity to course "Course 1" section "1" and I fill the form with: | Forum name | Single groups forum | | Forum type | Standard forum for general use | | Description | Standard forum description | diff --git a/tests/behat/split_forum_discussion.feature b/tests/behat/split_forum_discussion.feature index 33ddcc6e..905e4ca4 100644 --- a/tests/behat/split_forum_discussion.feature +++ b/tests/behat/split_forum_discussion.feature @@ -18,7 +18,7 @@ Feature: Open Forum discussions can be split | student1 | C1 | student | And I log in as "teacher1" And I am on "Science 101" course homepage with editing mode on - And I add a "Open Forum" to section "1" and I fill the form with: + And I add a "hsuforum" activity to course "Science 101" section "1" and I fill the form with: | Forum name | Study discussions | | Forum type | Standard forum for general use | | Description | Forum to discuss your coursework. | diff --git a/tests/externallib_test.php b/tests/externallib_test.php index 9a6a76e3..b352ceff 100644 --- a/tests/externallib_test.php +++ b/tests/externallib_test.php @@ -297,6 +297,7 @@ public function test_mod_hsuforum_get_forum_discussion_posts() { 'timemodified' => $timepost, 'mimetype' => 'image/jpeg', 'isexternalfile' => false, + 'icon' => "f/image", ) ), 'totalscore' => $discussion1reply1->totalscore, @@ -345,7 +346,6 @@ public function test_mod_hsuforum_get_forum_discussion_posts() { $userpicture = new user_picture($user2); $userpicture->size = 1; // Size f1. $expectedposts['posts'][1]['userpictureurl'] = $userpicture->get_url($PAGE)->out(false); - // Unset the initial discussion post. array_shift($posts['posts']); $this->assertEquals($expectedposts, $posts); diff --git a/tests/portfolio_caller_test.php b/tests/portfolio_caller_test.php index f3eb52c1..93452383 100644 --- a/tests/portfolio_caller_test.php +++ b/tests/portfolio_caller_test.php @@ -30,7 +30,7 @@ * * Tests behaviour of the hsuforum_portfolio_caller class. */ -class mod_hsuforum_portfolio_caller_testcase extends advanced_testcase { +class portfolio_caller_test extends advanced_testcase { /** * Ensure that a file will be loaded in an instance of the caller when supplied valid and