From babe07caefe8a035f711fd76c38b4dbeb0a8e804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Col=C3=B3n?= Date: Tue, 26 Jun 2012 00:37:48 -0400 Subject: [PATCH] [ticket/10786] Javascript toggle member search panel in memberlist.php Search functions on the memberlist.php page are now rendered by default and displayed via javascript. If javascript is disabled the page still works as it previously did. PHPBB3-10786 --- phpBB/memberlist.php | 6 +-- phpBB/styles/prosilver/template/ajax.js | 13 +++++- phpBB/styles/prosilver/template/forum_fn.js | 37 ----------------- .../prosilver/template/memberlist_body.html | 2 +- .../subsilver2/template/memberlist_body.html | 8 ++-- .../template/memberlist_search.html | 41 +------------------ 6 files changed, 22 insertions(+), 85 deletions(-) diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 681e51e3fd..ebc1757810 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1025,7 +1025,7 @@ switch ($mode) // We validate form and field here, only id/class allowed $form = (!preg_match('/^[a-z0-9_-]+$/i', $form)) ? '' : $form; $field = (!preg_match('/^[a-z0-9_-]+$/i', $field)) ? '' : $field; - if ((in_array($mode, array('', 'searchuser')) || sizeof(array_intersect($request->variable_names(phpbb_request_interface::GET), $search_params)) > 0) && ($config['load_search'] || $auth->acl_get('a_'))) + if ((($mode == '' || $mode == 'searchuser') || sizeof(array_intersect($request->variable_names(phpbb_request_interface::GET), $search_params)) > 0) && ($config['load_search'] || $auth->acl_get('a_'))) { $username = request_var('username', '', true); $email = strtolower(request_var('email', '')); @@ -1377,7 +1377,7 @@ switch ($mode) } // Some search user specific data - if (in_array($mode, array('', 'searchuser')) && ($config['load_search'] || $auth->acl_get('a_'))) + if (($mode == '' || $mode == 'searchuser') && ($config['load_search'] || $auth->acl_get('a_'))) { $group_selected = request_var('search_group_id', 0); $s_group_select = ''; @@ -1447,7 +1447,7 @@ switch ($mode) 'S_IP_SEARCH_ALLOWED' => ($auth->acl_getf_global('m_info')) ? true : false, 'S_EMAIL_SEARCH_ALLOWED'=> ($auth->acl_get('a_user')) ? true : false, 'S_IN_SEARCH_POPUP' => ($form && $field) ? true : false, - 'S_SEARCH_USER' => ($mode == 'searchuser' || ($mode == '' && $submit)) ? true : false, + 'S_SEARCH_USER' => ($mode == 'searchuser' || ($mode == '' && $submit)), 'S_FORM_NAME' => $form, 'S_FIELD_NAME' => $field, 'S_SELECT_SINGLE' => $select_single, diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index 8583fb565c..968f57bba2 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -192,6 +192,17 @@ $('#quick-mod-select').change(function () { $('#quickmodform').submit(); }); - +/** +* Toggle the member search panel in memberlist.php. +*/ +$('#member_search').click(function () { + $('#memberlist_search').slideToggle('fast'); + phpbb.ajax_callbacks['alt_text'].call(this); + //Focus on the username textbox if it's available and displayed + if ($('#username').length > 0 && $('#memberlist_search').is(':visible')) { + $('#username').focus(); + } + return false; +}); })(jQuery); // Avoid conflicts with other libraries diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 527a064fa9..995b4b0ab7 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -433,43 +433,6 @@ function apply_onkeypress_event() } } -/** -* Toggle a section's visibility status -*/ -function toggle_section(link, panel_id, expand_text, collapse_text) -{ - if (jquery_present) - { - var panel = jQuery('#' + panel_id); - if (panel.is(':visible')) - { - jQuery(link).text(expand_text); - panel.slideUp('fast'); - } - else - { - jQuery(link).text(collapse_text); - panel.slideDown('fast'); - } - } - else - { - var panel = document.getElementById(panel_id); - if (panel.style.display == 'none') - { - link.innerHTML = collapse_text; - panel.style.display = ''; - } - else - { - link.innerHTML = expand_text; - panel.style.display = 'none'; - } - } - - return false; -} - /** * Detect JQuery existance. We currently do not deliver it, but some styles do, so why not benefit from it. ;) */ diff --git a/phpBB/styles/prosilver/template/memberlist_body.html b/phpBB/styles/prosilver/template/memberlist_body.html index 023c0e1e4e..17dc2c33c0 100644 --- a/phpBB/styles/prosilver/template/memberlist_body.html +++ b/phpBB/styles/prosilver/template/memberlist_body.html @@ -30,7 +30,7 @@