version 1.21, 2011/11/02 15:14:21
|
version 1.23, 2014/02/28 19:20:06
|
Line 183 sub processPDF {
|
Line 183 sub processPDF {
|
&grade_pdf(@pdfdata); |
&grade_pdf(@pdfdata); |
} else { |
} else { |
$result .= '<p class="LC_error">' |
$result .= '<p class="LC_error">' |
.&mt("Can't find any valid PDF formfields.") |
.&mt("Can't find any valid PDF form fields.") |
.'</p>'; |
.'</p>'; |
} |
} |
} |
} |
Line 193 sub get_pdf_data() {
|
Line 193 sub get_pdf_data() {
|
my $pdf = CAM::PDF->new($env{'form.file'}); |
my $pdf = CAM::PDF->new($env{'form.file'}); |
|
|
if($pdf) { |
if($pdf) { |
my @formFields = $pdf->getFormFieldList(); #get names of formfields |
my @formFields = $pdf->getFormFieldList(); #get names of form fields |
|
|
foreach my $field (@formFields) { |
foreach my $field (@formFields) { |
my $dict = $pdf->getFormFieldDict($pdf->getFormField($field)); # get formfield dictonary |
my $dict = $pdf->getFormFieldDict($pdf->getFormField($field)); # get form field dictonary |
|
|
# this is necessary because CAM::PDF has a problem with formfieldnames which include a |
# this is necessary because CAM::PDF has a problem with form fieldnames which include a |
# dot in fieldnames. So a fieldname like "i.am.aFormfield" will offer three fieldnames |
# dot in fieldnames. So a fieldname like "i.am.aFormfield" will offer three fieldnames |
# "i", "i.am" and "i.am.aFormfield". The fragmentary names keep no values and will be ignored. |
# "i", "i.am" and "i.am.aFormfield". The fragmentary names keep no values and will be ignored. |
if($dict->{'V'}) { |
if($dict->{'V'}) { |
Line 299 sub grade_pdf {
|
Line 299 sub grade_pdf {
|
$result .= '<td><a href="/res/'.$problem{'resource'}. |
$result .= '<td><a href="/res/'.$problem{'resource'}. |
'?symb='. |
'?symb='. |
&HTML::Entities::encode($problem{'symb'},'"&<>'). |
&HTML::Entities::encode($problem{'symb'},'"&<>'). |
'">'.$problemname.'</a></td><td class="'; |
'">'.$problemname.'</a></td><td><span class="'; |
if ($grade eq "EXACT_ANS" || $grade eq "APPROX_ANS") { |
if ($grade eq "EXACT_ANS" || $grade eq "APPROX_ANS") { |
$result .= 'LC_answer_correct'; |
$result .= 'LC_answer_correct'; |
} else { |
} elsif ($grade eq "DRAFT") { |
|
$result .= 'LC_answer_not_charged_try'; |
|
} else { |
$result .= 'LC_answer_charged_try'; |
$result .= 'LC_answer_charged_try'; |
} |
} |
$result .= '">'; |
$result .= '">'; |
Line 375 sub parse_grade_answer {
|
Line 377 sub parse_grade_answer {
|
my %answerhash = ('EXACT_ANS' => &mt('You are correct.'), |
my %answerhash = ('EXACT_ANS' => &mt('You are correct.'), |
'APPROX_ANS' => &mt('You are correct.'), |
'APPROX_ANS' => &mt('You are correct.'), |
'INCORRECT' => &mt('You are incorrect'), |
'INCORRECT' => &mt('You are incorrect'), |
|
'DRAFT' => &mt('Copy saved but not submitted.'), |
); |
); |
|
|
foreach my $key (keys %answerhash) { |
foreach my $key (keys %answerhash) { |