--- loncom/interface/loncommon.pm 2009/04/25 20:22:07 1.796 +++ loncom/interface/loncommon.pm 2009/05/19 22:52:10 1.822 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.796 2009/04/25 20:22:07 www Exp $ +# $Id: loncommon.pm,v 1.822 2009/05/19 22:52:10 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -517,6 +517,10 @@ sub coursebrowser_javascript { else { if (formname == 'portform') { url += '&setroles='+extra_element; + } else { + if (formname == 'rules') { + url += '&fixeddom='+extra_element; + } } } } @@ -931,9 +935,6 @@ sub help_open_topic { my ($topic, $text, $stayOnPage, $width, $height) = @_; $text = "" if (not defined $text); $stayOnPage = 0 if (not defined $stayOnPage); - if ($env{'browser.interface'} eq 'textual') { - $stayOnPage=1; - } $width = 350 if (not defined $width); $height = 400 if (not defined $height); my $filename = $topic; @@ -1039,8 +1040,7 @@ sub help_open_menu { $stayOnPage = 0 if (not defined $stayOnPage); # only use pop-up help (stayOnPage == 0) # if environment.remote is on (using remote control UI) - if ($env{'browser.interface'} eq 'textual' || - $env{'environment.remote'} eq 'off' ) { + if ($env{'environment.remote'} eq 'off' ) { $stayOnPage=1; } my $output; @@ -1064,8 +1064,7 @@ sub top_nav_help { my ($text) = @_; $text = &mt($text); my $stay_on_page = - ($env{'browser.interface'} eq 'textual' || - $env{'environment.remote'} eq 'off' ); + ($env{'environment.remote'} eq 'off' ); my $link = ($stay_on_page) ? "javascript:helpMenu('display')" : "javascript:helpMenu('open')"; my $banner_link = &update_help_link(undef,undef,undef,undef,$stay_on_page); @@ -1082,8 +1081,7 @@ sub help_menu_js { my ($text) = @_; my $stayOnPage = - ($env{'browser.interface'} eq 'textual' || - $env{'environment.remote'} eq 'off' ); + ($env{'environment.remote'} eq 'off' ); my $width = 620; my $height = 600; @@ -1142,8 +1140,7 @@ sub help_open_bug { unless ($Apache::lonnet::perlvar{'BugzillaHost'}) { return ''; } $text = "" if (not defined $text); $stayOnPage = 0 if (not defined $stayOnPage); - if ($env{'browser.interface'} eq 'textual' || - $env{'environment.remote'} eq 'off' ) { + if ($env{'environment.remote'} eq 'off' ) { $stayOnPage=1; } $width = 600 if (not defined $width); @@ -1187,8 +1184,7 @@ sub help_open_faq { unless ($Apache::lonnet::perlvar{'FAQHost'}) { return ''; } $text = "" if (not defined $text); $stayOnPage = 0 if (not defined $stayOnPage); - if ($env{'browser.interface'} eq 'textual' || - $env{'environment.remote'} eq 'off' ) { + if ($env{'environment.remote'} eq 'off' ) { $stayOnPage=1; } $width = 350 if (not defined $width); @@ -1859,7 +1855,7 @@ sub home_server_form_item { if ($numlib > 1) { $result .= '&"').'" onclick="javascript:setSearch(\'1\','.$caller.');" />

'; } else { - my $helplink = ' href="javascript:helpMenu('."'display'".')"'; + my $helplink = 'javascript:helpMenu('."'display'".')'; my %usertypetext = ( official => 'institutional', unofficial => 'non-institutional', ); - $new_user_create = '
'.&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.").' '.&mt('Contact the helpdesk for assistance.',$helplink).'

'; + $new_user_create = '

' + .&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.") + .' ' + .&mt('Please contact the [_1]helpdesk[_2] for assistance.' + ,'','') + .'


'; } } } @@ -10202,7 +10291,23 @@ sub escape_url { return join('/',@urlslices).'/'.$lastitem; } -# -------------------------------------------------------- Initliaze user login +sub compare_arrays { + my ($arrayref1,$arrayref2) = @_; + my (@difference,%count); + @difference = (); + %count = (); + if ((ref($arrayref1) eq 'ARRAY') && (ref($arrayref2) eq 'ARRAY')) { + foreach my $element (@{$arrayref1}, @{$arrayref2}) { $count{$element}++; } + foreach my $element (keys(%count)) { + if ($count{$element} == 1) { + push(@difference,$element); + } + } + } + return @difference; +} + +# -------------------------------------------------------- Initialize user login sub init_user_environment { my ($r, $username, $domain, $authhost, $form, $args) = @_; my $lonids=$Apache::lonnet::perlvar{'lonIDsDir'}; @@ -10256,19 +10361,6 @@ sub init_user_environment { my ($httpbrowser,$clientbrowser,$clientversion,$clientmathml, $clientunicode,$clientos) = &decode_user_agent($r); -# -------------------------------------- Any accessibility options to remember? - if (($form->{'interface'}) && ($form->{'remember'} eq 'true')) { - foreach my $option ('imagesuppress','appletsuppress', - 'embedsuppress','fontenhance','blackwhite') { - if ($form->{$option} eq 'true') { - &Apache::lonnet::put('environment',{$option => 'on'}, - $domain,$username); - } else { - &Apache::lonnet::del('environment',[$option], - $domain,$username); - } - } - } # ------------------------------------------------------------- Get environment my %userenv = &Apache::lonnet::dump('environment',$domain,$username); @@ -10286,10 +10378,8 @@ sub init_user_environment { if ($userenv{'texengine'} eq 'ttm') { $clientmathml=1; } # --------------- Do not trust query string to be put directly into environment - foreach my $option ('imagesuppress','appletsuppress', - 'embedsuppress','fontenhance','blackwhite', - 'interface','localpath','localres') { - $form->{$option}=~s/[\n\r\=]//gs; + foreach my $option ('interface','localpath','localres') { + $form->{$option}=~s/[\n\r\=]//gs; } # --------------------------------------------------------- Write first profile @@ -10323,13 +10413,6 @@ sub init_user_environment { $form->{'interface'}=~s/\W//gs; $initial_env{"browser.interface"} = $form->{'interface'}; $env{'browser.interface'}=$form->{'interface'}; - foreach my $option ('imagesuppress','appletsuppress', - 'embedsuppress','fontenhance','blackwhite') { - if (($form->{$option} eq 'true') || - ($userenv{$option} eq 'on')) { - $initial_env{"browser.$option"} = "on"; - } - } } foreach my $tool ('aboutme','blog','portfolio') {