--- loncom/interface/lonpreferences.pm 2008/03/24 04:56:22 1.117 +++ loncom/interface/lonpreferences.pm 2008/05/12 23:47:43 1.118 @@ -1,7 +1,7 @@ # The LearningOnline Network # Preferences # -# $Id: lonpreferences.pm,v 1.117 2008/03/24 04:56:22 raeburn Exp $ +# $Id: lonpreferences.pm,v 1.118 2008/05/12 23:47:43 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -609,6 +609,42 @@ sub verify_and_change_clicker { $r->print(&mt('Registering clickers: [_1]',$newclickers)); } +################################################################# +## Lock Subroutines # +################################################################# + +sub lockwarning { + my $r = shift; + my $title=&mt('Action locked'); + my $texttop=&mt('LON-CAPA is currently performing the following actions:'); + my $textbottom=&mt('Changing roles or logging out may result in data corruption.'); + my ($num,%which)=&Apache::lonnet::get_locks(); + my $which=''; + foreach my $id (keys %which) { + $which.='
  • '.$which{$id}.'
  • '; + } + my $change=&mt('Override'); + $r->print(< + +

    $title

    +$texttop + +$textbottom + + +ENDSCREEN +} + +sub verify_and_change_lockwarning { + my $r = shift; + &Apache::lonnet::remove_all_locks(); + $r->print(&mt('Cleared locks.')); +} + + ################################################################ # Message Forward # ################################################################ @@ -1825,7 +1861,7 @@ sub handler { href => '/adm/preferences', subroutine => \&clickerchanger, breadcrumb => - { href => '/adm/preferences?action=changeicons', + { href => '/adm/preferences?action=changeclicker', text => 'Register Clicker'}, }, { action => 'verify_and_change_clicker', @@ -1836,6 +1872,20 @@ sub handler { printmenu => 'yes', })); + push (@Options,({ action => 'lockwarning', + subroutine => \&lockwarning, + breadcrumb => + { href => '/adm/preferences?action=lockwarning', + text => 'Lock Warnings'}, + }, + { action => 'verify_and_change_locks', + subroutine => \&verify_and_change_lockwarning, + breadcrumb => + { href => '/adm/preferences?action=lockwarning', + text => 'Lockwarnings'}, + printmenu => 'yes', + })); + if (&Apache::lonnet::allowed('whn',$env{'request.course.id'}) || &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/'