diff --git a/Source/Source.FilterAPI.php b/Source/Source.FilterAPI.php index 4302bd4..9f68165 100644 --- a/Source/Source.FilterAPI.php +++ b/Source/Source.FilterAPI.php @@ -352,14 +352,14 @@ $t_repo_table = plugin_table( 'repository' ); - $t_query = "SELECT id,name FROM $t_repo_table ORDER BY name ASC"; + $t_query = "SELECT id,name,type FROM $t_repo_table ORDER BY name ASC"; $t_result = db_query_bound( $t_query ); - echo '', + ''; while( $t_row = db_fetch_array( $t_result ) ) { - echo ''; } @@ -380,8 +380,8 @@ $t_query = "SELECT DISTINCT( type ) FROM $t_repo_table ORDER BY type ASC"; $t_result = db_query_bound( $t_query ); - echo '', + ''; while( $t_row = db_fetch_array( $t_result ) ) { if ( !isset( $t_types[ $t_row['type'] ] ) ) { @@ -405,15 +405,15 @@ $t_changeset_table = plugin_table( 'changeset' ); - $t_query = "SELECT DISTINCT( branch ) FROM $t_changeset_table ORDER BY branch ASC"; + $t_query = "SELECT DISTINCT( branch ), repo_id FROM $t_changeset_table ORDER BY branch ASC"; $t_result = db_query_bound( $t_query ); - echo '', + ''; while( $t_row = db_fetch_array( $t_result ) ) { if ( is_blank( $t_row['branch'] ) ) { continue; } - echo ''; } diff --git a/Source/Source.php b/Source/Source.php index 8133b39..ca3f773 100644 --- a/Source/Source.php +++ b/Source/Source.php @@ -27,6 +27,9 @@ 'MantisCore' => '1.2.0', 'Meta' => '0.1', ); + $this->uses = array( + 'jQuery' => '1.3', + ); $this->page = 'manage_config_page'; $this->author = 'John Reese'; diff --git a/Source/files/search.js b/Source/files/search.js new file mode 100644 index 0000000..c064b0d --- /dev/null +++ b/Source/files/search.js @@ -0,0 +1,80 @@ +/* +# Copyright (C) 2008-2009 John Reese +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +*/ + +$(document).ready( function() { + + var typeselect = $("table.SourceFilters select.SourceType"); + var reposelect = $("table.SourceFilters select.SourceRepo"); + var branchselect = $("table.SourceFilters select.SourceBranch"); + + function SourceTypeChange() { + var options = $(this).children("option:selected"); + var types = new Array(); + options.each( function(index) { + types.push( "SourceType" + this.value ) + }); + reposelect.children("option").each( function(index) { + if ( this.value == "" ) { + //continue; + } + + var show = $(this).hasClass( "SourceAny" ); + for(var i = 0; !show && i < types.length; i++) { + if ( types[i] == "SourceType" || $(this).hasClass( types[i] ) ) { + show = true; + } + } + + if ( show ) { + $(this).show(); + } else { + $(this).hide(); + $(this).removeAttr("selected"); + } + }); + + SourceRepoChange(); + } + + function SourceRepoChange() { + var options = $(this).children("option:selected"); + var types = new Array(); + options.each( function(index) { + repos.push( "SourceRepo" + this.value ) + }); + branchselect.children("option").each( function(index) { + if ( this.value == "" ) { + //continue; + } + + var show = $(this).hasClass( "SourceAny" ); + for(var i = 0; !show && i < repos.length; i++) { + if ( repos[i] == "SourceRepo" || $(this).hasClass( repos[i] ) ) { + show = true; + } + } + + if ( show ) { + $(this).show(); + } else { + $(this).hide(); + $(this).removeAttr("selected"); + } + }); + } + + typeselect.change( SourceTypeChange ); + reposelect.change( SourceRepoChange ); + +}); diff --git a/Source/pages/search_page.php b/Source/pages/search_page.php index 91b2278..6ad46c1 100644 --- a/Source/pages/search_page.php +++ b/Source/pages/search_page.php @@ -25,10 +25,14 @@ ?> + + + +
- +