--- loncom/interface/londocs.pm 2010/01/21 23:42:55 1.325.2.2 +++ loncom/interface/londocs.pm 2010/05/23 20:44:10 1.325.2.9 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.325.2.2 2010/01/21 23:42:55 raeburn Exp $ +# $Id: londocs.pm,v 1.325.2.9 2010/05/23 20:44:10 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -117,17 +117,17 @@ sub authorhosts { sub dumpbutton { my ($home,$other,%outhash)=&authorhosts(); - my $type = &Apache::loncommon::course_type(); + my $crstype = &Apache::loncommon::course_type(); if ($home+$other==0) { return ''; } if ($home) { return '
'. ''. + &mt('Dump '.$crstype.' DOCS to Construction Space').'" />'. &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs'). '
'; } else { return '
'. - &mt('Dump '.$type. + &mt('Dump '.$crstype. ' DOCS to Construction Space: available on other servers'). '
'; } @@ -143,10 +143,10 @@ sub clean { sub dumpcourse { my ($r) = @_; - my $type = &Apache::loncommon::course_type(); - $r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space'). + my $crstype = &Apache::loncommon::course_type(); + $r->print(&Apache::loncommon::start_page('Dump '.$crstype.' DOCS to Construction Space'). '
'); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$type.' DOCS to Construction Space')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$crstype.' DOCS to Construction Space')); my ($home,$other,%outhash)=&authorhosts(); unless ($home) { return ''; } my $origcrsid=$env{'request.course.id'}; @@ -257,17 +257,17 @@ sub dumpcourse { $r->print(&Apache::loncommon::end_data_table()); &untiehash(); $r->print( - '

'); + '

'); } } sub exportbutton { - my $type = &Apache::loncommon::course_type(); - return '
'. - ''. + my $crstype = &Apache::loncommon::course_type(); + return '
'. &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'
'; } @@ -275,7 +275,7 @@ sub exportbutton { sub exportcourse { my $r=shift; - my $type = &Apache::loncommon::course_type(); + my $crstype = &Apache::loncommon::course_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); @@ -312,7 +312,17 @@ sub exportcourse { my @exportitems = &Apache::loncommon::get_env_multiple('form.archive'); my @discussions = &Apache::loncommon::get_env_multiple('form.discussion'); if (@exportitems == 0 && @discussions == 0) { - $outcome = '
As you did not select any content items or discussions for export, an IMS package has not been created. Please go back to select either content items or discussions for export'; + $outcome = + '

' + .&mt('As you did not select any content items or discussions' + .' for export, an IMS package has not been created.') + .'

' + .'

' + .&mt('Please [_1]go back[_2] to select either content items' + .' or discussions for export.' + ,'' + ,'') + .'

'; } else { my $now = time; my %symbs; @@ -346,11 +356,19 @@ sub exportcourse { .'

'; } } else { - $outcome = '
'.&mt('Unfortunately you will not be able to retrieve an IMS archive of your course at this time, because there was a problem creating a manifest file.').'
'; + $outcome = '

' + .&mt('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.') + .'

' + .'

' + .&mt('Go Back') + .'

'; } } - $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package')); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package')); + $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export')); $r->print($outcome); $r->print(&Apache::loncommon::end_page()); } else { @@ -500,13 +518,13 @@ function containerCheck(item) { // ]]> |; - $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package', - $scripttag)); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package')); + $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package', + $scripttag)); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($crstype).' to IMS content package')); $r->print($display. '

'. '

'); + &mt('Export').'" />

'); } } @@ -991,7 +1009,7 @@ sub group_import { } sub breadcrumbs { - my ($where,$allowed,$type)=@_; + my ($allowed,$crstype)=@_; &Apache::lonhtmlcommon::clear_breadcrumbs(); my (@folders); if ($env{'form.pagepath'}) { @@ -1026,9 +1044,9 @@ sub breadcrumbs { if ($4 ne '') { $is_random_order = 1; } if ($folder eq 'supplemental') { if ($allowed) { - $name = &mt('Supplemental '.$type.' Documents'); + $name = &mt('Supplemental '.$crstype.' Documents'); } else { - $name = &mt($type.' Documents'); + $name = &mt($crstype.' Documents'); } } &Apache::lonhtmlcommon::add_breadcrumb( @@ -1485,7 +1503,7 @@ sub handle_edit_cmd { } sub editor { - my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$type)=@_; + my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype)=@_; my $container= ($env{'form.pagepath'}) ? 'page' : 'sequence'; @@ -1502,7 +1520,7 @@ sub editor { } my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order)= - &breadcrumbs($folder,$allowed,$type); + &breadcrumbs($allowed,$crstype); $r->print($breadcrumbtrail); # ------------------------------------------------------------ Process commands @@ -1601,7 +1619,7 @@ sub editor { unless ($name) { $name=(split(/\//,$url))[-1]; } unless ($name) { $idx++; next; } $r->print(&entryline($idx,$name,$url,$folder,$allowed,$res, - $coursenum)); + $coursenum,$crstype)); $idx++; $shown++; } @@ -1679,7 +1697,7 @@ sub process_file_upload { return 'failed'; } else { if ($parseaction eq 'parse') { - my $total_embedded = keys(%{$allfiles}); + my $total_embedded = scalar(keys(%{$allfiles})); if ($total_embedded > 0) { my $num = 0; my $state = ' @@ -1740,6 +1758,7 @@ sub parse_supplemental_title { $foldertitle=&Apache::lontexconvert::msgtexconverted($4); my $name = &Apache::loncommon::plainname($uname,$udom); $name = &HTML::Entities::encode($name,'"<>&\''); + $renametitle = &HTML::Entities::encode($renametitle,'"<>&\''); $title=''.&Apache::lonlocal::locallocaltime($time).' '. $name.':
'.$foldertitle; } @@ -1752,7 +1771,7 @@ sub parse_supplemental_title { # --------------------------------------------------------------- An entry line sub entryline { - my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_; + my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$crstype)=@_; my ($foldertitle,$pagetitle,$renametitle); if (&is_supplemental_title($title)) { @@ -2018,12 +2037,18 @@ END } else { undef($external); } + my $reinit; + if ($crstype eq 'Community') { + $reinit = &mt('(re-initialize community to access)'); + } else { + $reinit = &mt('(re-initialize course to access)'); + } $line.=' '.($url?'':'').''.($url?'':'').' - '.($url?"":'').$title.($url?'':' '.&mt('(re-initialize course to access)').'').$external." + '.($url?"":'').$title.($url?'':' '.$reinit.'').$external." "; if (($allowed) && ($folder!~/^supplemental/)) { my %lt=&Apache::lonlocal::texthash( @@ -2171,7 +2196,7 @@ List Symbs sub list_symbs { my ($r) = @_; - my $type = &Apache::loncommon::course_type(); + my $crstype = &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(); @@ -2180,7 +2205,7 @@ sub list_symbs { '
'. &mt('Unable to retrieve information about course contents'). '
'); - &Apache::lonnet::logthis('Symb list failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'}); + &Apache::lonnet::logthis('Symb list failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'}); } else { $r->print("
\n");
         foreach my $res ($navmap->retrieveResources()) {
@@ -2194,11 +2219,11 @@ sub list_symbs {
 
 sub verifycontent {
     my ($r) = @_;
-    my $type = &Apache::loncommon::course_type();
+    my $crstype = &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'));
+   $r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Documents'));
+   $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Documents'));
    $hashtied=0;
    undef %alreadyseen;
    %alreadyseen=();
@@ -2207,7 +2232,7 @@ sub verifycontent {
        if ($hash{$key}=~/\.(page|sequence)$/) {
 	   if (($key=~/^src_/) && ($alreadyseen{&unescape($hash{$key})})) {
 	       $r->print('
'. - &mt('The following sequence or page is included more than once in your '.$type.': '). + &mt('The following sequence or page is included more than once in your '.$crstype.': '). &unescape($hash{$key}).'
'. &mt('Note that grading records for problems included in this sequence or folder will overlap.
')); } @@ -2230,9 +2255,9 @@ sub devalidateversioncache { 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 $crstype = &Apache::loncommon::course_type(); + $r->print(&Apache::loncommon::start_page("Check $crstype Document Versions")); + $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Document Versions")); my $header=''; my $startsel=''; my $monthsel=''; @@ -2293,7 +2318,7 @@ sub checkversions { &changewarning($r,''); if ($env{'form.timerange'} eq 'all') { # show all documents - $header=&mt('All Documents in '.$type); + $header=&mt('All Documents in '.$crstype); $allsel=1; foreach my $key (keys(%hash)) { if ($key=~/^ids\_(\/res\/.+)$/) { @@ -2338,7 +2363,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 '.$type, + ('st' => 'Version changes since start of '.$crstype, 'lm' => 'Version changes since last Month', 'lw' => 'Version changes since last Week', 'sy' => 'Version changes since Yesterday', @@ -2347,9 +2372,9 @@ sub checkversions { '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', + 've' => 'Version used in '.$crstype, + 'vu' => 'Set Version to be used in '.$crstype, +'sv' => 'Set Versions to be used in '.$crstype.' 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'); @@ -2396,7 +2421,7 @@ ENDHEADERS 'Most Recent: '. ''.$currentversion.''. ''. - 'In '.$type.': '. + 'In '.$crstype.': '. ''); # Used in course my $usedversion=$hash{'version_'.$linkurl}; @@ -2413,7 +2438,7 @@ ENDHEADERS ('select_form_order' => ['',1..$currentversion,'mostrecent'], '' => '', - 'mostrecent' => 'most recent', + 'mostrecent' => &mt('most recent'), map {$_,$_} (1..$currentversion)))); $r->print(''); my $lastold=1; @@ -2514,18 +2539,19 @@ sub changewarning { $message='Changes will become active for your current session after [_1], or the next time you log in.'; } $r->print("\n\n". -''."\n". '
'. '

'. +'" />

'. &mt($message,' '). -$help{'Caching'}.'

'."\n\n"); +$help{'Caching'}.'

'."\n\n"); + } @@ -2533,7 +2559,7 @@ sub init_breadcrumbs { my ($form,$text)=@_; &Apache::lonhtmlcommon::clear_breadcrumbs(); &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs", - text=>"Edit ".&Apache::loncommon::course_type(), + text=>&Apache::loncommon::course_type().' Editor', faq=>273, bug=>'Instructor Interface', help => 'Docs_Adding_Course_Doc'}); @@ -2551,7 +2577,7 @@ sub handler { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; return OK if $r->header_only; - my $type = &Apache::loncommon::course_type(); + my $crstype = &Apache::loncommon::course_type(); # --------------------------------------------- Initialize help topics for this foreach my $topic ('Adding_Course_Doc','Main_Course_Documents', @@ -2594,7 +2620,7 @@ sub handler { &init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' DOCS to Construction Space'); &dumpcourse($r); } elsif ($allowed && $env{'form.exportcourse'}) { - &init_breadcrumbs('exportcourse','Export '.&Apache::loncommon::course_type().' to IMS'); + &init_breadcrumbs('exportcourse','IMS Export'); &exportcourse($r); } else { # is this a standard course? @@ -2623,7 +2649,7 @@ sub handler { } if ($env{'form.folderpath'} =~ /^supplemental_\d+/) { $env{'form.folderpath'} = 'supplemental&'. - &escape(&mt('Supplemental '.$type.' Documents')).'&'. + &escape(&mt('Supplemental '.$crstype.' Documents')).'&'. $env{'form.folderpath'}; } &Apache::loncommon::store_course_settings('docs_folderpath', @@ -2679,12 +2705,12 @@ sub handler { } # -------------------------------------------------------------------- Body tag $script = ''; - my $brcrum = [{href=>"/adm/createuser",text=>"$type Documents"}]; - $r->print(&Apache::loncommon::start_page("$type Documents", $script, + .'// '."\n" + .''."\n"; + my $brcrum = [{href=>"/adm/createuser",text=>"Edit $crstype"}]; + $r->print(&Apache::loncommon::start_page("Edit $crstype", $script, {'force_register' => $showdoc, 'bread_crumbs' => $brcrum}). &Apache::loncommon::help_open_menu('','',273,'RAT')); @@ -2779,8 +2805,8 @@ sub handler { 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', + 'uplm' => 'Upload a new main '.lc($crstype).' document', + 'upls' => 'Upload a new supplemental '.lc($crstype).' document', 'impp' => 'Import a document', 'pubd' => 'Published documents', 'copm' => 'All documents out of a published map into this folder', @@ -2806,13 +2832,24 @@ sub handler { 'grpo' => 'Group Portfolios', 'rost' => 'Course Roster', 'abou' => 'About User', - 'imsf' => 'Import IMS package', + 'imsf' => 'IMS Import', + 'imsl' => 'Import IMS package', 'file' => 'File', 'title' => 'Title', 'comment' => 'Comment', 'parse' => 'If HTML file, upload embedded images/multimedia files' ); # ----------------------------------------------------------------------------- + my %tabtitles = ( + main => { + Course => &mt('Main Course Documents'), + Community => &mt('Main Community Documents'), + }, + supplemental => { + Course => &mt('Supplemental Course Documents'), + Community => &mt('Supplemental Community Documents'), + }, + ); if ($allowed) { &update_paste_buffer($coursenum,$coursedom); my $dumpbut=&dumpbutton(); @@ -2828,8 +2865,7 @@ sub handler { if (!$folderpath) { if ($env{'form.folder'} eq '' || $env{'form.folder'} eq 'supplemental') { - $folderpath='default&'. - &escape(&mt('Main '.$type.' Documents')); + $folderpath='default&'.&escape($tabtitles{'main'}{$crstype}); } } unless ($env{'form.pagepath'}) { @@ -2872,7 +2908,7 @@ sub handler {
 
ENDCOURSEVERIFY $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc', - &mt('Editing the Table of Contents for your '.$type))); + &mt('Editing the Table of Contents for your '.$crstype))); } # --------------------------------------------------------- Standard documents $r->print(''); @@ -2884,24 +2920,24 @@ ENDCOURSEVERIFY my $folder=$env{'form.folder'}; if ($folder eq '' || $folder eq 'supplemental') { $folder='default'; - $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents')); + $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$crstype.' Documents')); $uploadtag = ''; } my $postexec=''; if ($folder eq 'default') { - $r->print('' + $r->print(''."\n" ); } else { #$postexec='self.close();'; } $hadchanges=0; my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed, - $upload_output,$type); + $upload_output,$crstype); if ($error) { $r->print('

'.$error.'

'); } @@ -2989,7 +3025,7 @@ value="$lt{'extr'}" /> $help{'Adding_Ext
- + ENDFORM } @@ -3149,9 +3185,9 @@ ENDBLOCK if ($folder =~ /^supplemental$/ && (($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) { $env{'form.folderpath'} = 'supplemental&'. - &escape(&mt('Supplemental '.$type.' Documents')); + &escape($tabtitles{'supplemental'}{$crstype}); } - my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); + my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype); if ($error) { $r->print('

'.$error.'

'); }