--- loncom/interface/lonpdfupload.pm 2009/04/04 21:47:41 1.3 +++ loncom/interface/lonpdfupload.pm 2009/05/15 23:40:54 1.5 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpdfupload.pm,v 1.3 2009/04/04 21:47:41 bisitz Exp $ +# $Id: lonpdfupload.pm,v 1.5 2009/05/15 23:40:54 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -80,7 +80,12 @@ sub handler() { } #link to course-content - $r->print("
\n \n ".&mt("Navigate Contents")."\n \n
"); + $r->print('

'."\n" + .''."\n" + .&mt("Navigate Contents")."\n" + .''."\n" + .'

'."\n" + ); #&dumpenv($r); #debug -> prints the environment $r->print(" \n\n"); @@ -139,42 +144,30 @@ END sub get_uploadform() { - my $result = < -

-
- -
- - - - -
- - - - - - - - - - - -
- PDF-Formular einsenden -
- Datei auswählen - - -
- -
-
-
-
-END -; + + my %lt = &Apache::lonlocal::texthash( + 'title'=>'Submit a PDF-Form with problems', + 'chFile' => 'Choose file', + 'submit'=>'Submit' + ); + + my $result = + '
' + .'
' + .'' + .&Apache::lonhtmlcommon::start_pick_box() + .&Apache::lonhtmlcommon::row_headline() + .'

'.$lt{'title'}.'

' + .&Apache::lonhtmlcommon::row_closure() + .&Apache::lonhtmlcommon::row_title($lt{'chFile'}) + .'' + .&Apache::lonhtmlcommon::row_closure(1) + .&Apache::lonhtmlcommon::end_pick_box() + .'' + .'
' + .'
' + .'
'; + return $result; } @@ -222,13 +215,18 @@ sub grade_pdf { my $debug = (); $debug .= "Found: ". scalar @pdfdata." Entries \n"; - $result .= "\n"; + $result .= '
'; + $result .= &Apache::loncommon::start_data_table(); + $result .= &Apache::loncommon::start_data_table_header_row(); + $result .= &mt('Results of PDF-Form problems'); + $result .= &Apache::loncommon::end_data_table_header_row(); + foreach my $entry (sort(@pdfdata)) { if ($entry =~ /^meta.*/) { $debug .= 'found: metadata -> '.$entry . "
"; my ($label, $value) = ($entry =~ /^([^?]*)\?(.*)/); my ($domain, $user) = split('&', $value); - $user =~ s/(.*)\n/$1/; #TODO find an other way + $user =~ s/(.*)\n/$1/; #TODO is that equals to chomp? if($user ne $env{'user.name'} or $domain ne $env{'user.domain'}) { return "
".&mt('Wrong username in PDF-File').": $user $domain -> $env{'user.domain'} $env{'user.name'} 
"; @@ -252,7 +250,7 @@ sub grade_pdf { $problems{$symb.$part}{$HWVAL} = $value; } else { $problems{$symb.$part} = { 'resource' => $resource, - 'symb' => $symb, + 'symb' => &Apache::lonenc::encrypted($symb), 'submitted' => $part, $submit => 'Answer', $HWVAL => $value}; @@ -262,21 +260,27 @@ sub grade_pdf { next; } } - $result .= $debug; + #$result .= $debug; foreach my $key (sort (keys %problems)) { my %problem = %{$problems{$key}}; my ($problemname, $grade) = &grade_problem(%problem); - $result .= "
$problemname(.*)<\/td>.*/$1/g; $content = $1;