$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(
''.
'