Browse Source

! Rework hook filtering to be based on an onchange event rather than an onclick, and also click up one of the options we don't really need from it. Should also fix #430 in the meantime.

Signed-off-by: Peter Spicer <[email protected]>
Peter Spicer 10 năm trước cách đây
mục cha
commit
d3e8c439f7

+ 2 - 2
Sources/ManageMaintenance.php

@@ -2415,7 +2415,7 @@ function get_integration_hooks_data($start, $per_page, $sort)
 
 	foreach ($hooks as $hook => $functions)
 	{
-		$hooks_filters[] = '<option ' . ($context['current_filter'] == $hook ? 'selected="selected" ' : '') . 'onclick="window.location = \'' . $scripturl . '?action=admin;area=maintain;sa=hooks;filter=' . $hook . '\';">' . $hook . '</option>';
+		$hooks_filters[] = '<option ' . ($context['current_filter'] == $hook ? 'selected="selected" ' : '') . ' value="' . $hook . '">' . $hook . '</option>';
 		foreach ($functions as $function)
 		{
 			$enabled = strstr($function, ']') === false;
@@ -2442,7 +2442,7 @@ function get_integration_hooks_data($start, $per_page, $sort)
 		$context['insert_after_template'] .= '
 		<script type="text/javascript"><!-- // --><![CDATA[
 			var hook_name_header = document.getElementById(\'header_list_integration_hooks_hook_name\');
-			hook_name_header.innerHTML += ' . JavaScriptEscape('<select style="margin-left:15px;"><option>---</option><option onclick="window.location = \'' . $scripturl . '?action=admin;area=maintain;sa=hooks\';">' . $txt['hooks_reset_filter'] . '</option>' . implode('', $hooks_filters) . '</select>'). ';
+			hook_name_header.innerHTML += ' . JavaScriptEscape('<select style="margin-left:15px;" onchange="window.location=(\'' . $scripturl . '?action=admin;area=maintain;sa=hooks\' + (this.value ? \';filter=\' + this.value : \'\'));"><option value="">' . $txt['hooks_reset_filter'] . '</option>' . implode('', $hooks_filters) . '</select>'). ';
 		// ]]></script>';
 
 	$temp_data = array();

+ 1 - 1
Themes/default/languages/Admin.english.php

@@ -718,7 +718,7 @@ $txt['hooks_disable_legend'] = 'Legend';
 $txt['hooks_disable_legend_exists'] = 'the hook exists and is active';
 $txt['hooks_disable_legend_disabled'] = 'the hook exists but has been disabled';
 $txt['hooks_disable_legend_missing'] = 'the hook has not been found';
-$txt['hooks_reset_filter'] = 'Reset filter';
+$txt['hooks_reset_filter'] = 'No filter';
 
 $txt['board_perms_allow'] = 'Allow';
 $txt['board_perms_ignore'] = 'Ignore';