--- loncom/interface/londocs.pm 2006/05/01 19:37:33 1.226
+++ loncom/interface/londocs.pm 2006/06/30 03:44:03 1.236
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.226 2006/05/01 19:37:33 albertel Exp $
+# $Id: londocs.pm,v 1.236 2006/06/30 03:44:03 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -42,6 +42,8 @@ use HTML::Entities;
use GDBM_File;
use Apache::lonlocal;
use Cwd;
+use lib '/home/httpd/lib/perl/';
+use LONCAPA;
my $iconpath;
@@ -119,16 +121,18 @@ sub authorhosts {
sub dumpbutton {
my ($home,$other,%outhash)=&authorhosts();
+ my $type = &Apache::loncommon::course_type();
if ($home+$other==0) { return ''; }
my $output='
';
if ($home) {
return '
'.
''.
+ &mt('Dump '.$type.' DOCS to Construction Space').'" />'.
&Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs');
} else {
return'
'.
- &mt('Dump Course DOCS to Construction Space: available on other servers');
+ &mt('Dump '.$type.
+ ' DOCS to Construction Space: available on other servers');
}
}
@@ -141,8 +145,8 @@ sub clean {
sub dumpcourse {
my ($r) = @_;
-
- $r->print(&Apache::loncommon::start_page('Dump Course DOCS to Construction Space').
+ my $type = &Apache::loncommon::course_type();
+ $r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space').
'');
+ '');
}
}
# ------------------------------------------------------ Generate "export" button
sub exportbutton {
+ my $type = &Apache::loncommon::course_type();
return '
'.
''.
+ &mt('Export '.$type.' to IMS').'" />'.
&Apache::loncommon::help_open_topic('Docs_Export_Course_Docs');
}
sub exportcourse {
my $r=shift;
+ my $type = &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;
@@ -299,7 +307,7 @@ sub exportcourse {
open(OUTPUT, "zip -r $imszip * 2> /dev/null |");
close(OUTPUT);
chdir $cwd;
- $outcome .= 'Download the zip file from IMS course archive ';
+ $outcome .= &mt('Download the zip file from IMS '.lc($type).' archive ',$imszipfile,);
if ($copyresult) {
$outcome .= 'The following errors occurred during export - '.$copyresult;
}
@@ -307,13 +315,13 @@ sub exportcourse {
$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. ';
}
}
- $r->print(&Apache::loncommon::start_page('Export course to IMS content package'));
+ $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package'));
$r->print($outcome);
$r->print(&Apache::loncommon::end_page());
} else {
my $display;
$display = ''.
+ &mt('Export '.$type.' DOCS').'" />'.
&Apache::loncommon::end_page());
}
}
@@ -948,11 +956,10 @@ sub breadcrumbs {
my $folderpath;
my $cpinfo='';
if ($env{'form.markedcopy_url'}) {
- &Apache::lonnet::logthis('Found '.$env{'form.markedcopy_url'});
$cpinfo='&markedcopy_url='.
- &Apache::lonnet::escape($env{'form.markedcopy_url'}).
+ &escape($env{'form.markedcopy_url'}).
'&markedcopy_title='.
- &Apache::lonnet::escape($env{'form.markedcopy_title'});
+ &escape($env{'form.markedcopy_title'});
}
while (@folders) {
my $folder=shift(@folders);
@@ -960,17 +967,18 @@ sub breadcrumbs {
if ($folderpath) {$folderpath.='&';}
$folderpath.=$folder.'&'.$foldername;
my $url='/adm/coursedocs?folderpath='.
- &Apache::lonnet::escape($folderpath);
+ &escape($folderpath);
&Apache::lonhtmlcommon::add_breadcrumb(
{'href'=>$url.$cpinfo,
- 'title'=>&Apache::lonnet::unescape($foldername),
+ 'title'=>&unescape($foldername),
'text'=>''.
- &Apache::lonnet::unescape($foldername).''
+ &unescape($foldername).''
});
}
- return &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp');
+ return &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp',
+ 'LC_docs_path');
}
sub editor {
@@ -1167,11 +1175,12 @@ sub editor {
# Group import/search
if ($env{'form.importdetail'}) {
my @imports;
+ &Apache::lonnet::logthis("imp detail ".$env{'form.importdetail'});
foreach (split(/\&/,$env{'form.importdetail'})) {
if (defined($_)) {
my ($name,$url)=split(/\=/,$_);
- $name=&Apache::lonnet::unescape($name);
- $url=&Apache::lonnet::unescape($url);
+ $name=&unescape($name);
+ $url=&unescape($url);
push @imports, $name, $url;
}
}
@@ -1324,14 +1333,14 @@ sub process_file_upload {
method="post" enctype="multipart/form-data">
-
+
';
$$upload_output .= 'Upload embedded files:
';
foreach my $embed_file (keys(%{$allfiles})) {
$$upload_output .= '
'.$embed_file.
'
- ';
+ ';
my $attrib;
if (@{$$allfiles{$embed_file}} > 1) {
$attrib = join(':',@{$$allfiles{$embed_file}});
@@ -1342,7 +1351,7 @@ sub process_file_upload {
'';
if (exists($$codebase{$embed_file})) {
$$upload_output .=
- '';
+ '';
}
$$upload_output .= '
';
$num ++;
@@ -1385,7 +1394,7 @@ sub entryline {
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_;
$title=~s/\&colon\;/\:/g;
$title=&HTML::Entities::encode(&HTML::Entities::decode(
- &Apache::lonnet::unescape($title)),'"<>&\'');
+ &unescape($title)),'"<>&\'');
my $renametitle=$title;
my $foldertitle=$title;
my $pagetitle=$title;
@@ -1405,21 +1414,21 @@ sub entryline {
my $folderpath;
if ($env{'form.folderpath'}) {
$container = 'sequence';
- $folderpath=&Apache::lonnet::escape($env{'form.folderpath'});
+ $folderpath=&escape($env{'form.folderpath'});
# $htmlfoldername=&HTML::Entities::encode($env{'form.foldername'},'<>&"');
}
my ($pagepath,$pagesymb);
if ($env{'form.pagepath'}) {
$container = 'page';
- $pagepath=&Apache::lonnet::escape($env{'form.pagepath'});
- $pagesymb=&Apache::lonnet::escape($env{'form.pagesymb'});
+ $pagepath=&escape($env{'form.pagepath'});
+ $pagesymb=&escape($env{'form.pagesymb'});
}
my $cpinfo='';
if ($env{'form.markedcopy_url'}) {
$cpinfo='&markedcopy_url='.
- &Apache::lonnet::escape($env{'form.markedcopy_url'}).
+ &escape($env{'form.markedcopy_url'}).
'&markedcopy_title='.
- &Apache::lonnet::escape($env{'form.markedcopy_title'});
+ &escape($env{'form.markedcopy_title'});
}
if ($allowed) {
my $incindex=$index+1;
@@ -1577,21 +1586,21 @@ END
} elsif ($url=~m|^/ext/|) {
$url='/adm/wrapper'.$url;
}
- $url.=(($url=~/\?/)?'&':'?').'symb='.&Apache::lonnet::escape($symb);
+ $url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb);
if ($container eq 'page') {
my $symb=$env{'form.pagesymb'};
$url=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($symb))[2]);
- $url.=(($url=~/\?/)?'&':'?').'symb='.&Apache::lonnet::escape($symb);
+ $url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb);
}
}
my $parameterset=' ';
if ($isfolder || $extension eq 'sequence') {
- my $foldername=&Apache::lonnet::escape($foldertitle);
+ my $foldername=&escape($foldertitle);
my $folderpath=$env{'form.folderpath'};
if ($folderpath) { $folderpath.='&' };
$folderpath.=$folderarg.'&'.$foldername;
- $url.='folderpath='.&Apache::lonnet::escape($folderpath).$cpinfo;
+ $url.='folderpath='.&escape($folderpath).$cpinfo;
$parameterset='