--- loncom/interface/loncommon.pm 2012/12/19 23:05:01 1.1105 +++ loncom/interface/loncommon.pm 2013/01/01 19:53:26 1.1108 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1105 2012/12/19 23:05:01 raeburn Exp $ +# $Id: loncommon.pm,v 1.1108 2013/01/01 19:53:26 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -67,6 +67,7 @@ use Apache::lonhtmlcommon(); use Apache::loncoursedata(); use Apache::lontexconvert(); use Apache::lonclonecourse(); +use Apache::lonuserutils(); use LONCAPA qw(:DEFAULT :match); use DateTime::TimeZone; use DateTime::Locale::Catalog; @@ -2511,7 +2512,7 @@ END return $result; } -sub authform_authorwarning{ +sub authform_authorwarning { my $result=''; $result=''. &mt('As a general rule, only authors or co-authors should be '. @@ -2520,13 +2521,13 @@ sub authform_authorwarning{ return $result; } -sub authform_nochange{ +sub authform_nochange { my %in = ( formname => 'document.cu', kerb_def_dom => 'MSU.EDU', @_, ); - my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); + my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); my $result; if (!$authnum) { $result = &mt('Under your current role you are not permitted to change login settings for this user'); @@ -2549,7 +2550,7 @@ sub authform_kerberos { ); my ($check4,$check5,$krbcheck,$krbarg,$krbver,$result,$authtype, $autharg,$jscall); - my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); + my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); if ($in{'kerb_def_auth'} eq 'krb5') { $check5 = ' checked="checked"'; } else { @@ -2611,9 +2612,9 @@ sub authform_kerberos { $krbcheck.' />'; } if (($can_assign{'krb4'} && $can_assign{'krb5'}) || - ($can_assign{'krb4'} && !$can_assign{'krb5'} && + ($can_assign{'krb4'} && !$can_assign{'krb5'} && $in{'curr_authtype'} eq 'krb5') || - (!$can_assign{'krb4'} && $can_assign{'krb5'} && + (!$can_assign{'krb4'} && $can_assign{'krb5'} && $in{'curr_authtype'} eq 'krb4')) { $result .= &mt ('[_1] Kerberos authenticated with domain [_2] '. @@ -2649,14 +2650,14 @@ sub authform_kerberos { return $result; } -sub authform_internal { +sub authform_internal { my %in = ( formname => 'document.cu', kerb_def_dom => 'MSU.EDU', @_, ); my ($intcheck,$intarg,$result,$authtype,$autharg,$jscall); - my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); + my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); if (defined($in{'curr_authtype'})) { if ($in{'curr_authtype'} eq 'int') { if ($can_assign{'int'}) { @@ -2711,7 +2712,7 @@ sub authform_local { @_, ); my ($loccheck,$locarg,$result,$authtype,$autharg,$jscall); - my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); + my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); if (defined($in{'curr_authtype'})) { if ($in{'curr_authtype'} eq 'loc') { if ($can_assign{'loc'}) { @@ -2758,14 +2759,14 @@ sub authform_local { return $result; } -sub authform_filesystem{ +sub authform_filesystem { my %in = ( formname => 'document.cu', kerb_def_dom => 'MSU.EDU', @_, ); my ($fsyscheck,$result,$authtype,$autharg,$jscall); - my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); + my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); if (defined($in{'curr_authtype'})) { if ($in{'curr_authtype'} eq 'fsys') { if ($can_assign{'fsys'}) { @@ -6656,7 +6657,7 @@ ol.LC_docs_parameters li.LC_docs_paramet } ul#LC_secondary_menu { - clear: both; + clear: right; color: $fontmenu; background: $tabbg; list-style: none; @@ -6664,15 +6665,52 @@ ul#LC_secondary_menu { margin: 0; width: 100%; text-align: left; + float: left; } ul#LC_secondary_menu li { font-weight: bold; line-height: 1.8em; + border-right: 1px solid black; + float: left; +} + +ul#LC_secondary_menu li.LC_hoverable:hover, ul#LC_secondary_menu li.hover { + background-color: $data_table_light; +} + +ul#LC_secondary_menu li a { padding: 0 0.8em; +} + +ul#LC_secondary_menu li ul { + display: none; +} + +ul#LC_secondary_menu li:hover ul, ul#LC_secondary_menu li.hover ul { + display: block; + position: absolute; + margin: 0; + padding: 0; + list-style:none; + float: none; + background-color: $data_table_light; + z-index: 2; + margin-left: -1px; +} + +ul#LC_secondary_menu li ul li { + font-size: 90%; + vertical-align: top; + border-left: 1px solid black; border-right: 1px solid black; - display: inline; - vertical-align: middle; + background-color: $data_table_light + list-style:none; + float: none; +} + +ul#LC_secondary_menu li ul li:hover, ul#LC_secondary_menu li ul li.hover { + background-color: $data_table_dark; } ul.LC_TabContent { @@ -13280,6 +13318,26 @@ sub commit_studentrole { return $result; } +sub show_role_extent { + my ($scope,$context,$role) = @_; + $scope =~ s{^/}{}; + my @courseroles = &Apache::lonuserutils::roles_by_context('course',1); + push(@courseroles,'co'); + my @authorroles = &Apache::lonuserutils::roles_by_context('author'); + if (($context eq 'course') || (grep(/^\Q$role\E/,@courseroles))) { + $scope =~ s{/}{_}; + return ''.$env{'course.'.$scope.'.description'}.''; + } elsif (($context eq 'author') || (grep(/^\Q$role\E/,@authorroles))) { + my ($audom,$auname) = split(/\//,$scope); + return &mt('[_1] Author Space',''. + &Apache::loncommon::plainname($auname,$audom).''); + } else { + $scope =~ s{/$}{}; + return &mt('Domain: [_1]',''. + &Apache::lonnet::domain($scope,'description').''); + } +} + ############################################################ ############################################################