-
-
-
-
+
+
+
+
@@ -1320,9 +1300,9 @@ END
} else {
$line.=(<
-
-
-
+
+
+
@@ -1375,8 +1355,8 @@ END
if ((!$isfolder) && ($residx) && ($folder!~/supplemental/) && (!$ispage)) {
my $symb=&Apache::lonnet::symbclean(
&Apache::lonnet::declutter('uploaded/'.
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.'/'.
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'}.'/'.$folder.
+ $env{'course.'.$env{'request.course.id'}.'.domain'}.'/'.
+ $env{'course.'.$env{'request.course.id'}.'.num'}.'/'.$folder.
'.sequence').
'___'.$residx.'___'.
&Apache::lonnet::declutter($url));
@@ -1397,7 +1377,7 @@ END
}
$url.=(($url=~/\?/)?'&':'?').'symb='.&Apache::lonnet::escape($symb);
if ($container eq 'page') {
- my $symb=$ENV{'form.pagesymb'};
+ my $symb=$env{'form.pagesymb'};
$url=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($symb))[2]);
$url.=(($url=~/\?/)?'&':'?').'symb='.&Apache::lonnet::escape($symb);
@@ -1406,7 +1386,7 @@ END
my $parameterset=' ';
if ($isfolder) {
my $foldername=&Apache::lonnet::escape($foldertitle);
- my $folderpath=$ENV{'form.folderpath'};
+ my $folderpath=$env{'form.folderpath'};
if ($folderpath) { $folderpath.='&' };
$folderpath.=$folderarg.'&'.$foldername;
$url.='folderpath='.&Apache::lonnet::escape($folderpath).$cpinfo;
@@ -1421,14 +1401,14 @@ END
if ($ispage) {
my $pagename=&Apache::lonnet::escape($pagetitle);
my $pagepath;
- my $folderpath=$ENV{'form.folderpath'};
+ my $folderpath=$env{'form.folderpath'};
if ($folderpath) { $pagepath = $folderpath.'&' };
$pagepath.=$pagearg.'&'.$pagename;
- my $symb=$ENV{'form.pagesymb'};
+ my $symb=$env{'form.pagesymb'};
if (!$symb) {
my $path='uploaded/'.
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.'/'.
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'}.'/';
+ $env{'course.'.$env{'request.course.id'}.'.domain'}.'/'.
+ $env{'course.'.$env{'request.course.id'}.'.num'}.'/';
$symb=&Apache::lonnet::encode_symb($path.$folder.'.sequence',
$residx,
$path.$pagearg.'.page');
@@ -1464,14 +1444,14 @@ ENDPARMS
sub tiehash {
my ($mode)=@_;
$hashtied=0;
- if ($ENV{'request.course.fn'}) {
+ if ($env{'request.course.fn'}) {
if ($mode eq 'write') {
- if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.".db",
+ if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.".db",
&GDBM_WRCREAT(),0640)) {
$hashtied=2;
}
} else {
- if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.".db",
+ if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.".db",
&GDBM_READER(),0640)) {
$hashtied=1;
}
@@ -1501,7 +1481,7 @@ sub checkonthis {
if ($url=~/^\/res\//) {
my $result=&Apache::lonnet::repcopy(
&Apache::lonnet::filelocation('',$url));
- if ($result eq 'OK') {
+ if ($result eq 'ok') {
$r->print(''.&mt('ok').'');
$r->rflush();
&Apache::lonnet::countacc($url);
@@ -1515,7 +1495,8 @@ sub checkonthis {
$r->print('- '.&mt('Rendering').': ');
my ($errorcount,$warningcount)=split(/:/,
&Apache::lonnet::ssi_body($url,
- ('return_only_error_and_warning_counts' => 1)));
+ ('grade_target'=>'web',
+ 'return_only_error_and_warning_counts' => 1)));
if (($errorcount) ||
($warningcount)) {
if ($errorcount) {
@@ -1540,9 +1521,9 @@ sub checkonthis {
&checkonthis($r,$_,$level+1);
}
}
- } elsif ($result eq 'HTTP_SERVICE_UNAVAILABLE') {
+ } elsif ($result eq 'unavailable') {
$r->print(''.&mt('connection down').'');
- } elsif ($result eq 'HTTP_NOT_FOUND') {
+ } elsif ($result eq 'not_found') {
unless ($url=~/\$/) {
$r->print(''.&mt('not found').'');
} else {
@@ -1605,20 +1586,20 @@ sub checkversions {
my $starttime=0;
my $haschanged=0;
my %setversions=&Apache::lonnet::dump('resourceversions',
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
+ $env{'course.'.$env{'request.course.id'}.'.domain'},
+ $env{'course.'.$env{'request.course.id'}.'.num'});
$hashtied=0;
&tiehash();
my %newsetversions=();
- if ($ENV{'form.setmostrecent'}) {
+ if ($env{'form.setmostrecent'}) {
$haschanged=1;
foreach (keys %hash) {
if ($_=~/^ids\_(\/res\/.+)$/) {
$newsetversions{$1}='mostrecent';
}
}
- } elsif ($ENV{'form.setcurrent'}) {
+ } elsif ($env{'form.setcurrent'}) {
$haschanged=1;
foreach (keys %hash) {
if ($_=~/^ids\_(\/res\/.+)$/) {
@@ -1628,21 +1609,21 @@ sub checkversions {
}
}
}
- } elsif ($ENV{'form.setversions'}) {
+ } elsif ($env{'form.setversions'}) {
$haschanged=1;
- foreach (keys %ENV) {
+ foreach (keys %env) {
if ($_=~/^form\.set_version_(.+)$/) {
my $src=$1;
- if (($ENV{$_}) && ($ENV{$_} ne $setversions{$src})) {
- $newsetversions{$src}=$ENV{$_};
+ if (($env{$_}) && ($env{$_} ne $setversions{$src})) {
+ $newsetversions{$src}=$env{$_};
}
}
}
}
if ($haschanged) {
if (&Apache::lonnet::put('resourceversions',\%newsetversions,
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'}) eq 'ok') {
+ $env{'course.'.$env{'request.course.id'}.'.domain'},
+ $env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') {
$r->print(''.&mt('Your Version Settings have been Stored').'');
} else {
$r->print(''.&mt('An Error Occured while Attempting to Store your Version Settings').'');
@@ -1650,7 +1631,7 @@ sub checkversions {
&mark_hash_old();
}
&changewarning($r,'');
- if ($ENV{'form.timerange'} eq 'all') {
+ if ($env{'form.timerange'} eq 'all') {
# show all documents
$header=&mt('All Documents in Course');
$allsel=1;
@@ -1663,28 +1644,28 @@ sub checkversions {
} else {
# show documents which changed
%changes=&Apache::lonnet::dump
- ('versionupdate',$ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
+ ('versionupdate',$env{'course.'.$env{'request.course.id'}.'.domain'},
+ $env{'course.'.$env{'request.course.id'}.'.num'});
my $firstkey=(keys %changes)[0];
unless ($firstkey=~/^error\:/) {
- unless ($ENV{'form.timerange'}) {
- $ENV{'form.timerange'}=604800;
+ unless ($env{'form.timerange'}) {
+ $env{'form.timerange'}=604800;
}
- my $seltext=&mt('during the last').' '.$ENV{'form.timerange'}.' '
+ my $seltext=&mt('during the last').' '.$env{'form.timerange'}.' '
.&mt('seconds');
- if ($ENV{'form.timerange'}==-1) {
+ if ($env{'form.timerange'}==-1) {
$seltext='since start of course';
$startsel='selected';
- $ENV{'form.timerange'}=time;
+ $env{'form.timerange'}=time;
}
- $starttime=time-$ENV{'form.timerange'};
- if ($ENV{'form.timerange'}==2592000) {
+ $starttime=time-$env{'form.timerange'};
+ if ($env{'form.timerange'}==2592000) {
$seltext=&mt('during the last month').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
$monthsel='selected';
- } elsif ($ENV{'form.timerange'}==604800) {
+ } elsif ($env{'form.timerange'}==604800) {
$seltext=&mt('during the last week').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
$weeksel='selected';
- } elsif ($ENV{'form.timerange'}==86400) {
+ } elsif ($env{'form.timerange'}==86400) {
$seltext=&mt('since yesterday').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
$daysel='selected';
}
@@ -1694,8 +1675,8 @@ sub checkversions {
}
}
%setversions=&Apache::lonnet::dump('resourceversions',
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
+ $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',
'lm' => 'Version changes since last Month',
@@ -1856,25 +1837,29 @@ sub is_hash_old {
}
sub changewarning {
- my ($r,$postexec)=@_;
+ my ($r,$postexec,$message,$url)=@_;
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'});
+ my $path=&Apache::lonnet::escape($env{'form.folderpath'});
+ if (!defined($url)) {
+ if (defined($env{'form.pagepath'})) {
+ $pathvar='pagepath';
+ $path=&Apache::lonnet::escape($env{'form.pagepath'});
+ $path.='&symb='.&Apache::lonnet::escape($env{'form.pagesymb'});
+ }
+ $url='/adm/coursedocs?'.$pathvar.'='.$path;
+ }
+ if (!defined($message)) {
+ $message='Changes will become active for your current session after [_1], or the next time you log in.';
}
$r->print(
''.
'');
}
@@ -1907,18 +1892,18 @@ sub handler {
'Docs_About_My_Personal_Info,Docs_Editing_Templated_Pages');
$help{'Caching'} = &Apache::loncommon::help_open_topic('Caching');
- if ($ENV{'form.verify'}) {
+ if ($env{'form.verify'}) {
&verifycontent($r);
- } elsif ($ENV{'form.versions'}) {
+ } elsif ($env{'form.versions'}) {
&checkversions($r);
- } elsif ($ENV{'form.dumpcourse'}) {
+ } elsif ($env{'form.dumpcourse'}) {
&dumpcourse($r);
- } elsif ($ENV{'form.exportcourse'}) {
+ } elsif ($env{'form.exportcourse'}) {
&exportcourse($r);
} else {
# is this a standard course?
- my $standard=($ENV{'request.course.uri'}=~/^\/uploaded\//);
+ my $standard=($env{'request.course.uri'}=~/^\/uploaded\//);
my $forcestandard = 0;
my $forcesupplement;
my $script='';
@@ -1929,32 +1914,32 @@ sub handler {
my $uploadtag;
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['folderpath','pagepath','pagesymb','markedcopy_url','markedcopy_title']);
- if ($ENV{'form.folderpath'}) {
- my (@folderpath)=split('&',$ENV{'form.folderpath'});
- $ENV{'form.foldername'}=&Apache::lonnet::unescape(pop(@folderpath));
- $ENV{'form.folder'}=pop(@folderpath);
- }
- if ($ENV{'form.pagepath'}) {
- my (@pagepath)=split('&',$ENV{'form.pagepath'});
- $ENV{'form.pagename'}=&Apache::lonnet::unescape(pop(@pagepath));
- $ENV{'form.folder'}=pop(@pagepath);
+ if ($env{'form.folderpath'}) {
+ my (@folderpath)=split('&',$env{'form.folderpath'});
+ $env{'form.foldername'}=&Apache::lonnet::unescape(pop(@folderpath));
+ $env{'form.folder'}=pop(@folderpath);
+ }
+ if ($env{'form.pagepath'}) {
+ my (@pagepath)=split('&',$env{'form.pagepath'});
+ $env{'form.pagename'}=&Apache::lonnet::unescape(pop(@pagepath));
+ $env{'form.folder'}=pop(@pagepath);
$containertag = ''.
'';
- $uploadtag = ''.
- '';
+ $uploadtag = ''.
+ '';
}
if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
$showdoc='/'.$1;
}
unless ($showdoc) { # got called from remote
- if (($ENV{'form.folder'}=~/^default_/) ||
- ($ENV{'form.folder'} =~ m#^\d+/(pages|sequences)/#)) {
+ if (($env{'form.folder'}=~/^default_/) ||
+ ($env{'form.folder'} =~ m#^\d+/(pages|sequences)/#)) {
$forcestandard = 1;
}
- $forcesupplement=($ENV{'form.folder'}=~/^supplemental_/);
+ $forcesupplement=($env{'form.folder'}=~/^supplemental_/);
# does this user have privileges to post, etc?
- $allowed=&Apache::lonnet::allowed('mdc',$ENV{'request.course.id'});
+ $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});
if ($allowed) {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']);
$script=&Apache::lonratedt::editscript('simple');
@@ -1967,19 +1952,19 @@ sub handler {
}
# get course data
- my $coursenum=$ENV{'course.'.$ENV{'request.course.id'}.'.num'};
- my $coursedom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
+ my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'};
+ my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'};
# get personal data
- my $uname=$ENV{'user.name'};
- my $udom=$ENV{'user.domain'};
+ my $uname=$env{'user.name'};
+ my $udom=$env{'user.domain'};
my $plainname=&Apache::lonnet::escape(
&Apache::loncommon::plainname($uname,$udom));
# graphics settings
- $iconpath = $r->dir_config('lonIconsURL') . "/";
+ $iconpath = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL') . "/");
my $now=time;
@@ -2194,15 +2179,15 @@ ENDNEWSCRIPT
'cv' => 'Check/Set Resource Versions',
);
- my $folderpath=$ENV{'form.folderpath'};
+ my $folderpath=$env{'form.folderpath'};
if (!$folderpath) {
- if ($ENV{'form.folder'} eq '' ||
- $ENV{'form.folder'} eq 'supplemental') {
+ if ($env{'form.folder'} eq '' ||
+ $env{'form.folder'} eq 'supplemental') {
$folderpath='default&'.
&Apache::lonnet::escape(&mt('Main Course Documents'));
}
}
- unless ($ENV{'form.pagepath'}) {
+ unless ($env{'form.pagepath'}) {
$containertag = '';
$uploadtag = '';
}
@@ -2238,10 +2223,10 @@ ENDCOURSEVERIFY
$r->print(' | ');
# ''.&mt('Main Course Documents').
# ($allowed?' '.$help{'Main_Course_Documents'}:'').'');
- my $folder=$ENV{'form.folder'};
+ my $folder=$env{'form.folder'};
if ($folder eq '' || $folder eq 'supplemental') {
$folder='default';
- $ENV{'form.folderpath'}='default&'.&Apache::lonnet::escape(&mt('Main Course Documents'));
+ $env{'form.folderpath'}='default&'.&Apache::lonnet::escape(&mt('Main Course Documents'));
}
my $postexec='';
if ($folder eq 'default') {
@@ -2301,7 +2286,7 @@ $help{'Load_Map'}
ENDFORM
- unless ($ENV{'form.pagepath'}) {
+ unless ($env{'form.pagepath'}) {
$r->print(<
| ');
- unless ($ENV{'form.pagepath'}) {
+ unless ($env{'form.pagepath'}) {
$r->print(<
-
+
$help{'Adding_Fold
| | | |