--- loncom/interface/londocs.pm 2004/06/27 16:43:28 1.131
+++ loncom/interface/londocs.pm 2004/08/29 07:54:40 1.137.2.1
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.131 2004/06/27 16:43:28 www Exp $
+# $Id: londocs.pm,v 1.137.2.1 2004/08/29 07:54:40 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -157,7 +157,7 @@ sub dumpcourse {
$crs=~s/\_/\//g;
foreach (keys %replacehash) {
my $newfilename=$title.'/'.$replacehash{$_};
- $newfilename=~s/[^\w\/\.]+/\_/g;
+ $newfilename=~s/[^\w\/\.\/]+/\_/g;
my @dirs=split(/\//,$newfilename);
my $path='/home/'.$ca.'/public_html';
my $makepath=$path;
@@ -201,7 +201,8 @@ sub dumpcourse {
$r->print(
'');
} else {
- $r->print('');
+ $r->print('');
}
}
}
@@ -224,7 +225,7 @@ sub dumpcourse {
$title=$_;
}
$title=~s/\.(\w+)$//;
- $title=~s/\W+/\_/gs;
+ $title=~s/[^\w\/]+/\_/gs;
$title.='.'.$ext;
$r->print("\n
| \n");
}
@@ -280,7 +281,8 @@ sub breadcrumbs {
}
- return &Apache::lonhtmlcommon::breadcrumbs(undef,undef,undef,undef,undef,0);
+ return &Apache::lonhtmlcommon::breadcrumbs(undef,undef,undef,undef,undef,
+ 0,'nohelp');
}
sub editor {
@@ -574,13 +576,15 @@ END
my $isfolder=0;
my $folderarg;
if ($uploaded) {
- if ($extension eq 'sequence') {
- $icon=$iconpath.'/folder_closed.gif';
- $url=~/$coursenum\/([\/\w]+)\.sequence$/;
- $url='/adm/coursedocs?';
- $folderarg=$1;
- $isfolder=1;
- }
+ if ($extension eq 'sequence') {
+ $icon=$iconpath.'/folder_closed.gif';
+ $url=~/$coursenum\/([\/\w]+)\.sequence$/;
+ $url='/adm/coursedocs?';
+ $folderarg=$1;
+ $isfolder=1;
+ } else {
+ &Apache::lonnet::allowuploaded('/adm/coursedoc',$url);
+ }
}
$url=~s/^http\&colon\;\/\//\/adm\/wrapper\/ext\//;
if ((!$isfolder) && ($residx) && ($folder!~/supplemental/)) {
@@ -632,8 +636,8 @@ END
$line.=(<
$lt{'hd'}
-
- $lt{'ec'} |
+
$parameterset |
@@ -647,12 +651,20 @@ ENDPARMS
# ---------------------------------------------------------------- tie the hash
sub tiehash {
+ my ($mode)=@_;
$hashtied=0;
if ($ENV{'request.course.fn'}) {
- if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.".db",
- &GDBM_READER(),0640)) {
+ if ($mode eq 'write') {
+ 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",
+ &GDBM_READER(),0640)) {
$hashtied=1;
- }
+ }
+ }
}
}
@@ -818,8 +830,9 @@ sub checkversions {
} else {
$r->print(''.&mt('An Error Occured while Attempting to Store your Version Settings').'');
}
- &changewarning($r,'');
+ &mark_hash_old();
}
+ &changewarning($r,'');
if ($ENV{'form.timerange'} eq 'all') {
# show all documents
$header=&mt('All Documents in Course');
@@ -939,7 +952,9 @@ ENDHEADERS
# Set version
$r->print(&Apache::loncommon::select_form($setversions{$linkurl},
'set_version_'.$linkurl,
- ('' => '',
+ ('select_form_order' =>
+ ['',1..$currentversion,'mostrecent'],
+ '' => '',
'mostrecent' => 'most recent',
map {$_,$_} (1..$currentversion))));
$r->print(' | | ');
@@ -1000,8 +1015,32 @@ ENDHEADERS
&untiehash();
}
+sub mark_hash_old {
+ my $retie_hash=0;
+ if ($hashtied) {
+ $retie_hash=1;
+ &untiehash();
+ }
+ &tiehash('write');
+ $hash{'old'}=1;
+ &untiehash();
+ if ($retie_hash) { &tiehash(); }
+}
+
+sub is_hash_old {
+ my $untie_hash=0;
+ if (!$hashtied) {
+ $untie_hash=1;
+ &tiehash();
+ }
+ my $return=$hash{'old'};
+ if ($untie_hash) { &untiehash(); }
+ return $return;
+}
+
sub changewarning {
my ($r,$postexec)=@_;
+ if (!&is_hash_old()) { return; }
$r->print(
''.
'