mirrored from git://git.moodle.org/moodle.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'MDL-77159-master' of https://github.com/andrewnicols/mo…
- Loading branch information
Showing
12 changed files
with
75 additions
and
354 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// 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/>. | ||
|
||
import {get_strings as getStrings} from 'core/str'; | ||
import {saveCancelPromise, alert as displayAlert} from "core/notification"; | ||
import MoodleConfig from 'core/config'; | ||
|
||
export const init = (form) => { | ||
form?.addEventListener('submit', async(e) => { | ||
e.preventDefault(); | ||
const selectedOptions = form.querySelector('#menuuninstalllang')?.selectedOptions; | ||
if (!selectedOptions?.length) { | ||
const alertStrings = await getStrings( | ||
['noenglishuninstalltitle', 'selectlangs'].map((key) => ({key, component: 'tool_langimport'}) | ||
)); | ||
displayAlert(...alertStrings); | ||
return; | ||
} | ||
|
||
if ([...selectedOptions].map((node) => node.value).indexOf('en') !== -1) { | ||
const alertStrings = await getStrings( | ||
['noenglishuninstalltitle', 'noenglishuninstall'].map((key) => ({key, component: 'tool_langimport'}) | ||
)); | ||
displayAlert(...alertStrings); | ||
return; | ||
} | ||
|
||
const confirmationStrings = await getStrings([ | ||
{ | ||
key: 'uninstall', | ||
component: 'tool_langimport', | ||
}, | ||
{ | ||
key: 'uninstallconfirm', | ||
component: 'tool_langimport', | ||
param: [...selectedOptions].map((node) => node.textContent).join(', '), | ||
}, | ||
{ | ||
key: 'yes', | ||
component: 'core', | ||
}, | ||
]); | ||
|
||
saveCancelPromise(...confirmationStrings).then(() => { | ||
const url = new URL(form.action); | ||
url.searchParams.append('sesskey', MoodleConfig.sesskey); | ||
url.searchParams.append('confirmtouninstall', [...selectedOptions].map((node) => node.value).join('/')); | ||
form.action = url.toString(); | ||
form.submit(); | ||
return true; | ||
}) | ||
.catch(() => { | ||
return false; | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 0 additions & 110 deletions
110
lib/yui/build/moodle-core-languninstallconfirm/moodle-core-languninstallconfirm-debug.js
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
lib/yui/build/moodle-core-languninstallconfirm/moodle-core-languninstallconfirm-min.js
This file was deleted.
Oops, something went wrong.
110 changes: 0 additions & 110 deletions
110
lib/yui/build/moodle-core-languninstallconfirm/moodle-core-languninstallconfirm.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.