--- loncom/interface/londocs.pm 2008/09/04 17:50:47 1.310
+++ loncom/interface/londocs.pm 2008/11/18 19:14:22 1.316
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.310 2008/09/04 17:50:47 raeburn Exp $
+# $Id: londocs.pm,v 1.316 2008/11/18 19:14:22 jms Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -26,6 +26,22 @@
# http://www.lon-capa.org/
#
+
+=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;
use strict;
@@ -53,15 +69,27 @@ my %alreadyseen=();
my $hadchanges;
-# Available help topics
+
+=pod
+
+=item %help=()
+
+ Available help topics
+
+=cut
my %help=();
-# 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
-#
+=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)=@_;
@@ -81,7 +109,14 @@ sub storemap {
return ($errtext,0);
}
-# ----------------------------------------- Return hash with valid author names
+
+=pod
+
+=item authorhosts()
+
+ Return hash with valid author names
+
+=cut
sub authorhosts {
my %outhash=();
@@ -116,7 +151,13 @@ sub authorhosts {
}
return ($home,$other,%outhash);
}
-# ------------------------------------------------------ Generate "dump" button
+=pod
+
+=item dumpbutton()
+
+ Generate "dump" button
+
+=cut
sub dumpbutton {
my ($home,$other,%outhash)=&authorhosts();
@@ -141,7 +182,14 @@ sub clean {
$title=~s/[^\w\/\!\$\%\^\*\-\_\=\+\;\:\,\\\|\`\~]+/\_/gs;
return $title;
}
-# -------------------------------------------------------- Actually dump course
+
+=pod
+
+=item dumpcourse()
+
+ Actually dump course
+
+=cut
sub dumpcourse {
my ($r) = @_;
@@ -228,11 +276,19 @@ sub dumpcourse {
my $title=$origcrsdata{'description'};
$title=~s/[\/\s]+/\_/gs;
$title=&clean($title);
- $r->print('
'.&mt('Folder in Construction Space').'
');
+ $r->print(''.&mt('Folder in Construction Space').'
'
+ .'
');
&tiehash();
- $r->print(''.&mt('Filenames in Construction Space').'
\n");
+ $r->print(&Apache::loncommon::end_data_table());
&untiehash();
$r->print(
- '');
+ '');
}
}
-# ------------------------------------------------------ Generate "export" button
+=pod
+
+=item exportbutton()
+
+ Generate "export" button
+
+=cut
sub exportbutton {
my $type = &Apache::loncommon::course_type();
@@ -264,6 +327,12 @@ sub exportbutton {
&Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'';
}
+=pod
+
+=item exportcourse()
+
+=cut
+
sub exportcourse {
my $r=shift;
my $type = &Apache::loncommon::course_type();
@@ -309,10 +378,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 +971,15 @@ sub store_template {
}
}
-# Imports the given (name, url) resources into the course
-# coursenum, coursedom, and folder must precede the list
+=pod
+
+=item group_import()
+
+ Imports the given (name, url) resources into the course
+ coursenum, coursedom, and folder must precede the list
+
+=cut
+
sub group_import {
my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_;
@@ -924,7 +1000,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) {
@@ -1064,10 +1140,12 @@ sub log_docs {
}
}
+=pod
+
+=item docs_change_log()
+
+=cut
-#
-# Docs Change Log
-#
sub docs_change_log {
my ($r)=@_;
my $folder=$env{'form.folder'};
@@ -1208,7 +1286,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//};
@@ -1257,7 +1338,7 @@ ENDPASTE
}
sub do_paste_from_buffer {
- my ($coursenum,$coursedom) = @_;
+ my ($coursenum,$coursedom,$folder) = @_;
return 0 if (!$env{'form.pastemarked'});
@@ -1299,6 +1380,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
@@ -1419,7 +1514,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);
}
@@ -1938,7 +2033,13 @@ ENDPARMS
return $line;
}
-# ---------------------------------------------------------------- tie the hash
+=pod
+
+=item tiehash()
+
+tie the hash
+
+=cut
sub tiehash {
my ($mode)=@_;
@@ -1964,7 +2065,15 @@ sub untiehash {
return OK;
}
-# --------------------------------------------------------------- check on this
+
+=pod
+
+=item checkonthis()
+
+check on this
+
+=cut
+
sub checkonthis {
my ($r,$url,$level,$title)=@_;
@@ -1973,6 +2082,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(' ');
}
@@ -1982,7 +2094,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+)$/;
@@ -1992,7 +2104,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',
@@ -2001,13 +2113,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').'');
@@ -2025,21 +2135,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) = @_;
@@ -2055,9 +2171,14 @@ sub list_symbs {
}
-#
-# -------------------------------------------------------------- Verify Content
-#
+=pod
+
+=item verifycontent()
+
+Verify Content
+
+=cut
+
sub verifycontent {
my ($r) = @_;
my $type = &Apache::loncommon::course_type();
@@ -2087,8 +2208,13 @@ sub verifycontent {
&mt('Return to DOCS').'');
}
+=pod
+
+=item devalidateversioncache() & checkversions()
-# -------------------------------------------------------------- Check Versions
+Check Versions
+
+=cut
sub devalidateversioncache {
my $src=shift;
@@ -2392,7 +2518,13 @@ sub changewarning {
$help{'Caching'}.''."\n\n");
}
-# =========================================== Breadcrumbs for special functions
+=pod
+
+=item init_breadcrumbs()
+
+Breadcrumbs for special functions
+
+=cut
sub init_breadcrumbs {
my ($form,$text)=@_;
@@ -2408,7 +2540,15 @@ sub init_breadcrumbs {
bug=>'Instructor Interface'});
}
-# ================================================================ Main Handler
+
+=pod
+
+=item handler()
+
+Main Handler
+
+=cut
+
sub handler {
my $r = shift;
&Apache::loncommon::content_type($r,'text/html');
@@ -3313,3 +3453,9 @@ ENDNEWSCRIPT
}
1;
__END__
+
+=pod
+
+=back
+
+=cut