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

raeburn raeburn at source.lon-capa.org
Wed Jul 31 13:37:19 EDT 2013


raeburn		Wed Jul 31 17:37:19 2013 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - In &EXT(), check $qualifier is null, when retrieving: &EXT("resource.$space")
    $space = title, map or filename,  in case this is a multi-part problem
    with a part ID matching $space.     
  - Add two additional &EXT() items -- resource.maptitle, resource.visibleparts
    (a) return title (in Course) and (b) comma-separated list of parts available to
    current user, respectively.
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1231 loncom/lonnet/perl/lonnet.pm:1.1232
--- loncom/lonnet/perl/lonnet.pm:1.1231	Thu Jul 25 19:11:12 2013
+++ loncom/lonnet/perl/lonnet.pm	Wed Jul 31 17:37:18 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1231 2013/07/25 19:11:12 raeburn Exp $
+# $Id: lonnet.pm,v 1.1232 2013/07/31 17:37:18 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -9773,21 +9773,43 @@
 	    if (!$symbparm) { $symbparm=&symbread(); }
 	}
 
-	if ($space eq 'title') {
-	    if (!$symbparm) { $symbparm = $env{'request.filename'}; }
-	    return &gettitle($symbparm);
-	}
+        if ($qualifier eq '') {
+	    if ($space eq 'title') {
+	        if (!$symbparm) { $symbparm = $env{'request.filename'}; }
+	        return &gettitle($symbparm);
+	    }
 	
-	if ($space eq 'map') {
-	    my ($map) = &decode_symb($symbparm);
-	    return &symbread($map);
-	}
-	if ($space eq 'filename') {
-	    if ($symbparm) {
-		return &clutter((&decode_symb($symbparm))[2]);
+	    if ($space eq 'map') {
+	        my ($map) = &decode_symb($symbparm);
+	        return &symbread($map);
+	    }
+            if ($space eq 'maptitle') {
+                my ($map) = &decode_symb($symbparm);
+                return &gettitle($map);
+            }
+	    if ($space eq 'filename') {
+	        if ($symbparm) {
+		    return &clutter((&decode_symb($symbparm))[2]);
+	        }
+	        return &hreflocation('',$env{'request.filename'});
 	    }
-	    return &hreflocation('',$env{'request.filename'});
-	}
+        }
+
+        if ((defined($courseid)) && ($courseid eq $env{'request.course.id'}) && $symbparm) {
+            if ($space eq 'visibleparts') {
+                my $navmap = Apache::lonnavmaps::navmap->new();
+                my $item;
+                if (ref($navmap)) {
+                    my $res = $navmap->getBySymb($symbparm);
+                    my $parts = $res->parts();
+                    if (ref($parts) eq 'ARRAY') {
+                        $item = join(',',@{$parts});
+                    }
+                    undef($navmap);
+                }
+                return $item;
+            }
+        }
 
 	my ($section, $group, @groups);
 	my ($courselevelm,$courselevel);




More information about the LON-CAPA-cvs mailing list