diff --git a/Source/Source.FilterAPI.php b/Source/Source.FilterAPI.php index 9f68165..2da6c1e 100644 --- a/Source/Source.FilterAPI.php +++ b/Source/Source.FilterAPI.php @@ -44,6 +44,7 @@ $this->filters['c.author'] = new SourceFilterOption(); $this->filters['c.message'] = new SourceFilterOption(); $this->filters['c.user_id'] = new SourceFilterOption(); + $this->filters['c.ported'] = new SourceFilterOption(); $this->filters['r.id'] = new SourceFilterOption(); $this->filters['r.type'] = new SourceFilterOption(); @@ -193,6 +194,40 @@ return array( $sql, $value ); } + # Porting status + if ( $key == 'c.ported' ) { + $clauses = array(); + + foreach( $value as $ported ) { + # ported + if ( $ported == "-2" ) { + $clauses[] = "( $key != '' AND $key != '0' )"; + } + # pending + if ( $ported == "-1" ) { + $clauses[] = "$key = ''"; + } + # n/a + if ( $ported == "0" ) { + $clauses[] = "$key = '0'"; + } + } + + if ( SOURCE_ANY == $how ) { + if ( count( $clauses ) > 0 ) { + return array( '(' . implode( ' OR ', $clauses ) . ')', array() ); + } else { + return array( null, null ); + } + } else { + if ( count( $clauses ) > 0 ) { + return array( 'NOT (' . implode( ' OR ', $clauses ) . ')', array() ); + } else { + return array( null, null ); + } + } + } + # Standard values if ( is_array( $value ) ) { $wc = map( 'db_param', $value ); @@ -234,6 +269,7 @@ $f_repo_id = Source_FilterOption_Permalink( 'repo_id', true ); $f_branch = Source_FilterOption_Permalink( 'branch', true ); $f_file_action = Source_FilterOption_Permalink( 'file_action', true ); + $f_ported = Source_FilterOption_Permalink( 'ported', true ); $f_revision = Source_FilterOption_Permalink( 'revision' ); $f_author = Source_FilterOption_Permalink( 'author' ); @@ -256,6 +292,7 @@ $t_filter->filters['c.message']->value = $f_message; $t_filter->filters['c.author']->value = $f_author; $t_filter->filters['c.user_id']->value = $f_user_id; + $t_filter->filters['c.ported']->value = $f_ported; $t_filter->filters['r.id']->value = $f_repo_id; $t_filter->filters['r.type']->value = $f_repo_type; @@ -496,6 +533,21 @@ echo ''; } +function Source_Ported_Select( $p_selected=null ) { + if ( !is_array( $p_selected ) ) { + $t_selected = array( $p_selected ); + } else { + $t_selected = $p_selected; + } + + echo ''; +} + function Source_Date_StampArray( $t_input ) { if ( !preg_match( '/^(\d{4})\-(\d{1,2})\-(\d{1,2})/', $t_input, $t_matches ) ) { return null; @@ -545,3 +597,4 @@ print_day_option_list( $t_selected[2] ); echo ' '; } + diff --git a/Source/pages/search_page.php b/Source/pages/search_page.php index 6ad46c1..7f0c75a 100644 --- a/Source/pages/search_page.php +++ b/Source/pages/search_page.php @@ -85,6 +85,13 @@ + +> +Porting Status +filters['c.ported']->value ); ?> + + + >