[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface londocs.pm

raeburn raeburn at source.lon-capa.org
Wed Dec 12 23:51:41 EST 2012


raeburn		Thu Dec 13 04:51:41 2012 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	londocs.pm 
  Log:
  - For 2.11
    - Backport 1.510, 1.511, 1.512, 1.513, 1.514, 1.515, 1.516, 1.517, 1.518,
      1.519, 1.520, 1.521, 1.522, 1.523, 1.524.
  
  
-------------- next part --------------
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.484.2.18 loncom/interface/londocs.pm:1.484.2.19
--- loncom/interface/londocs.pm:1.484.2.18	Thu Dec 13 04:15:30 2012
+++ loncom/interface/londocs.pm	Thu Dec 13 04:51:41 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.484.2.18 2012/12/13 04:15:30 raeburn Exp $
+# $Id: londocs.pm,v 1.484.2.19 2012/12/13 04:51:41 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -41,6 +41,7 @@
 use Apache::lonnavmaps;
 use Apache::lonnavdisplay();
 use Apache::lonuserstate();
+use Apache::lonextresedit();
 use HTML::Entities;
 use HTML::TokeParser;
 use GDBM_File;
@@ -390,18 +391,15 @@
     my %orderhash;
     my $container='sequence';
     my $pathitem;
-    if ($env{'form.pagepath'}) {
+    if ($env{'form.folderpath'} =~ /\:1$/) {
         $container='page';
-        $pathitem = '<input type="hidden" name="pagepath" value="'.
-                    &HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" />';
-    } else {
-        my $folderpath=$env{'form.folderpath'};
-        if ($folderpath eq '') {
-            $folderpath = 'default&'.&escape(&mt('Main '.$crstype.' Documents'));
-        }
-        $pathitem = '<input type="hidden" name="folderpath" value="'.
-                    &HTML::Entities::encode($folderpath,'<>&"').'" />';
     }
+    my $folderpath=$env{'form.folderpath'};
+    if ($folderpath eq '') {
+        $folderpath = 'default&'.&escape(&mt('Main '.$crstype.' Documents').':::::');
+    }
+    $pathitem = '<input type="hidden" name="folderpath" value="'.
+                &HTML::Entities::encode($folderpath,'<>&"').'" />';
     my $readfile="/uploaded/$coursedom/$coursenum/$folder.$container";
     my $jumpto = $readfile;
     $jumpto =~ s{^/}{};
@@ -409,7 +407,7 @@
     if ($supplementalflag) {
         $tid = 2;
     }
-    my ($breadcrumbtrail) =
+    my ($breadcrumbtrail) = 
         &Apache::lonhtmlcommon::docs_breadcrumbs($allowed,$crstype,1);
     $r->print($breadcrumbtrail.
               &generate_edit_table($tid,\%orderhash,undef,$iconpath,$jumpto,
@@ -484,7 +482,7 @@
                                   ':'.$docslog{$id}{'exe_udom'}.'</tt>'.
                   $send_msg_link.'</td><td>'.
                   $docslog{$id}{'logentry'}{'folder'}.'</td><td>');
-        my $is_supp = 0;
+        my $is_supp = 0; 
         if ($docslog{$id}{'logentry'}{'currentfolder'} =~ /^supplemental/) {
             $is_supp = 1;
         }
@@ -507,7 +505,7 @@
                 if ($is_supp) {
                     $shown = &Apache::loncommon::parse_supplemental_title($shown);
                 }
-                $r->print('<li>'.$shown.'</li>');
+		$r->print('<li>'.$shown.'</li>');
 	    }
 	}
 	$r->print('</ul>');
@@ -658,7 +656,7 @@
         $canpaste = &supp_pasteable($env{'docs.markedcopy_url'});
         unless ($canpaste) {
             $nopaste = &mt('Paste into Supplemental Content unavailable for this type of content.');
-        }
+        } 
     } else {
         $canpaste = 1;
     }
@@ -672,11 +670,11 @@
                 $othercourse = 1;
                 if ($env{"user.priv.cm./$srcdom/$srcnum"} =~ /\Q:mdc&F\E/) {
                     if ($canpaste) {
-                        $othercrs = '<br />'.&mt('(from another course).');
+                        $othercrs = '<br />'.&mt('(from another course).');  
                     }
                 } else {
                     $canpaste = 0;
-                    $nopaste = &mt('Paste from another course unavailable.')
+                    $nopaste = &mt('Paste from another course unavailable.') 
                 }
             }
             if ($rem =~ m{^(default|supplemental)_?(\d*)\.(?:page|sequence)$}) {
@@ -694,18 +692,18 @@
              .'<legend>'.&mt('Clipboard').'</legend>');
     my ($type,$buffer);
     if ($is_external) {
-	$type = &mt('External Resource');
-	$buffer = $type.': '.
-		  &LONCAPA::map::qtescape($env{'docs.markedcopy_title'}).' ('.
+        $type = &mt('External Resource');
+        $buffer = $type.': '.
+                  &LONCAPA::map::qtescape($env{'docs.markedcopy_title'}).' ('.
                   &LONCAPA::map::qtescape($env{'docs.markedcopy_url'}).')';
     }  else {
-	my $icon = &Apache::loncommon::icon($extension);
-	if ($extension eq 'sequence' &&
-	    $env{'docs.markedcopy_url'} =~ m{/default_\d+\.sequence$ }x) {
-	    $icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
-	    $icon .= '/navmap.folder.closed.gif';
-	}
-	$icon = '<img src="'.$icon.'" alt="" class="LC_icon" />';
+        my $icon = &Apache::loncommon::icon($extension);
+        if ($extension eq 'sequence' &&
+            $env{'docs.markedcopy_url'} =~ m{/default_\d+\.sequence$ }x) {
+            $icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
+            $icon .= '/navmap.folder.closed.gif';
+        }
+        $icon = '<img src="'.$icon.'" alt="" class="LC_icon" />';
         $buffer = $icon.$type.': '.  &Apache::loncommon::parse_supplemental_title(&LONCAPA::map::qtescape($env{'docs.markedcopy_title'}));
     }
     if ($canpaste) {
@@ -719,7 +717,7 @@
                           '<label>'.
                           '<input type="radio" name="docs.markedcopy_options" value="new" checked="checked" />'.
                           &mt('Copy to new folder').'</label>'.(' ' x2).
-                          '<label>'.
+                          '<label>'.   
                           '<input type="radio" name="docs.markedcopy_options" value="move" />'.
                           &mt('Move old folder').'</label><br />');
                 if ($env{'docs.markedcopy_nested'}) {
@@ -731,7 +729,7 @@
                     my %depths = (
                                    $lastdir => 0,
                                  );
-                    my (%display,%deps);
+                    my (%display,%deps); 
                     for (my $i=0; $i<@pastemaps; $i++) {
                         ($lastdir,my $subfolderstr) = split(/\:/,$pastemaps[$i]);
                         my ($namedir,$esctitlestr) = split(/\:/,$titles[$i]);
@@ -743,7 +741,7 @@
                         my $indent = (' ' x $offset);
                         for (my $j=0; $j<@subfolders; $j++) {
                             $depths{$subfolders[$j]} = $depth;
-                            $display{$subfolders[$j]} =
+                            $display{$subfolders[$j]} = 
                                   '<tr><td>'.$indent.$subfoldertitles[$j].' </td>'.
                                   '<td><label>'.
                                   '<input type="radio" name="docs.markedcopy_'.$subfolders[$j].'" value="new" checked="checked" />'.&mt('Copy to new').'</label>'.(' ' x2).
@@ -760,16 +758,9 @@
             }
         }
         $r->print('<br /><input type="submit" name="pastemarked" value="'.&mt('Paste').'" />'.$othercrs);
-        if ($container eq 'page') {
-	    $r->print('
-	<input type="hidden" name="pagepath" value="'.&HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" />
-	<input type="hidden" name="pagesymb" value="'.&HTML::Entities::encode($env{'form.pagesymb'},'<>&"').'" />
-');
-        } else {
-	    $r->print('
+        $r->print('
         <input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />
 ');
-        }
         $r->print('</form>');
     } else {
         $r->print(&mt('Paste buffer contains:').' '.$buffer.
@@ -848,22 +839,22 @@
 
     my ($is_map,$srcdom,$srcnum,$prefixchg,%before,%after,%mapchanges,%tomove);
     if ($url=~/\.(page|sequence)$/) {
-        $is_map = 1;
+        $is_map = 1; 
     }
     if ($url =~ m{^/uploaded/($match_domain)/($match_courseid)/([^/]+)}) {
         $srcdom = $1;
         $srcnum = $2;
         my $oldprefix = $3;
 # When paste buffer was populated using an active role in a different course
-# check for mdc privilege in the course from which the resource was pasted
+# check for mdc privilege in the course from which the resource was pasted 
         if (($srcdom ne $coursedom) || ($srcnum ne $coursenum)) {
             unless ($env{"user.priv.cm./$srcdom/$srcnum"} =~ /\Q:mdc&F\E/) {
                 return (&mt('Paste failed: Item is from a different course which you do not have rights to edit.'));
             }
         }
-# When pasting content from Main Content to Supplemental Content and vice versa
+# When pasting content from Main Content to Supplemental Content and vice versa 
 # URLs will contain different paths (which depend on whether pasted item is
-# a folder/page or a document.
+# a folder/page or a document.   
         if (($folder =~ /^supplemental/) && (($oldprefix =~ /^default/) || ($oldprefix eq 'docs'))) {
             $prefixchg = 1;
             %before = ( map => 'default',
@@ -907,7 +898,7 @@
         if ($folder =~ /^default/) {
             my $lastchange = &Apache::lonnet::get_coursechange($coursedom,$coursenum);
             if ($lastchange > $env{'request.course.tied'}) {
-                &reinit_role($coursedom,$coursenum,$env{"course.$env{'request.course.id'}.home"});
+                &reinit_role($coursedom,$coursenum,$env{"course.$env{'request.course.id'}.home"}); 
             }
         }
 # If pasting a map, check if map contains other maps
@@ -925,7 +916,7 @@
         if ($url=~ m{^/uploaded/}) {
             my $newurl;
             unless ($env{'form.docs.markedcopy_options'} eq 'move') {
-                ($newurl,my $error) =
+                ($newurl,my $error) = 
                     &get_newmap_url($url,$folder,$prefixchg,$coursedom,$coursenum,
                                     $srcdom,$srcnum,\$title,\%allmaps,\%newurls);
                 if ($error) {
@@ -952,7 +943,7 @@
             } elsif ($env{'docs.markedcopy_nested'}) {
                 &url_paste_fixups($url,$folder,$prefixchg,$coursedom,$coursenum,\%allmaps,\%rewrites,
                                   \%retitles,\%copies,\%dbcopies,\%zombies,\%params,\%mapmoves,
-                                  \%mapchanges,\%tomove,\%newsubdir,\%newurls);
+                                  \%mapchanges,\%tomove,\%newsubdir,\%newurls); 
             }
         } elsif ($url=~m {^/res/}) {
 # published maps can only exists once, so remove it from paste buffer when done
@@ -966,21 +957,21 @@
         }
     }
     if ($url=~ m{/smppg$}) {
-        my $db_name = &Apache::lonsimplepage::get_db_name($url);
-        if ($db_name =~ /^smppage_/) {
-            #simple pages, need to copy the db contents to a new one.
-            my %contents=&Apache::lonnet::dump($db_name,$coursedom,$coursenum);
-            my $now = time();
-            $db_name =~ s{_\d*$ }{_$now}x;
-            my $dbresult=&Apache::lonnet::put($db_name,\%contents,
-                                            $coursedom,$coursenum);
+	my $db_name = &Apache::lonsimplepage::get_db_name($url);
+	if ($db_name =~ /^smppage_/) {
+	    #simple pages, need to copy the db contents to a new one.
+	    my %contents=&Apache::lonnet::dump($db_name,$coursedom,$coursenum);
+	    my $now = time();
+	    $db_name =~ s{_\d*$ }{_$now}x;
+	    my $dbresult=&Apache::lonnet::put($db_name,\%contents,
+					    $coursedom,$coursenum);
             if ($dbresult eq 'ok') {
                 $url =~ s{/(\d*)/smppg$ }{/$now/smppg}x;
                 $title=&mt('Copy of').' '.$title;
             } else {
                 return (&mt('Paste failed: An error occurred when copying the simple page.'));
             }
-        }
+	}
     }
     $title = &LONCAPA::map::qtunescape($title);
     my $ext='false';
@@ -1023,7 +1014,7 @@
             }
         }
     }
-# Apply any changes to maps, or copy dependencies for uploaded HTML pages
+# Apply any changes to maps, or copy dependencies for uploaded HTML pages 
     my ($result,$save_err);
     $result =
         &apply_fixups($folder,$is_map,$prefixchg,$coursedom,$coursenum,$oldurl,
@@ -1031,7 +1022,7 @@
                       \%copies,\%dbcopies,\%zombies,\%params,\%docmoves,
                       \%mapmoves,\%newsubdir,$errors,\%before,\%after);
     if ($result eq 'ok') {
-        if ($is_map) {
+        if ($is_map) { 
             my ($errtext,$fatal) = &mapread($coursenum,$coursedom,
                                             $folder.'.'.$container);
             return $errtext if ($fatal);
@@ -1055,17 +1046,17 @@
                        $env{'user.domain'}.'___&&&___'.$title;
             }
         }
-        $LONCAPA::map::resources[$newidx]=      $title.':'.$url.':'.$ext.':normal:res';
+        $LONCAPA::map::resources[$newidx]= 	$title.':'.$url.':'.$ext.':normal:res';
         push(@LONCAPA::map::order, $newidx);
 
 # Store the result
-        my ($errtext,$fatal) =
+        my ($errtext,$fatal) = 
             &storemap($coursenum,$coursedom,$folder.'.'.$container,1);
         if ($fatal) {
             $save_err = $errtext;
         }
     }
-
+   
     if ($env{'form.docs.markedcopy_options'} eq 'move') {
         &Apache::lonnet::delenv('docs.markedcopy');
         &Apache::lonnet::delenv('docs.markedcopy_nested');
@@ -1189,7 +1180,7 @@
                         $titles->{$url}{$token->[2]->{'id'}} = $token->[2]->{'title'};
                     } else {
                         if ($allmaps->{$ressrc}) {
-                            $removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc;
+                            $removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc; 
                         } elsif (ref($addedmaps->{$ressrc}) eq 'ARRAY') {
                             $removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc;
                         } else {
@@ -1204,7 +1195,7 @@
                     if (ref($removeparam->{$url}{$token->[2]->{'to'}}) eq 'ARRAY') {
                         push(@{$removeparam->{$url}{$token->[2]->{'to'}}},$token->[2]->{'name'});
                     } else {
-                        $removeparam->{$url}{$token->[2]->{'to'}} = [$token->[2]->{'name'}];
+                        $removeparam->{$url}{$token->[2]->{'to'}} = [$token->[2]->{'name'}]; 
                     }
                 }
             }
@@ -1256,7 +1247,7 @@
             }
             next if ($token->[2]->{'type'} eq 'external');
             if ($token->[2]->{'type'} eq 'zombie') {
-                next if ($skip);
+                next if ($skip);  
                 $zombies->{$oldurl}{$ressrc} = $id;
                 $changed = 1;
             } elsif ($ressrc =~ m{^/uploaded/($match_domain)/($match_courseid)/(.+)$}) {
@@ -1288,7 +1279,7 @@
                 }
                 if (($srcdom ne $cdom) || ($srcnum ne $cnum) || ($prefixchg) ||
                     ($mapchanges->{$oldurl}) || (($newurl ne '') && ($newurl ne $oldurl))) {
-
+                   
                     if ($rem =~ /^(default|supplemental)(_?\d*).(sequence|page)$/) {
                         $rewrites->{$oldurl}{$ressrc} = $id;
                         $mapchanges->{$ressrc} = 1;
@@ -1306,7 +1297,7 @@
                     }
                 }
             } elsif ($ressrc =~ m{^/adm/($match_domain)/($match_courseid)/(.+)$}) {
-                next if ($skip);
+                next if ($skip);  
                 my $srcdom = $1;
                 my $srcnum = $2;
                 if (($srcdom ne $cdom) || ($srcnum ne $cnum)) {
@@ -1326,7 +1317,7 @@
             }
         } elsif ($token->[1] eq 'param') {
             next if ($skip);
-            my $to = $token->[2]->{'to'};
+            my $to = $token->[2]->{'to'}; 
             if ($to ne '') {
                 if (ref($params->{$oldurl}{$to}) eq 'ARRAY') {
                     push(@{$params->{$oldurl}{$to}},$token->[2]->{'name'});
@@ -1364,7 +1355,7 @@
         }
         if (@allcopies > 0) {
             foreach my $item (@allcopies) {
-                my ($relpath,$oldsubdir,$fname) =
+                my ($relpath,$oldsubdir,$fname) = 
                     ($item =~ m{^(/uploaded/$match_domain/$match_courseid/(?:docs|supplemental)/(default|\d+)/.*/)([^/]+)$});
                 if ($fname ne '') {
                     my $content = &Apache::lonnet::getfile($item);
@@ -1383,7 +1374,7 @@
                             }
                         }
                         &copy_dependencies($item,$storefn,$relpath,$errors,\$content);
-                        my $copyurl =
+                        my $copyurl = 
                             &Apache::lonclonecourse::writefile($env{'request.course.id'},
                                                                $storefn.$fname,$content);
                         if ($copyurl eq '/adm/notfound.html') {
@@ -1529,7 +1520,7 @@
             }
             foreach my $idx (keys(%remparam)) {
                 if (ref($remparam{$idx}) eq 'ARRAY') {
-                    foreach my $name (@{$remparam{$idx}}) {
+                    foreach my $name (@{$remparam{$idx}}) {   
                         &LONCAPA::map::delparameter($idx,'parameter_'.$name);
                     }
                 }
@@ -1691,12 +1682,17 @@
 sub editor {
     my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype,
         $supplementalflag,$orderhash,$iconpath,$pathitem)=@_;
-    my $container= ($env{'form.pagepath'}) ? 'page'
-		                           : 'sequence';
-
-    my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) =
-        &Apache::lonhtmlcommon::docs_breadcrumbs($allowed,$crstype,1);
-    $r->print($breadcrumbtrail);
+    my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order,$container);
+    if ($allowed) {
+        (my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,
+         $is_random_order,$container) =
+            &Apache::lonhtmlcommon::docs_breadcrumbs($allowed,$crstype,1);
+        $r->print($breadcrumbtrail);
+    } elsif ($env{'form.folderpath'} =~ /\:1$/) {
+        $container = 'page'; 
+    } else {
+        $container = 'sequence';
+    }
 
     my $jumpto = "uploaded/$coursedom/$coursenum/$folder.$container";
 
@@ -1742,7 +1738,7 @@
                 &do_paste_from_buffer($coursenum,$coursedom,$folder,$container,
                                       \%paste_errors);
                 if ($save_error ne '') {
-                    return $save_error;
+                    return $save_error; 
                 }
             if ($paste_res ne 'ok') {
                 $r->print('<p><span class="LC_error">'.$paste_res.'</span></p>');
@@ -1776,13 +1772,13 @@
 		    my ($name,$url,$residx)=
 			map {&unescape($_)} split(/\=/,$item);
                     if ($url=~ m{^\Q/uploaded/$coursedom/$coursenum/\E(default|supplemental)_new\.(sequence|page)$}) {
-                        my ($suffix,$errortxt,$locknotfreed) =
+                        my ($suffix,$errortxt,$locknotfreed) = 
                             &newmap_suffix($1,$2,$coursedom,$coursenum);
                         if ($locknotfreed) {
                             $r->print($locknotfreed);
                         }
                         if ($suffix) {
-                            $url =~ s/_new\./_$suffix./;
+                            $url =~ s/_new\./_$suffix./; 
                         } else {
                             return $errortxt;
                         }
@@ -1859,35 +1855,67 @@
         unless ($name) { $idx++; next; }
         $output .= &entryline($idx,$name,$url,$folder,$allowed,$res,
                               $coursenum,$coursedom,$crstype,
-                              $pathitem,$supplementalflag);
+                              $pathitem,$supplementalflag,$container);
         $idx++;
         $shown++;
     }
     &Apache::loncommon::end_data_table_count();
-    
-    if ($shown) {
-        $to_show = &Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll')
-                  .&Apache::loncommon::start_data_table(undef,'contentlist');
-        if ($allowed) {
-            $to_show .= &Apache::loncommon::start_data_table_header_row()
-                     .'<th colspan="2">'.&mt('Move').'</th>'
-                     .'<th>'.&mt('Actions').'</th>'
-                     .'<th colspan="2">'.&mt('Document').'</th>';
-            if ($folder !~ /^supplemental/) {
-                $to_show .= '<th colspan="4">'.&mt('Settings').'</th>';
+
+    if (($allowed) || ($supplementalflag && $folder eq 'supplemental')) {
+        my $toolslink = '<table><tr><td>'
+                       .&Apache::loncommon::help_open_menu('Navigation Screen',
+                                                           'Navigation_Screen',undef,'RAT')
+                       .'</td><td class="LC_middle">'.&mt('Tools:').'</td>'
+                       .'<td align="left"><ul id="LC_toolbar">'
+                       .'<li><a href="/adm/coursedocs?forcesupplement=1" '
+                       .'id="LC_content_toolbar_edittoplevel" '
+                       .'class="LC_toolbarItem" '
+                       .'title="'.&mt('Supplemental Content Editor').'">'
+                       .'</a></li></ul></td></tr></table><br />';
+        if ($shown) {
+            if ($allowed) {
+                $to_show = &Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll')
+                          .&Apache::loncommon::start_data_table(undef,'contentlist')
+                          .&Apache::loncommon::start_data_table_header_row()
+                          .'<th colspan="2">'.&mt('Move').'</th>'
+                          .'<th>'.&mt('Actions').'</th>'
+                          .'<th colspan="2">'.&mt('Document').'</th>';
+                if ($folder !~ /^supplemental/) {
+                    $to_show .= '<th colspan="4">'.&mt('Settings').'</th>';
+                }
+                $to_show .= &Apache::loncommon::end_data_table_header_row()
+                           .$output.' '
+                           .&Apache::loncommon::end_data_table()
+                           .'<br style="line-height:2px;" />'
+                           .&Apache::loncommon::end_scrollbox();
+            } else {
+                $to_show .= $toolslink
+                           .&Apache::loncommon::start_data_table('LC_tableOfContent')
+                           .$output.' '
+                           .&Apache::loncommon::end_data_table();
+            }
+        } else {
+            if (!$allowed) {
+                $to_show .= $toolslink;
             }
-            $to_show .= &Apache::loncommon::end_data_table_header_row();
+            $to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll')
+                       .'<div class="LC_info" id="contentlist">'
+                       .&mt('Currently no documents.')
+                       .'</div>'
+                       .&Apache::loncommon::end_scrollbox();
         }
-        $to_show .= $output.' '
-                 .&Apache::loncommon::end_data_table()
-                 .'<br style="line-height:2px;" />'
-                 .&Apache::loncommon::end_scrollbox();
     } else {
-        $to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll')
-                 .'<div class="LC_info" id="contentlist">'
-                 .&mt('Currently no documents.')
-                 .'</div>'
-                 .&Apache::loncommon::end_scrollbox();
+        if ($shown) {
+            $to_show = '<div>'
+                      .&Apache::loncommon::start_data_table('LC_tableOfContent')
+                      .$output
+                      .&Apache::loncommon::end_data_table()
+                      .'</div>';
+        } else {
+            $to_show = '<div class="LC_info" id="contentlist">'
+                      .&mt('Currently no documents.')
+                      .'</div>'
+        }
     }
     my $tid = 1;
     if ($supplementalflag) {
@@ -1899,19 +1927,6 @@
                                        $readfile));
         &print_paste_buffer($r,$container,$folder,$coursedom,$coursenum);
     } else {
-        if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
-            #Function Box for Supplemental Content for users with mdc priv.
-            my $funcname = &mt('Folder Editor');
-            $r->print(
-                &Apache::loncommon::head_subbox(
-                    &Apache::lonhtmlcommon::start_funclist().
-                    &Apache::lonhtmlcommon::add_item_funclist(
-                        '<a href="/adm/coursedocs?command=direct&forcesupplement=1&'.
-                        'supppath='.&HTML::Entities::encode($env{'form.folderpath'}).'">'.
-                        '<img src="/res/adm/pages/docs-22x22.png" alt="'.$funcname.'" class="LC_icon" />'.
-                        '<span class="LC_menubuttons_inline_text">'.$funcname.'</span></a>').
-                          &Apache::lonhtmlcommon::end_funclist()));
-        }
         $r->print($to_show);
     }
     return;
@@ -1932,7 +1947,7 @@
         my $errtext='';
         my $fatal=0;
         my $container='sequence';
-        if ($env{'form.pagepath'}) {
+        if ($env{'form.folderpath'} =~ /:1$/) {
             $container='page';
         }
         ($errtext,$fatal)=
@@ -2022,7 +2037,6 @@
                 my $archiveurl = &HTML::Entities::encode($url,'<>&"');
                 my %archiveitems = (
                     folderpath => $env{'form.folderpath'},
-                    pagepath   => $env{'form.pagepath'},
                     cmd        => $nextphase,
                     newidx     => $newidx,
                     position   => $position,
@@ -2077,16 +2091,14 @@
 
 sub entryline {
     my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom,
-        $crstype,$pathitem,$supplementalflag)=@_;
-    my ($foldertitle,$pagetitle,$renametitle);
+        $crstype,$pathitem,$supplementalflag,$container)=@_;
+    my ($foldertitle,$renametitle);
     if (&is_supplemental_title($title)) {
 	($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title);
-	$pagetitle = $foldertitle;
     } else {
 	$title=&HTML::Entities::encode($title,'"<>&\'');
 	$renametitle=$title;
 	$foldertitle=$title;
-	$pagetitle=$title;
     }
 
     my $orderidx=$LONCAPA::map::order[$index];
@@ -2097,34 +2109,34 @@
     my $line=&Apache::loncommon::start_data_table_row();
     my ($form_start,$form_end,$form_common);
 # Edit commands
-    my ($container, $type, $esc_path, $path, $symb);
+    my ($type, $esc_path, $path, $symb);
+    if ($container eq 'page') {
+        $type = 'page';
+    } else {
+        $type = 'folder';
+    }
     if ($env{'form.folderpath'}) {
-	$type = 'folder';
-        $container = 'sequence';
 	$esc_path=&escape($env{'form.folderpath'});
 	$path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
 	# $htmlfoldername=&HTML::Entities::encode($env{'form.foldername'},'<>&"');
     }
-    if ($env{'form.pagepath'}) {
-        $type = $container = 'page';
-        $esc_path=&escape($env{'form.pagepath'});
-	$path = &HTML::Entities::encode($env{'form.pagepath'},'<>&"');
-    }
     my $isexternal;
-    if (!$supplementalflag && $residx) {
+    if ($residx) {
         my $currurl = $url;
         $currurl =~ s{^http(|s)(:|:)//}{/adm/wrapper/ext/};
         if ($currurl =~ m{^/adm/wrapper/ext/}) {
             $isexternal = 1;
         }
-        my $path = 'uploaded/'.
-                   $env{'course.'.$env{'request.course.id'}.'.domain'}.'/'.
-                   $env{'course.'.$env{'request.course.id'}.'.num'}.'/';
-        $symb = &Apache::lonnet::encode_symb($path.$folder.".$container",
-                                             $residx,
-                                             &Apache::lonnet::declutter($currurl));
+        if (!$supplementalflag) {
+            my $path = 'uploaded/'.
+                       $env{'course.'.$env{'request.course.id'}.'.domain'}.'/'.
+                       $env{'course.'.$env{'request.course.id'}.'.num'}.'/';
+            $symb = &Apache::lonnet::encode_symb($path.$folder.".$container",
+                                                 $residx,
+                                                 &Apache::lonnet::declutter($currurl));
+        }
     }
-    my %lt;
+    my ($renamelink,%lt);
     if ($allowed) {
 	my $incindex=$index+1;
 	my $selectbox='';
@@ -2165,9 +2177,9 @@
         my $nocut=0;
         my $noremove=0;
         if ($url=~ m{^/res/.+\.(page|sequence)$}) {
-            # no copy for published maps
-            $nocopy=1;
-        }
+	    # no copy for published maps
+	    $nocopy=1;
+	}
         if ($url=~/^\/res\/lib\/templates\//) {
            $nocopy=1;
            $nocut=1;
@@ -2221,8 +2233,7 @@
                 $nocopy=1;
             }
         }
-        my ($copylink,$cutlink,$removelink,$renamelink);
-
+        my ($copylink,$cutlink,$removelink);
 	my $skip_confirm = 0;
 	if ( $folder =~ /^supplemental/
 	     || ($url =~ m{( /smppg$
@@ -2231,25 +2242,26 @@
 			    |/navmaps$
 			    |/bulletinboard$
 			    |\.html$)}x)
-             || $isexternal) { 
+             || $isexternal) {
 	    $skip_confirm = 1;
 	}
-        if ($nocopy) {
+
+	if ($nocopy) {
             $copylink=(<<ENDCOPY);
 <span style="visibility: hidden;">$lt{'cp'}</span>
 ENDCOPY
         } else {
-            $copylink=(<<ENDCOPY);
-<a href="javascript:markcopy('$esc_path','$index','$renametitle','$container','$symb','$folder');" class="LC_docs_copy">$lt{'cp'}</a>
+	    $copylink=(<<ENDCOPY);
+<a href="javascript:markcopy('$esc_path','$index','$renametitle','$container','$folder');" class="LC_docs_copy">$lt{'cp'}</a>
 ENDCOPY
         }
-        if ($nocut) {
+	if ($nocut) {
             $cutlink=(<<ENDCUT);
 <span style="visibility: hidden;">$lt{'ct'}</span>
 ENDCUT
         } else {
-            $cutlink=(<<ENDCUT);
-<a href="javascript:cutres('$esc_path','$index','$renametitle','$container','$symb','$folder',$skip_confirm);" class="LC_docs_cut">$lt{'ct'}</a>
+	    $cutlink=(<<ENDCUT);
+<a href="javascript:cutres('$esc_path','$index','$renametitle','$container','$folder',$skip_confirm);" class="LC_docs_cut">$lt{'ct'}</a>
 ENDCUT
         }
         if ($noremove) {
@@ -2258,12 +2270,14 @@
 ENDREM
         } else {
             $removelink=(<<ENDREM);
-<a href='javascript:removeres("$esc_path","$index","$renametitle","$container","$symb",$skip_confirm);' class="LC_docs_remove">$lt{'rm'}</a>
+<a href='javascript:removeres("$esc_path","$index","$renametitle",$skip_confirm);' class="LC_docs_remove">$lt{'rm'}</a>
 ENDREM
         }
-        $renamelink=(<<ENDREN);
-<a href='javascript:changename("$esc_path","$index","$renametitle","$container","$symb");' class="LC_docs_rename">$lt{'rn'}</a>
+        unless ($isexternal) {
+            $renamelink=(<<ENDREN);
+<a href='javascript:changename("$esc_path","$index","$renametitle");' class="LC_docs_rename">$lt{'rn'}</a>
 ENDREN
+        }
 	$form_start = '
    <form action="/adm/coursedocs" method="post">
 ';
@@ -2295,7 +2309,6 @@
 </td>
 <td class="LC_docs_entry_commands"><span class="LC_nobreak">
 $removelink
-$renamelink
 $cutlink
 $copylink
 </span>
@@ -2307,22 +2320,18 @@
     my ($extension)=($url=~/\.(\w+)$/);
     my $uploaded=($url=~/^\/*uploaded\//);
     my $icon=&Apache::loncommon::icon($url);
-    my $isfolder=0;
-    my $ispage=0;
-    my $folderarg;
-    my $pagearg;
-    my $pagefile;
+    my $isfolder;
+    my $ispage;
+    my $containerarg;
     if ($uploaded) {
         if (($extension eq 'sequence') || ($extension eq 'page')) {
             $url=~/\Q$coursenum\E\/([\/\w]+)\.\Q$extension\E$/;
-            my $containerarg = $1;
+            $containerarg = $1;
 	    if ($extension eq 'sequence') {
 	        $icon=$iconpath.'navmap.folder.closed.gif';
-                $folderarg=$containerarg;
                 $isfolder=1;
             } else {
                 $icon=$iconpath.'page.gif';
-                $pagearg=$containerarg;
                 $ispage=1;
             }
             if ($allowed) {
@@ -2335,15 +2344,11 @@
 	}
     }
 
-    my $editlink;
+    my ($editlink,$extresform);
     my $orig_url = $url;
     $orig_url=~s{http(:|:)//https(:|:)//}{https$2//};
-    my $external = ($url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/});
+    $url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/};
     if (!$supplementalflag && $residx && $symb) {
-        if ($container eq 'page') {
-            $url=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($symb))[2]);
-            $url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb);
-        } 
         if ((!$isfolder) && (!$ispage)) {
 	    (undef,undef,$url)=&Apache::lonnet::decode_symb($symb);
 	    $url=&Apache::lonnet::clutter($url);
@@ -2359,123 +2364,102 @@
 	        }
 	    } elsif ($url=~m|^/ext/|) {
 	        $url='/adm/wrapper'.$url;
-	        $external = 1;
- 	    }
+	    }
             if (&Apache::lonnet::symbverify($symb,$url)) {
-                $url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb);
+	        $url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb);
             } else {
                 $url='';
             }
-        }
+	}
     }
     my ($rand_pick_text,$rand_order_text);
-    if ($isfolder || $extension eq 'sequence') {
+    if ($isfolder || $ispage || $extension eq 'sequence' || $extension eq 'page') {
 	my $foldername=&escape($foldertitle);
 	my $folderpath=$env{'form.folderpath'};
 	if ($folderpath) { $folderpath.='&' };
+        if (!$allowed && $supplementalflag) {
+            $folderpath.=$containerarg.'&'.$foldername;
+            $url.='folderpath='.&escape($folderpath);
+        } else {
 # Append randompick number, hidden, and encrypted with ":" to foldername,
 # so it gets transferred between levels
-	$folderpath.=$folderarg.'&'.$foldername.':'.(&LONCAPA::map::getparameter($orderidx,
+	    $folderpath.=$containerarg.'&'.$foldername.
+                                              ':'.(&LONCAPA::map::getparameter($orderidx,
                                               'parameter_randompick'))[0]
                                                .':'.((&LONCAPA::map::getparameter($orderidx,
                                               'parameter_hiddenresource'))[0]=~/^yes$/i)
                                                .':'.((&LONCAPA::map::getparameter($orderidx,
                                               'parameter_encrypturl'))[0]=~/^yes$/i)
                                                .':'.((&LONCAPA::map::getparameter($orderidx,
-                                              'parameter_randomorder'))[0]=~/^yes$/i);
-	$url.='folderpath='.&escape($folderpath);
-        my $rpicknum = (&LONCAPA::map::getparameter($orderidx,
-                                                   'parameter_randompick'))[0];
-        my $rpckchk;
-        if ($rpicknum) {
-            $rpckchk = ' checked="checked"';
-        }
-        my $formname = 'edit_rpick_'.$orderidx;
-	$rand_pick_text = 
+                                              'parameter_randomorder'))[0]=~/^yes$/i)
+                                               .':'.$ispage;
+	    $url.='folderpath='.&escape($folderpath);
+            my $rpicknum = (&LONCAPA::map::getparameter($orderidx,
+                                                        'parameter_randompick'))[0];
+            my $rpckchk;
+            if ($rpicknum) {
+                $rpckchk = ' checked="checked"';
+            }
+            my $formname = 'edit_rpick_'.$orderidx;
+	    $rand_pick_text = 
 '<form action="/adm/coursedocs" method="post" name="'.$formname.'">'."\n".
 $form_common."\n".
 '<span class="LC_nobreak"><label><input type="checkbox" name="randpickon_'.$orderidx.'" id="rpick_'.$orderidx.'" onclick="'."updatePick(this.form,'$orderidx','check');".'"'.$rpckchk.' /> '.&mt('Randomly Pick').'</label><input type="hidden" name="randompick_'.$orderidx.'" id="rpicknum_'.$orderidx.'" value="'.$rpicknum.'" />';
-        if ($rpicknum ne '') {
-            $rand_pick_text .= ': <a href="javascript:updatePick('."document.$formname,'$orderidx','link'".')">'.$rpicknum.'</a>';
-        }
-        $rand_pick_text .= '</span></form>';
-    	my $ro_set=
-	    ((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':'');
-	$rand_order_text = 
+            if ($rpicknum ne '') {
+                $rand_pick_text .= ': <a href="javascript:updatePick('."document.$formname,'$orderidx','link'".')">'.$rpicknum.'</a>';
+            }
+            $rand_pick_text .= '</span></form>';
+    	    my $ro_set=
+	        ((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':'');
+	    $rand_order_text = 
 $form_start.
 $form_common.'
 <span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" onclick="'."this.form.changeparms.value='randomorder';this.form.submit()".'" '.$ro_set.' /> '.&mt('Random Order').' </label></span></form>';
+        }
     } elsif ($supplementalflag && !$allowed) {
-        $url .= ($url =~ /\?/) ? 'amp;':'?';
+        $url .= ($url =~ /\?/) ? '&':'?';
         $url .= 'folderpath='.&HTML::Entities::encode($esc_path,'<>&"');
+        if ($title) {
+            $url .= '&title='.&HTML::Entities::encode($renametitle,'<>&"');
+        }
+        if ($isexternal && $orderidx) {
+            $url .= '&idx='.$orderidx;
+        }
     }
-    if ($ispage) {
-        my $pagename=&escape($pagetitle);
-        my $pagepath;
-        my $folderpath=$env{'form.folderpath'};
-        if ($folderpath) { $pagepath = $folderpath.'&' };
-        $pagepath.=$pagearg.'&'.$pagename;
-	$url.='pagepath='.&escape($pagepath).
-	    '&pagesymb='.&escape($symb);
-    }
+    my ($tdalign,$tdwidth);
     if ($allowed) {
-        my $fileloc =
+        my $fileloc = 
             &Apache::lonnet::declutter(&Apache::lonnet::filelocation('',$orig_url));
-
-        if ($external) {
-            $editlink = <<"EXTLNK";
-             
-            <a class="LC_docs_ext_edit" href="javascript:editext('$residx');">
-            $lt{'ed'}</a>
-            <form action="/adm/coursedocs" method="post" name="editext_$residx">
-            <fieldset id="uploadext$residx" style="display: none;" />
-            <input type="hidden" name="active" value="aa" />
-            <span class="LC_nobreak">
-            <span class="LC_docs_ext_edit">$lt{'ul'} </span>
-            <input type="text" size="40" name="exturl" id="exturl_$residx" value="$orig_url" /> 
-            <a class="LC_docs_ext_edit" href="javascript:extUrlPreview('exturl_$residx');">$lt{'pr'}</a></span>
-            </span><br />
-            <span class="LC_nobreak">
-            <span class="LC_docs_ext_edit">$lt{'ti'} </span>
-            <input type="text" size="40" name="exttitle" value="$title" />
-            $pathitem
-            <input type="hidden" name="importdetail" value="" />
-            <input type="button" value="$lt{'sv'}" onclick="javascript:setExternal(this.form,'$residx')" />
-            </span>
-            </fieldset>
-            </form>
-EXTLNK
-        } else {
-            my ($cfile,$home,$switchserver,$forceedit,$forceview) =
+        if ($isexternal) {
+            ($editlink,$extresform) = 
+                &Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem);
+        } elsif (!$isfolder && !$ispage) {
+            my ($cfile,$home,$switchserver,$forceedit,$forceview) = 
                 &Apache::lonnet::can_edit_resource($fileloc,$coursenum,$coursedom,$orig_url);
-            my $geteditlink;
-            if ($supplementalflag) {
-                if ($orig_url eq "/adm/$env{'user.domain'}/$env{'user.name'}/aboutme") {
-                    $geteditlink = 1;
-                }
-            } elsif (($cfile ne '') && ($symb ne '')) {
-                $geteditlink = 1;
-            }
-            if ($geteditlink) {
-                my $jscall =
+            if (($cfile ne '') && ($symb ne '' || $supplementalflag)) {
+                my $jscall = 
                     &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,
                                                             $switchserver,
                                                             $forceedit,
-                                                            undef,$symb);
+                                                            undef,$symb,
+                                                            &escape($env{'form.folderpath'}),
+                                                            $renametitle,'','',1);
                 if ($jscall) {
-                    $editlink = ' <a class="LC_docs_ext_edit" href="javascript:'.
-                                $jscall.'" >'.&mt('Edit').'</a>';
+                    $editlink = '<a class="LC_docs_ext_edit" href="javascript:'.
+                                $jscall.'" >'.&mt('Edit').'</a> '."\n";
                 }
             }
         }
+        $tdalign = ' align="right" valign="top"';
+        $tdwidth = ' width="80%"';
     }
     my $reinit;
     if ($crstype eq 'Community') {
         $reinit = &mt('(re-initialize community to access)');
     } else {
         $reinit = &mt('(re-initialize course to access)');
-    }  
-    $line.='<td>';
+    }
+    $line.='<td class="LC_docs_entry_commands"'.$tdalign.'><span class="LC_nobreak">'.$editlink.$renamelink;
     if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {
        $line.='<a href="'.$url.'"><img src="'.$icon.'" alt="" class="LC_icon" /></a>';
     } elsif ($url) {
@@ -2484,7 +2468,7 @@
     } else {
        $line.='<img src="'.$icon.'" alt="" class="LC_icon" />';
     }
-    $line.='</td><td>';
+    $line.='</span></td><td'.$tdwidth.'>';
     if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {
        $line.='<a href="'.$url.'">'.$title.'</a>';
     } elsif ($url) {
@@ -2493,7 +2477,7 @@
     } else {
        $line.=$title.' <span class="LC_docs_reinit_warn">'.$reinit.'</span>';
     }
-    $line.=$editlink."</td>";
+    $line.="$extresform</td>";
     $rand_pick_text = ' ' if ($rand_pick_text eq '');
     $rand_order_text = ' ' if ($rand_order_text eq '');
     if (($allowed) && ($folder!~/^supplemental/)) {
@@ -2643,7 +2627,7 @@
              $r->print('<span class="LC_error">'.&mt('connection down').'</span>');
           } elsif ($result eq 'not_found') {
 	      unless ($url=~/\$/) {
-		  $r->print('<span class="LC_error">'.&mt('not found').'</b></span>');
+		  $r->print('<span class="LC_error">'.&mt('not found').'</span>');
 	      } else {
 		  $r->print('<span class="LC_error">'.&mt('unable to verify variable URL').'</span>');
 	      }
@@ -2689,7 +2673,7 @@
             $r->print(&Apache::loncommon::start_data_table_row().
                       '<td>'.$res->compTitle().'</td>'.
                       '<td>'.$res->symb().'</td>'.
-                      &Apache::loncommon::start_data_table_row());
+                      &Apache::loncommon::end_data_table_row());
             $count ++;
         }
         if (!$count) {
@@ -2699,6 +2683,7 @@
         }
         $r->print(&Apache::loncommon::end_data_table());
     }
+    $r->print(&endContentScreen());
 }
 
 
@@ -2729,6 +2714,7 @@
    }
    &untiehash();
    $r->print('<p class="LC_success">'.&mt('Done').'</p>');
+    $r->print(&endContentScreen());
 }
 
 
@@ -2808,7 +2794,7 @@
     if ($env{'form.timerange'} eq 'all') {
 # show all documents
 	$header=&mt('All Documents in '.$crstype);
-	$allsel=1;
+	$allsel=' selected="selected"';
 	foreach my $key (keys(%hash)) {
 	    if ($key=~/^ids\_(\/res\/.+)$/) {
 		my $src=$1;
@@ -2829,19 +2815,19 @@
 		.&mt('seconds');
 	    if ($env{'form.timerange'}==-1) {
 		$seltext='since start of course';
-		$startsel='selected';
+		$startsel=' selected="selected"';
 		$env{'form.timerange'}=time;
 	    }
 	    $starttime=time-$env{'form.timerange'};
 	    if ($env{'form.timerange'}==2592000) {
 		$seltext=&mt('during the last month').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
-		$monthsel='selected';
+		$monthsel=' selected="selected"';
 	    } elsif ($env{'form.timerange'}==604800) {
 		$seltext=&mt('during the last week').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
-		$weeksel='selected';
+		$weeksel=' selected="selected"';
 	    } elsif ($env{'form.timerange'}==86400) {
 		$seltext=&mt('since yesterday').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
-		$daysel='selected';
+		$daysel=' selected="selected"';
 	    }
 	    $header=&mt('Content changed').' '.$seltext;
 	} else {
@@ -2879,11 +2865,11 @@
 <fieldset>
 <legend>$lt{'cd'}</legend>
 <select name="timerange">
-<option value='all' $allsel>$lt{'al'}</option>
-<option value="-1" $startsel>$lt{'st'}</option>
-<option value="2592000" $monthsel>$lt{'lm'}</option>
-<option value="604800" $weeksel>$lt{'lw'}</option>
-<option value="86400" $daysel>$lt{'sy'}</option>
+<option value='all'$allsel>$lt{'al'}</option>
+<option value="-1"$startsel>$lt{'st'}</option>
+<option value="2592000"$monthsel>$lt{'lm'}</option>
+<option value="604800"$weeksel>$lt{'lw'}</option>
+<option value="86400"$daysel>$lt{'sy'}</option>
 </select>
 <input type="submit" name="display" value="$lt{'sd'}" />
 </fieldset>
@@ -2899,111 +2885,93 @@
 <hr />
 <h4>$lt{'vers'}</h4>
 <input type="submit" name="setversions" value="$lt{'save'}" />
-<table border="0">
 ENDHEADERS
     #number of columns for version history
-    my $num_ver_col = 1;
     $r->print(
-    &Apache::loncommon::start_data_table().
-    &Apache::loncommon::start_data_table_header_row().
-    '<th>'.&mt('Resources').'</th>'.
-    "<th>$lt{'mr'}</th>".
-    "<th>$lt{'ve'}</th>".
-    "<th>$lt{'vu'}</th>".
-    '<th colspan="'.$num_ver_col.'">'.&mt('History').'</th>'.
-    '</b>');
+        &Apache::loncommon::start_data_table().
+        &Apache::loncommon::start_data_table_header_row().
+        '<th>'.&mt('Resources').'</th>'.
+        "<th>$lt{'mr'}</th>".
+        "<th>$lt{'ve'}</th>".
+        "<th>$lt{'vu'}</th>".
+        '<th>'.&mt('History').'</th>'.
+        &Apache::loncommon::end_data_table_header_row()
+    );
     foreach my $key (sort(keys(%changes))) {
         #excludes not versionable problems from resource version history:
         next unless ($changes{$key}>$starttime && $key !~ /^\/res\/lib\/templates/);
-	    my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
-	    my $currentversion=&Apache::lonnet::getversion($key);
-	    if ($currentversion<0) {
-                $currentversion='<span class="LC_error">'.&mt('Could not be determined.').'</span>';
-	    }
-	    my $linkurl=&Apache::lonnet::clutter($key);
+        my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
+        my $currentversion=&Apache::lonnet::getversion($key);
+        if ($currentversion<0) {
+            $currentversion='<span class="LC_error">'.&mt('Could not be determined.').'</span>';
+        }
+        my $linkurl=&Apache::lonnet::clutter($key);
         $r->print(
-            &Apache::loncommon::end_data_table_header_row().
             &Apache::loncommon::start_data_table_row().
-            '<td><b>'.&Apache::lonnet::gettitle($linkurl).'</b><br>'.
+            '<td><b>'.&Apache::lonnet::gettitle($linkurl).'</b><br />'.
             '<a href="'.$linkurl.'" target="cat">'.$linkurl.'</a></td>'.
-            '<td align="right">'.$currentversion.'<span class="LC_fontsize_medium"><br>('.
+            '<td align="right">'.$currentversion.'<span class="LC_fontsize_medium"><br />('.
             &Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate')).')</span></td>'.
-            '<td align="right">');
-# Used in course
-	    my $usedversion=$hash{'version_'.$linkurl};
-	    if (($usedversion) && ($usedversion ne 'mostrecent')) {
-                if($usedversion != $currentversion){
+            '<td align="right">'
+        );
+        # Used in course
+        my $usedversion=$hash{'version_'.$linkurl};
+        if (($usedversion) && ($usedversion ne 'mostrecent')) {
+                if ($usedversion != $currentversion) {
                     $r->print('<span class="LC_warning">'.$usedversion.'</span>');
-                }else{
+                } else {
                     $r->print($usedversion);
                 }
-	    } else {
-		$r->print($currentversion);
-	    }
-	    $r->print('</td><td title="'.$lt{'vu'}.'">');
-# Set version
-	    $r->print(&Apache::loncommon::select_form($setversions{$linkurl},
-						      'set_version_'.$linkurl,
-						      {'select_form_order' =>
-						       ['',1..$currentversion,'mostrecent'],
-						       '' => '',
-						       'mostrecent' => &mt('most recent'),
-						       map {$_,$_} (1..$currentversion)}));
-	    my $lastold=1;
-	    for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
-		my $url=$root.'.'.$prevvers.'.'.$extension;
-		if (&Apache::lonnet::metadata($url,'lastrevisiondate')<
-		    $starttime) {
-		    $lastold=$prevvers;
-		}
-	    }
-            #
-            # Code to figure out how many version entries should go in
-            # each of the four columns
-            my $entries_per_col = 0;
-            my $num_entries = ($currentversion-$lastold);
-            if ($num_entries % $num_ver_col == 0) {
-                $entries_per_col = $num_entries/$num_ver_col;
             } else {
-                $entries_per_col = $num_entries/$num_ver_col + 1;
+                $r->print($currentversion);
             }
-            my $entries_count = 0;
-            $r->print('<td valign="top"><span class="LC_fontsize_medium">');
-            my $cols_output = 1;
-            for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
-		my $url=$root.'.'.$prevvers.'.'.$extension;
-		$r->print('<span class="LC_nobreak"><a href="'.&Apache::lonnet::clutter($url).
-			  '">'.&mt('Version').' '.$prevvers.'</a> ('.
-			  &Apache::lonlocal::locallocaltime(
-                                &Apache::lonnet::metadata($url,
-                                                          'lastrevisiondate')
-                                                            ).
-			  ')');
-		if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') {
-                    $r->print(' <a href="/adm/diff?filename='.
-			      &Apache::lonnet::clutter($root.'.'.$extension).
-			      '&versionone='.$prevvers.
-			      '" target="diffs">'.&mt('Diffs').'</a>');
-		}
-		$r->print('</span><br />');
-                if (++$entries_count % $entries_per_col == 0) {
-                    $r->print('</span></td>');
-                    if ($cols_output != $num_ver_col) {
-                        $r->print('<td valign="top"><span class="LC_fontsize_medium">');
-                        $cols_output++;
-                    }
-                }
-	    }
-            while($cols_output++ < $num_ver_col) {
-                $r->print('</span></td><td>');
+        $r->print('</td><td title="'.$lt{'vu'}.'">');
+        # Set version
+        $r->print(&Apache::loncommon::select_form(
+            $setversions{$linkurl},
+            'set_version_'.$linkurl,
+            {'select_form_order' => ['',1..$currentversion,'mostrecent'],
+             '' => '',
+             'mostrecent' => &mt('most recent'),
+             map {$_,$_} (1..$currentversion)}));
+        my $lastold=1;
+        for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
+            my $url=$root.'.'.$prevvers.'.'.$extension;
+            if (&Apache::lonnet::metadata($url,'lastrevisiondate')<$starttime) {
+                $lastold=$prevvers;
+            }
+        }
+        $r->print('</td>');
+        # List all available versions
+        $r->print('<td valign="top"><span class="LC_fontsize_medium">');
+        for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
+            my $url=$root.'.'.$prevvers.'.'.$extension;
+            $r->print(
+                '<span class="LC_nobreak">'
+               .'<a href="'.&Apache::lonnet::clutter($url).'">'
+               .&mt('Version [_1]',$prevvers).'</a>'
+               .' ('.&Apache::lonlocal::locallocaltime(
+                         &Apache::lonnet::metadata($url,'lastrevisiondate'))
+               .')');
+            if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') {
+                $r->print(
+                    ' <a href="/adm/diff?filename='.
+                    &Apache::lonnet::clutter($root.'.'.$extension).
+                    &HTML::Entities::encode('&versionone='.$prevvers,'"<>&').
+                    '" target="diffs">'.&mt('Diffs').'</a>');
             }
-	}
+            $r->print('</span><br />');
+        }
+        $r->print('</span></td>'.&Apache::loncommon::end_data_table_row());
     }
-    $r->print('</td>'.&Apache::loncommon::end_data_table_row().
-            &Apache::loncommon::end_data_table().
-            '<input type="submit" name="setversions" value="'.$lt{'save'}.'" />');
+    $r->print(
+        &Apache::loncommon::end_data_table().
+        '<input type="submit" name="setversions" value="'.$lt{'save'}.'" />'.
+        '</form>'
+    );
 
     &untiehash();
+    $r->print(&endContentScreen());
 }
 
 sub mark_hash_old {
@@ -3035,11 +3003,6 @@
     my $pathvar='folderpath';
     my $path=&escape($env{'form.folderpath'});
     if (!defined($url)) {
-	if (defined($env{'form.pagepath'})) {
-	    $pathvar='pagepath';
-	    $path=&escape($env{'form.pagepath'});
-	    $path.='&pagesymb='.&escape($env{'form.pagesymb'});
-	}
 	$url='/adm/coursedocs?'.$pathvar.'='.$path;
     }
     my $course_type = &Apache::loncommon::course_type();
@@ -3151,7 +3114,7 @@
 	               'Adding_External_Resource','Navigate_Content',
 	               'Adding_Folders','Docs_Overview', 'Load_Map',
 	               'Supplemental','Score_Upload_Form','Adding_Pages',
-                       'Importing_LON-CAPA_Resource','Importing_IMS_Course',
+	               'Importing_LON-CAPA_Resource','Importing_IMS_Course',
                        'Uploading_From_Harddrive',
 	               'Check_Resource_Versions','Verify_Content') {
 	$help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic);
@@ -3212,9 +3175,9 @@
 # Get the parameters that may be needed
 #
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-                                            ['folderpath','pagepath',
-                                             'pagesymb','forcesupplement','forcestandard',
-                                             'tools','symb','command']);
+                                            ['folderpath',
+                                             'forcesupplement','forcestandard',
+                                             'tools','symb','command','supppath']);
 
 # standard=1: this is a "new-style" course with an uploaded map as top level
 # standard=2: this is a "old-style" course, and there is nothing we can do
@@ -3228,7 +3191,7 @@
 
 
     my $supplementalflag=($env{'form.folderpath'}=~/^supplemental/);
-    if (($env{'form.folderpath'}=~/^default/) || $env{'form.folderpath'} eq "" || ($env{'form.pagepath'})) {
+    if (($env{'form.folderpath'}=~/^default/) || ($env{'form.folderpath'} eq "")) {
        $supplementalflag=0;
     }
     if ($env{'form.forcesupplement'}) { $supplementalflag=1; }
@@ -3250,73 +3213,18 @@
    if ($env{'form.command'} eq 'direct') {
        my ($mapurl,$id,$resurl);
        if ($env{'form.symb'} ne '') {
-           ($mapurl,$id,$resurl) = &Apache::lonnet::decode_symb($env{'form.symb'});
-           if ($resurl=~/\.(sequence|page)$/) {
-               $mapurl=$resurl;
-           } elsif ($resurl eq 'adm/navmaps') {
-               $mapurl=$env{'course.'.$env{'request.course.id'}.'.url'};
-           }
-           my $mapresobj;
-           my $navmap = Apache::lonnavmaps::navmap->new();
-           if (ref($navmap)) {
-               $mapresobj = $navmap->getResourceByUrl($mapurl);
-           }
-           $mapurl=~s{^.*/([^/]+)\.(\w+)$}{$1};
-           my $type=$2;
-           my $path;
-           if (ref($mapresobj)) {
-               my $pcslist = $mapresobj->map_hierarchy();
-               if ($pcslist ne '') {
-                   foreach my $pc (split(/,/,$pcslist)) {
-                       next if ($pc <= 1);
-                       my $res = $navmap->getByMapPc($pc);
-                       if (ref($res)) {
-                           my $thisurl = $res->src();
-                           $thisurl=~s{^.*/([^/]+)\.\w+$}{$1}; 
-                           my $thistitle = $res->title();
-                           $path .= '&'.
-                                    &Apache::lonhtmlcommon::entity_encode($thisurl).'&'.
-                                    &Apache::lonhtmlcommon::entity_encode($thistitle).
-                                    ':'.$res->randompick().
-                                    ':'.$res->randomout().
-                                    ':'.$res->encrypted().
-                                    ':'.$res->randomorder();
-                       }
-                   }
-               }
-               $path .= '&'.&Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
-                    &Apache::lonhtmlcommon::entity_encode($mapresobj->title()).
-                    ':'.$mapresobj->randompick().
-                    ':'.$mapresobj->randomout().
-                    ':'.$mapresobj->encrypted().
-                    ':'.$mapresobj->randomorder();
-           } else {
-               my $maptitle = &Apache::lonnet::gettitle($mapurl);
-               $path = '&default&...::::'.
-                   '&'.&Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
-                   &Apache::lonhtmlcommon::entity_encode($maptitle).'::::';
-           }
-           $path = 'default&'.
-                   &Apache::lonhtmlcommon::entity_encode('Main Course Documents').
-                   $path;
-           if ($type eq 'sequence') {
-               $env{'form.folderpath'}=$path;
-               $env{'form.pagepath'}='';
-           } else {
-               $env{'form.pagepath'}=$path;
-               $env{'form.folderpath'}='';
-           }
+           $env{'form.folderpath'}=
+               &Apache::loncommon::symb_to_docspath($env{'form.symb'});
        } elsif ($env{'form.supppath'} ne '') {
            $env{'form.folderpath'}=$env{'form.supppath'};
        }
    } elsif ($env{'form.command'} eq 'editdocs') {
         $env{'form.folderpath'} = 'default&'.
-                                  &Apache::lonhtmlcommon::entity_encode('Main Course Content');
-        $env{'form.pagepath'}='';
+                                  &Apache::lonhtmlcommon::entity_encode('Main Course Content').
+                                  ':::::';
    } elsif ($env{'form.command'} eq 'editsupp') {
         $env{'form.folderpath'} = 'default&'.
                                   &Apache::lonhtmlcommon::entity_encode('Supplemental Content');
-        $env{'form.pagepath'}='';
    }
 
 # Where do we store these for when we come back?
@@ -3325,24 +3233,21 @@
        $stored_folderpath='docs_sup_folderpath';
     }
 
-# No folderpath, no pagepath, see if we have something stored
-    if ((!$env{'form.folderpath'}) && (!$env{'form.pagepath'})) {
+# No folderpath, and in edit mode, see if we have something stored
+    if ((!$env{'form.folderpath'}) && $allowed) {
         &Apache::loncommon::restore_course_settings($stored_folderpath,
-                                              {'folderpath' => 'scalar'});
+                                          {'folderpath' => 'scalar'});
+        unless (&unescape($env{'form.folderpath'}) =~ m{^(default|supplemental)&}) {
+            undef($env{'form.folderpath'});
+        }
     }
    
 # If we are not allowed to make changes, all we can see are supplemental docs
     if (!$allowed) {
-        $env{'form.pagepath'}='';
         unless ($env{'form.folderpath'} =~ /^supplemental/) {
             $env{'form.folderpath'} = &supplemental_base();
         }
     }
-# If we still not have a folderpath, see if we can resurrect at pagepath
-    if (!$env{'form.folderpath'} && $allowed) {
-        &Apache::loncommon::restore_course_settings($stored_folderpath,
-                                              {'pagepath' => 'scalar'});
-    }
 # Make the zeroth entry in supplemental docs page paths, so we can get to top level
     if ($env{'form.folderpath'} =~ /^supplemental_\d+/) {
         $env{'form.folderpath'} = &supplemental_base()
@@ -3350,48 +3255,42 @@
                                   $env{'form.folderpath'};
     }
 # If after all of this, we still don't have any paths, make them
-    unless (($env{'form.pagepath'}) || ($env{'form.folderpath'})) {
+    unless ($env{'form.folderpath'}) {
        if ($supplementalflag) {
           $env{'form.folderpath'}=&supplemental_base();
        } else {
-          $env{'form.folderpath'}='default';
+          $env{'form.folderpath'}='default'.&escape(&mt('Main '.$crstype.' Documents')).
+                                  ':::::';
        }
     }
 
 # Store this
     unless ($toolsflag) {
-        &Apache::loncommon::store_course_settings($stored_folderpath,
-                                                  {'pagepath' => 'scalar',
-                                                   'folderpath' => 'scalar'});
+        if ($allowed) {
+            &Apache::loncommon::store_course_settings($stored_folderpath,
+                                                      {'folderpath' => 'scalar'});
+        }
+        my $folderpath;
         if ($env{'form.folderpath'}) {
-	    my (@folderpath)=split('&',$env{'form.folderpath'});
-	    $env{'form.foldername'}=&unescape(pop(@folderpath));
-	    $env{'form.folder'}=pop(@folderpath);
-            $container='sequence';
-        }
-        if ($env{'form.pagepath'}) {
-            my (@pagepath)=split('&',$env{'form.pagepath'});
-            $env{'form.pagename'}=&unescape(pop(@pagepath));
-            $env{'form.folder'}=pop(@pagepath);
-            $container='page';
-            $containertag = '<input type="hidden" name="pagepath" value="" />'.
-	                    '<input type="hidden" name="pagesymb" value="" />';
-            $pathitem = 
-                '<input type="hidden" name="pagepath" value="'.&HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" />'.
-	        '<input type="hidden" name="pagesymb" value="'.&HTML::Entities::encode($env{'form.pagesymb'},'<>&"').'" />'.
-                '<input type="hidden" name="folderpath" value="" />';
+            $folderpath = $env{'form.folderpath'};
+	    my (@folders)=split('&',$env{'form.folderpath'});
+	    $env{'form.foldername'}=&unescape(pop(@folders));
+            if ($env{'form.foldername'} =~ /\:1$/) {
+                $container = 'page';
+            } else {
+                $container = 'sequence';
+            }
+	    $env{'form.folder'}=pop(@folders);
         } else {
-            my $folderpath=$env{'form.folderpath'};
-            if (!$folderpath) {
-                if ($env{'form.folder'} eq '' ||
-                    $env{'form.folder'} eq 'supplemental') {
-                    $folderpath='default&'.
-                        &escape(&mt('Main '.$crstype.' Documents'));
-                }
+            if ($env{'form.folder'} eq '' ||
+                $env{'form.folder'} eq 'supplemental') {
+                $folderpath='default&'.
+                            &escape(&mt('Main '.$crstype.' Documents')).
+                            ':::::';
             }
-            $containertag = '<input type="hidden" name="folderpath" value="" />';
-            $pathitem = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />';
         }
+        $containertag = '<input type="hidden" name="folderpath" value="" />';
+        $pathitem = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />';
         if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
            $showdoc='/'.$1;
         }
@@ -3429,7 +3328,7 @@
                 @tabids = ('002','ee2','ff2');
             } else {
                 @tabids = ('aa1','bb1','cc1','ff1');
-                unless ($env{'form.pagepath'}) {
+                unless ($env{'form.folderpath'} =~ /\:1$/) {
                     unshift(@tabids,'001');
                     push(@tabids,('dd1','ee1'));
                 }
@@ -3438,16 +3337,19 @@
 	    $script .= &editing_js($udom,$uname,$supplementalflag).
                        &history_tab_js().
                        &inject_data_js().
-                       &Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr);
+                       &Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr).
+                       &Apache::lonextresedit::extedit_javascript();
             $addentries = {
                             onload   => "javascript:resize_scrollbox('contentscroll','1','1');",
                           };
         }
         if ($env{'docs.markedcopy_url'}) {
-            $script .= &paste_popup_js();
+            $script .= &paste_popup_js(); 
         }
         my $confirm_switch = &mt("Editing requires switching to the resource's home server.").'\n'.
                              &mt('Switch server?');
+        
+
     }
 # -------------------------------------------------------------------- Body tag
     $script = '<script type="text/javascript">'."\n"
@@ -3458,22 +3360,26 @@
 
     # Breadcrumbs
     &Apache::lonhtmlcommon::clear_breadcrumbs();
-    unless ($showdoc) {
+
+    if ($showdoc) {
+        $r->print(&Apache::loncommon::start_page("$crstype documents",undef,
+                                                {'force_register' => $showdoc,}));
+    } elsif ($r->uri eq '/adm/supplemental') {
+        my $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype);
+        $r->print(&Apache::loncommon::start_page("Supplemental $crstype Content",undef,
+                                                {'bread_crumbs' => $brcrum,}));
+    } else {
         &Apache::lonhtmlcommon::add_breadcrumb({
             href=>"/adm/coursedocs",text=>"$crstype Contents"});
 
         $r->print(&Apache::loncommon::start_page("$crstype Contents", $script,
-                                                 {'force_register' => $showdoc,
-                                                  'add_entries'    => $addentries,
-                                                 })
+                                                 {'add_entries'    => $addentries}
+                                                )
                  .&Apache::loncommon::help_open_menu('','',273,'RAT')
                  .&Apache::lonhtmlcommon::breadcrumbs(
                      'Editing '.$crstype.' Contents',
                      'Docs_Adding_Course_Doc')
         );
-    } else {
-        $r->print(&Apache::loncommon::start_page("$crstype documents",undef,
-                                                {'force_register' => $showdoc,}));
     }
 
   my %allfiles = ();
@@ -3544,7 +3450,7 @@
                 'upld' => 'Import Content',
                 'srch' => 'Search',
                 'impo' => 'Import',
-                'lnks' => 'Import from Stored Links',
+		'lnks' => 'Import from Stored Links',
                 'impm' => 'Import from Assembled Map',
                 'selm' => 'Select Map',
                 'load' => 'Load Map',
@@ -3566,18 +3472,14 @@
                 'imsf' => 'IMS Import',
                 'imsl' => 'Import IMS package',
                 'cms'  => 'Origin of IMS package',
-                'file' =>  'File',
                 'se'   => 'Select',
+                'file' =>  'File',
                 'title' => 'Title',
                 'comment' => 'Comment',
                 'url'  => 'URL',
                 'prev' => 'Preview',
-                'lnk'  => 'Add Link',
+                'lnk'  => 'Add Link', 
                 'parse' => 'Upload embedded images/multimedia files if HTML file',
-		'nd' => 'Upload Document',
-		'pm' => 'Published Map',
-		'sd' => 'Special Document',
-		'mo' => 'More Options',
 					  );
 # -----------------------------------------------------------------------------
 	my $fileupload=(<<FIUP);
@@ -3595,18 +3497,18 @@
 CHBO
         my $imsfolder = $env{'form.folder'};
         if ($imsfolder eq '') {
-            $imsfolder = 'default';
+            $imsfolder = 'default';  
         }
         my $imspform=(<<IMSFORM);
         <a class="LC_menubuttons_link" href="javascript:toggleUpload('ims');">
         $lt{'imsf'}</a> $help{'Importing_IMS_Course'}
         <form name="uploadims" action="/adm/imsimportdocs" method="post" enctype="multipart/form-data" target="IMSimport">
-        <fieldset id="uploadimsform" style="display: none;" />
+        <fieldset id="uploadimsform" style="display: none;">
         <legend>$lt{'imsf'}</legend>
         $fileupload
         <br />
         <p>
-        $lt{'cms'}: 
+        $lt{'cms'}:  
         <select name="source">
         <option value="-1" selected="selected">$lt{'se'}</option>
         <option value="bb5">Blackboard 5</option>
@@ -3622,11 +3524,11 @@
         </form>
 IMSFORM
 
-        my $fileuploadform=(<<FUFORM);
+	my $fileuploadform=(<<FUFORM);
         <a class="LC_menubuttons_link" href="javascript:toggleUpload('doc');">
         $lt{'upfi'}</a> $help{'Uploading_From_Harddrive'}
         <form name="uploaddocument" action="/adm/coursedocs" method="post" enctype="multipart/form-data">
-        <fieldset id="uploaddocform" style="display: none;" />
+        <fieldset id="uploaddocform" style="display: none;">
         <legend>$lt{'upfi'}</legend>
 	<input type="hidden" name="active" value="aa" />
 	$fileupload
@@ -3645,52 +3547,33 @@
         </form>
 FUFORM
 
-        my $importpubform=(<<SEDFFORM);
-        <a class="LC_menubuttons_link" href="javascript:toggleMap();">
+	my $importpubform=(<<SEDFFORM);
+        <a class="LC_menubuttons_link" href="javascript:toggleMap('map');">
         $lt{'impm'}</a>$help{'Load_Map'}
-        <form action="/adm/coursedocs" method="post" name="mapimportform">
-        <fieldset id="importmapform" style="display: none;" />
+	<form action="/adm/coursedocs" method="post" name="mapimportform">
+        <fieldset id="importmapform" style="display: none;">
         <legend>$lt{'impm'}</legend>
-        <input type="hidden" name="active" value="bb" />
+	<input type="hidden" name="active" value="bb" />
         $lt{'copm'}<br />
         <span class="LC_nobreak">
-        <input type="text" name="importmap" size="40" value=""
+        <input type="text" name="importmap" size="40" value="" 
         onfocus="this.blur();openbrowser('mapimportform','importmap','sequence,page','');" />
-         <a href="javascript:openbrowser('mapimportform','importmap','sequence,page','');">$lt{'selm'}</a><br />
+         <a href="javascript:openbrowser('mapimportform','importmap','sequence,page','');">$lt{'selm'}</a></span><br />
         <input type="submit" name="loadmap" value="$lt{'load'}" />
         </fieldset>
         </form>
 
 SEDFFORM
-
-	my @simpleeditdefaultforma = ( 
-	{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/src.png" alt="'.$lt{srch}.'"  onclick="javascript:groupsearch()" />' => "$pathitem<a class='LC_menubuttons_link' href='javascript:groupsearch()'>$lt{'srch'}</a>" },
+	my @importpubforma = (
+	{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/src.png" alt="'.$lt{srch}.'"  onclick="javascript:groupsearch()" />' => $pathitem."<a class='LC_menubuttons_link' href='javascript:groupsearch()'>$lt{'srch'}</a>" },
 	{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/res.png" alt="'.$lt{impo}.'"  onclick="javascript:groupimport();"/>' => "<a class='LC_menubuttons_link' href='javascript:groupimport();'>$lt{'impo'}</a>$help{'Importing_LON-CAPA_Resource'}" },
-        { '<img class="LC_noBorder LC_middle" src="/res/adm/pages/wishlist.png" alt="'.$lt{lnks}.'" onclick="javascript:open_StoredLinks_Import();" />' => "<a class='LC_menubuttons_link' href='javascript:open_StoredLinks_Import();'>$lt{'lnks'}</a>" },
-        { '<img class="LC_noBorder LC_middle" src="/res/adm/pages/sequence.png" alt="'.$lt{impm}.'" onclick="javascript:toggleMap();" />' => $importpubform }
-        );
-        $importpubform = &create_form_ul(&create_list_elements(@importpubforma));
-
-      my $extresourcesform=(<<ERFORM);
-      <a class="LC_menubuttons_link" href="javascript:toggleUpload('ext');">$lt{'extr'}</a>$help{'Adding_External_Resource'}
-      <form action="/adm/coursedocs" method="post" name="newext">
-      <fieldset id="uploadextform" style="display: none;" />
-      <legend>$lt{'extr'}</legend>
-      <input type="hidden" name="active" value="aa" />
-      $lt{'url'}:<br />
-      <input type="text" size="60" name="exturl" id="exturl" value="http://" />
-      <input type="button" name="view" value="$lt{'prev'}" onclick="javascript:extUrlPreview('exturl');" /><br />
-      $lt{'title'}:<br />
-      <input type="text" size="60" name="exttitle" value="$lt{'extr'}" />
-      $pathitem
-      <br />
-      <input type="hidden" name="importdetail" value="" />
-      <input type="button" value="$lt{'lnk'}" onclick="javascript:setExternal(this.form,0)" />
-      </fieldset>
-      </form>
-ERFORM
-
-
+	{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/wishlist.png" alt="'.$lt{lnks}.'" onclick="javascript:open_StoredLinks_Import();" />' => "<a class='LC_menubuttons_link' href='javascript:open_StoredLinks_Import();'>$lt{'lnks'}</a>" },
+        { '<img class="LC_noBorder LC_middle" src="/res/adm/pages/sequence.png" alt="'.$lt{impm}.'" onclick="javascript:toggleMap(\'map\');" />' => $importpubform }
+	);
+	$importpubform = &create_form_ul(&create_list_elements(@importpubforma));
+        my $extresourcesform =
+            &Apache::lonextresedit::extedit_form(0,0,undef,undef,$pathitem,
+                                                 $help{'Adding_External_Resource'});
     if ($allowed) {
         my $folder = $env{'form.folder'};
         if ($folder eq '') {
@@ -3714,11 +3597,16 @@
     }
 
 # Generate the tabs
-    my $mode;
+    my ($mode,$needs_end);
     if (($supplementalflag) && (!$allowed)) {
-        &Apache::lonnavdisplay::startContentScreen($r,'supplemental');
+        my @folders = split('&',$env{'form.folderpath'});
+        unless (@folders > 2) {
+            &Apache::lonnavdisplay::startContentScreen($r,'supplemental');
+            $needs_end = 1;
+        }
     } else {
         $r->print(&startContentScreen(($supplementalflag?'suppdocs':'docs')));
+        $needs_end = 1;
     }
 
 #
@@ -3746,13 +3634,7 @@
            #$postexec='self.close();';
        }
        my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.sequence';
-                     '.sequence';
        my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.page';
-                     '.page';
-	my $container='sequence';
-	if ($env{'form.pagepath'}) {
-	    $container='page';
-	}
 	my $readfile='/uploaded/'.$coursedom.'/'.$coursenum.'/'.$folder.'.'.$container;
 
 	my $newnavform=(<<NNFORM);
@@ -3871,7 +3753,7 @@
 
 	$newfolderform=(<<NFFORM);
 	<form action="/adm/coursedocs" method="post" name="newfolder">
-	<input type="hidden" name="folderpath" value="$path" />
+	$pathitem
 	<input type="hidden" name="importdetail" value="" />
 	<input type="hidden" name="active" value="aa" />
 	<a href="javascript:makenewfolder(document.newfolder,'$folderseq');">$lt{'newf'}</a>$help{'Adding_Folders'}
@@ -3909,12 +3791,17 @@
         $specialdocumentsform = &create_form_ul(&create_list_elements(@specialdocumentsforma));
 
 
-
         my @importdoc = (
-        {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="toggleUpload(\'ext\');" />'=>$extresourcesform},
-        {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/ims.png" alt="'.$lt{imsf}.'" onclick="javascript:toggleUpload(\'ims\');" />'=>$imspform},
-        {'<img class="LC_noBorder_LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'doc\');" />'=>$fileuploadform,
-        });
+        {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="toggleUpload(\'ext\');" />'=>$extresourcesform}
+        );
+        unless ($container eq 'page') {
+            push(@importdoc,
+                {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/ims.png" alt="'.$lt{imsf}.'" onclick="javascript:toggleUpload(\'ims\');" />'=>$imspform}
+            );
+        }
+        push(@importdoc,
+            {'<img class="LC_noBorder_LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'doc\');" />'=>$fileuploadform}
+        );
         $fileuploadform =  &create_form_ul(&create_list_elements(@importdoc));
 
         @gradingforma=(
@@ -3939,10 +3826,10 @@
                 'bb' => ['Published Content',$importpubform],
                 'cc' => ['Grading Resources',$gradingform],
                 );
-unless ($env{'form.pagepath'}) {
+unless ($container eq 'page') {
     $orderhash{'00'} = ['Newfolder',$newfolderform];
     $orderhash{'dd'} = ['Collaboration',$communityform];
-    $orderhash{'ee'} = ['Special Documents',$specialdocumentsform];
+    $orderhash{'ee'} = ['Special Pages',$specialdocumentsform];
 }
 
  $hadchanges=0;
@@ -3972,7 +3859,6 @@
        } elsif ($allowed) {
 	  $env{'form.folderpath'} = $savefolderpath;
        }
-       $env{'form.pagepath'} = '';
        $pathitem = '<input type="hidden" name="folderpath" value="'.
                     &HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';
        if ($allowed) {
@@ -3983,7 +3869,7 @@
         <a class="LC_menubuttons_link" href="javascript:toggleUpload('suppdoc');">
         $lt{'upfi'}</a> $help{'Uploading_From_Harddrive'}
 	<form action="/adm/coursedocs" method="post" name="supuploaddocument" enctype="multipart/form-data">
-        <fieldset id="uploadsuppdocform" style="display: none;" />
+        <fieldset id="uploadsuppdocform" style="display: none;">
         <legend>$lt{'upfi'}</legend>
 	<input type="hidden" name="active" value="ee" />	
 	$fileupload
@@ -3996,10 +3882,11 @@
 	$lt{'comment'}:<br />
 	<textarea cols="50" rows="4" name="comment"></textarea>
 	<br />
-        $pathitem
+	$pathitem
 	<input type="hidden" name="cmd" value="upload_supplemental" />
         <input type='submit' value="$lt{'upld'}" />
         </form>
+SUPDOCFORM
 
 	my $supnewfolderform=(<<SNFFORM);
 	<form action="/adm/coursedocs" method="post" name="supnewfolder">
@@ -4011,29 +3898,14 @@
 	</form>
 SNFFORM
 	
-        my $supextform=(<<ERFORM);
-        <a class="LC_menubuttons_link" href="javascript:toggleUpload('suppext');">$lt{'extr'}</a>$help{'Adding_External_Resource'}
-        <form action="/adm/coursedocs" method="post" name="newsuppext">
-        <fieldset id="uploadsuppextform" style="display: none;" />
-        <legend>$lt{'extr'}</legend>
-        <input type="hidden" name="active" value="ee" />
-        $lt{'url'}:<br />
-        <input type="text" size="60" name="exturl" id="exturl" value="http://" />
-        <input type="button" name="view" value="$lt{'prev'}" onclick="javascript:extUrlPreview('exturl');" /><br />
-        $lt{'title'}:<br />
-        <input type="text" size="60" name="exttitle" value="$lt{'extr'}" />
-        $pathitem
-        <br />
-        <input type="hidden" name="importdetail" value="" />
-        <input type="button" value="$lt{'lnk'}" onclick="javascript:setExternal(this.form,0)" />
-        </fieldset>
-        </form>
-ERFORM
+        my $supextform =
+            &Apache::lonextresedit::extedit_form(1,0,undef,undef,$pathitem,
+                                                 $help{'Adding_External_Resource'});
 
 	my $supnewsylform=(<<SNSFORM);
 	<form action="/adm/coursedocs" method="post" name="supnewsyl">
 	<input type="hidden" name="active" value="ff" />
-	<input type="hidden" name="folderpath" value="$path" />
+        $pathitem
 	<input type="hidden" name="importdetail" 
 	value="Syllabus=/public/$coursedom/$coursenum/syllabus" />
 	<a class="LC_menubuttons_link" href="javascript:document.supnewsyl.submit()">$lt{'syll'}</a>
@@ -4044,7 +3916,7 @@
 	my $supnewaboutmeform=(<<SNAMFORM);
 	<form action="/adm/coursedocs" method="post" name="supnewaboutme">
 	<input type="hidden" name="active" value="ff" />
-	<input type="hidden" name="folderpath" value="$path" />
+        $pathitem
 	<input type="hidden" name="importdetail" 
 	value="$plainname=/adm/$udom/$uname/aboutme" />
 	<a class="LC_menubuttons_link" href="javascript:document.supnewaboutme.submit()">$lt{'mypi'}</a>
@@ -4060,16 +3932,17 @@
             =>$supnewaboutmeform},
 		);
 my @supimportdoc = (
-		{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:makenewext(\'supext\');" />'
+		{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:toggleUpload(\'suppext\')" />'
             =>$supextform},
                 {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'suppdoc\');" />'
             =>$supupdocform},
-        );
+                   );
+
 $supupdocform =  &create_form_ul(&create_list_elements(@supimportdoc));
 my %suporderhash = (
 		'00' => ['Supnewfolder', $supnewfolderform],
                 'ee' => ['Import Content',$supupdocform],
-                'ff' => ['Special Documents',&create_form_ul(&create_list_elements(@specialdocs))]
+                'ff' => ['Special Pages',&create_form_ul(&create_list_elements(@specialdocs))]
                 );
         if ($supplementalflag) {
            my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
@@ -4086,7 +3959,9 @@
         }
     }
 
-    $r->print(&endContentScreen());
+    if ($needs_end) {
+        $r->print(&endContentScreen());
+    }
 
     if ($allowed) {
 	$r->print('
@@ -4152,12 +4027,9 @@
     my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'};
     my $container='sequence';
     my ($pathitem,$hiddenelem);
-    my @hiddens = ('newidx','comment','position');
-    if ($env{'form.pagepath'}) {
+    my @hiddens = ('newidx','comment','position','folderpath');
+    if ($env{'form.folderpath'} =~ /\:1$/) {
         $container='page';
-        $pathitem = 'pagepath';
-    } else {
-        $pathitem = 'folderpath';
     }
     unshift(@hiddens,$pathitem);
     foreach my $item (@hiddens) {
@@ -4351,16 +4223,16 @@
         $activetab = $env{'form.active'};
     }
     my $backicon = $iconpath.'clickhere.gif';
-    my $backtext = &mt('To Overview');
+    my $backtext = &mt('Exit');
     $form = '<div class="LC_Box" style="margin:0;">'.
-             '<ul id="navigation'.$tid.'" class="LC_TabContent">'."\n".
-             '<li class="goback">'.
-             '<a href="javascript:toContents('."'$jumpto'".');">'.
-             '<img src="'.$backicon.'" class="LC_icon" style="border: none; vertical-align: top;"'.
-             '  alt="'.$backtext.'" />'.$backtext.'</a></li>'."\n".
-             '<li>'.
-             '<a href="javascript:groupopen('."'$readfile'".',1);">'.
-             &mt('Undo Delete').'</a></li>'."\n";
+            '<ul id="navigation'.$tid.'" class="LC_TabContent">'."\n".
+            '<li class="goback">'.
+            '<a href="javascript:toContents('."'$jumpto'".');">'.
+            '<img src="'.$backicon.'" class="LC_icon" style="border: none; vertical-align: top;"'.
+            '  alt="'.$backtext.'" />'.$backtext.'</a></li>'."\n".
+            '<li>'.
+            '<a href="javascript:groupopen('."'$readfile'".',1);">'.
+            &mt('Undo Delete').'</a></li>'."\n";
     if ($env{'form.docslog'}) {
         $form .= '<li class="active">';
     } else {
@@ -4444,14 +4316,11 @@
 
     my $crstype = &Apache::loncommon::course_type();
     my $docs_folderpath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'},'<>&"');
-    my $docs_pagepath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.pagepath'},'<>&"');
     my $main_container_page;
-    if ($docs_folderpath eq '') {
-        if ($docs_pagepath ne '') {
-            $main_container_page = 1;
-        }
+    if (&HTML::Entities::decode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'}) =~ /\:1$/) {
+        $main_container_page = 1;
     }
-    my $toplevelmain = 'default&Main%20'.$crstype.'%20Documents';
+    my $toplevelmain = 'default&Main%20'.$crstype.'%20Documents%3A%3A%3A%3A%3A';
     my $toplevelsupp = &supplemental_base();
 
     my $backtourl = '/adm/navmaps';
@@ -4459,15 +4328,14 @@
         $backtourl = '/adm/supplemental';
     }
 
-    my $fieldsets = "'ext','doc','ims'";
+    my $fieldsets = "'ext','doc'";
+    unless ($main_container_page) {
+        $fieldsets .=",'ims'";
+    }
     if ($supplementalflag) {
         $fieldsets = "'suppext','suppdoc'";
     }
 
-    my $urlregexp = <<'ENDREGEXP';
-/^([a-z]([a-z]|\d|\+|-|\.)*):(\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?((\[(|(v[\da-f]{1,}\.(([a-z]|\d|-|\.|_|~)|[!\$&'\(\)\*\+,;=]|:)+))\])|((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=])*)(:\d*)?)(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*|(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|!
 @)*)*)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)){0})(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i
-ENDREGEXP
-
     return <<ENDNEWSCRIPT;
 function makenewfolder(targetform,folderseq) {
     var foldername=prompt('$lt{"p_mnf"}','$lt{"t_mnf"}');
@@ -4485,20 +4353,6 @@
     }
 }
 
-function editext(residx) {
-    if (document.getElementById('uploadext'+residx)) {
-        var curr = document.getElementById('uploadext'+residx).style.display;
-        if (curr == 'none') {
-            disp = 'block';
-        } else {
-            disp = 'none';
-        }
-        document.getElementById('uploadext'+residx).style.display=disp;
-    }
-    resize_scrollbox('contentscroll','1','1');
-    return;
-}
-
 function makeexamupload() {
    var title=prompt('$lt{"p_mxu"}');
    if (title) {
@@ -4579,28 +4433,19 @@
     return;
 }
 
-function toggleMap() {
+function toggleMap(caller) {
     var disp = 'none';
-    var curr = document.getElementById('importmapform').style.display;
-    if (curr == 'none') {
-        disp='block';
-    }
-    document.getElementById('importmapform').style.display=disp;
-    resize_scrollbox('contentscroll','1','1');
-    return;
-}
-
-
-function extUrlPreview(caller) {
-    if (document.getElementById(caller)) {
-        var url = document.getElementById(caller).value;
-        var regexp = $urlregexp;
-        if (regexp.test(url)) {
-            openMyModal(url,500,400,'yes');
-        } else {
-            alert("$lt{'invurl'}");
+    if (document.getElementById('importmapform')) {
+        if (caller == 'map') {
+            var curr = document.getElementById('importmapform').style.display;
+            if (curr == 'none') {
+                disp='block';
+            }
         }
+        document.getElementById('importmapform').style.display=disp;
+        resize_scrollbox('contentscroll','1','1');
     }
+    return;
 }
 
 function makeims(imsform) {
@@ -4616,89 +4461,40 @@
     imsform.submit();
 }
 
-function setExternal(extform,residx) {
-    var title=extform.exttitle.value;
-    if (!String.trim) {
-        String.prototype.trim = function() {return this.replace(\/^\\s+|\\s+$\/g, "");};    }
-    var url=extform.exturl.value;
-    var regexp = $urlregexp;
-    if (title == null || title.trim()=="") {
-        alert("$lt{'titbl'}");
-        extform.exttitle.focus();
-        return;
-    }
-    if (regexp.test(url)) {
-        url = escape(url);
-        if (residx > 0) {
-            eval("extform.importdetail.value=title+'='+url+'='+residx;extform.submit();");
-        } else {
-            eval("extform.importdetail.value=title+'='+url;extform.submit();");
-        }
-    } else {
-        alert("$lt{'invurl'}");
-        extform.exturl.focus();
-        return;
-    }
-}
-
-function changename(folderpath,index,oldtitle,container,pagesymb) {
+function changename(folderpath,index,oldtitle) {
 var title=prompt('$lt{"p_chn"}',oldtitle);
 if (title) {
 this.document.forms.renameform.markcopy.value=-1;
 this.document.forms.renameform.title.value=title;
 this.document.forms.renameform.cmd.value='rename_'+index;
-if (container == 'sequence') {
-    this.document.forms.renameform.folderpath.value=folderpath;
-}
-if (container == 'page') {
-    this.document.forms.renameform.pagepath.value=folderpath;
-    this.document.forms.renameform.pagesymb.value=pagesymb;
-}
+this.document.forms.renameform.folderpath.value=folderpath;
 this.document.forms.renameform.submit();
 }
 }
 
-function removeres(folderpath,index,oldtitle,container,pagesymb,skip_confirm) {
+function removeres(folderpath,index,oldtitle,skip_confirm) {
 if (skip_confirm || confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr2a"} "'+oldtitle+'" $lt{"p_rmr2b"}')) {
 this.document.forms.renameform.markcopy.value=-1;
 this.document.forms.renameform.cmd.value='del_'+index;
-if (container == 'sequence') {
-    this.document.forms.renameform.folderpath.value=folderpath;
-}
-if (container == 'page') {
-    this.document.forms.renameform.pagepath.value=folderpath;
-    this.document.forms.renameform.pagesymb.value=pagesymb;
-}
+this.document.forms.renameform.folderpath.value=folderpath;
 this.document.forms.renameform.submit();
 }
 }
 
-function cutres(folderpath,index,oldtitle,container,pagesymb,folder,skip_confirm) {
+function cutres(folderpath,index,oldtitle,container,folder,skip_confirm) {
 if (skip_confirm || confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr2a"} "'+oldtitle+'" $lt{"p_ctr2b"}')) {
 this.document.forms.renameform.cmd.value='cut_'+index;
 this.document.forms.renameform.markcopy.value=index;
 this.document.forms.renameform.copyfolder.value=folder+'.'+container;
-if (container == 'sequence') {
-    this.document.forms.renameform.folderpath.value=folderpath;
-}
-if (container == 'page') {
-    this.document.forms.renameform.pagepath.value=folderpath;
-    this.document.forms.renameform.pagesymb.value=pagesymb;
-}
+this.document.forms.renameform.folderpath.value=folderpath;
 this.document.forms.renameform.submit();
 }
 }
 
-function markcopy(folderpath,index,oldtitle,container,pagesymb,folder) {
+function markcopy(folderpath,index,oldtitle,container,folder) {
 this.document.forms.renameform.markcopy.value=index;
 this.document.forms.renameform.copyfolder.value=folder+'.'+container;
-if (container == 'sequence') {
 this.document.forms.renameform.folderpath.value=folderpath;
-}
-if (container == 'page') {
-this.document.forms.renameform.pagepath.value=folderpath;
-this.document.forms.renameform.pagesymb.value=pagesymb;
-}
 this.document.forms.renameform.submit();
 }
 
@@ -4796,9 +4592,6 @@
         toggleMap();
         if (nav == 'mainnav') {
             var storedpath = "$docs_folderpath";
-            if (storedpath == '') {
-                storedpath = "$docs_pagepath";
-            }
             var storedpage = "$main_container_page";
             var reg = new RegExp("^supplemental");
             if (pageId == 'mainCourseDocuments') {


More information about the LON-CAPA-cvs mailing list