\n");
+ $r->print(&Apache::loncommon::end_data_table());
&untiehash();
$r->print(
- '');
+ '');
}
}
-# ------------------------------------------------------ Generate "export" button
+
sub exportbutton {
my $type = &Apache::loncommon::course_type();
@@ -264,6 +271,8 @@ sub exportbutton {
&Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'';
}
+
+
sub exportcourse {
my $r=shift;
my $type = &Apache::loncommon::course_type();
@@ -309,10 +318,10 @@ sub exportcourse {
chdir $cwd;
$outcome .= &mt('Download the zip file from IMS '.lc($type).' archive ',$imszipfile,);
if ($copyresult) {
- $outcome .= 'The following errors occurred during export - '.$copyresult;
+ $outcome .= &mt('The following errors occurred during export - [_1]',$copyresult);
}
} else {
- $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. ';
+ $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.').' ';
}
}
$r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package'));
@@ -902,8 +911,7 @@ sub store_template {
}
}
-# Imports the given (name, url) resources into the course
-# coursenum, coursedom, and folder must precede the list
+
sub group_import {
my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_;
@@ -924,7 +932,7 @@ sub group_import {
my $result=&Apache::lonnet::finishuserfileupload($coursenum,$coursedom,
'output',$1.$2);
if ($result != m|^/uploaded/|) {
- $errtext.='Map not saved: A network error occured when trying to save the new map. ';
+ $errtext.='Map not saved: A network error occurred when trying to save the new map. ';
$fatal = 2;
}
if ($fatal) {
@@ -949,7 +957,7 @@ sub group_import {
}
sub breadcrumbs {
- my ($where)=@_;
+ my ($where,$allowed,$type)=@_;
&Apache::lonhtmlcommon::clear_breadcrumbs();
my (@folders);
if ($env{'form.pagepath'}) {
@@ -966,7 +974,7 @@ sub breadcrumbs {
my $is_random_order=0;
while (@folders) {
my $folder=shift(@folders);
- my $foldername=shift(@folders);
+ my $foldername=shift(@folders);
if ($folderpath) {$folderpath.='&';}
$folderpath.=$folder.'&'.$foldername;
my $url='/adm/coursedocs?folderpath='.
@@ -982,6 +990,13 @@ sub breadcrumbs {
if ($2) { $ishidden=1; }
if ($3) { $isencrypted=1; }
if ($4 ne '') { $is_random_order = 1; }
+ if ($folder eq 'supplemental') {
+ if ($allowed) {
+ $name = &mt('Supplemental '.$type.' Documents');
+ } else {
+ $name = &mt($type.' Documents');
+ }
+ }
&Apache::lonhtmlcommon::add_breadcrumb(
{'href'=>$url.$cpinfo,
'title'=>$name,
@@ -1058,9 +1073,9 @@ sub log_docs {
}
-#
-# Docs Change Log
-#
+
+
+
sub docs_change_log {
my ($r)=@_;
my $folder=$env{'form.folder'};
@@ -1201,7 +1216,10 @@ sub update_paste_buffer {
# Mark for copying
my ($title,$url)=split(':',$LONCAPA::map::resources[$LONCAPA::map::order[$env{'form.markcopy'}]]);
if (&is_supplemental_title($title)) {
+ &Apache::lonnet::appenv({'docs.markedcopy_supplemental' => $title});
($title) = &parse_supplemental_title($title);
+ } elsif ($env{'docs.markedcopy_supplemental'}) {
+ &Apache::lonnet::delenv('docs\\.markedcopy_supplemental');
}
$url=~s{http(:|:)//https(:|:)//}{https$2//};
@@ -1250,7 +1268,7 @@ ENDPASTE
}
sub do_paste_from_buffer {
- my ($coursenum,$coursedom) = @_;
+ my ($coursenum,$coursedom,$folder) = @_;
return 0 if (!$env{'form.pastemarked'});
@@ -1292,6 +1310,20 @@ sub do_paste_from_buffer {
$url = &LONCAPA::map::qtunescape($url);
# Now insert the URL at the bottom
my $newidx = &LONCAPA::map::getresidx($url);
+ if ($env{'docs.markedcopy_supplemental'}) {
+ if ($folder =~ /^supplemental/) {
+ $title = $env{'docs.markedcopy_supplemental'};
+ } else {
+ (undef,undef,$title) =
+ &parse_supplemental_title($env{'docs.markedcopy_supplemental'});
+ }
+ } else {
+ if ($folder=~/^supplemental/) {
+ $title=time.'___&&&___'.$env{'user.name'}.'___&&&___'.
+ $env{'user.domain'}.'___&&&___'.$title;
+ }
+ }
+
$LONCAPA::map::resources[$newidx]= $title.':'.$url.':'.$ext.':normal:res';
push(@LONCAPA::map::order, $newidx);
# Store the result
@@ -1370,7 +1402,7 @@ sub handle_edit_cmd {
}
sub editor {
- my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$which)=@_;
+ my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$type)=@_;
my $container= ($env{'form.pagepath'}) ? 'page'
: 'sequence';
@@ -1387,7 +1419,7 @@ sub editor {
}
my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order)=
- &breadcrumbs($folder);
+ &breadcrumbs($folder,$allowed,$type);
$r->print($breadcrumbtrail);
# ------------------------------------------------------------ Process commands
@@ -1412,7 +1444,7 @@ sub editor {
}
if ($env{'form.pastemarked'}) {
- &do_paste_from_buffer($coursenum,$coursedom);
+ &do_paste_from_buffer($coursenum,$coursedom,$folder);
($errtext,$fatal) = &storemap($coursenum,$coursedom,$folder.'.'.$container);
return $errtext if ($fatal);
}
@@ -1489,8 +1521,9 @@ sub editor {
$r->print('
'.&mt('Currently no documents.').'
');
}
$r->print("\n\n");
-
- &print_paste_buffer($r,$container);
+ if ($allowed) {
+ &print_paste_buffer($r,$container);
+ }
return;
}
@@ -1930,7 +1963,13 @@ ENDPARMS
return $line;
}
-# ---------------------------------------------------------------- tie the hash
+=pod
+
+=item tiehash()
+
+tie the hash
+
+=cut
sub tiehash {
my ($mode)=@_;
@@ -1956,7 +1995,8 @@ sub untiehash {
return OK;
}
-# --------------------------------------------------------------- check on this
+
+
sub checkonthis {
my ($r,$url,$level,$title)=@_;
@@ -1965,6 +2005,9 @@ sub checkonthis {
$r->rflush();
if (($url) && ($url!~/^\/uploaded\//) && ($url!~/\*$/)) {
$r->print("\n ");
+ if ($level==0) {
+ $r->print(" ");
+ }
for (my $i=0;$i<=$level*5;$i++) {
$r->print(' ');
}
@@ -1974,7 +2017,7 @@ sub checkonthis {
my $result=&Apache::lonnet::repcopy(
&Apache::lonnet::filelocation('',$url));
if ($result eq 'ok') {
- $r->print(''.&mt('ok').'');
+ $r->print(''.&mt('ok').'');
$r->rflush();
&Apache::lonnet::countacc($url);
$url=~/\.(\w+)$/;
@@ -1984,7 +2027,7 @@ sub checkonthis {
for (my $i=0;$i<=$level*5;$i++) {
$r->print(' ');
}
- $r->print('- '.&mt('Rendering').': ');
+ $r->print('- '.&mt('Rendering:').' ');
my ($errorcount,$warningcount)=split(/:/,
&Apache::lonnet::ssi_body($url,
('grade_target'=>'web',
@@ -1993,13 +2036,11 @@ sub checkonthis {
($warningcount)) {
if ($errorcount) {
$r->print(''.
- $errorcount.' '.
- &mt('error(s)').' ');
+ &mt('[quant,_1,error]',$errorcount).'');
}
if ($warningcount) {
$r->print(''.
- $warningcount.' '.
- &mt('warning(s)').'');
+ &mt('[quant,_1,warning]',$warningcount).'');
}
} else {
$r->print(''.&mt('ok').'');
@@ -2017,21 +2058,27 @@ sub checkonthis {
$r->print(''.&mt('connection down').'');
} elsif ($result eq 'not_found') {
unless ($url=~/\$/) {
- $r->print(''.&mt('not found').'');
+ $r->print(''.&mt('not found').'');
} else {
$r->print(''.&mt('unable to verify variable URL').'');
}
} else {
$r->print(''.&mt('access denied').'');
}
- }
- }
+ }
+ }
}
-#
-# ----------------------------------------------------------------- List Symbs
-#
+
+=pod
+
+=item list_symbs()
+
+List Symbs
+
+=cut
+
sub list_symbs {
my ($r) = @_;
@@ -2047,9 +2094,7 @@ sub list_symbs {
}
-#
-# -------------------------------------------------------------- Verify Content
-#
+
sub verifycontent {
my ($r) = @_;
my $type = &Apache::loncommon::course_type();
@@ -2080,8 +2125,6 @@ sub verifycontent {
}
-# -------------------------------------------------------------- Check Versions
-
sub devalidateversioncache {
my $src=shift;
&Apache::lonnet::devalidate_cache_new('courseresversion',$env{'request.course.id'}.'_'.
@@ -2384,7 +2427,6 @@ sub changewarning {
$help{'Caching'}.''."\n\n");
}
-# =========================================== Breadcrumbs for special functions
sub init_breadcrumbs {
my ($form,$text)=@_;
@@ -2400,7 +2442,9 @@ sub init_breadcrumbs {
bug=>'Instructor Interface'});
}
-# ================================================================ Main Handler
+
+
+
sub handler {
my $r = shift;
&Apache::loncommon::content_type($r,'text/html');
@@ -2476,6 +2520,11 @@ sub handler {
if ($env{'form.pagepath'}) {
$env{'form.folderpath'}='';
}
+ if ($env{'form.folderpath'} =~ /^supplemental_\d+/) {
+ $env{'form.folderpath'} = 'supplemental&'.
+ &escape(&mt('Supplemental '.$type.' Documents')).'&'.
+ $env{'form.folderpath'};
+ }
&Apache::loncommon::store_course_settings('docs_folderpath',
{'pagepath' => 'scalar',
'folderpath' => 'scalar'});
@@ -2529,8 +2578,9 @@ sub handler {
}
# -------------------------------------------------------------------- Body tag
$script = '';
+ my @brcrum = [{href=>"/adm/createuser",text=>"$type Documents"}];
$r->print(&Apache::loncommon::start_page("$type Documents", $script,
- {'force_register' => $showdoc,}).
+ {'force_register' => $showdoc, bread_crumbs => @brcrum}).
&Apache::loncommon::help_open_menu('','',273,'RAT'));
my %allfiles = ();
@@ -2740,7 +2790,7 @@ ENDCOURSEVERIFY
}
$hadchanges=0;
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,
- $upload_output);
+ $upload_output,$type);
if ($error) {
$r->print('