[LON-CAPA-cvs] cvs: loncom /interface londocs.pm

raeburn raeburn at source.lon-capa.org
Sun Dec 4 10:51:58 EST 2011


raeburn		Sun Dec  4 15:51:58 2011 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  - Editor breadcrumbs trail created when jumping directly into a folder.
    - Include information about hidden, encrypted URL, randompick, randomorder.
    - Include complete folder hierarchy if target folder is within sub-folder(s).
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.466 loncom/interface/londocs.pm:1.467
--- loncom/interface/londocs.pm:1.466	Sun Nov 27 22:51:28 2011
+++ loncom/interface/londocs.pm	Sun Dec  4 15:51:58 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.466 2011/11/27 22:51:28 www Exp $
+# $Id: londocs.pm,v 1.467 2011/12/04 15:51:58 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2880,13 +2880,49 @@
        if ($resurl=~/\.(sequence|page)$/) {
            $mapurl=$resurl;
        }
-       my $maptitle = &Apache::lonnet::gettitle($mapurl);
+       my $mapresobj;
+       my $navmap = Apache::lonnavmaps::navmap->new();
+       if (ref($navmap)) {
+           $mapresobj = $navmap->getResourceByUrl($mapurl);
+       }
        $mapurl=~s{^.*/([^/]+)\.(\w+)$}{$1};
        my $type=$2;
-       my $path='default&'.&Apache::lonhtmlcommon::entity_encode('Main Course Documents').
-                '&default&...::::&'.
-                &Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
-                        &Apache::lonhtmlcommon::entity_encode($maptitle).'::::';
+       my $path;
+       if (ref($mapresobj)) {
+           my $pcslist = $mapresobj->map_hierarchy();
+           if ($pcslist ne '') {
+               foreach my $pc (split(/,/,$pcslist)) {
+                   next if ($pc <= 1);
+                   my $res = $navmap->getByMapPc($pc);
+                   if (ref($res)) {
+                       my $thisurl = $res->src();
+                       $thisurl=~s{^.*/([^/]+)\.\w+$}{$1}; 
+                       my $thistitle = $res->title();
+                       $path .= '&'.
+                                &Apache::lonhtmlcommon::entity_encode($thisurl).'&'.
+                                &Apache::lonhtmlcommon::entity_encode($thistitle).
+                                ':'.$res->randompick().
+                                ':'.$res->randomout().
+                                ':'.$res->encrypted().
+                                ':'.$res->randomorder();
+                   }
+               }
+           }
+           $path .= '&'.&Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
+                    &Apache::lonhtmlcommon::entity_encode($mapresobj->title()).
+                    ':'.$mapresobj->randompick().
+                    ':'.$mapresobj->randomout().
+                    ':'.$mapresobj->encrypted().
+                    ':'.$mapresobj->randomorder();
+       } else {
+           my $maptitle = &Apache::lonnet::gettitle($mapurl);
+           $path = '&default&...::::'.
+               '&'.&Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
+               &Apache::lonhtmlcommon::entity_encode($maptitle).'::::';
+       }
+       $path = 'default&'.
+               &Apache::lonhtmlcommon::entity_encode('Main Course Documents').
+               $path;
        if ($type eq 'sequence') {
            $env{'form.folderpath'}=$path;
            $env{'form.pagepath'}='';




More information about the LON-CAPA-cvs mailing list