[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 12 Jun 2006 18:57:20 -0000
albertel Mon Jun 12 14:57:20 2006 EDT
Modified files:
/loncom/homework bridgetask.pm
Log:
- factor out the done screen code
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.165 loncom/homework/bridgetask.pm:1.166
--- loncom/homework/bridgetask.pm:1.165 Mon Jun 12 14:45:35 2006
+++ loncom/homework/bridgetask.pm Mon Jun 12 14:57:20 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.165 2006/06/12 18:45:35 albertel Exp $
+# $Id: bridgetask.pm,v 1.166 2006/06/12 18:57:20 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -413,6 +413,35 @@
return $result;
}
+sub done_screen {
+ my ($version) = @_;
+ my $title=&Apache::lonnet::gettitle();
+ my @files=split(',',$Apache::lonhomework::history{'resource.'.$version.'.0.bridgetask.portfiles'});
+ my (undef,undef,$domain,$user)= &Apache::lonxml::whichuser();
+ my $files = '<ul>';
+ foreach my $file (@files) {
+ my $url="/uploaded/$domain/$user/portfolio$file";
+ if (! &Apache::lonnet::stat_file($url)) {
+ $file = &mt('<span class="LC_error"> Nonexistent file:</span> '.
+ '<span class="LC_filename">[_1]</span>',$file);
+ } else {
+ $file = '<span class="LC_filename">'.$file.'</span>';
+ }
+ $files .= '<li>'.$file.'</li>';
+ }
+ $files.='</ul>';
+
+ return <<DONESCREEN;
+<h2>$title</h2>
+<p> Files submitted: $files </p>
+<p> You are now done with this Bridge Task </p>
+<hr />
+<p> <a href="/adm/logout">Logout</a> </p>
+<p> <a href="/adm/roles">Change to a different course</a> </p>
+DONESCREEN
+
+}
+
sub start_Task {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
@@ -513,30 +542,7 @@
} elsif ($status eq 'WAITING_FOR_GRADE') {
$msg.='<h1>'.&mt('Your submission is in the grading queue.').'</h1>';
} elsif ($env{'form.donescreen'}) {
- my $title=&Apache::lonnet::gettitle();
- my @files=split(',',$Apache::lonhomework::history{'resource.'.$version.'.0.bridgetask.portfiles'});
- my (undef,undef,$domain,$user)=
- &Apache::lonxml::whichuser();
- my $files = '<ul>';
- foreach my $file (@files) {
- my $url="/uploaded/$domain/$user/portfolio$file";
- if (! &Apache::lonnet::stat_file($url)) {
- $file = &mt('<font color="red"> Nonexistant file:</font> <tt>[_1]</tt>',$file);
- } else {
- $file = '<tt>'.$file.'</tt>';
- }
- $files .= '<li>'.$file.'</li>';
- }
- $files.='</ul>';
-
- $result.=<<DONESCREEN;
-<h2>$title</h2>
-<p> Files submitted: $files </p>
-<p> You are now done with this Bridge Task </p>
-<hr />
-<p> <a href="/adm/logout">Logout</a> </p>
-<p> <a href="/adm/roles">Change to a different course</a> </p>
-DONESCREEN
+ $result .= &done_screen();
} elsif ($status ne 'NOT_YET_VIEWED') {
$msg.='<h1>'.&mt('Not open to be viewed').'</h1>';
}