[LON-CAPA-cvs] cvs: loncom /homework essayresponse.pm
raeburn
raeburn@source.lon-capa.org
Sun, 29 Aug 2010 19:36:38 -0000
raeburn Sun Aug 29 19:36:38 2010 EDT
Modified files:
/loncom/homework essayresponse.pm
Log:
- Support deletion of uploaded files from submission, in cases where original
file was uploaded using older versions of essayresponse.pm
-- pre rev. 1.95 (LON-CAPA 2.8.0) -- where there was no hierarchy below:
$udom/$uname/essayresponse.
- Allow submission to occur if only action is to delete a file uploaded via the
old mechanism.
Index: loncom/homework/essayresponse.pm
diff -u loncom/homework/essayresponse.pm:1.111 loncom/homework/essayresponse.pm:1.112
--- loncom/homework/essayresponse.pm:1.111 Sat Aug 28 22:25:07 2010
+++ loncom/homework/essayresponse.pm Sun Aug 29 19:36:37 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# essay (ungraded) style responses
#
-# $Id: essayresponse.pm,v 1.111 2010/08/28 22:25:07 raeburn Exp $
+# $Id: essayresponse.pm,v 1.112 2010/08/29 19:36:37 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -308,6 +308,8 @@
$port_delete{$file} = 1;
} elsif ($file =~ m{^/uploaded/\Q$udom\E/\Q$uname\E/essayresponse/\Q$cdom\E/\Q$cnum\E/}) {
$uploaded_delete = $file;
+ } elsif ($file =~ m{^/uploaded/\Q$udom\E/\Q$uname\E/essayresponse/[^/]+$}) {
+ $uploaded_delete = $file;
}
}
}
@@ -318,8 +320,12 @@
}
}
if ($uploaded_delete) {
- $Apache::lonhomework::results{"resource.$part.$id.uploadedfile"} = "";
- $Apache::lonhomework::results{"resource.$part.$id.uploadedurl"} = "";
+ if ($uploaded_delete eq $uploadedurl) {
+ $Apache::lonhomework::results{"resource.$part.$id.uploadedfile"} = "";
+ $Apache::lonhomework::results{"resource.$part.$id.uploadedurl"} = "";
+ } else {
+ undef($uploaded_delete);
+ }
}
}
if ($env{'form.HWPORT'.$jspart.'_'.$id} ne '') {
@@ -516,7 +522,9 @@
$Apache::lonhomework::results{"resource.$part.$id.portfiles"} = "";
}
}
- if ($Apache::lonhomework::history{"resource.$part.$id.portfiles"} ne $Apache::lonhomework::results{"resource.$part.$id.portfiles"}) {
+ if (($Apache::lonhomework::history{"resource.$part.$id.portfiles"} ne
+ $Apache::lonhomework::results{"resource.$part.$id.portfiles"}) ||
+ ($uploaded_delete)) {
if (ref($uploadedflag)) {
$$uploadedflag=1;
}