aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2016-11-26 13:27:24 +0100
committerMarc Alexander <admin@m-a-styles.de>2016-11-26 13:28:15 +0100
commit30b3fbb2cf4fba62ab4deb3cbcb5875e26af8cf4 (patch)
tree5783f37457f398e799f3ef56c162d6d05800c90f
parentff76a3e433700687cb1937cfe97263a94cd539d4 (diff)
downloadforums-30b3fbb2cf4fba62ab4deb3cbcb5875e26af8cf4.tar
forums-30b3fbb2cf4fba62ab4deb3cbcb5875e26af8cf4.tar.gz
forums-30b3fbb2cf4fba62ab4deb3cbcb5875e26af8cf4.tar.bz2
forums-30b3fbb2cf4fba62ab4deb3cbcb5875e26af8cf4.tar.xz
forums-30b3fbb2cf4fba62ab4deb3cbcb5875e26af8cf4.zip
[ticket/9590] Support ajax submit of permissions for specific forums
PHPBB3-9590
-rw-r--r--phpBB/adm/style/ajax.js33
1 files changed, 24 insertions, 9 deletions
diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js
index 21cc22c6c6..d95b1d47d6 100644
--- a/phpBB/adm/style/ajax.js
+++ b/phpBB/adm/style/ajax.js
@@ -70,15 +70,8 @@ function submitPermissions() {
var $form = $('form#set-permissions'),
fieldsetList = $form.find('fieldset[id^=perm]'),
formDataSets = [],
- $submitAllButton = $form.find('input[type=submit][name^=action]')[0];
-
- $.each(fieldsetList, function (key, value) {
- if (key % 5 === 0) {
- formDataSets[Math.floor(key / 5)] = $form.find('fieldset#' + value.id).serialize();
- } else {
- formDataSets[Math.floor(key / 5)] += '&' + $form.find('fieldset#' + value.id).serialize();
- }
- });
+ $submitAllButton = $form.find('input[type=submit][name^=action]')[0],
+ $submitButton = $form.find('input[type=submit][data-clicked=true]')[0];
// Set proper start values for handling refresh of page
var permissionSubmitSize = formDataSets.length,
@@ -86,6 +79,24 @@ function submitPermissions() {
forumIds = [],
permissionSubmitFailed = false;
+ if ($submitAllButton === $submitButton) {
+ $.each(fieldsetList, function (key, value) {
+ if (key % 5 === 0) {
+ formDataSets[Math.floor(key / 5)] = $form.find('fieldset#' + value.id).serialize();
+ } else {
+ formDataSets[Math.floor(key / 5)] += '&' + $form.find('fieldset#' + value.id).serialize();
+ }
+ });
+ } else {
+ formDataSets[0] = $form.find('fieldset#' + $submitButton.closest('fieldset.permissions').id).serialize();
+ // Add each forum ID to forum ID list to preserve selected forums
+ $.each($form.find('input[type=hidden][name^=forum_id]'), function (key, value) {
+ if (value.name.match(/^forum_id\[([0-9]+)\]$/)) {
+ forumIds.push(value.value);
+ }
+ });
+ }
+
/**
* Handler for submitted permissions form chunk
*
@@ -186,6 +197,10 @@ $(function() {
submitPermissions();
e.preventDefault();
});
+ $setPermissionsForm.find('input[type=submit]').click(function() {
+ $('input[type=submit]', $(this).parents($('form#set-permissions'))).removeAttr('data-clicked');
+ $(this).attr('data-clicked', true);
+ });
}
});