--- loncom/interface/loncommon.pm 2009/08/03 16:47:53 1.875 +++ loncom/interface/loncommon.pm 2009/10/10 03:32:46 1.895 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.875 2009/08/03 16:47:53 bisitz Exp $ +# $Id: loncommon.pm,v 1.895 2009/10/10 03:32:46 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -483,27 +483,18 @@ ENDAUTHORBRW sub coursebrowser_javascript { my ($domainfilter,$sec_element,$formname)=@_; - 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 $output = ' + 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 = ' ENDTEMPLATE return $template; @@ -2880,7 +2965,7 @@ sub aboutmewrapper { if (!defined($username) && !defined($domain)) { return; } - return ''.$link.''; } @@ -2894,7 +2979,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*$/ && @@ -2908,6 +2993,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}. @@ -3840,23 +3926,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 @@ -3958,7 +4047,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'}; @@ -4352,29 +4441,47 @@ sub bodytag { if ($env{'environment.remote'} eq 'off') { # No Remote - if ($env{'request.state'} eq 'construct') { - $forcereg=1; - } + 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 ($env{'request.state'} eq 'construct') { + # $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls + # } my $titletable = '' - ."" - .'
$titleinfo $dc_info
'; + ." $titleinfo $dc_info" + .''; - if ($no_nav_bar) { - $bodytag .= $titletable; - } else { - $bodytag .= qq|
$name $role
- $realm $dc_info
| unless $env{'form.inhibitmenu'}; + 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; - } +#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; } @@ -4391,7 +4498,7 @@ sub bodytag { # Explicit link to get inline menu my $menu= ($no_inline_link?'' - :''.&mt('Switch to Inline Menu Mode').''); + :''.&mt('Switch to Inline Menu Mode').''); $bodytag .= qq|
$name $role $realm $dc_info
    @@ -4565,14 +4672,6 @@ a:focus { background: yellow } -hr { - clear: both; - color: $tabbg; - background-color: $tabbg; - height: 3px; - border: none; -} - form, .inline { display: inline; } @@ -4838,10 +4937,6 @@ td.LC_menubuttons_text { font-weight: bold; } -.LC_roleslog_note { - font-size: small; -} - table.LC_data_table, table.LC_mail_list { border: 1px solid #000000; @@ -4861,6 +4956,7 @@ table.LC_nested_outer { width: 100%; } +table.LC_innerpickbox, table.LC_nested { border: none; border-collapse: collapse; @@ -4871,13 +4967,19 @@ table.LC_nested { table.LC_data_table tr th, table.LC_calendar tr th, table.LC_mail_list tr th, -table.LC_prior_tries tr th { +table.LC_prior_tries tr th, +table.LC_innerpickbox tr th { font-weight: bold; background-color: $data_table_head; color:$fontmenu; font-size:90%; } +table.LC_innerpickbox tr th, +table.LC_innerpickbox tr td { + vertical-align: top; +} + table.LC_data_table tr.LC_info_row > td { background-color: #CCCCCC; font-weight: bold; @@ -4914,6 +5016,9 @@ table.LC_nested tr.LC_empty_row td { padding: 8px; } +table.LC_caption { +} + table.LC_nested tr.LC_empty_row td { padding: 4ex } @@ -6683,6 +6788,11 @@ sub simple_error_page { sub end_data_table_header_row { return ''."\n";; } + + sub data_table_caption { + my $caption = shift; + return "$caption"; + } } =pod @@ -7455,6 +7565,7 @@ sub user_picker { # loncreateuser::print_user_query_page() # has been completed. next if ($option eq 'alc'); + next if (($option eq 'crs') && ($env{'form.form'} eq 'requestcrs')); next if ($option eq 'crs' && !$env{'request.course.id'}); if ($curr_selected{'srchin'} eq $option) { $srchinsel .= ' @@ -7619,24 +7730,20 @@ $newuserscript $new_user_create - - - - - - - - - - -
    $lt{'doma'}:$domform
    $lt{'usr'}:$srchbysel - $srchtypesel - - $srchinsel -
    -
    END_BLOCK + $output .= &Apache::lonhtmlcommon::start_pick_box(). + &Apache::lonhtmlcommon::row_title($lt{'doma'}). + $domform. + &Apache::lonhtmlcommon::row_closure(). + &Apache::lonhtmlcommon::row_title($lt{'usr'}). + $srchbysel. + $srchtypesel. + ''. + $srchinsel. + &Apache::lonhtmlcommon::row_closure(1). + &Apache::lonhtmlcommon::end_pick_box(). + '
    '; return $output; } @@ -9207,10 +9314,11 @@ sub restore_settings { =item * &build_recipient_list() -Build recipient lists for four types of e-mail: +Build recipient lists for five types of e-mail: (a) Error Reports, (b) Package Updates, (c) lonstatus warnings/errors -(d) Help requests, generated by -lonerrorhandler.pm, CHECKRPMS, loncron, and lonsupportreq.pm respectively. +(d) Help requests, (e) Course requests needing approval, generated by +lonerrorhandler.pm, CHECKRPMS, loncron, lonsupportreq.pm and +loncoursequeueadmin.pm respectively. Inputs: defmail (scalar - email address of default recipient), @@ -9783,7 +9891,8 @@ sub check_clone { $clonemsg = &mt('No new course created.').$linefeed.&mt('A new course could not be cloned from the specified original - [_1] - because it is a non-existent course.',$args->{'clonecourse'}.':'.$args->{'clonedomain'}); } else { my %clonedesc = &Apache::lonnet::coursedescription($cloneid,{'one_time' => 1}); - if ($env{'request.role.domain'} eq $args->{'clonedomain'}) { + if (($env{'request.role.domain'} eq $args->{'clonedomain'}) && + (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'}))) { $can_clone = 1; } else { my %clonehash = &Apache::lonnet::get('environment',['cloners'], @@ -9811,7 +9920,7 @@ sub check_clone { } sub construct_course { - my ($args,$logmsg,$courseid,$crsudom,$crsunum,$udom,$uname,$context) = @_; + my ($args,$logmsg,$courseid,$crsudom,$crsunum,$udom,$uname,$context,$cnum,$category) = @_; my $outcome; my $linefeed = '
    '."\n"; if ($context eq 'auto') { @@ -9849,7 +9958,8 @@ sub construct_course { $args->{'crscode'}, $args->{'ccuname'}.':'. $args->{'ccdomain'}, - $args->{'crstype'}); + $args->{'crstype'}, + $cnum,$context,$category); # Note: The testing routines depend on this being output; see # Utils::Course. This needs to at least be output as a comment