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 +1790,8 @@ sub display_title {
$title = $env{'request.filename'};
$title = substr($title, rindex($title, '/') + 1);
}
- $result = "";
+ $result = "";
}
return $result;
}
@@ -1594,12 +1824,30 @@ sub show_error_warn_msg {
}
sub error {
+ my @errors = @_;
+
$errorcount++;
+
+ 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;
@@ -1609,7 +1857,12 @@ sub error {
$errormsg=&mt("An error occured 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
@@ -1655,8 +1908,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 +2137,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__
-