Your IP : 192.168.165.1


Current Path : C:/Users/Mahmood/Desktop/moodle/user/amd/build/
Upload File :
Current File : C:/Users/Mahmood/Desktop/moodle/user/amd/build/participants.min.js.map

{"version":3,"sources":["../src/participants.js"],"names":["Selectors","bulkActionSelect","bulkUserSelectedCheckBoxes","checkCountButton","showCountText","showCountToggle","stateHelpIcon","tableForm","uniqueId","init","uniqueid","noteStateNames","root","document","querySelector","getTableFromUniqueId","DynamicTableSelectors","main","fromRegionId","registerEventListeners","CustomEvents","define","events","accessibleChange","on","e","target","closest","action","value","tableRoot","checkboxes","querySelectorAll","pendingPromise","Pending","indexOf","preventDefault","ids","forEach","checkbox","push","getAttribute","replace","bulkAction","dataset","courseId","pendingBulkAction","then","modal","getRoot","ModalEvents","hidden","focus","resolve","catch","Notification","exception","length","form","submit","resetBulkAction","addEventListener","showCountLink","showCountLinkClicked","contains","checkCountButtonClicked","DynamicTable","setPageSize","targetPageSize","CheckboxToggleAll","setGroupState","Events","tableContentRefreshed","defaultPageSize","parseInt","tableDefaultPerPage","currentPageSize","tablePageSize","totalRowCount","tableTotalRows","updateSlavesFromMasterState","pageCountStrings","key","component","param","classList","add","remove","Str","get_strings","showingParticipantCountString","showCountString","selectCountString","showingParticipantCount","innerHTML"],"mappings":"uqBAyBA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,O,wjDAGMA,CAAAA,CAAS,CAAG,CACdC,gBAAgB,CAAE,eADJ,CAEdC,0BAA0B,CAAE,2EAFd,CAGdC,gBAAgB,CAAE,WAHJ,CAIdC,aAAa,CAAE,qCAJD,CAKdC,eAAe,CAAE,6BALH,CAMdC,aAAa,CAAE,mCAND,CAOdC,SAAS,CAAE,mBAAAC,CAAQ,8CAAkCA,CAAlC,QAPL,C,QAUE,QAAPC,CAAAA,IAAO,GAGd,IAFFC,CAAAA,CAEE,GAFFA,QAEE,KADFC,cACE,CADFA,CACE,YADe,EACf,GACIC,CAAI,CAAGC,QAAQ,CAACC,aAAT,CAAuBd,CAAS,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,SAAxB,CAAoCJ,CAApC,CAEA,GAAIC,CAAJ,CAAqB,CACjB7B,CAAa,CAACgC,SAAd,CAA0BH,CAC7B,CAED,GAAIC,CAAiB,EAAIzF,CAAzB,CAA2C,CACvCA,CAAgB,CAAC0B,KAAjB,CAAyB+D,CAC5B,CAGJ,CAdD,EAeCtC,KAfD,CAeOC,UAAaC,SAfpB,CAgBH,CAxFD,CAyFH,CAhLC,CAkLII,CAAe,CAAG,SAAA3D,CAAgB,CAAI,CACxCA,CAAgB,CAAC4B,KAAjB,CAAyB,EAC5B,CApLC,CAsLFV,CAAsB,EACzB,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 * Some UI stuff for participants page.\n * This is also used by the report/participants/index.php because it has the same functionality.\n *\n * @module     core_user/participants\n * @package    core_user\n * @copyright  2017 Damyon Wiese\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport * as DynamicTable from 'core_table/dynamic';\nimport * as Str from 'core/str';\nimport CheckboxToggleAll from 'core/checkbox-toggleall';\nimport CustomEvents from 'core/custom_interaction_events';\nimport DynamicTableSelectors from 'core_table/local/dynamic/selectors';\nimport ModalEvents from 'core/modal_events';\nimport Notification from 'core/notification';\nimport Pending from 'core/pending';\nimport jQuery from 'jquery';\nimport {showAddNote, showSendMessage} from 'core_user/local/participants/bulkactions';\n\nconst Selectors = {\n    bulkActionSelect: \"#formactionid\",\n    bulkUserSelectedCheckBoxes: \"input[data-togglegroup='participants-table'][data-toggle='slave']:checked\",\n    checkCountButton: \"#checkall\",\n    showCountText: '[data-region=\"participant-count\"]',\n    showCountToggle: '[data-action=\"showcount\"]',\n    stateHelpIcon: '[data-region=\"state-help-icon\"]',\n    tableForm: uniqueId => `form[data-table-unique-id=\"${uniqueId}\"]`,\n};\n\nexport const init = ({\n    uniqueid,\n    noteStateNames = {},\n}) => {\n    const root = document.querySelector(Selectors.tableForm(uniqueid));\n    const getTableFromUniqueId = uniqueId => root.querySelector(DynamicTableSelectors.main.fromRegionId(uniqueId));\n\n    /**\n     * Private method.\n     *\n     * @method registerEventListeners\n     * @private\n     */\n    const registerEventListeners = () => {\n        CustomEvents.define(Selectors.bulkActionSelect, [CustomEvents.events.accessibleChange]);\n        jQuery(Selectors.bulkActionSelect).on(CustomEvents.events.accessibleChange, e => {\n            const bulkActionSelect = e.target.closest('select');\n            const action = bulkActionSelect.value;\n            const tableRoot = getTableFromUniqueId(uniqueid);\n            const checkboxes = tableRoot.querySelectorAll(Selectors.bulkUserSelectedCheckBoxes);\n            const pendingPromise = new Pending('core_user/participants:bulkActionSelect');\n\n            if (action.indexOf('#') !== -1) {\n                e.preventDefault();\n\n                const ids = [];\n                checkboxes.forEach(checkbox => {\n                    ids.push(checkbox.getAttribute('name').replace('user', ''));\n                });\n\n                let bulkAction;\n                if (action === '#messageselect') {\n                    bulkAction = showSendMessage(ids);\n                } else if (action === '#addgroupnote') {\n                    bulkAction = showAddNote(\n                        root.dataset.courseId,\n                        ids,\n                        noteStateNames,\n                        root.querySelector(Selectors.stateHelpIcon)\n                    );\n                }\n\n                if (bulkAction) {\n                    const pendingBulkAction = new Pending('core_user/participants:bulkActionSelected');\n                    bulkAction\n                    .then(modal => {\n                        modal.getRoot().on(ModalEvents.hidden, () => {\n                            // Focus on the action select when the dialog is closed.\n                            bulkActionSelect.focus();\n                        });\n\n                        pendingBulkAction.resolve();\n                        return modal;\n                    })\n                    .catch(Notification.exception);\n                }\n            } else if (action !== '' && checkboxes.length) {\n                bulkActionSelect.form.submit();\n            }\n\n            resetBulkAction(bulkActionSelect);\n            pendingPromise.resolve();\n        });\n\n        root.addEventListener('click', e => {\n            // Handle clicking of the \"Show [all|count]\" and \"Select all\" actions.\n            const showCountLink = root.querySelector(Selectors.showCountToggle);\n            const checkCountButton = root.querySelector(Selectors.checkCountButton);\n\n            const showCountLinkClicked = showCountLink && showCountLink.contains(e.target);\n            const checkCountButtonClicked = checkCountButton && checkCountButton.contains(e.target);\n\n            if (showCountLinkClicked || checkCountButtonClicked) {\n                e.preventDefault();\n\n                const tableRoot = getTableFromUniqueId(uniqueid);\n\n                DynamicTable.setPageSize(tableRoot, showCountLink.dataset.targetPageSize)\n                .then(tableRoot => {\n                    // Always update the toggle state.\n                    // This ensures that the bulk actions are disabled after changing the page size.\n                    CheckboxToggleAll.setGroupState(tableRoot, 'participants-table', checkCountButtonClicked);\n\n                    return tableRoot;\n                })\n                .catch(Notification.exception);\n            }\n        });\n\n        // When the content is refreshed, update the row counts in various places.\n        root.addEventListener(DynamicTable.Events.tableContentRefreshed, e => {\n            const showCountLink = root.querySelector(Selectors.showCountToggle);\n            const checkCountButton = root.querySelector(Selectors.checkCountButton);\n\n            const tableRoot = e.target;\n\n            const defaultPageSize = parseInt(root.dataset.tableDefaultPerPage, 10);\n            const currentPageSize = parseInt(tableRoot.dataset.tablePageSize, 10);\n            const totalRowCount = parseInt(tableRoot.dataset.tableTotalRows, 10);\n\n            CheckboxToggleAll.updateSlavesFromMasterState(tableRoot, 'participants-table');\n\n            const pageCountStrings = [\n                {\n                    key: 'countparticipantsfound',\n                    component: 'core_user',\n                    param: totalRowCount,\n                },\n            ];\n\n\n            if (totalRowCount <= defaultPageSize) {\n                // There are fewer than the default page count numbers of rows.\n                showCountLink.classList.add('hidden');\n\n                if (checkCountButton) {\n                    checkCountButton.classList.add('hidden');\n                }\n            } else if (totalRowCount <= currentPageSize) {\n                // The are fewer than the current page size.\n                pageCountStrings.push({\n                    key: 'showperpage',\n                    component: 'core',\n                    param: defaultPageSize,\n                });\n\n                pageCountStrings.push({\n                    key: 'selectalluserswithcount',\n                    component: 'core',\n                    param: defaultPageSize,\n                });\n\n                // Show the 'Show [x]' link.\n                showCountLink.classList.remove('hidden');\n                showCountLink.dataset.targetPageSize = defaultPageSize;\n\n                if (checkCountButton) {\n                    // The 'Check all [x]' button is only visible when there are values to set.\n                    checkCountButton.classList.add('hidden');\n                }\n            } else {\n                pageCountStrings.push({\n                    key: 'showall',\n                    component: 'core',\n                    param: totalRowCount,\n                });\n\n                pageCountStrings.push({\n                    key: 'selectalluserswithcount',\n                    component: 'core',\n                    param: totalRowCount,\n                });\n\n                // Show both the 'Show [x]' link, and the 'Check all [x]' button.\n                showCountLink.classList.remove('hidden');\n                showCountLink.dataset.targetPageSize = totalRowCount;\n\n                if (checkCountButton) {\n                    checkCountButton.classList.remove('hidden');\n                }\n            }\n\n            Str.get_strings(pageCountStrings)\n            .then(([showingParticipantCountString, showCountString, selectCountString]) => {\n                const showingParticipantCount = root.querySelector(Selectors.showCountText);\n                showingParticipantCount.innerHTML = showingParticipantCountString;\n\n                if (showCountString) {\n                    showCountLink.innerHTML = showCountString;\n                }\n\n                if (selectCountString && checkCountButton) {\n                    checkCountButton.value = selectCountString;\n                }\n\n                return;\n            })\n            .catch(Notification.exception);\n        });\n    };\n\n    const resetBulkAction = bulkActionSelect => {\n        bulkActionSelect.value = '';\n    };\n\n    registerEventListeners();\n};\n"],"file":"participants.min.js"}