';
for (my $col=1; $col<=2; $col++) {
$output.='';
for (my $row=1; $row<=8; $row++) {
foreach my $cat (keys(%category_members)) {
if ($category_positions{$cat} ne "$col,$row") { next; }
#$output.=' ';
- $output.='';
- $output.=' '.&mt($category_names{$cat}).'';
+ $output.=' ';
+ $output.=' '.&mt($category_names{$cat}).'';
$output.=' ';
my %active=();
foreach my $menu_item (split(/\:/,$category_members{$cat})) {
@@ -1310,12 +1560,12 @@ sub rawconfig {
#
my $textualoverride=shift;
my $output='';
- unless ($env{'environment.remote'} eq 'off') {
+ if ($env{'environment.remote'} eq 'on') {
$output.=
"window.status='Opening Remote Control';var swmenu=".&openmenu().
"\nwindow.status='Configuring Remote Control ';";
} else {
- unless ($textualoverride) { return ''; }
+ unless ($textualoverride) { return ''; }
}
my $uname=$env{'user.name'};
my $udom=$env{'user.domain'};
@@ -1398,15 +1648,31 @@ sub rawconfig {
}
} elsif ($pro =~ /^courseenv_(.*)$/) {
my $key = $1;
- if (($env{'course.'.$env{'request.course.id'}.'.'.$key}) &&
- ($crstype ne 'Community')) {
- $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
+ if ($crstype ne 'Community') {
+ my $coursepref = $env{'course.'.$env{'request.course.id'}.'.'.$key};
+ if ($key eq 'canuse_pdfforms') {
+ if ($env{'request.course.id'} && $coursepref eq '') {
+ my %domdefs = &Apache::lonnet::get_domain_defaults($env{'course.'.$env{'request.course.id'}.'.domain'});
+ $coursepref = $domdefs{'canuse_pdfforms'};
+ }
+ }
+ if ($coursepref) {
+ $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
+ }
}
} elsif ($pro =~ /^communityenv_(.*)$/) {
my $key = $1;
- if (($env{'course.'.$env{'request.course.id'}.'.'.$key}) &&
- ($crstype eq 'Community')) {
- $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
+ if ($crstype eq 'Community') {
+ my $coursepref = $env{'course.'.$env{'request.course.id'}.'.'.$key};
+ if ($key eq 'canuse_pdfforms') {
+ if ($env{'request.course.id'} && $coursepref eq '') {
+ my %domdefs = &Apache::lonnet::get_domain_defaults($env{'course.'.$env{'request.course.id'}.'.domain'});
+ $coursepref = $domdefs{'canuse_pdfforms'};
+ }
+ }
+ if ($coursepref) {
+ $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
+ }
}
} elsif ($pro =~ /^course_(.*)$/) {
# Check for permissions inside of a course
@@ -1437,6 +1703,7 @@ sub rawconfig {
($env{'request.role'}=~/($match_domain)\/($match_username)$/);
}
$act =~ s/\$caname/$caname/g;
+ $act =~ s/\$cadom/$cadom/g;
my $home = &Apache::lonnet::homeserver($caname,$cadom);
my $allowed=0;
my @ids=&Apache::lonnet::current_machine_ids();
@@ -1474,13 +1741,12 @@ sub rawconfig {
$uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
}
}
- unless ($env{'environment.remote'} eq 'off') {
- $output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';";
- if (&Apache::lonmsg::newmail()) {
- $output.='swmenu.setstatus("you have","messages");';
- }
+ if ($env{'environment.remote'} eq 'on') {
+ $output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';";
+ if (&Apache::lonmsg::newmail()) {
+ $output.='swmenu.setstatus("you have","messages");';
+ }
}
-
return $output;
}
@@ -1509,7 +1775,7 @@ sub check_for_rcrs {
# ======================================================================= Close
sub close {
- if ($env{'environment.remote'} eq 'off') { return ''; }
+ unless ($env{'environment.remote'} eq 'on') { return ''; }
my $menuname = &get_menu_name();
return(<
@@ -1528,45 +1794,68 @@ window.status='Done.';
ENDCLOSE
}
-# ====================================================================== Footer
+sub dc_popup_js {
+ my %lt = &Apache::lonlocal::texthash(
+ more => '(More ...)',
+ less => '(Less ...)',
+ );
+ return <<"END";
-sub footer {
+function showCourseID() {
+ document.getElementById('dccid').style.display='block';
+ document.getElementById('dccid').style.textAlign='left';
+ document.getElementById('dccid').style.textFace='normal';
+ document.getElementById('dccidtext').innerHTML ='';
+ return;
+}
+function hideCourseID() {
+ document.getElementById('dccid').style.display='none';
+ document.getElementById('dccidtext').innerHTML ='';
+ return;
}
-sub nav_control_js {
- my $nav=($env{'environment.remotenavmap'} eq 'on');
- return (< 1});
- my $start_page_bookmark =
- &Apache::loncommon::start_page('Bookmarks',undef,
- {'only_body' => 1,
- 'js_ready' => 1,
- 'bgcolor' => '#BBBBBB',});
+ my $jumptores = &Apache::lonhtmlcommon::javascript_jumpto_resource();
- my $end_page_bookmark =
- &Apache::loncommon::end_page({'js_ready' => 1});
+ my $esc_url=&escape($currenturl);
+ my $esc_symb=&escape($currentsymb);
+
+ my $countdown = &countdown_toggle_js();
return (<'
- +'$end_page_bookmark' );
- bmquery.document.close();
+function open_StoredLinks_Import(rat) {
+ var newWin;
+ if (rat) {
+ newWin = window.open('/adm/wishlist?inhibitmenu=yes&mode=import&rat='+rat,
+ 'wishlistImport','scrollbars=1,resizable=1,menubar=0');
+ }
+ else {
+ newWin = window.open('/adm/wishlist?inhibitmenu=yes&mode=import',
+ 'wishlistImport','scrollbars=1,resizable=1,menubar=0');
+ }
+ newWin.focus();
}
+(function (\$) {
+ \$(document).ready(function () {
+ \$.single=function(a){return function(b){a[0]=b;return a}}(\$([1]));
+ /*\@cc_on
+ if (!window.XMLHttpRequest) {
+ \$('.LC_hoverable').each(function () {
+ this.attachEvent('onmouseenter', function (evt) { \$.single(evt.srcElement).addClass('hover'); });
+ this.attachEvent('onmouseleave', function (evt) { \$.single(evt.srcElement).removeClass('hover'); });
+ });
+ }
+ \@*/
+ });
+}(jQuery));
+
+$countdown
+
ENDUTILITY
}
@@ -1763,23 +2052,20 @@ sub constspaceform {
ENDCONSTSPACEFORM
}
-
sub get_nav_status {
my $navstatus="swmenu.w_loncapanav_flag=";
if ($env{'environment.remotenavmap'} eq 'on') {
- $navstatus.="1";
+ $navstatus.="1";
} else {
- $navstatus.="-1";
+ $navstatus.="-1";
}
return $navstatus;
}
sub hidden_button_check {
- my $hidden;
- if ($env{'request.course.id'} eq '') {
- return;
- }
- if ($env{'request.role.adv'}) {
+ if ( $env{'request.course.id'} eq ''
+ || $env{'request.role.adv'} ) {
+
return;
}
my $buttonshide = &Apache::lonnet::EXT('resource.0.buttonshide');
@@ -1788,16 +2074,43 @@ sub hidden_button_check {
sub roles_selector {
my ($cdom,$cnum) = @_;
- my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
- if ($crstype eq '') {
- $crstype = 'Course';
- }
+ my $crstype = &Apache::loncommon::course_type();
my $now = time;
- my (%courseroles,%seccount);
+ my (%courseroles,%seccount,%courseprivs);
my $is_cc;
my $role_selector;
- if ($env{'user.role.cc./'.$cdom.'/'.$cnum}) {
- my ($start,$end) = split(/\./,$env{'user.role.cc./'.$cdom.'/'.$cnum});
+ my $ccrole;
+ if ($crstype eq 'Community') {
+ $ccrole = 'co';
+ } else {
+ $ccrole = 'cc';
+ }
+ my ($priv,$gotsymb,$destsymb);
+ my $destinationurl = $ENV{'REQUEST_URI'};
+ if ($destinationurl =~ /\?symb=/) {
+ $gotsymb = 1;
+ } elsif ($destinationurl =~ m{^/enc/}) {
+ my $plainurl = &Apache::lonenc::unencrypted($destinationurl);
+ if ($plainurl =~ /\?symb=/) {
+ $gotsymb = 1;
+ }
+ }
+ unless ($gotsymb) {
+ $destsymb = &Apache::lonnet::symbread();
+ if ($destsymb ne '') {
+ $destsymb = &Apache::lonenc::check_encrypt($destsymb);
+ }
+ }
+ my $reqprivs = &required_privs();
+ if (ref($reqprivs) eq 'HASH') {
+ my $destination = $destinationurl;
+ $destination =~ s/(\?.*)$//;
+ if (exists($reqprivs->{$destination})) {
+ $priv = $reqprivs->{$destination};
+ }
+ }
+ if ($env{'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum}) {
+ my ($start,$end) = split(/\./,$env{'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum});
if ((($start) && ($start<0)) ||
(($end) && ($end<$now)) ||
@@ -1808,7 +2121,7 @@ sub roles_selector {
}
}
if ($is_cc) {
- &get_all_courseroles($cdom,$cnum,\%courseroles,\%seccount);
+ &get_all_courseroles($cdom,$cnum,\%courseroles,\%seccount,\%courseprivs,$priv);
} else {
my %gotnosection;
foreach my $item (keys(%env)) {
@@ -1824,6 +2137,18 @@ sub roles_selector {
$gotnosection{$role} = 1;
}
}
+ if ($priv ne '') {
+ my $cnumsec = $cnum;
+ if ($sec ne '') {
+ $cnumsec .= "/$sec";
+ }
+ $courseprivs{"$role./$cdom/$cnumsec./"} =
+ $env{"user.priv.$role./$cdom/$cnumsec./"};
+ $courseprivs{"$role./$cdom/$cnumsec./$cdom/"} =
+ $env{"user.priv.$role./$cdom/$cnumsec./$cdom/"};
+ $courseprivs{"$role./$cdom/$cnumsec./$cdom/$cnumsec"} =
+ $env{"user.priv.$role./$cdom/$cnumsec./$cdom/$cnumsec"};
+ }
if (ref($courseroles{$role}) eq 'ARRAY') {
if ($sec ne '') {
if (!grep(/^\Q$sec\E$/,@{$courseroles{$role}})) {
@@ -1847,15 +2172,15 @@ sub roles_selector {
} else {
$switchtext = &mt('Switch course role to...')
}
- my @roles_order = ('cc','in','ta','ep','ad','st');
+ my @roles_order = ($ccrole,'in','ta','ep','ad','st');
if (keys(%courseroles) > 1) {
- $role_selector = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles);
+ $role_selector = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles,\%courseprivs,$priv);
$role_selector .= '
|