--- loncom/interface/londocs.pm 2006/05/30 12:46:09 1.228
+++ 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.228 2006/05/30 12:46:09 www Exp $
+# $Id: londocs.pm,v 1.236 2006/06/30 03:44:03 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -121,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');
}
}
@@ -143,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;
@@ -301,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;
}
@@ -309,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());
}
}
@@ -950,7 +956,6 @@ sub breadcrumbs {
my $folderpath;
my $cpinfo='';
if ($env{'form.markedcopy_url'}) {
- &Apache::lonnet::logthis('Found '.$env{'form.markedcopy_url'});
$cpinfo='&markedcopy_url='.
&escape($env{'form.markedcopy_url'}).
'&markedcopy_title='.
@@ -972,7 +977,8 @@ sub breadcrumbs {
}
- return &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp');
+ return &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp',
+ 'LC_docs_path');
}
sub editor {
@@ -1169,6 +1175,7 @@ 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(/\=/,$_);
@@ -1764,9 +1771,10 @@ sub list_symbs {
#
sub verifycontent {
my ($r) = @_;
+ my $type = &Apache::loncommon::course_type();
my $loaderror=&Apache::lonnet::overloaderror($r);
if ($loaderror) { return $loaderror; }
- $r->print(&Apache::loncommon::start_page('Verify Course Documents'));
+ $r->print(&Apache::loncommon::start_page('Verify '.$type.' Documents'));
$hashtied=0;
undef %alreadyseen;
%alreadyseen=();
@@ -1775,7 +1783,7 @@ sub verifycontent {
if ($hash{$_}=~/\.(page|sequence)$/) {
if (($_=~/^src_/) && ($alreadyseen{&unescape($hash{$_})})) {
$r->print(''.
- &mt('The following sequence or page is included more than once in your course: ').
+ &mt('The following sequence or page is included more than once in your '.$type.': ').
&unescape($hash{$_}).' '.
&mt('Note that grading records for problems included in this sequence or folder will overlap.'));
}
@@ -1800,7 +1808,8 @@ sub devalidateversioncache {
sub checkversions {
my ($r) = @_;
- $r->print(&Apache::loncommon::start_page('Check Course Document Versions'));
+ my $type = &Apache::loncommon::course_type();
+ $r->print(&Apache::loncommon::start_page("Check $type Document Versions"));
my $header='';
my $startsel='';
my $monthsel='';
@@ -1861,7 +1870,7 @@ sub checkversions {
&changewarning($r,'');
if ($env{'form.timerange'} eq 'all') {
# show all documents
- $header=&mt('All Documents in Course');
+ $header=&mt('All Documents in '.$type);
$allsel=1;
foreach (keys %hash) {
if ($_=~/^ids\_(\/res\/.+)$/) {
@@ -1906,7 +1915,7 @@ sub checkversions {
$env{'course.'.$env{'request.course.id'}.'.domain'},
$env{'course.'.$env{'request.course.id'}.'.num'});
my %lt=&Apache::lonlocal::texthash
- ('st' => 'Version changes since start of Course',
+ ('st' => 'Version changes since start of '.$type,
'lm' => 'Version changes since last Month',
'lw' => 'Version changes since last Week',
'sy' => 'Version changes since Yesterday',
@@ -1915,9 +1924,9 @@ sub checkversions {
'fi' => 'File',
'md' => 'Modification Date',
'mr' => 'Most recently published Version',
- 've' => 'Version used in Course',
- 'vu' => 'Set Version to be used in Course',
-'sv' => 'Set Versions to be used in Course according to Selections below',
+ 've' => 'Version used in '.$type,
+ 'vu' => 'Set Version to be used in '.$type,
+'sv' => 'Set Versions to be used in '.$type.' according to Selections below',
'sm' => 'Keep all Resources up-to-date with most recent Versions (default)',
'sc' => 'Set all Resource Versions to current Version (Fix Versions)',
'di' => 'Differences');
@@ -1964,7 +1973,7 @@ ENDHEADERS
'
Most Recent: '.
''.$currentversion.''.
'
'.
- '
In Course: '.
+ '
In '.$type.': '.
'');
# Used in course
my $usedversion=$hash{'version_'.$linkurl};
@@ -2077,6 +2086,7 @@ sub changewarning {
}
$url='/adm/coursedocs?'.$pathvar.'='.$path;
}
+ my $course_type = &Apache::loncommon::course_type();
if (!defined($message)) {
$message='Changes will become active for your current session after [_1], or the next time you log in.';
}
@@ -2087,7 +2097,7 @@ sub changewarning {
'" />
'."\n\n");
}
@@ -2097,6 +2107,7 @@ sub handler {
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
return OK if $r->header_only;
+ my $type = &Apache::loncommon::course_type();
# --------------------------------------------- Initialize help topics for this
foreach ('Adding_Course_Doc','Main_Course_Documents',
@@ -2198,9 +2209,9 @@ sub handler {
}
# -------------------------------------------------------------------- Body tag
$script = '';
- $r->print(&Apache::loncommon::start_page('Course Documents', $script,
+ $r->print(&Apache::loncommon::start_page("$type Documents", $script,
{'force_register' => $showdoc,}).
- &Apache::loncommon::help_open_menu('','','','',273,'RAT'));
+ &Apache::loncommon::help_open_menu('','',273,'RAT'));
my %allfiles = ();
my %codebase = ();
@@ -2287,8 +2298,8 @@ sub handler {
unless ($showdoc || $upload_result eq 'phasetwo') {
# -----------------------------------------------------------------------------
my %lt=&Apache::lonlocal::texthash(
- 'uplm' => 'Upload a new main course document',
- 'upls' => 'Upload a new supplemental course document',
+ 'uplm' => 'Upload a new main '.lc($type).' document',
+ 'upls' => 'Upload a new supplemental '.lc($type).' document',
'impp' => 'Import a document',
'pubd' => 'Published documents',
'copm' => 'All documents out of a published map into this folder',
@@ -2296,6 +2307,7 @@ sub handler {
'upld' => 'Upload Document',
'srch' => 'Search',
'impo' => 'Import',
+ 'book' => 'Import Bookmarks',
'selm' => 'Select Map',
'load' => 'Load Map',
'reco' => 'Recover Deleted Resources',
@@ -2332,7 +2344,7 @@ sub handler {
if ($env{'form.folder'} eq '' ||
$env{'form.folder'} eq 'supplemental') {
$folderpath='default&'.
- &escape(&mt('Main Course Documents'));
+ &escape(&mt('Main '.$type.' Documents'));
}
}
unless ($env{'form.pagepath'}) {
@@ -2365,7 +2377,7 @@ $exportbut
ENDCOURSEVERIFY
$r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
- &mt('Editing the Table of Contents for your Course')));
+ &mt('Editing the Table of Contents for your '.$type)));
}
# --------------------------------------------------------- Standard documents
$r->print('
');
@@ -2376,7 +2388,7 @@ ENDCOURSEVERIFY
my $folder=$env{'form.folder'};
if ($folder eq '' || $folder eq 'supplemental') {
$folder='default';
- $env{'form.folderpath'}='default&'.&escape(&mt('Main Course Documents'));
+ $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents'));
}
my $postexec='';
if ($folder eq 'default') {
@@ -2432,11 +2444,14 @@ $uploadtag
ENDFORM
unless ($env{'form.pagepath'}) {
@@ -2607,7 +2622,7 @@ ENDBLOCK
if ($folder =~ /^supplemental$/ &&
$env{'form.folderpath'} =~ /^default\&/) {
$env{'form.folderpath'}='supplemental&'.
- &escape(&mt('Supplemental Course Documents'));
+ &escape(&mt('Supplemental '.$type.' Documents'));
}
&editor($r,$coursenum,$coursedom,$folder,$allowed);
if ($allowed) {
@@ -2712,7 +2727,7 @@ sub editing_js {
function makenewfolder(targetform,folderseq) {
var foldername=prompt('Name of New Folder','New Folder');
if (foldername) {
- targetform.importdetail.value=foldername+"="+folderseq;
+ targetform.importdetail.value=escape(foldername)+"="+folderseq;
targetform.submit();
}
}
@@ -2720,7 +2735,7 @@ function makenewfolder(targetform,folder
function makenewpage(targetform,folderseq) {
var pagename=prompt('Name of New Page','New Page');
if (pagename) {
- targetform.importdetail.value=pagename+"="+folderseq;
+ targetform.importdetail.value=escape(pagename)+"="+folderseq;
targetform.submit();
}
}
@@ -2734,7 +2749,7 @@ function makeexamupload() {
var title=prompt('Listed Title for the Uploaded Score');
if (title) {
this.document.forms.newexamupload.importdetail.value=
- title+'=/res/lib/templates/examupload.problem';
+ escape(title)+'=/res/lib/templates/examupload.problem';
this.document.forms.newexamupload.submit();
}
}
@@ -2743,7 +2758,7 @@ function makesmppage() {
var title=prompt('Listed Title for the Page');
if (title) {
this.document.forms.newsmppg.importdetail.value=
- title+'=/adm/$udom/$uname/$now/smppg';
+ escape(title)+'=/adm/$udom/$uname/$now/smppg';
this.document.forms.newsmppg.submit();
}
}
@@ -2752,7 +2767,7 @@ function makesmpproblem() {
var title=prompt('Listed Title for the Problem');
if (title) {
this.document.forms.newsmpproblem.importdetail.value=
- title+'=/res/lib/templates/simpleproblem.problem';
+ escape(title)+'=/res/lib/templates/simpleproblem.problem';
this.document.forms.newsmpproblem.submit();
}
}
@@ -2761,7 +2776,7 @@ function makedropbox() {
var title=prompt('Listed Title for the Drop Box');
if (title) {
this.document.forms.newdropbox.importdetail.value=
- title+'=/res/lib/templates/DropBox.problem';
+ escape(title)+'=/res/lib/templates/DropBox.problem';
this.document.forms.newdropbox.submit();
}
}
@@ -2770,26 +2785,26 @@ function makebulboard() {
var title=prompt('Listed Title for the Bulletin Board');
if (title) {
this.document.forms.newbul.importdetail.value=
- title+'=/adm/$udom/$uname/$now/bulletinboard';
+ escape(title)+'=/adm/$udom/$uname/$now/bulletinboard';
this.document.forms.newbul.submit();
}
}
function makeabout() {
- var user=prompt("Enter user\@domain for User's 'About Me' Page");
+ var user=prompt("Enter user:domain for User's 'About Me' Page");
if (user) {
var comp=new Array();
- comp=user.split('\@');
+ comp=user.split(':');
if ((typeof(comp[0])!=undefined) && (typeof(comp[1])!=undefined)) {
if ((comp[0]) && (comp[1])) {
this.document.forms.newaboutsomeone.importdetail.value=
- 'About '+user+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme';
+ 'About '+escape(user)+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme';
this.document.forms.newaboutsomeone.submit();
} else {
- alert("Not a valid user\@domain");
+ alert("Not a valid user:domain");
}
} else {
- alert("Please enter both user and domain in the format user\@domain");
+ alert("Please enter both user and domain in the format user:domain");
}
}
}