$lt{'ret'}
ENDRELOAD
}
+ if ($role_selector) {
+ $roles = ''.$role_selector.' | '.$lt{'other'}.' | ';
+ }
}
if (($env{'request.state'} eq 'construct') && ($env{'request.course.id'})) {
my $escreload=&escape('return:');
@@ -258,7 +273,7 @@ $navmaps
$docs
$groups
$remote
-$lt{'roles'} |
+$roles
$helplink |
$lt{'exit'} |
@@ -274,6 +289,19 @@ ENDINLINEMENU
}
}
+sub show_return_link {
+ return (($env{'request.noversionuri'}=~m{^/(res|public)/} &&
+ $env{'request.symb'} eq '')
+ ||
+ ($env{'request.noversionuri'}=~ m{^/cgi-bin/printout.pl})
+ ||
+ (($env{'request.noversionuri'}=~/^\/adm\//) &&
+ ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
+ ($env{'request.noversionuri'}!~
+ m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)])
+ ));
+}
+
# ====================================== This gets called in the header section
sub registerurl {
@@ -334,16 +362,18 @@ sub innerregister {
} else {
$newmail= 'swmenu.setstatus("you have","messages");';
}
- } elsif (($textual)
+ }
+ if (($textual)
&& ($env{'request.symb'})
&& ($env{'request.course.id'})) {
$newmail.= '';
my ($mapurl,$rid,$resurl)=
&Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
- $newmail.=$env{'course.'.$env{'request.course.id'}.'.description'};
+ my $coursetitle=$env{'course.'.$env{'request.course.id'}.'.description'};
+ $newmail.=$coursetitle;
my $maptitle=&Apache::lonnet::gettitle($mapurl);
my $restitle=&Apache::lonnet::gettitle(&Apache::lonnet::symbread());
- if ($maptitle && $maptitle ne 'default.sequence') {
+ if ($maptitle && ($maptitle ne 'default.sequence') && ($maptitle ne $coursetitle)) {
$newmail.=', '.$maptitle;
}
if ($restitle) {
@@ -398,19 +428,24 @@ sub innerregister {
###
my $editbutton = '';
if ($env{'user.author'}) {
- if ($env{'request.role'}=~/^(ca|au)/) {
+ if ($env{'request.role'}=~/^(aa|ca|au)/) {
# Set defaults for authors
my ($top,$bottom) = ('con-','struct');
my $action = "go('/priv/".$env{'user.name'}."');";
my $cadom = $env{'request.role.domain'};
my $caname = $env{'user.name'};
- my $desc = "Enter my resource construction space";
+ my $desc = "Enter my construction space";
# Set defaults for co-authors
if ($env{'request.role'} =~ /^ca/) {
($cadom,$caname)=($env{'request.role'}=~/($match_domain)\/($match_username)$/);
($top,$bottom) = ('co con-','struct');
$action = "go('/priv/".$caname."');";
$desc = "Enter construction space as co-author";
+ } elsif ($env{'request.role'} =~ /^aa/) {
+ ($cadom,$caname)=($env{'request.role'}=~/($match_domain)\/($match_username)$/);
+ ($top,$bottom) = ('co con-','struct');
+ $action = "go('/priv/".$caname."');";
+ $desc = "Enter construction space as assistant co-author";
}
# Check that we are on the correct machine
my $home = &Apache::lonnet::homeserver($caname,$cadom);
@@ -547,29 +582,34 @@ $inlineremote[91] $inlineremote[92] $inl
ENDINLINEICONS
}
} else {
- $inlinebuttons=(<$inlineremote[21] | | $inlineremote[23] |
ENDFIRSTLINE
- if (&hidden_button_check() ne 'yes') {
- $inlinebuttons .= (<$inlineremote[61] | $inlineremote[62] | $inlineremote[63] |
-$inlineremote[71] | $inlineremote[72] | $inlineremote[73] |
-$inlineremote[81] | $inlineremote[82] | $inlineremote[83] |
-$inlineremote[91] | $inlineremote[92] | $inlineremote[93] |
-ENDINLINE
}
- }
- }
+ if (&hidden_button_check() ne 'yes') {
+ foreach my $row (6..9) {
+ if ($inlineremote[${row}.'1'] ne ''
+ || $inlineremote[$row.'2'] ne ''
+ || $inlineremote[$row.'3'] ne '') {
+ $inlinebuttons .= <<"ENDLINE";
+$inlineremote["${row}1"] | $inlineremote["${row}2"] | $inlineremote["${row}3"] |
+ENDLINE
+ }
+ }
+ }
+ }
+ }
}
$result =(<
// BEGIN LON-CAPA Internal
$timesync
-$newmail
$tablestart
$inlinebuttons
$tableend
+$newmail
@@ -788,12 +828,19 @@ sub load_remote_msg {
$link
ENDREMOTEFORM
}
+
+sub get_menu_name {
+ my $hostid = $Apache::lonnet::perlvar{'lonHostID'};
+ $hostid =~ s/\W//g;
+ return 'LCmenu'.$hostid;
+}
+
# ================================================================= Reopen menu
sub reopenmenu {
if (($env{'browser.interface'} eq 'textual') ||
($env{'environment.remote'} eq 'off')) { return ''; }
- my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
+ my $menuname = &get_menu_name();
my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
return('window.open('.$nothing.',"'.$menuname.'","",false);');
}
@@ -806,7 +853,7 @@ sub open {
($env{'environment.remote'} eq 'off')) {
return '';
}
- my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
+ my $menuname = &get_menu_name();
# unless (shift eq 'unix') {
# resizing does not work on linux because of virtual desktop sizes
@@ -851,8 +898,9 @@ sub switch {
$top=&mt($top);
$bot=&mt($bot);
$desc=&mt($desc);
- $img=&mt($img);
-
+ if (($env{'environment.remote'} ne 'off') || ($env{'environment.icons'} eq 'classic')) {
+ $img=&mt($img);
+ }
my $idx=10*$row+$col;
$category_members{$cat}.=':'.$idx;
@@ -882,12 +930,10 @@ sub switch {
my $text=$top.' '.$bot;
$text=~s/\s*\-\s*//gs;
- my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'};
- if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; }
my $pic=
- '';
+ '';
if ($env{'browser.interface'} eq 'faketextual') {
# Accessibility
if ($nobreak==3) {
@@ -936,7 +982,7 @@ sub secondlevel {
}
sub openmenu {
- my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
+ my $menuname = &get_menu_name();
if (($env{'browser.interface'} eq 'textual') ||
($env{'environment.remote'} eq 'off')) { return ''; }
my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
@@ -986,6 +1032,7 @@ sub rawconfig {
my $uname=$env{'user.name'};
my $udom=$env{'user.domain'};
my $adv=$env{'user.adv'};
+ my $show_course=&show_course();
my $author=$env{'user.author'};
my $crs='';
if ($env{'request.course.id'}) {
@@ -1025,6 +1072,16 @@ sub rawconfig {
$output.=&secondlevel(
$uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
}
+ } elsif ($pro eq 'shc') {
+ if ($show_course) {
+ $output.=&secondlevel(
+ $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
+ }
+ } elsif ($pro eq 'nsc') {
+ if (!$show_course) {
+ $output.=&secondlevel(
+ $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
+ }
} elsif (($pro=~/^p(\w+)/) && ($prt)) {
if (&Apache::lonnet::allowed($1,$prt)) {
$output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
@@ -1049,11 +1106,12 @@ sub rawconfig {
} elsif ($pro eq 'author') {
if ($author) {
if ((($prt eq 'rca') && ($env{'request.role'}=~/^ca/)) ||
+ (($prt eq 'raa') && ($env{'request.role'}=~/^aa/)) ||
(($prt eq 'rau') && ($env{'request.role'}=~/^au/))) {
# Check that we are on the correct machine
my $cadom=$requested_domain;
my $caname=$env{'user.name'};
- if ($prt eq 'rca') {
+ if (($prt eq 'rca') || ($prt eq 'raa')) {
($cadom,$caname)=
($env{'request.role'}=~/($match_domain)\/($match_username)$/);
}
@@ -1086,7 +1144,7 @@ sub rawconfig {
sub close {
if (($env{'browser.interface'} eq 'textual') ||
($env{'environment.remote'} eq 'off')) { return ''; }
- my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
+ my $menuname = &get_menu_name();
return(<
window.status='Accessing Remote Control';
@@ -1362,9 +1420,121 @@ sub hidden_button_check {
if ($env{'request.role.adv'}) {
return;
}
- return &Apache::lonnet::EXT('resource.0.buttonshide');
+ my $buttonshide = &Apache::lonnet::EXT('resource.0.buttonshide');
+ return $buttonshide;
}
+sub roles_selector {
+ my ($cdom,$cnum) = @_;
+ my $now = time;
+ my %courseroles;
+ my $is_cc;
+ my $role_selector;
+ if ($env{'user.role.cc./'.$cdom.'/'.$cnum}) {
+ my ($start,$end) = split(/\./,$env{'user.role.cc./'.$cdom.'/'.$cnum});
+
+ if ((($start) && ($start<0)) ||
+ (($end) && ($end<$now)) ||
+ (($start) && ($now<$start))) {
+ $is_cc = 0;
+ } else {
+ $is_cc = 1;
+ }
+ }
+ if ($is_cc) {
+ my %adv_roles =
+ &Apache::lonnet::get_course_adv_roles($env{'request.course.id'},1);
+ foreach my $role (keys(%adv_roles),'st') {
+ my ($urole,$usec) = split(/:/,$role);
+ @{$courseroles{$urole}} = 'none';
+ }
+ } else {
+ foreach my $item (keys(%env)) {
+ if ($item =~ m-^user\.role\.([^.]+)\./\Q$cdom\E/\Q$cnum\E(/?\w*)$-) {
+ my $role = $1;
+ my $sec = $2;
+ next if ($role eq 'gr');
+ my ($start,$end) = split(/\./,$env{$item});
+ next if (($start && $start > $now) || ($end && $end < $now));
+ if ($sec eq '') {
+ $sec = 'none';
+ }
+ if (ref($courseroles{$role}) eq 'ARRAY') {
+ if (!grep(/^Q$sec\E$/,@{$courseroles{$role}})) {
+ push(@{$courseroles{$role}},$sec);
+ }
+ } else {
+ @{$courseroles{$role}} = ($sec);
+ }
+ }
+ }
+ }
+ my @roles_order = ('cc','in','ta','ep','ad','st');
+ if (keys(%courseroles) > 1) {
+ $role_selector = &jump_to_role($cdom,$cnum);
+ $role_selector .= '';
+ }
+ return $role_selector;
+}
+
+sub jump_to_role {
+ my ($cdom,$cnum) = @_;
+ my $output = <<"END";
+
+END
+ return $output;
+}
+
+
# ================================================================ Main Program
BEGIN {
|