[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm

raeburn raeburn@source.lon-capa.org
Tue, 12 Oct 2010 16:07:43 -0000


raeburn		Tue Oct 12 16:07:43 2010 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  - Bug 5633.
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.254 loncom/homework/bridgetask.pm:1.255
--- loncom/homework/bridgetask.pm:1.254	Mon Sep 27 20:59:41 2010
+++ loncom/homework/bridgetask.pm	Tue Oct 12 16:07:43 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.254 2010/09/27 20:59:41 raeburn Exp $
+# $Id: bridgetask.pm,v 1.255 2010/10/12 16:07:43 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -545,23 +545,35 @@
     my $title=&Apache::lonnet::gettitle($env{'request.uri'});
     my @files=split(',',$Apache::lonhomework::history{'resource.'.$version.'.0.bridgetask.portfiles'});
     my (undef,undef,$domain,$user)= &Apache::lonnet::whichuser();
-    my $files = '<ul>';
-    my $msg;
-    foreach my $file (@files) {
-	my $url="/uploaded/$domain/$user/portfolio$file";
-	if (! &Apache::lonnet::stat_file($url)) {
-	    $file = '<span class="LC_error">'
-                   .&mt('[_1]Nonexistent file:[_2]'
-                       ,'<span class="LC_error"> '
-                       ,'</span> <span class="LC_filename">'.$file.'</span>');
-	    $msg .= "<p>".&mt('Submitted non-existent file [_1]',$file)."</p>\n";
-	} else {
-	    $file = '<span class="LC_filename">'.$file.'</span>';
-	    $msg .= "<p>".&mt('Submitted file [_1]',$file)."</p>\n";
-	}
-	$files .= '<li>'.$file.'</li>';
+    my ($msg,$files,$shown);
+    if (@files > 0) {
+        $files = '<ul>';
+        foreach my $file (@files) {
+	    my $url="/uploaded/$domain/$user/portfolio$file";
+	    if (! &Apache::lonnet::stat_file($url)) {
+	        $file = '<span class="LC_error">'
+                       .&mt('[_1]Nonexistent file:[_2]'
+                           ,'<span class="LC_error"> '
+                           ,'</span> <span class="LC_filename">'.$file.'</span>');
+	        $msg .= "<p>".&mt('Submitted non-existent file [_1]',$file)."</p>\n";
+	    } else {
+	        $file = '<span class="LC_filename">'.$file.'</span>';
+	        $msg .= "<p>".&mt('Submitted file [_1]',$file)."</p>\n";
+	    }
+	    $files .= '<li>'.$file.'</li>';
+        }
+        $files.='</ul>';
+        $shown = '<p>'.&mt('Files submitted: [_1]',$files).'</p>'
+                .'<p>'.&mt('You are now done with this Bridge Task').'</p>'
+                .'<hr />'
+                .'<p><a href="/adm/logout">'.&mt('Logout').'</a></p>'
+                .'<p><a href="/adm/roles">'.&mt('Change to a different course').'</a></p>';
+    } else {
+        $msg = &mt("Submission status: no files currently submitted, when 'Done' was indicated.");
+        $shown = '<p class="LC_error">'.
+                 &mt('You did not submit any files.  Please try again.').'</span>'.
+                 '</p><p><a href="javascript:history.go(-1);">'.&mt('Back to Bridge Task').'</a></p><hr />';
     }
-    $files.='</ul>';
     my $subject = &mt('Submission message for [_1]',$title);
     my ($message_status,$comment_status);
     my $setting = $env{'course.'.$env{'request.course.id'}.'.task_messages'};
@@ -581,15 +593,11 @@
 	$comment_status = '<p>'.&mt('Message sent to instructor: [_1]',
 				    $comment_status).' </p>';
     }
+ 
     return "<h2>$title</h2>"
-          .'<p>'.&mt('Files submitted: [_1]',$files).'</p>'
-          .'<p>'.&mt('You are now done with this Bridge Task').'</p>'
-          .'<hr />'
-          .'<p><a href="/adm/logout">'.&mt('Logout').'</a></p>'
-.'<p><a href="/adm/roles">'.&mt('Change to a different course').'</a></p>'
-.$message_status
-.$comment_status;
-
+          .$shown
+          .$message_status
+          .$comment_status;
 }
 
 sub start_Task {