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

www www at source.lon-capa.org
Thu Jul 19 15:42:20 EDT 2012


www		Thu Jul 19 19:42:20 2012 EDT

  Modified files:              
    /modules/gerd/harvesting	lonrecommender.pm 
  Log:
  Bugfix for problem type filter. Unused routine for possible "tagcloud" in the future.
  
  
Index: modules/gerd/harvesting/lonrecommender.pm
diff -u modules/gerd/harvesting/lonrecommender.pm:1.32 modules/gerd/harvesting/lonrecommender.pm:1.33
--- modules/gerd/harvesting/lonrecommender.pm:1.32	Thu Jul 19 17:04:38 2012
+++ modules/gerd/harvesting/lonrecommender.pm	Thu Jul 19 19:42:20 2012
@@ -5,7 +5,7 @@
 #
 # MODIFY $datapath VARIABLE FOR LOCATION OF DATA FILES
 #
-# $Id: lonrecommender.pm,v 1.32 2012/07/19 17:04:38 www Exp $
+# $Id: lonrecommender.pm,v 1.33 2012/07/19 19:42:20 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -342,6 +342,30 @@
 
 # =================================================================================
 #
+#  Return the keywords associated with a list of resource IDs
+#
+
+sub assoc_keywords {
+   my (@urlids)=@_;
+   my $collection='';
+   my %hash=();
+   tie(%hash, 'GDBM_File', $datapath.'dbfiles/keywords.db',&GDBM_READER(),0640);
+   foreach my $key (@urlids) {
+      $collection.=','.$hash{$key};
+   }
+   untie(%hash);
+   my %output=();
+   foreach my $keyw (split(/\,/,$collection)) {
+      if ($keyw=~/\w/) {
+         $output{$keyw}=1;
+      }
+   }
+   return sort(keys(%output));
+}
+
+
+# =================================================================================
+#
 # Filter by resource type and if already existing
 # Take search string and hash of resids
 #
@@ -475,6 +499,7 @@
       }
       @urls=@newurls;
    }
+   &elog('cart', at urls);
    return @urls;
 }
 
@@ -514,7 +539,7 @@
 
 sub display_list {
    my ($r,$editflag,$taxocats, at urls)=@_;
-   &elog('shown', at urls);
+   &elog('shown',$editflag, at urls);
    my %urlids=&urlres(@urls);
    my %taxoids=&taxoids(values(%urlids));
    $r->print(&Apache::loncommon::start_data_table());
@@ -771,7 +796,7 @@
                '<option value="sty">'.&mt('Style File').'</option>'.
                '<option value="rights">'.&mt("Rights File").'</option>';
     foreach my $type (sort(keys(%problemtypes))) {
-       $output.="\n".'<option value="$type">-- '.$problemtypes{$type}.'</option>';
+       $output.="\n".'<option value="'.$type.'">-- '.$problemtypes{$type}.'</option>';
     }
     $output.='</select>';
     $output=~s/(value=\"\Q$filter\E\")\>/$1 selected=\"selected\"\>/s;




More information about the LON-CAPA-cvs mailing list