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

raeburn raeburn at source.lon-capa.org
Tue May 21 14:57:46 EDT 2013


raeburn		Tue May 21 18:57:46 2013 EDT

  Modified files:              
    /loncom/interface	lonextresedit.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Eliminate duplicate routine &getdocspath() in lonnet.
    - lonextresedit.pm uses &Apache::loncommon::symb_to_docspath() instead.
  
  
Index: loncom/interface/lonextresedit.pm
diff -u loncom/interface/lonextresedit.pm:1.5 loncom/interface/lonextresedit.pm:1.6
--- loncom/interface/lonextresedit.pm:1.5	Wed Feb 13 04:41:35 2013
+++ loncom/interface/lonextresedit.pm	Tue May 21 18:57:40 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: lonextresedit.pm,v 1.5 2013/02/13 04:41:35 raeburn Exp $
+# $Id: lonextresedit.pm,v 1.6 2013/05/21 18:57:40 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -308,7 +308,7 @@
         (my $map,$residx,my $res) =
             &Apache::lonnet::decode_symb($symb);
         $title = &Apache::lonnet::gettitle($symb);
-        my $path = &Apache::lonnet::getdocspath($symb);
+        my $path = &Apache::loncommon::symb_to_docspath($symb);
         $pathitem = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($path,'<>&"').'" />';
     }
     my $js = &Apache::lonhtmlcommon::scripttag(&extedit_javascript());
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1222 loncom/lonnet/perl/lonnet.pm:1.1223
--- loncom/lonnet/perl/lonnet.pm:1.1222	Wed May 15 18:48:38 2013
+++ loncom/lonnet/perl/lonnet.pm	Tue May 21 18:57:45 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1222 2013/05/15 18:48:38 raeburn Exp $
+# $Id: lonnet.pm,v 1.1223 2013/05/21 18:57:45 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -10375,78 +10375,6 @@
     return $title;
 }
 
-sub getdocspath {
-    my ($symb) = @_;
-    my $path;
-    if ($symb) {
-        my ($mapurl,$id,$resurl) = &decode_symb($symb);
-        if ($resurl=~/\.(sequence|page)$/) {
-            $mapurl=$resurl;
-        } elsif ($resurl eq 'adm/navmaps') {
-            $mapurl=$env{'course.'.$env{'request.course.id'}.'.url'};
-        }
-        my $mapresobj;
-        my $navmap = Apache::lonnavmaps::navmap->new();
-        if (ref($navmap)) {
-            $mapresobj = $navmap->getResourceByUrl($mapurl);
-        }
-        $mapurl=~s{^.*/([^/]+)\.(\w+)$}{$1};
-        my $type=$2;
-        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().
-                                 ':'.$res->is_page();
-                    }
-                }
-            }
-            $path =~ s/^\&//;
-            my $maptitle = $mapresobj->title();
-            if ($mapurl eq 'default') {
-                $maptitle = 'Main Course Documents';
-            }
-            $path .= ($path ne '')? '&' : ''.
-                    &Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
-                    &Apache::lonhtmlcommon::entity_encode($maptitle).
-                    ':'.$mapresobj->randompick().
-                    ':'.$mapresobj->randomout().
-                    ':'.$mapresobj->encrypted().
-                    ':'.$mapresobj->randomorder().
-                    ':'.$mapresobj->is_page();
-        } else {
-            my $maptitle = &gettitle($mapurl);
-            my $ispage;
-            if ($mapurl =~ /\.page$/) {
-                $ispage = 1;
-            }
-            if ($mapurl eq 'default') {
-                $maptitle = 'Main Course Documents';
-            }
-            $path = &Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
-                    &Apache::lonhtmlcommon::entity_encode($maptitle).':::::'.$ispage;
-        }
-        unless ($mapurl eq 'default') {
-            $path = 'default&'.
-                    &Apache::lonhtmlcommon::entity_encode('Main Course Documents').
-                    ':::::&'.$path;
-        }
-    }
-    return $path;
-}
-
 sub get_slot {
     my ($which,$cnum,$cdom)=@_;
     if (!$cnum || !$cdom) {




More information about the LON-CAPA-cvs mailing list