form to
allow a user to select the domain to preform an operation in.
@@ -1798,16 +1892,15 @@ selected");
If the $showdomdesc flag is set, the domain name is followed by the domain description.
-If the $autosubmit flag is set, the form containing the domain selector will be auto-submitted by an onchange action.
+The optional $onchange argumnet specifies what should occur if the domain selector is changed, e.g., 'this.form.submit()' if the form is to be automatically submitted.
=cut
#-------------------------------------------
sub select_dom_form {
- my ($defdom,$name,$includeempty,$showdomdesc,$autosubmit) = @_;
- my $onchange;
- if ($autosubmit) {
- $onchange = ' onchange="this.form.submit()"';
+ my ($defdom,$name,$includeempty,$showdomdesc,$onchange) = @_;
+ if ($onchange) {
+ $onchange = ' onchange="'.$onchange.'"';
}
my @domains = sort {lc($a) cmp lc($b)} (&Apache::lonnet::all_domains());
if ($includeempty) { @domains=('',@domains); }
@@ -2862,7 +2955,7 @@ sub messagewrapper {
sub noteswrapper {
my ($link,$un,$do)=@_;
return
-"$link ";
+"$link ";
}
# ------------------------------------------------------------- Aboutme Wrapper
@@ -2872,7 +2965,7 @@ sub aboutmewrapper {
if (!defined($username) && !defined($domain)) {
return;
}
- return ''.$link.' ';
}
@@ -2886,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*$/ &&
@@ -2900,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 }.
@@ -3766,7 +3860,7 @@ sub blockcheck {
($env{'request.role'} !~ m{^st\./\Q$cdom\E/\Q$cnum\E}));
next if ($no_userblock);
- # Retrieve blocking times and identity of blocker for course
+ # Retrieve blocking times and identity of locker for course
# of specified user, unless user has 'evb' privilege.
my ($start,$end)=&get_blocks($setters,$activity,$cdom,$cnum);
@@ -3831,64 +3925,25 @@ sub parse_block_record {
return ($setuname,$setudom,$title,$blocks);
}
-sub build_block_table {
- my ($startblock,$endblock,$setters) = @_;
- my %lt = &Apache::lonlocal::texthash(
- 'cacb' => 'Currently active communication blocks',
- 'cour' => 'Course',
- 'dura' => 'Duration',
- 'blse' => 'Block set by'
- );
- my $output;
- $output = ' '.$lt{'cacb'}.': ';
- $output .= &start_data_table();
- $output .= '
-
- '.$lt{'cour'}.'
- '.$lt{'dura'}.'
- '.$lt{'blse'}.'
-
-';
- foreach my $course (keys(%{$setters})) {
- my %courseinfo=&Apache::lonnet::coursedescription($course);
- for (my $i=0; $i<@{$$setters{$course}{staff}}; $i++) {
- my ($uname,$udom) = @{$$setters{$course}{staff}[$i]};
- my $fullname = &plainname($uname,$udom);
- if (defined($env{'user.name'}) && defined($env{'user.domain'})
- && $env{'user.name'} ne 'public'
- && $env{'user.domain'} ne 'public') {
- $fullname = &aboutmewrapper($fullname,$uname,$udom);
- }
- my ($openblock,$closeblock) = @{$$setters{$course}{times}[$i]};
- $openblock = &Apache::lonlocal::locallocaltime($openblock);
- $closeblock= &Apache::lonlocal::locallocaltime($closeblock);
- $output .= &Apache::loncommon::start_data_table_row().
- ''.$courseinfo{'description'}.' '.
- ''.$openblock.' to '.$closeblock.' '.
- ''.$fullname.' '.
- &Apache::loncommon::end_data_table_row();
- }
- }
- $output .= &end_data_table();
-}
sub blocking_status {
- my $blocked = blocking_status_print(@_);
my ($activity,$uname,$udom) = @_;
- if(!wantarray) {
- return $blocked;
- }
- my $output;
- my $querystring;
- $querystring = "?activity=$activity";
- if(defined($uname)) {
- $querystring .= "&uname=$uname";
- }if(defined($udom)) {
- $querystring .= "&udom=$udom";
- }
+ my %setters;
- $output .= <<"END_MYBLOCK";
-
END_MYBLOCK
+
+ $output = Apache::lonhtmlcommon::scripttag($output);
+
my $popupUrl = "/adm/blockingstatus/$querystring";
- $output.="\nBlocking Table ";
+ my $text = mt('Communication Blocked');
+
+ $output .= <<"END_BLOCK";
+
+
+END_BLOCK
return ($blocked, $output);
}
-sub blocking_status_print {
- my ($activity,$uname,$udom) = @_;
- my %setters;
- my ($blocked,$output,$ownitem,$is_course);
- my ($startblock,$endblock)=&blockcheck(\%setters,$activity,$uname,$udom);
- if ($startblock && $endblock) {
- $blocked = 1;
- if (wantarray) {
- my $category;
- if ($activity eq 'boards') {
- $category = 'Discussion posts in this course';
- } elsif ($activity eq 'blogs') {
- $category = 'Blogs';
- } elsif ($activity eq 'port') {
- if (defined($uname) && defined($udom)) {
- if ($uname eq $env{'user.name'} &&
- $udom eq $env{'user.domain'}) {
- $ownitem = 1;
- }
- }
- $is_course = &Apache::lonnet::is_course($udom,$uname);
- if ($ownitem) {
- $category = 'Your portfolio files';
- } elsif ($is_course) {
- my $coursedesc;
- foreach my $course (keys(%setters)) {
- my %courseinfo =
- &Apache::lonnet::coursedescription($course);
- $coursedesc = $courseinfo{'description'};
- }
- $category = "Group portfolio in the course '$coursedesc'";
- } else {
- $category = 'Portfolio files belonging to ';
- if ($env{'user.name'} eq 'public' &&
- $env{'user.domain'} eq 'public') {
- $category .= &plainname($uname,$udom);
- } else {
- $category .= &aboutmewrapper(&plainname($uname,$udom),$uname,$udom);
- }
- }
- } elsif ($activity eq 'groups') {
- $category = 'Groups in this course';
- }
- my $showstart = &Apache::lonlocal::locallocaltime($startblock);
- my $showend = &Apache::lonlocal::locallocaltime($endblock);
- $output = ' '.&mt('[_1] will be inaccessible between [_2] and [_3] because communication is being blocked.',$category,$showstart,$showend).' ';
- if (!($activity eq 'port' && !($ownitem) && !($is_course))) {
- $output .= &build_block_table($startblock,$endblock,\%setters);
- }
- }
- }
- if (wantarray) {
- return ($blocked,$output);
- } else {
- return $blocked;
- }
-}
###############################################
@@ -4038,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'};
@@ -4388,6 +4397,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);
@@ -4427,36 +4439,52 @@ 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 ($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,$forcereg,
- $titletable);
- } else {
- $bodytag .= &Apache::lonmenu::menubuttons($forcereg,$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;
}
@@ -4473,10 +4501,10 @@ 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
-