version 1.36, 2002/04/26 18:57:27
|
version 1.40, 2002/06/25 16:31:51
|
Line 336 END
|
Line 336 END
|
} # end of sub linked_select_forms { |
} # end of sub linked_select_forms { |
|
|
############################################################### |
############################################################### |
|
|
|
=item csv_translate($text) |
|
|
|
Translate $text to allow it to be output as a 'comma seperated values' |
|
format. |
|
|
|
=cut |
|
|
|
sub csv_translate { |
|
my $text = shift; |
|
$text =~ s/\"/\"\"/g; |
|
$text =~ s/\n//g; |
|
return $text; |
|
} |
|
|
|
############################################################### |
|
|
|
############################################################### |
## Home server <option> list generating code ## |
## Home server <option> list generating code ## |
############################################################### |
############################################################### |
#------------------------------------------- |
#------------------------------------------- |
Line 750 sub filedescriptionex {
|
Line 768 sub filedescriptionex {
|
return '.'.$ex.' '.$fd{lc($ex)}; |
return '.'.$ex.' '.$fd{lc($ex)}; |
} |
} |
|
|
|
# ---- Retrieve attempts by students |
|
# input |
|
# $symb - problem including path |
|
# $username,$domain - that of the student |
|
# $course - course name |
|
# $getattempt - leave blank if want all attempts, else put something. |
|
# |
|
# output |
|
# formatted as a table all the attempts, if any. |
|
# |
sub get_previous_attempt { |
sub get_previous_attempt { |
my ($symb,$username,$domain,$course)=@_; |
my ($symb,$username,$domain,$course,$getattempt)=@_; |
my $prevattempts=''; |
my $prevattempts=''; |
if ($symb) { |
if ($symb) { |
my (%returnhash)= |
my (%returnhash)= |
Line 764 sub get_previous_attempt {
|
Line 792 sub get_previous_attempt {
|
$lasthash{$_}=$returnhash{$version.':'.$_}; |
$lasthash{$_}=$returnhash{$version.':'.$_}; |
} |
} |
} |
} |
$prevattempts='<table border=2></tr><th>History</th>'; |
$prevattempts='<table border="0" width="100%"><tr><td bgcolor="#000000">'; |
|
$prevattempts.='<table border="0" width="100%"><tr bgcolor="#e6ffff"><td>History</td>'; |
foreach (sort(keys %lasthash)) { |
foreach (sort(keys %lasthash)) { |
my ($ign,@parts) = split(/\./,$_); |
my ($ign,@parts) = split(/\./,$_); |
if (@parts) { |
if (@parts) { |
my $data=$parts[-1]; |
my $data=$parts[-1]; |
pop(@parts); |
pop(@parts); |
$prevattempts.='<th>Part '.join('.',@parts).'<br />'.$data.'</th>'; |
$prevattempts.='<td>Part '.join('.',@parts).'<br />'.$data.' </td>'; |
} else { |
} else { |
$prevattempts.='<th>'.$ign.'</th>'; |
$prevattempts.='<td>'.$ign.' </td>'; |
} |
} |
} |
} |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
if ($getattempt eq '') { |
$prevattempts.='</tr><tr><th>Attempt '.$version.'</th>'; |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
foreach (sort(keys %lasthash)) { |
$prevattempts.='</tr><tr bgcolor="#ffffe6"><td>Transaction '.$version.'</td>'; |
my $value; |
foreach (sort(keys %lasthash)) { |
if ($_ =~ /timestamp/) { |
my $value; |
$value=scalar(localtime($returnhash{$version.':'.$_})); |
if ($_ =~ /timestamp/) { |
} else { |
$value=scalar(localtime($returnhash{$version.':'.$_})); |
$value=$returnhash{$version.':'.$_}; |
} else { |
} |
$value=$returnhash{$version.':'.$_}; |
$prevattempts.='<td>'.$value.'</td>'; |
} |
} |
$prevattempts.='<td>'.$value.' </td>'; |
|
} |
|
} |
} |
} |
$prevattempts.='</tr><tr><th>Current</th>'; |
$prevattempts.='</tr><tr bgcolor="#ffffe6"><td>Current</td>'; |
foreach (sort(keys %lasthash)) { |
foreach (sort(keys %lasthash)) { |
my $value; |
my $value; |
if ($_ =~ /timestamp/) { |
if ($_ =~ /timestamp/) { |
Line 795 sub get_previous_attempt {
|
Line 826 sub get_previous_attempt {
|
} else { |
} else { |
$value=$lasthash{$_}; |
$value=$lasthash{$_}; |
} |
} |
$prevattempts.='<td>'.$value.'</td>'; |
$prevattempts.='<td>'.$value.' </td>'; |
} |
} |
$prevattempts.='</tr></table>'; |
$prevattempts.='</tr></table></td></tr></table>'; |
} else { |
} else { |
$prevattempts='Nothing submitted - no attempts.'; |
$prevattempts='Nothing submitted - no attempts.'; |
} |
} |
Line 857 sub get_student_answers {
|
Line 888 sub get_student_answers {
|
return $userview; |
return $userview; |
} |
} |
|
|
|
############################################### |
|
|
|
=item get_unprocessed_cgi($query,$possible_names) |
|
|
|
Modify the %ENV hash to contain unprocessed CGI form parameters held in |
|
$query. The parameters listed in $possible_names (an array reference), |
|
will be set in $ENV{'form.name'} if they do not already exist. |
|
|
|
Typically called with $ENV{'QUERY_STRING'} as the first parameter. |
|
$possible_names is an ref to an array of form element names. As an example: |
|
get_unprocessed_cgi($ENV{'QUERY_STRING'},['uname','udom']); |
|
will result in $ENV{'form.uname'} and $ENV{'form.udom'} being set. |
|
|
|
=cut |
|
|
|
############################################### |
|
|
sub get_unprocessed_cgi { |
sub get_unprocessed_cgi { |
my ($query,$possible_names)= @_; |
my ($query,$possible_names)= @_; |
# $Apache::lonxml::debug=1; |
# $Apache::lonxml::debug=1; |