[Cpan-forum-commit] rev 68 - in trunk: lib/CPAN templates

svn at pti.co.il svn at pti.co.il
Wed Feb 2 21:48:31 IST 2005


Author: gabor
Date: 2005-02-02 21:48:31 +0200 (Wed, 02 Feb 2005)
New Revision: 68

Modified:
   trunk/lib/CPAN/Forum.pm
   trunk/templates/search.tmpl
Log:
add another search box to find modules

Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm	2005-02-02 19:07:28 UTC (rev 67)
+++ trunk/lib/CPAN/Forum.pm	2005-02-02 19:48:31 UTC (rev 68)
@@ -184,7 +184,9 @@
 v0.10_02
   <p>, <br> enabled
   Add link to Kobes Search
+  Improve full text search for posts
 
+
 v0.10
 - markup improved, bugs fixed
 
@@ -212,11 +214,8 @@
 tag for code:  </code>
 
 - check all submitted fields (restrict posting size to 10.000 Kbyte ?
-- Make the site look nicer (HTML and css work)
 - Improve text and explanations.
-- Improve Legal statement, look at other sites.
 
-
 clean up documentation
 
 add indexes to the tables ?
@@ -595,6 +594,7 @@
 					posts threads dist users 
 					search all 
 					help
+					find_groups
 					rss ); 
 my @restricted_modes = qw(
 			new_post process_post
@@ -1774,29 +1774,32 @@
 
 =cut
 # not in use
-sub small_search {
-	my $self = shift;
-	my $q       = $self->query;
-	my $name    = $q->param("name")    || '';
+sub find_groups {
+	my $self  = shift;
+	my $q     = $self->query;
+	my $name  = $q->param("name")    || '';
 
-	if ($name    =~ /(.*)/) { $name    = $1; }
+	if ($name =~ /(.*)/) { $name    = $1; }
+	$name =~ s/::/-/g;
 	
 	my $t = $self->load_tmpl("search.tmpl",
 		associate => $q,
 		loop_context_vars => 1,
 	);
-
+	my $it;
+	my @groups;
 	if ($name) {
 		my $it =  CPAN::Forum::Groups->search_like(name => $name . '%');
-		my $cnt = CPAN::Forum::Groups->sql_count_like("name" =>  $name . '%')->select_val;
-		$t->param(messages => $self->build_listing($it,$cnt));
+		while (my $group  = $it->next) {
+			push @groups, {name => $group->name};
+		}
 	}
+	$t->param(groups => \@groups);
 
 	$t->output;
 }
 
 
-# not yet in use
 sub search {
 	my $self = shift;
 

Modified: trunk/templates/search.tmpl
===================================================================
--- trunk/templates/search.tmpl	2005-02-02 19:07:28 UTC (rev 67)
+++ trunk/templates/search.tmpl	2005-02-02 19:48:31 UTC (rev 68)
@@ -5,6 +5,20 @@
 
 <form method="post" action="/search/">
 <p>
+<input type="hidden" name="rm" value="find_groups" />
+<input name="name" value="<TMPL_VAR name>" /><br />
+<input type="submit" value="Search Module names" />
+</p>
+</form>
+
+<TMPL_LOOP groups>
+   <a href="/dist/<TMPL_VAR name>"><TMPL_VAR name></a><br />
+</TMPL_LOOP>
+
+<hr />
+
+<form method="post" action="/search/">
+<p>
 <input type="hidden" name="rm" value="search" />
 </p>
 <table>
@@ -16,10 +30,7 @@
 </p>
 </form>
 
-<TMPL_IF q>
-Search results
-</TMPL_IF>
+<TMPL_INCLUDE NAME="listing.tmpl">
 
-<TMPL_INCLUDE NAME="listing.tmpl">
 <TMPL_INCLUDE NAME="footer.tmpl">
 



More information about the Cpan-forum-commit mailing list