moseley 02/04/19 12:53:34 Modified: src config.cfg style.css src/search .swishcgi.conf SwishSpiderConfig.pl search.tt searchresults.html swish.conf src/search/modules TemplateToolkit.pm tmpl/custom/html download_link left_box navbar_local_top page_body search Log: Here's the search update with the search box on the left. Please see email to follow on the docs-dev list. Revision Changes Path 1.19 +2 -1 modperl-docs/src/config.cfg Index: config.cfg =================================================================== RCS file: /home/cvs/modperl-docs/src/config.cfg,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- config.cfg 13 Apr 2002 17:46:09 -0000 1.18 +++ config.cfg 19 Apr 2002 19:53:33 -0000 1.19 @@ -76,7 +76,8 @@ dst_split_html => "dst_split_html", # location of the templates (searched left to right) - tmpl => [qw(tmpl/custom tmpl/std tmpl)], + # src/search contains the array and hash for the search areas + tmpl => [qw(tmpl/custom tmpl/std tmpl src/search)], # search path for pods, etc. must put more specific paths first! search_paths => [qw( 1.52 +21 -10 modperl-docs/src/style.css Index: style.css =================================================================== RCS file: /home/cvs/modperl-docs/src/style.css,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- style.css 19 Apr 2002 06:20:57 -0000 1.51 +++ style.css 19 Apr 2002 19:53:33 -0000 1.52 @@ -52,7 +52,7 @@ text-decoration: none; } -div.nonselectedmenuitem a:hover { color: #999999; } +div.nonselectedmenuitem a:hover { text-decoration: underline; } div.selectedmenuitem { padding: 3px; @@ -83,6 +83,11 @@ text-decoration: none; } +div.menu-title a:hover { + text-decoration: underline; +} + + /* dark blue border color for menu-boxes */ td.menu-border { background-color: #525d76; } @@ -188,6 +193,20 @@ /* Search Results */ div.searchform { font-size: 1.0em; } +input { + font-size: 12px; +} + +select { + font-size: 12px; +} + +td.searchtitle { + font-size: 12px; +} + + + td.searchheader { background-color: #525d76; font-family: verdana, arial, helvetica, sans-serif; @@ -204,6 +223,7 @@ /* font-size: 0.6em; */ } + td.searchnav { background-color: #eeeeee; font-family: verdana, arial, helvetica, sans-serif; @@ -297,12 +317,3 @@ } .hr { height: 1px; } - -/* quotations, mainly for the first page */ - -.quotation { - font-style: italic; -} -p.quotation { /* Used to cite the author */ - text-align: right; -} 1.5 +84 -0 modperl-docs/src/search/.swishcgi.conf Index: .swishcgi.conf =================================================================== RCS file: /home/cvs/modperl-docs/src/search/.swishcgi.conf,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- .swishcgi.conf 6 Apr 2002 19:17:16 -0000 1.4 +++ .swishcgi.conf 19 Apr 2002 19:53:33 -0000 1.5 @@ -4,6 +4,85 @@ $ENV{TZ} = 'UTC'; + +# Stas added tree display - Apr 15, 2002 +# syntax (amount of spaces doesn't matter): +# indent path title +# + + +my $items = <<ITEMS; + 0 outstanding Technologie Extraordinaire + 0 download Download + 0 docs Documentation + 1 docs/1.0 mod_perl 1.0 Docs + 2 docs/1.0/guide Guide + 2 docs/1.0/faqs FAQs + 2 docs/1.0/win32 Win32 + 2 docs/1.0/api API + 1 docs/2.0 mod_perl 2.0 Docs + 2 docs/2.0/user User + 2 docs/2.0/devel Developer + 2 docs/2.0/api API + 2 docs/2.0/world Related + 0 help Getting Help + 0 products Products + 0 contribute Contribute +ITEMS + +my @items_flat = split /\n/, $items, ; + +my @items = (); +my $parent; +my $cur_indent = 0; +for my $item (@items_flat) { + $item = '' unless defined $item; + my ($indent, $path, $title); + if ($item =~ m|^\s*(\d+)\s+(\S+)\s+(.*)$|) { + ($indent, $path, $title) = ($1, $2, $3) + } + else { + warn "couldn't parse '$item'"; + next; + } + + my $node = { + label => $title, + value => $path, + parent => $parent, + }; + + my $diff = $indent - $cur_indent; + #print "$indent, $cur_indent, $path, $title\n"; + if ($diff < 1 ) { + for (0..abs($diff)) { + $parent = $parent->{parent}; + $cur_indent--; + } + } + + if ($indent == 0) { + push @items, $node; + $parent = $items[-1]; + $cur_indent = 0; + next; + } + + if ($diff > 1) { + $cur_indent++; + $parent = @{ $parent->{subs} }[-1]; + push @{ $parent->{subs} }, $node; + } + else { # $indent - $cur_indent = 1 + push @{ $parent->{subs} }, $node; + } + +} + +#use Data::Dumper; +#print Dumper [EMAIL PROTECTED]; + + return { title => 'Search mod_perl Site', prepend_path => '../', # search results are shown one level down @@ -17,6 +96,8 @@ INCLUDE_PATH => '.', }, }, + + select_by_meta => { #method => 'radio_group', # pick: radio_group, popup_menu, or checkbox_group method => 'checkbox_group', @@ -47,6 +128,9 @@ }, description => 'Limit search to these areas: ', + + # This is the tree structure of selects + items => [EMAIL PROTECTED], }, }; 1.9 +18 -14 modperl-docs/src/search/SwishSpiderConfig.pl Index: SwishSpiderConfig.pl =================================================================== RCS file: /home/cvs/modperl-docs/src/search/SwishSpiderConfig.pl,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- SwishSpiderConfig.pl 6 Apr 2002 19:17:16 -0000 1.8 +++ SwishSpiderConfig.pl 19 Apr 2002 19:53:33 -0000 1.9 @@ -71,6 +71,7 @@ ## If a page doesn't have an "index_section" then it's probably a table of contents (index.html) ## so don't index it. + $tree->delete; return 0; @@ -106,29 +107,32 @@ my $name = $section->look_down( '_tag', 'a', sub { defined($_[0]->attr('name')) } ); - my @a_content = ('Unknown title'); if ( $name ) { + + my @a_content; + my $section_name = $name->attr('name'); $uri->fragment( $section_name ); - $section_name =~ tr/_//d; - - @a_content = $name->content_list ? $name->content_list : ( $section_name ); - } - + if ( ! (@a_content = $name->content_list) ) { + $section_name =~ tr/_/ /; + @a_content = ( $section_name ); + } - # Modify or create the title + # Modify or create the title - my $title = $head->look_down('_tag', 'title'); + my $title = $head->look_down('_tag', 'title'); - if ( $title ) { - $title->push_content( ': ', @a_content ); - } else { - my $title = HTML::Element->new('title'); - $title->push_content( @a_content ); - $head->push_content( $title ); + if ( $title ) { + $title->push_content( ': ', @a_content ); + } else { + my $title = HTML::Element->new('title'); + $title->push_content( @a_content ); + $head->push_content( $title ); + } } + 1.12 +40 -7 modperl-docs/src/search/search.tt Index: search.tt =================================================================== RCS file: /home/cvs/modperl-docs/src/search/search.tt,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- search.tt 9 Apr 2002 00:58:34 -0000 1.11 +++ search.tt 19 Apr 2002 19:53:33 -0000 1.12 @@ -1,6 +1,11 @@ [% # This template is used for rendering the search results # It expects the search hash ref to be set. -%] + + +[% PROCESS search_options %] + + [% WRAPPER searchresults.html %] [% # Title takes up space for no reason @@ -14,10 +19,11 @@ ELSE; nav_bar_res = PROCESS nav_bar; - PROCESS search_form; nav_bar_res; PROCESS results_list; nav_bar_res IF search.navigation('hits') > search.config('page_size'); + '<p><a name="search_form"></a>'; + PROCESS search_form; END; %] [% END %] @@ -54,11 +60,32 @@ [% BLOCK show_message %] [% IF search.errstr %] - <font size="+2" color="red">[% search.errstr | html %]</font> + <font size="+2" color="red"> + [% IF search.errstr == 'no results' %] + No Results + [% ELSE %] + [% search.errstr | html %] + [% END %] + </font> + + [% IF search.errstr == 'no results' && CGI.param('sbm') %] + <br>(Try searching the whole site or use a different keyword) + [% END %] [% END %] [% END %] +[% BLOCK sub_items %] + <ul> + [%- FOREACH sec = subs -%] + + <li>[% CGI.checkbox('sbm', 0, sec.value, sec.label); %] + [%- IF sec.subs -%][%- PROCESS sub_items subs=sec.subs -%][%- END -%]</li> + + [%- END -%] + </ul> + +[% END %] [% BLOCK search_form %] @@ -66,7 +93,7 @@ [% CGI.start_form( '-action' => CGI.script_name) %] [% CGI.textfield( { name => 'query', - size => 25, + size => 40, maxlength => 200, } ) %] @@ -74,8 +101,10 @@ [% search.get_meta_name_limits %] [% search.get_sort_select_list %] [% search.get_index_select_list %] - [% search.get_limit_select %] - + [% SET limit = search.get_limit_select_tree %] + <br> + [% limit.description %] + [%- INCLUDE sub_items subs=limit.items -%] [% CGI.end_form.join('') %] </div> @@ -92,14 +121,14 @@ [% search.navigation('from') %] to [% search.navigation('to') %] of [% search.navigation('hits') %] results. </td> <td align="right" class="searchtimes"> - [% search.navigation('search_time') %] + [% search.navigation('search_time') %] </td> </tr> [% IF search.navigation('pages') %] <tr> - <td colspan="2" class="searchnav"> + <td class="searchnav"> Page: [% search.navigation('pages') %] @@ -113,6 +142,10 @@ Next [% search.navigation('next_count') %]</a> [% END %] </td> + <td align="right" class="searchnav"> + <a href="#search_form"><span class="advanced-search">Advanced Search</span></a> + </td> + </tr> [% END %] 1.2 +1 -0 modperl-docs/src/search/searchresults.html Index: searchresults.html =================================================================== RCS file: /home/cvs/modperl-docs/src/search/searchresults.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- searchresults.html 30 Jan 2002 06:35:00 -0000 1.1 +++ searchresults.html 19 Apr 2002 19:53:33 -0000 1.2 @@ -9,3 +9,4 @@ </body> </html> + 1.8 +4 -4 modperl-docs/src/search/swish.conf Index: swish.conf =================================================================== RCS file: /home/cvs/modperl-docs/src/search/swish.conf,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- swish.conf 6 Apr 2002 19:17:16 -0000 1.7 +++ swish.conf 19 Apr 2002 19:53:33 -0000 1.8 @@ -13,8 +13,8 @@ # And don't index any text from other <meta> tags UndefinedMetaTags ignore -# Add in chars [_:] to allow them in the middle of a word -WordCharacters _:0123456789abcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ -IgnoreFirstChar _: -IgnoreLastChar _: +# Add in chars [_:-] to allow them in the middle of a word +WordCharacters _-:0123456789abcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ +IgnoreFirstChar _:- +IgnoreLastChar _:- 1.3 +12 -1 modperl-docs/src/search/modules/TemplateToolkit.pm Index: TemplateToolkit.pm =================================================================== RCS file: /home/cvs/modperl-docs/src/search/modules/TemplateToolkit.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TemplateToolkit.pm 9 Apr 2002 00:58:34 -0000 1.2 +++ TemplateToolkit.pm 19 Apr 2002 19:53:34 -0000 1.3 @@ -1,6 +1,6 @@ #======================================================================= # Module for using Template-Toolkit for generating output -# $Id: TemplateToolkit.pm,v 1.2 2002/04/09 00:58:34 moseley Exp $ +# $Id: TemplateToolkit.pm,v 1.3 2002/04/19 19:53:34 moseley Exp $ # #======================================================================= package TemplateToolkit; @@ -175,6 +175,17 @@ ( $limit->{description} || 'Select: '), $q->$method( @options ); } + +sub get_limit_select_tree { + my ( $results ) = @_; + + my $limit = $results->config('select_by_meta'); + return {} unless ref $limit eq 'HASH'; + + $limit->{description} ||= 'Select: '; + return $limit; +} + sub stopwords_removed { my $results = shift; 1.8 +3 -3 modperl-docs/tmpl/custom/html/download_link Index: download_link =================================================================== RCS file: /home/cvs/modperl-docs/tmpl/custom/html/download_link,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- download_link 19 Apr 2002 06:01:05 -0000 1.7 +++ download_link 19 Apr 2002 19:53:34 -0000 1.8 @@ -1,13 +1,13 @@ [%- # link to the pdf, source and other variants of the doc # src block flag = 0; - IF doc.src_doc.link; + IF doc.src_doc.link && doc.meta.link != 'search/searchresults.html'; INCLUDE src_doc; ELSE; flag = flag + 1; END; # pdf block - IF doc.pdf_doc.link; + IF doc.pdf_doc.link && doc.meta.link != 'search/searchresults.html'; INCLUDE pdf_doc; ELSE; flag = flag + 1; @@ -22,4 +22,4 @@ [%- END -%] [%- BLOCK pdf_doc -%] <a href="[%- doc.pdf_doc.link -%]"><img src="[%- doc.dir.abs_doc_root -%]/images/nav/page_pdf.gif" width="48" height="20" border="0" alt="PDF version of the document ([%- doc.pdf_doc.size -%])"></a> -[%- END -%] \ No newline at end of file +[%- END -%] 1.3 +3 -1 modperl-docs/tmpl/custom/html/left_box Index: left_box =================================================================== RCS file: /home/cvs/modperl-docs/tmpl/custom/html/left_box,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- left_box 13 Apr 2002 18:25:48 -0000 1.2 +++ left_box 19 Apr 2002 19:53:34 -0000 1.3 @@ -14,6 +14,7 @@ <br> +[% IF 1 %] <!-- search begin --> [%- INCLUDE search -%] @@ -21,6 +22,7 @@ <!-- search end --> <br> +[% END %] <!-- menu short_cuts begin --> @@ -44,4 +46,4 @@ <!-- ad end --> - <br><br> \ No newline at end of file + <br><br> 1.15 +4 -3 modperl-docs/tmpl/custom/html/navbar_local_top Index: navbar_local_top =================================================================== RCS file: /home/cvs/modperl-docs/tmpl/custom/html/navbar_local_top,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- navbar_local_top 13 Apr 2002 02:59:44 -0000 1.14 +++ navbar_local_top 19 Apr 2002 19:53:34 -0000 1.15 @@ -10,11 +10,12 @@ <td colspan="2" height="6"><br class="smallbr"></td> </tr> <tr valign="middle"> - <td align="left" valign="top" width="50%" nowrap>[%- INCLUDE download_link -%]</td> - <td align="right" valign="top" width="50%" nowrap>[%- INCLUDE prev_next_link -%]</td> + [% IF 0 %]<td align="left" valign="top" nowrap>[%- INCLUDE search_field -%]</td>[% END %] + <td align="left" valign="top" nowrap>[%- INCLUDE download_link -%]</td> + <td align="right" valign="top" nowrap>[%- INCLUDE prev_next_link -%]</td> </tr> <tr> <td colspan="2" height="6"><br class="smallbr"></td> </tr> </table> - <!-- download and local navigation end --> \ No newline at end of file + <!-- download and local navigation end --> 1.22 +4 -0 modperl-docs/tmpl/custom/html/page_body Index: page_body =================================================================== RCS file: /home/cvs/modperl-docs/tmpl/custom/html/page_body,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- page_body 3 Apr 2002 05:18:27 -0000 1.21 +++ page_body 19 Apr 2002 19:53:34 -0000 1.22 @@ -1,9 +1,13 @@ + + [%- INCLUDE title; INCLUDE navbar_local_top nav=doc.nav rel_doc_root=doc.dir.rel_doc_root; + + -%] 1.19 +96 -31 modperl-docs/tmpl/custom/html/search Index: search =================================================================== RCS file: /home/cvs/modperl-docs/tmpl/custom/html/search,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- search 13 Apr 2002 18:28:28 -0000 1.18 +++ search 19 Apr 2002 19:53:34 -0000 1.19 @@ -2,7 +2,26 @@ # this template expects these vars to be set: # doc.dir.abs_doc_root - doc root # doc.dir.path_from_base + + # search_opitons is an array and hash for generating the drop-down box. -%] + + +[%- PROCESS search_options -%] +[%- USE CGI -%] + +[% + IF doc.meta.link == 'search/searchresults.html'; + PROCESS build_results_search_widgets; + ELSE; + PROCESS build_std_search_widgets; + END; +%] + + + + + <table border="0" cellspacing="0" cellpadding="0" width="150" align="center"> <tr> <td class="menu-border" width="1"><br class="smallbr"></td> @@ -27,36 +46,7 @@ <td class="non-sel-bg" align="center"> <div class="nonselectedmenuitem"> <form method="post" action="[% doc.dir.abs_doc_root %]/search/swish.cgi" enctype="application/x-www-form-urlencoded" name="site_search_form"> - <table border="0" cellspacing="0" cellpadding="2"> - <tr> - <td colspan="2" height="5"><br class="smallbr"></td> - </tr> - <tr> - <td colspan="2" align="center"> - <!-- cannot more than 12 for NS to render properly! --> - <input type="text" name="query" size="12" maxlength="200" value=""> - </td> - </tr> - <tr> - <td colspan="2" height="5"><br class="smallbr"></td> - </tr> - <tr valign="top"> - <td><input type="radio" name="sbm" value="[% doc.dir.path_from_base %]" checked></td> - <td class="radio-font">This section</td> - </tr> - <tr valign="top"> - <td><input type="radio" name="sbm" value=""></td> - <td class="radio-font">Whole site</td> - </tr> - <tr> - <td colspan="2" height="5"><br class="smallbr"></td> - </tr> - <tr> - <td colspan="2" align="center"> - <input type="submit" name="submit" value="Search!"> - </td> - </tr> - </table> + [% PROCESS search_widget %] </form> </div> </td> @@ -66,4 +56,79 @@ <tr> <td class="menu-border" colspan="3" height="1"><br class="smallbr"></td> </tr> - </table> \ No newline at end of file + </table> + + + +[% BLOCK search_widget %] + <table border="0" cellspacing="0" cellpadding="2"> + + <tr> + <td colspan="2" align="center" nowrap="nowrap">[% search_input %]<br> + <input type="submit" name="submit" value="search"> + </tr> + + <tr valign="top"> + <td align="center">[% search_options %]</td> + </tr> + + </table> +[% END %] + +[% BLOCK build_results_search_widgets %] + + [% + stag = "[\%" + etag = "%\]" + %] + + [% search_input = BLOCK %] + + [% stag %] CGI.textfield( { + name => 'query', + size => 12, + maxlength => 200, + } ) + [% etag %] + + [% END %] + + [% search_options = BLOCK %] + + [% stag %] CGI.popup_menu( { + Name => 'sbm', + Values => search_areas, + Labels => search_labels, + }) + [% etag %] + + [% IF 0 %] + [% stag %] IF search.results [% etag %] + <br> + <a href="#search_form"><span class="searchtext">Advanced</span></a> + [% stag %] END [% etag %] + [% END %] + + [% END %] + +[% END %] + + +[% BLOCK build_std_search_widgets %] + + [% search_input = BLOCK %] + <input type="text" name="query" size="12" maxlength="200" value=""> + [% END %] + + [% search_options = BLOCK %] + + [% CGI.popup_menu( { + Name => 'sbm', + Values => search_areas, + Labels => search_labels, + Default => doc.dir.path_from_base, + }) + %] + [% END %] +[% END %] +
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]