1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-22 00:21:02 +01:00

[ticket/9590] Correctly update submit size and replace all forum_id[]

PHPBB3-9590
This commit is contained in:
Marc Alexander 2016-11-27 00:12:59 +01:00
parent 0f46d35f75
commit 5e36dd3d0b
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995

View File

@ -74,7 +74,7 @@ function submitPermissions() {
$submitButton = $form.find('input[type=submit][data-clicked=true]')[0];
// Set proper start values for handling refresh of page
var permissionSubmitSize = formDataSets.length,
var permissionSubmitSize = 0,
permissionRequestCount = 0,
forumIds = [],
permissionSubmitFailed = false;
@ -91,6 +91,8 @@ function submitPermissions() {
}
});
permissionSubmitSize = formDataSets.length;
// 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]+)\]$/)) {
@ -119,7 +121,7 @@ function submitPermissions() {
// Create form to submit instead of normal "Back to previous page" link
if ($alertBoxLink) {
// Remove forum_id[] from URL
$alertBoxLink.attr('href', $alertBoxLink.attr('href').replace(/(&forum_id\[\]=[0-9]+)/, ''));
$alertBoxLink.attr('href', $alertBoxLink.attr('href').replace(/(&forum_id\[\]=[0-9]+)/g, ''));
var previousPageForm = '<form action="' + $alertBoxLink.attr('href') + '" method="post">';
$.each(forumIds, function (key, value) {
previousPageForm += '<input type="text" name="forum_id[]" value="' + value + '" />';
@ -142,7 +144,7 @@ function submitPermissions() {
setTimeout(function () {
// Create forum to submit using POST. This will prevent
// exceeding the maximum length of URLs
var form = '<form action="' + res.REFRESH_DATA.url.replace(/(&forum_id\[\]=[0-9]+)/, '') + '" method="post">';
var form = '<form action="' + res.REFRESH_DATA.url.replace(/(&forum_id\[\]=[0-9]+)/g, '') + '" method="post">';
$.each(forumIds, function (key, value) {
form += '<input type="text" name="forum_id[]" value="' + value + '" />';
});