--- loncom/interface/lonpreferences.pm 2008/05/12 23:47:43 1.118 +++ loncom/interface/lonpreferences.pm 2008/05/14 18:21:40 1.119 @@ -1,7 +1,7 @@ # The LearningOnline Network # Preferences # -# $Id: lonpreferences.pm,v 1.118 2008/05/12 23:47:43 www Exp $ +# $Id: lonpreferences.pm,v 1.119 2008/05/14 18:21:40 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -609,6 +609,52 @@ sub verify_and_change_clicker { $r->print(&mt('Registering clickers: [_1]',$newclickers)); } +################################################################ +# Domcoord Access Subroutines # +################################################################ + +sub domcoordchanger { + my $r = shift; + my $user = $env{'user.name'}; + my $domain = $env{'user.domain'}; + my %userenv = &Apache::lonnet::get + ('environment',['domcoord.author','domcoord.cc']); + my $constchecked=''; + my $courseschecked=''; + if ($userenv{'domcoord.author'} eq 'blocked') { + $constchecked='checked="checked"'; + } + if ($userenv{'domcoord.cc'} eq 'blocked') { + $courseschecked='checked="checked"'; + } + my $text=&mt('By default, the Domain Coordinator can enter your courses and construction space.'); + my $construction=&mt('Block access to construction space'); + my $courses=&mt('Block access to courses'); + my $change=&mt('Change'); + $r->print(< + +$text
+
+
+ + +ENDSCREEN +} + +sub verify_and_change_domcoord { + my $r = shift; + my $user = $env{'user.name'}; + my $domain = $env{'user.domain'}; + my %domcoord=('domcoord.author' => '','domcoord.cc' => ''); + if ($env{'form.construction'}) { $domcoord{'domcoord.author'}='blocked'; } + if ($env{'form.courses'}) { $domcoord{'domcoord.cc'}='blocked'; } + &Apache::lonnet::put('environment',\%domcoord); + &Apache::lonnet::appenv({'environment.domcoord.author' => $domcoord{'domcoord.author'}, + 'environment.domcoord.cc' => $domcoord{'domcoord.cc'}}); + $r->print(&mt('Registering Domain Coordinator access restrictions.')); +} + ################################################################# ## Lock Subroutines # ################################################################# @@ -1871,6 +1917,23 @@ sub handler { text => 'Register Clicker'}, printmenu => 'yes', })); + if ($env{'user.adv'}) { + push (@Options,({ action => 'changedomcoord', + linktext => 'Restrict Domain Coordinator Access', + href => '/adm/preferences', + subroutine => \&domcoordchanger, + breadcrumb => + { href => '/adm/preferences?action=changedomcoord', + text => 'Restrict Domain Coordinator Access'}, + }, + { action => 'verify_and_change_domcoord', + subroutine => \&verify_and_change_domcoord, + breadcrumb => + { href => '/adm/preferences?action=changedomcoord', + text => 'Restrict Domain Coordinator Access'}, + printmenu => 'yes', + })); + } push (@Options,({ action => 'lockwarning', subroutine => \&lockwarning, @@ -1906,7 +1969,7 @@ sub handler { })); } - if ($env{'user.name'} =~ /^(albertel|fox|foxr|koretemey|korte|hallmat3|turtle|raeburn)$/) { + if ($env{'user.name'} =~ /^(albertel|fox|foxr|kortemey|korte|raeburn)$/) { push (@Options,({ action => 'debugtoggle', printmenu => 'yes', subroutine => \&toggle_debug,