$titledisplay
@@ -1651,9 +1695,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,18 +1705,47 @@ sub handler {
$request->set_last_modified(&Apache::lonnet::metadata($request->uri,
'lastrevisiondate'));
}
+ # 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) =
+ &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;
my $file=&Apache::lonnet::filelocation("",$request->uri);
- my $filetype;
- if ($file =~ /\.sty$/) {
- $filetype='sty';
+ 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.
#
@@ -1692,17 +1764,22 @@ 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='';
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' && $filetype ne 'tex') {
$filecontents=&createnewhtml();
}
$env{'form.editmode'}='Edit'; #force edit mode
@@ -1718,28 +1795,67 @@ 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();
+ } 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 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();
- }
- }
+ 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 $brcrum;
+ if ($env{'request.state'} eq 'construct') {
+ $brcrum = [{'href' => &Apache::loncommon::authorspace(),
+ 'text' => 'Construction Space'},
+ {'href' => '',
+ 'text' => $breadcrumbtext}];
+ } else {
+ $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();
+ } else {
+ $result = $controls.$result;
+ }
+ }
+ }
}
#
@@ -1756,9 +1872,18 @@ ENDNOTFOUND
my %options =
('add_entries' =>
- {'onresize' => $add_to_onresize,
- 'onload' => $add_to_onload, });
-
+ {'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());
+ }
if ($env{'environment.remote'} ne 'off') {
$options{'bgcolor'} = '#FFFFFF';
$options{'only_body'} = 1;
@@ -1768,14 +1893,15 @@ ENDNOTFOUND
&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);
@@ -1828,6 +1954,8 @@ sub error {
$errorcount++;
+ $Apache::lonxml::internal_error=1;
+
if (defined($Apache::inputtags::part)) {
if ( @Apache::inputtags::response ) {
push(@errors,
@@ -2137,7 +2265,105 @@ sub get_tag {
return $insertlist{"$tagnum.tag"};
}
+############################################################
+# PDF-FORM-METHODS
+
+=pod
+
+=item &print_pdf_radiobutton(fieldname, value)
+
+Returns a latexline to generate a PDF-Form-Radiobutton.
+Note: Radiobuttons with equal names are automaticly grouped
+ in a selection-group.
+
+$fieldname: PDF internalname of the radiobutton(group)
+$value: Value of radiobutton
+
+=cut
+sub print_pdf_radiobutton {
+ my ($fieldname, $value) = @_;
+ return '\radioButton[\symbolchoice{circle}]{'
+ .$fieldname.'}{10bp}{10bp}{'.$value.'}';
+}
+
+
+=pod
+
+=item &print_pdf_start_combobox(fieldname)
+
+Starts a latexline to generate a PDF-Form-Combobox with text.
+
+$fieldname: PDF internal name of the Combobox
+
+=cut
+sub print_pdf_start_combobox {
+ my $result;
+ my ($fieldName) = @_;
+ $result .= '\begin{tabularx}{\textwidth}{p{2.5cm}X}'."\n";
+ $result .= '\comboBox[]{'.$fieldName.'}{2.3cm}{14bp}{'; #
+
+ return $result;
+}
+
+
+=pod
+
+=item &print_pdf_add_combobox_option(options)
+
+Generates a latexline to add Options to a PDF-Form-ComboBox.
+
+$option: PDF internal name of the Combobox-Option
+
+=cut
+sub print_pdf_add_combobox_option {
+
+ my $result;
+ my ($option) = @_;
+
+ $result .= '('.$option.')';
+
+ return $result;
+}
+
+
+=pod
+
+=item &print_pdf_end_combobox(text) {
+
+Returns latexcode to end a PDF-Form-Combobox with text.
+
+=cut
+sub print_pdf_end_combobox {
+ my $result;
+ my ($text) = @_;
+
+ $result .= '}&'.$text."\\\\\n";
+ $result .= '\end{tabularx}' . "\n";
+ $result .= '\hspace{2mm}' . "\n";
+ return $result;
+}
+
+
+=pod
+
+=item &print_pdf_hiddenField(fieldname, user, domain)
+
+Returns a latexline to generate a PDF-Form-hiddenField with userdata.
+
+$fieldname label for hiddentextfield
+$user: name of user
+$domain: domain of user
+
+=cut
+sub print_pdf_hiddenfield {
+ my $result;
+ my ($fieldname, $user, $domain) = @_;
+
+ $result .= '\textField [\F{\FHidden}\F{-\FPrint}\V{'.$domain.'&'.$user.'}]{'.$fieldname.'}{0in}{0in}'."\n";
+
+ return $result;
+}
+
1;
__END__
-