Proyectos de Subversion Moodle

Rev

Rev 1 | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

{"version":3,"file":"user.min.js","sources":["../src/user.js"],"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 * Allow the user to search for learners within the grader report.\n *\n * @module    gradereport_grader/user\n * @copyright 2023 Mathew May <mathew.solutions>\n * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport UserSearch from 'core_user/comboboxsearch/user';\nimport * as Repository from 'gradereport_grader/local/user/repository';\n\n// Define our standard lookups.\nconst selectors = {\n    component: '.user-search',\n    courseid: '[data-region=\"courseid\"]',\n};\nconst component = document.querySelector(selectors.component);\nconst courseID = component.querySelector(selectors.courseid).dataset.courseid;\n\nexport default class User extends UserSearch {\n\n    /**\n     * Construct the class.\n     * @param {string} baseUrl The base URL for the page.\n     */\n    constructor(baseUrl) {\n        super();\n        this.baseUrl = baseUrl;\n    }\n\n    static init(baseUrl) {\n        return new User(baseUrl);\n    }\n\n    /**\n     * Get the data we will be searching against in this component.\n     *\n     * @returns {Promise<*>}\n     */\n    fetchDataset() {\n        return Repository.userFetch(courseID).then((r) => r.users);\n    }\n\n    /**\n     * Build up the view all link.\n     *\n     * @returns {string|*}\n     */\n    selectAllResultsLink() {\n        const url = new URL(this.baseUrl);\n        url.searchParams.set('gpr_search', this.getSearchTerm());\n        return url.toString();\n    }\n\n    /**\n     * Build up the link that is dedicated to a particular result.\n     *\n     * @param {Number} userID The ID of the user selected.\n     * @returns {string|*}\n     */\n    selectOneLink(userID) {\n        const url = new URL(this.baseUrl);\n        url.searchParams.set('gpr_search', this.getSearchTerm());\n        url.searchParams.set('gpr_userid', userID);\n        return url.toString();\n    }\n}\n"],"names":["selectors","courseID","document","querySelector","dataset","courseid","User","UserSearch","constructor","baseUrl","fetchDataset","Repository","userFetch","then","r","users","selectAllResultsLink","url","URL","this","searchParams","set","getSearchTerm","toString","selectOneLink","userID"],"mappings":";;;;;;;skCA0BMA,oBACS,eADTA,mBAEQ,2BAGRC,SADYC,SAASC,cAAcH,qBACdG,cAAcH,oBAAoBI,QAAQC,eAEhDC,aAAaC,cAM9BC,YAAYC,sBAEHA,QAAUA,oBAGPA,gBACD,IAAIH,KAAKG,SAQpBC,sBACWC,WAAWC,UAAUX,UAAUY,MAAMC,GAAMA,EAAEC,QAQxDC,6BACUC,IAAM,IAAIC,IAAIC,KAAKV,gBACzBQ,IAAIG,aAAaC,IAAI,aAAcF,KAAKG,iBACjCL,IAAIM,WASfC,cAAcC,cACJR,IAAM,IAAIC,IAAIC,KAAKV,gBACzBQ,IAAIG,aAAaC,IAAI,aAAcF,KAAKG,iBACxCL,IAAIG,aAAaC,IAAI,aAAcI,QAC5BR,IAAIM"}