[LON-CAPA-cvs] cvs: loncom /interface londocs.pm
raeburn
raeburn at source.lon-capa.org
Sun Aug 24 20:55:27 EDT 2014
raeburn Mon Aug 25 00:55:27 2014 EDT
Modified files:
/loncom/interface londocs.pm
Log:
- Removal of archive file (.zip etc.) uploaded to a course from which
contents have just been extracted:
- Sanity checking: compare url of item from current map with expected
url of archive file before removing archive file.
- Auto-extraction of Camtasia files from zip file -- map order index
expected for archive file being deleted needs to be adjusted if the
folder was originally empty, prior to fiel upload.
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.582 loncom/interface/londocs.pm:1.583
--- loncom/interface/londocs.pm:1.582 Mon Jun 16 00:09:31 2014
+++ loncom/interface/londocs.pm Mon Aug 25 00:55:27 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.582 2014/06/16 00:09:31 raeburn Exp $
+# $Id: londocs.pm,v 1.583 2014/08/25 00:55:27 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -5460,15 +5460,16 @@
my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'};
my $container='sequence';
my ($pathitem,$hiddenelem);
- my @hiddens = ('newidx','comment','position','folderpath');
+ my @hiddens = ('newidx','comment','position','folderpath','archiveurl');
if ($env{'form.folderpath'} =~ /\:1$/) {
$container='page';
}
unshift(@hiddens,$pathitem);
foreach my $item (@hiddens) {
if ($env{'form.'.$item}) {
+ my $value = $env{'form.'.$item};
$hiddenelem .= '<input type="hidden" name="'.$item.'" value="'.
- $env{'form.'.$item}.'" />'."\n";
+ &HTML::Entities::encode($env{'form.'.$item},'<>&"').'" />'."\n";
}
}
return ($destination,$dir_root,$londocroot,$docudom,$docuname,$container,
@@ -5525,25 +5526,34 @@
} else {
$delwarning = &mt('An error occurred retrieving the contents of the current folder.');
}
- $delwarning .= &mt('As a result the archive file has not been removed.');
+ $delwarning .= ' '.&mt('As a result the archive file has not been removed.');
} else {
my $currcmd = $env{'form.cmd'};
my $position = $env{'form.position'};
+ my $archiveidx = $position;
if ($position > 0) {
- $env{'form.cmd'} = 'remove_'.$position;
+ if (($env{'form.autoextract_camtasia'}) && (scalar(@LONCAPA::map::order) == 2)) {
+ $archiveidx = $position-1;
+ }
+ $env{'form.cmd'} = 'remove_'.$archiveidx;
my ($title,$url, at rrest) =
- split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$position]]);
- if (&handle_edit_cmd($docuname,$docudom)) {
- ($errtext,$fatal) = &storemap($docuname,$docudom,$map,1);
- if ($fatal) {
- if ($container eq 'page') {
- $delwarning = &mt('An error occurred updating the contents of the current page.');
+ split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$archiveidx]]);
+ if ($url eq $env{'form.archiveurl'}) {
+ if (&handle_edit_cmd($docuname,$docudom)) {
+ ($errtext,$fatal) = &storemap($docuname,$docudom,$map,1);
+ if ($fatal) {
+ if ($container eq 'page') {
+ $delwarning = &mt('An error occurred updating the contents of the current page.');
+ } else {
+ $delwarning = &mt('An error occurred updating the contents of the current folder.');
+ }
} else {
- $delwarning = &mt('An error occurred updating the contents of the current folder.');
+ $delresult = &mt('Archive file removed.');
}
- } else {
- $delresult = &mt('Archive file removed.');
}
+ } else {
+ $delwarning .= &mt('Archive file had unexpected item number in folder.').
+ ' '.&mt('As a result the archive file has not been removed.');
}
}
$env{'form.cmd'} = $currcmd;
More information about the LON-CAPA-cvs
mailing list