aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/adm/style/admin.js
diff options
context:
space:
mode:
authorJakub Senko <jakubsenko@gmail.com>2018-05-14 21:14:41 +0200
committerMarc Alexander <admin@m-a-styles.de>2019-05-09 18:20:41 +0200
commit3e6fd7e8fd419ed999fe38ee48519dae98988081 (patch)
tree5f418acfd278e8f4ab4a87a75fc887f66db84e42 /phpBB/adm/style/admin.js
parentdc9b1c37b163a46b46b79f5b968408ede97e45e8 (diff)
downloadforums-3e6fd7e8fd419ed999fe38ee48519dae98988081.tar
forums-3e6fd7e8fd419ed999fe38ee48519dae98988081.tar.gz
forums-3e6fd7e8fd419ed999fe38ee48519dae98988081.tar.bz2
forums-3e6fd7e8fd419ed999fe38ee48519dae98988081.tar.xz
forums-3e6fd7e8fd419ed999fe38ee48519dae98988081.zip
[ticket/15664] Ajaxify ext actions in ACP
PHPBB3-15664
Diffstat (limited to 'phpBB/adm/style/admin.js')
-rw-r--r--phpBB/adm/style/admin.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js
index 551c78a4a3..b7c25b7c86 100644
--- a/phpBB/adm/style/admin.js
+++ b/phpBB/adm/style/admin.js
@@ -229,6 +229,64 @@ function parse_document(container)
}
/**
+ * Extension actions helper functions
+ */
+function move_to_enabled(element)
+{
+ var disabled_header = document.querySelector('#ext_disabled_header');
+ disabled_header.parentNode.insertBefore(element, disabled_header);
+ element.classList.remove('ext_disabled');
+ element.classList.add('ext_enabled');
+}
+function move_to_disabled(element)
+{
+ var table_body = document.querySelector('#ext_disabled_header').parentNode;
+ table_body.appendChild(element);
+ element.classList.remove('ext_enabled');
+ element.classList.add('ext_disabled');
+}
+function set_actions(container, actions) {
+ container.innerHTML = '';
+ for (var i = 0; i < actions.length; i++) {
+ var a = document.createElement('a');
+ a.href = actions[i].U_ACTION.split('&amp;').join('&'); // replace all occurances
+ a.title = actions[i].L_ACTION_EXPLAIN;
+ if (actions[i].COLOR) {
+ a.style = actions[i].COLOR;
+ }
+ a.innerHTML = actions[i].L_ACTION;
+ // ajaxify this action as well
+ phpbb.ajaxify({
+ selector: a,
+ refresh: false,
+ callback: actions[i].ACTION_AJAX
+ });
+
+ container.appendChild(a);
+
+ if (i < actions.length - 1) {
+ container.innerHTML += '&nbsp;|&nbsp;';
+ }
+ }
+}
+function show_enabled_header() {
+ document.querySelector('#ext_enabled_header').classList.remove('hidden');
+}
+function show_disabled_header() {
+ document.querySelector('#ext_disabled_header').classList.remove('hidden');
+}
+function hide_disabled_header_if_empty() {
+ if (!document.querySelector('.ext_disabled')) {
+ document.querySelector('#ext_disabled_header').classList.add('hidden');
+ }
+}
+function hide_enabled_header_if_empty() {
+ if (!document.querySelector('.ext_enabled')) {
+ document.querySelector('#ext_enabled_header').classList.add('hidden');
+ }
+}
+
+/**
* Run onload functions
*/
(function($) {