--- loncom/xml/lonxml.pm 2012/04/11 15:58:07 1.529 +++ loncom/xml/lonxml.pm 2012/04/16 19:46:14 1.530 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.529 2012/04/11 15:58:07 raeburn Exp $ +# $Id: lonxml.pm,v 1.530 2012/04/16 19:46:14 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1510,12 +1510,12 @@ sub renderingoptions { } sub inserteditinfo { - my ($filecontents, $filetype, $filename)=@_; + my ($filecontents,$filetype,$filename,$symb,$itemtitle) = @_; $filecontents = &HTML::Entities::encode($filecontents,'<>&"'); my $xml_help = ''; my $initialize=''; my $textarea_id = 'filecont'; - my $dragmath_button; + my ($dragmath_button,$deps_button); my ($add_to_onload, $add_to_onresize); $initialize=&Apache::lonhtmlcommon::spellheader(); if (($filetype eq 'html') && (&Apache::lonhtmlcommon::htmlareabrowser())) { @@ -1536,6 +1536,11 @@ sub inserteditinfo { FULLPAGE if ($filetype eq 'html') { + if ($symb) { + $deps_button = &Apache::lonhtmlcommon::dependencies_button()."\n"; + $initialize .= + &Apache::lonhtmlcommon::dependencycheck_js($symb,$itemtitle)."\n"; + } $dragmath_button = ''.&Apache::lonhtmlcommon::dragmath_button('filecont',1).''; $initialize .= "\n".&Apache::lonhtmlcommon::dragmath_js('EditMathPopup'); } @@ -1580,7 +1585,7 @@ $initialize
- $htmlerror $dragmath_button + $htmlerror $deps_button $dragmath_button
@@ -1789,26 +1794,17 @@ ENDNOTFOUND unless ($env{'request.state'} eq 'published') { if ($env{'form.editmode'} && (!($env{'form.viewmode'})) && (!($env{'form.discardview'}))) { - my $displayfile=$request->uri; - 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(' » ',@pathitems); - } - } + my ($displayfile,$url,$symb,$itemtitle); + $displayfile=$request->uri; + if ($request->uri =~ m{^/uploaded/}) { + ($symb,$itemtitle,$displayfile) = + &get_courseupload_hierarchy($request->uri); } else { $displayfile=~s/^\/[^\/]*//; } my ($edit_info, $add_to_onload, $add_to_onresize)= - &inserteditinfo($filecontents,$filetype,$displayfile); + &inserteditinfo($filecontents,$filetype,$displayfile,$symb,$itemtitle); my %options = ('add_entries' => @@ -1858,6 +1854,27 @@ sub display_title { return $result; } +sub get_courseupload_hierarchy { + my ($url) = @_; + my ($symb,$itemtitle,$displaypath); + if ($env{'request.course.id'}) { + $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); + if (ref($res)) { + my @pathitems = + &Apache::loncommon::get_folder_hierarchy($navmap,$map,1); + $itemtitle = $res->compTitle(); + push(@pathitems,$itemtitle); + $displaypath = join(' » ',@pathitems); + } + } + } + return ($symb,$itemtitle,$displaypath); +} + sub debug { if ($Apache::lonxml::debug eq "1") { $|=1;