aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/adm/style/permission_mask.html2
-rw-r--r--phpBB/adm/style/tooltip.js28
-rw-r--r--phpBB/includes/acp/auth.php6
3 files changed, 31 insertions, 5 deletions
diff --git a/phpBB/adm/style/permission_mask.html b/phpBB/adm/style/permission_mask.html
index 91894ebc77..347da3181e 100644
--- a/phpBB/adm/style/permission_mask.html
+++ b/phpBB/adm/style/permission_mask.html
@@ -50,7 +50,7 @@
{% endfor %}
</ul>
</div>
- <input type="hidden" name="role[{p_mask.f_mask.UG_ID}][{p_mask.f_mask.FORUM_ID}]" />
+ <input type="hidden" name="role[{p_mask.f_mask.UG_ID}][{p_mask.f_mask.FORUM_ID}]"{% if S_ROLE_ID %}value="{{ S_ROLE_ID }}"{% endif %} />
</div>
</dd>
{% else %}
diff --git a/phpBB/adm/style/tooltip.js b/phpBB/adm/style/tooltip.js
index 641d82c80a..68964034f0 100644
--- a/phpBB/adm/style/tooltip.js
+++ b/phpBB/adm/style/tooltip.js
@@ -141,15 +141,20 @@ phpbb.positionTooltip = function ($element) {
*/
phpbb.prepareRolesDropdown = function () {
var $options = $('.roles-options li');
+ var $rolesOptions = $options.closest('.roles-options');
+ var $span = $rolesOptions.children('span');
// Prepare highlighting of select options and settings update
$options.each(function () {
var $this = $(this);
- var $rolesOptions = $this.closest('.roles-options');
// Correctly show selected option
if (typeof $this.attr('data-selected') !== 'undefined') {
- $this.closest('.roles-options').children('span').text($this.text());
+ $rolesOptions.closest('.roles-options')
+ .children('span')
+ .text($this.text())
+ .attr('data-default', $this.text())
+ .attr('data-default-val', $this.attr('data-id'));
}
$this.on('mouseover', function () {
@@ -164,13 +169,28 @@ phpbb.prepareRolesDropdown = function () {
init_colours($this.attr('data-target-id').replace('advanced', ''));
// Set selected setting
- $rolesOptions.children('span').text($this.text());
- $rolesOptions.children('input[type=hidden]').val($this.attr('data-id'));
+ $rolesOptions.children('span')
+ .text($this.text());
+ $rolesOptions.children('input[type=hidden]')
+ .val($this.attr('data-id'));
// Trigger hiding of selection options
$('body').trigger('click');
});
});
+
+ // Save default text of drop down if there is no default set yet
+ if (typeof $span.attr('data-default') === 'undefined') {
+ $span.attr('data-default', $span.text());
+ }
+
+ // Prepare resetting drop down on form reset
+ $options.closest('form').on('reset', function () {
+ $span.text($span.attr('data-default'));
+ $rolesOptions.children('input[type=hidden]')
+ .val($span.attr('data-id'));
+ });
+
};
// Run onload functions for RolesDropdown and tooltips
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php
index efb92685f6..b13b1ee040 100644
--- a/phpBB/includes/acp/auth.php
+++ b/phpBB/includes/acp/auth.php
@@ -470,6 +470,9 @@ class auth_admin extends \phpbb\auth\auth
// Build role dropdown options
$current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0;
+ // Output current role id to template
+ $template->assign_var('S_ROLE_ID', $current_role_id);
+
@reset($roles);
while (list($role_id, $role_row) = each($roles))
{
@@ -552,6 +555,9 @@ class auth_admin extends \phpbb\auth\auth
// Build role dropdown options
$current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0;
+ // Output current role id to template
+ $template->assign_var('S_ROLE_ID', $current_role_id);
+
@reset($roles);
while (list($role_id, $role_row) = each($roles))
{