--- loncom/interface/lonpdfupload.pm 2009/04/04 21:47:41 1.3
+++ loncom/interface/lonpdfupload.pm 2009/05/15 17:53:06 1.4
@@ -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.4 2009/05/15 17:53:06 onken Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -139,40 +139,36 @@ END
sub get_uploadform() {
+
+ #TODO use LON-CAPA routines like pick_box or like that
+ my %lt = &Apache::lonlocal::texthash(
+ 'title'=>'Submit a PDF-Form with problems',
+ 'chFile' => 'Choose file:',
+ 'submit'=>'Submit'
+ );
+
my $result = <
-
+
+ $lt{'title'}
+
+
+
+
+
+
END
;
return $result;
@@ -222,13 +218,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 +253,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 +263,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;
|