--- loncom/interface/loncommon.pm 2006/05/30 20:05:05 1.377 +++ loncom/interface/loncommon.pm 2006/06/22 19:11:13 1.388 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.377 2006/05/30 20:05:05 raeburn Exp $ +# $Id: loncommon.pm,v 1.388 2006/06/22 19:11:13 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -730,8 +730,8 @@ sub help_open_menu { } else { $link = "javascript:helpMenu('display')"; } - my $banner_link = "/adm/helpmenu?page=banner&color=$color&function=$function&topic=$topic&component_help=$component_help&faq=$faq&bug=$bug&origurl=$origurl&stamp=$timestamp&stayonpage=$stayOnPage"; - my $details_link = "/adm/helpmenu?page=body&color=$color&function=$function&topic=$topic&component_help=$component_help&faq=$faq&bug=$bug&origurl=$origurl&stamp=$timestamp"; + my $banner_link = "/adm/helpmenu?page=banner&color=$color&function=$function&topic=$topic&component_help=$component_help&faq=$faq&bug=$bug&origurl=$origurl&stamp=$timestamp&stayonpage=$stayOnPage"; + my $details_link = "/adm/helpmenu?page=body&color=$color&function=$function&topic=$topic&component_help=$component_help&faq=$faq&bug=$bug&origurl=$origurl&stamp=$timestamp"; my $template; if ($text ne "") { $template .= @@ -816,8 +816,8 @@ sub help_open_bug { $topic=~s/\W+/\+/g; my $link=''; my $template=''; - my $url=$Apache::lonnet::perlvar{'BugzillaHost'}.'enter_bug.cgi?product=LON-CAPA&bug_file_loc='. - &escape($ENV{'REQUEST_URI'}).'&component='.$topic; + my $url=$Apache::lonnet::perlvar{'BugzillaHost'}.'enter_bug.cgi?product=LON-CAPA&bug_file_loc='. + &escape($ENV{'REQUEST_URI'}).'&component='.$topic; if (!$stayOnPage) { $link = "javascript:void(open('$url', 'Bugzilla', 'menubar=0,toolbar=1,scrollbars=1,width=$width,height=$height,resizable=yes'))"; @@ -2826,17 +2826,19 @@ sub bodytag { @$addentries{keys(%design)} = @design{keys(%design)}; # role and realm - my ($role,$realm) = - &Apache::lonnet::plaintext((split(/\./,$env{'request.role'}))[0]); + my ($role,$realm) = split(/\./,$env{'request.role'},2); + if ($role eq 'ca') { + my ($rdom,$rname) = ($realm =~ m-^/(\w+)/(\w+)$-); + $realm = &plainname($rname,$rdom).':'.$rdom; + } # realm if ($env{'request.course.id'}) { - my $type = $env{'course.'.$env{'request.course.id'}.'.type'}; - if ($type eq 'Group') { - if ($env{'request.role'} !~ /^cr/) { # Change role name if Group - $role = &convert_role($role,$type); - } - } + if ($env{'request.role'} !~ /^cr/) { + $role = &Apache::lonnet::plaintext($role,&course_type()); + } $realm = $env{'course.'.$env{'request.course.id'}.'.description'}; + } else { + $role = &Apache::lonnet::plaintext($role); } if (!$realm) { $realm=' '; } # Set messages @@ -2897,6 +2899,7 @@ ENDROLE '.domain'}.'/'})) { my $cid = $env{'request.course.id'}; $dc_info.= $cid.' '.$env{'course.'.$cid.'.internal.coursecode'}; + $dc_info =~ s/\s+$//; $dc_info = '('.$dc_info.')'; } @@ -3095,8 +3098,10 @@ sub standard_css { my $tabbg = &designparm($function.'.tabbg', $domain); my $font = &designparm($function.'.font', $domain); my $sidebg = &designparm($function.'.sidebg',$domain); - my $pgbg = $bgcolor || + my $pgbg_or_bgcolor = + $bgcolor || &designparm($function.'.pgbg', $domain); + my $pgbg = &designparm($function.'.pgbg', $domain); my $alink = &designparm($function.'.alink', $domain); my $vlink = &designparm($function.'.vlink', $domain); my $link = &designparm($function.'.link', $domain); @@ -3122,7 +3127,7 @@ table.thinborder { border-collapse: coll table.thinborder tr th, table.thinborder tr td { border-style: solid; border-width: 1px} form, .inline { display: inline; } .center { text-align: center; } -.filename {font-family: monospace;} +.LC_filename {font-family: monospace;} .LC_error { color: red; font-size: larger; @@ -3131,11 +3136,11 @@ form, .inline { display: inline; } color: green; } -table#LC_top_nav, table#LC_menubuttons, table#LC_nav_location, table#LC_breadcrumbs { +table#LC_top_nav, table#LC_menubuttons, table#LC_nav_location { width: 100%; background: $pgbg; border: 0px; - border-spacing: 2px 1px; + border-spacing: 2px 2px; padding: 0px; margin: 0px; border-collapse: separate; @@ -3143,7 +3148,16 @@ table#LC_top_nav, table#LC_menubuttons, table#LC_title_bar { width: 100%; border: 0; - border-spacing: 0px 1px; + border-spacing: 0px 0px; + padding: 0px 2px 0px 2px; + background: $pgbg; + font-family: $sans; + border-collapse: separate; +} +table#LC_breadcrumbs { + width: 100%; + border: 0; + border-spacing: 0px; padding: 0px 2px 0px 2px; background: $pgbg; font-family: $sans; @@ -3215,6 +3229,10 @@ table#LC_breadcrumbs td.LC_breadcrumb_co font-size: larger; text-align: right; } +td.LC_table_cell_checkbox { + text-align: center; +} + .LC_menubuttons_inline_text { color: $font; font-family: $sans; @@ -3297,6 +3315,40 @@ table.LC_mail_list tr.LC_mail_other { table.LC_mail_list tr.LC_mail_other:hover { background-color: $mail_other_hover; } + +table#LC_portfolio_actions { + width: auto; + background: $pgbg; + border: 0px; + border-spacing: 2px 2px; + padding: 0px; + margin: 0px; + border-collapse: separate; +} +table#LC_portfolio_actions td.LC_label { + background: $tabbg; + text-align: right; +} +table#LC_portfolio_actions td.LC_value { + background: $tabbg; +} + +table.LC_brower { +} +table.LC_browser tr.LC_browser_file { + background: #CCFF88 +} +table.LC_browser tr.LC_browser_file_locked { + background: #FFAA99 +} +table.LC_browser tr.LC_browser_folder { + background: #CCCCFF +} +span.LC_current_location { + font-size: x-large; + background: $pgbg; +} + END } @@ -3966,6 +4018,43 @@ sub get_user_info { return; } +sub get_secgrprole_info { + my ($cdom,$cnum,$needroles,$type) = @_; + my %sections_count = &get_sections($cdom,$cnum); + my @sections = (sort {$a <=> $b} keys(%sections_count)); + my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum); + my @groups = sort(keys(%curr_groups)); + my $allroles = []; + my $rolehash; + my $accesshash = { + active => 'Currently has access', + future => 'Will have future access', + previous => 'Previously had access', + }; + if ($needroles) { + $rolehash = {'all' => 'all'}; + my %user_roles = &Apache::lonnet::dump('nohist_userroles',$cdom,$cnum); + if (&Apache::lonnet::error(%user_roles)) { + undef(%user_roles); + } + foreach my $item (keys(%user_roles)) { + my ($role)=split(/\:/,$item,2); + if ($role eq 'cr') { next; } + if ($role =~ /^cr/) { + $$rolehash{$role} = (split('/',$role))[3]; + } else { + $$rolehash{$role} = &Apache::lonnet::plaintext($role,$type); + } + } + foreach my $key (sort(keys(%{$rolehash}))) { + push(@{$allroles},$key); + } + push (@{$allroles},'st'); + $$rolehash{'st'} = &Apache::lonnet::plaintext('st',$type); + } + return (\@sections,\@groups,$allroles,$rolehash,$accesshash); +} + =pod =item * get_unprocessed_cgi($query,$possible_names) @@ -4981,15 +5070,16 @@ sub restore_course_settings { ############################################################ ############################################################ -sub convert_role { - my ($rolename,$type) = @_; - if ($type eq 'Group') { - $rolename =~ s/Course/Group/; - $rolename =~ s/Instructor/Leader/; - $rolename =~ s/Teaching Assistant/Assistant Leader/; - $rolename =~ s/Student/Member/; +sub course_type { + my ($cid) = @_; + if (!defined($cid)) { + $cid = $env{'request.course.id'}; + } + if (defined($env{'course.'.$cid.'type'})) { + return $env{'course.'.$cid.'type'}; + } else { + return 'Course'; } - return $rolename; } sub icon {