1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

Merge pull request #2420 from prototech/ticket/9388

[ticket/9388] Only display the settings for the selected method in the auth and search ACP pages.

* prototech/ticket/9388:
  [ticket/9388] Use "togglable" instead of "toggable"
  [ticket/9388] Do not nest the <fieldset> tags in the OAuth settings.
  [ticket/9388] Reopen <fieldset> after auth templates.
  [ticket/9388] Fix unit tests.
  [ticket/9388] Use the new toggle function for the avatar type <select>.
  [ticket/9388] Display only the settings for the selected search backend.
  [ticket/9388] Display only the settings for the auth method that's selected.
  [ticket/9388] Add support for making <select> options able to toggle settings.
This commit is contained in:
Joas Schilling
2014-05-11 10:48:10 +02:00
17 changed files with 102 additions and 119 deletions

View File

@@ -363,7 +363,7 @@ class acp_board
'title' => 'ACP_AUTH_SETTINGS',
'vars' => array(
'legend1' => 'ACP_AUTH_SETTINGS',
'auth_method' => array('lang' => 'AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'select_auth_method', 'explain' => false),
'auth_method' => array('lang' => 'AUTH_METHOD', 'validate' => 'string', 'type' => 'select:1:toggable', 'method' => 'select_auth_method', 'explain' => false),
)
);
break;
@@ -715,7 +715,7 @@ class acp_board
foreach ($auth_plugins as $method)
{
$selected = ($selected_method == $method) ? ' selected="selected"' : '';
$auth_select .= '<option value="' . $method . '"' . $selected . '>' . ucfirst($method) . '</option>';
$auth_select .= "<option value=\"$method\"$selected data-toggle-setting=\"#auth_{$method}_settings\">" . ucfirst($method) . '</option>';
}
return $auth_select;

View File

@@ -79,7 +79,8 @@ class acp_search
$name = $search->get_name();
$selected = ($config['search_type'] == $type) ? ' selected="selected"' : '';
$search_options .= '<option value="' . $type . '"' . $selected . '>' . $name . '</option>';
$identifier = substr($type, strrpos($type, '\\') + 1);
$search_options .= "<option value=\"$type\"$selected data-toggle-setting=\"#search_{$identifier}_settings\">$name</option>";
if (method_exists($search, 'acp'))
{
@@ -88,9 +89,10 @@ class acp_search
if (!$submit)
{
$template->assign_block_vars('backend', array(
'NAME' => $name,
'SETTINGS' => $vars['tpl'])
);
'NAME' => $name,
'SETTINGS' => $vars['tpl'],
'IDENTIFIER' => $identifier,
));
}
else if (is_array($vars['config']))
{

View File

@@ -364,8 +364,9 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
if ($tpl_type[0] == 'select')
{
$size = (isset($tpl_type[1])) ? (int) $tpl_type[1] : 1;
$data_toggle = (!empty($tpl_type[2])) ? ' data-togglable-settings="true"' : '';
$tpl = '<select id="' . $key . '" name="' . $name . '"' . (($size > 1) ? ' size="' . $size . '"' : '') . '>' . $return . '</select>';
$tpl = '<select id="' . $key . '" name="' . $name . '"' . (($size > 1) ? ' size="' . $size . '"' : '') . $data_toggle . '>' . $return . '</select>';
}
else
{