--- loncom/interface/loncommon.pm 2009/10/24 03:24:13 1.902 +++ loncom/interface/loncommon.pm 2009/10/31 05:47:10 1.906 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.902 2009/10/24 03:24:13 raeburn Exp $ +# $Id: loncommon.pm,v 1.906 2009/10/31 05:47:10 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -482,7 +482,7 @@ ENDAUTHORBRW } sub coursebrowser_javascript { - my ($domainfilter,$sec_element,$formname)=@_; + my ($domainfilter,$sec_element,$formname,$role_element)=@_; my $crs_or_grp_alert = &mt('Please select the type of LON-CAPA entity - Course or Community - for which you wish to add/modify a user role.'); my $id_functions = &javascript_index_functions(); my $output = ' @@ -548,8 +548,8 @@ sub coursebrowser_javascript { } $id_functions ENDSTDBRW - if ($sec_element ne '') { - $output .= &setsec_javascript($sec_element,$formname); + if (($sec_element ne '') || ($role_element ne '')) { + $output .= &setsec_javascript($sec_element,$formname,$role_element); } $output .= ' // ]]> @@ -661,7 +661,28 @@ ENDUSERBRW } sub setsec_javascript { - my ($sec_element,$formname) = @_; + my ($sec_element,$formname,$role_element) = @_; + my (@courserolenames,@communityrolenames,$rolestr,$courserolestr, + $communityrolestr); + if ($role_element ne '') { + my @allroles = ('st','ta','ep','in','ad'); + foreach my $crstype ('Course','Community') { + if ($crstype eq 'Community') { + foreach my $role (@allroles) { + push(@communityrolenames,&Apache::lonnet::plaintext($role,$crstype)); + } + push(@communityrolenames,&Apache::lonnet::plaintext('co')); + } else { + foreach my $role (@allroles) { + push(@courserolenames,&Apache::lonnet::plaintext($role,$crstype)); + } + push(@courserolenames,&Apache::lonnet::plaintext('cc')); + } + } + $rolestr = '"'.join('","',@allroles).'"'; + $courserolestr = '"'.join('","',@courserolenames).'"'; + $communityrolestr = '"'.join('","',@communityrolenames).'"'; + } my $setsections = qq| function setSect(sectionlist) { var sectionsArray = new Array(); @@ -695,16 +716,57 @@ function setSect(sectionlist) { } } } + +function setRole(crstype) { |; + if ($role_element eq '') { + $setsections .= ' return; +} +'; + } else { + $setsections .= qq| + var elementLength = document.$formname.$role_element.length; + var allroles = Array($rolestr); + var courserolenames = Array($courserolestr); + var communityrolenames = Array($communityrolestr); + if (elementLength != undefined) { + if (document.$formname.$role_element.options[5].value == 'cc') { + if (crstype == 'Course') { + return; + } else { + allroles[5] = 'co'; + for (var i=0; i<6; i++) { + document.$formname.$role_element.options[i].value = allroles[i]; + document.$formname.$role_element.options[i].text = communityrolenames[i]; + } + } + } else { + if (crstype == 'Community') { + return; + } else { + allroles[5] = 'cc'; + for (var i=0; i<6; i++) { + document.$formname.$role_element.options[i].value = allroles[i]; + document.$formname.$role_element.options[i].text = courserolenames[i]; + } + } + } + } + return; +} +|; + } return $setsections; } - sub selectcourse_link { my ($form,$unameele,$udomele,$desc,$extra_element,$multflag,$selecttype)=@_; my $linktext = &mt('Select Course'); if ($selecttype eq 'Community') { $linktext = &mt('Select Community'); + } elsif ($selecttype eq 'Course/Community') { + $linktext = &mt('Select Course/Community'); + $selecttype = 'Course'; } return '' ." $titleinfo $dc_info" - .''; + # if ($env{'request.state'} eq 'construct') { + # $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls + # } - if ($no_nav_bar) { - $bodytag .= $titletable; - } else { - $bodytag .= qq|
$name $role
- $realm $dc_info
| unless $env{'form.inhibitmenu'}; + $bodytag .= qq|
$name $role
+ $realm $dc_info
| unless $env{'form.inhibitmenu'}; + + if ( $env{'form.inhibitmenu'} eq 'yes' + || $ENV{'REQUEST_URI'} eq '/adm/logout' + || $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { -#SD $titletable is obsolete -#SD if ($env{'request.state'} eq 'construct') { -#SD $bodytag .= &Apache::lonmenu::menubuttons($forcereg,$titletable); -#SD } else { -#SD $bodytag .= &Apache::lonmenu::menubuttons($forcereg).$titletable; -#SD } - if ( $env{'form.inhibitmenu'} eq 'yes' - || $ENV{'REQUEST_URI'} eq '/adm/logout' - || $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { - - return $bodytag; - } - - $bodytag .= Apache::lonhtmlcommon::scripttag( - Apache::lonmenu::utilityfunctions(), - 'start'); - $bodytag .= Apache::lonmenu::primary_menu(); - $bodytag .= Apache::lonmenu::secondary_menu(); - #SD remove next line - #$bodytag .= Apache::lonmenu::menubuttons($forcereg); - $bodytag .= Apache::lonmenu::serverform(); - $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); - $bodytag .= Apache::lonmenu::innerregister($forcereg) if $forcereg; + return $bodytag; } + + $bodytag .= Apache::lonhtmlcommon::scripttag( + Apache::lonmenu::utilityfunctions(), 'start'); + + $bodytag .= Apache::lonmenu::primary_menu(); + + #don't show menus for public users + if($env{'user.name'} ne 'public' && $env{'user.domain'} ne 'public'){ + $bodytag .= Apache::lonmenu::secondary_menu(); + $bodytag .= Apache::lonmenu::serverform(); + $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + $bodytag .= Apache::lonmenu::innerregister($forcereg) if $forcereg; + }else{ + # this is to seperate menu from content when there's no secondary + # menu. Especially needed for public accessible ressources. + $bodytag .= '
'; + $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + } + + #SD testing + #$bodytag .= Apache::lonmenu::menubuttons($forcereg); return $bodytag; } @@ -4884,7 +4942,10 @@ table#LC_mainmenu td.LC_mainmenu_column clear:both; background: $sidebg; border-bottom: 1px solid $lg_border_color; - line-height: 32px; + line-height: 2.5em; + /* SD working here + height: 2.5em; + overflow: hidden; */ margin: 0; padding: 0; } @@ -5808,7 +5869,7 @@ ul#LC_secondary_menu a:hover, .LC_FormSectionClearButton input:hover ul.LC_TabContent li:hover a { color:#BF2317; - text-decoration:none; + text-decoration:none; } h1 { @@ -6038,6 +6099,8 @@ ol#LC_PathBreadcrumbs { padding-left: 10px; margin: 0; list-style-position: inside; + /* SD working here + white-space: nowrap; */ } ol#LC_MenuBreadcrumbs li, @@ -6045,6 +6108,8 @@ ol#LC_PathBreadcrumbs li, ul.LC_CourseBreadcrumbs li { display: inline; white-space: nowrap; + /* SD working here + white-space: normal; */ } ol#LC_MenuBreadcrumbs li a,