Diff for /loncom/interface/lonpreferences.pm between versions 1.125.8.3 and 1.125.8.4

version 1.125.8.3, 2009/11/19 15:41:59 version 1.125.8.4, 2009/12/07 00:04:10
Line 42  use Apache::loncommon(); Line 42  use Apache::loncommon();
 use Apache::lonhtmlcommon();  use Apache::lonhtmlcommon();
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonnet;  use Apache::lonnet;
   use LONCAPA::lonauthcgi();
 use LONCAPA();  use LONCAPA();
   
 #  #
Line 2043  sub handler { Line 2044  sub handler {
                        }));                         }));
     }      }
   
     if ($env{'user.name'} =~ /^(albertel|fox|foxr|kortemey|korte|raeburn)$/) {      if (&can_toggle_debug()) {
         push (@Options,({ action => 'debugtoggle',          push (@Options,({ action => 'debugtoggle',
                           printmenu => 'yes',                            printmenu => 'yes',
                           subroutine => \&toggle_debug,                            subroutine => \&toggle_debug,
Line 2075  sub handler { Line 2076  sub handler {
    || ($printmenu eq 'not_on_error' && !$error) )     || ($printmenu eq 'not_on_error' && !$error) )
  && (!$env{'form.returnurl'})) {   && (!$env{'form.returnurl'})) {
         my $optionlist = '<table cellpadding="5">';          my $optionlist = '<table cellpadding="5">';
         if ($env{'user.name'} =~           if (&can_toggle_debug()) {
                          /^(albertel|kortemey|fox|foxr|korte|hallmat3|turtle|raeburn)$/  
             ) {  
             push (@Options,({ action => 'debugtoggle',              push (@Options,({ action => 'debugtoggle',
                               linktext => 'Toggle Debug Messages',                                linktext => 'Toggle Debug Messages',
                               text => 'Current Debug status is -'.                                text => 'Current Debug status is: '.
                                   $env{'user.debug'}.'-.',                                        ($env{'user.debug'} ? 'on' : 'off'),
                               href => '/adm/preferences',                                href => '/adm/preferences',
                               printmenu => 'yes',                                printmenu => 'yes',
                               subroutine => \&toggle_debug,                                subroutine => \&toggle_debug,
Line 2123  sub handler { Line 2122  sub handler {
 }  }
   
 sub toggle_debug {  sub toggle_debug {
     if ($env{'user.debug'}) {      if (&can_toggle_debug()) {
         &Apache::lonnet::delenv('user.debug');          &Apache::lonnet::delenv('user.debug');
     } else {      } else {
         &Apache::lonnet::appenv({'user.debug' => 1});          &Apache::lonnet::appenv({'user.debug' => 1});
     }      }
 }  }
   
   sub can_toggle_debug {
       my $can_toggle = 0;
       my $page = 'toggledebug';
       if (&LONCAPA::lonauthcgi::can_view($page)) {
           $can_toggle = 1;
       } elsif (&LONCAPA::lonauthcgi::check_ipbased_access($page)) {
           $can_toggle = 1;
       }
       return $can_toggle;
   }
   
   
 1;  1;
 __END__  __END__

Removed from v.1.125.8.3  
changed lines
  Added in v.1.125.8.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>