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

www www at source.lon-capa.org
Wed Jul 11 21:22:30 EDT 2012


www		Thu Jul 12 01:22:30 2012 EDT

  Modified files:              
    /modules/gerd/harvesting	lonrecommender.pm 
  Log:
  Link back to groupsort
  
  
Index: modules/gerd/harvesting/lonrecommender.pm
diff -u modules/gerd/harvesting/lonrecommender.pm:1.1 modules/gerd/harvesting/lonrecommender.pm:1.2
--- modules/gerd/harvesting/lonrecommender.pm:1.1	Thu Jul 12 00:21:09 2012
+++ modules/gerd/harvesting/lonrecommender.pm	Thu Jul 12 01:22:30 2012
@@ -5,7 +5,7 @@
 #
 # MODIFY $datapath VARIABLE FOR LOCATION OF DATA FILES
 #
-# $Id: lonrecommender.pm,v 1.1 2012/07/12 00:21:09 www Exp $
+# $Id: lonrecommender.pm,v 1.2 2012/07/12 01:22:30 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -30,20 +30,6 @@
 # http://www.lon-capa.org/
 #
 ###
-
-###############################################################################
-##                                                                           ##
-## ORGANIZATION OF THIS PERL MODULE                                          ##
-##                                                                           ##
-## 1. Description of functions                                               ##
-## 2. Modules used by this module                                            ##
-## 3. Choices for different output views (detailed, summary, xml, etc)       ##
-## 4. BEGIN block (to be run once after compilation)                         ##
-## 5. Handling routine called via Apache and mod_perl                        ##
-## 6. Other subroutines                                                      ##
-##                                                                           ##
-###############################################################################
-
 package Apache::lonrecommender;
 
 # ------------------------------------------------- modules used by this module
@@ -281,6 +267,26 @@
 }
 
 # =================================================================================
+# Write a file in groupimport format
+#
+
+sub write_groupimportfile {
+   my @urls=@_;
+   my $diropendb =
+        "/home/httpd/perl/tmp/$env{'user.domain'}_$env{'user.name'}_sel_res.db";
+   my %dbfile;
+# Remove old garbage
+   unlink($diropendb);
+# Tie the file and write into it
+   tie(%dbfile,'GDBM_File',$diropendb,&GDBM_WRITER(),0640);
+   for (my $i=0;$i<=$#urls;$i++) {
+       $dbfile{'store_'.$urls[$i]}=1;
+       $dbfile{'storectr_'.$urls[$i]}=$i;
+   }
+   untie(%dbfile);
+}
+
+# =================================================================================
 #
 
 sub handle_request {
@@ -302,6 +308,13 @@
     $r->print(&Apache::loncommon::start_page("Recommender"));
     $r->print("<h1>Hello World!</h1>");
     $r->print(join("<br />\n", at existingbasket));
+    &write_groupimportfile(
+         '/res/msu/kortemey/physicsprecourse/functions/chain.problem',
+         '/res/msu/kortemey/physicsprecourse/functions/decay.problem',
+         '/res/msu/kortemey/physicsprecourse/functions/decibels.problem');
+    $r->print("<form method='post' action='/adm/groupsort'>");
+    $r->print("<input type='submit'>");
+    $r->print("</form>");
     $r->print(&Apache::loncommon::end_page());
     return 1;
 }




More information about the LON-CAPA-cvs mailing list