--- loncom/interface/londocs.pm	2016/10/31 20:48:30	1.484.2.66
+++ loncom/interface/londocs.pm	2015/06/09 21:22:56	1.594
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.484.2.66 2016/10/31 20:48:30 raeburn Exp $
+# $Id: londocs.pm,v 1.594 2015/06/09 21:22:56 damieng Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -196,7 +196,7 @@ ENDJS
         } else {
             &Apache::loncourserespicker::enumerate_course_contents($navmap,\%maps,\%resources,\%titles,
                                                                    'dumpdocs',$cdom,$cnum);
-        }
+	}
         my @todump = &Apache::loncommon::get_env_multiple('form.archive');
         my (%tocopy,%replacehash,%lookup,%deps,%display,%result,%depresult,%simpleproblems,%simplepages,
             %newcontent,%has_simpleprobs);
@@ -207,7 +207,7 @@ ENDJS
                 if ($res =~ m{^uploaded/$cdom/$cnum/\E((?:docs|supplemental)/.+)$}) {
                     $tocopy{$1} = $name;
                     $display{$item} = $1;
-                    $lookup{$1} = $item;
+                    $lookup{$1} = $item; 
                 } elsif ($res eq 'lib/templates/simpleproblem.problem') {
                     $simpleproblems{$item} = {
                                                 symb => $resources{$item},
@@ -307,7 +307,7 @@ $contents{content}.'
 </div>';
                 }
                 if ($contents{webreferences}) {
-                    $content .= '
+                    $content .= ' 
 <div class="LC_Box">
 <h4 class="LC_hcell">'.&mt('Web References').'</h4>'.
 $contents{webreferences}.'
@@ -317,10 +317,10 @@ $contents{webreferences}.'
 </body>
 </html>
 ';
-                $newcontent{'/'.$simplepages{$item}{res}} = $content;
+                $newcontent{'/'.$simplepages{$item}{res}} = $content; 
             }
         }
-        foreach my $item (keys(%tocopy)) {
+	foreach my $item (keys(%tocopy)) {
             unless ($item=~/\.(sequence|page)$/) {
                 my $currurlpath = $prefix.$item;
                 my $currdirpath = &Apache::lonnet::filelocation('',$currurlpath);
@@ -351,39 +351,39 @@ $contents{webreferences}.'
                 if ($simpleproblems{$num}) {
                     $newfilename=$title.'/'.$simpleproblems{$num}{'name'};
                 } else {
-                    $newfilename=$title.'/'.$replacehash{$item};
+	            $newfilename=$title.'/'.$replacehash{$item};
                 }
-                $newfilename=~s/\.(\w+)$//;
-               my $ext=$1;
-                $newfilename=&clean($newfilename);
-                $newfilename.='.'.$ext;
-                my ($newrelpath) = ($newfilename =~ m{^\Q$title/\E(.+)$});
+	        $newfilename=~s/\.(\w+)$//;
+	        my $ext=$1;
+	        $newfilename=&clean($newfilename);
+	        $newfilename.='.'.$ext;
+                my ($newrelpath) = ($newfilename =~ m{^\Q$title/\E(.+)$}); 
                 if ($newrelpath ne $replacehash{$item}) {
                     $replacehash{$item} = $newrelpath;
                 }
-                my @dirs=split(/\//,$newfilename);
-                my $path=$r->dir_config('lonDocRoot')."/priv/$cd/$ca";
-                my $makepath=$path;
-                my $fail;
+	        my @dirs=split(/\//,$newfilename);
+	        my $path=$r->dir_config('lonDocRoot')."/priv/$cd/$ca";
+	        my $makepath=$path;
+	        my $fail;
                 my $origin;
-                for (my $i=0;$i<$#dirs;$i++) {
-                    $makepath.='/'.$dirs[$i];
-                    unless (-e $makepath) {
-                        unless(mkdir($makepath,0755)) {
+	        for (my $i=0;$i<$#dirs;$i++) {
+		    $makepath.='/'.$dirs[$i];
+		    unless (-e $makepath) {
+		        unless(mkdir($makepath,0755)) { 
                             $fail = &mt('Directory creation failed.');
                         }
-                    }
-                }
+		    }
+	        }
                 if ($i == 0) {
-                    $result = '<br /><tt>'.$item.'</tt> => <tt>'.$newfilename.'</tt>: ';
+	            $result = '<br /><tt>'.$item.'</tt> => <tt>'.$newfilename.'</tt>: ';
                 } else {
                     $depresult .= '<li><tt>'.$item.'</tt> => <tt>'.$newfilename.'</tt> '.
                                   '<span class="LC_fontsize_small" style="font-weight: bold;">'.
                                   &mt('(dependency)').'</span>: ';
                 }
                 if (-e $path.'/'.$newfilename) {
-                    $fail = &mt('Destination already exists -- not overwriting.');
-                } else {
+                    $fail = &mt('Destination already exists -- not overwriting.'); 
+	        } else {
                     if (my $fh=Apache::File->new('>'.$path.'/'.$newfilename)) {
                         if (($item =~ m{^/adm/$match_domain/$match_username/\d+/smppg}) ||
                             ($item =~ /^simpleproblem_/)) {
@@ -405,18 +405,18 @@ $contents{webreferences}.'
                                         while (my $token = $parser->get_token) {
                                             if ($token->[0] eq 'S') {
                                                 if (($token->[1] eq 'resource') &&
-                                                    ($token->[2]->{'src'} eq '/res/lib/templates/simpleproblem.problem') &&
+                                                    ($token->[2]->{'src'} eq '/res/lib/templates/simpleproblem.problem') && 
                                                     ($changes{$token->[2]->{'id'}})) {
                                                     my $id = $token->[2]->{'id'};
                                                     $updatedcontent .= '<'.$token->[1];
                                                     foreach my $attrib (@{$token->[3]}) {
-                                                       next unless ($attrib =~ /^(src|type|title|id)$/);
+                                                        next unless ($attrib =~ /^(src|type|title|id)$/);
                                                         if ($attrib eq 'src') {
-                                                            my ($file) = ($display{$changes{$id}} =~ /^\Qsimpleproblem_\E(.+)$/);
+                                                            my ($file) = ($display{$changes{$id}} =~ /^\Qsimpleproblem_\E(.+)$/); 
                                                             if ($file) {
                                                                 $updatedcontent .= ' '.$attrib.'="'.$file.'"';
                                                             } else {
-                                                                $updatedcontent .= ' '.$attrib.'="'.$token->[2]->{$attrib}.'"';
+                                                                $updatedcontent .= ' '.$attrib.'="'.$token->[2]->{$attrib}.'"'; 
                                                             }
                                                         } else {
                                                             $updatedcontent .= ' '.$attrib.'="'.$token->[2]->{$attrib}.'"';
@@ -431,36 +431,36 @@ $contents{webreferences}.'
                                              }
                                          }
                                          print $fh $updatedcontent;
-                                    } else {
-                                        print $fh &Apache::lonclonecourse::rewritefile(
+                                    } else {  
+		                        print $fh &Apache::lonclonecourse::rewritefile(
                      &Apache::lonclonecourse::readfile($env{'request.course.id'},$item),
-                                                      (%replacehash,$crs => '')
-                                                                                      );
+		                                      (%replacehash,$crs => '')
+							                              );
                                     }
                                 } else {
-                                    print $fh
+		                    print $fh
                                         &Apache::lonclonecourse::readfile($env{'request.course.id'},$item);
-                                }
+		                }
                             } else {
-                                $fail = &mt('Source does not exist.');
+                                $fail = &mt('Source does not exist.');  
                             }
                         }
                         $fh->close();
-                    } else {
-                        $fail = &mt('Could not write to destination.');
+	            } else {
+		        $fail = &mt('Could not write to destination.');
                     }
-                }
+	        }
                 my $text;
-                if ($fail) {
+	        if ($fail) {
                     $text = '<span class="LC_error">'.&mt('fail').('&nbsp;'x3).$fail.'</span>';
-                } else {
+	        } else {
                     $text = '<span class="LC_success">'.&mt('ok').'</span>';
                 }
                 if ($i == 0) {
                     $result .= $text;
                 } else {
                     $depresult .= $text.'</li>';
-                }
+	        }
             }
             $r->print($result);
             if ($depresult) {
@@ -477,63 +477,63 @@ $contents{webreferences}.'
             $r->rflush();
             my ($preamble,$formname);
             $formname = 'dumpdoc';
-            unless ($home==1) {
-                $preamble = '<div class="LC_left_float">'.
-                            '<fieldset><legend>'.
+	    unless ($home==1) {
+	        $preamble = '<div class="LC_left_float">'.
+		            '<fieldset><legend>'.
                             &mt('Select the Authoring Space').
                             '</legend><select name="authorspace">';
-            }
+	    }
             my @orderspaces = ();
-            foreach my $key (sort(keys(%outhash))) {
+	    foreach my $key (sort(keys(%outhash))) {
                 if ($key=~/^home_(.+)$/) {
                     if ($1 eq $env{'user.name'}.':'.$env{'user.domain'}) {
                         unshift(@orderspaces,$1);
                     } else {
                         push(@orderspaces,$1);
                     }
-                }
+                } 
             }
             if ($home>1) {
                 $preamble .= '<option value="" selected="selected">'.&mt('Select').'</option>';
             }
             foreach my $user (@orderspaces) {
-                if ($home==1) {
-                    $preamble .= '<input type="hidden" name="authorspace" value="'.$user.'" />';
-                } else {
-                    $preamble .= '<option value="'.$user.'">'.$user.' - '.
-                                 &Apache::loncommon::plainname(split(/\:/,$user)).'</option>';
-                }
-            }
-            unless ($home==1) {
-                $preamble .= '</select></fieldset></div>'."\n";
-            }
-            my $title=$origcrsdata{'description'};
-            $title=~s/[\/\s]+/\_/gs;
-            $title=&clean($title);
-            $preamble .= '<div class="LC_left_float">'.
+		if ($home==1) {
+		    $preamble .= '<input type="hidden" name="authorspace" value="'.$user.'" />';
+		} else {
+		    $preamble .= '<option value="'.$user.'">'.$user.' - '.
+			         &Apache::loncommon::plainname(split(/\:/,$user)).'</option>';
+	        }
+	    }
+	    unless ($home==1) {
+	        $preamble .= '</select></fieldset></div>'."\n";
+	    }
+	    my $title=$origcrsdata{'description'};
+	    $title=~s/[\/\s]+/\_/gs;
+	    $title=&clean($title);
+	    $preamble .= '<div class="LC_left_float">'.
                          '<fieldset><legend>'.&mt('Folder in Authoring Space').'</legend>'.
                          '<input type="text" size="50" name="authorfolder" value="'.
                          $title.'" />'.
                          '</fieldset></div><div style="padding:0;clear:both;margin:0;border:0"></div>'."\n";
             my %uploadedfiles;
-            &tiehash();
-            foreach my $file (&Apache::lonclonecourse::crsdirlist($origcrsid,'userfiles')) {
-                my ($ext)=($file=~/\.(\w+)$/);
+	    &tiehash();
+	    foreach my $file (&Apache::lonclonecourse::crsdirlist($origcrsid,'userfiles')) {
+	        my ($ext)=($file=~/\.(\w+)$/);
 # FIXME Check supplemental here
-                my $title=$hash{'title_'.$hash{
-                                'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$file}};
-                if (!$title) {
-                    $title=$file;
-                } else {
-                    $title=~s|/|_|g;
-                }
-                $title=~s/\.(\w+)$//;
-                $title=&clean($title);
-                $title.='.'.$ext;
-#           $r->print("\n<td><input type='text' size='60' name='namefor_".$file."' value='".$title."' /></td>"
+	        my $title=$hash{'title_'.$hash{
+		                'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$file}};
+	        if (!$title) {
+		    $title=$file;
+	        } else {
+		    $title=~s|/|_|g;
+	        }
+	        $title=~s/\.(\w+)$//;
+	        $title=&clean($title);
+	        $title.='.'.$ext;
+#	    $r->print("\n<td><input type='text' size='60' name='namefor_".$file."' value='".$title."' /></td>"
                 $uploadedfiles{$file} = $title;
-            }
-            &untiehash();
+	    }
+	    &untiehash();
             $r->print(&Apache::loncourserespicker::create_picker($navmap,'dumpdocs',$formname,$crstype,undef,
                                                                  undef,undef,$preamble,$home,\%uploadedfiles));
         }
@@ -564,16 +564,16 @@ sub recurse_html {
                 } else {
                     $relfile = $dependency;
                     $depurl = $currurlpath;
-                    $depurl =~ s{[^/]+$}{}; 
+                    $depurl =~ s{[^/]+$}{};  
                     $depurl .= $dependency;
-                    ($newcontainer) = ($depurl =~ m{^\Q$prefix\E(.+)$});
+                    ($newcontainer) = ($depurl =~ m{^\Q$prefix\E(.+)$}); 
                 }
                 next if ($relfile eq '');
                 my $newname = $replacehash->{$container};
                 $newname =~ s{[^/]+$}{};
                 $replacehash->{$newcontainer} = $newname.$relfile;
                 $deps->{$item}{$newcontainer} = 1;
-                my ($newurlpath) = ($depurl =~ m{^(.*)/[^/]+$});
+                my ($newurlpath) = ($depurl =~ m{^(.*)/[^/]+$});  
                 my $depfile = &Apache::lonnet::filelocation('',$depurl);
                 my $type = $mm->checktype_filename($depfile);
                 if ($type eq 'text/html') {
@@ -652,7 +652,7 @@ sub group_import {
                 } else {
                     $fname =~ s/\W/_/g;
                 }
-                if (length($fname) > 15) {
+                if (length($fname > 15)) {
                     $fname = substr($fname,0,14);
                 }
                 my $initialtext = &mt('Replace with your own content.');
@@ -667,7 +667,7 @@ $initialtext
 </html>
 END
                 $env{'form.output'}=$newhtml;
-                my $result =
+                my $result = 
                     &Apache::lonnet::finishuserfileupload($coursenum,$coursedom,
                                                           'output',
                                                           "$filepath/$residx/$fname.html");
@@ -692,7 +692,7 @@ END
                           removefrommap => \%removefrommap,
                           removeparam   => \%removeparam,
                       );
-        my ($result,$msgsarray,$lockerror) =
+        my ($result,$msgsarray,$lockerror) = 
             &apply_fixups($folder,1,$coursedom,$coursenum,\%import_errors,\%updated);
         if (keys(%import_errors) > 0) {
             $fixuperrors =
@@ -1242,10 +1242,10 @@ sub print_paste_buffer {
             my $value = &mt('Paste to current folder');
             if ($container eq 'page') {
                 $value = &mt('Paste to current page');
-            }
+            } 
             $buttons = '<input type="submit" name="pastemarked" value="'.$value.'" />'.('&nbsp;'x2);
         }
-        $buttons .= '<input type="submit" name="clearmarked" value="'.&mt('Clear selected').'" />'.('&nbsp;'x2);
+        $buttons .= '<input type="submit" name="clearmarked" value="'.&mt('Remove from clipboard').'" />'.('&nbsp;'x2);
         if ($clipboardcount > 1) {
             $buttons .=
                 '<span style="text-decoration:line-through">'.('&nbsp;'x20).'</span>'.('&nbsp;'x2).
@@ -1418,7 +1418,7 @@ function checkClipboard() {
     if (document.pasteform.pasting.length > 1) {
         for (var i=0; i<document.pasteform.pasting.length; i++) {
             document.pasteform.pasting[i].checked = true;
-        }
+        } 
     }
     return;
 }
@@ -1678,7 +1678,7 @@ sub do_paste_from_buffer {
                     next;
 	        }
                 if ($lockerr{$prefix}) {
-                    $lockerrs{$suffix} = $lockerr{$prefix};
+                    $lockerrs{$suffix} = $lockerr{$prefix};  
                 }
             }
         }
@@ -1717,7 +1717,7 @@ sub do_paste_from_buffer {
                     if ($newdocsdir eq '') {
                         $newdocsdir = 'default';
                     }
-                    if (($prefixchg{$suffix}) ||
+                    if (($prefixchg{$suffix}) || 
                         ($srcdom{$suffix} ne $coursedom) || 
                         ($srcnum{$suffix} ne $coursenum) ||
                         ($env{'form.docs.markedcopy_options_'.$suffix} ne 'move')) {
@@ -1924,7 +1924,7 @@ sub dbcopy {
     if (ref($dbref) eq 'HASH') {
         if ($url =~ m{/(smppg|bulletinboard)$}) {
             my $prefix = $1;
-            if (($dbref->{'cdom'} =~ /^$match_domain$/) &&
+            if (($dbref->{'cdom'} =~ /^$match_domain$/) && 
                 ($dbref->{'cnum'} =~ /^$match_courseid$/)) {
                 my $db_name;
                 my $marker = (split(m{/},$url))[4];
@@ -1959,12 +1959,12 @@ sub dbcopy {
                         my $photo = $contents{'uploaded.photourl'};
                         my ($subdir,$fname) =
                             ($photo =~ m{^/uploaded/$match_domain/$match_courseid/+(bulletin|simplepage)/(?:|\d+/)([^/]+)$});
-                        my $newphoto;
+                        my $newphoto; 
                         if ($fname ne '') {
                             my $content = &Apache::lonnet::getfile($photo);
                             unless ($content eq '-1') {
                                 $env{'form.'.$suffix.'.photourl'} = $content;
-                                $newphoto =
+                                $newphoto = 
                                     &Apache::lonnet::finishuserfileupload($coursenum,$coursedom,$suffix.'.photourl',"$subdir/$suffix/$fname");
                                 delete($env{'form.'.$suffix.'.photourl'});
                             }
@@ -2109,7 +2109,7 @@ sub url_paste_fixups {
             }
             next if ($token->[2]->{'type'} eq 'external');
             if ($token->[2]->{'type'} eq 'zombie') {
-                next if ($skip);
+                next if ($skip);  
                 $zombies->{$oldurl}{$id} = $ressrc;
                 $changed = 1;
             } elsif ($ressrc =~ m{^/uploaded/($match_domain)/($match_courseid)/(.+)$}) {
@@ -2555,7 +2555,7 @@ sub update_parameter {
                          'randomorder'    => {},
                       );
         foreach my $which (keys(%allchecked)) {
-            $env{'form.all'.$which} =~ s/,$//;
+            $env{'form.all'.$which} =~ s/,$//;   
             if ($which eq 'randompick') {
                 foreach my $item (split(/,/,$env{'form.all'.$which})) {
                     my ($res,$value) = split(/:/,$item);
@@ -2582,7 +2582,7 @@ sub update_parameter {
             foreach my $which (keys(%allchecked)) {
                 if (($which eq 'randompick' || $which eq 'randomorder')) {
                     next if (!$is_map);
-                }
+                } 
                 my $oldvalue = 0;
                 my $newvalue = 0;
                 if ($allchecked{$which}{$res}) {
@@ -2634,8 +2634,8 @@ sub update_parameter {
             $oldvalue = 1;
         }
         if ($env{'form.'.$which.'_'.$idx}) {
-            $newvalue = ($which eq 'randompick') ? $env{'form.rpicknum_'.$idx}
-                                                 : 1;
+	    $newvalue = ($which eq 'randompick') ? $env{'form.rpicknum_'.$idx}
+	                                         : 1;
         }
         if ($oldvalue ne $newvalue) {
             $haschanges = 1;
@@ -2644,17 +2644,16 @@ sub update_parameter {
                 if ($which eq 'randompick') {
                     $storeval = $newvalue;
                 }
-                &LONCAPA::map::storeparameter($idx, 'parameter_'.$which, $storeval,
-                                              $parameter_type{$which});
-                &remember_parms($idx,$which,'set',$storeval);
+	        &LONCAPA::map::storeparameter($idx, 'parameter_'.$which, $storeval,
+				              $parameter_type{$which});
+	        &remember_parms($idx,$which,'set',$storeval);
             } else {
-                &LONCAPA::map::delparameter($idx,'parameter_'.$which);
-                &remember_parms($idx,$which,'del');
+	        &LONCAPA::map::delparameter($idx,'parameter_'.$which);
+	        &remember_parms($idx,$which,'del');
             }
         }
         return $haschanges;
     }
-    return;
 }
 
 sub handle_edit_cmd {
@@ -2810,7 +2809,7 @@ sub editor {
 	$r->print($upload_output);
 
 # Rename, cut, copy or remove a single resource
-	if (&handle_edit_cmd($coursenum,$coursedom)) {
+	if (&handle_edit_cmd()) {
             my $contentchg;
             if ($env{'form.cmd'} =~ m{^(remove|cut)_}) {
                 $contentchg = 1;
@@ -3060,11 +3059,11 @@ sub editor {
                     if (@allidx > 0) {
                         my $path;
                         if ($env{'form.folderpath'}) {
-                            $path =
+                            $path = 
                                 &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
                         }
                         if (@allidx > 1) {
-                            $to_show .=
+                            $to_show .= 
                                 &Apache::loncommon::continue_data_table_row().
                                 '<td colspan="2">&nbsp;</td>'.
                                 '<td>'.
@@ -3208,7 +3207,7 @@ sub process_file_upload {
     }
     my $quotatype = 'unofficial';
     if ($crstype eq 'Community') {
-        $quotatype = 'community';
+        $quotatype = 'community';    
     } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.coursecode'}) {
         $quotatype = 'official';
     } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.textbook'}) {
@@ -3395,7 +3394,7 @@ sub entryline {
     $renametitle=~s/"/%22/g;
     $renametitle=~s/ /%20/g;
     $oldtitle = $renametitle;
-    $renametitle=~s/\&#39\;/\\\'/g;
+    $renametitle=~s/\&#39;/\\\'/g;
     my $line=&Apache::loncommon::start_data_table_row();
     my ($form_start,$form_end,$form_common,$form_param);
 # Edit commands
@@ -3480,7 +3479,6 @@ END
                                           $currgroups);
         my ($copylink,$cutlink,$removelink);
 	my $skip_confirm = 0;
-        my $confirm_removal = 0;
 	if ( $folder =~ /^supplemental/
 	     || ($url =~ m{( /smppg$
 			    |/syllabus$
@@ -3491,10 +3489,6 @@ END
              || $isexternal) {
 	    $skip_confirm = 1;
 	}
-        if (($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) &&
-            ($url!~/$LONCAPA::assess_page_seq_re/)) {
-            $confirm_removal = 1;
-        }
 
 	if ($denied{'copy'}) {
             $copylink=(<<ENDCOPY)
@@ -3537,12 +3531,11 @@ ENDCUT
 ENDREM
         } else {
             my $formname = 'edit_remove_'.$orderidx;
-            my $js = "javascript:checkForSubmit(document.forms.renameform,'remove','actions','$orderidx','$esc_path','$index','$renametitle',$skip_confirm,'$container','$folder',$confirm_removal);";
+            my $js = "javascript:checkForSubmit(document.forms.renameform,'remove','actions','$orderidx','$esc_path','$index','$renametitle',$skip_confirm);";
             $removelink=(<<ENDREM);
 <form name="$formname" method="post" action="/adm/coursedocs">
 $form_common
 <input type="hidden" name="skip_$orderidx" id="skip_remove_$orderidx" value="$skip_confirm" />
-<input type="hidden" name="confirm_rem_$orderidx" id="confirm_removal_$orderidx" value="$confirm_removal" />
 <input type="checkbox" name="remove" id="remove_$orderidx" value="$orderidx" onclick="javascript:singleCheck(this,'$orderidx','remove');" class="LC_hidden" /><a href="$js" class="LC_docs_remove">$lt{'rm'}</a>
 $form_end
 ENDREM
@@ -3608,7 +3601,7 @@ END
 	}
     }
 
-    my ($editlink,$extresform,$anchor);
+    my ($editlink,$extresform);
     my $orig_url = $url;
     $orig_url=~s{http(&colon;|:)//https(&colon;|:)//}{https$2//};
     $url=~s{^http(|s)(&colon;|:)//}{/adm/wrapper/ext/};
@@ -3630,28 +3623,11 @@ END
 	        $url='/adm/wrapper'.$url;
 	    }
             if (&Apache::lonnet::symbverify($symb,$url)) {
-                my $shownsymb = $symb;
-                if ($isexternal) {
-                    if ($url =~ /^([^#]+)#([^#]+)$/) {
-                        $url = $1;
-                        $anchor = $2;
-                        if ($symb =~ m{^([^#]+)\Q#$anchor\E$}) {
-                            $shownsymb = $1.&escape('#').$anchor;
-                        }
-                    }
-                }
-	        $url.=(($url=~/\?/)?'&':'?').'symb='.&HTML::Entities::encode($shownsymb,'"<>&');
+	        $url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb);
             } else {
                 $url='';
             }
 	}
-    } elsif ($supplementalflag) {
-        if ($isexternal) {
-            if ($url =~ /^([^#]+)#([^#]+)$/) {
-                $url = $1;
-                $anchor = $2;
-            }
-        }
     }
     my ($rand_pick_text,$rand_order_text);
     if ($isfolder || $ispage || $extension eq 'sequence' || $extension eq 'page') {
@@ -3708,7 +3684,7 @@ $form_common."\n".
 $form_param."\n".
 $form_common."\n".
 '<span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" id="randomorder_'.$orderidx.'" onclick="checkForSubmit(this.form,'."'randomorder','settings'".');" '.$ro_set.' /> '.&mt('Random Order').' </label></span>'.
-$form_end;
+$form_end; 
         }
     } elsif ($supplementalflag && !$allowed) {
         $url .= ($url =~ /\?/) ? '&amp;':'?';
@@ -3719,9 +3695,6 @@ $form_end;
         if ($isexternal && $orderidx) {
             $url .= '&amp;idx='.$orderidx;
         }
-        if ($anchor ne '') {
-            $url .= '&amp;anchor='.&HTML::Entities::encode($anchor,'"<>&');
-        }
     }
     my ($tdalign,$tdwidth);
     if ($allowed) {
@@ -3734,17 +3707,13 @@ $form_end;
             my ($cfile,$home,$switchserver,$forceedit,$forceview) = 
                 &Apache::lonnet::can_edit_resource($fileloc,$coursenum,$coursedom,$orig_url);
             if (($cfile ne '') && ($symb ne '' || $supplementalflag)) {
-                my $suppanchor;
-                if ($supplementalflag) {
-                    $suppanchor = $anchor;
-                }
                 my $jscall = 
                     &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,
                                                             $switchserver,
                                                             $forceedit,
                                                             undef,$symb,
                                                             &escape($env{'form.folderpath'}),
-                                                            $renametitle,'','',1,$suppanchor);
+                                                            $renametitle,'','',1);
                 if ($jscall) {
                     $editlink = '<a class="LC_docs_ext_edit" href="javascript:'.
                                 $jscall.'" >'.&mt('Edit').'</a>&nbsp;'."\n";
@@ -3764,15 +3733,7 @@ $form_end;
     if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {
        $line.='<a href="'.$url.'"><img src="'.$icon.'" alt="" class="LC_icon" /></a>';
     } elsif ($url) {
-       if ($anchor ne '') {
-           if ($supplementalflag) {
-               $anchor = '&amp;anchor='.&HTML::Entities::encode($anchor,'"<>&');
-           } else {
-               $anchor = '#'.&HTML::Entities::encode($anchor,'"<>&');
-           }
-       }
-       $line.=&Apache::loncommon::modal_link($url.(($url=~/\?/)?'&amp;':'?').'inhibitmenu=yes'.
-                                             (($anchor ne '')?$anchor:''),
+       $line.=&Apache::loncommon::modal_link($url.(($url=~/\?/)?'&amp;':'?').'inhibitmenu=yes',
                                              '<img src="'.$icon.'" alt="" class="LC_icon" />',600,500);
     } else {
        $line.='<img src="'.$icon.'" alt="" class="LC_icon" />';
@@ -3781,8 +3742,7 @@ $form_end;
     if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {
        $line.='<a href="'.$url.'">'.$title.'</a>';
     } elsif ($url) {
-       $line.=&Apache::loncommon::modal_link($url.(($url=~/\?/)?'&amp;':'?').'inhibitmenu=yes'.
-                                             (($anchor ne '')?$anchor:''),
+       $line.=&Apache::loncommon::modal_link($url.(($url=~/\?/)?'&amp;':'?').'inhibitmenu=yes',
                                              $title,600,500);
     } else {
        $line.=$title.' <span class="LC_docs_reinit_warn">'.$reinit.'</span>';
@@ -3928,7 +3888,7 @@ sub new_timebased_suffix {
         }
     }
     if ($freedlock ne 'ok') {
-        $locknotfreed =
+        $locknotfreed = 
             '<div class="LC_error">'.
             &mt('There was a problem removing a lockfile.').' ';
         if ($type eq 'paste') {
@@ -3936,9 +3896,9 @@ sub new_timebased_suffix {
                 $locknotfreed =
                     '<div class="LC_error">'.
                     &mt('A lockfile was not released when you added content to the clipboard earlier in this session.').' '.
-
+ 
                     &mt('As a result addition of items to the clipboard will be unavailable until your next log-in.');
-            } else {
+            } else { 
                 $locknotfreed .=
                     &mt('This will prevent addition of items to the clipboard until your next log-in.');
             }
@@ -4337,7 +4297,7 @@ ENDHEADERS
         return;
     }
     $r->print(
-        '<input type="submit" name="setversions" value="'.$lt{'save'}.'" />'.
+       '<input type="submit" name="setversions" value="'.$lt{'save'}.'" />'.
         &Apache::loncommon::start_data_table().
         &Apache::loncommon::start_data_table_header_row().
         '<th>'.&mt('Resources').'</th>'.
@@ -4380,9 +4340,9 @@ ENDHEADERS
                       $setversions{$linkurl},
                       'set_version_'.$linkurl,
                       {'select_form_order' => ['',1..$currentversion,'mostrecent'],
-                       '' => '',
-                       'mostrecent' => &mt('most recent'),
-                       map {$_,$_} (1..$currentversion)}));
+                      '' => '',
+                      'mostrecent' => &mt('most recent'),
+                      map {$_,$_} (1..$currentversion)}));
             my $lastold=1;
             for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
                 my $url=$root.'.'.$prevvers.'.'.$extension;
@@ -4519,6 +4479,7 @@ sub startContentScreen {
     if (($mode eq 'navmaps') || ($mode eq 'supplemental')) {
         $output .= '<li'.(($mode eq 'navmaps')?' class="active"':'').'><a href="/adm/navmaps"><b>&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Overview').'&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>'."\n";
         $output .= '<li'.(($mode eq 'coursesearch')?' class="active"':'').'><a href="/adm/searchcourse"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Search').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>'."\n";
+        $output .= '<li'.(($mode eq 'courseindex')?' class="active"':'').'><a href="/adm/indexcourse"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Index').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>'."\n";
         $output .= '<li '.(($mode eq 'suppdocs')?' class="active"':'').'><a href="/adm/supplemental"><b>'.&mt('Supplemental Content').'</b></a></li>';
     } else {
         $output .= '<li '.(($mode eq 'docs')?' class="active"':'').' id="tabbededitor"><a href="/adm/coursedocs?forcestandard=1"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Main Content Editor').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>'."\n";
@@ -4916,7 +4877,7 @@ sub handler {
                 'navc' => 'Table of Contents',
                 'sipa' => 'Simple Course Page',
                 'sipr' => 'Simple Problem',
-                'webp' => 'Blank Web Page (editable)',
+                'webp' => 'Blank Web Page (editable)', 
                 'drbx' => 'Drop Box',
                 'scuf' => 'External Scores (handgrade, upload, clicker)',
                 'bull' => 'Discussion Board',
@@ -4938,39 +4899,7 @@ sub handler {
                 'webctce4' => 'WebCT 4 Campus Edition',
         );
 # -----------------------------------------------------------------------------
-    # Calculate free quota space for a user or course.
-    my $quotatype = 'unofficial';
-    if ($crstype eq 'Community') {
-        $quotatype = 'community';
-    } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.coursecode'}) {
-        $quotatype = 'official';
-    } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.textbook'}) {
-        $quotatype = 'textbook';
-    }
-    my $disk_quota = &Apache::loncommon::get_user_quota($coursenum,$coursedom,
-                     'course',$quotatype); # expressed in MB
-    my $current_disk_usage = 0;
-    foreach my $subdir ('docs','supplemental') {
-        $current_disk_usage += &Apache::lonnet::diskusage($coursedom,$coursenum,
-                               "userfiles/$subdir",1); # expressed in kB
-    }
-    my $free_space = 1024 * ((1024 * $disk_quota) - $current_disk_usage);
-    my $usage = $current_disk_usage/1024; # in MB
-    my $quota = $disk_quota;
-    my $percent;
-    if ($disk_quota == 0) {
-        $percent = 100.0;
-    } else {
-        $percent = 100*($current_disk_usage/$disk_quota);
-    }
-    $usage = sprintf("%.2f",$usage);
-    $quota = sprintf("%.2f",$quota);
-    $percent = sprintf("%.0f",$percent);
-    my $quotainfo = '<p>'.&mt('Currently using [_1] of the [_2] available.',
-                              $percent.'%',$quota.' MB').'</p>';
-
 	my $fileupload=(<<FIUP);
-        $quotainfo
 	$lt{'file'}:<br />
 	<input type="file" name="uploaddoc" size="40" />
 FIUP
@@ -5496,8 +5425,8 @@ my %suporderhash = (
                    }
                    &Apache::lonnet::get_numsuppfiles($coursenum,$coursedom,1);
                    undef($suppchanges);
-               }
-           }
+               }  
+           } 
         }
     } elsif ($supplementalflag) {
         my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
@@ -5880,25 +5809,23 @@ sub editing_js {
                                           p_msb => 'Title for the Problem',
                                           p_mdb => 'Title for the Drop Box',
                                           p_mbb => 'Title for the Discussion Board',
-                                          p_mwp => 'Title for Web Page',
+                                          p_mwp => 'Title for Web Page', 
                                           p_mab => "Enter user:domain for User's Personal Information Page",
                                           p_mab2 => 'Personal Information Page of ',
                                           p_mab_alrt1 => 'Not a valid user:domain',
                                           p_mab_alrt2 => 'Please enter both user and domain in the format user:domain',
                                           p_chn => 'New Title',
                                           p_rmr1 => 'WARNING: Removing a resource makes associated grades and scores inaccessible!',
-                                          p_rmr2a => 'Remove',
-                                          p_rmr2b => '?',
-                                          p_rmr3a => 'Remove those',
-                                          p_rmr3b => 'items?',
-                                          p_rmr4  => 'WARNING: Removing a resource uploaded to a course cannot be undone via "Undo Delete".',
-                                          p_rmr5  => 'Push "Cancel" and then use "Cut" instead if you might need to undo this change.',
+                                          p_rmr2a => 'Remove[_99]',
+                                          p_rmr2b => '?[_99]',
+                                          p_rmr3a => 'Remove those [_2]',
+                                          p_rmr3b => 'items?[_2]',
                                           p_ctr1a => 'WARNING: Cutting a resource makes associated grades and scores inaccessible!',
                                           p_ctr1b => 'Grades remain inaccessible if resource is pasted into another folder.',
-                                          p_ctr2a => 'Cut',
-                                          p_ctr2b => '?',
-                                          p_ctr3a => 'Cut those',
-                                          p_ctr3b => 'items?',
+                                          p_ctr2a => 'Cut[_98]',
+                                          p_ctr2b => '?[_98]',
+                                          p_ctr3a => 'Cut those[_2]',
+                                          p_ctr3b => 'items?[_2]',
                                           rpck    => 'Enter number to pick (e.g., 3)',
                                           imsfile => 'You must choose an IMS package for import',
                                           imscms  => 'You must select which Course Management System was the source of the IMS package',
@@ -5910,7 +5837,6 @@ sub editing_js {
                                           noch    => 'No changes to settings specified.',
                                           noac    => 'No actions selected.',
                                         );
-
     &js_escape(\%js_lt);
     my $crstype = &Apache::loncommon::course_type();
     my $docs_folderpath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'},'<>&"');
@@ -5931,20 +5857,9 @@ sub editing_js {
             my ($map,$id,$res)=&Apache::lonnet::decode_symb($caller);
             $res = &Apache::lonnet::clutter($res);
             if (&Apache::lonnet::is_on_map($res)) {
-                my ($url,$anchor);
-                if ($res =~ /^([^#]+)#([^#]+)$/) {
-                    $url = $1;
-                    $anchor = $2;
-                    if (($caller =~ m{^([^#]+)\Q#$anchor\E$})) {
-                        $caller = $1.&escape('#').$anchor;
-                    }
-                }
-                $backtourl = &HTML::Entities::encode(&Apache::lonnet::clutter($url),'<>&"').'?symb='.
+                $backtourl = &HTML::Entities::encode(&Apache::lonnet::clutter($res),'<>&"').'?symb='.
                              &HTML::Entities::encode($caller,'<>&"');
-                if ($anchor ne '') {
-                    $backtourl .= '#'.&HTML::Entities::encode($anchor,'<>&"');
-                }
-                $backtourl = &Apache::loncommon::escape_single($backtourl); 
+                $backtourl = &Apache::loncommon::escape_single($backtourl);
             } else {
                 $backtourl = '/adm/navmaps';
             }
@@ -6009,7 +5924,7 @@ function makewebpage(type) {
        formname = this.document.forms.newwebpage;
    }
    if (title) {
-       var webpage = formname.importdetail.value;
+       var webpage = formname.importdetail.value; 
        formname.importdetail.value = escape(title)+'='+webpage;
        formname.submit();
    }
@@ -6280,7 +6195,7 @@ function propagateState(form,param) {
     return;
 }
 
-function checkForSubmit(targetform,param,context,idx,folderpath,index,oldtitle,skip_confirm,container,folder,confirm_removal) {
+function checkForSubmit(targetform,param,context,idx,folderpath,index,oldtitle,skip_confirm,container,folder) {
     var dosettings;
     var doaction;
     var control = document.togglemultsettings;
@@ -6318,21 +6233,7 @@ function checkForSubmit(targetform,param
             targetform.markcopy.value=idx+':'+param;
             targetform.copyfolder.value=folder+'.'+container;
             if (param == 'remove') {
-                var doremove = 0;
-                if (skip_confirm) {
-                    if (confirm_removal) {
-                        if (confirm('$js_lt{"p_rmr4"}\\n$js_lt{"p_rmr5"}\\n\\n$js_lt{"p_rmr2a"} "'+oldtitle+'"$js_lt{"p_rmr2b"}')) {
-                            doremove = 1;
-                        }
-                    } else {
-                        doremove = 1;
-                    }
-                } else {
-                    if (confirm('$js_lt{"p_rmr1"}\\n\\n$js_lt{"p_rmr2a"} "'+oldtitle+'" $js_lt{"p_rmr2b"}')) {
-                        doremove = 1;
-                    }
-                }
-                if (doremove) {
+                if (skip_confirm || confirm('$js_lt{"p_rmr1"}\\n\\n$js_lt{"p_rmr2a"} "'+oldtitle+'" $js_lt{"p_rmr2b"}')) {
                     targetform.markcopy.value='';
                     targetform.copyfolder.value='';
                     targetform.submit();
@@ -6404,11 +6305,11 @@ for (i = 0; i < currentLis.length; i++)
 
 function hideAll(current, nav, data) {
 unselectInactive(nav);
-if (current) {
+if (current) { 
     if (current.className == 'right'){
-	current.className = 'right active'
+        current.className = 'right active'
     } else {
-	current.className = 'active';
+        current.className = 'active';
     }
 }
 currentData = document.getElementById(data);
@@ -6446,11 +6347,11 @@ function showPage(current, pageId, nav,
 	unselectInactive(nav);
         if ((currstate == 'active') || (currstate == 'right active')) {
             if (currstate == 'active') {
-                current.className = '';
+	        current.className = '';
             } else {
                 current.className = 'right';
             }
-            activeTab = '';
+            activeTab = ''; 
             toggleUpload();
             toggleMap();
             resize_scrollbox('contentscroll','1','0');
@@ -6589,7 +6490,6 @@ function checkSubmits() {
     var doactions = multiActions();
     var cutwarnings = 0;
     var remwarnings = 0;
-    var removalinfo = 0;
     if (doactions == 1) {
         var remidxlist = document.cumulativeactions.allremoveidx.value;
         if ((remidxlist != '') && (remidxlist != null)) {
@@ -6604,11 +6504,6 @@ function checkSubmits() {
                                 remwarnings ++;
                             }
                         }
-                        if (document.getElementById('confirm_removal_'+remidxs[i])) {
-                            if (document.getElementById('confirm_removal_'+remidxs[i]).value == 1) {
-                                removalinfo ++;
-                            }
-                        }
                     }
                 }
             }
@@ -6707,17 +6602,12 @@ function checkSubmits() {
     }
     if (doactions == 1) {
         if (numchanges > 0) {
-            if ((cutwarnings > 0) || (remwarnings > 0) || (removalinfo > 0)) {
+            if ((cutwarnings > 0) || (remwarnings > 0)) {
                 if (remwarnings > 0) {
                     if (!confirm('$js_lt{"p_rmr1"}\\n\\n$js_lt{"p_rmr3a"} '+remwarnings+' $js_lt{"p_rmr3b"}')) {
                         return false;
                     }
                 }
-                if (removalinfo > 0) {
-                    if (!confirm('$js_lt{"p_rmr4"}\\n$js_lt{"p_rmr5"}\\n\\n$js_lt{"p_rmr3a"} '+removalinfo+' $js_lt{"p_rmr3b"}')) {
-                        return false;
-                    }
-                }
                 if (cutwarnings > 0) {
                     if (!confirm('$js_lt{"p_ctr1a"}\\n$js_lt{"p_ctr1b"}\\n\\n$js_lt{"p_ctr3a"} '+cutwarnings+' $js_lt{"p_ctr3b"}')) {
                         return false;