diff --git a/adm/style/portal/acp_portal_modules.html b/adm/style/portal/acp_portal_modules.html
index 3b2d7259..7530f878 100644
--- a/adm/style/portal/acp_portal_modules.html
+++ b/adm/style/portal/acp_portal_modules.html
@@ -57,8 +57,10 @@
{modules_top.MODULE_IMAGE} {modules_top.MODULE_NAME}
- {ICON_MOVE_UP_DISABLED}{ICON_MOVE_UP}
- {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN}
+ style="display: none;">{ICON_MOVE_UP_DISABLED}
+ style="display: none;">{ICON_MOVE_UP}
+ style="display: none;">{ICON_MOVE_DOWN_DISABLED}
+ style="display: none;">{ICON_MOVE_DOWN}
{ICON_EDIT} {ICON_DELETE}
|
@@ -84,11 +86,13 @@
{modules_left.MODULE_IMAGE} {modules_left.MODULE_NAME}
- {ICON_MOVE_UP_DISABLED}{ICON_MOVE_UP}
+ style="display: none;">{ICON_MOVE_UP_DISABLED}
+ style="display: none;">{ICON_MOVE_UP}
{ICON_MOVE_LEFT}{ICON_MOVE_RIGHT}{ICON_MOVE_LEFT_DISABLED}{ICON_MOVE_RIGHT_DISABLED}
{ICON_EDIT} {ICON_DELETE}
{ICON_MOVE_RIGHT_DISABLED}{ICON_MOVE_LEFT_DISABLED}
- {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN}
+ style="display: none;">{ICON_MOVE_DOWN_DISABLED}
+ style="display: none;">{ICON_MOVE_DOWN}
|
@@ -111,11 +115,13 @@
{modules_center.MODULE_IMAGE} {modules_center.MODULE_NAME}
- {ICON_MOVE_UP_DISABLED}{ICON_MOVE_UP}
+ style="display: none;">{ICON_MOVE_UP_DISABLED}
+ style="display: none;">{ICON_MOVE_UP}
{ICON_MOVE_RIGHT}{ICON_MOVE_RIGHT_DISABLED}
{ICON_EDIT} {ICON_DELETE}
{ICON_MOVE_LEFT}{ICON_MOVE_LEFT_DISABLED}
- {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN}
+ style="display: none;">{ICON_MOVE_DOWN_DISABLED}
+ style="display: none;">{ICON_MOVE_DOWN}
|
@@ -138,11 +144,13 @@
{modules_right.MODULE_IMAGE} {modules_right.MODULE_NAME}
- {ICON_MOVE_UP_DISABLED}{ICON_MOVE_UP}
+ style="display: none;">{ICON_MOVE_UP_DISABLED}
+ style="display: none;">{ICON_MOVE_UP}
{ICON_MOVE_LEFT_DISABLED}{ICON_MOVE_RIGHT_DISABLED}
{ICON_EDIT} {ICON_DELETE}
{ICON_MOVE_RIGHT}{ICON_MOVE_LEFT}{ICON_MOVE_RIGHT_DISABLED}{ICON_MOVE_LEFT_DISABLED}
- {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN}
+ style="display: none;">{ICON_MOVE_DOWN_DISABLED}
+ style="display: none;">{ICON_MOVE_DOWN}
|
@@ -168,8 +176,10 @@
{modules_bottom.MODULE_IMAGE} {modules_bottom.MODULE_NAME}
- {ICON_MOVE_UP_DISABLED}{ICON_MOVE_UP}
- {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN}
+ style="display: none;">{ICON_MOVE_UP_DISABLED}
+ style="display: none;">{ICON_MOVE_UP}
+ style="display: none;">{ICON_MOVE_DOWN_DISABLED}
+ style="display: none;">{ICON_MOVE_DOWN}
{ICON_EDIT} {ICON_DELETE}
|
diff --git a/adm/style/portal/ajax.js b/adm/style/portal/ajax.js
new file mode 100644
index 00000000..ce96050f
--- /dev/null
+++ b/adm/style/portal/ajax.js
@@ -0,0 +1,81 @@
+(function($) { // Avoid conflicts with other libraries
+
+"use strict";
+
+/**
+ * The following callbacks are for reording items. row_down
+ * is triggered when an item is moved down, and row_up is triggered when
+ * an item is moved up. It moves the row up or down, and deactivates /
+ * activates any up / down icons that require it (the ones at the top or bottom).
+ */
+phpbb.addAjaxCallback('b3p_move_module_up', function(res) {
+ if (typeof res.success === 'undefined' || !res.success) {
+ return;
+ }
+
+ var el = $(this).parents('tr:first'),
+ trSwap = el.prev(),
+ elClass = trSwap.attr('class'),
+ trSwapClass = el.attr('class');
+
+ el.insertBefore(trSwap);
+ el.attr('class', elClass);
+ trSwap.attr('class', trSwapClass);
+
+ // Swap images if swap element is first row
+ var swapIsFirstRow = trSwap.find('img[src*="icon_up_disabled"]').parents('span:first').is(':visible');
+
+ if (swapIsFirstRow) {
+ trSwap.find('img[src*="icon_up_disabled"]').parents('span:first').toggle();
+ trSwap.find('img[src*="icon_up."]').parents('span:first').toggle();
+ el.find('img[src*="icon_up."]').parents('span:first').toggle();
+ el.find('img[src*="icon_up_disabled"]').parents('span:first').toggle();
+ }
+
+ // Swap images if move element is last row
+ var elIsLastRow = el.find('img[src*="icon_down_disabled"]').parents('span:first').is(':visible');
+
+ if (elIsLastRow) {
+ trSwap.find('img[src*="icon_down_disabled"]').parents('span:first').toggle();
+ trSwap.find('img[src*="icon_down."]').parents('span:first').toggle();
+ el.find('img[src*="icon_down."]').parents('span:first').toggle();
+ el.find('img[src*="icon_down_disabled"]').parents('span:first').toggle();
+ }
+});
+
+phpbb.addAjaxCallback('b3p_move_module_down', function(res) {
+ if (typeof res.success === 'undefined' || !res.success) {
+ return;
+ }
+
+ var el = $(this).parents('tr:first'),
+ trSwap = el.next(),
+ elClass = trSwap.attr('class'),
+ trSwapClass = el.attr('class');
+
+ el.insertAfter(trSwap);
+ el.attr('class', elClass);
+ trSwap.attr('class', trSwapClass);
+
+ // Swap images if swap element is last row
+ var swapIsLastRow = trSwap.find('img[src*="icon_down_disabled"]').parents('span:first').is(':visible');
+
+ if (swapIsLastRow) {
+ trSwap.find('img[src*="icon_down_disabled"]').parents('span:first').toggle();
+ trSwap.find('img[src*="icon_down."]').parents('span:first').toggle();
+ el.find('img[src*="icon_down."]').parents('span:first').toggle();
+ el.find('img[src*="icon_down_disabled"]').parents('span:first').toggle();
+ }
+
+ // Swap images if move element is first row
+ var elIsFirstRow = el.find('img[src*="icon_up_disabled"]').parents('span:first').is(':visible');
+
+ if (elIsFirstRow) {
+ trSwap.find('img[src*="icon_up_disabled"]').parents('span:first').toggle();
+ trSwap.find('img[src*="icon_up."]').parents('span:first').toggle();
+ el.find('img[src*="icon_up."]').parents('span:first').toggle();
+ el.find('img[src*="icon_up_disabled"]').parents('span:first').toggle();
+ }
+});
+
+})(jQuery); // Avoid conflicts with other libraries