Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/monara/public_html/test.athavaneng.com/themes.php on line 99
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 226
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 227
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 228
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 229
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 230
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 231
// 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 .
/**
* Javascript module for editing a database preset.
*
* @module mod_data/editpreset
* @copyright 2022 Sara Arjona
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
import ModalForm from 'core_form/modalform';
import Notification from 'core/notification';
import {get_string as getString} from 'core/str';
const selectors = {
editPresetButton: '[data-action="editpreset"]',
};
/**
* Initialize module
*/
export const init = () => {
registerEventListeners();
};
/**
* Register events for update/delete links.
*/
const registerEventListeners = () => {
document.addEventListener('click', (event) => {
const editAction = event.target.closest(selectors.editPresetButton);
if (editAction) {
event.preventDefault();
showEditPresetModal(editAction);
}
});
};
/**
* Show the edit preset modal.
*
* @param {HTMLElement} editAction the edit action element.
*/
const showEditPresetModal = (editAction) => {
const modalForm = new ModalForm({
modalConfig: {
title: getString('editpreset', 'mod_data'),
},
formClass: 'mod_data\\form\\save_as_preset',
args: {
d: editAction.getAttribute('data-dataid'),
action: editAction.getAttribute('data-action'),
presetname: editAction.getAttribute('data-presetname'),
presetdescription: editAction.getAttribute('data-presetdescription')
},
saveButtonText: getString('save'),
returnFocus: editAction,
});
modalForm.addEventListener(modalForm.events.FORM_SUBMITTED, event => {
if (event.detail.result) {
window.location.reload();
} else {
Notification.addNotification({
type: 'error',
message: event.detail.errors.join('
')
});
}
});
modalForm.show();
};