--- rat/lonpage.pm 2016/08/10 04:37:32 1.111.2.2
+++ rat/lonpage.pm 2016/10/29 05:59:30 1.111.2.3
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Page Handler
#
-# $Id: lonpage.pm,v 1.111.2.2 2016/08/10 04:37:32 raeburn Exp $
+# $Id: lonpage.pm,v 1.111.2.3 2016/10/29 05:59:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -183,6 +183,7 @@ sub handler {
if (($env{'request.course.fn'}) && (!$env{'form.forceselect'})) {
my $fn=$env{'request.course.fn'};
if (-e "$fn.db") {
+ my %buttonshide;
if (tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER(),0640)) {
# ------------------------------------------------------------------- Hash tied
my $firstres=$hash{'map_start_'.$requrl};
@@ -260,11 +261,17 @@ sub handler {
$lcm*=($#colcont+1)/euclid($lcm,($#colcont+1));
foreach (@colcont) {
my $src=$hash{'src_'.$_};
+ my $plainsrc = $src;
my ($extension)=($src=~/\.(\w+)$/);
$cellexternal{$_}=($hash{'ext_'.$_} eq 'true:');
if ($hash{'encrypted_'.$_}) {
$src=&Apache::lonenc::encrypted($src);
}
+ my ($mapid,$resid)=split(/\./,$_);
+ my $symb=&Apache::lonnet::encode_symb($hash{'map_id_'.$mapid},$resid,$src);
+ unless ($env{'request.role.adv'}) {
+ $buttonshide{$symb} = &Apache::lonnet::EXT("resource.0.buttonshide",$symb);
+ }
$cellemb{$_}=
&Apache::loncommon::fileembstyle($extension);
if ($cellexternal{$_}) {
@@ -275,9 +282,6 @@ ENDEXT
}
} elsif ($cellemb{$_} eq 'ssi') {
# --------------------------------------------------------- This is an SSI cell
- my ($mapid,$resid)=split(/\./,$_);
- my $symb=&Apache::lonnet::encode_symb($hash{'map_id_'.$mapid},$resid,$src);
-
my $prefix=$_.'_';
my $idprefix= join('_',($mapid,$resid,''));
my %posthash=('request.prefix' => $prefix,
@@ -431,11 +435,11 @@ ENDEXT
$output=~
s/\<(input[^\>]+\Qonfocus=\"javascript:disableAutoComplete\E)\(\'([^\']+)\'\)(;\")/\<$1('$idprefix$2')$3/gsi;
unless ($hastimer) {
- if ($src =~ /$LONCAPA::assess_re/) {
+ if ($plainsrc =~ /$LONCAPA::assess_re/) {
%Apache::lonhomework::history =
&Apache::lonnet::restore($symb,$courseid,$domain,$name);
my $type = 'problem';
- if ($src =~ /\.task$/) {
+ if ($extension eq 'task') {
$type = 'Task';
}
my ($status,$accessmsg,$slot_name,$slot) =
@@ -508,7 +512,7 @@ ENDEXT
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
$r->print(&Apache::loncommon::start_page(undef,undef,
- {'force_register' => 1,}));
+ {'force_register' => 1}));
$r->print(&mt('This page is either empty or it only contains resources that are currently hidden').'. ');
$r->print('
'.&mt('Please use the LON-CAPA navigation arrows to move to another item in the course').
&Apache::loncommon::end_page());
@@ -576,10 +580,27 @@ ENDEXT
&add_countdown_timer($currdisp);
}
}
+ my $pagebuttonshide;
+ if (keys(%buttonshide)) {
+ my %uniquebuttonhide;
+ foreach my $item (values(%buttonshide)) {
+ if (exists($uniquebuttonhide{$item})) {
+ $uniquebuttonhide{$item} ++;
+ } else {
+ $uniquebuttonhide{$item} = 1;
+ }
+ }
+ if (keys(%uniquebuttonhide) == 1) {
+ if (lc((keys(%uniquebuttonhide))[0]) eq 'yes') {
+ $pagebuttonshide = 'yes';
+ }
+ }
+ }
# ------------------------------------------------------------------ Start body
$r->print(&Apache::loncommon::start_page(undef,$allscript,
{'force_register' => 1,
- 'bgcolor' => '#ffffff',}));
+ 'bgcolor' => '#ffffff',
+ 'hide_buttons' => $pagebuttonshide}));
# ------------------------------------------------------------------ Start form
if ($nforms) {
my $fmtag = '