';
@@ -2008,6 +2011,7 @@ sub new {
$self->{USERNAME} = shift || $env{'user.name'};
$self->{DOMAIN} = shift || $env{'user.domain'};
+ $self->{CODE} = shift;
@@ -2024,7 +2028,7 @@ sub new {
# assume there are course hashes for the specific requested user@domamin:
#
- if (($self->{USERNAME} eq $env{'user.name'}) && ($self->{DOMAIN} eq $env{'user.domain'})) {
+ if (($self->{USERNAME} eq $env{'user.name'}) && ($self->{DOMAIN} eq $env{'user.domain'}) && !$self->{CODE}) {
# tie the nav hash
@@ -2047,7 +2051,7 @@ sub new {
$self->{PARM_HASH} = \%parmhash;
$self->{PARM_CACHE} = {};
} else {
- $self->change_user($self->{USERNAME}, $self->{DOMAIN});
+ $self->change_user($self->{USERNAME}, $self->{DOMAIN}, $self->{CODE});
}
return $self;
@@ -2060,12 +2064,14 @@ sub new {
# Parameters:
# user - New user.
# domain- Domain the user belongs to.
+# code - Anonymous CODE in use.
# Implicit inputs:
#
sub change_user {
my $self = shift;
$self->{USERNAME} = shift;
$self->{DOMAIN} = shift;
+ $self->{CODE} = shift;
# If the hashes are already tied make sure to break that bond:
@@ -2081,7 +2087,7 @@ sub change_user {
my ($cdom, $cnum) = split(/\_/, $env{'request.course.id'});
my %big_hash;
- &Apache::lonmap::loadmap($cnum, $cdom, $self->{USERNAME}, $self->{DOMAIN}, \%big_hash);
+ &Apache::lonmap::loadmap($cnum, $cdom, $self->{USERNAME}, $self->{DOMAIN}, $self->{CODE}, \%big_hash);
$self->{NAV_HASH} = \%big_hash;
@@ -4362,19 +4368,34 @@ sub printable {
my ($self, $part) = @_;
- # Get the print open/close dates for the resource.
+ &Apache::lonnet::logthis($self->symb());
- my $start = $self->parmval("printstartdate", $part);
- my $end = $self->parmval("printenddate", $part);
# The following cases apply:
- # - No dates set: Printable.
+ # - If a start date is not set, it is replaced by the open date.
+ # - Ditto for start/open replaced by content open.
+ # - If neither start nor printdates are set the part is printable.
# - Start date set but no end date: Printable if now >= start date.
# - End date set but no start date: Printable if now <= end date.
# - both defined: printable if start <= now <= end
#
+
+ # Get the print open/close dates for the resource.
+
+ my $start = $self->parmval("printstartdate", $part);
+ my $end = $self->parmval("printenddate", $part);
+
+ if (!$start) {
+ $start = $self->parmval("opendate", $part);
+ }
+ if (!$start) {
+ $start = $self->parmval("contentopen", $part);
+ }
+
+
my $now = time();
+
my $startok = 1;
my $endok = 1;
@@ -4395,7 +4416,7 @@ sub resprintable {
my $partsref = $self->parts();
my @parts = @$partsref;
- if ((!defined(@parts)) || (scalar(@parts) == 0)) {
+ if (!@parts) {
return $self->printable(0);
} else {
foreach my $part (@parts) {