first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,15 @@
<div class="imagegallery-addentry">
<div class="mb-3">
<div class="font-weight-bold">[[title#name]]</div>
[[title]]
</div>
<div class="mb-3">
<div class="font-weight-bold">[[image#name]]</div>
[[image]]
</div>
<div class="mb-3">
<div class="font-weight-bold">[[description#name]]</div>
[[description]]
</div>
##otherfields##
</div>
@@ -0,0 +1,21 @@
<div class="imagegallery-asearch container">
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3">
<div class="mb-3 col">
<div class="font-weight-bold mb-2">First name</div>
##firstname##
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">Last name</div>
##lastname##
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">[[title#name]]</div>
[[title]]
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">[[description#name]]</div>
[[description]]
</div>
</div>
</div>
@@ -0,0 +1,46 @@
<?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/>.
/**
* Privacy provider implementation for datapreset_imagegallery.
*
* @package datapreset_imagegallery
* @copyright 2018 Mihail Geshoski <mihail@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace datapreset_imagegallery\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy provider implementation for datapreset_imagegallery.
*
* @copyright 2018 Mihail Geshoski <mihail@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -0,0 +1,38 @@
/****** List View CSS ******/
#imagegallery-list img.list_picture {
width: 100%;
height: 15vw;
object-fit: cover;
}
#imagegallery-list .card {
margin-top: 30px;
margin-bottom: 15px;
}
.imagegallery-listentry .card-title {
font-size: larger;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
/***** Single View CSS *****/
.imagegallery-single-body .col {
padding: 10px 15px;
}
.imagegallery-single img.list_picture {
max-width: 100%;
height: auto;
}
/***** Add entry CSS *****/
.imagegallery-addentry .form-group label,
.imagegallery-asearch .form-group label {
font-weight: bold;
padding-top: 20px;
}
@@ -0,0 +1,29 @@
<?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/>.
/**
* Strings for component 'datapreset_imagegallery', language 'en', branch 'MOODLE_20_STABLE'
*
* @package datapreset_imagegallery
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['modulename'] = 'Image gallery';
$string['modulename_help'] = 'Use this preset to collect images.';
$string['pluginname'] = 'Image gallery';
$string['privacy:metadata'] = 'The Image gallery plugin does not store any personal data.';
@@ -0,0 +1,19 @@
<div class="col mb-4">
<div class="imagegallery-listentry card">
<div class="img-wrapper">
[[image]]
</div>
<div class="card-body">
<div class="card-title" style="transform: rotate(0);">
[[title]]
<a href="##moreurl##" class="stretched-link"></a>
</div>
<div class="d-flex align-items-start">
<div class="card-footer border-0 bg-white ml-auto d-flex" style="position: relative;">
<div class="ml-auto my-auto ##approvalstatusclass##">##approvalstatus##</div>
<div>##actionsmenu##</div>
</div>
</div>
</div>
</div>
</div>
@@ -0,0 +1 @@
</div>
@@ -0,0 +1 @@
<div id="imagegallery-list" class="row row-cols-1 row-cols-md-2 row-cols-lg-3 row-cols-xl-4" role="list">
+45
View File
@@ -0,0 +1,45 @@
<preset>
<settings>
<intro></intro>
<comments>0</comments>
<ratings>0</ratings>
<participants>3</participants>
<requiredentries>0</requiredentries>
<requiredentriestoview>0</requiredentriestoview>
<maxentries>0</maxentries>
<rssarticles>0</rssarticles>
<approval>0</approval>
<scale>0</scale>
<assessed>0</assessed>
<assessedpublic></assessedpublic>
<defaultsort>0</defaultsort>
<defaultsortdir>0</defaultsortdir>
<editany>0</editany>
</settings>
<field>
<type>picture</type>
<name>image</name>
<param1></param1>
<param2></param2>
<param3>2097152</param3>
<param4></param4>
</field>
<field>
<type>text</type>
<name>title</name>
</field>
<field>
<type>textarea</type>
<name>description</name>
<required>0</required>
<param2>60</param2>
<param3>10</param3>
<param4>1</param4>
<param5>0</param5>
</field>
</preset>
@@ -0,0 +1,30 @@
<div class="imagegallery-rss">
<div class="row my-4">
<div class="col-auto">##userpicture##</div>
<div class="col">
<div class="row h-100">
<div class="col-3 align-self-center">
##user##<br/><span class="data-timeinfo">##timeadded##</span>
</div>
<div class="col-4 col-md-6 text-right align-self-center data-timeinfo">
<span class="font-weight-bold ">Last edited:</span> ##timemodified##
</div>
<div class="col-4 col-md-3 ml-auto align-self-center d-flex flex-row-reverse">
<div class="ml-auto my-auto ##approvalstatusclass##">##approvalstatus##</div>
</div>
</div>
</div>
</div>
<hr/>
<h2 class="card-title mt-4">[[title]]</h2>
<div class="imagegallery-single-body">
<div class="row singleentry-caption">
<div class="col">[[description]]</div>
</div>
<div class="row singleentry-image">
<div class="col">[[image]]</div>
</div>
</div>
</div>
@@ -0,0 +1 @@
[[title]]
@@ -0,0 +1,32 @@
<div class="imagegallery-single">
<div class="row my-4">
<div class="col-auto">##userpicture##</div>
<div class="col">
<div class="row h-100">
<div class="col-3 align-self-center">
##user##<br/><span class="data-timeinfo">##timeadded##</span>
</div>
<div class="col-4 col-md-6 text-right align-self-center data-timeinfo">
<span class="font-weight-bold ">Last edited:</span> ##timemodified##
</div>
<div class="col-4 col-md-3 ml-auto align-self-center d-flex flex-row-reverse">
<div>##actionsmenu##</div>
<div class="ml-auto my-auto ##approvalstatusclass##">##approvalstatus##</div>
</div>
</div>
</div>
</div>
<hr/>
<h2 class="card-title mt-4">[[title]]</h2>
<div class="imagegallery-single-body">
<div class="row singleentry-caption">
<div class="col">[[description]]</div>
</div>
<div class="row singleentry-image">
<div class="col">[[image]]</div>
</div>
##otherfields##
</div>
</div>
@@ -0,0 +1,118 @@
@mod @mod_data @datapreset @data_preset_imagegallery
Feature: Users can use the Image gallery preset
In order to create an Image gallery database
As a user
I need to apply and use the Image gallery preset
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Alice | Student | student1@example.com |
| teacher1 | Pau | Teacher | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| data | Mountain landscapes | Database intro | C1 | data1 |
And I am on the "Mountain landscapes" "data activity" page logged in as teacher1
And I follow "Presets"
And I click on "fullname" "radio" in the "Image gallery" "table_row"
And I click on "Use this preset" "button"
And the following "mod_data > entries" exist:
| database | user | title | description | image |
| data1 | student1 | First image | This is the description text for image 1 | first.png |
| data1 | teacher1 | Second image | And this is the description text for image 2 | second.png |
@javascript
Scenario: Users view entries
When I am on the "Mountain landscapes" "data activity" page logged in as student1
Then I should see "First image"
And I should not see "This is the description text for image 1"
And I should not see "first.png"
And I should not see "Alice Student" in the "#imagegallery-list" "css_element"
And "//a/child::img[contains(@src, 'first.png')]" "xpath_element" should exist
And "Actions" "icon" should exist in the "#imagegallery-list" "css_element"
And I should see "Second image"
And I should not see "And this is the description text for image 2"
And I should not see "second.png"
And I should not see "Pau Teacher"
And "//a/child::img[contains(@src, 'second.png')]" "xpath_element" should exist
# Single view.
And I select "Single view" from the "jump" singleselect
And I should see "First image"
And I should see "Alice Student" in the ".imagegallery-single" "css_element"
And I should see "This is the description text for image 1"
And "//a/child::img[contains(@src, 'first.png')]" "xpath_element" should exist
And "Actions" "icon" should exist in the ".imagegallery-single" "css_element"
And I should not see "Second image"
And I should not see "And this is the description text for image 2"
And I should not see "Pau Teacher"
And "//a/child::img[contains(@src, 'second.png')]" "xpath_element" should not exist
And I follow "Next"
And I should see "Second image"
And I should see "Pau Teacher"
And I should see "And this is the description text for image 2"
And "//a/child::img[contains(@src, 'second.png')]" "xpath_element" should exist
# This student can't edit or delete this entry, so the Actions menu shouldn't be displayed.
And "Actions" "icon" should not exist in the ".imagegallery-single" "css_element"
And I should not see "First image"
And I should not see "Alice Student" in the ".imagegallery-single" "css_element"
And I should not see "This is the description text for image 1"
And "//a/child::img[contains(@src, 'first.png')]" "xpath_element" should not exist
@javascript
Scenario: Users can search entries
Given I am on the "Mountain landscapes" "data activity" page logged in as student1
And "First image" "text" should appear before "Second image" "text"
When I click on "Advanced search" "checkbox"
And I should see "First name"
And I should see "Last name"
And I set the field "title" to "First image"
And I click on "Save settings" "button" in the "data_adv_form" "region"
Then I should see "First image"
And I should not see "Second image"
But I set the field "title" to "image"
And I set the field "Order" to "Descending"
And I click on "Save settings" "button" in the "data_adv_form" "region"
And "Second image" "text" should appear before "First image" "text"
@javascript
Scenario: Users can add entries
Given I am on the "Mountain landscapes" "data activity" page logged in as student1
When I press "Add entry"
And I set the field "title" to "New image"
And I set the field "description" to "This is the description for the new image."
And I press "Save"
Then I should see "New image"
And I should see "This is the description for the new image."
@javascript
Scenario: Image gallery. Renaming a field should affect the template
Given I am on the "Mountain landscapes" "data activity" page logged in as teacher1
And I navigate to "Fields" in current page administration
And I open the action menu in "title" "table_row"
And I choose "Edit" in the open action menu
And I set the field "Field name" to "Edited field name"
And I press "Save"
And I should see "Field updated"
When I navigate to "Database" in current page administration
Then I click on "Advanced search" "checkbox"
And I should see "Edited field name"
And I click on "Add entry" "button"
And I should see "Edited field name"
@javascript
Scenario: Image gallery. Has otherfields tag
Given the following "mod_data > fields" exist:
| database | type | name | description |
| data1 | text | Extra field | Test field description |
And I am on the "Mountain landscapes" "data activity" page logged in as teacher1
When I select "Single view" from the "jump" singleselect
Then I should see "Extra field"
And I click on "Add entry" "button"
And I should see "Extra field"
+28
View File
@@ -0,0 +1,28 @@
<?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/>.
/**
* @package datapreset
* @subpackage imagegallery
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2024042200; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2024041600; // Requires this Moodle version.
$plugin->component = 'datapreset_imagegallery'; // Full name of the plugin (used for diagnostics)
+11
View File
@@ -0,0 +1,11 @@
<div class="journal-addentry">
<div class="mb-3">
<div class="font-weight-bold">[[Title#name]]</div>
[[Title]]
</div>
<div class="mb-3">
<div class="font-weight-bold">[[Content#name]]</div>
[[Content]]
</div>
##otherfields##
</div>
@@ -0,0 +1,21 @@
<div class="journal-asearch container">
<div class="row row-cols-3">
<div class="mb-3 col">
<div class="font-weight-bold mb-2">First name</div>
##firstname##
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">Last name</div>
##lastname##
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">[[Title#name]]</div>
[[Title]]
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">[[Content#name]]</div>
[[Content]]
</div>
</div>
</div>
@@ -0,0 +1,37 @@
<?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/>.
namespace datapreset_journal\privacy;
/**
* Privacy provider implementation for datapreset_journal.
*
* @package datapreset_journal
* @copyright 2022 Sara Arjona <sara@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason(): string {
return 'privacy:metadata';
}
}
+16
View File
@@ -0,0 +1,16 @@
/****** List View CSS ******/
.truncate-overflow {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
/***** Add entry CSS *****/
.journal-addentry .form-group label,
.journal-asearch .form-group label {
font-weight: bold;
padding-top: 20px;
}
@@ -0,0 +1,28 @@
<?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/>.
/**
* Strings for component 'datapreset_journal', language 'en'.
*
* @package datapreset_journal
* @copyright 2022 Sara Arjona <sara@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['modulename'] = 'Journal';
$string['modulename_help'] = 'Use this preset for a journal, diary, reflections tool or research log.';
$string['pluginname'] = 'Journal';
$string['privacy:metadata'] = 'The Journal plugin doesn\'t store any personal data.';
+28
View File
@@ -0,0 +1,28 @@
<div class="card my-3">
<div class="card-body">
<div class="row">
<div class="col-4 col-sm-8 my-auto">
<h2 class="card-title"><a href="##moreurl##">[[Title]]</a></h2>
</div>
<div class="col-auto ml-auto d-flex flex-row-reverse">
<div>##actionsmenu##</div>
<div class="ml-auto my-auto ##approvalstatusclass##">##approvalstatus##</div>
</div>
</div>
<div class="card-text truncate-overflow mb-4">[[Content]]</div>
<div class="row my-4 mr-1">
<div class="col-auto">##userpicture##</div>
<div class="col">
<div class="row h-100">
<div class="col-4 col-md-3 align-self-center">
##user##<br/><span class="data-timeinfo">##timeadded##</span>
</div>
<div class="col-8 col-md-6 text-right align-self-center data-timeinfo">
<span class="font-weight-bold ">Last edited:</span> ##timemodified##
</div>
</div>
</div>
</div>
</div>
</div>
@@ -0,0 +1 @@
</div>
@@ -0,0 +1 @@
<div id="journal-list">
+32
View File
@@ -0,0 +1,32 @@
<preset>
<settings>
<intro></intro>
<comments>0</comments>
<requiredentries>0</requiredentries>
<requiredentriestoview>0</requiredentriestoview>
<maxentries>0</maxentries>
<rssarticles>0</rssarticles>
<approval>0</approval>
<manageapproved>1</manageapproved>
<defaultsortdir>0</defaultsortdir>
<defaultsort>0</defaultsort>
</settings>
<field>
<type>text</type>
<name>Title</name>
<required>0</required>
</field>
<field>
<type>textarea</type>
<name>Content</name>
<required>0</required>
<param2>60</param2>
<param3>10</param3>
<param4>1</param4>
<param5>0</param5>
</field>
</preset>
+27
View File
@@ -0,0 +1,27 @@
<div class="journal-rss my-5">
<div class="row my-4">
<div class="col-auto">##userpicture##</div>
<div class="col">
<div class="row h-100">
<div class="col-3 align-self-center">
##user##<br/><span class="data-timeinfo">##timeadded##</span>
</div>
<div class="col-4 col-md-6 text-right align-self-center data-timeinfo">
<span class="font-weight-bold ">Last edited:</span> ##timemodified##
</div>
<div class="col-4 col-md-3 ml-auto align-self-center d-flex flex-row-reverse">
<div class="ml-auto my-auto ##approvalstatusclass##">##approvalstatus##</div>
</div>
</div>
</div>
</div>
<hr/>
<h2 class="card-title mt-4">[[title]]</h2>
<div class="journal-single-body my-5">
<div class="singleentry-content">
[[Content]]
</div>
</div>
</div>
@@ -0,0 +1 @@
[[Title]]
@@ -0,0 +1,29 @@
<div class="journal-single my-5">
<div class="row my-4">
<div class="col-auto">##userpicture##</div>
<div class="col">
<div class="row h-100">
<div class="col-3 align-self-center">
##user##<br/><span class="data-timeinfo">##timeadded##</span>
</div>
<div class="col-4 col-md-6 text-right align-self-center data-timeinfo">
<span class="font-weight-bold ">Last edited:</span> ##timemodified##
</div>
<div class="col-4 col-md-3 ml-auto align-self-center d-flex flex-row-reverse">
<div>##actionsmenu##</div>
<div class="ml-auto my-auto ##approvalstatusclass##">##approvalstatus##</div>
</div>
</div>
</div>
</div>
<hr/>
<h2 class="card-title mt-4">[[title]]</h2>
<div class="journal-single-body my-5">
<div class="singleentry-content">
[[Content]]
</div>
##otherfields##
</div>
</div>
@@ -0,0 +1,102 @@
@mod @mod_data @datapreset @datapreset_journal
Feature: Users can use the Journal preset
In order to create a Journal database
As a user
I need to apply and use the Journal preset
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Alice | Student | student1@example.com |
| teacher1 | Pau | Teacher | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| data | Student reflections | Database intro | C1 | data1 |
And I am on the "Student reflections" "data activity" page logged in as teacher1
And I follow "Presets"
And I click on "fullname" "radio" in the "Journal" "table_row"
And I click on "Use this preset" "button"
And the following "mod_data > entries" exist:
| database | user | Title | Content |
| data1 | student1 | Reflection created by student | This is the content for the entry 1 |
| data1 | teacher1 | Reflection created by teacher | And this is the content for the entry 2 |
@javascript
Scenario: Journal. Users view entries
When I am on the "Student reflections" "data activity" page logged in as student1
Then I should see "Reflection created by student"
And I should see "This is the content for the entry 1"
And "Actions" "icon" should exist in the "#journal-list" "css_element"
And I should see "Reflection created by teacher"
And I should see "And this is the content for the entry 2"
# Single view.
And I select "Single view" from the "jump" singleselect
And I should see "Reflection created by student"
And I should see "This is the content for the entry 1"
And "Actions" "icon" should exist in the ".journal-single" "css_element"
And I should not see "Reflection created by teacher"
And I should not see "And this is the content for the entry 2"
And I follow "Next"
And I should see "Reflection created by teacher"
And I should see "And this is the content for the entry 2"
# This student can't edit or delete this entry, so the Actions menu shouldn't be displayed.
And "Actions" "icon" should not exist in the ".journal-single" "css_element"
And I should not see "Reflection created by student"
And I should not see "This is the content for the entry 1"
@javascript
Scenario: Journal. Users can search entries
Given I am on the "Student reflections" "data activity" page logged in as student1
And "Reflection created by student" "text" should appear before "Reflection created by teacher" "text"
When I click on "Advanced search" "checkbox"
And I should see "First name"
And I should see "Last name"
And I set the field "Title" to "student"
And I click on "Save settings" "button" in the "data_adv_form" "region"
Then I should see "Reflection created by student"
And I should not see "Reflection created by teacher"
But I set the field "Title" to "Reflection"
And I set the field "Order" to "Descending"
And I click on "Save settings" "button" in the "data_adv_form" "region"
And "Reflection created by teacher" "text" should appear before "Reflection created by student" "text"
@javascript
Scenario: Journal. Users can add entries
Given I am on the "Student reflections" "data activity" page logged in as student1
When I press "Add entry"
And I set the field "Title" to "This is the title"
And I set the field "Content" to "This is the content for the new entry."
And I press "Save"
Then I should see "This is the title"
And I should see "This is the content for the new entry."
@javascript
Scenario: Journal. Renaming a field should affect the template
Given I am on the "Student reflections" "data activity" page logged in as teacher1
And I navigate to "Fields" in current page administration
And I open the action menu in "Content" "table_row"
And I choose "Edit" in the open action menu
And I set the field "Field name" to "Edited field name"
And I press "Save"
And I should see "Field updated"
When I navigate to "Database" in current page administration
Then I click on "Advanced search" "checkbox"
And I should see "Edited field name"
And I click on "Add entry" "button"
And I should see "Edited field name"
@javascript
Scenario: Journal. Has otherfields tag
Given the following "mod_data > fields" exist:
| database | type | name | description |
| data1 | text | Extra field | Test field description |
And I am on the "Student reflections" "data activity" page logged in as teacher1
When I click on "Add entry" "button"
Then I should see "Extra field"
+29
View File
@@ -0,0 +1,29 @@
<?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/>.
/**
* Data Journal preset version information.
*
* @package datapreset_journal
* @copyright 2022 Sara Arjona <sara@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2024042200; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2024041600; // Requires this Moodle version.
$plugin->component = 'datapreset_journal'; // Full name of the plugin (used for diagnostics).
@@ -0,0 +1,19 @@
<div class="proposals-addentry">
<div class="mb-3">
<div class="font-weight-bold">[[Title#name]]</div>
[[Title]]
</div>
<div class="mb-3">
<div class="font-weight-bold">[[Status#name]]</div>
[[Status]]
</div>
<div class="mb-3">
<div class="font-weight-bold">[[Summary#name]]</div>
[[Summary]]
</div>
<div class="mb-3">
<div class="font-weight-bold">[[Content#name]]</div>
[[Content]]
</div>
##otherfields##
</div>
@@ -0,0 +1,29 @@
<div class="proposals-asearch container">
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3">
<div class="mb-3 col">
<div class="font-weight-bold mb-2">First name</div>
##firstname##
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">Last name</div>
##lastname##
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">[[Title#name]]</div>
[[Title]]
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">[[Status#name]]</div>
[[Status]]
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">[[Summary#name]]</div>
[[Summary]]
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">[[Content#name]]</div>
[[Content]]
</div>
</div>
</div>
@@ -0,0 +1,37 @@
<?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/>.
namespace datapreset_proposals\privacy;
/**
* Privacy provider implementation for datapreset_proposals.
*
* @package datapreset_proposals
* @copyright 2022 Sara Arjona <sara@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason(): string {
return 'privacy:metadata';
}
}
+18
View File
@@ -0,0 +1,18 @@
/****** List View CSS ******/
#proposals-list .card-header a.d-block {
color: black;
font-weight: bold;
}
#proposals-list .card {
overflow: visible;
}
/***** Add entry CSS *****/
.proposals-addentry .form-group label,
.proposals-asearch .form-group label {
font-weight: bold;
padding-top: 20px;
}
@@ -0,0 +1,28 @@
<?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/>.
/**
* Strings for component 'datapreset_proposals', language 'en'.
*
* @package datapreset_proposals
* @copyright 2022 Sara Arjona <sara@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['modulename'] = 'Proposals';
$string['modulename_help'] = 'Use this preset to collect proposals for topics, research, projects, etc. Fields include status such as approved, declined, revise or pending.';
$string['pluginname'] = 'Proposals';
$string['privacy:metadata'] = 'The Proposals plugin does not store any personal data.';
@@ -0,0 +1,25 @@
<div class="card">
<div class="card-header" role="tab" id="entry-##id##">
<div>
<div class="row align-middle">
<div class="col-4 col-sm-8 my-auto">
<a data-toggle="collapse" data-parent="#proposals-list" href="#collapseentry-##id##" aria-expanded="true" aria-controls="collapseentry-##id##" class="d-block">
<i class="fa fa-chevron-down"></i> [[Title]]
</a>
</div>
<div class="col-4 col-sm-2 ml-auto my-auto">##userpicture## ##user##</div>
<div class="col-4 col-sm-2 ml-auto align-self-center d-flex flex-row-reverse">
<div>##actionsmenu##</div>
<div class="ml-auto my-auto ##approvalstatusclass##">##approvalstatus##</div>
</div>
</div>
</div>
</div>
<div id="collapseentry-##id##" class="collapse" role="tabpanel" aria-labelledby="entry-##id##">
<div class="card-body">
[[Summary]]
<p class="mt-3 preview-disabled"><a href="##moreurl##">View the full proposal</a></p>
</div>
</div>
</div>
@@ -0,0 +1 @@
</div>
@@ -0,0 +1 @@
<div id="proposals-list" class="accordion mb-4" role="tablist" aria-multiselectable="true">
+48
View File
@@ -0,0 +1,48 @@
<preset>
<settings>
<intro></intro>
<comments>0</comments>
<requiredentries>0</requiredentries>
<requiredentriestoview>0</requiredentriestoview>
<maxentries>0</maxentries>
<rssarticles>0</rssarticles>
<approval>0</approval>
<manageapproved>1</manageapproved>
<defaultsortdir>0</defaultsortdir>
<defaultsort>0</defaultsort>
</settings>
<field>
<type>text</type>
<name>Title</name>
<required>0</required>
</field>
<field>
<type>menu</type>
<name>Status</name>
<required>0</required>
<param1>Approved
In review
Rejected
Pending</param1>
</field>
<field>
<type>text</type>
<name>Summary</name>
<required>0</required>
</field>
<field>
<type>textarea</type>
<name>Content</name>
<required>0</required>
<param2>60</param2>
<param3>10</param3>
<param4>1</param4>
<param5>0</param5>
</field>
</preset>
@@ -0,0 +1,40 @@
<div class="proposals-rss my-5">
<div class="row my-4">
<div class="col-auto">##userpicture##</div>
<div class="col">
<div class="row h-100">
<div class="col-3 align-self-center">
##user##<br/><span class="data-timeinfo">##timeadded##</span>
</div>
<div class="col-4 col-md-6 text-right align-self-center data-timeinfo">
<span class="font-weight-bold ">Last edited:</span> ##timemodified##
</div>
<div class="col-4 col-md-3 ml-auto align-self-center d-flex flex-row-reverse">
<div class="ml-auto my-auto ##approvalstatusclass##">##approvalstatus##</div>
</div>
</div>
</div>
</div>
<hr/>
<h2 class="card-title mt-4">[[Title]]</h2>
<div class="proposals-single-body">
<div class="row my-3">
<div class="col-3 col-md-1"><strong>[[Status#name]]</strong></div>
<div class="col">[[Status]]</div>
</div>
<div class="row singleentry-summary">
<div class="col">
<h3 class="my-5">[[Summary#name]]</h3>
[[Summary]]
</div>
</div>
<div class="row singleentry-content">
<div class="col">
<h3 class="my-5">[[Content#name]]</h3>
[[Content]]
</div>
</div>
</div>
</div>
@@ -0,0 +1 @@
[[Title]]
@@ -0,0 +1,44 @@
<div class="proposals-single my-5">
<div class="row my-4">
<div class="col-auto">##userpicture##</div>
<div class="col">
<div class="row h-100">
<div class="col-3 align-self-center">
##user##<br/><span class="data-timeinfo">##timeadded##</span>
</div>
<div class="col-4 col-md-6 text-right align-self-center data-timeinfo">
<span class="font-weight-bold ">Last edited:</span> ##timemodified##
</div>
<div class="col-4 col-md-3 ml-auto align-self-center d-flex flex-row-reverse">
<div>##actionsmenu##</div>
<div class="ml-auto my-auto ##approvalstatusclass##">##approvalstatus##</div>
</div>
</div>
</div>
</div>
<hr/>
<h2 class="card-title mt-4">[[Title]]</h2>
<div class="proposals-single-body">
<div class="row singleentry-status">
<div class="col">
<h3 class="my-5">[[Status#name]]</h3>
[[Status]]
</div>
</div>
<div class="row singleentry-summary">
<div class="col">
<h3 class="my-5">[[Summary#name]]</h3>
[[Summary]]
</div>
</div>
<div class="row singleentry-content">
<div class="col">
<h3 class="my-5">[[Content#name]]</h3>
[[Content]]
</div>
</div>
##otherfields##
</div>
</div>
@@ -0,0 +1,124 @@
@mod @mod_data @datapreset @datapreset_proposals
Feature: Users can use the Proposals preset
In order to create a Proposals database
As a user
I need to apply and use the Proposals preset
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Alice | Student | student1@example.com |
| teacher1 | Pau | Teacher | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| data | Student projects | Database intro | C1 | data1 |
And I am on the "Student projects" "data activity" page logged in as teacher1
And I follow "Presets"
And I click on "fullname" "radio" in the "Proposals" "table_row"
And I click on "Use this preset" "button"
And the following "mod_data > entries" exist:
| database | user | Title | Summary | Content | Status |
| data1 | student1 | Project created by student | Summary 1 | Content for entry 1 | Pending |
| data1 | teacher1 | Project created by teacher | Summary 2 | And content for entry 2 | Rejected |
@javascript
Scenario: Proposals. Users view entries
When I am on the "Student projects" "data activity" page logged in as student1
Then I should see "Project created by student"
And "Summary 1" "text" should exist
And "Actions" "icon" should exist in the "#proposals-list" "css_element"
And I should see "Project created by teacher"
And "Summary 2" "text" should exist
And I click on "Project created by student" "link"
And I click on "Project created by teacher" "link"
And I should see "Summary 1"
And I should not see "Content for entry 1"
And I should see "Summary 2"
And I should not see "And content for entry 2"
# Single view.
And I select "Single view" from the "jump" singleselect
And I should see "Project created by student"
And I should see "Summary 1"
And I should see "Content for entry 1"
And I should see "Pending"
And "Actions" "icon" should exist in the ".proposals-single" "css_element"
And I should not see "Project created by teacher"
And I should not see "Summary 2"
And I should not see "And content for entry 2"
And I should not see "Rejected"
And I follow "Next"
And I should see "Project created by teacher"
And I should see "Summary 2"
And I should see "And content for entry 2"
And I should see "Rejected"
# This student can't edit or delete this entry, so the Actions menu shouldn't be displayed.
And "Actions" "icon" should not exist in the ".proposals-single" "css_element"
And I should not see "Project created by student"
And I should not see "Summary 1"
And I should not see "Content for entry 1"
And I should not see "Pending"
@javascript
Scenario: Proposals. Users can search entries
Given I am on the "Student projects" "data activity" page logged in as student1
And "Project created by student" "text" should appear before "Project created by teacher" "text"
When I click on "Advanced search" "checkbox"
And I should see "First name"
And I should see "Last name"
And I set the field "Title" to "student"
And I click on "Save settings" "button" in the "data_adv_form" "region"
Then I should see "Project created by student"
And I should not see "Project created by teacher"
But I set the field "Title" to "Project"
And I set the field "Order" to "Descending"
And I click on "Save settings" "button" in the "data_adv_form" "region"
And "Project created by teacher" "text" should appear before "Project created by student" "text"
@javascript
Scenario: Proposals. Users can add entries
Given I am on the "Student projects" "data activity" page logged in as student1
When I press "Add entry"
And I set the field "Title" to "This is the title"
And I set the field "Summary" to "This is the summary for the new entry."
And I set the field "Content" to "This is the content for the new entry."
And I set the field "Status" to "Approved"
And I press "Save"
Then I should see "This is the title"
And I should see "Approved"
And I should see "This is the summary for the new entry."
And I should see "This is the content for the new entry."
@javascript
Scenario: Proposals. Renaming a field should affect the template
Given I am on the "Student projects" "data activity" page logged in as teacher1
And I navigate to "Fields" in current page administration
And I open the action menu in "Summary" "table_row"
And I choose "Edit" in the open action menu
And I set the field "Field name" to "Edited field name"
And I press "Save"
And I should see "Field updated"
When I navigate to "Database" in current page administration
Then I click on "Advanced search" "checkbox"
And I should see "Edited field name"
And I select "Single view" from the "jump" singleselect
And I should see "Edited field name"
And I click on "Add entry" "button"
And I should see "Edited field name"
@javascript
Scenario: Proposals. Has otherfields tag
Given the following "mod_data > fields" exist:
| database | type | name | description |
| data1 | text | Extra field | Test field description |
And I am on the "Student projects" "data activity" page logged in as teacher1
When I select "Single view" from the "jump" singleselect
Then I should see "Extra field"
And I click on "Add entry" "button"
And I should see "Extra field"
+29
View File
@@ -0,0 +1,29 @@
<?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/>.
/**
* Data Proposals preset version information.
*
* @package datapreset_proposals
* @copyright 2022 Sara Arjona <sara@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2024042200; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2024041600; // Requires this Moodle version.
$plugin->component = 'datapreset_proposals'; // Full name of the plugin (used for diagnostics).
@@ -0,0 +1,27 @@
<div class="resources-addentry">
<div class="mb-3">
<div class="font-weight-bold">[[Title#name]]</div>
[[Title]]
</div>
<div class="mb-3">
<div class="font-weight-bold">Author of resource</div>
[[Author]]
</div>
<div class="mb-3">
<div class="font-weight-bold">[[Cover#name]]</div>
[[Cover]]
</div>
<div class="mb-3">
<div class="font-weight-bold">Content</div>
[[Description]]
</div>
<div class="mb-3">
<div class="font-weight-bold">[[Web link#name]]</div>
[[Web link]]
</div>
<div class="mb-3">
<div class="font-weight-bold">[[Type#name]]</div>
[[Type]]
</div>
##otherfields##
</div>
@@ -0,0 +1,33 @@
<div class="resources-asearch container">
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3">
<div class="mb-3 col">
<div class="font-weight-bold mb-2">First name</div>
##firstname##
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">Last name</div>
##lastname##
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">[[Title#name]]</div>
[[Title]]
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">Author of resource</div>
[[Author]]
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">Content</div>
[[Description]]
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">[[Web link#name]]</div>
[[Web link]]
</div>
<div class="mb-3 col">
<div class="font-weight-bold mb-2">[[Type#name]]</div>
[[Type]]
</div>
</div>
</div>
@@ -0,0 +1,37 @@
<?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/>.
namespace datapreset_resources\privacy;
/**
* Privacy provider implementation for datapreset_resources.
*
* @package datapreset_resources
* @copyright 2022 Sara Arjona <sara@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason(): string {
return 'privacy:metadata';
}
}
+14
View File
@@ -0,0 +1,14 @@
/****** Single View CSS ******/
.resources-single .img-wrapper img {
flex-shrink: 0;
width: 200px;
}
/***** Add entry CSS *****/
.resources-addentry .form-group label,
.resources-asearch .form-group label {
font-weight: bold;
padding-top: 20px;
}
@@ -0,0 +1,28 @@
<?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/>.
/**
* Strings for component 'datapreset_resources', language 'en'.
*
* @package datapreset_resources
* @copyright 2022 Sara Arjona <sara@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['modulename'] = 'Resources';
$string['modulename_help'] = 'Collect resources such as web links or book reviews in a table, with links to the detailed view.';
$string['pluginname'] = 'Resources';
$string['privacy:metadata'] = 'The Resources plugin does not store any personal data.';
@@ -0,0 +1,8 @@
<tr>
<th scope="row"><a href="##moreurl##">[[Title]]</a></th>
<td class="d-none d-md-table-cell">[[Type]]</td>
<td class="d-none d-md-table-cell">[[Author]]</td>
<td>[[Web link]]</td>
<td><div class="##approvalstatusclass##">##approvalstatus##</div></td>
<td>##actionsmenu##</td>
</tr>
@@ -0,0 +1,2 @@
</tbody>
</table>
@@ -0,0 +1,12 @@
<table id="resources-list" class="table table-striped">
<thead>
<tr>
<th scope="col">Title</th>
<th class="d-none d-md-table-cell" scope="col">Type</th>
<th class="d-none d-md-table-cell" scope="col">Author of resource</th>
<th scope="col">Link</th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
+62
View File
@@ -0,0 +1,62 @@
<preset>
<settings>
<intro></intro>
<comments>0</comments>
<requiredentries>0</requiredentries>
<requiredentriestoview>0</requiredentriestoview>
<maxentries>0</maxentries>
<rssarticles>0</rssarticles>
<approval>0</approval>
<manageapproved>1</manageapproved>
<defaultsortdir>0</defaultsortdir>
<defaultsort>0</defaultsort>
</settings>
<field>
<type>text</type>
<name>Title</name>
<required>0</required>
</field>
<field>
<type>text</type>
<name>Author</name>
<required>0</required>
</field>
<field>
<type>picture</type>
<name>Cover</name>
<required>0</required>
<param3>0</param3>
</field>
<field>
<type>textarea</type>
<name>Description</name>
<required>0</required>
<param2>60</param2>
<param3>10</param3>
<param4>1</param4>
<param5>0</param5>
</field>
<field>
<type>url</type>
<name>Web link</name>
<required>0</required>
<param1>1</param1>
<param3>1</param3>
</field>
<field>
<type>menu</type>
<name>Type</name>
<required>0</required>
<param1>Type1
Type2
Type3</param1>
</field>
</preset>
@@ -0,0 +1,48 @@
<div class="resources-rss my-5">
<div class="row my-4">
<div class="col-auto">##userpicture##</div>
<div class="col">
<div class="row h-100">
<div class="col-3 align-self-center">
##user##<br/><span class="data-timeinfo">##timeadded##</span>
</div>
<div class="col-4 col-md-6 text-right align-self-center data-timeinfo">
<span class="font-weight-bold ">Last edited:</span> ##timemodified##
</div>
<div class="col-4 col-md-3 ml-auto align-self-center d-flex flex-row-reverse">
<div class="ml-auto my-auto ##approvalstatusclass##">##approvalstatus##</div>
</div>
</div>
</div>
</div>
<hr/>
<h2 class="card-title mt-4">[[Title]]</h2>
<div class="resources-single-body my-5">
<div class="d-flex flex-column flex-md-row">
<div class="single-entry-header w-100 pr-2">
<div class="row my-3">
<div class="col-3 col-md-1"><strong>Author of resource</strong></div>
<div class="col-9 col-md-11">[[Author]]</div>
</div>
<div class="row my-3">
<div class="col-3 col-md-1"><strong>[[Type#name]]</strong></div>
<div class="col-9 col-md-11">[[Type]]</div>
</div>
<div class="row my-3">
<div class="col-3 col-md-1"><strong>Link</strong></div>
<div class="col-9 col-md-11">[[Web link]]</div>
</div>
</div>
<div class="img-wrapper">[[Cover]]</div>
</div>
<div class="row singleentry-content">
<div class="col">
<h3 class="my-5">Content</h3>
[[Description]]
</div>
</div>
</div>
</div>
@@ -0,0 +1 @@
[[Title]]
@@ -0,0 +1,50 @@
<div class="resources-single my-5">
<div class="row my-4">
<div class="col-auto">##userpicture##</div>
<div class="col">
<div class="row h-100">
<div class="col-3 align-self-center">
##user##<br/><span class="data-timeinfo">##timeadded##</span>
</div>
<div class="col-4 col-md-6 text-right align-self-center data-timeinfo">
<span class="font-weight-bold ">Last edited:</span> ##timemodified##
</div>
<div class="col-4 col-md-3 ml-auto align-self-center d-flex flex-row-reverse">
<div>##actionsmenu##</div>
<div class="ml-auto my-auto ##approvalstatusclass##">##approvalstatus##</div>
</div>
</div>
</div>
</div>
<hr/>
<h2 class="card-title mt-4">[[Title]]</h2>
<div class="resources-single-body my-5">
<div class="d-flex flex-column flex-md-row">
<div class="single-entry-header w-100 pr-2">
<div class="row my-3">
<div class="col-3 col-md-2 font-weight-bold">Author of resource</div>
<div class="col-9 col-md-auto">[[Author]]</div>
</div>
<div class="row my-3">
<div class="col-3 col-md-2 font-weight-bold">[[Type#name]]</div>
<div class="col-9 col-md-auto">[[Type]]</div>
</div>
<div class="row my-3">
<div class="col-3 col-md-2 font-weight-bold">Link</div>
<div class="col-9 col-md-auto">[[Web link]]</div>
</div>
</div>
<div class="img-wrapper">[[Cover]]</div>
</div>
<div class="row singleentry-content">
<div class="col">
<h3 class="my-5">Content</h3>
[[Description]]
</div>
</div>
##otherfields##
</div>
</div>
@@ -0,0 +1,127 @@
@mod @mod_data @datapreset @datapreset_resources
Feature: Users can use the Resources preset
In order to create a Resources database
As a user
I need to apply and use the Resources preset
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Alice | Student | student1@example.com |
| teacher1 | Pau | Teacher | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| data | Student resources | Database intro | C1 | data1 |
And I am on the "Student resources" "data activity" page logged in as teacher1
And I follow "Presets"
And I click on "fullname" "radio" in the "Resources" "table_row"
And I click on "Use this preset" "button"
And the following "mod_data > entries" exist:
| database | user | Title | Description | Type | Author | Web link | Cover |
| data1 | student1 | My favourite book | Book content | Type1 | The book author | http://myfavouritebook.cat | first.png |
| data1 | teacher1 | My favourite podcast | Podcast content| Type2 | The podcast author | http://myfavouritepodcast.cat | second.png |
@javascript
Scenario: Resources. Users view entries
When I am on the "Student resources" "data activity" page logged in as student1
Then I should see "My favourite book"
And I should see "Type1"
And I should see "The book author"
And I should see "http://myfavouritebook.cat"
And I should not see "Book content"
And "Actions" "icon" should exist in the "#resources-list" "css_element"
And I should see "My favourite podcast"
And I should see "Type2"
And I should see "The podcast author"
And I should see "http://myfavouritepodcast.cat"
And I should not see "Podcast content"
# Single view.
And I select "Single view" from the "jump" singleselect
And I should see "My favourite book"
And I should see "Type1"
And I should see "The book author"
And I should see "http://myfavouritebook.cat"
And I should see "Book content"
And "Actions" "icon" should exist in the ".resources-single" "css_element"
And I should not see "My favourite podcast"
And I should not see "Type2"
And I should not see "The podcast author"
And I should not see "http://myfavouritepodcast.cat"
And I should not see "Podcast content"
And I follow "Next"
And I should see "My favourite podcast"
And I should see "Type2"
And I should see "The podcast author"
And I should see "http://myfavouritepodcast.cat"
And I should see "Podcast content"
# This student can't edit or delete this entry, so the Actions menu shouldn't be displayed.
And "Actions" "icon" should not exist in the ".resources-single" "css_element"
And I should not see "My favourite book"
And I should not see "Type1"
And I should not see "The book author"
And I should not see "http://myfavouritebook.cat"
And I should not see "Book content"
@javascript
Scenario: Resources. Users can search entries
Given I am on the "Student resources" "data activity" page logged in as student1
And "My favourite book" "text" should appear before "My favourite podcast" "text"
When I click on "Advanced search" "checkbox"
And I should see "First name"
And I should see "Last name"
And I set the field "Title" to "book"
And I click on "Save settings" "button" in the "data_adv_form" "region"
Then I should see "My favourite book"
And I should not see "My favourite podcast"
But I set the field "Title" to "favourite"
And I set the field "Order" to "Descending"
And I click on "Save settings" "button" in the "data_adv_form" "region"
And "My favourite podcast" "text" should appear before "My favourite book" "text"
@javascript
Scenario: Resources. Users can add entries
Given I am on the "Student resources" "data activity" page logged in as student1
When I press "Add entry"
And I set the field "Title" to "This is the title"
And I set the field "Author" to "This is the author"
And I set the field "Description" to "This is description."
And I set the field "Web link" to "https://thisisthelink.cat"
And I set the field "Type" to "Type2"
And I press "Save"
Then I should see "This is the title"
And I should see "This is the author"
And I should see "https://thisisthelink.cat"
And I should see "Type2"
@javascript
Scenario: Resources. Renaming a field should affect the template
Given I am on the "Student resources" "data activity" page logged in as teacher1
And I navigate to "Fields" in current page administration
And I open the action menu in "Type" "table_row"
And I choose "Edit" in the open action menu
And I set the field "Field name" to "Edited field name"
And I press "Save"
And I should see "Field updated"
When I navigate to "Database" in current page administration
Then I click on "Advanced search" "checkbox"
And I should see "Edited field name"
And I click on "Add entry" "button"
And I should see "Edited field name"
@javascript
Scenario: Resources. Has otherfields tag
Given the following "mod_data > fields" exist:
| database | type | name | description |
| data1 | text | Extra field | Test field description |
And I am on the "Student resources" "data activity" page logged in as teacher1
When I select "Single view" from the "jump" singleselect
Then I should see "Extra field"
And I click on "Add entry" "button"
And I should see "Extra field"
+29
View File
@@ -0,0 +1,29 @@
<?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/>.
/**
* Data Resources preset version information.
*
* @package datapreset_resources
* @copyright 2022 Sara Arjona <sara@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2024042200; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2024041600; // Requires this Moodle version.
$plugin->component = 'datapreset_resources'; // Full name of the plugin (used for diagnostics).