--- loncom/interface/loncommon.pm 2009/08/19 19:43:38 1.886 +++ 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.886 2009/08/19 19:43:38 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 = ' @@ -493,6 +493,7 @@ sub coursebrowser_javascript { $output .= <<"ENDSTDBRW"; function opencrsbrowser(formname,uname,udom,desc,extra_element,multflag,crstype) { var url = '/adm/pickcourse?'; + var formid = getFormIdByName(formname); var domainfilter = getDomainFromSelectbox(formname,udom); if (domainfilter != null) { if (domainfilter != '') { @@ -547,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 .= ' // ]]> @@ -602,7 +603,7 @@ sub userbrowser_javascript { my $id_functions = &javascript_index_functions(); return <<"ENDUSERBRW"; -function openuserbrowser(formname,uname,udom,ulast,ufirst,uemail,hideudom,crsdom) { +function openuserbrowser(formname,uname,udom,ulast,ufirst,uemail,hideudom,crsdom,caller) { var url = '/adm/pickuser?'; var userdom = getDomainFromSelectbox(formname,udom); if (userdom != null) { @@ -617,6 +618,9 @@ function openuserbrowser(formname,uname, '&uemailelement='+uemail+ '&hideudomelement='+hideudom+ '&coursedom='+crsdom; + if ((caller != null) && (caller != undefined)) { + url += '&caller='+caller; + } var title = 'User_Browser'; var options = 'scrollbars=1,resizable=1,menubar=0'; options += ',width=700,height=600'; @@ -624,23 +628,27 @@ function openuserbrowser(formname,uname, stdeditbrowser.focus(); } -function fix_domain (formname,udom,origdom) { +function fix_domain (formname,udom,origdom,uname) { var formid = getFormIdByName(formname); if (formid > -1) { + var unameid = getIndexByName(formid,uname); var domid = getIndexByName(formid,udom); var hidedomid = getIndexByName(formid,origdom); if (hidedomid > -1) { var fixeddom = document.forms[formid].elements[hidedomid].value; - if (domid > -1) { - var slct = document.forms[formid].elements[domid]; - if (slct.type == 'select-one') { - var i; - for (i=0;i -1) { + var slct = document.forms[formid].elements[domid]; + if (slct.type == 'select-one') { + var i; + for (i=0;i' ."'.$linktext.''; } @@ -2947,7 +3017,7 @@ sub messagewrapper { sub noteswrapper { my ($link,$un,$do)=@_; return -"$link"; +"$link"; } # ------------------------------------------------------------- Aboutme Wrapper @@ -2957,7 +3027,7 @@ sub aboutmewrapper { if (!defined($username) && !defined($domain)) { return; } - return ''.$link.''; } @@ -2971,7 +3041,7 @@ sub syllabuswrapper { # ----------------------------------------------------------------------------- sub track_student_link { - my ($linktext,$sname,$sdom,$target,$start) = @_; + my ($linktext,$sname,$sdom,$target,$start,$only_body) = @_; my $link ="/adm/trackstudent?"; my $title = 'View recent activity'; if (defined($sname) && $sname !~ /^\s*$/ && @@ -2985,6 +3055,7 @@ sub track_student_link { $target = ''; } if ($start) { $link.='&start='.$start; } + if ($only_body) { $link .= '&only_body=1'; } $title = &mt($title); $linktext = &mt($linktext); return qq{$linktext}. @@ -3917,23 +3988,24 @@ sub parse_block_record { } sub blocking_status { - my $blocked; my ($activity,$uname,$udom) = @_; my %setters; + + # check for active blocking my ($startblock,$endblock)=&blockcheck(\%setters,$activity,$uname,$udom); - if ($startblock && $endblock) { - $blocked = 1; - } - if(!wantarray) { - return $blocked; - } - my $output; - my $querystring; - $querystring = "?activity=$activity"; - $output .= <<"END_MYBLOCK"; - END_MYBLOCK + + $output = Apache::lonhtmlcommon::scripttag($output); + my $popupUrl = "/adm/blockingstatus/$querystring"; + my $text = mt('Communication Blocked'); + $output .= <<"END_BLOCK";
- Communication Blocked + title='$text'> + $text Communication Blocked + title='$text'>$text
END_BLOCK @@ -4035,7 +4109,7 @@ sub determinedomain { my $domain=shift; if (! $domain) { # Determine domain if we have not been given one - $domain = $Apache::lonnet::perlvar{'lonDefDomain'}; + $domain = &Apache::lonnet::default_login_domain(); if ($env{'user.domain'}) { $domain=$env{'user.domain'}; } if ($env{'request.role.domain'}) { $domain=$env{'request.role.domain'}; @@ -4385,6 +4459,9 @@ sub bodytag { if ($env{'request.role'} !~ /^cr/) { $role = &Apache::lonnet::plaintext($role,&course_type()); } + if ($env{'request.course.sec'}) { + $role .= (' 'x2).'- '.&mt('section:').' '.$env{'request.course.sec'}; + } $realm = $env{'course.'.$env{'request.course.id'}.'.description'}; } else { $role = &Apache::lonnet::plaintext($role); @@ -4424,35 +4501,49 @@ sub bodytag { $dc_info = '('.$dc_info.')'; } - $role = "($role)" if $role; + $role = '('.$role.')' if $role; &get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['inhibitmenu']); if ($env{'environment.remote'} eq 'off') { # No Remote - if ($env{'request.state'} eq 'construct') { - $forcereg=1; - } + if ($no_nav_bar) { return $bodytag; } -# if ($env{'request.state'} eq 'construct') { -# $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls -# } - - my $titletable = '' - ."" - .'
$titleinfo $dc_info
'; + if ($env{'request.state'} eq 'construct') { $forcereg=1; } + + # 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'}; - if ($env{'request.state'} eq 'construct') { - $bodytag .= &Apache::lonmenu::menubuttons($forcereg,$titletable); - } else { - $bodytag .= &Apache::lonmenu::menubuttons($forcereg).$titletable; - } + 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(); + + #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; } @@ -4471,7 +4562,7 @@ sub bodytag { :''.&mt('Switch to Inline Menu Mode').''); $bodytag .= qq|
$name $role $realm $dc_info
-
    +
    1. $menu
    | unless $env{'form.inhibitmenu'}; # @@ -4642,14 +4733,6 @@ a:focus { background: yellow } -hr { - clear: both; - color: $tabbg; - background-color: $tabbg; - height: 3px; - border: none; -} - form, .inline { display: inline; } @@ -4859,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; } @@ -4968,12 +5054,14 @@ table.LC_data_table tr.LC_odd_row > td, table.LC_pick_box tr > td.LC_odd_row { background-color: $data_table_light; padding: 2px; + vertical-align: top; } table.LC_data_table tr.LC_even_row > td, table.LC_pick_box tr > td.LC_even_row { background-color: $data_table_dark; padding: 2px; + vertical-align: top; } table.LC_data_table tr.LC_data_table_highlight td { @@ -4994,6 +5082,9 @@ table.LC_nested tr.LC_empty_row td { padding: 8px; } +table.LC_caption { +} + table.LC_nested tr.LC_empty_row td { padding: 4ex } @@ -5117,7 +5208,7 @@ table.LC_mail_list tr.LC_mail_other:hove table.LC_data_table tr > td.LC_browser_file, table.LC_data_table tr > td.LC_browser_file_published { - background: #CCFF88; + background: #AAEE77; } table.LC_data_table tr > td.LC_browser_file_locked, @@ -5126,16 +5217,16 @@ table.LC_data_table tr > td.LC_browser_f } table.LC_data_table tr > td.LC_browser_file_obsolete { - background: #AAAAAA; + background: #888888; } table.LC_data_table tr > td.LC_browser_file_modified, table.LC_data_table tr > td.LC_browser_file_metamodified { - background: #FFFF77; + background: #F8F866; } table.LC_data_table tr.LC_browser_folder > td { - background: #CCCCFF; + background: #E0E8FF; } table.LC_data_table tr > td.LC_roles_is { @@ -5277,7 +5368,7 @@ table.LC_pick_box { table.LC_pick_box td.LC_pick_box_title { background: $sidebg; font-weight: bold; - text-align: right; + text-align: left; vertical-align: top; width: 184px; padding: 8px; @@ -5315,40 +5406,6 @@ table.LC_pick_box td.LC_oddrow_value { background-color: $data_table_light; } -table.LC_helpform_receipt { - width: 620px; - border-collapse: separate; - background: white; - border: 1px solid black; - border-spacing: 1px; -} - -table.LC_helpform_receipt td.LC_pick_box_title { - background: $tabbg; - font-weight: bold; - text-align: right; - width: 184px; - padding: 8px; -} - -table.LC_helpform_receipt td.LC_evenrow_value { - text-align: left; - padding: 8px; - background-color: $data_table_light; -} - -table.LC_helpform_receipt td.LC_oddrow_value { - text-align: left; - padding: 8px; - background-color: $data_table_light; -} - -table.LC_helpform_receipt td.LC_pick_box_separator { - padding: 0; - height: 1px; - background: black; -} - span.LC_helpform_receipt_cat { font-weight: bold; } @@ -5805,14 +5862,14 @@ div.LC_createcourse { # --------------------------*/ a:hover, -ol.LC_smallMenu a:hover, +ol.LC_primary_menu a:hover, ol#LC_MenuBreadcrumbs a:hover, ol#LC_PathBreadcrumbs a:hover, -ul#LC_TabMainMenuContent a:hover, +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 { @@ -5885,7 +5942,7 @@ fieldset > legend { font-style: normal; } -ol.LC_smallMenu { +ol.LC_primary_menu { float: right; margin: 0.2em 0 0 0; } @@ -5894,23 +5951,23 @@ ol#LC_PathBreadcrumbs { margin: 0; } -ol.LC_smallMenu li { +ol.LC_primary_menu li { display: inline; padding: 5px 5px 0 10px; vertical-align: top; } -ol.LC_smallMenu li img { +ol.LC_primary_menu li img { vertical-align: bottom; } -ol.LC_smallMenu a { +ol.LC_primary_menu a { font-size: 90%; color: RGB(80, 80, 80); text-decoration: none; } -ul#LC_TabMainMenuContent { +ul#LC_secondary_menu { clear: both; color: $fontmenu; background: $tabbg; @@ -5920,7 +5977,7 @@ ul#LC_TabMainMenuContent { width: 100%; } -ul#LC_TabMainMenuContent li { +ul#LC_secondary_menu li { font-weight: bold; line-height: 1.8em; padding: 0 0.8em; @@ -5943,7 +6000,7 @@ ul.LC_TabContentBigger li { float:left; } -ul#LC_TabMainMenuContent li a { +ul#LC_secondary_menu li a { color: $fontmenu; text-decoration: none; } @@ -6042,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, @@ -6049,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, @@ -6732,14 +6793,14 @@ sub simple_error_page { my ($add_class) = @_; $row_count[0]++; my $css_class = ($row_count[0] % 2)?'LC_odd_row':'LC_even_row'; - $css_class = (join(' ',$css_class,$add_class)); + $css_class = (join(' ',$css_class,$add_class)) unless ($add_class eq ''); return ''."\n";; } sub continue_data_table_row { my ($add_class) = @_; my $css_class = ($row_count[0] % 2)?'LC_odd_row':'LC_even_row'; - $css_class = (join(' ',$css_class,$add_class)); + $css_class = (join(' ',$css_class,$add_class)) unless ($add_class eq '');; return ''."\n";; } @@ -6763,6 +6824,11 @@ sub simple_error_page { sub end_data_table_header_row { return ''."\n";; } + + sub data_table_caption { + my $caption = shift; + return "$caption"; + } } =pod @@ -10243,6 +10309,16 @@ sub group_term { return $names{$crstype}; } +sub course_types { + my @types = ('official','unofficial','community'); + my %typename = ( + official => 'Official course', + unofficial => 'Unofficial course', + community => 'Community', + ); + return (\@types,\%typename); +} + sub icon { my ($file)=@_; my $curfext = lc((split(/\./,$file))[-1]);