--- loncom/interface/londocs.pm 2004/09/18 17:06:57 1.146
+++ loncom/interface/londocs.pm 2005/03/02 22:26:36 1.169
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.146 2004/09/18 17:06:57 albertel Exp $
+# $Id: londocs.pm,v 1.169 2005/03/02 22:26:36 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -30,6 +30,7 @@ package Apache::londocs;
use strict;
use Apache::Constants qw(:common :http);
+use Apache::imsexport;
use Apache::lonnet;
use Apache::loncommon;
use Apache::lonratedt;
@@ -131,11 +132,17 @@ sub dumpbutton {
}
}
+sub clean {
+ my ($title)=@_;
+ $title=~s/[^\w\/\!\$\%\^\*\-\_\=\+\;\:\,\\\|\`\~]+/\_/gs;
+ return $title;
+}
# -------------------------------------------------------- Actually dump course
sub dumpcourse {
my $r=shift;
- $r->print('
Dump DOCS'.
+ my $html=&Apache::lonxml::xmlbegin();
+ $r->print($html.'Dump DOCS'.
&Apache::loncommon::bodytag('Dump Course DOCS to Construction Space').
'";
@@ -1205,33 +1452,24 @@ ENDPARMS
sub tiehash {
my ($mode)=@_;
$hashtied=0;
- &Apache::lonnet::logthis(" tiehash1 -- $hashtied ");
if ($ENV{'request.course.fn'}) {
- &Apache::lonnet::logthis(" tiehash2 -- $hashtied ");
if ($mode eq 'write') {
- &Apache::lonnet::logthis(" tiehash3 -- $hashtied ");
if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.".db",
&GDBM_WRCREAT(),0640)) {
$hashtied=2;
- &Apache::lonnet::logthis(" tiehash4 -- $hashtied ");
}
} else {
- &Apache::lonnet::logthis(" tiehash5 -- $hashtied ");
if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.".db",
&GDBM_READER(),0640)) {
$hashtied=1;
- &Apache::lonnet::logthis(" tiehash6 -- $hashtied ");
}
}
}
- &Apache::lonnet::logthis(" tiehash7 -- $hashtied ");
}
sub untiehash {
- &Apache::lonnet::logthis(" untiehash1 -- $hashtied ");
if ($hashtied) { untie %hash; }
$hashtied=0;
- &Apache::lonnet::logthis(" untiehash2 -- $hashtied ");
}
# --------------------------------------------------------------- check on this
@@ -1251,7 +1489,7 @@ sub checkonthis {
if ($url=~/^\/res\//) {
my $result=&Apache::lonnet::repcopy(
&Apache::lonnet::filelocation('',$url));
- if ($result==OK) {
+ if ($result eq 'OK') {
$r->print(''.&mt('ok').'');
$r->rflush();
&Apache::lonnet::countacc($url);
@@ -1294,9 +1532,9 @@ sub checkonthis {
&checkonthis($r,$_,$level+1);
}
}
- } elsif ($result==HTTP_SERVICE_UNAVAILABLE) {
+ } elsif ($result eq 'HTTP_SERVICE_UNAVAILABLE') {
$r->print(''.&mt('connection down').'');
- } elsif ($result==HTTP_NOT_FOUND) {
+ } elsif ($result eq 'HTTP_NOT_FOUND') {
unless ($url=~/\$/) {
$r->print(''.&mt('not found').'');
} else {
@@ -1317,8 +1555,8 @@ sub verifycontent {
my $r=shift;
my $loaderror=&Apache::lonnet::overloaderror($r);
if ($loaderror) { return $loaderror; }
-
- $r->print('Verify Content'.
+ my $html=&Apache::lonxml::xmlbegin();
+ $r->print($html.'Verify Content'.
&Apache::loncommon::bodytag('Verify Course Documents'));
$hashtied=0;
undef %alreadyseen;
@@ -1346,7 +1584,8 @@ sub verifycontent {
sub checkversions {
my $r=shift;
- $r->print('Check Versions'.
+ my $html=&Apache::lonxml::xmlbegin();
+ $r->print($html.'Check Versions'.
&Apache::loncommon::bodytag('Check Course Document Versions'));
my $header='';
my $startsel='';
@@ -1587,21 +1826,14 @@ ENDHEADERS
sub mark_hash_old {
my $retie_hash=0;
- &Apache::lonnet::logthis(" markold1 -- $hashtied $retie_hash ");
if ($hashtied) {
$retie_hash=1;
- &Apache::lonnet::logthis(" markold2 -- $hashtied $retie_hash ");
&untiehash();
- &Apache::lonnet::logthis(" markold3 -- $hashtied $retie_hash ");
}
&tiehash('write');
- &Apache::lonnet::logthis(" markold4 -- $hashtied $retie_hash ");
$hash{'old'}=1;
- &Apache::lonnet::logthis(" markold5 -- $hashtied $retie_hash ");
&untiehash();
- &Apache::lonnet::logthis(" markold6 -- $hashtied $retie_hash ");
if ($retie_hash) { &tiehash(); }
- &Apache::lonnet::logthis(" markold7 -- $hashtied $retie_hash ");
}
sub is_hash_old {
@@ -1618,11 +1850,18 @@ sub is_hash_old {
sub changewarning {
my ($r,$postexec)=@_;
if (!&is_hash_old()) { return; }
+ my $pathvar='folderpath';
+ my $path=&Apache::lonnet::escape($ENV{'form.folderpath'});
+ if (defined($ENV{'form.pagepath'})) {
+ $pathvar='pagepath';
+ $path=&Apache::lonnet::escape($ENV{'form.pagepath'});
+ $path.='&symb='.&Apache::lonnet::escape($ENV{'form.pagesymb'});
+ }
$r->print(
''.
'
'.
-'
'.
&mt('Changes will become active for your current session after').
' ';
- $uploadtag = '';
+ $containertag = ''.
+ '';
+ $uploadtag = ''.
+ '';
}
if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
$showdoc='/'.$1;
}
unless ($showdoc) { # got called from remote
- $forcestandard=($ENV{'form.folder'}=~/^default_/);
+ if (($ENV{'form.folder'}=~/^default_/) ||
+ ($ENV{'form.folder'} =~ m#^\d+/(pages|sequences)/#)) {
+ $forcestandard = 1;
+ }
$forcesupplement=($ENV{'form.folder'}=~/^supplemental_/);
# does this user have privileges to post, etc?
@@ -1732,8 +1976,9 @@ sub handler {
my $now=time;
# print screen
+ my $html=&Apache::lonxml::xmlbegin();
$r->print(<
+$html
The LearningOnline Network with CAPA
ENDNEWSCRIPT
@@ -1874,7 +2137,9 @@ ENDNEWSCRIPT
my %lt=&Apache::lonlocal::texthash(
'uplm' => 'Upload a new main course document',
'upls' => 'Upload a new supplemental course document',
- 'impp' => 'Import a published document',
+ 'impp' => 'Import a document',
+ 'pubd' => 'Published documents',
+ 'copm' => 'All documents out of a published map',
'spec' => 'Special documents',
'upld' => 'Upload Document',
'srch' => 'Search',
@@ -1923,6 +2188,7 @@ ENDNEWSCRIPT