--- loncom/interface/londocs.pm 2006/04/10 19:59:53 1.225
+++ loncom/interface/londocs.pm 2006/05/30 20:09:25 1.229
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.225 2006/04/10 19:59:53 albertel Exp $
+# $Id: londocs.pm,v 1.229 2006/05/30 20:09:25 raeburn 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,21 @@ sub authorhosts {
sub dumpbutton {
my ($home,$other,%outhash)=&authorhosts();
+ my $type = 'Course';
+ if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
+ $type = $env{'course.'.$env{'request.course.id'}.'.type'};
+ }
if ($home+$other==0) { return ''; }
my $output='
';
if ($home) {
return '
'.
''.
+ &mt('Dump [_1] DOCS to Construction Space',$type).'" />'.
&Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs');
} else {
return'
'.
- &mt('Dump Course DOCS to Construction Space: available on other servers');
+ &mt('Dump [_1] DOCS to Construction Space: available on other servers',
+ $type);
}
}
@@ -141,9 +148,12 @@ sub clean {
sub dumpcourse {
my ($r) = @_;
-
- $r->print(&Apache::loncommon::start_page('Dump Course DOCS to Construction Space').
- '');
+ '');
}
}
# ------------------------------------------------------ Generate "export" button
sub exportbutton {
+ my $type = 'Course';
+ if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
+ $type = $env{'course.'.$env{'request.course.id'}.'.type'};
+ }
return '
'.
''.
+ &mt('Export [_1] to IMS',$type).'" />'.
&Apache::loncommon::help_open_topic('Docs_Export_Course_Docs');
}
sub exportcourse {
my $r=shift;
+ my $type = 'Course';
+ if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
+ $type = $env{'course.'.$env{'request.course.id'}.'.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 +317,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 [_2] archive ',$imszipfile,lc($type));
if ($copyresult) {
$outcome .= 'The following errors occurred during export - '.$copyresult;
}
@@ -307,13 +325,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 [_1] DOCS',$type).'" />'.
&Apache::loncommon::end_page());
}
}
@@ -950,9 +968,9 @@ sub breadcrumbs {
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,18 +978,17 @@ 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,undef,undef,undef,
- 0,'nohelp');
+ return &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp');
}
sub editor {
@@ -1171,8 +1188,8 @@ sub editor {
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;
}
}
@@ -1325,14 +1342,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}});
@@ -1343,7 +1360,7 @@ sub process_file_upload {
'';
if (exists($$codebase{$embed_file})) {
$$upload_output .=
- '';
+ '';
}
$$upload_output .= '
';
$num ++;
@@ -1386,7 +1403,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;
@@ -1406,21 +1423,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;
@@ -1578,21 +1595,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='