--- loncom/interface/londocs.pm 2006/06/26 22:31:56 1.233
+++ loncom/interface/londocs.pm 2006/07/21 00:21:28 1.243
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.233 2006/06/26 22:31:56 albertel Exp $
+# $Id: londocs.pm,v 1.243 2006/07/21 00:21:28 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -42,7 +42,6 @@ use HTML::Entities;
use GDBM_File;
use Apache::lonlocal;
use Cwd;
-use lib '/home/httpd/lib/perl/';
use LONCAPA;
my $iconpath;
@@ -237,8 +236,10 @@ sub dumpcourse {
'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$_}};
$title=~s/:/:/g;
$r->print('
'.($title?$title:' ').'
');
- unless ($title) {
+ if (!$title) {
$title=$_;
+ } else {
+ $title=~s|/|_|g;
}
$title=~s/\.(\w+)$//;
$title=&clean($title);
@@ -959,6 +960,9 @@ sub breadcrumbs {
'&markedcopy_title='.
&escape($env{'form.markedcopy_title'});
}
+ my $randompick=-1;
+ my $isencrypted=0;
+ my $ishidden=0;
while (@folders) {
my $folder=shift(@folders);
my $foldername=shift(@folders);
@@ -966,16 +970,25 @@ sub breadcrumbs {
$folderpath.=$folder.'&'.$foldername;
my $url='/adm/coursedocs?folderpath='.
&escape($folderpath);
+ my $name=&unescape($foldername);
+# randompick number, hidden, encrypted is appended with ":"s to the foldername
+ $name=~s/\:(\d*)\:(\w*)\:(\w*)$//;
+ if ($1 ne '') {
+ $randompick=$1;
+ } else {
+ $randompick=-1;
+ }
+ if ($2) { $ishidden=1; }
+ if ($3) { $isencrypted=1; }
&Apache::lonhtmlcommon::add_breadcrumb(
{'href'=>$url.$cpinfo,
- 'title'=>&unescape($foldername),
+ 'title'=>$name,
'text'=>''.
- &unescape($foldername).''
+ $name.''
});
-
-
}
- return &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp');
+ return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp',
+ 'LC_docs_path'),$randompick,$ishidden,$isencrypted);
}
sub editor {
@@ -1000,7 +1013,8 @@ sub editor {
$env{'form.markedcopy_title'}=$title;
$env{'form.markedcopy_url'}=$url;
}
- $r->print(&breadcrumbs($folder));
+ my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted)=&breadcrumbs($folder);
+ $r->print($breadcrumbtrail);
if ($fatal) {
$r->print('
'.$errtext.'
');
} else {
@@ -1160,6 +1174,11 @@ sub editor {
$Apache::lonratedt::order[$idx]]=
$comment.':'.join(':',@rrest);
}
+# Devalidate title cache
+ my $renamed_url=$rrest[0];
+# Has the :-escaping
+ $renamed_url=~s/\&colon\;/\:/g;
+ &Apache::lonnet::devalidate_title_cache($renamed_url);
}
# Store the changed version
($errtext,$fatal)=&storemap($coursenum,$coursedom,
@@ -1172,6 +1191,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(/\=/,$_);
@@ -1214,6 +1234,16 @@ sub editor {
# ---------------------------------------------------------------- Print screen
my $idx=0;
my $shown=0;
+ if (($ishidden) || ($isencrypted) || ($randompick>=0)) {
+ $r->print('
'.&mt('Caution: this folder is set to randomly pick a subset of resources. Adding or removing resources from this folder will change the set of resources that the students see, resulting in spurious or missing credit for completed problems, not limited to ones you modify. Do not modify the contents of this folder if it is in active student use.').'
');
+ }
$r->print('
');
foreach (@Apache::lonratedt::order) {
my ($name,$url)=split(/\:/,$Apache::lonratedt::resources[$_]);
@@ -1582,7 +1612,11 @@ END
} elsif ($url=~m|^/ext/|) {
$url='/adm/wrapper'.$url;
}
- $url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb);
+ if (&Apache::lonnet::symbverify($symb,$url)) {
+ $url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb);
+ } else {
+ $url='';
+ }
if ($container eq 'page') {
my $symb=$env{'form.pagesymb'};
@@ -1595,7 +1629,14 @@ END
my $foldername=&escape($foldertitle);
my $folderpath=$env{'form.folderpath'};
if ($folderpath) { $folderpath.='&' };
- $folderpath.=$folderarg.'&'.$foldername;
+# Append randompick number, hidden, and encrypted with ":" to foldername,
+# so it gets transferred between levels
+ $folderpath.=$folderarg.'&'.$foldername.':'.(&Apache::lonratedt::getparameter($orderidx,
+ 'parameter_randompick'))[0]
+ .':'.((&Apache::lonratedt::getparameter($orderidx,
+ 'parameter_hiddenresource'))[0]=~/^yes$/i)
+ .':'.((&Apache::lonratedt::getparameter($orderidx,
+ 'parameter_encrypturl'))[0]=~/^yes$/i);
$url.='folderpath='.&escape($folderpath).$cpinfo;
$parameterset='