--- loncom/interface/londocs.pm 2009/07/10 17:05:05 1.377
+++ loncom/interface/londocs.pm 2010/03/29 12:34:47 1.425
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.377 2009/07/10 17:05:05 bisitz Exp $
+# $Id: londocs.pm,v 1.425 2010/03/29 12:34:47 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -35,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;
@@ -116,17 +117,22 @@ 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 ''.
- &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs').' ';
- } else {
- return '
'.
- &mt('Dump '.$type.
- ' DOCS to Construction Space: available on other servers').
- '
';
+ my $link =
+ ""
+ .&mt('Dump '.$crstype.' Documents to Construction Space')
+ .'';
+ return
+ $link.' '
+ .&Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs')
+ .' ';
+ } else {
+ return
+ &mt('Dump '.$crstype.' Documents to Construction Space: available on other servers');
}
}
@@ -140,10 +146,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.' Documents to Construction Space').
'');
+ '');
}
}
sub exportbutton {
- my $type = &Apache::loncommon::course_type();
- return ''.
+ my $crstype = &Apache::loncommon::course_type();
+ return "".&mt('IMS Export')."".
&Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').' ';
}
@@ -272,18 +276,28 @@ 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 '.$type.' to IMS Package').
+ $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package').
'
'.&mt('IMS Export Failed').'
'.
- '
'.
- &mt('Unable to retrieve information about course contents').
- '
'.&mt('Return to Course Editor').'');
- &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'});
+ '
');
+ 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('
'
+ .&mt('[_1]Your IMS package[_2] is ready for download.'
+ ,'','')
+ .'
';
if ($copyresult) {
$outcome .= '
'
.&mt('The following errors occurred during export - [_1]'
,$copyresult)
.'
';
}
- $outcome .= '
'
- .&mt('[_1]Your IMS package[_2] is ready for download.'
- ,'','')
- .'
';
} else {
$outcome = '
'
.&mt('Unfortunately you will not be able to retrieve'
- .' an IMS archive of this posts at this time,'
+ .' an IMS archive of your course at this time,'
.' because there was a problem creating a'
.' manifest file.')
.'
'
@@ -354,29 +368,31 @@ sub exportcourse {
.'';
}
}
- $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS 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 = '');
}
sub do_paste_from_buffer {
@@ -1492,8 +1506,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';
@@ -1508,9 +1521,14 @@ sub editor {
$LONCAPA::map::resources[$idx]='';
}
- my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order)=
- &breadcrumbs($folder,$allowed,$type);
- $r->print($breadcrumbtrail);
+ my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order);
+ if ($allowed) {
+ ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) =
+ &breadcrumbs($allowed,$crstype);
+ $r->print($breadcrumbtrail);
+ } else {
+ $randompick = -1;
+ }
# ------------------------------------------------------------ Process commands
@@ -1588,34 +1606,74 @@ sub editor {
my $idx=0;
my $shown=0;
if (($ishidden) || ($isencrypted) || ($randompick>=0) || ($is_random_order)) {
- $r->print('
'
+ .&mt('Caution: this folder is set to randomly pick a subset'
+ .' of resources. Adding or removing resources from this'
+ .' folder will change the set of resources that the'
+ .' students see, resulting in spurious or missing credit'
+ .' for completed problems, not limited to ones you'
+ .' modify. Do not modify the contents of this folder if'
+ .' it is in active student use.')
+ .'
'
+ .&mt('Caution: this folder is set to randomly order its'
+ .' contents. Adding or removing resources from this folder'
+ .' will change the order of resources shown.')
+ .'
'
+ );
+ }
+ $r->print('
');
}
- if ($randompick>=0) {
- $r->print('
'.&mt('Caution: this folder is set to randomly pick a subset of resources. Adding or removing resources from this folder will change the set of resources that the students see, resulting in spurious or missing credit for completed problems, not limited to ones you modify. Do not modify the contents of this folder if it is in active student use.').'
');
- }
- if ($is_random_order) {
- $r->print('
'.&mt('Caution: this folder is set to randomly order its contents. Adding or removing resources from this folder will change the order of resources shown.').'
";
if (($allowed) && ($folder!~/^supplemental/)) {
my %lt=&Apache::lonlocal::texthash(
@@ -2055,7 +2117,7 @@ END
$form_start $parameterset $form_end
ENDPARMS
}
- $line.="
";
+ $line.=&Apache::loncommon::end_data_table_row();
return $line;
}
@@ -2178,7 +2240,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();
@@ -2187,25 +2249,25 @@ 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");
}
- $r->print(''.&mt('Return to DOCS').'');
+ $r->print(''.&mt('Back to Course Editor').'');
}
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=();
@@ -2214,9 +2276,9 @@ 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.'));
+ &mt('Note that grading records for problems included in this sequence or folder will overlap.').'');
}
}
if (($key=~/^src\_(.+)$/) && (!$alreadyseen{&unescape($hash{$key})})) {
@@ -2224,8 +2286,13 @@ sub verifycontent {
}
}
&untiehash();
- $r->print('
'
+ );
}
@@ -2237,9 +2304,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='';
@@ -2300,7 +2367,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\/.+)$/) {
@@ -2345,7 +2412,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',
@@ -2354,9 +2421,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');
@@ -2403,7 +2470,7 @@ ENDHEADERS
'
Most Recent: '.
''.$currentversion.''.
'
'.
- '
In '.$type.': '.
+ '
In '.$crstype.': '.
'');
# Used in course
my $usedversion=$hash{'version_'.$linkurl};
@@ -2420,7 +2487,7 @@ ENDHEADERS
('select_form_order' =>
['',1..$currentversion,'mostrecent'],
'' => '',
- 'mostrecent' => 'most recent',
+ 'mostrecent' => &mt('most recent'),
map {$_,$_} (1..$currentversion))));
$r->print('
');
my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
+ my $supupdocformbtn = "$help{'Uploading_From_Harddrive'}";
my $supupdocform=(<
+