--- loncom/xml/lonxml.pm 2012/04/11 15:58:07 1.529
+++ loncom/xml/lonxml.pm 2012/05/10 19:08:33 1.531.2.1
@@ -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.531.2.1 2012/05/10 19:08:33 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1502,7 +1502,6 @@ sub renderingoptions {
{&Apache::lonlocal::texthash
('' => '',
'tth' => 'tth (TeX to HTML)',
- 'MathJax' => 'MathJax',
'jsMath' => 'jsMath',
'mimetex' => 'mimetex (Convert to Images)')}).
'';
@@ -1510,12 +1509,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 +1535,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 +1584,7 @@ $initialize
- $htmlerror $dragmath_button
+ $htmlerror $deps_button $dragmath_button
@@ -1789,26 +1793,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 +1853,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;
@@ -1940,7 +1956,7 @@ sub error {
my @userlist;
foreach (keys %users) {
my ($user,$domain) = split(/:/, $_);
- push(@userlist,"$user\@$domain");
+ push(@userlist,"$user:$domain");
my $key=$declutter.'_'.$user.'_'.$domain;
my %lastnotified=&Apache::lonnet::get('nohist_xmlerrornotifications',
[$key],
@@ -1963,7 +1979,7 @@ sub error {
$errormsg=&mt("An error occurred while processing this resource. The instructor has been notified.");
}
}
- push(@Apache::lonxml::error_messages,"$errormsg
");
+ push(@Apache::lonxml::error_messages,"$errormsg
");
}
}