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

www www at source.lon-capa.org
Mon Jul 16 14:07:24 EDT 2012


www		Mon Jul 16 18:07:24 2012 EDT

  Modified files:              
    /modules/gerd/harvesting	lonrecommender.pm 
  Log:
  Edit commands work now
  
  
Index: modules/gerd/harvesting/lonrecommender.pm
diff -u modules/gerd/harvesting/lonrecommender.pm:1.11 modules/gerd/harvesting/lonrecommender.pm:1.12
--- modules/gerd/harvesting/lonrecommender.pm:1.11	Mon Jul 16 17:16:28 2012
+++ modules/gerd/harvesting/lonrecommender.pm	Mon Jul 16 18:07:24 2012
@@ -5,7 +5,7 @@
 #
 # MODIFY $datapath VARIABLE FOR LOCATION OF DATA FILES
 #
-# $Id: lonrecommender.pm,v 1.11 2012/07/16 17:16:28 www Exp $
+# $Id: lonrecommender.pm,v 1.12 2012/07/16 18:07:24 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -391,11 +391,11 @@
         "/home/httpd/perl/tmp/$env{'user.domain'}_$env{'user.name'}_sel_res.db";
    my %dbfile;
    my @urls=();
-# Tie the file and write into it
+# Tie the file and read from it
    if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_READER(),0640)) {
       foreach my $fkey (keys(%dbfile)) {
          if ($fkey=~/^storectr\_(.+)$/) {
-            $urls[$fkey]=$1;
+            $urls[$dbfile{$fkey}]=$1;
          }
       }
       untie(%dbfile);
@@ -447,7 +447,7 @@
 sub display_line {
    my ($url,$taxonomy,$editflag)=@_;
    return "\n<tr><td>".
-          &submit_link(($editflag?'Remove':'Add'),($editflag?'rem_':'add_'.$url)).
+          &submit_link(($editflag?'Remove':'Add'),($editflag?'rem:':'add:').$url).
           "</td><td>".
           &submit_link(&Apache::lonnet::gettitle($url),'indiv:'.$url).
           "</td><td>".
@@ -559,6 +559,7 @@
 # ------ ... and execute any editing commands
     if ($cmd=~/^(add|rem)\:/) {
        @selectedurls=&edit_commands($cmd, at selectedurls);
+       &write_groupimportfile(@selectedurls);
     }
 # ------ Add the resource IDs of the selected URLs to the existing ones
     my @selectedids=&urlres(@selectedurls);
@@ -582,7 +583,7 @@
               &mt('Search')."' /></td>");
     if (($cmd ne 'showbasket') && ($cmd!~/^rem\:/)) {
        $r->print("<td rowspan='2' align='right' bgcolor='#DDDDFF'>".
-                 &submit_link(&mt('Your cart ([_1] item(s))',$#selectedurls+1),'showbasket').
+                 &submit_link(&mt('Your cart ([_1] item(s))',$#selectedurls+1),'showbasket').
                  "</td>");
     }
     $r->print("</tr>\n<tr>");
@@ -598,7 +599,8 @@
        '/res/msu/physicslib/msuphysicslib/05_1D_Motion/msu-prob49.problem')
     );
 
-    if (($cmd eq 'showbasket') || ($cmd!~/^rem\:/)) {
+    if (($cmd eq 'showbasket') || ($cmd=~/^rem\:/)) {
+       &display_list($r,1,\%taxonomy_categories, at selectedurls);
     } elsif ($cmd eq 'search') {
     } elsif ($cmd=~/^taxo\:/) {
     } elsif ($cmd=~/^dir\:/) {




More information about the LON-CAPA-cvs mailing list