--- loncom/interface/londocs.pm 2008/11/18 19:14:22 1.316 +++ loncom/interface/londocs.pm 2010/08/16 08:58:39 1.435 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.316 2008/11/18 19:14:22 jms Exp $ +# $Id: londocs.pm,v 1.435 2010/08/16 08:58:39 wenzelju Exp $ # # Copyright Michigan State University Board of Trustees # @@ -27,20 +27,6 @@ # -=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 - -=cut package Apache::londocs; @@ -49,6 +35,7 @@ use Apache::Constants qw(:common :http); use Apache::imsexport; use Apache::lonnet; use Apache::loncommon; +use Apache::lonhtmlcommon; use LONCAPA::map(); use Apache::lonratedt(); use Apache::lonxml; @@ -70,26 +57,8 @@ my %alreadyseen=(); my $hadchanges; -=pod - -=item %help=() - - Available help topics - -=cut - my %help=(); -=pod - -=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 - -=cut sub mapread { my ($coursenum,$coursedom,$map)=@_; @@ -104,32 +73,25 @@ sub storemap { &LONCAPA::map::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'. $map,1); if ($errtext) { return ($errtext,2); } - + $hadchanges=1; return ($errtext,0); } -=pod - -=item authorhosts() - - Return hash with valid author names - -=cut sub authorhosts { my %outhash=(); my $home=0; my $other=0; - foreach (keys %env) { - if ($_=~/^user\.role\.(au|ca)\.(.+)$/) { + foreach my $key (keys(%env)) { + if ($key=~/^user\.role\.(au|ca)\.(.+)$/) { my $role=$1; my $realm=$2; - my ($start,$end)=split(/\./,$env{$_}); + my ($start,$end)=split(/\./,$env{$key}); if (($start) && ($start>time)) { next; } if (($end) && (time>$end)) { next; } - my $ca; my $cd; + my ($ca,$cd); if ($1 eq 'au') { $ca=$env{'user.name'}; $cd=$env{'user.domain'}; @@ -151,52 +113,43 @@ sub authorhosts { } return ($home,$other,%outhash); } -=pod -=item dumpbutton() - - Generate "dump" button - -=cut 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('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; @@ -376,35 +346,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' + .&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 your course at this time,' + .' because there was a problem creating a' + .' manifest file.') + .'
' + .''; } } - $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 = ''. - &Apache::loncommon::end_page()); + &mt('Export').'" />'); } } @@ -617,7 +607,7 @@ sub build_package { if ($curRes->is_sequence() || $curRes->is_page()) { $lastcontainer = $count; } - if (grep/^$count$/,@$exportitems) { + if (grep(/^$count$/,@$exportitems)) { &get_dependencies($exportitems,\%parent,$depth,\@dependencies); } } @@ -641,7 +631,7 @@ sub build_package { if (ref($curRes)) { $count ++; - if ((grep/^$count$/,@$exportitems) || (grep/^$count$/,@dependencies)) { + if ((grep(/^$count$/,@$exportitems)) || (grep(/^$count$/,@dependencies))) { my $symb = $curRes->symb(); my $isvisible = 'true'; my $resourceref; @@ -675,11 +665,11 @@ sub build_package { '