$lt{'roles'}
+$roles
$helplink |
$lt{'exit'} |
@@ -274,6 +284,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 +357,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 +423,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);
@@ -484,8 +514,18 @@ c&8&1
c&8&2
s&8&3&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
s&9&1&sbkm.gif&set[_1]&bookmark[_2]&set_bookmark()&Set a bookmark for this resource&&1
-s&9&3&anot.gif&anno-[_1]&tations[_1]&annotate()&Make notes and annotations about this resource&&1
ENDMENUITEMS
+ my $currentURL = &Apache::loncommon::get_symb();
+ my ($symb_old,$symb_old_enc) = &Apache::loncommon::clean_symb($currentURL);
+ my $annotation = &Apache::loncommon::get_annotation($symb_old,$symb_old_enc);
+ $menuitems.="s&9&3&";
+ if (length($annotation) > 0){
+ $menuitems.="anot2.gif";
+ } else {
+ $menuitems.="anot.gif";
+ }
+ $menuitems.="&anno-[_1]&tations[_1]&annotate()&";
+ $menuitems.="Make notes and annotations about this resource&&1\n";
unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) {
if (!$env{'request.enc'}) {
@@ -507,10 +547,19 @@ ENDMENUITEMS
my $buttons='';
foreach (split(/\n/,$menuitems)) {
my ($command,@rest)=split(/\&/,$_);
- if ($command eq 's') {
- $buttons.=&switch('','',@rest);
- } else {
- $buttons.=&clear(@rest);
+ my $idx=10*$rest[0]+$rest[1];
+ if (&hidden_button_check() eq 'yes') {
+ if ($idx == 21 ||$idx == 23) {
+ $buttons.=&switch('','',@rest);
+ } else {
+ $buttons.=&clear(@rest);
+ }
+ } else {
+ if ($command eq 's') {
+ $buttons.=&switch('','',@rest);
+ } else {
+ $buttons.=&clear(@rest);
+ }
}
}
@@ -520,29 +569,52 @@ ENDMENUITEMS
my $inlinebuttons='';
if ($addremote) {
# Registered, textual output
-
if ($env{'browser.interface'} eq 'textual') {
$inlinebuttons=
join('',map { (defined($_)?$_:'') } @inlineremote);
} else {
- $inlinebuttons=(<
+$inlineremote[21] $inlineremote[23]
+ENDARROWSINLINE
+ if (&hidden_button_check() ne 'yes') {
+ $inlinebuttons .= (<
+ENDINLINEICONS
+ }
+ } else {
+ if ($inlineremote[21] ne '' || $inlineremote[23] ne '') {
+ $inlinebuttons=(<$inlineremote[21] | | $inlineremote[23] |
-$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
- }
+ENDFIRSTLINE
+ }
+ 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
@@ -761,12 +833,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);');
}
@@ -779,16 +858,17 @@ sub open {
($env{'environment.remote'} eq 'off')) {
return '';
}
- my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
- unless (shift eq 'unix') {
+ my $menuname = &get_menu_name();
+
+# unless (shift eq 'unix') {
# resizing does not work on linux because of virtual desktop sizes
- $returnval.=(<';
+ '';
if ($env{'browser.interface'} eq 'faketextual') {
# Accessibility
if ($nobreak==3) {
@@ -881,9 +960,13 @@ sub switch {
}
} else {
# Inline Menu
- $inlineremote[$idx]=
+ if ($env{'environment.icons'} eq 'iconsonly') {
+ $inlineremote[$idx]=''.$pic.'';
+ } else {
+ $inlineremote[$idx]=
'';
+ }
}
}
return '';
@@ -904,7 +987,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();
@@ -954,6 +1037,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'}) {
@@ -993,6 +1077,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);
@@ -1017,11 +1111,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)$/);
}
@@ -1036,6 +1131,18 @@ sub rawconfig {
}
}
}
+ } elsif ($pro eq 'tools') {
+ my @tools = ('aboutme','blog','portfolio');
+ if (grep(/^\Q$prt\E$/,@tools)) {
+ if (!&Apache::lonnet::usertools_access($env{'user.name'},
+ $env{'user.domain'},$prt)) {
+ $output.=&clear($row,$col);
+ next;
+ }
+ }
+ $prt='any';
+ $output.=&secondlevel(
+ $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
}
}
unless (($env{'browser.interface'} eq 'textual') ||
@@ -1054,7 +1161,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';
@@ -1238,7 +1345,7 @@ function annotate() {
'$start_page_annotate'
+"';
+ }
+ return $role_selector;
+}
+
+sub jump_to_role {
+ my ($cdom,$cnum,$seccount,$courseroles) = @_;
+ my %lt = &Apache::lonlocal::texthash(
+ this => 'This role has section(s) associated with it.',
+ ente => 'Enter a specific section.',
+ orlb => 'Enter a specific section, or leave blank for no section.',
+ avai => 'Available sections are:',
+ youe => 'You entered an invalid section choice:',
+ plst => 'Please try again',
+ );
+ my $js;
+ if (ref($courseroles) eq 'HASH') {
+ $js = ' var secpick = new Array("'.$lt{'ente'}.'","'.$lt{'orlb'}.'");'."\n".
+ ' var numsec = new Array();'."\n".
+ ' var rolesections = new Array();'."\n".
+ ' var rolenames = new Array();'."\n".
+ ' var roleseclist = new Array();'."\n";
+ my @items = keys(%{$courseroles});
+ for (my $i=0; $i<@items; $i++) {
+ $js .= ' rolenames['.$i.'] = "'.$items[$i].'";'."\n";
+ my ($secs,$secstr);
+ if (ref($courseroles->{$items[$i]}) eq 'ARRAY') {
+ my @sections = sort { $a <=> $b } @{$courseroles->{$items[$i]}};
+ $secs = join('","',@sections);
+ $secstr = join(', ',@sections);
+ }
+ $js .= ' rolesections['.$i.'] = new Array("'.$secs.'");'."\n".
+ ' roleseclist['.$i.'] = "'.$secstr.'";'."\n".
+ ' numsec['.$i.'] = "'.$seccount->{$items[$i]}.'";'."\n";
+ }
+ }
+ my $output = <<"END";
+
+END
+ return $output;
+}
+
# ================================================================ Main Program
| |