[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm inputtags.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 21 Feb 2006 22:41:30 -0000
albertel Tue Feb 21 17:41:30 2006 EDT
Modified files:
/loncom/homework inputtags.pm bridgetask.pm
Log:
- if students submitted portfolio items that don't exist let them know
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.186 loncom/homework/inputtags.pm:1.187
--- loncom/homework/inputtags.pm:1.186 Wed Jan 4 00:56:16 2006
+++ loncom/homework/inputtags.pm Tue Feb 21 17:41:29 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.186 2006/01/04 05:56:16 albertel Exp $
+# $Id: inputtags.pm,v 1.187 2006/02/21 22:41:29 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -363,15 +363,22 @@
'<input type="text" size="50" name="HWPORT'.$jspart.'_'.$id.'" value="" />'.
'<br />';
if ($Apache::lonhomework::history{"resource.$part.$id.portfiles"}=~/[^\s]/){
- my @filelist;
+ my (@filelist,@bad_file_list);
foreach my $file (split(',',&Apache::lonnet::unescape($Apache::lonhomework::history{"resource.$part.$id.portfiles"}))) {
my (undef,undef,$domain,$user)=&Apache::lonxml::whichuser();
my $url="/uploaded/$domain/$user/portfolio$file";
my $icon=&Apache::loncommon::icon($url);
push(@filelist,'<a href="'.$url.'"><img src="'.$icon.
'" border="0" />'.$file.'</a>');
+ if (! &Apache::lonnet::stat_file($url)) {
+ push(@bad_file_list,'<a href="'.$url.'"><img src="'.$icon.
+ '" border="0" />'.$file.'</a>');
+ }
}
$result.=&mt("Portfolio files previously selected: <strong>[_1]</strong>",join(', ',@filelist));
+ if (@bad_file_list) {
+ $result.='<br />'.&mt('<font color="red">These file(s) don\'t exist:</font> <strong>[_1]</strong>',join(', ',@bad_file_list));
+ }
}
}
$result.='</td></tr>';
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.113 loncom/homework/bridgetask.pm:1.114
--- loncom/homework/bridgetask.pm:1.113 Tue Feb 21 13:36:30 2006
+++ loncom/homework/bridgetask.pm Tue Feb 21 17:41:29 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.113 2006/02/21 18:36:30 albertel Exp $
+# $Id: bridgetask.pm,v 1.114 2006/02/21 22:41:29 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -480,7 +480,20 @@
} elsif ($env{'form.donescreen'}) {
my $title=&Apache::lonnet::gettitle();
my @files=split(',',$Apache::lonhomework::history{'resource.'.$version.'.0.bridgetask.portfiles'});
- my $files='<ul><li>'.join('</li><li>',@files).'</li></ul>';
+ 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>