[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm

raeburn raeburn at source.lon-capa.org
Wed Apr 11 11:58:07 EDT 2012


raeburn		Wed Apr 11 15:58:07 2012 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - Edit mode for a file uploaded directly to a course (e.g., html page).
    Replace path to file with path based on folder/sub-folder context of
    symb in course context for /uploaded/ item.  
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.528 loncom/xml/lonxml.pm:1.529
--- loncom/xml/lonxml.pm:1.528	Wed Dec 28 13:15:00 2011
+++ loncom/xml/lonxml.pm	Wed Apr 11 15:58:07 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.528 2011/12/28 13:15:00 www Exp $
+# $Id: lonxml.pm,v 1.529 2012/04/11 15:58:07 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -113,6 +113,7 @@
 use Apache::lonlocal;
 use Apache::lonhtmlcommon();
 use Apache::functionplotresponse();
+use Apache::lonnavmaps();
 
 #====================================   Main subroutine: xmlparse  
 
@@ -1789,7 +1790,22 @@
 	if ($env{'form.editmode'} && (!($env{'form.viewmode'})) && (!($env{'form.discardview'})))
 	{
 	    my $displayfile=$request->uri;
-	    $displayfile=~s/^\/[^\/]*//;
+            if ($displayfile =~ m{^/uploaded/}) {
+                if ($env{'request.course.id'}) {
+                    my $symb = &Apache::lonnet::symbread();
+                    my ($map,$id,$res)=&Apache::lonnet::decode_symb($symb);
+                    my $navmap=Apache::lonnavmaps::navmap->new;
+                    if (ref($navmap)) {
+                        my $res = $navmap->getBySymb($symb);
+                        my @pathitems = 
+                            &Apache::loncommon::get_folder_hierarchy($navmap,$map,1);
+                        push(@pathitems,$res->compTitle());
+                        $displayfile = join(' » ', at pathitems);
+                    }
+                }
+            } else {
+	        $displayfile=~s/^\/[^\/]*//;
+            }
 
 	    my ($edit_info, $add_to_onload, $add_to_onresize)=
 		&inserteditinfo($filecontents,$filetype,$displayfile);




More information about the LON-CAPA-cvs mailing list