[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm /lonnet/perl lonnet.pm

www www@source.lon-capa.org
Mon, 06 Jun 2011 23:28:48 -0000


www		Mon Jun  6 23:28:48 2011 EDT

  Modified files:              
    /loncom/homework	inputtags.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Bug #6476: store if special version was set
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.289 loncom/homework/inputtags.pm:1.290
--- loncom/homework/inputtags.pm:1.289	Mon Jun  6 22:20:46 2011
+++ loncom/homework/inputtags.pm	Mon Jun  6 23:28:42 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.289 2011/06/06 22:20:46 www Exp $
+# $Id: inputtags.pm,v 1.290 2011/06/06 23:28:42 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1323,6 +1323,7 @@
     $Apache::lonhomework::results{"resource.$id.type"} = $Apache::lonhomework::type;
     $Apache::lonhomework::results{"resource.$id.duedate"} = &Apache::lonnet::EXT("resource.$id.duedate");
     $Apache::lonhomework::results{"resource.$id.hinttries"} = &Apache::lonnet::EXT("resource.$id.hinttries");
+    $Apache::lonhomework::results{"resourse.$id.version"} = &Apache::lonnet::usedversion(); 
 }
 
 sub find_which_previous {
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1110 loncom/lonnet/perl/lonnet.pm:1.1111
--- loncom/lonnet/perl/lonnet.pm:1.1110	Mon Jun  6 17:17:44 2011
+++ loncom/lonnet/perl/lonnet.pm	Mon Jun  6 23:28:48 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1110 2011/06/06 17:17:44 www Exp $
+# $Id: lonnet.pm,v 1.1111 2011/06/06 23:28:48 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2015,6 +2015,17 @@
     return &do_cache_new('resversion',$fname,$answer,600);
 }
 
+#
+# Return special version number of resource if set by override, empty otherwise
+#
+sub usedversion {
+    my $fname=shift;
+    unless ($fname) { $fname=$env{'request.uri'}; }
+    my ($urlversion)=($fname=~/\.(\d+)\.\w+$/);
+    if ($urlversion) { return $urlversion; }
+    return '';
+}
+
 # ----------------------------- Subscribe to a resource, return URL if possible
 
 sub subscribe {