Changeset 26094

Show
Ignore:
Timestamp:
09.08.2012 17:20:51 (7 years ago)
Author:
ak19
Message:

Finally properly fixed the appearance and non-appearance of the quick search form. It should not appear if there are no query elements in the config file. However, even when no search indexes were built, query elements still came through in the XML and it was hard to distinguish at the XSLT stage whether any search indexes were built or not. Kathy suggested that the perl code writing out the buildconfig.xml should not write out the ServiceRacks? for searching if no indexes were built and pointed out that the changes were required in buildconfigxml.pm which was called from basebuilder.pm to write out the buildConfig.xml file. Now the XSLT can at last do the right thing: it doesn't display the quick search area if there are no search elements, and doesn't provide the plain text query form in the quick search area if TextQuery? isn't one of the query types, but does provide the buttons to other query types like form search if these are meant to be visible according to the SearchType? format feature. If there are no search indexes built, then there is no quick search area.

Location:
main/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/basebuilder.pm

    r25958 r26094  
    560560    } 
    561561    } 
     562     
     563    # store the number of indexes built to later determine whether search serviceracks get written out to buildConfig.xml 
     564    $build_cfg->{'num_indexes'} = scalar (@indexmap);    
     565     
    562566    $build_cfg->{'indexmap'} = \@indexmap if scalar (@indexmap); 
    563567 
  • main/trunk/greenstone2/perllib/buildConfigxml.pm

    r25758 r26094  
    273273    } 
    274274    } else { 
    275     print STDERR "$maptype not defined"; 
    276     } 
    277  
     275    print STDERR "$maptype not defined\n"; 
     276    } 
     277 
     278    $settings->{'num_indexes'} = $buildcfg->{'num_indexes'}; 
    278279    $settings->{'defaultindex'} = $defaultindex; 
    279280    $settings->{'indexmap'} = $indexmap; 
     
    352353    } 
    353354    # the default level assigned by the user is no longer ignored [Shaoqun], but the retrievel level stays the same.  
    354         #if (defined $collectcfg->{"defaultlevel"}) { 
    355     $default_search_level = $levelmap->{$collectcfg->{"defaultlevel"}}; 
     355    if (defined $collectcfg->{"defaultlevel"}) { 
     356        $default_search_level = $levelmap->{$collectcfg->{"defaultlevel"}}; 
    356357        #  $default_retrieve_level = $default_search_level; 
    357     #} 
     358    } 
    358359     
    359360    if (defined $buildcfg->{'textlevel'}) { 
     
    366367    $settings->{'levelmap'} = $levelmap; 
    367368    $settings->{'levellist'} = $levellist; 
    368     $settings->{'default_search_level'} = $default_search_level; 
     369    $settings->{'default_search_level'} = $default_search_level if $default_search_level; 
    369370    $settings->{'default_retrieve_level'} = $default_retrieve_level; 
    370371    $settings->{'default_db_level'} = $default_db_level; 
     
    383384    my $service_type = $settings->{'service_type'}; 
    384385 
     386    # there's no searching and therefore no search services if there are no indexes 
     387    return if($settings->{'num_indexes'} <= 0); 
     388     
    385389    # do the search service  
    386390    &write_line('COLCFG', ["<serviceRack name=\"GS2", $service_type, "Search\">"]); 
     
    523527    my ($buildcfg,$settings) = @_; 
    524528 
     529    #return if($settings->{'num_indexes'} <= 0);    # no search if no indexes 
     530     
    525531    my $infodbtype   = $settings->{'infodbtype'}; 
    526532 
  • main/trunk/greenstone3/web/interfaces/default/transform/layouts/header.xsl

    r26084 r26094  
    360360         no search indexes, which is why the extra test for the presence of an index/fq-something is necessary. --> 
    361361    <xsl:template name="quick-search-area"> 
    362         <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']/paramList/param[@name='index' or starts-with(@name, 'fq')]"> 
     362        <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']"> 
    363363            <xsl:variable name="subaction" select="/page/pageRequest/@subaction"/> 
    364364            <div id="quicksearcharea"> 
     365                <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']"> 
    365366                <form action="{$library_name}/collection/{$collNameChecked}/search/TextQuery"> 
    366367                    <!-- This parameter says that we have come from the quick search area --> 
     
    423424                    <br/> 
    424425                    </xsl:if> 
     426                </form> 
     427                </xsl:if> 
     428                 
    425429                    <!-- The list of other search types --> 
    426430                    <ul> 
     
    436440                        </xsl:for-each> 
    437441                    </ul> 
    438                 </form> 
    439442            </div> 
    440443        </xsl:if>