--- loncom/interface/londocs.pm 2006/05/30 12:46:09 1.228 +++ loncom/interface/londocs.pm 2006/05/30 20:09:25 1.229 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.228 2006/05/30 12:46:09 www Exp $ +# $Id: londocs.pm,v 1.229 2006/05/30 20:09:25 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -121,16 +121,21 @@ sub authorhosts { sub dumpbutton { my ($home,$other,%outhash)=&authorhosts(); + my $type = 'Course'; + if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) { + $type = $env{'course.'.$env{'request.course.id'}.'.type'}; + } if ($home+$other==0) { return ''; } my $output=''; if ($home) { return ''. ''. + &mt('Dump [_1] DOCS to Construction Space',$type).'" />'. &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs'); } else { return''. - &mt('Dump Course DOCS to Construction Space: available on other servers'); + &mt('Dump [_1] DOCS to Construction Space: available on other servers', + $type); } } @@ -143,9 +148,12 @@ sub clean { sub dumpcourse { my ($r) = @_; - - $r->print(&Apache::loncommon::start_page('Dump Course DOCS to Construction Space'). - '
'); + my $type = 'Course'; + if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) { + $type = $env{'course.'.$env{'request.course.id'}.'.type'}; + } + $r->print(&Apache::loncommon::start_page('Dump [_1] DOCS to Construction Space', + $type).''); my ($home,$other,%outhash)=&authorhosts(); unless ($home) { return ''; } my $origcrsid=$env{'request.course.id'}; @@ -246,21 +254,29 @@ sub dumpcourse { $r->print("\n"); &untiehash(); $r->print( - '

'); + '

'); } } # ------------------------------------------------------ Generate "export" button sub exportbutton { + my $type = 'Course'; + if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) { + $type = $env{'course.'.$env{'request.course.id'}.'.type'}; + } return ''. ''. + &mt('Export [_1] to IMS',$type).'" />'. &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs'); } sub exportcourse { my $r=shift; + my $type = 'Course'; + if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) { + $type = $env{'course.'.$env{'request.course.id'}.'.type'}; + } my %discussiontime = &Apache::lonnet::dump('discussiontimes', $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'}); my $numdisc = keys %discussiontime; @@ -301,7 +317,7 @@ sub exportcourse { open(OUTPUT, "zip -r $imszip * 2> /dev/null |"); close(OUTPUT); chdir $cwd; - $outcome .= 'Download the zip file from IMS course archive
'; + $outcome .= &mt('Download the zip file from IMS [_2] archive
',$imszipfile,lc($type)); if ($copyresult) { $outcome .= 'The following errors occurred during export - '.$copyresult; } @@ -309,13 +325,13 @@ sub exportcourse { $outcome = '
Unfortunately you will not be able to retrieve an IMS archive of this posts at this time, because there was a problem creating a manifest file.
'; } } - $r->print(&Apache::loncommon::start_page('Export course to IMS content package')); + $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package')); $r->print($outcome); $r->print(&Apache::loncommon::end_page()); } else { my $display; $display = '
'."\n"; - $display .= 'Choose which items you wish to export from your course.

'; + $display .= &mt('Choose which items you wish to export from your [_1].

',$type); $display .= ''. '
 Content items'. ' |; - $r->print(&Apache::loncommon::start_page('Export course to IMS content package', + $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package', $scripttag)); $r->print($display.'
'. '

'. '

'. + &mt('Export [_1] DOCS',$type).'" />

'. &Apache::loncommon::end_page()); } } @@ -1764,9 +1780,13 @@ sub list_symbs { # sub verifycontent { my ($r) = @_; + my $type = 'Course'; + if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) { + $type = $env{'course.'.$env{'request.course.id'}.'.type'}; + } my $loaderror=&Apache::lonnet::overloaderror($r); if ($loaderror) { return $loaderror; } - $r->print(&Apache::loncommon::start_page('Verify Course Documents')); + $r->print(&Apache::loncommon::start_page('Verify '.$type.' Documents')); $hashtied=0; undef %alreadyseen; %alreadyseen=(); @@ -1775,7 +1795,7 @@ sub verifycontent { if ($hash{$_}=~/\.(page|sequence)$/) { if (($_=~/^src_/) && ($alreadyseen{&unescape($hash{$_})})) { $r->print('
'. - &mt('The following sequence or page is included more than once in your course: '). + &mt('The following sequence or page is included more than once in your [_1]: ',$type). &unescape($hash{$_}).'
'. &mt('Note that grading records for problems included in this sequence or folder will overlap.
')); } @@ -1800,7 +1820,11 @@ sub devalidateversioncache { sub checkversions { my ($r) = @_; - $r->print(&Apache::loncommon::start_page('Check Course Document Versions')); + my $type = 'Course'; + if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) { + $type = $env{'course.'.$env{'request.course.id'}.'.type'}; + } + $r->print(&Apache::loncommon::start_page("Check $type Document Versions")); my $header=''; my $startsel=''; my $monthsel=''; @@ -1861,7 +1885,7 @@ sub checkversions { &changewarning($r,''); if ($env{'form.timerange'} eq 'all') { # show all documents - $header=&mt('All Documents in Course'); + $header=&mt('All Documents in [_1]',$type); $allsel=1; foreach (keys %hash) { if ($_=~/^ids\_(\/res\/.+)$/) { @@ -1906,7 +1930,7 @@ sub checkversions { $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 Course', + ('st' => 'Version changes since start of '.$type, 'lm' => 'Version changes since last Month', 'lw' => 'Version changes since last Week', 'sy' => 'Version changes since Yesterday', @@ -1915,9 +1939,9 @@ sub checkversions { 'fi' => 'File', 'md' => 'Modification Date', 'mr' => 'Most recently published Version', - 've' => 'Version used in Course', - 'vu' => 'Set Version to be used in Course', -'sv' => 'Set Versions to be used in Course according to Selections below', + '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'); @@ -1964,7 +1988,7 @@ ENDHEADERS 'Most Recent: '. ''.$currentversion.''. ''. - 'In Course: '. + 'In '.$type.': '. ''); # Used in course my $usedversion=$hash{'version_'.$linkurl}; @@ -2077,6 +2101,10 @@ sub changewarning { } $url='/adm/coursedocs?'.$pathvar.'='.$path; } + my $crstype = 'course'; + if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) { + $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; + } if (!defined($message)) { $message='Changes will become active for your current session after [_1], or the next time you log in.'; } @@ -2087,7 +2115,7 @@ sub changewarning { '" />

'. &mt($message,' '). + &mt('re-initializing [_1]',$crstype).'" onClick="reinit(this.form)" />'). $help{'Caching'}.'

'."\n\n"); } @@ -2097,6 +2125,12 @@ sub handler { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; return OK if $r->header_only; +# Identify type - Course or Group. + my $type = 'Course'; + if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) { + $type = $env{'course.'.$env{'request.course.id'}.'.type'}; + } + # --------------------------------------------- Initialize help topics for this foreach ('Adding_Course_Doc','Main_Course_Documents', @@ -2198,7 +2232,7 @@ sub handler { } # -------------------------------------------------------------------- Body tag $script = ''; - $r->print(&Apache::loncommon::start_page('Course Documents', $script, + $r->print(&Apache::loncommon::start_page("$type Documents", $script, {'force_register' => $showdoc,}). &Apache::loncommon::help_open_menu('','','','',273,'RAT')); @@ -2287,8 +2321,8 @@ sub handler { unless ($showdoc || $upload_result eq 'phasetwo') { # ----------------------------------------------------------------------------- my %lt=&Apache::lonlocal::texthash( - 'uplm' => 'Upload a new main course document', - 'upls' => 'Upload a new supplemental course document', + 'uplm' => 'Upload a new main '.lc($type).' document', + 'upls' => 'Upload a new supplemental '.lc($type).' document', 'impp' => 'Import a document', 'pubd' => 'Published documents', 'copm' => 'All documents out of a published map into this folder', @@ -2332,7 +2366,7 @@ sub handler { if ($env{'form.folder'} eq '' || $env{'form.folder'} eq 'supplemental') { $folderpath='default&'. - &escape(&mt('Main Course Documents')); + &escape(&mt('Main [_1] Documents',$type)); } } unless ($env{'form.pagepath'}) { @@ -2365,7 +2399,7 @@ $exportbut ENDCOURSEVERIFY $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc', - &mt('Editing the Table of Contents for your Course'))); + &mt('Editing the Table of Contents for your [_1]',$type))); } # --------------------------------------------------------- Standard documents $r->print(''); @@ -2376,7 +2410,7 @@ ENDCOURSEVERIFY my $folder=$env{'form.folder'}; if ($folder eq '' || $folder eq 'supplemental') { $folder='default'; - $env{'form.folderpath'}='default&'.&escape(&mt('Main Course Documents')); + $env{'form.folderpath'}='default&'.&escape(&mt('Main [_1] Documents',$type)); } my $postexec=''; if ($folder eq 'default') { @@ -2607,7 +2641,7 @@ ENDBLOCK if ($folder =~ /^supplemental$/ && $env{'form.folderpath'} =~ /^default\&/) { $env{'form.folderpath'}='supplemental&'. - &escape(&mt('Supplemental Course Documents')); + &escape(&mt('Supplemental [_1] Documents',$type)); } &editor($r,$coursenum,$coursedom,$folder,$allowed); if ($allowed) {