[LON-CAPA-cvs] cvs: modules /gerd/harvesting lonrecommender.pm

www www at source.lon-capa.org
Wed Jul 18 12:54:35 EDT 2012


www		Wed Jul 18 16:54:35 2012 EDT

  Modified files:              
    /modules/gerd/harvesting	lonrecommender.pm 
  Log:
  Search works
  
  
Index: modules/gerd/harvesting/lonrecommender.pm
diff -u modules/gerd/harvesting/lonrecommender.pm:1.21 modules/gerd/harvesting/lonrecommender.pm:1.22
--- modules/gerd/harvesting/lonrecommender.pm:1.21	Wed Jul 18 16:25:15 2012
+++ modules/gerd/harvesting/lonrecommender.pm	Wed Jul 18 16:54:35 2012
@@ -5,7 +5,7 @@
 #
 # MODIFY $datapath VARIABLE FOR LOCATION OF DATA FILES
 #
-# $Id: lonrecommender.pm,v 1.21 2012/07/18 16:25:15 www Exp $
+# $Id: lonrecommender.pm,v 1.22 2012/07/18 16:54:35 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -123,14 +123,6 @@
          $associations{$b}/$maxassoc+$counts{$b}/$maxcount 
      <=> $associations{$a}/$maxassoc+$counts{$a}/$maxcount
    } (@$list);
-
-   for (my $i=0; $i<=10; $i++) {
-       &Apache::lonnet::logthis($i.":".$newlist[$i].' -> '.$associations{$newlist[$i]}.' - '.$counts{$newlist[$i]});
-   }
-   for (my $i=90000; $i<=90010; $i++) {
-       &Apache::lonnet::logthis($i.":".$newlist[$i].' -> '.$associations{$newlist[$i]}.' - '.$counts{$newlist[$i]});
-   }
-
    return @newlist;
 }
 
@@ -307,7 +299,7 @@
 #
 
 sub keyword_search {
-   my @keywords=@_;
+   my ($filter, at keywords)=@_;
    my %output=();
    my $skey=join(',', at keywords);
    $skey=~s/^\W+//gs;
@@ -738,8 +730,10 @@
     $r->print('<input type="hidden" name="cmd" value="" />');
 # ------ Page opened
 # ------ Make header row
+    my $searchterm=$env{'form.searchterm'};
+    $searchterm=~s/[\"\']//gs;
     $r->print("<table width='100%'><tr>\n");
-    $r->print("<td><input type='text' size='40' name='searchterm' /><input type='submit' name='search' value='".
+    $r->print("<td><input type='text' size='40' name='searchterm' value='$searchterm' /><input type='submit' name='search' value='".
               &mt('Search')."' /></td>");
     $r->print("<td rowspan='2' align='right' bgcolor='#DDDDFF'>".
               "<font size='+1'><a href='/adm/groupsort?inhibitmenu=yes'>".&mt("Checkout")."</a></font><br /> <br />".
@@ -750,8 +744,11 @@
     $r->print("\n</tr></table>");
 # ------ End header row
     if (($cmd eq 'showbasket') || ($cmd=~/^rem\:/)) {
+       $r->print("\n<h1>".&mt("Current Cart")."</h1>\n");
        &display_list($r,1,\%taxonomy_categories, at selectedurls);
-    } elsif ($cmd eq 'search') {
+    } elsif ($env{'form.search'}) {
+       my %list=&urlres((&keyword_search($filter,$env{'form.searchterm'}))[0..9]);
+       &display_list($r,0,\%taxonomy_categories,values(%list));
     } elsif ($cmd=~/^taxo\:/) {
        $r->print(&list_nextlevel_cats($cmd,\%taxonomy_categories));
        my %list=&urlres((&show_taxonomy_list($cmd,\%taxonomy_categories,$filter, at baseids))[0..9]);




More information about the LON-CAPA-cvs mailing list