[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface loncommon.pm

raeburn raeburn at source.lon-capa.org
Wed Jan 9 11:33:57 EST 2013


raeburn		Wed Jan  9 16:33:57 2013 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	loncommon.pm 
  Log:
  - For 2.11
    - Backport 1.1110.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1075.2.26 loncom/interface/loncommon.pm:1.1075.2.27
--- loncom/interface/loncommon.pm:1.1075.2.26	Thu Jan  3 20:10:02 2013
+++ loncom/interface/loncommon.pm	Wed Jan  9 16:33:56 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1075.2.26 2013/01/03 20:10:02 raeburn Exp $
+# $Id: loncommon.pm,v 1.1075.2.27 2013/01/09 16:33:56 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -68,6 +68,7 @@
 use Apache::lontexconvert();
 use Apache::lonclonecourse();
 use Apache::lonuserutils();
+use Apache::lonuserstate();
 use LONCAPA qw(:DEFAULT :match);
 use DateTime::TimeZone;
 use DateTime::Locale::Catalog;
@@ -14123,6 +14124,32 @@
     return;
 }
 
+sub allmaps_incourse {
+    my ($cdom,$cnum,$chome,$cid) = @_;
+    if ($cdom eq '' || $cnum eq '' || $chome eq '' || $cid eq '') {
+        $cid = $env{'request.course.id'};
+        $cdom = $env{'course.'.$cid.'.domain'};
+        $cnum = $env{'course.'.$cid.'.num'};
+        $chome = $env{'course.'.$cid.'.home'};
+    }
+    my %allmaps = ();
+    my $lastchange =
+        &Apache::lonnet::get_coursechange($cdom,$cnum);
+    if ($lastchange > $env{'request.course.tied'}) {
+        my ($furl,$ferr) = &Apache::lonuserstate::readmap("$cdom/$cnum");
+        unless ($ferr) {
+            &update_content_constraints($cdom,$cnum,$chome,$cid);
+        }
+    }
+    my $navmap = Apache::lonnavmaps::navmap->new();
+    if (defined($navmap)) {
+        foreach my $res ($navmap->retrieveResources(undef,sub { $_[0]->is_map() },1,0,1)) {
+            $allmaps{$res->src()} = 1;
+        }
+    }
+    return \%allmaps;
+}
+
 sub parse_supplemental_title {
     my ($title) = @_;
 




More information about the LON-CAPA-cvs mailing list