need to clean
+ # up if it did
+ &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 ne 'html') {
+ 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') {
+ $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' => 'Editor'}];
+ } 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;
+ }
+ }
+ }
}
-
+
#
# 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, });
+
+ $options{'bread_crumbs'} = [{
+ 'href' => &Apache::loncommon::authorspace(),
+ 'text' => 'Construction Space'},
+ {'href' => '',
+ 'text' => 'HTML Editor'}];
+
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);
- }
+ $result = $start_page
+ .&Apache::loncommon::head_subbox(
+ &Apache::loncommon::CSTR_pageheader())
+ .&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 +1875,8 @@ sub display_title {
$title = $env{'request.filename'};
$title = substr($title, rindex($title, '/') + 1);
}
- $result = "";
+ $result = "";
}
return $result;
}
@@ -1594,22 +1909,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 +1980,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 +1995,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='';
}
}
@@ -1881,7 +2224,109 @@ sub get_tag {
return $insertlist{"$tagnum.tag"};
}
+############################################################
+# PDF-FORM-METHODS
+
+=pod
+
+=item &print_pdf_radiobutton(fieldname, value, text)
+
+Returns a latexline to generate a PDF-Form-Radiobutton with Text.
+
+$fieldname: PDF internalname of the radiobutton
+$value: Value of radiobutton (read when dumping the PDF data)
+$text: Text on the rightside of the radiobutton
+
+=cut
+sub print_pdf_radiobutton {
+ my $result = '';
+ my ($fieldName, $value, $text) = @_;
+ $result .= '\begin{tabularx}{\textwidth}{p{0cm}X}'."\n";
+ $result .= '\radioButton[\symbolchoice{circle}]{'.
+ $fieldName.'}{10bp}{10bp}{'.$value.'}&'.$text."\n";
+ $result .= '\end{tabularx}' . "\n";
+ $result .= '\hspace{2mm}' . "\n";
+ return $result;
+}
+
+
+=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__
-