need to clean
+ # up if it did
+ &Apache::structuretags::reset_problem_globals();
+ &Apache::lonhomework::finished_parsing();
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['rawmode']);
if ($env{'form.rawmode'}) { $result = $filecontents; }
+ if ($filetype eq 'sty') {
+ my $controls =
+ ($env{'request.state'} eq 'construct') ? &Apache::londefdef::edit_controls()
+ : '';
+ my %options = ('bgcolor' => '#FFFFFF');
+ $result =
+ &Apache::loncommon::start_page(undef,undef,\%options).
+ $controls.
+ $result.
+ &Apache::loncommon::end_page();
+ }
}
}
-
+
#
# Edit action? Insert editing commands
#
unless ($env{'request.state'} eq 'published') {
if ($env{'form.editmode'} && (!($env{'form.viewmode'})) && (!($env{'form.discardview'})))
- {
+ {
my $displayfile=$request->uri;
$displayfile=~s/^\/[^\/]*//;
- my %options = ();
+
+ my ($edit_info, $add_to_onload, $add_to_onresize)=
+ &inserteditinfo($filecontents,$filetype,$displayfile);
+
+ my %options =
+ ('add_entries' =>
+ {'onresize' => $add_to_onresize,
+ 'onload' => $add_to_onload, });
+
if ($env{'environment.remote'} ne 'off') {
$options{'bgcolor'} = '#FFFFFF';
+ $options{'only_body'} = 1;
}
- my $start_page = &Apache::loncommon::start_page(undef,undef,
+ my $js =
+ &Apache::edit::js_change_detection().
+ &Apache::loncommon::resize_textarea_js();
+ my $start_page = &Apache::loncommon::start_page(undef,$js,
\%options);
$result=$start_page.
- &Apache::lonxml::message_location().''.
- $displayfile.
- '
'.&Apache::loncommon::end_page();
- $result=&inserteditinfo($result,$filecontents,$filetype);
+ &Apache::lonxml::message_location().
+ $edit_info.
+ &Apache::loncommon::end_page();
}
}
if ($filetype eq 'html') { &writeallows($request->uri); }
-
&Apache::lonxml::add_messages(\$result);
$request->print($result);
@@ -1561,7 +1791,8 @@ sub display_title {
$title = $env{'request.filename'};
$title = substr($title, rindex($title, '/') + 1);
}
- $result = "";
+ $result = "";
}
return $result;
}
@@ -1594,22 +1825,47 @@ sub show_error_warn_msg {
}
sub error {
+ my @errors = @_;
+
$errorcount++;
+
+ $Apache::lonxml::internal_error=1;
+
+ if (defined($Apache::inputtags::part)) {
+ if ( @Apache::inputtags::response ) {
+ push(@errors,
+ &mt("This error occurred while processing response [_1] in part [_2]",
+ $Apache::inputtags::response[-1],
+ $Apache::inputtags::part));
+ } else {
+ push(@errors,
+ &mt("This error occurred while processing part [_1]",
+ $Apache::inputtags::part));
+ }
+ }
+
if ( &show_error_warn_msg() ) {
# If printing in construction space, put the error inside
push(@Apache::lonxml::error_messages,
- $Apache::lonxml::warnings_error_header.
- "ERROR:".join("
\n",@_)."
\n");
+ $Apache::lonxml::warnings_error_header
+ .''
+ .''.&mt('ERROR:').' '.join("
\n",@errors)
+ ."
\n");
$Apache::lonxml::warnings_error_header='';
} else {
my $errormsg;
my ($symb)=&Apache::lonnet::symbread();
if ( !$symb ) {
#public or browsers
- $errormsg=&mt("An error occured while processing this resource. The author has been notified.");
+ $errormsg=&mt("An error occurred while processing this resource. The author has been notified.");
}
my $host=$Apache::lonnet::perlvar{'lonHostID'};
- my $msg = join('
',(@_,"The error occurred on host $host"));
+ push(@errors,
+ &mt("The error occurred on host [_1]",
+ "$host"));
+
+ my $msg = join('
', @errors);
+
#notify author
&Apache::lonmsg::author_res_msg($env{'request.filename'},$msg);
#notify course
@@ -1640,9 +1896,9 @@ sub error {
}
}
if ($env{'request.role.adv'}) {
- $errormsg=&mt("An error occured while processing this resource. The course personnel ([_1]) and the author have been notified.",join(', ',@userlist));
+ $errormsg=&mt("An error occurred while processing this resource. The course personnel ([_1]) and the author have been notified.",join(', ',@userlist));
} else {
- $errormsg=&mt("An error occured while processing this resource. The instructor has been notified.");
+ $errormsg=&mt("An error occurred while processing this resource. The instructor has been notified.");
}
}
push(@Apache::lonxml::error_messages,"$errormsg
");
@@ -1655,8 +1911,11 @@ sub warning {
if ($env{'form.grade_target'} ne 'tex') {
if ( &show_error_warn_msg() ) {
push(@Apache::lonxml::warning_messages,
- $Apache::lonxml::warnings_error_header.
- "WARNING:".join('
',@_)."
\n");
+ $Apache::lonxml::warnings_error_header
+ .''
+ .&mt('[_1]W[_2]ARNING','','').": ".join('
',@_)
+ ."
\n"
+ );
$Apache::lonxml::warnings_error_header='';
}
}