+ $wysiwyglink
$titledisplay
@@ -1716,8 +1726,8 @@ 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.
+ # Embedded Flash movies 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) =
@@ -1737,12 +1747,25 @@ sub handler {
my $file=&Apache::lonnet::filelocation("",$request->uri);
- my $filetype;
- if ($file =~ /\.(sty|css|js|txt)$/) {
+ my ($filetype,$breadcrumbtext);
+ if ($file =~ /\.(sty|css|js|txt|tex)$/) {
$filetype=$1;
} else {
$filetype='html';
}
+ if ($filetype eq 'sty') {
+ $breadcrumbtext = 'Style File Editor';
+ } elsif ($filetype eq 'js') {
+ $breadcrumbtext = 'Javascript Editor';
+ } elsif ($filetype eq 'css') {
+ $breadcrumbtext = 'CSS Editor';
+ } elsif ($filetype eq 'txt') {
+ $breadcrumbtext = 'Text Editor';
+ } elsif ($filetype eq 'tex') {
+ $breadcrumbtext = 'TeX Editor';
+ } else {
+ $breadcrumbtext = 'HTML Editor';
+ }
#
# Edit action? Save file.
@@ -1762,10 +1785,13 @@ sub handler {
if ($filecontents eq -1) {
my $start_page=&Apache::loncommon::start_page('File Error');
my $end_page=&Apache::loncommon::end_page();
- my $fnf=&mt('File not found');
+ my $errormsg=''
+ .&mt('File not found: [_1]'
+ ,''.$file.'')
+ .'
';
$result=(<$fnf: $file
+$errormsg
$end_page
ENDNOTFOUND
$filecontents='';
@@ -1774,7 +1800,7 @@ ENDNOTFOUND
$filecontents=&createnewsty();
} elsif ($filetype eq 'js') {
$filecontents=&createnewjs();
- } elsif (($filetype ne 'css') && ($filetype ne 'txt')) {
+ } elsif ($filetype ne 'css' && $filetype ne 'txt' && $filetype ne 'tex') {
$filecontents=&createnewhtml();
}
$env{'form.editmode'}='Edit'; #force edit mode
@@ -1798,36 +1824,55 @@ ENDNOTFOUND
# up if it did
&Apache::structuretags::reset_problem_globals();
&Apache::lonhomework::finished_parsing();
+ } elsif ($filetype eq 'tex') {
+ $result = &Apache::lontexconvert::converted(\$filecontents,
+ $env{'form.texengine'});
+ if ($env{'form.return_only_error_and_warning_counts'}) {
+ if (&verify_html(''.$result.'')) {
+ $errorcount++;
+ }
+ $result = "$errorcount:$warningcount";
+ }
} else {
$result = $filecontents;
}
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['rawmode']);
if ($env{'form.rawmode'}) { $result = $filecontents; }
- if ($filetype ne 'html') {
- my $nochgview = 1;
- my $controls =
- ($env{'request.state'} eq 'construct') ? &Apache::londefdef::edit_controls($nochgview)
- : '';
- if ($filetype ne 'sty') {
+ if (($filetype ne 'html') &&
+ (!$env{'form.return_only_error_and_warning_counts'})) {
+ my $nochgview = 1;
+ my $controls = '';
+ if ($env{'request.state'} eq 'construct') {
+ $controls = &Apache::loncommon::head_subbox(
+ &Apache::loncommon::CSTR_pageheader()
+ .&Apache::londefdef::edit_controls($nochgview));
+ }
+ if ($filetype ne 'sty' && $filetype ne 'tex') {
$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();
+ my $brcrum;
+ if ($env{'request.state'} eq 'construct') {
+ $brcrum = [{'href' => &Apache::loncommon::authorspace(),
+ 'text' => 'Construction Space'},
+ {'href' => '',
+ 'text' => $breadcrumbtext}];
} else {
- $result = $controls.$result;
+ $brcrum = ''; # FIXME: Where are we?
}
+ my %options = ('bread_crumbs' => $brcrum,
+ 'bgcolor' => '#FFFFFF');
+ $result =
+ &Apache::loncommon::start_page(undef,undef,\%options)
+ .$controls
+ .$result
+ .&Apache::loncommon::end_page();
}
- }
+ }
}
#
@@ -1844,26 +1889,32 @@ ENDNOTFOUND
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;
- }
+ {'onresize' => $add_to_onresize,
+ 'onload' => $add_to_onload, });
+ my $header;
+ if ($env{'request.state'} eq 'construct') {
+ $options{'bread_crumbs'} = [{
+ 'href' => &Apache::loncommon::authorspace(),
+ 'text' => 'Construction Space'},
+ {'href' => '',
+ 'text' => $breadcrumbtext}];
+ $header = &Apache::loncommon::head_subbox(
+ &Apache::loncommon::CSTR_pageheader());
+ }
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().
- $edit_info.
- &Apache::loncommon::end_page();
+ $result = $start_page
+ .$header
+ .&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);