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

raeburn raeburn at source.lon-capa.org
Sat Mar 1 20:42:04 EST 2025


raeburn		Sun Mar  2 01:42:04 2025 EDT

  Modified files:              
    /loncom/homework	inputtags.pm 
  Log:
  - Modify changes in rev. 1.329 so essayresponse can show files submitted in
    most recent submission in case where no more submissions are allowed.
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.364 loncom/homework/inputtags.pm:1.365
--- loncom/homework/inputtags.pm:1.364	Sat Mar  1 17:20:14 2025
+++ loncom/homework/inputtags.pm	Sun Mar  2 01:42:04 2025
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.364 2025/03/01 17:20:14 raeburn Exp $
+# $Id: inputtags.pm,v 1.365 2025/03/02 01:42:04 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -660,7 +660,7 @@
     $jspart=~s/\./_/g;
 
     my $result;
-    my $current_files_display = &current_file_submissions($part,$id);
+    my $current_files_display = &current_file_submissions($part,$id,'unversioned');
     my $addfiles;
     if ($current_files_display) {
         $result .= &Apache::lonhtmlcommon::row_title(&mt('Files currently selected for submission')).
@@ -722,21 +722,25 @@
 }
 
 sub current_file_submissions {
-    my ($part,$id) = @_;
+    my ($part,$id,$filetype) = @_;
     my $jspart=$part;
     $jspart=~s/\./_/g;
     my $uploadedfile=$Apache::lonhomework::history{"resource.$part.$id.uploadedfile"};
     my $portfiles=$Apache::lonhomework::history{"resource.$part.$id.portfiles"};
     return if (($uploadedfile eq '') && ($portfiles !~/[^\s]/));
-    my @unversioned;
+    my @files_to_show;
     foreach my $file (split(/\s*,\s*/,&unescape($portfiles))) {
         my ($path,$name) = ($file =~ m{^(.*/)([^/]+)$});
         my ($origname,$version,$ext) = &Apache::lonnet::file_name_version_ext($name);
-        unless ($version) {
-            push(@unversioned,$file);
-        }    
+        if ($filetype eq 'unversioned') {
+            unless ($version) {
+                push(@files_to_show,$file);
+            }
+        } else {
+            push(@files_to_show,$file);
+        }
     }
-    return if (!@unversioned);
+    return unless ((@files_to_show) || ($uploadedfile));
     my $header = &portpath_popup_js().
                  &Apache::loncommon::start_data_table().
                  &Apache::loncommon::start_data_table_header_row();
@@ -766,9 +770,9 @@
             push(@bad_file_list,$error);
         }
     }
-    if (@unversioned > 0) {
+    if (@files_to_show > 0) {
         my $prefix = "/uploaded/$udom/$uname/portfolio";
-        foreach my $file (@unversioned) {
+        foreach my $file (@files_to_show) {
             my ($path,$name) = ($file =~ m{^(.*/)([^/]+)$});
             my $url = $prefix.$path.$name;
             my $uploadedfile = &HTML::Entities::encode($url,'<>&"');




More information about the LON-CAPA-cvs mailing list