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

raeburn raeburn at source.lon-capa.org
Mon Dec 22 12:04:04 EST 2014


raeburn		Mon Dec 22 17:04:04 2014 EDT

  Modified files:              
    /loncom/homework	essayresponse.pm externalresponse.pm inputtags.pm 
  Log:
  - Support for submission of files to externalresponse
    - Exclude "graded files" (i.e., versioned files) from previous (incorrect) 
      graded submission when displaying list of files selected for submission.
    - Wording change to differentiate between submission and saving (as "draft") 
      without grading, and to differentiate between submission (essayresponse)
      and grading (externalresponse). 
  
  
Index: loncom/homework/essayresponse.pm
diff -u loncom/homework/essayresponse.pm:1.122 loncom/homework/essayresponse.pm:1.123
--- loncom/homework/essayresponse.pm:1.122	Sat Dec  6 20:08:16 2014
+++ loncom/homework/essayresponse.pm	Mon Dec 22 17:04:03 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # essay (ungraded) style responses
 #
-# $Id: essayresponse.pm,v 1.122 2014/12/06 20:08:16 raeburn Exp $
+# $Id: essayresponse.pm,v 1.123 2014/12/22 17:04:03 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -68,7 +68,7 @@
                 ($Apache::lonhomework::type eq 'anonsurveycred')) {
                 $hiddendraft = '<input type="hidden" name="HWDRAFT'.$part.'_'.$id.'" value="yes" />';
             } else {
-                $result = &draft_row($part,$id,$ncol,$uploadedfiletypes);
+                $result = &draft_row($part,$id,$ncol,$uploadedfiletypes.'essayresponse');
 	    }
 	    if ($ncol > 0) {
                 $result .= &get_collab_row($part,$id,$coll,$ncol);
@@ -98,7 +98,7 @@
 }
 
 sub draft_row {
-    my ($part,$id,$ncol,$uploadedfiletypes) = @_;
+    my ($part,$id,$ncol,$uploadedfiletypes,$resptype) = @_;
     my $status_text = &mt('Submission type');
     if ($Apache::lonhomework::history{"resource.$part.award"} eq 'DRAFT') {
         $status_text .= '<br />'.&mt('(Currently -- draft)');
@@ -107,14 +107,23 @@
     unless ($ncol || $uploadedfiletypes) {
         $closure = 1;
     }
+    my %label = (
+        draft => {
+                   essayresponse => &mt('Save entries below (not submitted for credit yet)'),
+                   externalresponse => &mt('Save entries below (not submitted for grading yet)'),
+                 },
+        submit => {
+                    essayresponse => &mt('Submit entries below as answer to receive credit'),
+                    externalresponse => &mt('Submit entries below for grading'),
+                  }
+    );
     return &Apache::lonhtmlcommon::row_title($status_text).
            '<label>'.
            '<input type="radio" name="HWDRAFT'.$part.'_'.$id.'" value="yes" checked="checked" />'.
-           ' '.&mt('Submit entries below as answer to receive credit').'</label> <br />'.
+           ' '.$label{'submit'}{$resptype}.'</label> <br />'.
            '<label>'.
            '<input type="radio" name="HWDRAFT'.$part.'_'.$id.'" value="no" /> '.
-           &mt('Save entries below (not submitted for credit yet)').
-           '</label>'.
+           $label{'draft'}{$resptype}.'</label>'.
            &Apache::lonhtmlcommon::row_closure($closure);
 }
 
@@ -318,7 +327,14 @@
     if ($Apache::lonhomework::history{"resource.$part.$id.portfiles"} ||
         $Apache::lonhomework::history{"resource.$part.$id.uploadedurl"}) {
         if ($Apache::lonhomework::history{"resource.$part.$id.portfiles"}) {
-            @portfiles = split(/,/,$Apache::lonhomework::history{"resource.$part.$id.portfiles"});
+            my @possfiles = split(/,/,$Apache::lonhomework::history{"resource.$part.$id.portfiles"});
+            foreach my $file (@possfiles) {
+                my ($path,$name) = ($file =~ m{^(.*/)([^/]+)$});
+                my ($origname,$version,$ext) = &Apache::lonnet::file_name_version_ext($name);
+                unless ($version) {
+                    push(@portfiles,$file);
+                }
+            }
         }
         $uploadedurl = $Apache::lonhomework::history{"resource.$part.$id.uploadedurl"};
         if (ref($deletions) eq 'ARRAY') {
Index: loncom/homework/externalresponse.pm
diff -u loncom/homework/externalresponse.pm:1.31 loncom/homework/externalresponse.pm:1.32
--- loncom/homework/externalresponse.pm:1.31	Sun Dec  7 19:45:08 2014
+++ loncom/homework/externalresponse.pm	Mon Dec 22 17:04:03 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # external style responses
 #
-# $Id: externalresponse.pm,v 1.31 2014/12/07 19:45:08 raeburn Exp $
+# $Id: externalresponse.pm,v 1.32 2014/12/22 17:04:03 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -97,7 +97,8 @@
                     ($Apache::lonhomework::type eq 'anonsurveycred')) {
                     $hiddendraft = '<input type="hidden" name="HWDRAFT'.$part.'_'.$id.'" value="yes" />';
                 } else {
-                    $result = &Apache::essayresponse::draft_row($part,$id,$ncol,$uploadedfiletypes);
+                    $result = &Apache::essayresponse::draft_row($part,$id,$ncol,$uploadedfiletypes,
+                                                                'externalresponse');
                 }
                 if ($ncol > 0) {
                     $result .= &Apache::essayresponse::get_collab_row($part,$id,$coll,$ncol);
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.328 loncom/homework/inputtags.pm:1.329
--- loncom/homework/inputtags.pm:1.328	Fri Nov 28 18:23:04 2014
+++ loncom/homework/inputtags.pm	Mon Dec 22 17:04:03 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.328 2014/11/28 18:23:04 raeburn Exp $
+# $Id: inputtags.pm,v 1.329 2014/12/22 17:04:03 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -641,7 +641,7 @@
     my $current_files_display = &current_file_submissions($part,$id);
     my $addfiles;
     if ($current_files_display) {
-        $result .= &Apache::lonhtmlcommon::row_title(&mt('Currently submitted files')).
+        $result .= &Apache::lonhtmlcommon::row_title(&mt('Files currently selected for submission')).
                    $current_files_display.
                    &Apache::lonhtmlcommon::row_closure();
         $addfiles = &mt('Submit other file(s)');
@@ -699,6 +699,15 @@
     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;
+    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);
+        }    
+    }
+    return if (!@unversioned);
     my $header = &portpath_popup_js().
                  &Apache::loncommon::start_data_table().
                  &Apache::loncommon::start_data_table_header_row();
@@ -709,7 +718,7 @@
                  '<th>'.&mt('Size (MB)').'</th>'.
                  '<th>'.&mt('Last Modified').'</th>'.
                  &Apache::loncommon::end_data_table_header_row();
-    my (undef,$crsid,$udom,$uname)=&Apache::lonnet::whichuser();
+    my ($symb,$crsid,$udom,$uname)=&Apache::lonnet::whichuser();
     my ($cdom,$cnum) = ($crsid =~ /^($LONCAPA::match_domain)_($LONCAPA::match_courseid)$/);
     my ($result,$header_shown,%okfiles,%rows,%legacy, at bad_file_list);
     if ($uploadedfile) {
@@ -728,9 +737,9 @@
             push(@bad_file_list,$error);
         }
     }
-    if ($portfiles =~ /[^\s]/) {
+    if (@unversioned > 0) {
         my $prefix = "/uploaded/$udom/$uname/portfolio";
-        foreach my $file (split(/\s*,\s*/,&unescape($portfiles))) {
+        foreach my $file (@unversioned) {
             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