--- loncom/interface/londocs.pm 2008/12/13 00:19:07 1.320 +++ 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.320 2008/12/13 00:19:07 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'). - '
'); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('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 '.$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,11 +275,30 @@ 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); my $navmap = Apache::lonnavmaps::navmap->new(); + if (!defined($navmap)) { + $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package'). + '

'.&mt('IMS Export Failed').'

'. + '
'); + if ($crstype eq 'Community') { + $r->print(&mt('Unable to retrieve information about community contents')); + } else { + $r->print(&mt('Unable to retrieve information about course contents')); + } + $r->print('
'); + if ($crstype eq 'Community') { + $r->print(&mt('Return to Community Editor')); + } else { + $r->print(&mt('Return to Course Editor')); + } + $r->print(''); + &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'}); + return; + } my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); my $curRes; my $outcome; @@ -293,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; @@ -316,35 +345,53 @@ sub exportcourse { open(OUTPUT, "zip -r $imszip * 2> /dev/null |"); close(OUTPUT); chdir $cwd; - $outcome .= &mt('Download the zip file from IMS '.lc($type).' archive
',$imszipfile,); + $outcome .= '

' + .&mt('[_1]Your IMS package[_2] is ready for download.' + ,'','') + .'

'; if ($copyresult) { - $outcome .= &mt('The following errors occurred during export - [_1]',$copyresult); + $outcome .= '

' + .&mt('The following errors occurred during export - [_1]' + ,$copyresult) + .'

'; } } else { - $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.').'
'; + $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 { - my $display; - $display = '
'."\n"; - $display .= &mt('Choose which items you wish to export from your '.$type.'.

'); - $display .= ''. - ''. - ''. - ''. - '
 Content items'. - ''. + &mt('Choose which items you wish to export from your '.$crstype.'.'). + '

'. + '
'. + ''.&mt('Content items').''. + ''. - '  
  
 Discussion posts'. - ''. - '  
'; + '  '; + if ($numdisc > 0) { + $display .= '
'. + ''.&mt('Discussion posts').''. + ''. + '  '. + '
'; + } + $display .= '
'; my $curRes; my $depth = 0; my $count = 0; @@ -353,13 +400,13 @@ sub exportcourse { my %parent = (); my %children = (); my $lastcontainer = $startcount; - my @bgcolors = ('#F6F6F6','#FFFFFF'); - $display .= ''. - ''; if ($numdisc > 0) { - $display.='Export discussion posts?'."\n"; + $display .= ''; } - $display.=' '; + $display .= &Apache::loncommon::end_data_table_header_row(); while ($curRes = $it->next()) { if (ref($curRes)) { $count ++; @@ -380,38 +427,43 @@ sub exportcourse { $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard'; } } - my $color = $count%2; - $display .=''; + $display .= ' '.$curRes->title().''."\n"; + + # Existing discussion posts? + if ($discussiontime{$ressymb} > 0) { $boards ++; - $currelem = $count+$boards+$startcount; - $display .= ''."\n"; + $display .= ''."\n"; } else { - $display .= ''."\n"; + $display .= ''."\n"; } + $display .= &Apache::loncommon::end_data_table_row(); } } + $display .= &Apache::loncommon::end_data_table(); my $scripttag = qq| - |; - $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($display.'
Export content item?
 '."\n"; + $display .= &Apache::loncommon::start_data_table() + .&Apache::loncommon::start_data_table_header_row() + .''.&mt('Export content item?').''.&mt('Export discussion posts?').'
'."\n". - ''."\n" + .'is_sequence()) || ($curRes->is_page())) { - my $checkitem = $count + $boards + $startcount; - $display .= 'onClick="javascript:propagateCheck('."'$checkitem'".')"'; + $lastcontainer = $currelem; + $display .= 'onclick="javascript:propagateCheck('."'$currelem'".')"'; } $display .= ' />'."\n"; for (my $i=0; $i<$depth; $i++) { - $display .= ''."\n"; + $display .= ('' x2)."\n"; } if ($curRes->is_sequence()) { - $display .= ' '."\n"; - $lastcontainer = $count + $startcount + $boards; + $display .= ' '."\n"; } elsif ($curRes->is_page()) { - $display .= ' '."\n"; - $lastcontainer = $count + $startcount + $boards; + $display .= ' '."\n"; } - my $currelem = $count+$boards+$startcount; $children{$parent{$depth}} .= $currelem.':'; - $display .= ' '.$curRes->title().'  ' + .'' + .'  
'. - '

'. + $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. + '

'. '

'. - &Apache::loncommon::end_page()); + &mt('Export').'" />

'); } } @@ -499,7 +551,7 @@ sub create_ims_store { my $manifestfilename = $$tempexport.$manifest; if ($ims_manifest = Apache::File->new('>'.$manifestfilename)) { $$manifestok=1; - print $ims_manifest + print $ims_manifest ''."\n". ' $title}); ($title) = &parse_supplemental_title($title); } elsif ($env{'docs.markedcopy_supplemental'}) { - &Apache::lonnet::delenv('docs\\.markedcopy_supplemental'); + &Apache::lonnet::delenv('docs.markedcopy_supplemental'); } $url=~s{http(:|:)//https(:|:)//}{https$2//}; @@ -1270,7 +1322,9 @@ ENDPASTE sub do_paste_from_buffer { my ($coursenum,$coursedom,$folder) = @_; - return 0 if (!$env{'form.pastemarked'}); + if (!$env{'form.pastemarked'}) { + return; + } # paste resource to end of list my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url'}); @@ -1278,18 +1332,50 @@ sub do_paste_from_buffer { # Maps need to be copied first if (($url=~/\.(page|sequence)$/) && ($url=~/^\/uploaded\//)) { $title=&mt('Copy of').' '.$title; - my $newid=$$.time; - $url=~/^(.+)\.(\w+)$/; - my $newurl=$1.$newid.'.'.$2; + my $newid=$$.int(rand(100)).time; + my ($oldid,$ext) = ($url=~/^(.+)\.(\w+)$/); + if ($oldid =~ m{^(/uploaded/\Q$coursedom\E/\Q$coursenum\E/)(\D+)(\d+)$}) { + my $path = $1; + my $prefix = $2; + my $ancestor = $3; + if (length($ancestor) > 10) { + $ancestor = substr($ancestor,-10,10); + } + $oldid = $path.$prefix.$ancestor; + } + my $counter = 0; + my $newurl=$oldid.$newid.'.'.$ext; + my $is_unique = &uniqueness_check($newurl); + while (!$is_unique && $counter < 100) { + $counter ++; + $newid ++; + $newurl = $oldid.$newid; + $is_unique = &uniqueness_check($newurl); + } + if (!$is_unique) { + if ($url=~/\.page$/) { + return &mt('Paste failed: an error occurred creating a unique URL for the composite page'); + } else { + return &mt('Paste failed: an error occurred creating a unique URL for the folder'); + } + } my $storefn=$newurl; $storefn=~s{^/\w+/$match_domain/$match_username/}{}; - &Apache::lonclonecourse::writefile($env{'request.course.id'},$storefn, - &Apache::lonnet::getfile($url)); + my $paste_map_result = + &Apache::lonclonecourse::writefile($env{'request.course.id'},$storefn, + &Apache::lonnet::getfile($url)); + if ($paste_map_result eq '/adm/notfound.html') { + if ($url=~/\.page$/) { + return &mt('Paste failed: an error occurred saving the composite page'); + } else { + return &mt('Paste failed: an error occurred saving the folder'); + } + } $url = $newurl; } # published maps can only exists once, so remove it from paste buffer when done if (($url=~/\.(page|sequence)$/) && ($url=~m {^/res/})) { - &Apache::lonnet::delenv('docs\\.markedcopy'); + &Apache::lonnet::delenv('docs.markedcopy'); } if ($url=~ m{/smppg$}) { my $db_name = &Apache::lonsimplepage::get_db_name($url); @@ -1326,9 +1412,24 @@ sub do_paste_from_buffer { $LONCAPA::map::resources[$newidx]= $title.':'.$url.':'.$ext.':normal:res'; push(@LONCAPA::map::order, $newidx); + return 'ok'; # Store the result } +sub uniqueness_check { + my ($newurl) = @_; + my $unique = 1; + foreach my $res (@LONCAPA::map::order) { + my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]); + $url=&LONCAPA::map::qtescape($url); + if ($newurl eq $url) { + $unique = 0; + last; + } + } + return $unique; +} + my %parameter_type = ( 'randompick' => 'int_pos', 'hiddenresource' => 'string_yesno', 'encrypturl' => 'string_yesno', @@ -1402,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'; @@ -1419,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 @@ -1444,9 +1545,14 @@ sub editor { } if ($env{'form.pastemarked'}) { - &do_paste_from_buffer($coursenum,$coursedom,$folder); - ($errtext,$fatal) = &storemap($coursenum,$coursedom,$folder.'.'.$container); - return $errtext if ($fatal); + my $paste_res = + &do_paste_from_buffer($coursenum,$coursedom,$folder); + if ($paste_res eq 'ok') { + ($errtext,$fatal) = &storemap($coursenum,$coursedom,$folder.'.'.$container); + return $errtext if ($fatal); + } elsif ($paste_res ne '') { + $r->print('

'.$paste_res.'

'); + } } $r->print($upload_output); @@ -1513,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++; } @@ -1591,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 = ' @@ -1652,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; } @@ -1664,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)) { @@ -1717,7 +1824,7 @@ sub entryline { ' '.&mt('Random Order').' '; +'; } if ($ispage) { my $pagename=&escape($pagetitle); @@ -1929,30 +2037,36 @@ 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( 'hd' => 'Hidden', 'ec' => 'URL hidden'); my $enctext= - ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="1"':''); + ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="checked"':''); my $hidtext= - ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':''); + ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="checked"':''); $line.=(< $form_start - + $form_end $form_start - + $form_end $form_start $rand_order_text $form_end @@ -2035,7 +2149,7 @@ sub checkonthis { if (($errorcount) || ($warningcount)) { if ($errorcount) { - $r->print(''. + $r->print(''.&mt('bomb').''. &mt('[quant,_1,error]',$errorcount).''); } if ($warningcount) { @@ -2060,7 +2174,7 @@ sub checkonthis { unless ($url=~/\$/) { $r->print(''.&mt('not found').''); } else { - $r->print(''.&mt('unable to verify variable URL').''); + $r->print(''.&mt('unable to verify variable URL').''); } } else { $r->print(''.&mt('access denied').''); @@ -2082,26 +2196,34 @@ List Symbs sub list_symbs { my ($r) = @_; + 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(); - $r->print("
\n");
-    foreach my $res ($navmap->retrieveResources()) {
-	$r->print($res->compTitle()."\t".$res->symb()."\n");
+    if (!defined($navmap)) {
+        $r->print('

'.&mt('Retrieval of List Failed').'

'. + '
'. + &mt('Unable to retrieve information about course contents'). + '
'); + &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()) {
+	    $r->print($res->compTitle()."\t".$res->symb()."\n");
+        }
+        $r->print("\n
\n"); } - $r->print("\n
\n"); $r->print(''.&mt('Return to DOCS').''); } - 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=(); @@ -2110,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.
')); } @@ -2133,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=''; @@ -2196,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\/.+)$/) { @@ -2241,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', @@ -2250,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'); @@ -2299,7 +2421,7 @@ ENDHEADERS 'Most Recent: '. ''.$currentversion.''. ''. - 'In '.$type.': '. + 'In '.$crstype.': '. ''); # Used in course my $usedversion=$hash{'version_'.$linkurl}; @@ -2316,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; @@ -2417,14 +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". +''."\n". '
'. '

'. +'" />

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

'."\n\n"); + &mt('re-initializing '.$course_type).'" onclick="reinit(this.form)" />'). +$help{'Caching'}.'

'."\n\n"); + } @@ -2432,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'}); @@ -2450,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', @@ -2493,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? @@ -2522,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', @@ -2577,10 +2704,15 @@ sub handler { $script .= &editing_js($udom,$uname); } # -------------------------------------------------------------------- Body tag - $script = ''; - my @brcrum = [{href=>"/adm/createuser",text=>"$type Documents"}]; - $r->print(&Apache::loncommon::start_page("$type Documents", $script, - {'force_register' => $showdoc, bread_crumbs => @brcrum}). + $script = ''."\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')); my %allfiles = (); @@ -2673,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', @@ -2691,22 +2823,33 @@ sub handler { 'extr' => 'External Resource', 'syll' => 'Syllabus', 'navc' => 'Navigate Contents', - 'sipa' => 'Simple Page', + 'sipa' => 'Simple Course Page', 'sipr' => 'Simple Problem', 'drbx' => 'Drop Box', 'scuf' => 'Score Upload Form', - 'bull' => 'Bulletin Board', - 'mypi' => 'My Personal Info', - 'grpo' => 'Group Files', + 'bull' => 'Discussion Board', + 'mypi' => 'My Personal Information Page', + '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(); @@ -2722,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'}) { @@ -2766,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(''); @@ -2778,19 +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.'

'); } @@ -2842,27 +2989,27 @@ $uploadtag $lt{'pubd'}
$uploadtag - +
- + $help{'Importing_LON-CAPA_Resource'}
- +

$lt{'copm'}

$help{'Load_Map'}


- + ENDFORM unless ($env{'form.pagepath'}) { @@ -2872,13 +3019,13 @@ ENDFORM $uploadtag - $help{'Adding_External_Resource'}
- + ENDFORM } @@ -2891,7 +3038,7 @@ ENDFORM $help{'Adding_Folders'} @@ -2900,7 +3047,7 @@ value="$lt{'newf'}" />$help{'Adding_Fold $help{'Adding_Pages'} @@ -2927,7 +3074,7 @@ $uploadtag $help{'Simple Page'} +onclick="javascript:makesmppage();" /> $help{'Simple Page'}
@@ -2935,7 +3082,7 @@ $uploadtag $help{'Simple Problem'} +onclick="javascript:makesmpproblem();" />$help{'Simple Problem'}
@@ -2943,7 +3090,7 @@ $uploadtag +onclick="javascript:makedropbox();" />
@@ -2951,7 +3098,7 @@ $uploadtag +onclick="javascript:makeexamupload();" /> $help{'Score_Upload_Form'} @@ -2960,7 +3107,7 @@ $uploadtag +onclick="javascript:makebulboard();" /> $help{'Bulletin Board'} @@ -2978,7 +3125,7 @@ $uploadtag +onclick="javascript:makeabout();" />
@@ -3008,7 +3155,7 @@ $uploadtag $help{'Simple Problem'} +onclick="javascript:makesmpproblem();" />$help{'Simple Problem'}
@@ -3016,7 +3163,7 @@ $uploadtag +onclick="javascript:makeexamupload();" /> $help{'Score_Upload_Form'} @@ -3038,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.'

'); } @@ -3067,7 +3214,7 @@ ENDBLOCK

$lt{'comment'}:
-
@@ -3084,7 +3231,7 @@ $lt{'comment'}:
$help{'Adding_Folders'} @@ -3093,7 +3240,7 @@ value="$lt{'newf'}" /> $help{'Adding_Fol $help{'Adding_External_Resource'} @@ -3154,10 +3301,10 @@ sub editing_js { p_mnp => 'Name of New Page', t_mnp => 'New Page', p_mxu => 'Title for the Uploaded Score', - p_msp => 'Title for the Page', + p_msp => 'Name of the Simple Course Page', p_msb => 'Title for the Problem', p_mdb => 'Title for the Drop Box', - p_mbb => 'Title for the Bulletin Board', + p_mbb => 'Title for the Discussion Board', p_mab => "Enter user:domain for User's 'About Me' Page", p_mab2 => "About [_99]", p_mab_alrt1 => 'Not a valid user:domain',