[LON-CAPA-cvs] cvs: rat / lonpage.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Sun, 29 Aug 2004 18:34:37 -0000
raeburn Sun Aug 29 14:34:37 2004 EDT
Modified files:
/rat lonpage.pm
Log:
1. Add lonlocal (line 48) so &mt() call at line 354 is error-free.
2. Changes to sub tracetable().
Most changes are indentation changes to conform to LON-CAPA style.
Functionality changes are: lines 76-79 - detect if resource is hidden, and user has student role. If so lines 82-115 are not executed. Purpose is to display hidden resources in a page to non-students, but to hide them from students. Might cause confusion in the attached discussions, as different students may be commenting on different resources in the page. Recommendation for future is to add an apprpriate note to any feedback window, where feedback is being given on a page with hidden resources.
Index: rat/lonpage.pm
diff -u rat/lonpage.pm:1.56 rat/lonpage.pm:1.57
--- rat/lonpage.pm:1.56 Mon Mar 22 15:37:06 2004
+++ rat/lonpage.pm Sun Aug 29 14:34:36 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Page Handler
#
-# $Id: lonpage.pm,v 1.56 2004/03/22 20:37:06 sakharuk Exp $
+# $Id: lonpage.pm,v 1.57 2004/08/29 18:34:36 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -45,6 +45,7 @@
use Apache::lonnet();
use Apache::loncommon();
use Apache::lonxml();
+use Apache::lonlocal;
use Apache::lonmenu;
use HTML::TokeParser;
use GDBM_File;
@@ -72,66 +73,70 @@
sub tracetable {
my ($sofar,$rid,$beenhere)=@_;
my $further=$sofar;
+ my $randomout=0;
+ if ($ENV{'request.role'} =~ /^st/) {
+ $randomout = $hash{'randomout_'.$rid};
+ }
unless ($beenhere=~/\&$rid\&/) {
- $beenhere.=$rid.'&';
-
- if (defined($hash{'is_map_'.$rid})) {
- if ((defined($hash{'map_start_'.$hash{'src_'.$rid}})) &&
- (defined($hash{'map_finish_'.$hash{'src_'.$rid}}))) {
- my $frid=$hash{'map_finish_'.$hash{'src_'.$rid}};
- $sofar=
- &tracetable($sofar,$hash{'map_start_'.$hash{'src_'.$rid}},
- '&'.$frid.'&');
- $sofar++;
- if ($hash{'src_'.$frid}) {
- my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$frid});
- if (($brepriv eq '2') || ($brepriv eq 'F')) {
- if (defined($rows[$sofar])) {
- $rows[$sofar].='&'.$frid;
- } else {
- $rows[$sofar]=$frid;
- }
- }
- }
- }
- } else {
- $sofar++;
- if ($hash{'src_'.$rid}) {
- my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$rid});
- if (($brepriv eq '2') || ($brepriv eq 'F')) {
- if (defined($rows[$sofar])) {
- $rows[$sofar].='&'.$rid;
- } else {
- $rows[$sofar]=$rid;
- }
- }
- }
- }
-
- if (defined($hash{'to_'.$rid})) {
- my $mincond=1;
- my $next='';
- foreach (split(/\,/,$hash{'to_'.$rid})) {
- my $thiscond=
+ $beenhere.=$rid.'&';
+ unless ($randomout) {
+ if (defined($hash{'is_map_'.$rid})) {
+ if ((defined($hash{'map_start_'.$hash{'src_'.$rid}})) &&
+ (defined($hash{'map_finish_'.$hash{'src_'.$rid}}))) {
+ my $frid=$hash{'map_finish_'.$hash{'src_'.$rid}};
+ $sofar=
+ &tracetable($sofar,$hash{'map_start_'.$hash{'src_'.$rid}},
+ '&'.$frid.'&');
+ $sofar++;
+ if ($hash{'src_'.$frid}) {
+ my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$frid});
+ if (($brepriv eq '2') || ($brepriv eq 'F')) {
+ if (defined($rows[$sofar])) {
+ $rows[$sofar].='&'.$frid;
+ } else {
+ $rows[$sofar]=$frid;
+ }
+ }
+ }
+ }
+ } else {
+ $sofar++;
+ if ($hash{'src_'.$rid}) {
+ my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$rid});
+ if (($brepriv eq '2') || ($brepriv eq 'F')) {
+ if (defined($rows[$sofar])) {
+ $rows[$sofar].='&'.$rid;
+ } else {
+ $rows[$sofar]=$rid;
+ }
+ }
+ }
+ }
+ }
+
+ if (defined($hash{'to_'.$rid})) {
+ my $mincond=1;
+ my $next='';
+ foreach (split(/\,/,$hash{'to_'.$rid})) {
+ my $thiscond=
&Apache::lonnet::directcondval($hash{'condid_'.$hash{'undercond_'.$_}});
- if ($thiscond>=$mincond) {
- if ($next) {
- $next.=','.$_.':'.$thiscond;
- } else {
- $next=$_.':'.$thiscond;
- }
- if ($thiscond>$mincond) { $mincond=$thiscond; }
- }
- }
- foreach (split(/\,/,$next)) {
- my ($linkid,$condval)=split(/\:/,$_);
- if ($condval>=$mincond) {
- my $now=&tracetable($sofar,$hash{'goesto_'.$linkid},$beenhere);
- if ($now>$further) { $further=$now; }
- }
- }
-
- }
+ if ($thiscond>=$mincond) {
+ if ($next) {
+ $next.=','.$_.':'.$thiscond;
+ } else {
+ $next=$_.':'.$thiscond;
+ }
+ if ($thiscond>$mincond) { $mincond=$thiscond; }
+ }
+ }
+ foreach (split(/\,/,$next)) {
+ my ($linkid,$condval)=split(/\:/,$_);
+ if ($condval>=$mincond) {
+ my $now=&tracetable($sofar,$hash{'goesto_'.$linkid},$beenhere);
+ if ($now>$further) { $further=$now; }
+ }
+ }
+ }
}
return $further;
}