[LON-CAPA-cvs] cvs: modules /gerd/gcistuff londocs.pm

www www@source.lon-capa.org
Wed, 15 Jul 2009 09:14:11 -0000


This is a MIME encoded message

--www1247649251
Content-Type: text/plain

www		Wed Jul 15 09:14:11 2009 EDT

  Modified files:              
    /modules/gerd/gcistuff	londocs.pm 
  Log:
  Saving my work on GCI test assembly
  
  
--www1247649251
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20090715091411.txt"

Index: modules/gerd/gcistuff/londocs.pm
diff -u modules/gerd/gcistuff/londocs.pm:1.2 modules/gerd/gcistuff/londocs.pm:1.3
--- modules/gerd/gcistuff/londocs.pm:1.2	Wed Jul 15 06:24:37 2009
+++ modules/gerd/gcistuff/londocs.pm	Wed Jul 15 09:14:10 2009
@@ -2,7 +2,7 @@
 # Documents
 # Modified for GCI Concept Inventory Assemby
 #
-# $Id: londocs.pm,v 1.2 2009/07/15 06:24:37 www Exp $
+# $Id: londocs.pm,v 1.3 2009/07/15 09:14:10 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -33,26 +33,6 @@
 
 use strict;
 
-my $path='/res/gci/gci';
-my $version='GCIv2-1-1';
-my @categories=('M1','M2','M3','M4',
-                'A','B','C','D','E','F','G','H','I','J','K');
-my %problems=('01' => 'M1','02' => 'M2','03' => 'A' ,'04' => 'A' ,'05' => ''  ,'06' => 'A' ,'07' => 'B' ,'08' => 'B' ,'09' => 'B' ,'10' => 'C' ,
-              '11' => ''  ,'12' => 'C' ,'13' => 'C' ,'14' => 'C' ,'15' => 'C' ,'16' => 'C' ,'17' => 'C' ,'18' => 'D' ,'19' => 'D' ,'20' => 'D' ,
-              '21' => 'D' ,'22' => 'D' ,'23' => 'D' ,'24' => 'D' ,'25' => 'D' ,'26' => 'E' ,'27' => 'E' ,'28' => 'E' ,'29' => ''  ,'30' => 'E' ,
-              '31' => ''  ,'32' => 'F' ,'33' => 'F' ,'34' => 'F' ,'35' => 'F' ,'36' => 'F' ,'37' => 'M3','38' => 'G' ,
-              '39A'=> 'G' ,'39B'=> 'G' ,
-              '40' => 'G' ,
-              '41' => 'G' ,'42' => 'G' ,'43' => 'G' ,'44' => 'G' ,'45' => 'G' ,'46' => 'G' ,'47' => 'H' ,'48' => 'H' ,'49' => 'H' ,'50' => 'H' ,
-              '51' => 'H' ,'52' => 'H' ,'53' => 'H' ,'54' => 'I' ,'55' => 'I' ,'56' => 'I' ,'57' => 'I' ,'58' => 'I' ,
-              '60' => 'I' ,
-              '61' => 'I' ,'62' => 'I' ,'63' => 'J' ,'64' => 'J' ,'65' => 'J' ,'66' => 'K' ,'67' => 'K' ,'68' => 'K' ,'69' => 'K' ,'70' => 'K' ,
-              '71' => 'K' ,
-              '2004_73' => 'M4');
-my %prereqs=('10' => '08', '57' => '52', '69' => '18');
-
-
-
 use Apache::Constants qw(:common :http);
 use Apache::imsexport;
 use Apache::lonnet;
@@ -81,6 +61,63 @@
 my %help=();
 
 
+my $path;
+my $version;
+my $reqnum;
+my @categories;
+my %problems;
+my %prereqs;
+my @defchosen;
+my @chosen;
+
+sub setdefaults {
+   $path='/res/gci/gci';
+   $version='GCIv2-1-1';
+   $reqnum=15;
+   @categories=('M1','M2','M3','M4',
+                'A','B','C','D','E','F','G','H','I','J','K');
+   %problems=('01' => 'M1','02' => 'M2','03' => 'A' ,'04' => 'A' ,'05' => ''  ,'06' => 'A' ,'07' => 'B' ,'08' => 'B' ,'09' => 'B' ,'10' => 'C' ,
+              '11' => ''  ,'12' => 'C' ,'13' => 'C' ,'14' => 'C' ,'15' => 'C' ,'16' => 'C' ,'17' => 'C' ,'18' => 'D' ,'19' => 'D' ,'20' => 'D' ,
+              '21' => 'D' ,'22' => 'D' ,'23' => 'D' ,'24' => 'D' ,'25' => 'D' ,'26' => 'E' ,'27' => 'E' ,'28' => 'E' ,'29' => ''  ,'30' => 'E' ,
+              '31' => ''  ,'32' => 'F' ,'33' => 'F' ,'34' => 'F' ,'35' => 'F' ,'36' => 'F' ,'37' => 'M3','38' => 'G' ,
+              '39A'=> 'G' ,'39B'=> 'G' ,
+              '40' => 'G' ,
+              '41' => 'G' ,'42' => 'G' ,'43' => 'G' ,'44' => 'G' ,'45' => 'G' ,'46' => 'G' ,'47' => 'H' ,'48' => 'H' ,'49' => 'H' ,'50' => 'H' ,
+              '51' => 'H' ,'52' => 'H' ,'53' => 'H' ,'54' => 'I' ,'55' => 'I' ,'56' => 'I' ,'57' => 'I' ,'58' => 'I' ,
+              '60' => 'I' ,
+              '61' => 'I' ,'62' => 'I' ,'63' => 'J' ,'64' => 'J' ,'65' => 'J' ,'66' => 'K' ,'67' => 'K' ,'68' => 'K' ,'69' => 'K' ,'70' => 'K' ,
+              '71' => 'K' ,
+              '2004_73' => 'M4');
+   %prereqs=('10' => '08', '57' => '52', '69' => '18');
+   @defchosen=('01','02','03','07','10','18','26','32','37','38','47','54','63','66','2004_73');
+}
+
+sub checkvalid {
+   my %covered=();
+   my %chosenproblems=();
+   my @errors=();
+   my $num=$#chosen+1;
+   unless ($num==$reqnum) {
+      push(@errors,&mt('Test requires [_1] items, but has [_2]',$reqnum,$num)); 
+   }
+   foreach my $item (@chosen) {
+      $chosenproblems{$item}=1;
+      $covered{$problems{$item}}=1;
+   }
+   foreach my $cat (@categories) {
+      unless ($covered{$cat}) {
+         push(@errors,&mt('Category [_1] not covered.',$cat));
+      }
+   }
+   foreach my $item (@chosen) {
+       if ($prereqs{$item}) {
+          unless ($chosenproblems{$item}) {
+             push(@errors,&mt('Problem [_1] requires problem [_2].',$item,$prereqs{$item}));
+          }
+       }
+   }
+}
+
 sub mapread {
     my ($coursenum,$coursedom,$map)=@_;
     return
@@ -1644,140 +1681,6 @@
     return;
 }
 
-sub process_file_upload {
-    my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase,$uploadcmd) = @_;
-# upload a file, if present
-    my $parseaction;
-   if ($env{'form.parserflag'}) {
-        $parseaction = 'parse';
-    }
-    my $phase_status;
-    my $folder=$env{'form.folder'};
-    if ($folder eq '') {
-        $folder='default';
-    }
-    if ( ($folder=~/^$uploadcmd/) || ($uploadcmd eq 'default') ) {
-        my $errtext='';
-        my $fatal=0;
-        my $container='sequence';
-        if ($env{'form.pagepath'}) {
-            $container='page';
-        }
-        ($errtext,$fatal)=
-              &mapread($coursenum,$coursedom,$folder.'.'.$container);
-        if ($#LONCAPA::map::order<1) {
-            $LONCAPA::map::order[0]=1;
-            $LONCAPA::map::resources[1]='';
-        }
-        if ($fatal) {
-            return 'failed';
-        }
-        my $destination = 'docs/';
-        if ($folder =~ /^supplemental/) {
-            $destination = 'supplemental/';
-        }
-        if (($folder eq 'default') || ($folder eq 'supplemental')) {
-            $destination .= 'default/';
-        } elsif ($folder =~ /^(default|supplemental)_(\d+)$/) {
-            $destination .=  $2.'/';
-        }
-# this is for a course, not a user, so set coursedoc flag
-# probably the only place in the system where this should be "1"
-        my $newidx=&LONCAPA::map::getresidx();
-        $destination .= $newidx;
-        my $url=&Apache::lonnet::userfileupload('uploaddoc',1,$destination,
-						$parseaction,$allfiles,
-						$codebase);
-        my $ext='false';
-        if ($url=~m{^http://}) { $ext='true'; }
-	$url     = &LONCAPA::map::qtunescape($url);
-        my $comment=$env{'form.comment'};
-	$comment = &LONCAPA::map::qtunescape($comment);
-        if ($folder=~/^supplemental/) {
-              $comment=time.'___&&&___'.$env{'user.name'}.'___&&&___'.
-                  $env{'user.domain'}.'___&&&___'.$comment;
-        }
-
-        $LONCAPA::map::resources[$newidx]=
-	    $comment.':'.$url.':'.$ext.':normal:res';
-        $LONCAPA::map::order[$#LONCAPA::map::order+1]= $newidx;
-        ($errtext,$fatal)=&storemap($coursenum,$coursedom,
-				    $folder.'.'.$container);
-        if ($fatal) {
-            $$upload_output .= '<p><span class="LC_error">'.$errtext.'</span></p>';
-            return 'failed';
-        } else {
-            if ($parseaction eq 'parse') {
-                my $total_embedded = keys(%{$allfiles});
-                if ($total_embedded > 0) {
-                    my $num = 0;
-		    my $state = '
-   <input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />
-   <input type="hidden" name="cmd" value="upload_embedded" />
-   <input type="hidden" name="newidx" value="'.$newidx.'" />
-   <input type="hidden" name="primaryurl" value="'.&escape($url).'" />
-   <input type="hidden" name="phasetwo" value="'.$total_embedded.'" />';
-		    $phase_status = 'phasetwo';
-
-                    $$upload_output .=
-			'This file contains embedded multimedia objects, which need to be uploaded to LON-CAPA.<br />'.
-			&Apache::loncommon::ask_for_embedded_content(
-                            '/adm/coursedocs',$state,$allfiles,$codebase);
-                } else {
-                    $$upload_output .= 'No embedded items identified<br />';
-                }
-            }
-        }
-    }
-    return $phase_status;
-}
-
-sub process_secondary_uploads {
-    my ($upload_output,$coursedom,$coursenum,$formname,$num,$newidx) = @_;
-    my $folder=$env{'form.folder'};
-    my $destination = 'docs/';
-    if ($folder =~ /^supplemental/) {
-        $destination = 'supplemental/';
-    }
-    if (($folder eq 'default') || ($folder eq 'supplemental')) {
-        $destination .= 'default/';
-    } elsif ($folder =~ /^(default|supplemental)_(\d+)$/) {
-        $destination .=  $2.'/';
-    }
-    $destination .= $newidx;
-    my ($url,$filename);
-    $url=&Apache::lonnet::userfileupload($formname.$num,1,$destination);
-    ($filename) = ($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/\Q$destination\E/(.+)$});
-    return $filename;
-}
-
-sub is_supplemental_title {
-    my ($title) = @_;
-    return scalar($title =~ m/^(\d+)___&&&___($match_username)___&&&___($match_domain)___&&&___(.*)$/);
-}
-
-sub parse_supplemental_title {
-    my ($title) = @_;
-
-    my ($foldertitle,$renametitle);
-    if ($title =~ /&amp;&amp;&amp;/) {
-	$title = &HTML::Entites::decode($title);
-    }
- if ($title =~ m/^(\d+)___&&&___($match_username)___&&&___($match_domain)___&&&___(.*)$/) {
-	$renametitle=$4;
-	my ($time,$uname,$udom) = ($1,$2,$3);
-	$foldertitle=&Apache::lontexconvert::msgtexconverted($4);
-	my $name =  &Apache::loncommon::plainname($uname,$udom);
-	$name = &HTML::Entities::encode($name,'"<>&\'');
-	$title='<i>'.&Apache::lonlocal::locallocaltime($time).'</i> '.
-	    $name.': <br />'.$foldertitle;
-    }
-    if (wantarray) {
-	return ($title,$foldertitle,$renametitle);
-    }
-    return $title;
-}
-
 # --------------------------------------------------------------- An entry line
 
 sub entryline {
@@ -2081,450 +1984,6 @@
     return $line;
 }
 
-=pod
-
-=item tiehash()
-
-tie the hash
-
-=cut
-
-sub tiehash {
-    my ($mode)=@_;
-    $hashtied=0;
-    if ($env{'request.course.fn'}) {
-	if ($mode eq 'write') {
-	    if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.".db",
-		    &GDBM_WRCREAT(),0640)) {
-                $hashtied=2;
-	    }
-	} else {
-	    if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.".db",
-		    &GDBM_READER(),0640)) {
-                $hashtied=1;
-	    }
-	}
-    }
-}
-
-sub untiehash {
-    if ($hashtied) { untie %hash; }
-    $hashtied=0;
-    return OK;
-}
-
-
-
-
-sub checkonthis {
-    my ($r,$url,$level,$title)=@_;
-    $url=&unescape($url);
-    $alreadyseen{$url}=1;
-    $r->rflush();
-    if (($url) && ($url!~/^\/uploaded\//) && ($url!~/\*$/)) {
-       $r->print("\n<br />");
-       if ($level==0) {
-           $r->print("<br />");
-       }
-       for (my $i=0;$i<=$level*5;$i++) {
-           $r->print('&nbsp;');
-       }
-       $r->print('<a href="'.$url.'" target="cat">'.
-		 ($title?$title:$url).'</a> ');
-       if ($url=~/^\/res\//) {
-	  my $result=&Apache::lonnet::repcopy(
-                              &Apache::lonnet::filelocation('',$url));
-          if ($result eq 'ok') {
-             $r->print('<span class="LC_success">'.&mt('ok').'</span>');
-             $r->rflush();
-             &Apache::lonnet::countacc($url);
-             $url=~/\.(\w+)$/;
-             if (&Apache::loncommon::fileembstyle($1) eq 'ssi') {
-		 $r->print('<br />');
-                 $r->rflush();
-                 for (my $i=0;$i<=$level*5;$i++) {
-                     $r->print('&nbsp;');
-                 }
-                 $r->print('- '.&mt('Rendering:').' ');
-		 my ($errorcount,$warningcount)=split(/:/,
-	       &Apache::lonnet::ssi_body($url,
-			       ('grade_target'=>'web',
-				'return_only_error_and_warning_counts' => 1)));
-                 if (($errorcount) ||
-                     ($warningcount)) {
-		     if ($errorcount) {
-                        $r->print('<img src="/adm/lonMisc/bomb.gif" alt="'.&mt('bomb').'" /><span class="LC_error">'.
-                          &mt('[quant,_1,error]',$errorcount).'</span>');
-                     }
-		     if ($warningcount) {
-                        $r->print('<span class="LC_warning">'.
-                          &mt('[quant,_1,warning]',$warningcount).'</span>');
-                     }
-                 } else {
-                     $r->print('<span class="LC_success">'.&mt('ok').'</span>');
-                 }
-                 $r->rflush();
-             }
-	     my $dependencies=
-                &Apache::lonnet::metadata($url,'dependencies');
-             foreach my $dep (split(/\,/,$dependencies)) {
-		 if (($dep=~/^\/res\//) && (!$alreadyseen{$dep})) {
-                    &checkonthis($r,$dep,$level+1);
-                 }
-             }
-          } elsif ($result eq 'unavailable') {
-             $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>');
-	      } else {
-		  $r->print('<span class="LC_error">'.&mt('unable to verify variable URL').'</span>');
-	      }
-          } else {
-             $r->print('<span class="LC_error">'.&mt('access denied').'</span>');
-          }
-       }
-    }
-}
-
-
-
-=pod
-
-=item list_symbs()
-
-List Symbs
-
-=cut
-
-sub list_symbs {
-    my ($r) = @_;
-
-    my $type = &Apache::loncommon::course_type();
-    $r->print(&Apache::loncommon::start_page('Symb List'));
-    $r->print(&Apache::lonhtmlcommon::breadcrumbs('Symb List'));
-    my $navmap = Apache::lonnavmaps::navmap->new();
-    if (!defined($navmap)) {
-        $r->print('<h2>'.&mt('Retrieval of List Failed').'</h2>'.
-                  '<div class="LC_error">'.
-                  &mt('Unable to retrieve information about course contents').
-                  '</div>');
-        &Apache::lonnet::logthis('Symb list failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'});
-    } else {
-        $r->print("<pre>\n");
-        foreach my $res ($navmap->retrieveResources()) {
-	    $r->print($res->compTitle()."\t".$res->symb()."\n");
-        }
-        $r->print("\n</pre>\n");
-    }
-    $r->print('<a href="/adm/coursedocs">'.&mt('Return to DOCS').'</a>');
-}
-
-
-sub verifycontent {
-    my ($r) = @_;
-    my $type = &Apache::loncommon::course_type();
-   my $loaderror=&Apache::lonnet::overloaderror($r);
-   if ($loaderror) { return $loaderror; }
-   $r->print(&Apache::loncommon::start_page('Verify '.$type.' Documents'));
-   $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$type.' Documents'));
-   $hashtied=0;
-   undef %alreadyseen;
-   %alreadyseen=();
-   &tiehash();
-   foreach my $key (keys(%hash)) {
-       if ($hash{$key}=~/\.(page|sequence)$/) {
-	   if (($key=~/^src_/) && ($alreadyseen{&unescape($hash{$key})})) {
-	       $r->print('<hr /><span class="LC_error">'.
-			 &mt('The following sequence or page is included more than once in your '.$type.': ').
-			 &unescape($hash{$key}).'</span><br />'.
-			 &mt('Note that grading records for problems included in this sequence or folder will overlap.<hr />'));
-	   }
-       }
-       if (($key=~/^src\_(.+)$/) && (!$alreadyseen{&unescape($hash{$key})})) {
-           &checkonthis($r,$hash{$key},0,$hash{'title_'.$1});
-       }
-   }
-   &untiehash();
-   $r->print('<h1>'.&mt('Done').'.</h1>'.'<a href="/adm/coursedocs">'.
-	     &mt('Return to DOCS').'</a>');
-}
-
-
-sub devalidateversioncache {
-    my $src=shift;
-    &Apache::lonnet::devalidate_cache_new('courseresversion',$env{'request.course.id'}.'_'.
-					  &Apache::lonnet::clutter($src));
-}
-
-sub checkversions {
-    my ($r) = @_;
-    my $type = &Apache::loncommon::course_type();
-    $r->print(&Apache::loncommon::start_page("Check $type Document Versions"));
-    $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $type Document Versions"));
-    my $header='';
-    my $startsel='';
-    my $monthsel='';
-    my $weeksel='';
-    my $daysel='';
-    my $allsel='';
-    my %changes=();
-    my $starttime=0;
-    my $haschanged=0;
-    my %setversions=&Apache::lonnet::dump('resourceversions',
-			  $env{'course.'.$env{'request.course.id'}.'.domain'},
-			  $env{'course.'.$env{'request.course.id'}.'.num'});
-
-    $hashtied=0;
-    &tiehash();
-    my %newsetversions=();
-    if ($env{'form.setmostrecent'}) {
-	$haschanged=1;
-	foreach my $key (keys(%hash)) {
-	    if ($key=~/^ids\_(\/res\/.+)$/) {
-		$newsetversions{$1}='mostrecent';
-                &devalidateversioncache($1);
-	    }
-	}
-    } elsif ($env{'form.setcurrent'}) {
-	$haschanged=1;
-	foreach my $key (keys(%hash)) {
-	    if ($key=~/^ids\_(\/res\/.+)$/) {
-		my $getvers=&Apache::lonnet::getversion($1);
-		if ($getvers>0) {
-		    $newsetversions{$1}=$getvers;
-		    &devalidateversioncache($1);
-		}
-	    }
-	}
-    } elsif ($env{'form.setversions'}) {
-	$haschanged=1;
-	foreach my $key (keys(%env)) {
-	    if ($key=~/^form\.set_version_(.+)$/) {
-		my $src=$1;
-		if (($env{$key}) && ($env{$key} ne $setversions{$src})) {
-		    $newsetversions{$src}=$env{$key};
-		    &devalidateversioncache($src);
-		}
-	    }
-	}
-    }
-    if ($haschanged) {
-        if (&Apache::lonnet::put('resourceversions',\%newsetversions,
-			  $env{'course.'.$env{'request.course.id'}.'.domain'},
-			  $env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') {
-	    $r->print('<h1>'.&mt('Your Version Settings have been Saved').'</h1>');
-	} else {
-	    $r->print('<h1><span class="LC_error">'.&mt('An Error Occured while Attempting to Save your Version Settings').'</span></h1>');
-	}
-	&mark_hash_old();
-    }
-    &changewarning($r,'');
-    if ($env{'form.timerange'} eq 'all') {
-# show all documents
-	$header=&mt('All Documents in '.$type);
-	$allsel=1;
-	foreach my $key (keys(%hash)) {
-	    if ($key=~/^ids\_(\/res\/.+)$/) {
-		my $src=$1;
-		$changes{$src}=1;
-	    }
-	}
-    } else {
-# show documents which changed
-	%changes=&Apache::lonnet::dump
-	 ('versionupdate',$env{'course.'.$env{'request.course.id'}.'.domain'},
-                     $env{'course.'.$env{'request.course.id'}.'.num'});
-	my $firstkey=(keys(%changes))[0];
-	unless ($firstkey=~/^error\:/) {
-	    unless ($env{'form.timerange'}) {
-		$env{'form.timerange'}=604800;
-	    }
-	    my $seltext=&mt('during the last').' '.$env{'form.timerange'}.' '
-		.&mt('seconds');
-	    if ($env{'form.timerange'}==-1) {
-		$seltext='since start of course';
-		$startsel='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';
-	    } elsif ($env{'form.timerange'}==604800) {
-		$seltext=&mt('during the last week').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
-		$weeksel='selected';
-	    } elsif ($env{'form.timerange'}==86400) {
-		$seltext=&mt('since yesterday').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
-		$daysel='selected';
-	    }
-	    $header=&mt('Content changed').' '.$seltext;
-	} else {
-	    $header=&mt('No content modifications yet.');
-	}
-    }
-    %setversions=&Apache::lonnet::dump('resourceversions',
-			  $env{'course.'.$env{'request.course.id'}.'.domain'},
-			  $env{'course.'.$env{'request.course.id'}.'.num'});
-    my %lt=&Apache::lonlocal::texthash
-	      ('st' => 'Version changes since start of '.$type,
-	       'lm' => 'Version changes since last Month',
-	       'lw' => 'Version changes since last Week',
-	       'sy' => 'Version changes since Yesterday',
-               'al' => 'All Resources (possibly large output)',
-	       'sd' => 'Display',
-	       'fi' => 'File',
-	       'md' => 'Modification Date',
-               'mr' => 'Most recently published Version',
-	       've' => 'Version used in '.$type,
-               'vu' => 'Set Version to be used in '.$type,
-'sv' => 'Set Versions to be used in '.$type.' according to Selections below',
-'sm' => 'Keep all Resources up-to-date with most recent Versions (default)',
-'sc' => 'Set all Resource Versions to current Version (Fix Versions)',
-	       'di' => 'Differences');
-    $r->print(<<ENDHEADERS);
-<form action="/adm/coursedocs" method="post">
-<input type="hidden" name="versions" value="1" />
-<input type="submit" name="setmostrecent" value="$lt{'sm'}" />
-<input type="submit" name="setcurrent" value="$lt{'sc'}" /><hr />
-<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>
-</select>
-<input type="submit" name="display" value="$lt{'sd'}" />
-<h3>$header</h3>
-<input type="submit" name="setversions" value="$lt{'sv'}" />
-<table border="0">
-ENDHEADERS
-    foreach my $key (sort(keys(%changes))) {
-	if ($changes{$key}>$starttime) {
-	    my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
-	    my $currentversion=&Apache::lonnet::getversion($key);
-	    if ($currentversion<0) {
-		$currentversion=&mt('Could not be determined.');
-	    }
-	    my $linkurl=&Apache::lonnet::clutter($key);
-	    $r->print(
-		      '<tr><td colspan="5"><br /><br /><font size="+1"><b>'.
-		      &Apache::lonnet::gettitle($linkurl).
-                      '</b></font></td></tr>'.
-                      '<tr><td>&nbsp;&nbsp;&nbsp;</td>'.
-                      '<td colspan="4">'.
-                      '<a href="'.$linkurl.'" target="cat">'.$linkurl.
-		      '</a></td></tr>'.
-                      '<tr><td></td>'.
-                      '<td title="'.$lt{'md'}.'">'.
-		      &Apache::lonlocal::locallocaltime(
-                           &Apache::lonnet::metadata($root.'.'.$extension,
-                                                     'lastrevisiondate')
-                                                        ).
-                      '</td>'.
-                      '<td title="'.$lt{'mr'}.'"><span class="LC_nobreak">Most Recent: '.
-                      '<font size="+1">'.$currentversion.'</font>'.
-                      '</span></td>'.
-                      '<td title="'.$lt{'ve'}.'"><span class="LC_nobreak">In '.$type.': '.
-                      '<font size="+1">');
-# Used in course
-	    my $usedversion=$hash{'version_'.$linkurl};
-	    if (($usedversion) && ($usedversion ne 'mostrecent')) {
-		$r->print($usedversion);
-	    } else {
-		$r->print($currentversion);
-	    }
-	    $r->print('</font></span></td><td title="'.$lt{'vu'}.'">'.
-                      '<span class="LC_nobreak">Use: ');
-# Set version
-	    $r->print(&Apache::loncommon::select_form($setversions{$linkurl},
-						      'set_version_'.$linkurl,
-						      ('select_form_order' =>
-						       ['',1..$currentversion,'mostrecent'],
-						       '' => '',
-						       'mostrecent' => 'most recent',
-						       map {$_,$_} (1..$currentversion))));
-	    $r->print('</span></td></tr><tr><td></td>');
-	    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 % 4 == 0) {
-                $entries_per_col = $num_entries/4;
-            } else {
-                $entries_per_col = $num_entries/4 + 1;
-            }
-            my $entries_count = 0;
-            $r->print('<td valign="top"><font size="-2">');
-            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.
-			      '">'.&mt('Diffs').'</a>');
-		}
-		$r->print('</span><br />');
-                if (++$entries_count % $entries_per_col == 0) {
-                    $r->print('</font></td>');
-                    if ($cols_output != 4) {
-                        $r->print('<td valign="top"><font size="-2">');
-                        $cols_output++;
-                    }
-                }
-	    }
-            while($cols_output++ < 4) {
-                $r->print('</font></td><td><font>')
-            }
-	    $r->print('</font></td></tr>'."\n");
-	}
-    }
-    $r->print('</table></form>');
-    $r->print('<h1>'.&mt('Done').'.</h1>');
-
-    &untiehash();
-}
-
-sub mark_hash_old {
-    my $retie_hash=0;
-    if ($hashtied) {
-	$retie_hash=1;
-	&untiehash();
-    }
-    &tiehash('write');
-    $hash{'old'}=1;
-    &untiehash();
-    if ($retie_hash) { &tiehash(); }
-}
-
-sub is_hash_old {
-    my $untie_hash=0;
-    if (!$hashtied) {
-	$untie_hash=1;
-	&tiehash();
-    }
-    my $return=$hash{'old'};
-    if ($untie_hash) { &untiehash(); }
-    return $return;
-}
-
 sub changewarning {
     my ($r,$postexec,$message,$url)=@_;
     if (!&is_hash_old()) { return; }
@@ -2558,89 +2017,14 @@
 }
 
 
-sub init_breadcrumbs {
-    my ($form,$text)=@_;
-    &Apache::lonhtmlcommon::clear_breadcrumbs();
-    &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs",
-					    text=>"Edit ".&Apache::loncommon::course_type(),
-					    faq=>273,
-					    bug=>'Instructor Interface',
-                                            help => 'Docs_Adding_Course_Doc'});
-    &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?".$form.'=1',
-					    text=>$text,
-					    faq=>273,
-					    bug=>'Instructor Interface'});
-}
-
-
-
-
 sub handler {
     my $r = shift;
     &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;
     return OK if $r->header_only;
-    my $type = &Apache::loncommon::course_type();
-
-
-# --------------------------------------------- Initialize help topics for this
-    foreach my $topic ('Adding_Course_Doc','Main_Course_Documents',
-	               'Adding_External_Resource','Navigate_Content',
-	               'Adding_Folders','Docs_Overview', 'Load_Map',
-	               'Supplemental','Score_Upload_Form','Adding_Pages',
-	               'Importing_LON-CAPA_Resource','Uploading_From_Harddrive',
-	               'Check_Resource_Versions','Verify_Content') {
-	$help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic);
-    }
-    # Composite help files
-    $help{'Syllabus'} = &Apache::loncommon::help_open_topic(
-		    'Docs_About_Syllabus,Docs_Editing_Templated_Pages');
-    $help{'Simple Page'} = &Apache::loncommon::help_open_topic(
-		    'Docs_About_Simple_Page,Docs_Editing_Templated_Pages');
-    $help{'Simple Problem'} = &Apache::loncommon::help_open_topic(
-		    'Option_Response_Simple');
-    $help{'Bulletin Board'} = &Apache::loncommon::help_open_topic(
-		    'Docs_About_Bulletin_Board,Docs_Editing_Templated_Pages');
-    $help{'My Personal Information Page'} = &Apache::loncommon::help_open_topic(
-		  'Docs_About_My_Personal_Info,Docs_Editing_Templated_Pages');
-    $help{'Group Portfolio'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files');
-    $help{'Caching'} = &Apache::loncommon::help_open_topic('Caching');
 
-# does this user have privileges to modify docs
-    my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});
-  if ($allowed && $env{'form.verify'}) {
-      &init_breadcrumbs('verify','Verify Content');
-      &verifycontent($r);
-  } elsif ($allowed && $env{'form.listsymbs'}) {
-      &init_breadcrumbs('listsymbs','List Symbs');
-      &list_symbs($r);
-  } elsif ($allowed && $env{'form.docslog'}) {
-      &init_breadcrumbs('docslog','Show Log');
-      &docs_change_log($r);
-  } elsif ($allowed && $env{'form.versions'}) {
-      &init_breadcrumbs('versions','Check/Set Resource Versions');
-      &checkversions($r);
-  } elsif ($allowed && $env{'form.dumpcourse'}) {
-      &init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' DOCS to Construction Space');
-      &dumpcourse($r);
-  } elsif ($allowed && $env{'form.exportcourse'}) {
-      &init_breadcrumbs('exportcourse','IMS Export');
-      &exportcourse($r);
-  } else {
-# is this a standard course?
-
-    my $standard=($env{'request.course.uri'}=~/^\/uploaded\//);
-    my $forcestandard = 0;
-    my $forcesupplement;
-    my $script='';
-    my $showdoc=0;
-    my $containertag;
-    my $uploadtag;
-
-
-    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-					    ['folderpath','pagepath',
-					     'pagesymb']);
+    $r->print(&Apache::loncommon::start_page('Assemble Test'));
+ 
 # No folderpath, no pagepath, see if we have something stored
     if ((!$env{'form.folderpath'}) && (!$env{'form.pagepath'})) {
         &Apache::loncommon::restore_course_settings('docs_folderpath',
@@ -2653,1183 +2037,23 @@
     if ($env{'form.pagepath'}) {
        $env{'form.folderpath'}='';
     }
-    if ($env{'form.folderpath'} =~ /^supplemental_\d+/) {
-        $env{'form.folderpath'} = 'supplemental&'.
-                                  &escape(&mt('Supplemental '.$type.' Documents')).'&'.
-                                  $env{'form.folderpath'};
-    }
     &Apache::loncommon::store_course_settings('docs_folderpath',
                                                 {'pagepath' => 'scalar',
                                                  'folderpath' => 'scalar'});
-    if ($env{'form.folderpath'}) {
-	my (@folderpath)=split('&',$env{'form.folderpath'});
-	$env{'form.foldername'}=&unescape(pop(@folderpath));
-	$env{'form.folder'}=pop(@folderpath);
-    }
-    if ($env{'form.pagepath'}) {
-        my (@pagepath)=split('&',$env{'form.pagepath'});
-        $env{'form.pagename'}=&unescape(pop(@pagepath));
-        $env{'form.folder'}=pop(@pagepath);
-        $containertag = '<input type="hidden" name="pagepath" value="" />'.
-	    '<input type="hidden" name="pagesymb" value="" />';
-        $uploadtag = '<input type="hidden" name="pagepath" value="'.&HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" />'.
-	    '<input type="hidden" name="pagesymb" value="'.&HTML::Entities::encode($env{'form.pagesymb'},'<>&"').'" />';
-    }
-    if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
-       $showdoc='/'.$1;
-    }
-    unless ($showdoc) { # got called from remote
-       if (($env{'form.folder'}=~/^(?:group|default)_/) ||
-          ($env{'form.folder'} =~ m:^\d+/(pages|sequences)/:)) {
-           $forcestandard = 1;
-       }
-       $forcesupplement=($env{'form.folder'}=~/^supplemental_/);
-
-       if ($allowed) {
-         &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']);
-         $script=&Apache::lonratedt::editscript('simple');
-       }
-    } else { # got called in sequence from course
-       $allowed=0;
-    }
-
-# get course data
     my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'};
     my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'};
-
+    my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});
+    
 # get personal data
     my $uname=$env{'user.name'};
     my $udom=$env{'user.domain'};
     my $plainname=&escape(&Apache::loncommon::plainname($uname,$udom));
-
 # graphics settings
-
     $iconpath = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL') . "/");
 
+# Only edit stuff if the user is allowed to edit
     if ($allowed) {
-	$script .= &editing_js($udom,$uname);
     }
-# -------------------------------------------------------------------- Body tag
-    $script = '<script type="text/javascript">'."\n"
-              .'// <![CDATA['."\n"
-              .$script."\n"
-              .'// ]]>'."\n"
-              .'</script>'."\n";
-    my $brcrum = [{href=>"/adm/createuser",text=>"$type Documents"}];
-    $r->print(&Apache::loncommon::start_page("$type Documents", $script,
-				    {'force_register' => $showdoc,
-                                     'bread_crumbs' => $brcrum}).
-	      &Apache::loncommon::help_open_menu('','',273,'RAT'));
-
-  my %allfiles = ();
-  my %codebase = ();
-  my ($upload_result,$upload_output);
-  if ($allowed) {
-      if (($env{'form.uploaddoc.filename'}) &&
-	  ($env{'form.cmd'}=~/^upload_(\w+)/)) {
-# Process file upload - phase one - upload and parse primary file.
-	  undef($hadchanges);
-          $upload_result = &process_file_upload(\$upload_output,$coursenum,
-						$coursedom,\%allfiles,
-						\%codebase,$1);
-	  if ($hadchanges) {
-	      &mark_hash_old();
-	  }
-          if ($upload_result eq 'phasetwo') {
-              $r->print($upload_output);
-          }
-      } elsif ($env{'form.phasetwo'}) {
-          my %newname = ();
-          my %origname = ();
-          my %attribs = ();
-          my $updateflag = 0;
-          my $residx = $env{'form.newidx'};
-          my $primary_url = &unescape($env{'form.primaryurl'});
-# Process file upload - phase two - gather secondary files.
-          for (my $i=0; $i<$env{'form.phasetwo'}; $i++) {
-              if ($env{'form.embedded_item_'.$i.'.filename'}) {
-                  my $javacodebase;
-                  $newname{$i} = &process_secondary_uploads(\$upload_output,$coursedom,$coursenum,'embedded_item_',$i,$residx);
-                  $origname{$i} = &unescape($env{'form.embedded_orig_'.$i});
-                  if (exists($env{'form.embedded_codebase_'.$i})) {
-                      $javacodebase =  &unescape($env{'form.embedded_codebase_'.$i});
-                      $origname{$i} =~ s#^\Q$javacodebase\E/##;
-                  }
-                  my @attributes = ();
-                  if ($env{'form.embedded_attrib_'.$i} =~ /:/) {
-                      @attributes = split(/:/,$env{'form.embedded_attrib_'.$i});
-                  } else {
-                      @attributes = ($env{'form.embedded_attrib_'.$i});
-                  }
-                  foreach my $attr (@attributes) {
-                      push(@{$attribs{$i}},&unescape($attr));
-                  }
-                  if ($javacodebase) {
-                      $codebase{$i} = $javacodebase;
-                      $codebase{$i} =~ s#/$##;
-                      $updateflag = 1;
-                  }
-              }
-              unless ($newname{$i} eq $origname{$i}) {
-                  $updateflag = 1;
-              }
-          }
-# Process file upload - phase three - modify primary file
-          if ($updateflag) {
-              my ($content,$rtncode);
-              my $updateflag = 0;
-              my $getstatus = &Apache::lonnet::getuploaded('GET',$primary_url,$coursedom,$coursenum,\$content,\$rtncode);
-              if ($getstatus eq 'ok') {
-                  foreach my $item (keys(%newname)) {
-                      if ($newname{$item} ne $origname{$item}) {
-                          my $attrib_regexp = '';
-                          if (@{$attribs{$item}} > 1) {
-                              $attrib_regexp = join('|',@{$attribs{$item}});
-                          } else {
-                              $attrib_regexp = $attribs{$item}[0];
-                          }
-                          if ($content =~ m#($attrib_regexp\s*=\s*['"]?)\Q$origname{$item}\E(['"]?)#) {
-                          }
-                          $content =~ s#($attrib_regexp\s*=\s*['"]?)\Q$origname{$item}\E(['"]?)#$1$newname{$item}$2#gi;
-                      }
-                      if (exists($codebase{$item})) {
-                          $content =~ s/(codebase\s*=\s*["']?)\Q$codebase{$item}\E(["']?)/$1.$2/i; #' stupid emacs
-                      }
-                  }
-# Save edited file.
-                  my $saveresult;
-                  my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'};
-                  my $docudom=$env{'course.'.$env{'request.course.id'}.'.domain'};
-                  my $url = &Apache::lonnet::store_edited_file($primary_url,$content,$docudom,$docuname,\$saveresult);
-              } else {
-                  &Apache::lonnet::logthis('retrieval of uploaded file - '.$primary_url.' - for editing, failed: '.$getstatus);
-              }
-          }
-      }
-  }
-
-  unless ($showdoc ||  $upload_result eq 'phasetwo') {
-# -----------------------------------------------------------------------------
-       my %lt=&Apache::lonlocal::texthash(
-                'uplm' => 'Upload a new main '.lc($type).' document',
-                'upls' => 'Upload a new supplemental '.lc($type).' document',
-                'impp' => 'Import a document',
-		'copm' => 'All documents out of a published map into this folder',
-                'upld' => 'Upload Document',
-                'srch' => 'Search',
-                'impo' => 'Import',
-		'book' => 'Import Bookmarks',
-                'selm' => 'Select Map',
-                'load' => 'Load Map',
-                'reco' => 'Recover Deleted Resources',
-                'newf' => 'New Folder',
-                'newp' => 'New Composite Page',
-                'extr' => 'External Resource',
-                'syll' => 'Syllabus',
-                'navc' => 'Navigate Contents',
-                'sipa' => 'Simple Course Page',
-                'sipr' => 'Simple Problem',
-                'drbx' => 'Drop Box',
-                'scuf' => 'Score Upload Form',
-                'bull' => 'Discussion Board',
-                'mypi' => 'My Personal Information Page',
-                'grpo' => 'Group Portfolio',
-                'rost' => 'Course Roster',
-				'abou' => 'Personal Information Page for a User',
-                'imsf' => 'IMS Import',
-                'imsl' => 'Import IMS package',
-                'file' =>  'File',
-                'title' => 'Title',
-                'comment' => 'Comment',
-                'parse' => 'Upload embedded images/multimedia files if HTML file!',
-		'nd' => 'Upload Document',
-		'pm' => 'Published Map',
-		'sd' => 'Special Document',
-		'mo' => 'More Options',
-					  );
-# -----------------------------------------------------------------------------
-	my $fileupload=(<<FIUP);
-	$lt{'file'}:<br />
-	<input type="file" name="uploaddoc" size="40" />
-FIUP
-
-	my $checkbox=(<<CHBO);
-	<!-- <label>$lt{'parse'}?
-	<input type="checkbox" name="parserflag" />
-	</label> -->
-	<label>
-	<input type="checkbox" name="parserflag" checked="checked" /> $lt{'parse'}
-	</label>
-CHBO
-
-	my $fileuploadform=(<<FUFORM);
-	<form name="uploaddocument" action="/adm/coursedocs" method="post" enctype="multipart/form-data">
-	<input type="hidden" name="active" value="aa" />
-	$fileupload
-	<br />
-	$lt{'title'}:<br />
-	<input type="text" size="50" name="comment" />
-	$uploadtag
-	<input type="hidden" name="cmd" value="upload_default" />
-	<br />
-	<span class="LC_nobreak">
-	$checkbox
-	</span>
-	<br />
-	<br />
-	<span class="LC_nobreak">
-	<input type="submit" value="$lt{'upld'}" />
-	 $help{'Uploading_From_Harddrive'}
-	</span>
-	</form>
-FUFORM
-
-	my $simpleeditdefaultform=(<<SEDFFORM);
-	<form action="/adm/coursedocs" method="post" name="simpleeditdefault">
-	<input type="hidden" name="active" value="bb" />
-	$uploadtag
-	<input type="button" onclick="javascript:groupsearch()" value="$lt{'srch'}" />
-	<br />
-	<span class="LC_nobreak">
-	<input type="button" onclick="javascript:groupimport();" value="$lt{'impo'}" />
-	$help{'Importing_LON-CAPA_Resource'}
-	</span>
-	<br />
-	<input type="button" onclick="javascript:groupopen(0,1,1);" value="$lt{'book'}" />
-	<hr />
-	<p>
-	$lt{'copm'}<br />
-	<input type="text" size="40" name="importmap" /><br />
-	<span class="LC_nobreak"><input type="button"
-	onclick="javascript:openbrowser('simpleeditdefault','importmap','sequence,page','')"
-	value="$lt{'selm'}" /> <input type="submit" name="loadmap" value="$lt{'load'}" />
-	$help{'Load_Map'}</span>
-	</p>
-	</form>
-SEDFFORM
-
-	my $extresourcesform=(<<ERFORM);
-	<form action="/adm/coursedocs" method="post" name="newext">
-	$uploadtag
-	<input type="hidden" name="importdetail" value="" />
-	<span class="LC_nobreak">
-	<input name="newext" type="button" onclick="javascript:makenewext('newext');"
-	value="$lt{'extr'}" /> $help{'Adding_External_Resource'}
-	</span>
-	</form>
-ERFORM
-
-    if ($allowed) {
-	&update_paste_buffer($coursenum,$coursedom);
-       my %lt=&Apache::lonlocal::texthash(
-					 'vc' => 'Verify Content',
-					 'cv' => 'Check/Set Resource Versions',
-					 'ls' => 'List Symbs',
-                                         'sl' => 'Show Log'
-					  );
-
-       my $folderpath=$env{'form.folderpath'};
-       if (!$folderpath) {
-	   if ($env{'form.folder'} eq '' ||
-	       $env{'form.folder'} eq 'supplemental') {
-	       $folderpath='default&'.
-		   &escape(&mt('Main '.$type.' Documents'));
-	   }
-       }
-       unless ($env{'form.pagepath'}) {
-           $containertag = '<input type="hidden" name="folderpath" value="" />';
-           $uploadtag = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />';
-       }
-	$r->print(<<HIDDENFORM);
-	<form name="renameform" method="post" action="/adm/coursedocs">
-   <input type="hidden" name="title" />
-   <input type="hidden" name="cmd" />
-   <input type="hidden" name="markcopy" />
-   <input type="hidden" name="copyfolder" />
-   $containertag
- </form>
- <form name="simpleedit" method="post" action="/adm/coursedocs">
-   <input type="hidden" name="importdetail" value="" />
-   $uploadtag
- </form>
-HIDDENFORM
-    }
-# --------------------------------------------------------- Main tab structure
-    my $activeClass = 1;
-    my $active = '';
-    $r->print('<ul class="LC_TabContentBigger" id="mainnav">');
-    if (($standard) && ($allowed) && (!$forcesupplement) && (($env{'form.folderpath'}=~/^default/) || $env{'form.folderpath'}eq"" || ($env{'form.pagepath'}))) {
-        if($activeClass == 1){
-           $active = 'class="active"';
-	   $activeClass = 0;
-	}
-    }
-    $r->print('<li '.$active.' onclick="javascript:showPage(this,\'mainCourseDocuments\',\'mainnav\',\'maincoursedoc\');">'.&mt('Main Course Documents').'</li>');
-    $active = '';
-    if (!$forcestandard || ($env{'form.folderpath'}=~/^supplemental/)) {
-        if($activeClass == 1){
-           $active = 'class="active"';
-        }
-    }
-    $r->print('<li '.$active.' onclick="javascript:showPage(this,\'supplCourseDocuments\',\'mainnav\',\'maincoursedoc\');">'.&mt('Supplemental Course Documents').'</li>');
-    $r->print('</ul>'
-             .'<div class="LC_Box" style="clear:both;margin:0;">'
-             .'<div id="maincoursedoc" style="margin:0 0;padding:0 0;">');
-# --------------------------------------------------------- Standard documents
-       my $savefolderpath;
-       my $active = 'style="display: none;"';
-       if($activeClass == 0){
-          $active = 'style="display: block;"';
-       }
-       $r->print('<div class="LC_ContentBox" id="mainCourseDocuments" '.$active.'>');
-       my $folder=$env{'form.folder'};
-       if ($folder eq '' || $folder=~/^supplemental/) {
-           $folder='default';
-	   $savefolderpath = $env{'form.folderpath'};
-	   $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents'));
-           $uploadtag = '<input type="hidden" name="folderpath" value="'.
-	       &HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';
-       }
-       my $postexec='';
-       if ($folder eq 'default') {
-           $r->print('<script type="text/javascript">'."\n"
-                    .'// <![CDATA['."\n"
-                    .'this.window.name="loncapaclient";'."\n"
-                    .'// ]]>'."\n"
-                    .'</script>'."\n"
-       );
-       } else {
-           #$postexec='self.close();';
-       }
-       my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
-                     '.sequence';
-       my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
-                     '.page';
-	my $container='sequence';
-	if ($env{'form.pagepath'}) {
-	    $container='page';
-	}
-	my $readfile='/uploaded/'.$coursedom.'/'.$coursenum.'/'.$folder.'.'.$container;
-
-
-
-	my $recoverform=(<<RFORM);
-	<form action="/adm/groupsort" method="post" name="recover">
-	<input type="button" name="recovermap" onclick="javascript:groupopen('$readfile',1,0)" value="$lt{'reco'}" />
-	</form>
-RFORM
-
-	my $imspform=(<<IMSPFORM);
-	<form action="/adm/imsimportdocs" method="post" name="ims">
-	<input type="hidden" name="folder" value="$folder" />
-	<input name="imsimport" type="button" value="$lt{'imsf'}" title="$lt{imsl}"  onclick="javascript:makeims();" />
-	</form>
-IMSPFORM
-
-	my $newnavform=(<<NNFORM);
-	<form action="/adm/coursedocs" method="post" name="newnav">
-	<input type="hidden" name="active" value="cc" />
-	$uploadtag
-	<input type="hidden" name="importdetail" 
-	value="$lt{'navc'}=/adm/navmaps" />
-	<span class="LC_nobreak">
-	<input name="newnav" type="submit" value="$lt{'navc'}" />
-	$help{'Navigate_Content'}
-	</span>
-	</form>
-NNFORM
-	my $newsmppageform=(<<NSPFORM);
-	<form action="/adm/coursedocs" method="post" name="newsmppg">
-	<input type="hidden" name="active" value="cc" />
-	$uploadtag
-	<input type="hidden" name="importdetail" value="" />
-	<span class="LC_nobreak">
-	<input name="newsmppg" type="button" value="$lt{'sipa'}"
-	onclick="javascript:makesmppage();" /> $help{'Simple Page'}
-	</span>
-	</form>
-NSPFORM
-
-	my $newsmpproblemform=(<<NSPROBFORM);
-	<form action="/adm/coursedocs" method="post" name="newsmpproblem">
-	<input type="hidden" name="active" value="cc" />
-	$uploadtag
-	<input type="hidden" name="importdetail" value="" />
-	<span class="LC_nobreak">
-	<input name="newsmpproblem" type="button" value="$lt{'sipr'}"
-	onclick="javascript:makesmpproblem();" />$help{'Simple Problem'}
-	</span>
-	</form>
-
-NSPROBFORM
-
-	my $newdropboxform=(<<NDBFORM);
-	<form action="/adm/coursedocs" method="post" name="newdropbox">
-	<input type="hidden" name="active" value="cc" />
-	$uploadtag
-	<input type="hidden" name="importdetail" value="" />
-	<span class="LC_nobreak">
-	<input name="newdropbox" type="button" value="$lt{'drbx'}"
-	onclick="javascript:makedropbox();" />
-	</span>
-	</form>
-NDBFORM
-
-	my $newexuploadform=(<<NEXUFORM);
-	<form action="/adm/coursedocs" method="post" name="newexamupload">
-	<input type="hidden" name="active" value="cc" />
-	$uploadtag
-	<input type="hidden" name="importdetail" value="" />
-	<span class="LC_nobreak">
-	<input name="newexamupload" type="button" value="$lt{'scuf'}"
-	onclick="javascript:makeexamupload();" />
-	$help{'Score_Upload_Form'}
-	</span>
-	</form>
-NEXUFORM
-
-	my $newbulform=(<<NBFORM);
-	<form action="/adm/coursedocs" method="post" name="newbul">
-	<input type="hidden" name="active" value="cc" />
-	$uploadtag
-	<input type="hidden" name="importdetail" value="" />
-	<span class="LC_nobreak">
-	<input name="newbulletin" type="button" value="$lt{'bull'}"
-	onclick="javascript:makebulboard();" />
-	$help{'Bulletin Board'}
-	</span>
-	</form>
-NBFORM
-
-	my $newaboutmeform=(<<NAMFORM);
-	<form action="/adm/coursedocs" method="post" name="newaboutme">
-	<input type="hidden" name="active" value="cc" />
-	$uploadtag
-	<input type="hidden" name="importdetail" 
-	value="$plainname=/adm/$udom/$uname/aboutme" />
-	<span class="LC_nobreak">
-	<input name="newaboutme" type="submit" value="$lt{'mypi'}" />
-	$help{'My Personal Information Page'}
-	</span>
-	</form>
-NAMFORM
-
-	my $newaboutsomeoneform=(<<NASOFORM);
-	<form action="/adm/coursedocs" method="post" name="newaboutsomeone">
-	<input type="hidden" name="active" value="cc" />
-	$uploadtag
-	<input type="hidden" name="importdetail" value="" />
-	<span class="LC_nobreak">
-	<input name="newaboutsomeone" type="button" value="$lt{'abou'}" 
-	onclick="javascript:makeabout();" />
-	</span>
-	</form>
-NASOFORM
-
-
-	my $newrosterform=(<<NROSTFORM);
-	<form action="/adm/coursedocs" method="post" name="newroster">
-	<input type="hidden" name="active" value="cc" />
-	$uploadtag
-	<input type="hidden" name="importdetail" 
-	value="$lt{'rost'}=/adm/viewclasslist" />
-	<span class="LC_nobreak">
-	<input name="newroster" type="submit" value="$lt{'rost'}" />
-	$help{'Course Roster'}
-	</span>
-	</form>
-NROSTFORM
-
-my $specialdocumentsform;
-my $newfolderform;
-
-       unless ($env{'form.pagepath'}) {
-	   my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
-
-	my $newpageform=(<<NPFORM);
-	<form action="/adm/coursedocs" method="post" name="newpage">
-	<input type="hidden" name="folderpath" value="$path" />
-	<input type="hidden" name="importdetail" value="" />
-	<input type="hidden" name="active" value="cc" />
-	<span class="LC_nobreak">
-	<input name="newpage" type="button"
-	onclick="javascript:makenewpage(this.form,'$pageseq');"
-	value="$lt{'newp'}" />$help{'Adding_Pages'}
-	</span>
-	</form>
-NPFORM
-
-	$newfolderform=(<<NFFORM);
-	<form action="/adm/coursedocs" method="post" name="newfolder">
-	<input type="hidden" name="folderpath" value="$path" />
-	<input type="hidden" name="importdetail" value="" />
-	<input type="hidden" name="active" value="aa" />
-	<span class="LC_nobreak">
-	<input name="newfolder" type="button"
-	onclick="javascript:makenewfolder(this.form,'$folderseq');"
-	value="$lt{'newf'}" />$help{'Adding_Folders'}
-	</span>
-	</form>
-NFFORM
-
-	my $newsylform=(<<NSYLFORM);
-	<form action="/adm/coursedocs" method="post" name="newsyl">
-	<input type="hidden" name="active" value="cc" />
-	$uploadtag
-	<input type="hidden" name="importdetail" 
-	value="$lt{'syll'}=/public/$coursedom/$coursenum/syllabus" />
-	<span class="LC_nobreak">
-	<input name="newsyl" type="submit" value="$lt{'syll'}" /> 
-	$help{'Syllabus'}
-	</span>
-	</form>
-NSYLFORM
-
-	my $newgroupfileform=(<<NGFFORM);
-	<form action="/adm/coursedocs" method="post" name="newgroupfiles">
-	<input type="hidden" name="active" value="cc" />
-	$uploadtag
-	<input type="hidden" name="importdetail"
-	value="$lt{'grpo'}=/adm/$coursedom/$coursenum/aboutme" />
-	<span class="LC_nobreak">
-	<input name="newgroupfiles" type="submit" value="$lt{'grpo'}" />
-	$help{'Group Portfolio'}
-	</span>
-	</form>
-NGFFORM
-
-	$specialdocumentsform="<br />$newpageform<br />$newsylform<br />$newgroupfileform";
-      }
-	$specialdocumentsform.="<br />$newnavform<br />$newsmppageform
-				<br />$newsmpproblemform<br />$newdropboxform
-       				<br />$newexuploadform<br />$newbulform
-       				<br />$newaboutmeform<br />$newaboutsomeoneform
-       				<br />$newrosterform";
-if($env{'form.pagepath'}) {
-	$specialdocumentsform="<br />$newsmpproblemform<br />$newexuploadform";
-}
-
-my %orderhash = (
-                'aa' => ['Upload Document',$fileuploadform.'<br />'.$newfolderform],
-                'bb' => ['Published Resources',$simpleeditdefaultform],
-                'cc' => ['Special Documents',$specialdocumentsform],
-		'dd' => ['Tools',$extresourcesform.'<br />'.$imspform.'<br />'.$recoverform.'<br />'.&generate_admin_options($containertag,$uploadtag,\%help,\%env)],
-                'zz' => ['Hide'],
-                );
-my $tid='1';
-my $varcd = 'Main Course Documents';
-$r->print(&generate_edit_table($tid,$varcd,\%orderhash));
- $hadchanges=0;
-        my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
-       if ($error) {
-           $r->print('<p><span class="LC_error">'.$error.'</span></p>');
-       }
-       if ($hadchanges) {
-           &mark_hash_old();
-       }
-
-       &changewarning($r,'');
- $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
-                     &mt('Editing the Table of Contents for your '.$type)));
-$r->print('</div>');
-       if ($env{'form.pagepath'}) {
-       }
-# ----------------------------------------------------- Supplemental documents
-       my $active = 'style="display: none;"';
-       if($activeClass == 1){
-          $active = 'style="display: block;"';
-       }
-       $r->print('<div class="LC_ContentBox" id="supplCourseDocuments" '.$active.'>');
-       my $folder=$env{'form.folder'};
-       unless ($folder=~/^supplemental/) {
-	   $folder='supplemental';
-       }
-       if ($folder =~ /^supplemental$/ &&
-	   (($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) {
-          $env{'form.folderpath'} = 'supplemental&'.
-                                    &escape(&mt('Supplemental '.$type.' Documents'));
-       }else{
-	  $env{'form.folderpath'} = $savefolderpath;
-       }
-       $env{'form.pagepath'} = '';
-       if ($allowed) {
-	   my $folderseq=
-	       '/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time.
-	       '.sequence';
-
-	   my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
-
-	my $supupdocform=(<<SUPDOCFORM);
-	<form action="/adm/coursedocs" method="post" enctype="multipart/form-data">
-	<input type="hidden" name="active" value="ee" />	
-	$fileupload
-	<br />
-	<br />
-	<span class="LC_nobreak">
-	$checkbox
-	</span>
-	<br /><br />
-	$lt{'comment'}:<br />
-	<textarea cols="50" rows="4" name="comment">
-	</textarea>
-	<br />
-	<input type="hidden" name="folderpath" value="$path" />
-	<input type="hidden" name="cmd" value="upload_supplemental" />
-	<span class="LC_nobreak">
-	<input type="submit" value="$lt{'upld'}" />
-	 $help{'Uploading_From_Harddrive'}
-	</span>
-	</form>
-SUPDOCFORM
-
-	my $supnewfolderform=(<<SNFFORM);
-	<form action="/adm/coursedocs" method="post" name="supnewfolder">
-	<input type="hidden" name="active" value="ee" />
-	<input type="hidden" name="folderpath" value="$path" />
-	<input type="hidden" name="importdetail" value="" />
-	<span class="LC_nobreak">
-	<input name="newfolder" type="button"
-	onclick="javascript:makenewfolder(this.form,'$folderseq');"
-	value="$lt{'newf'}" /> $help{'Adding_Folders'}
-	</span>
-	</form>
-SNFFORM
-
-
-	my $supnewextform=(<<SNEFORM);
-	<form action="/adm/coursedocs" method="post" name="supnewext">
-	<input type="hidden" name="active" value="ff" />
-	<input type="hidden" name="folderpath" value="$path" />
-	<input type="hidden" name="importdetail" value="" />
-	<span class="LC_nobreak">
-	<input name="newext" type="button" 
-	onclick="javascript:makenewext('supnewext');"
-	value="$lt{'extr'}" /> $help{'Adding_External_Resource'}
-	</span>
-	</form>
-SNEFORM
-
-	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" />
-	<input type="hidden" name="importdetail" 
-	value="Syllabus=/public/$coursedom/$coursenum/syllabus" />
-	<span class="LC_nobreak">
-	<input name="newsyl" type="submit" value="$lt{'syll'}" />
-	$help{'Syllabus'}
-	</span>
-	</form>
-SNSFORM
-
-	my $supnewaboutmeform=(<<SNAMFORM);
-	<form action="/adm/coursedocs" method="post" name="subnewaboutme">
-	<input type="hidden" name="active" value="ff" />
-	<input type="hidden" name="folderpath" value="$path" />
-	<input type="hidden" name="importdetail" 
-	value="$plainname=/adm/$udom/$uname/aboutme" />
-	<span class="LC_nobreak">
-	<input name="newaboutme" type="submit" value="$lt{'mypi'}" />
-	$help{'My Personal Information Page'}
-	</span>
-	</form>
-SNAMFORM
-
-
-
-my %suporderhash = (
-                'ee' => ['Upload Document',$supupdocform.'<br />'.$supnewfolderform],
-                'ff' => ['Special Documents',$supnewextform.'<br />'.$supnewsylform.'<br />'.$supnewaboutmeform],
-                'zz' => ['Hide'],
-                );
-
-my $tid='2';
-my $varscd = 'Supplemental Course Documents';
-
-$r->print(&generate_edit_table($tid,$varscd,\%suporderhash));
-my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
-       if ($error) {
-           $r->print('<p><span class="LC_error">'.$error.'</span></p>');
-       }
-$r->print('</div>');
-	}
-$r->print('</div>');
-    if ($allowed) {
-	$r->print('
-<form method="post" name="extimport" action="/adm/coursedocs">
-  <input type="hidden" name="title" />
-  <input type="hidden" name="url" />
-  <input type="hidden" name="useform" />
-  <input type="hidden" name="residx" />
-</form>');
-    }
-  } else {
-      unless ($upload_result eq 'phasetwo') {
-# -------------------------------------------------------- This is showdoc mode
-          $r->print("<h1>".&mt('Uploaded Document').' - '.
-		&Apache::lonnet::gettitle($r->uri).'</h1><p>'.
-&mt('It is recommended that you use an up-to-date virus scanner before handling this file.')."</p><table>".
-          &entryline(0,&mt("Click to download or use your browser's Save Link function"),$showdoc).'</table>');
-      }
-  }
- }
- $r->print(&Apache::loncommon::end_page());
- return OK;
-}
-
-sub generate_admin_options {
-  my ($containertag,$uploadtag,$help_ref,$env_ref) = @_;
- my %lt=&Apache::lonlocal::texthash(
-                                         'vc' => 'Verify Content',
-                                         'cv' => 'Check/Set Resource Versions',
-                                         'ls' => 'List Symbs',
-                                         'sl' => 'Show Log'
-                                          );
-  my %help = %{$help_ref};
-  my %env = %{$env_ref};
-  my $dumpbut=&dumpbutton();
-  my $exportbut=&exportbutton();
-  return (<<ENDOPTIONFORM);
- <form action="/adm/coursedocs" method="post" name="courseverify">
-           <input type="submit" name="verify" value="$lt{'vc'}" />$help{'Verify_Content'}<br />
-           <input type="submit" name="versions" value="$lt{'cv'}" />$help{'Check_Resource_Versions'}<br />
-           $dumpbut
-           $exportbut
-          <input type="submit" name="listsymbs" value="$lt{'ls'}" />
-          <input type="hidden" name="folder" value="$env{'form.folder'}" /><br />
-          <input type="submit" name="docslog" value="$lt{'sl'}" />
- </form>
-ENDOPTIONFORM
-
-}
-
-
-sub generate_edit_table {
-    my ($tid,$varcd,$orderhash_ref) = @_;
-    my %orderhash = %{$orderhash_ref};
-    my $form;
-    my $activetab;
-    my $active;
-    if($env{'form.active'} ne ''){
-        $activetab = $env{'form.active'};
-    }
-    $form = '<div class="LC_Box"><h4 class="LC_hcell">'.&mt($varcd).'</h4>';
-    $form .= '<ul id="navigation'.$tid.'" class="LC_TabContent">';
-    foreach my $name (sort(keys(%orderhash))){
-        if($name eq 'zz'){
-            if($activetab ne ''){
-               $active = 'class="right"';
-            }else{
-               $active = 'class="right active"';
-            }
-            $form .= '<li onclick="javascript:hideAll(this, \'navigation'.$tid.'\' ,\'content'.$tid.'\');" '.$active.'>'.&mt(${$orderhash{$name}}[0]).'</li>';
-        }else{
-            if($activetab eq '' || $activetab ne $name){
-               $active = '';
-            }elsif($activetab eq $name){
-               $active = 'class="active"';
-            }
-            $form .= '<li '.$active.' onclick="javascript:showPage(this, \''.$name.$tid.'\', \'navigation'.$tid.'\',\'content'.$tid.'\');">'.&mt(${$orderhash{$name}}[0]).'</li>';
-        }
-    }
-    $form .= '</ul>';
-    $form .= '<div id="content'.$tid.'" style="padding: 0 0; margin: 0 0;">';
-    foreach my $field (keys(%orderhash)){
-	if($field ne 'zz'){
-        if($activetab eq '' || $activetab ne $field){
-                $active = 'style="display: none;"';
-        }elsif($activetab eq $field){
-                $active = 'style="display:block;"';
-        }
-           $form .= '<div id="'.$field.$tid.'"'
-                   .' class="LC_ContentBox" '.$active.'>'.${$orderhash{$field}}[1]
-                   .'</div>';
-        }
-    }
-    $form .= '</div></div>';
-
-    return $form;
-}
-
-sub editing_js {
-    my ($udom,$uname) = @_;
-    my $now = time();
-    my %lt = &Apache::lonlocal::texthash(
-                                          p_mnf => 'Name of New Folder',
-                                          t_mnf => 'New Folder',
-                                          p_mnp => 'Name of New Page',
-                                          t_mnp => 'New Page',
-                                          p_mxu => 'Title for the Uploaded Score',
-                                          p_msp => 'Name of Simple Course Page',
-                                          p_msb => 'Title for the Problem',
-                                          p_mdb => 'Title for the Drop Box',
-                                          p_mbb => 'Title for the Discussion Board',
-                                          p_mab => "Enter user:domain for User's Personal Information Page",
-                                          p_mab2 => 'Personal Information Page of ',
-                                          p_mab_alrt1 => 'Not a valid user:domain',
-                                          p_mab_alrt2 => 'Please enter both user and domain in the format user:domain',
-                                          p_chn => 'New Title',
-                                          p_rmr1 => 'WARNING: Removing a resource makes associated grades and scores inaccessible!',
-                                          p_rmr2a => 'Remove[_99]',
-                                          p_rmr2b => '?[_99]',
-                                          p_ctr1a => 'WARNING: Cutting a resource makes associated grades and scores inaccessible!',
-                                          p_ctr1b => 'Grades remain inaccessible if resource is pasted into another folder.',
-                                          p_ctr2a => 'Cut[_98]',
-                                          p_ctr2b => '?[_98]'
-                                        );
-
-    return <<ENDNEWSCRIPT;
-function makenewfolder(targetform,folderseq) {
-    var foldername=prompt('$lt{"p_mnf"}','$lt{"t_mnf"}');
-    if (foldername) {
-       targetform.importdetail.value=escape(foldername)+"="+folderseq;
-        targetform.submit();
-    }
-}
-
-function makenewpage(targetform,folderseq) {
-    var pagename=prompt('$lt{"p_mnp"}','$lt{"t_mnp"}');
-    if (pagename) {
-        targetform.importdetail.value=escape(pagename)+"="+folderseq;
-        targetform.submit();
-    }
-}
-
-function makenewext(targetname) {
-    this.document.forms.extimport.useform.value=targetname;
-    this.document.forms.extimport.title.value='';
-    this.document.forms.extimport.url.value='';
-    this.document.forms.extimport.residx.value='';
-    window.open('/adm/rat/extpickframe.html');
-}
-
-function edittext(targetname,residx,title,url) {
-    this.document.forms.extimport.useform.value=targetname;
-    this.document.forms.extimport.residx.value=residx;
-    this.document.forms.extimport.url.value=url;
-    this.document.forms.extimport.title.value=title;
-    window.open('/adm/rat/extpickframe.html');
-}
-
-function makeexamupload() {
-   var title=prompt('$lt{"p_mxu"}');
-   if (title) {
-    this.document.forms.newexamupload.importdetail.value=
-	escape(title)+'=/res/lib/templates/examupload.problem';
-    this.document.forms.newexamupload.submit();
-   }
-}
-
-function makesmppage() {
-   var title=prompt('$lt{"p_msp"}');
-   if (title) {
-    this.document.forms.newsmppg.importdetail.value=
-	escape(title)+'=/adm/$udom/$uname/$now/smppg';
-    this.document.forms.newsmppg.submit();
-   }
-}
-
-function makesmpproblem() {
-   var title=prompt('$lt{"p_msb"}');
-   if (title) {
-    this.document.forms.newsmpproblem.importdetail.value=
-	escape(title)+'=/res/lib/templates/simpleproblem.problem';
-    this.document.forms.newsmpproblem.submit();
-   }
-}
-
-function makedropbox() {
-   var title=prompt('$lt{"p_mdb"}');
-   if (title) {
-    this.document.forms.newdropbox.importdetail.value=
-        escape(title)+'=/res/lib/templates/DropBox.problem';
-    this.document.forms.newdropbox.submit();
-   }
-}
-
-function makebulboard() {
-   var title=prompt('$lt{"p_mbb"}');
-   if (title) {
-    this.document.forms.newbul.importdetail.value=
-	escape(title)+'=/adm/$udom/$uname/$now/bulletinboard';
-    this.document.forms.newbul.submit();
-   }
-}
-
-function makeabout() {
-   var user=prompt("$lt{'p_mab'}");
-   if (user) {
-       var comp=new Array();
-       comp=user.split(':');
-       if ((typeof(comp[0])!=undefined) && (typeof(comp[1])!=undefined)) {
-	   if ((comp[0]) && (comp[1])) {
-	       this.document.forms.newaboutsomeone.importdetail.value=
-		   '$lt{"p_mab2"}'+escape(user)+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme';
-       this.document.forms.newaboutsomeone.submit();
-   } else {
-       alert("$lt{'p_mab_alrt1'}");
-   }
-} else {
-   alert("$lt{'p_mab_alrt2'}");
-}
-}
-}
-
-function makeims() {
-var caller = document.forms.ims.folder.value;
-var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one";
-newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes");
-newWindow.location.href = newlocation;
-}
-
-
-function finishpick() {
-var title=this.document.forms.extimport.title.value;
-var url=this.document.forms.extimport.url.value;
-var form=this.document.forms.extimport.useform.value;
-var residx=this.document.forms.extimport.residx.value;
-eval('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+'='+residx+'";this.document.forms.'+form+'.submit();');
-}
-
-function changename(folderpath,index,oldtitle,container,pagesymb) {
-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.submit();
-}
-}
-
-function removeres(folderpath,index,oldtitle,container,pagesymb,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.submit();
-}
-}
-
-function cutres(folderpath,index,oldtitle,container,pagesymb,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.submit();
-}
-}
-
-function markcopy(folderpath,index,oldtitle,container,pagesymb,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();
-}
-
-function unselectInactive(nav) {
-currentNav = document.getElementById(nav);
-currentLis = currentNav.getElementsByTagName('LI');
-for (i = 0; i < currentLis.length; i++) {
-	if(currentLis[i].className == 'right active' || currentLis[i].className == 'right'){
-		currentLis[i].className = 'right';
-	}else{
-		currentLis[i].className = 'i';
-	}
-}
-}
-
-function hideAll(current, nav, data) {
-unselectInactive(nav);
-if(current.className == 'right'){
-	current.className = 'right active'
-	}else{
-	current.className = 'active';
-}
-currentData = document.getElementById(data);
-currentDivs = currentData.getElementsByTagName('DIV');
-for (i = 0; i < currentDivs.length; i++) {
-	if(currentDivs[i].className == 'LC_ContentBox'){
-		currentDivs[i].style.display = 'none';
-	}
-}
-}
-
-function openTabs(pageId) {
-	tabnav = document.getElementById(pageId).getElementsByTagName('UL');	
-	if(tabnav.length > 0 ){
-		currentNav = document.getElementById(tabnav[0].id);
-		currentLis = currentNav.getElementsByTagName('LI');
-		for(i = 0; i< currentLis.length; i++){
-			if(currentLis[i].className == 'active') {
-				funcString = currentLis[i].onclick.toString();
-				tab = funcString.split('"');
-				currentData = document.getElementById(tab[1]);
-        			currentData.style.display = 'block';
-			}	
-		}
-	}
-}
-
-function showPage(current, pageId, nav, data) {
-	hideAll(current, nav, data);
-	openTabs(pageId);
-	unselectInactive(nav);
-	current.className = 'active';
-	currentData = document.getElementById(pageId);
-	currentData.style.display = 'block';
-	return false;
-}
-
-ENDNEWSCRIPT
+    $r->print(&Apache::loncommon::end_page());
+    return OK;
 }
-1;
-__END__
-
-
-=head1 NAME
-
-Apache::londocs.pm
-
-=head1 SYNOPSIS
-
-This is part of the LearningOnline Network with CAPA project
-described at http://www.lon-capa.org.
-
-=head1 SUBROUTINES
-
-=over
-
-=item %help=()
-
-Available help topics
-
-=item mapread()
-
-Mapread read maps into LONCAPA::map:: global arrays
-@order and @resources, determines status
-sets @order - pointer to resources in right order
-sets @resources - array with the resources with correct idx
-
-=item authorhosts()
-
-Return hash with valid author names
-
-=item dumpbutton()
-
-Generate "dump" button
-
-=item clean()
-
-=item dumpcourse()
-
-    Actually dump course
-
-
-=item exportbutton()
-
-    Generate "export" button
-
-=item exportcourse()
-
-=item create_ims_store()
-
-=item build_package()
-
-=item get_dependencies()
-
-=item process_content()
-
-=item replicate_content()
-
-=item extract_media()
-
-=item store_template()
-
-=item group_import()
-
-    Imports the given (name, url) resources into the course
-    coursenum, coursedom, and folder must precede the list
-
-=item breadcrumbs()
-
-=item log_docs()
-
-=item docs_change_log()
-
-=item update_paste_buffer()
-
-=item print_paste_buffer()
-
-=item do_paste_from_buffer()
-
-=item update_parameter()
-
-=item handle_edit_cmd()
-
-=item editor()
-
-=item process_file_upload()
-
-=item process_secondary_uploads()
-
-=item is_supplemental_title()
-
-=item parse_supplemental_title()
-
-=item entryline()
-
-=item tiehash()
-
-=item untiehash()
-
-=item checkonthis()
-
-check on this
-
-=item verifycontent()
-
-Verify Content
-
-=item devalidateversioncache() & checkversions()
-
-Check Versions
-
-=item mark_hash_old()
-
-=item is_hash_old()
-
-=item changewarning()
-
-=item init_breadcrumbs()
-
-Breadcrumbs for special functions
-
-=back
-
-=cut

--www1247649251--