--- loncom/interface/londocs.pm 2008/09/05 00:08:46 1.311
+++ loncom/interface/londocs.pm 2008/11/21 20:31:48 1.317
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.311 2008/09/05 00:08:46 raeburn Exp $
+# $Id: londocs.pm,v 1.317 2008/11/21 20:31:48 jms Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -26,6 +26,8 @@
# http://www.lon-capa.org/
#
+
+
package Apache::londocs;
use strict;
@@ -53,15 +55,10 @@ my %alreadyseen=();
my $hadchanges;
-# Available help topics
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
-#
+
sub mapread {
my ($coursenum,$coursedom,$map)=@_;
@@ -81,7 +78,7 @@ sub storemap {
return ($errtext,0);
}
-# ----------------------------------------- Return hash with valid author names
+
sub authorhosts {
my %outhash=();
@@ -116,7 +113,7 @@ sub authorhosts {
}
return ($home,$other,%outhash);
}
-# ------------------------------------------------------ Generate "dump" button
+
sub dumpbutton {
my ($home,$other,%outhash)=&authorhosts();
@@ -141,7 +138,8 @@ sub clean {
$title=~s/[^\w\/\!\$\%\^\*\-\_\=\+\;\:\,\\\|\`\~]+/\_/gs;
return $title;
}
-# -------------------------------------------------------- Actually dump course
+
+
sub dumpcourse {
my ($r) = @_;
@@ -228,11 +226,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
+
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) {
@@ -1065,9 +1073,9 @@ sub log_docs {
}
-#
-# Docs Change Log
-#
+
+
+
sub docs_change_log {
my ($r)=@_;
my $folder=$env{'form.folder'};
@@ -1955,7 +1963,13 @@ ENDPARMS
return $line;
}
-# ---------------------------------------------------------------- tie the hash
+=pod
+
+=item tiehash()
+
+tie the hash
+
+=cut
sub tiehash {
my ($mode)=@_;
@@ -1981,7 +1995,8 @@ sub untiehash {
return OK;
}
-# --------------------------------------------------------------- check on this
+
+
sub checkonthis {
my ($r,$url,$level,$title)=@_;
@@ -1990,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(' ');
}
@@ -1999,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+)$/;
@@ -2009,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',
@@ -2018,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').'');
@@ -2042,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) = @_;
@@ -2072,9 +2094,7 @@ sub list_symbs {
}
-#
-# -------------------------------------------------------------- Verify Content
-#
+
sub verifycontent {
my ($r) = @_;
my $type = &Apache::loncommon::course_type();
@@ -2105,8 +2125,6 @@ sub verifycontent {
}
-# -------------------------------------------------------------- Check Versions
-
sub devalidateversioncache {
my $src=shift;
&Apache::lonnet::devalidate_cache_new('courseresversion',$env{'request.course.id'}.'_'.
@@ -2409,7 +2427,6 @@ sub changewarning {
$help{'Caching'}.''."\n\n");
}
-# =========================================== Breadcrumbs for special functions
sub init_breadcrumbs {
my ($form,$text)=@_;
@@ -2425,7 +2442,9 @@ sub init_breadcrumbs {
bug=>'Instructor Interface'});
}
-# ================================================================ Main Handler
+
+
+
sub handler {
my $r = shift;
&Apache::loncommon::content_type($r,'text/html');
@@ -3330,3 +3349,126 @@ ENDNEWSCRIPT
}
1;
__END__
+
+
+=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
+
+=item %help=()
+
+Available help topics
+
+=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
+
+=item authorhosts()
+
+Return hash with valid author names
+
+=item dumpbutton()
+
+Generate "dump" button
+
+=item clean()
+
+=item dumpcourse()
+
+ Actually dump course
+
+
+=item exportbutton()
+
+ Generate "export" button
+
+=item exportcourse()
+
+=item create_ims_store()
+
+=item build_package()
+
+=item get_dependencies()
+
+=item process_content()
+
+=item replicate_content()
+
+=item extract_media()
+
+=item store_template()
+
+=item group_import()
+
+ Imports the given (name, url) resources into the course
+ coursenum, coursedom, and folder must precede the list
+
+=item breadcrumbs()
+
+=item log_docs()
+
+=item docs_change_log()
+
+=item update_paste_buffer()
+
+=item print_paste_buffer()
+
+=item do_paste_from_buffer()
+
+=item update_parameter()
+
+=item handle_edit_cmd()
+
+=item editor()
+
+=item process_file_upload()
+
+=item process_secondary_uploads()
+
+=item is_supplemental_title()
+
+=item parse_supplemental_title()
+
+=item entryline()
+
+=item tiehash()
+
+=item untiehash()
+
+=item checkonthis()
+
+check on this
+
+=item verifycontent()
+
+Verify Content
+
+=item devalidateversioncache() & checkversions()
+
+Check Versions
+
+=item mark_hash_old()
+
+=item is_hash_old()
+
+=item changewarning()
+
+=item init_breadcrumbs()
+
+Breadcrumbs for special functions
+
+=back
+
+=cut