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

www www at source.lon-capa.org
Sun Jul 15 09:12:04 EDT 2012


www		Sun Jul 15 13:12:04 2012 EDT

  Modified files:              
    /modules/gerd/harvesting	lonrecommender.pm 
  Log:
  URL link
  
  
Index: modules/gerd/harvesting/lonrecommender.pm
diff -u modules/gerd/harvesting/lonrecommender.pm:1.7 modules/gerd/harvesting/lonrecommender.pm:1.8
--- modules/gerd/harvesting/lonrecommender.pm:1.7	Sun Jul 15 12:22:17 2012
+++ modules/gerd/harvesting/lonrecommender.pm	Sun Jul 15 13:12:04 2012
@@ -5,7 +5,7 @@
 #
 # MODIFY $datapath VARIABLE FOR LOCATION OF DATA FILES
 #
-# $Id: lonrecommender.pm,v 1.7 2012/07/15 12:22:17 www Exp $
+# $Id: lonrecommender.pm,v 1.8 2012/07/15 13:12:04 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -390,6 +390,7 @@
 # =================================================================================
 # A display line for a URL
 # Edit flag: remove instead of add
+#
 
 sub display_line {
    my ($url,$editflag)=@_;
@@ -397,6 +398,23 @@
           "</td></tr>\n";
 }
 
+# =================================================================================
+# Showing a URL with links for directory jumps
+#
+
+sub showurl {
+   my ($url)=@_;
+   $url=~s/^\/?res\///;
+   my @parts=split(/\//,$url);
+   my $output='';
+   my $thusfar='';
+   for (my $i=0; $i<$#parts; $i++) {
+       $thusfar.='/'.$parts[$i];
+       $output.='/'.&submit_link($parts[$i],'dir:/res'.$thusfar);
+   }
+   $output.='/'.&submit_link($parts[-1],'indiv:/res/'.$url);
+   return $output;
+}
 
 # =================================================================================
 # A submitting link
@@ -442,8 +460,12 @@
 # ------ Now we have the taxonomies
 # ------ Read the URLs selected thus far ...
     my @selectedurls=&read_groupimportfile();
+# ------ Pick up commands
+    my $cmd=&unescape($env{'form.cmd'});
 # ------ ... and execute any editing commands
-    @selectedurls=&edit_commands(@selectedurls);
+    if ($cmd=~/^(del|rem)\:/) {
+       @selectedurls=&edit_commands($cmd, at selectedurls);
+    }
 # ------ Add the resource IDs of the selected URLs to the existing ones
     my @selectedids=&urlres(@selectedurls);
     my @baseids=(@existingbasket, at selectedurls);
@@ -468,10 +490,10 @@
     my ($max,%counts)=&counts(3,5,8,90,900,1450,13624,31415);
 
     foreach my $key (keys(%taxos)) {
-       $r->print($key.' '.$urls{$key}.' '.$counts{$key}.' => '.$taxos{$key}.' '.$taxonomy_categories{'cleartext_'.$taxos{$key}}."<br />\n");
+       $r->print($key.' '.&showurl($urls{$key}).' '.$counts{$key}.' => '.$taxos{$key}.' '.$taxonomy_categories{'cleartext_'.$taxos{$key}}."<br />\n");
     }
 
-    $r->print('<br />Got: '.$env{'form.cmd'}.'<br />');
+    $r->print('<br />Got: '.$cmd.'<br />');
     $r->print(&submit_link('My link','res_1234'));
 # ------ Close form, done with page
     $r->print('</form>');




More information about the LON-CAPA-cvs mailing list