version 1.135, 2004/07/08 19:58:29
|
version 1.136, 2004/08/03 20:44:33
|
Line 650 ENDPARMS
|
Line 650 ENDPARMS
|
# ---------------------------------------------------------------- tie the hash |
# ---------------------------------------------------------------- tie the hash |
|
|
sub tiehash { |
sub tiehash { |
|
my ($mode)=@_; |
$hashtied=0; |
$hashtied=0; |
if ($ENV{'request.course.fn'}) { |
if ($ENV{'request.course.fn'}) { |
if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.".db", |
if ($mode eq 'write') { |
&GDBM_READER(),0640)) { |
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; |
$hashtied=1; |
} |
} |
|
} |
} |
} |
} |
} |
|
|
Line 821 sub checkversions {
|
Line 829 sub checkversions {
|
} else { |
} else { |
$r->print('<h1><font color="red">'.&mt('An Error Occured while Attempting to Store your Version Settings').'</font></h1>'); |
$r->print('<h1><font color="red">'.&mt('An Error Occured while Attempting to Store your Version Settings').'</font></h1>'); |
} |
} |
&changewarning($r,''); |
&mark_hash_old(); |
} |
} |
|
&changewarning($r,''); |
if ($ENV{'form.timerange'} eq 'all') { |
if ($ENV{'form.timerange'} eq 'all') { |
# show all documents |
# show all documents |
$header=&mt('All Documents in Course'); |
$header=&mt('All Documents in Course'); |
Line 942 ENDHEADERS
|
Line 951 ENDHEADERS
|
# Set version |
# Set version |
$r->print(&Apache::loncommon::select_form($setversions{$linkurl}, |
$r->print(&Apache::loncommon::select_form($setversions{$linkurl}, |
'set_version_'.$linkurl, |
'set_version_'.$linkurl, |
('' => '', |
('select_form_order' => |
|
['',1..$currentversion,'mostrecent'], |
|
'' => '', |
'mostrecent' => 'most recent', |
'mostrecent' => 'most recent', |
map {$_,$_} (1..$currentversion)))); |
map {$_,$_} (1..$currentversion)))); |
$r->print('</nobr></td></tr><tr><td></td>'); |
$r->print('</nobr></td></tr><tr><td></td>'); |
Line 1003 ENDHEADERS
|
Line 1014 ENDHEADERS
|
&untiehash(); |
&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 { |
sub changewarning { |
my ($r,$postexec)=@_; |
my ($r,$postexec)=@_; |
|
if (!&is_hash_old()) { return; } |
$r->print( |
$r->print( |
'<script>function reinit(tf) { tf.submit();'.$postexec.' }</script>'. |
'<script>function reinit(tf) { tf.submit();'.$postexec.' }</script>'. |
'<form method="post" action="/adm/roles" target="loncapaclient">'. |
'<form method="post" action="/adm/roles" target="loncapaclient">'. |
Line 1313 ENDCOURSEVERIFY
|
Line 1348 ENDCOURSEVERIFY
|
$hadchanges=0; |
$hadchanges=0; |
&editor($r,$coursenum,$coursedom,$folder,$allowed); |
&editor($r,$coursenum,$coursedom,$folder,$allowed); |
if ($hadchanges) { |
if ($hadchanges) { |
&changewarning($r,$postexec); |
&mark_hash_old() |
} |
} |
|
&changewarning($r,$postexec); |
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. |
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. |
'.sequence'; |
'.sequence'; |
$r->print(<<ENDFORM); |
$r->print(<<ENDFORM); |