--- loncom/interface/londocs.pm	2014/03/11 00:57:23	1.580
+++ loncom/interface/londocs.pm	2014/08/25 01:42:30	1.584
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.580 2014/03/11 00:57:23 raeburn Exp $
+# $Id: londocs.pm,v 1.584 2014/08/25 01:42:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3345,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 {
@@ -3358,8 +3358,9 @@ sub entryline {
 
     $renametitle=~s/\\/\\\\/g;
     $renametitle=~s/\&quot\;/\\\"/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
@@ -3509,7 +3510,7 @@ ENDREM
             }
         }
         $renamelink=(<<ENDREN);
-<a href='javascript:changename("$esc_path","$index","$renametitle");' class="LC_docs_rename">$lt{'rn'}</a>
+<a href='javascript:changename("$esc_path","$index","$oldtitle");' class="LC_docs_rename">$lt{'rn'}</a>
 ENDREN
 	$line.=(<<END);
 <td>
@@ -4505,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'}) {
@@ -5463,7 +5460,7 @@ 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';
     }
@@ -5471,7 +5468,7 @@ sub decompression_info {
     foreach my $item (@hiddens) {
         if ($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,
@@ -5528,25 +5525,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;
-            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.');
+            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[$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;