Merge branch 'MDL-68793-master' of git://github.com/lameze/moodle

This commit is contained in:
Andrew Nicols
2020-06-02 11:56:31 +08:00
7 changed files with 19 additions and 20 deletions
+3 -3
View File
@@ -2764,10 +2764,10 @@ $functions = array(
'capabilities' => '',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE],
],
'core_table_dynamic_fetch' => [
'classname' => 'core_table\external\dynamic\fetch',
'core_table_get_dynamic_table_content' => [
'classname' => 'core_table\external\dynamic\get',
'methodname' => 'execute',
'description' => 'Fetch a dynamic table view raw html',
'description' => 'Get the dynamic table content raw html',
'type' => 'read',
'ajax' => true,
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE],
+1 -1
View File
@@ -1,2 +1,2 @@
define ("core_table/local/dynamic/repository",["exports","core/ajax"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.fetch=void 0;a.fetch=function fetch(a,c,d){var e=3<arguments.length&&arguments[3]!==void 0?arguments[3]:{},f=e.sortData,g=void 0===f?[]:f,h=e.joinType,i=void 0===h?null:h,j=e.filters,k=void 0===j?{}:j,l=e.firstinitial,m=void 0===l?null:l,n=e.lastinitial,o=void 0===n?null:n,p=e.pageNumber,q=void 0===p?null:p,r=e.pageSize,s=void 0===r?null:r,t=e.hiddenColumns,u=void 0===t?{}:t,v=4<arguments.length&&arguments[4]!==void 0?arguments[4]:!1;return(0,b.call)([{methodname:"core_table_dynamic_fetch",args:{component:a,handler:c,uniqueid:d,sortdata:g,jointype:i,filters:k,firstinitial:m,lastinitial:o,pagenumber:q,pagesize:s,hiddencolumns:u,resetpreferences:v}}])[0]}});
define ("core_table/local/dynamic/repository",["exports","core/ajax"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.fetch=void 0;a.fetch=function fetch(a,c,d){var e=3<arguments.length&&arguments[3]!==void 0?arguments[3]:{},f=e.sortData,g=void 0===f?[]:f,h=e.joinType,i=void 0===h?null:h,j=e.filters,k=void 0===j?{}:j,l=e.firstinitial,m=void 0===l?null:l,n=e.lastinitial,o=void 0===n?null:n,p=e.pageNumber,q=void 0===p?null:p,r=e.pageSize,s=void 0===r?null:r,t=e.hiddenColumns,u=void 0===t?{}:t,v=4<arguments.length&&arguments[4]!==void 0?arguments[4]:!1;return(0,b.call)([{methodname:"core_table_get_dynamic_table_content",args:{component:a,handler:c,uniqueid:d,sortdata:g,jointype:i,filters:k,firstinitial:m,lastinitial:o,pagenumber:q,pagesize:s,hiddencolumns:u,resetpreferences:v}}])[0]}});
//# sourceMappingURL=repository.min.js.map
@@ -1 +1 @@
{"version":3,"sources":["../../../src/local/dynamic/repository.js"],"names":["fetch","component","handler","uniqueid","sortData","joinType","filters","firstinitial","lastinitial","pageNumber","pageSize","hiddenColumns","resetPreferences","methodname","args","sortdata","jointype","pagenumber","pagesize","hiddencolumns","resetpreferences"],"mappings":"yKA6CqB,QAARA,CAAAA,KAAQ,CAACC,CAAD,CAAYC,CAAZ,CAAqBC,CAArB,CASoB,8DAAjC,EAAiC,KARjCC,QAQiC,CARjCA,CAQiC,YARtB,EAQsB,OAPjCC,QAOiC,CAPjCA,CAOiC,YAPtB,IAOsB,OANjCC,OAMiC,CANjCA,CAMiC,YANvB,EAMuB,OALjCC,YAKiC,CALjCA,CAKiC,YALlB,IAKkB,OAJjCC,WAIiC,CAJjCA,CAIiC,YAJnB,IAImB,OAHjCC,UAGiC,CAHjCA,CAGiC,YAHpB,IAGoB,OAFjCC,QAEiC,CAFjCA,CAEiC,YAFtB,IAEsB,OADjCC,aACiC,CADjCA,CACiC,YADjB,EACiB,GAA7BC,CAA6B,2DACrC,MAAO,WAAU,CAAC,CACdC,UAAU,2BADI,CAEdC,IAAI,CAAE,CACFb,SAAS,CAATA,CADE,CAEFC,OAAO,CAAPA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFY,QAAQ,CAAEX,CAJR,CAKFY,QAAQ,CAAEX,CALR,CAMFC,OAAO,CAAPA,CANE,CAOFC,YAAY,CAAZA,CAPE,CAQFC,WAAW,CAAXA,CARE,CASFS,UAAU,CAAER,CATV,CAUFS,QAAQ,CAAER,CAVR,CAWFS,aAAa,CAAER,CAXb,CAYFS,gBAAgB,CAAER,CAZhB,CAFQ,CAAD,CAAV,EAgBH,CAhBG,CAiBV,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * A javascript module to handle calendar ajax actions.\n *\n * @module core_calendar/repository\n * @class repository\n * @package core_calendar\n * @copyright 2017 Simey Lameze <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport {call as fetchMany} from 'core/ajax';\n\n/**\n * Fetch table view.\n *\n * @method fetch\n * @param {String} component The component\n * @param {String} handler The name of the handler\n * @param {String} uniqueid The unique id of the table\n * @param {Object} options The options to use when updating the table\n * @param {Array} options.sortData The list of columns to sort by\n * @param {Number} options.joinType The filterset join type\n * @param {Object} options.filters The filters to apply when searching\n * @param {String} options.firstinitial The first name initial to filter on\n * @param {String} options.lastinitial The last name initial to filter on\n * @param {String} options.pageNumber The page number\n * @param {Number} options.pageSize The page size\n * @param {Object} options.hiddenColumns The columns to hide\n * @param {Bool} resetPreferences\n * @return {Promise} Resolved with requested table view\n */\nexport const fetch = (component, handler, uniqueid, {\n sortData = [],\n joinType = null,\n filters = {},\n firstinitial = null,\n lastinitial = null,\n pageNumber = null,\n pageSize = null,\n hiddenColumns = {}\n } = {}, resetPreferences = false) => {\n return fetchMany([{\n methodname: `core_table_dynamic_fetch`,\n args: {\n component,\n handler,\n uniqueid,\n sortdata: sortData,\n jointype: joinType,\n filters,\n firstinitial,\n lastinitial,\n pagenumber: pageNumber,\n pagesize: pageSize,\n hiddencolumns: hiddenColumns,\n resetpreferences: resetPreferences\n },\n }])[0];\n};\n"],"file":"repository.min.js"}
{"version":3,"sources":["../../../src/local/dynamic/repository.js"],"names":["fetch","component","handler","uniqueid","sortData","joinType","filters","firstinitial","lastinitial","pageNumber","pageSize","hiddenColumns","resetPreferences","methodname","args","sortdata","jointype","pagenumber","pagesize","hiddencolumns","resetpreferences"],"mappings":"yKA6CqB,QAARA,CAAAA,KAAQ,CAACC,CAAD,CAAYC,CAAZ,CAAqBC,CAArB,CASoB,8DAAjC,EAAiC,KARjCC,QAQiC,CARjCA,CAQiC,YARtB,EAQsB,OAPjCC,QAOiC,CAPjCA,CAOiC,YAPtB,IAOsB,OANjCC,OAMiC,CANjCA,CAMiC,YANvB,EAMuB,OALjCC,YAKiC,CALjCA,CAKiC,YALlB,IAKkB,OAJjCC,WAIiC,CAJjCA,CAIiC,YAJnB,IAImB,OAHjCC,UAGiC,CAHjCA,CAGiC,YAHpB,IAGoB,OAFjCC,QAEiC,CAFjCA,CAEiC,YAFtB,IAEsB,OADjCC,aACiC,CADjCA,CACiC,YADjB,EACiB,GAA7BC,CAA6B,2DACrC,MAAO,WAAU,CAAC,CACdC,UAAU,uCADI,CAEdC,IAAI,CAAE,CACFb,SAAS,CAATA,CADE,CAEFC,OAAO,CAAPA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFY,QAAQ,CAAEX,CAJR,CAKFY,QAAQ,CAAEX,CALR,CAMFC,OAAO,CAAPA,CANE,CAOFC,YAAY,CAAZA,CAPE,CAQFC,WAAW,CAAXA,CARE,CASFS,UAAU,CAAER,CATV,CAUFS,QAAQ,CAAER,CAVR,CAWFS,aAAa,CAAER,CAXb,CAYFS,gBAAgB,CAAER,CAZhB,CAFQ,CAAD,CAAV,EAgBH,CAhBG,CAiBV,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * A javascript module to handle calendar ajax actions.\n *\n * @module core_calendar/repository\n * @class repository\n * @package core_calendar\n * @copyright 2017 Simey Lameze <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport {call as fetchMany} from 'core/ajax';\n\n/**\n * Fetch table view.\n *\n * @method fetch\n * @param {String} component The component\n * @param {String} handler The name of the handler\n * @param {String} uniqueid The unique id of the table\n * @param {Object} options The options to use when updating the table\n * @param {Array} options.sortData The list of columns to sort by\n * @param {Number} options.joinType The filterset join type\n * @param {Object} options.filters The filters to apply when searching\n * @param {String} options.firstinitial The first name initial to filter on\n * @param {String} options.lastinitial The last name initial to filter on\n * @param {String} options.pageNumber The page number\n * @param {Number} options.pageSize The page size\n * @param {Object} options.hiddenColumns The columns to hide\n * @param {Bool} resetPreferences\n * @return {Promise} Resolved with requested table view\n */\nexport const fetch = (component, handler, uniqueid, {\n sortData = [],\n joinType = null,\n filters = {},\n firstinitial = null,\n lastinitial = null,\n pageNumber = null,\n pageSize = null,\n hiddenColumns = {}\n } = {}, resetPreferences = false) => {\n return fetchMany([{\n methodname: `core_table_get_dynamic_table_content`,\n args: {\n component,\n handler,\n uniqueid,\n sortdata: sortData,\n jointype: joinType,\n filters,\n firstinitial,\n lastinitial,\n pagenumber: pageNumber,\n pagesize: pageSize,\n hiddencolumns: hiddenColumns,\n resetpreferences: resetPreferences\n },\n }])[0];\n};\n"],"file":"repository.min.js"}
@@ -54,7 +54,7 @@ export const fetch = (component, handler, uniqueid, {
hiddenColumns = {}
} = {}, resetPreferences = false) => {
return fetchMany([{
methodname: `core_table_dynamic_fetch`,
methodname: `core_table_get_dynamic_table_content`,
args: {
component,
handler,
@@ -31,7 +31,6 @@ use external_multiple_structure;
use external_single_structure;
use external_value;
use external_warnings;
use moodle_url;
/**
* Core table external functions.
@@ -41,7 +40,7 @@ use moodle_url;
* @copyright 2020 Simey Lameze <simey@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class fetch extends external_api {
class get extends external_api {
/**
* Describes the parameters for fetching the table html.
@@ -140,7 +139,7 @@ class fetch extends external_api {
}
/**
* External function to fetch a table view.
* External function to get the table view content.
*
* @param string $component The component.
* @param string $handler Dynamic table class name.
@@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for core_table\external\fetch;
* Unit tests for core_table\external\dynamic\get;
*
* @package core_table
* @category test
@@ -31,14 +31,14 @@ use core_table\local\filter\filter;
use advanced_testcase;
/**
* Unit tests for core_table\external\fetch;
* Unit tests for core_table\external\dynamic\get;
*
* @package core_table
* @category test
* @copyright 2020 Simey Lameze <simey@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class fetch_test extends advanced_testcase {
class get_test extends advanced_testcase {
/**
* Setup before class.
@@ -55,7 +55,7 @@ class fetch_test extends advanced_testcase {
$this->resetAfterTest();
$this->expectException(\invalid_parameter_exception::class);
fetch::execute(
get::execute(
"core-user",
"participants",
"",
@@ -79,7 +79,7 @@ class fetch_test extends advanced_testcase {
$this->resetAfterTest();
$this->expectException(\UnexpectedValueException::class);
fetch::execute(
get::execute(
"core_users",
"participants",
"",
@@ -106,7 +106,7 @@ class fetch_test extends advanced_testcase {
$this->expectExceptionMessage("Table handler class {$handler} not found. Please make sure that your table handler class is under the \\core_user\\table namespace.");
// Tests that invalid users_participants_table class gets an exception.
fetch::execute(
get::execute(
"core_user",
"users_participants_table",
"",
@@ -143,7 +143,7 @@ class fetch_test extends advanced_testcase {
$this->expectExceptionMessage("Invalid parameter value detected (filters => Invalid parameter value detected " .
"(Missing required key in single structure: name): Missing required key in single structure: name");
fetch::execute(
get::execute(
"core_user",
"participants", "user-index-participants-{$course->id}",
$this->get_sort_array(['firstname' => SORT_ASC]),
@@ -153,9 +153,9 @@ class fetch_test extends advanced_testcase {
}
/**
* Test execute fetch table.
* Test execute method.
*/
public function test_execute_fetch_table(): void {
public function test_table_get_execute(): void {
$this->resetAfterTest();
$course = $this->getDataGenerator()->create_course();
@@ -176,7 +176,7 @@ class fetch_test extends advanced_testcase {
]
];
$participantstable = fetch::execute(
$participantstable = get::execute(
"core_user",
"participants",
"user-index-participants-{$course->id}",
+1 -1
View File
@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2020052900.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2020052900.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '3.9dev+ (Build: 20200529)'; // Human-friendly version name