forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-77357 communication_matrix: Implement dynamic form fields
- Loading branch information
1 parent
982938f
commit 5fc1ded
Showing
10 changed files
with
234 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Install steps for communication_matrix. | ||
* | ||
* @package communication_matrix | ||
* @copyright 2023 Safat Shahin <safat.shahin@moodle.com> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
/** | ||
* Upgrade procedures for the matrix plugin. | ||
* | ||
* @return bool | ||
*/ | ||
function xmldb_communication_matrix_upgrade($oldversion) { | ||
global $DB; | ||
|
||
$dbman = $DB->get_manager(); | ||
if ($oldversion < 2023041100) { | ||
$table = new xmldb_table('matrix_rooms'); | ||
$field = new xmldb_field('topic', XMLDB_TYPE_CHAR, '255', null, false, false, null, 'roomid'); | ||
|
||
if (!$dbman->field_exists($table, $field)) { | ||
$dbman->add_field($table, $field); | ||
} | ||
} | ||
|
||
return true; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
communication/provider/matrix/tests/behat/matrix_form_fields.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
@communication @communication_matrix @javascript | ||
Feature: Communication matrix form field | ||
In order to create a new communication room in matrix | ||
As a teacher | ||
I can update the room the information from course | ||
|
||
Background: Make sure the mock server is initialized and a course is created for teacher | ||
Given the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| teacher1 | Teacher | 1 | teacher1@example.com | | ||
And the following "courses" exist: | ||
| fullname | shortname | category | | ||
| Test course | Test course | 0 | | ||
And the following "course enrolments" exist: | ||
| user | course | role | | ||
| teacher1 | Test course | editingteacher | | ||
|
||
Scenario: I can add room name for matrix room | ||
Given a Matrix mock server is configured | ||
And I log in as "teacher1" | ||
And I am on "Test course" course homepage | ||
When I navigate to "Settings" in current page administration | ||
And I click on "Communication" "link" | ||
And I set the field "id_selectedcommunication" to "Matrix" | ||
And I wait to be redirected | ||
And I should see "Room name" | ||
And I set the field "id_communicationroomname" to "Sampleroomname" | ||
And I press "Save and display" | ||
And I navigate to "Settings" in current page administration | ||
And I expand all fieldsets | ||
Then the field "id_communicationroomname" matches value "Sampleroomname" | ||
|
||
Scenario: I can add room topic for matrix room | ||
Given a Matrix mock server is configured | ||
And I log in as "teacher1" | ||
And I am on "Test course" course homepage | ||
When I navigate to "Settings" in current page administration | ||
And I click on "Communication" "link" | ||
And I set the field "id_selectedcommunication" to "Matrix" | ||
And I wait to be redirected | ||
And I should see "Room name" | ||
And I should see "Room topic" | ||
And I set the field "id_communicationroomname" to "Sampleroomname" | ||
And I set the field "id_matrixroomtopic" to "Sampleroomtopic" | ||
And I press "Save and display" | ||
And I navigate to "Settings" in current page administration | ||
And I click on "Communication" "link" | ||
Then the field "id_communicationroomname" matches value "Sampleroomname" | ||
And I press "Cancel" | ||
And I run all adhoc tasks | ||
And I navigate to "Settings" in current page administration | ||
And I click on "Communication" "link" | ||
And the field "id_matrixroomtopic" matches value "Sampleroomtopic" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters