--- loncom/interface/londocs.pm 2014/03/09 15:49:48 1.578 +++ loncom/interface/londocs.pm 2014/08/25 00:55:27 1.583 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.578 2014/03/09 15:49:48 raeburn Exp $ +# $Id: londocs.pm,v 1.583 2014/08/25 00:55:27 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3175,7 +3175,7 @@ sub process_file_upload { my $quotatype = 'unofficial'; if ($crstype eq 'Community') { $quotatype = 'community'; - } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.instcode'}) { + } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.coursecode'}) { $quotatype = 'official'; } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.textbook'}) { $quotatype = 'textbook'; @@ -3183,7 +3183,8 @@ sub process_file_upload { if (&Apache::loncommon::get_user_quota($coursenum,$coursedom,'course',$quotatype)) { $filesize = int($filesize/1000); #expressed in kb $$upload_output = &Apache::loncommon::excess_filesize_warning($coursenum,$coursedom,'course', - $env{'form.uploaddoc.filename'},$filesize,'upload'); + $env{'form.uploaddoc.filename'},$filesize, + 'upload',$quotatype); return if ($$upload_output); } my ($parseaction,$showupload,$nextphase,$mimetype); @@ -3344,7 +3345,7 @@ sub is_supplemental_title { sub entryline { my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom, $crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups)=@_; - my ($foldertitle,$renametitle); + my ($foldertitle,$renametitle,$oldtitle); if (&is_supplemental_title($title)) { ($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title); } else { @@ -3357,8 +3358,9 @@ sub entryline { $renametitle=~s/\\/\\\\/g; $renametitle=~s/\"\;/\\\"/g; - $renametitle=~s/\'/\\\'/g; $renametitle=~s/ /%20/g; + $oldtitle = $renametitle; + $renametitle=~s/\'/\\\'/g; my $line=&Apache::loncommon::start_data_table_row(); my ($form_start,$form_end,$form_common,$form_param); # Edit commands @@ -3508,7 +3510,7 @@ ENDREM } } $renamelink=(<$lt{'rn'} +$lt{'rn'} ENDREN $line.=(< @@ -4504,12 +4506,8 @@ sub handler { $allowed = &Apache::lonnet::allowed('mdc',$env{'request.course.id'}); } - &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['chooseserver', - 'inhibitmenu']); - if ($allowed && $env{'form.chooseserver'}) { - &choose_dump_server($r); - return OK; - } elsif ($allowed && $env{'form.verify'}) { + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['inhibitmenu']); + if ($allowed && $env{'form.verify'}) { &init_breadcrumbs('verify','Verify Content','Docs_Verify_Content'); &verifycontent($r); } elsif ($allowed && $env{'form.listsymbs'}) { @@ -5462,15 +5460,16 @@ sub decompression_info { 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 .= ''."\n"; + &HTML::Entities::encode($env{'form.'.$item},'<>&"').'" />'."\n"; } } return ($destination,$dir_root,$londocroot,$docudom,$docuname,$container, @@ -5527,25 +5526,34 @@ sub remove_archive { } 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,@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;