version 1.486, 2012/06/08 21:24:16
|
version 1.504, 2014/12/11 01:56:34
|
Line 164 If true, the resource's folder will not
|
Line 164 If true, the resource's folder will not
|
it. Default is false. True implies printCloseAll is false, since you |
it. Default is false. True implies printCloseAll is false, since you |
can't close or open folders when this is on anyhow. |
can't close or open folders when this is on anyhow. |
|
|
|
=item * B<map_no_edit_link>: |
|
|
|
If true, the title of the folder or page will not be followed by an |
|
icon/link to direct editing of a folder or composite page, originally |
|
added via the Course Editor. |
|
|
=back |
=back |
|
|
=item * B<Apache::lonnavmaps::communication_status>: |
=item * B<Apache::lonnavmaps::communication_status>: |
Line 488 use HTML::Entities;
|
Line 494 use HTML::Entities;
|
|
|
# For debugging |
# For debugging |
|
|
use Data::Dumper; |
#use Data::Dumper; |
|
|
|
|
# symbolic constants |
# symbolic constants |
Line 613 sub getDescription {
|
Line 619 sub getDescription {
|
return &mt("Having technical difficulties; please check status later"); |
return &mt("Having technical difficulties; please check status later"); |
} |
} |
if ($status == $res->NOTHING_SET) { |
if ($status == $res->NOTHING_SET) { |
return &Apache::lonhtmlcommon::direct_parm_link(&mt("Not currently assigned.",$res->symb(),'opendate'),$part); |
return &Apache::lonhtmlcommon::direct_parm_link(&mt('Not currently assigned'),$res->symb(),'opendate',$part); |
} |
} |
if ($status == $res->OPEN_LATER) { |
if ($status == $res->OPEN_LATER) { |
return &mt("Open [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($open,'start'),$res->symb(),'opendate',$part)); |
return &mt("Open [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($open,'start'),$res->symb(),'opendate',$part)); |
Line 692 sub getDescription {
|
Line 698 sub getDescription {
|
my $maxtries = $res->maxtries($part); |
my $maxtries = $res->maxtries($part); |
my $triesString = ""; |
my $triesString = ""; |
if ($tries && $maxtries) { |
if ($tries && $maxtries) { |
$triesString = '<font size="-1"><i>('.&mt('[_1] of [quant,_2,try,tries] used',$tries,$maxtries).')</i></font>'; |
$triesString = '<span class="LC_fontsize_medium"><i>('.&mt('[_1] of [quant,_2,try,tries] used',$tries,$maxtries).')</i></span>'; |
if ($maxtries > 1 && $maxtries - $tries == 1) { |
if ($maxtries > 1 && $maxtries - $tries == 1) { |
$triesString = "<b>$triesString</b>"; |
$triesString = "<b>$triesString</b>"; |
} |
} |
Line 981 sub render_resource {
|
Line 987 sub render_resource {
|
} |
} |
if ((&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) && |
if ((&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) && |
($resource->symb=~/\_\_\_[^\_]+\_\_\_uploaded/)) { |
($resource->symb=~/\_\_\_[^\_]+\_\_\_uploaded/)) { |
my $icon = &Apache::loncommon::lonhttpdurl('/res/adm/pages').'/editmap.png'; |
if (!$params->{'map_no_edit_link'}) { |
$editmapLink=' '. |
my $icon = &Apache::loncommon::lonhttpdurl('/res/adm/pages').'/editmap.png'; |
'<a href="/adm/coursedocs?command=direct&symb='.&escape($resource->symb()).'">'. |
$editmapLink=' '. |
|
'<a href="/adm/coursedocs?command=directnav&symb='.&escape($resource->symb()).'">'. |
'<img src="'.$icon.'" alt="'.&mt('Edit Content').'" title="'.&mt('Edit Content').'" />'. |
'<img src="'.$icon.'" alt="'.&mt('Edit Content').'" title="'.&mt('Edit Content').'" />'. |
'</a>'; |
'</a>'; |
|
} |
} |
} |
} |
} |
|
|
Line 996 sub render_resource {
|
Line 1004 sub render_resource {
|
$nonLinkedText .= ' <span class="LC_info">('.&mt('conditionally hidden').')</span> '; |
$nonLinkedText .= ' <span class="LC_info">('.&mt('conditionally hidden').')</span> '; |
} |
} |
if (($resource->is_practice()) && ($resource->is_raw_problem())) { |
if (($resource->is_practice()) && ($resource->is_raw_problem())) { |
$nonLinkedText .=' <font color="green"><b>'.&mt('not graded').'</b></font>'; |
$nonLinkedText .=' <span class="LC_info"><b>'.&mt('not graded').'</b></span>'; |
} |
} |
|
|
# We're done preparing and finally ready to start the rendering |
# We're done preparing and finally ready to start the rendering |
Line 1040 sub render_resource {
|
Line 1048 sub render_resource {
|
} |
} |
|
|
if (!$params->{'resource_nolink'} && !$resource->is_sequence() && !$resource->is_empty_sequence) { |
if (!$params->{'resource_nolink'} && !$resource->is_sequence() && !$resource->is_empty_sequence) { |
$result .= "$curMarkerBegin<a href=\"$link\">$title$partLabel</a>$curMarkerEnd$nonLinkedText</td>"; |
$result .= "$curMarkerBegin<a href=\"$link\">$title$partLabel</a>$curMarkerEnd$editmapLink$nonLinkedText</td>"; |
} else { |
} else { |
$result .= "$curMarkerBegin$linkopen$title$partLabel</a>$curMarkerEnd$editmapLink$nonLinkedText</td>"; |
$result .= "$curMarkerBegin$linkopen$title$partLabel</a>$curMarkerEnd$editmapLink$nonLinkedText</td>"; |
} |
} |
Line 1129 sub render_long_status {
|
Line 1137 sub render_long_status {
|
$params->{'multipart'} && $part eq "0"; |
$params->{'multipart'} && $part eq "0"; |
|
|
my $color; |
my $color; |
|
my $info = ''; |
if ($resource->is_problem() || $resource->is_practice()) { |
if ($resource->is_problem() || $resource->is_practice()) { |
$color = $colormap{$resource->status}; |
$color = $colormap{$resource->status}; |
|
|
if (dueInLessThan24Hours($resource, $part) || |
if (dueInLessThan24Hours($resource, $part)) { |
lastTry($resource, $part)) { |
|
$color = $hurryUpColor; |
$color = $hurryUpColor; |
} |
$info = ' title="'.&mt('Due in less than 24 hours!').'"'; |
|
} elsif (lastTry($resource, $part)) { |
|
unless (($resource->problemstatus($part) eq 'no') || |
|
($resource->problemstatus($part) eq 'no_feedback_ever')) { |
|
$color = $hurryUpColor; |
|
$info = ' title="'.&mt('One try remaining!').'"'; |
|
} |
|
} |
} |
} |
|
|
if ($resource->kind() eq "res" && |
if ($resource->kind() eq "res" && |
$resource->is_raw_problem() && |
$resource->is_raw_problem() && |
!$firstDisplayed) { |
!$firstDisplayed) { |
if ($color) {$result .= "<font color=\"$color\"><b>"; } |
if ($color) {$result .= '<span style="color:'.$color.'"'.$info.'><b>'; } |
$result .= getDescription($resource, $part); |
$result .= getDescription($resource, $part); |
if ($color) {$result .= "</b></font>"; } |
if ($color) {$result .= "</b></span>"; } |
} |
} |
if ($resource->is_map() && &advancedUser() && $resource->randompick()) { |
if ($resource->is_map() && &advancedUser() && $resource->randompick()) { |
$result .= &mt('(randomly select [_1])', $resource->randompick()); |
$result .= &mt('(randomly select [_1])', $resource->randompick()); |
Line 1225 sub render_parts_summary_status {
|
Line 1240 sub render_parts_summary_status {
|
} |
} |
$return.= $td . $totalParts . ' parts: '; |
$return.= $td . $totalParts . ' parts: '; |
foreach my $status (@statuses) { |
foreach my $status (@statuses) { |
if ($overallstatus{$status}) { |
if ($overallstatus{$status}) { |
$return.="<font color='" . $statusColors{$status} . |
$return.='<span style="color:' . $statusColors{$status} |
"'>" . $overallstatus{$status} . ' ' |
. '">' . $overallstatus{$status} . ' ' |
. $statusStrings{$status} . "</font>"; |
. $statusStrings{$status} . '</span>'; |
} |
} |
} |
} |
$return.= $endtd; |
$return.= $endtd; |
return $return; |
return $return; |
Line 2005 sub new {
|
Line 2020 sub new {
|
my $proto = shift; |
my $proto = shift; |
my $class = ref($proto) || $proto; |
my $class = ref($proto) || $proto; |
my $self = {}; |
my $self = {}; |
bless($self); # So we can call change_user if neceesary |
bless($self); # So we can call change_user if necessary |
|
|
$self->{USERNAME} = shift || $env{'user.name'}; |
$self->{USERNAME} = shift || $env{'user.name'}; |
$self->{DOMAIN} = shift || $env{'user.domain'}; |
$self->{DOMAIN} = shift || $env{'user.domain'}; |
|
$self->{CODE} = shift; |
|
$self->{NOHIDE} = shift; |
|
|
|
|
|
|
Line 2022 sub new {
|
Line 2039 sub new {
|
|
|
# We can only tie the nav hash as done below if the username/domain |
# We can only tie the nav hash as done below if the username/domain |
# match the env one. Otherwise change_user does everything we need...since we can't |
# match the env one. Otherwise change_user does everything we need...since we can't |
# assume there are course hashes for the specific requested user@domamin: |
# assume there are course hashes for the specific requested user:domain |
|
# Note: change_user is also called if we need the nav hash when printing CODEd |
|
# assignments or printing an exam, in which the enclosing folder for the items in |
|
# the exam has hidden set. |
# |
# |
|
|
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} && !$self->{NOHIDE}) { |
|
|
# tie the nav hash |
# tie the nav hash |
|
|
Line 2048 sub new {
|
Line 2069 sub new {
|
$self->{PARM_HASH} = \%parmhash; |
$self->{PARM_HASH} = \%parmhash; |
$self->{PARM_CACHE} = {}; |
$self->{PARM_CACHE} = {}; |
} else { |
} else { |
$self->change_user($self->{USERNAME}, $self->{DOMAIN}); |
$self->change_user($self->{USERNAME}, $self->{DOMAIN}, $self->{CODE}, $self->{NOHIDE}); |
} |
} |
|
|
return $self; |
return $self; |
Line 2061 sub new {
|
Line 2082 sub new {
|
# Parameters: |
# Parameters: |
# user - New user. |
# user - New user. |
# domain- Domain the user belongs to. |
# domain- Domain the user belongs to. |
|
# code - Anonymous CODE in use. |
# Implicit inputs: |
# Implicit inputs: |
# |
# |
sub change_user { |
sub change_user { |
my $self = shift; |
my $self = shift; |
$self->{USERNAME} = shift; |
$self->{USERNAME} = shift; |
$self->{DOMAIN} = shift; |
$self->{DOMAIN} = shift; |
|
$self->{CODE} = shift; |
|
$self->{NOHIDE} = shift; |
|
|
# If the hashes are already tied make sure to break that bond: |
# If the hashes are already tied make sure to break that bond: |
|
|
Line 2082 sub change_user {
|
Line 2106 sub change_user {
|
my ($cdom, $cnum) = split(/\_/, $env{'request.course.id'}); |
my ($cdom, $cnum) = split(/\_/, $env{'request.course.id'}); |
|
|
my %big_hash; |
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}, $self->{NOHIDE}, \%big_hash); |
$self->{NAV_HASH} = \%big_hash; |
$self->{NAV_HASH} = \%big_hash; |
|
|
|
|
Line 2093 sub change_user {
|
Line 2117 sub change_user {
|
$self->{PARM_CACHE} = {}; |
$self->{PARM_CACHE} = {}; |
|
|
my %parm_hash = {}; |
my %parm_hash = {}; |
foreach my $key (keys %big_hash) { |
foreach my $key (keys(%big_hash)) { |
if ($key =~ /^param\./) { |
if ($key =~ /^param\./) { |
my $param_key = $key; |
my $param_key = $key; |
$param_key =~ s/^param\.//; |
$param_key =~ s/^param\.//; |
Line 2103 sub change_user {
|
Line 2127 sub change_user {
|
|
|
$self->{PARM_HASH} = \%parm_hash; |
$self->{PARM_HASH} = \%parm_hash; |
|
|
|
} |
|
|
} |
|
|
|
sub generate_course_user_opt { |
sub generate_course_user_opt { |
my $self = shift; |
my $self = shift; |
Line 2168 sub generate_email_discuss_status {
|
Line 2190 sub generate_email_discuss_status {
|
my %lastread = &Apache::lonnet::dump('nohist_'.$cid.'_discuss', |
my %lastread = &Apache::lonnet::dump('nohist_'.$cid.'_discuss', |
$self->{DOMAIN},$self->{USERNAME},'lastread'); |
$self->{DOMAIN},$self->{USERNAME},'lastread'); |
my %lastreadtime = (); |
my %lastreadtime = (); |
foreach my $key (keys %lastread) { |
foreach my $key (keys(%lastread)) { |
my $shortkey = $key; |
my $shortkey = $key; |
$shortkey =~ s/_lastread$//; |
$shortkey =~ s/_lastread$//; |
$lastreadtime{$shortkey} = $lastread{$key}; |
$lastreadtime{$shortkey} = $lastread{$key}; |
Line 3314 sub new {
|
Line 3336 sub new {
|
if ($resourceCount == 1 && $resource->is_sequence() && !$self->{FORCE_TOP}) { |
if ($resourceCount == 1 && $resource->is_sequence() && !$self->{FORCE_TOP}) { |
my $firstResource = $resource->map_start(); |
my $firstResource = $resource->map_start(); |
my $finishResource = $resource->map_finish(); |
my $finishResource = $resource->map_finish(); |
my $result; |
return Apache::lonnavmaps::iterator->new($self->{NAV_MAP}, $firstResource, |
$result = Apache::lonnavmaps::iterator->new($self->{NAV_MAP}, $firstResource, |
$finishResource, $self->{FILTER}, |
$finishResource, $self->{FILTER}, |
$self->{ALREADY_SEEN}, |
$self->{ALREADY_SEEN}, |
$self->{CONDITION}, |
$self->{CONDITION}, |
$self->{FORCE_TOP}); |
$self->{FORCE_TOP}); |
|
return $result; |
|
|
|
|
|
} |
} |
|
|
# Set up some bookkeeping information. |
# Set up some bookkeeping information. |
Line 4220 resource of the map.
|
Line 4238 resource of the map.
|
|
|
Returns a string with the type of the map in it. |
Returns a string with the type of the map in it. |
|
|
=item *B<map_hierarchy>: |
=item * B<map_hierarchy>: |
|
|
Returns a string with a comma-separated ordered list of map_pc IDs |
Returns a string with a comma-separated ordered list of map_pc IDs |
for the hierarchy of maps containing a map, with the top level |
for the hierarchy of maps containing a map, with the top level |
Line 4363 sub printable {
|
Line 4381 sub printable {
|
|
|
my ($self, $part) = @_; |
my ($self, $part) = @_; |
|
|
# Get the print open/close dates for the resource. |
|
|
|
my $start = $self->parmval("printstartdate", $part); |
|
my $end = $self->parmval("printenddate", $part); |
|
|
|
# The following cases apply: |
# 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. |
# - Start date set but no end date: Printable if now >= start date. |
# - End date set but no start date: Printable if now <= end date. |
# - End date set but no start date: Printable if now <= end date. |
# - both defined: printable if start <= now <= end |
# - 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 $now = time(); |
|
|
|
|
my $startok = 1; |
my $startok = 1; |
my $endok = 1; |
my $endok = 1; |
|
|
Line 4396 sub resprintable {
|
Line 4426 sub resprintable {
|
my $partsref = $self->parts(); |
my $partsref = $self->parts(); |
my @parts = @$partsref; |
my @parts = @$partsref; |
|
|
if ((!defined(@parts)) || (scalar(@parts) == 0)) { |
if (!@parts) { |
return $self->printable(0); |
return $self->printable(0); |
} else { |
} else { |
foreach my $part (@parts) { |
foreach my $part (@parts) { |
Line 4844 sub extractParts {
|
Line 4874 sub extractParts {
|
} |
} |
} |
} |
} |
} |
my @sortedParts = sort keys %parts; |
my @sortedParts = sort(keys(%parts)); |
$self->{PARTS} = \@sortedParts; |
$self->{PARTS} = \@sortedParts; |
} |
} |
|
|
Line 4865 sub extractParts {
|
Line 4895 sub extractParts {
|
# So we have to use our knowlege of part names to figure out |
# So we have to use our knowlege of part names to figure out |
# where the part names begin and end, and even then, it is possible |
# where the part names begin and end, and even then, it is possible |
# to construct ambiguous situations. |
# to construct ambiguous situations. |
foreach my $data (split /,/, $metadata) { |
foreach my $data (split(/,/, $metadata)) { |
if ($data =~ /^([a-zA-Z]+)response_(.*)/ |
if ($data =~ /^([a-zA-Z]+)response_(.*)/ |
|| $data =~ /^(Task)_(.*)/) { |
|| $data =~ /^(Task)_(.*)/) { |
my $responseType = $1; |
my $responseType = $1; |
my $partStuff = $2; |
my $partStuff = $2; |
my $partIdSoFar = ''; |
my $partIdSoFar = ''; |
my @partChunks = split /_/, $partStuff; |
my @partChunks = split(/_/, $partStuff); |
my $i = 0; |
my $i = 0; |
for ($i = 0; $i < scalar(@partChunks); $i++) { |
for ($i = 0; $i < scalar(@partChunks); $i++) { |
if ($partIdSoFar) { $partIdSoFar .= '_'; } |
if ($partIdSoFar) { $partIdSoFar .= '_'; } |
Line 5372 sub check_for_slot {
|
Line 5402 sub check_for_slot {
|
} else { |
} else { |
if ($ip ne '') { |
if ($ip ne '') { |
if (!&Apache::loncommon::check_ip_acc($ip)) { |
if (!&Apache::loncommon::check_ip_acc($ip)) { |
return (RESERVED_LOCATION,$ip,$slot_name); |
return (RESERVED_LOCATION,$end,$slot_name); |
} |
} |
} |
} |
my @proctors; |
my @proctors; |
Line 5615 sub getPrevious {
|
Line 5645 sub getPrevious {
|
my $self = shift; |
my $self = shift; |
my @branches; |
my @branches; |
my $from = $self->from(); |
my $from = $self->from(); |
foreach my $branch ( split /,/, $from) { |
foreach my $branch ( split(/,/, $from)) { |
my $choice = $self->{NAV_MAP}->getById($branch); |
my $choice = $self->{NAV_MAP}->getById($branch); |
my $prev = $choice->comesfrom(); |
my $prev = $choice->comesfrom(); |
$prev = $self->{NAV_MAP}->getById($prev); |
$prev = $self->{NAV_MAP}->getById($prev); |