@@ -1651,9 +1714,8 @@ sub get_target {
sub handler {
my $request=shift;
-
+
my $target=&get_target();
-
$Apache::lonxml::debug=$env{'user.debug'};
&Apache::loncommon::content_type($request,'text/html');
@@ -1662,6 +1724,21 @@ sub handler {
$request->set_last_modified(&Apache::lonnet::metadata($request->uri,
'lastrevisiondate'));
}
+ # Embedded Flash movies (e.g., from Camtasia) served from https will not display in IE
+ # if XML config file has expired from cache.
+ if ($ENV{'SERVER_PORT'} == 443) {
+ if ($request->uri =~ /\.xml$/) {
+ my ($httpbrowser,$clientbrowser) =
+ &Apache::loncommon::decode_user_agent($request);
+ if ($clientbrowser =~ /^explorer$/i) {
+ delete $request->headers_out->{'Cache-control'};
+ delete $request->headers_out->{'Pragma'};
+ my $expiration = time + 60;
+ my $date=strftime("%a, %d %b %Y %H:%M:%S GMT",gmtime($expiration));
+ $request->headers_out->set("Expires" => $date);
+ }
+ }
+ }
$request->send_http_header;
return OK if $request->header_only;
@@ -1669,11 +1746,12 @@ sub handler {
my $file=&Apache::lonnet::filelocation("",$request->uri);
my $filetype;
- if ($file =~ /\.sty$/) {
- $filetype='sty';
+ if ($file =~ /\.(sty|css|js|txt)$/) {
+ $filetype=$1;
} else {
$filetype='html';
}
+
#
# Edit action? Save file.
#
@@ -1702,7 +1780,9 @@ ENDNOTFOUND
if ($env{'request.state'} ne 'published') {
if ($filetype eq 'sty') {
$filecontents=&createnewsty();
- } else {
+ } elsif ($filetype eq 'js') {
+ $filecontents=&createnewjs();
+ } elsif (($filetype ne 'css') && ($filetype ne 'txt')) {
$filecontents=&createnewhtml();
}
$env{'form.editmode'}='Edit'; #force edit mode
@@ -1718,27 +1798,43 @@ ENDNOTFOUND
['editmode']);
}
if (!$env{'form.editmode'} || $env{'form.viewmode'} || $env{'form.discardview'}) {
- &Apache::structuretags::reset_problem_globals();
- $result = &Apache::lonxml::xmlparse($request,$target,$filecontents,
- '',%mystyle);
+ if ($filetype eq 'html' || $filetype eq 'sty') {
+ &Apache::structuretags::reset_problem_globals();
+ $result = &Apache::lonxml::xmlparse($request,$target,
+ $filecontents,'',%mystyle);
# .html files may contain
or need to clean
# up if it did
- &Apache::structuretags::reset_problem_globals();
- &Apache::lonhomework::finished_parsing();
+ &Apache::structuretags::reset_problem_globals();
+ &Apache::lonhomework::finished_parsing();
+ } else {
+ $result = $filecontents;
+ }
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['rawmode']);
if ($env{'form.rawmode'}) { $result = $filecontents; }
- if ($filetype eq 'sty') {
+ if ($filetype ne 'html') {
+ my $nochgview = 1;
my $controls =
- ($env{'request.state'} eq 'construct') ? &Apache::londefdef::edit_controls()
+ ($env{'request.state'} eq 'construct') ? &Apache::londefdef::edit_controls($nochgview)
: '';
- my %options = ('bgcolor' => '#FFFFFF');
- $result =
- &Apache::loncommon::start_page(undef,undef,\%options).
- $controls.
- $result.
- &Apache::loncommon::end_page();
- }
+ if ($filetype ne 'sty') {
+ $result =~ s/</g;
+ $result =~ s/>/>/g;
+ $result = '';
+ }
+ if ($env{'environment.remote'} eq 'off') {
+ my %options = ('bgcolor' => '#FFFFFF');
+ $result =
+ &Apache::loncommon::start_page(undef,undef,\%options).
+ $controls.
+ $result.
+ &Apache::loncommon::end_page();
+ } else {
+ $result = $controls.$result;
+ }
+ }
}
}
@@ -1772,7 +1868,7 @@ ENDNOTFOUND
&Apache::lonxml::message_location().
$edit_info.
&Apache::loncommon::end_page();
- }
+ }
}
if ($filetype eq 'html') { &writeallows($request->uri); }
@@ -1828,6 +1924,8 @@ sub error {
$errorcount++;
+ $Apache::lonxml::internal_error=1;
+
if (defined($Apache::inputtags::part)) {
if ( @Apache::inputtags::response ) {
push(@errors,
@@ -1854,7 +1952,7 @@ sub error {
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'};
push(@errors,
@@ -1893,9 +1991,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 ");