version 1.392, 2006/10/23 22:48:27
|
version 1.394, 2006/12/20 23:25:13
|
Line 149 sub getLinkForResource {
|
Line 149 sub getLinkForResource {
|
if (defined($res)) { |
if (defined($res)) { |
my $anchor; |
my $anchor; |
if ($res->is_page()) { |
if ($res->is_page()) { |
foreach (@$stack) { if (defined($_)) { $anchor = $_; } } |
foreach my $item (@$stack) { if (defined($item)) { $anchor = $item; } } |
$anchor=&escape($anchor->shown_symb()); |
$anchor=&escape($anchor->shown_symb()); |
return ($res->link(),$res->shown_symb(),$anchor); |
return ($res->link(),$res->shown_symb(),$anchor); |
} |
} |
Line 167 sub getLinkForResource {
|
Line 167 sub getLinkForResource {
|
# (when we first recurse on a map, it puts an undefined resource |
# (when we first recurse on a map, it puts an undefined resource |
# on the bottom because $self->{HERE} isn't defined yet, and we |
# on the bottom because $self->{HERE} isn't defined yet, and we |
# want the src for the map anyhow) |
# want the src for the map anyhow) |
foreach (@$stack) { |
foreach my $item (@$stack) { |
if (defined($_)) { $res = $_; } |
if (defined($item)) { $res = $item; } |
} |
} |
|
|
return ($res->link(),$res->shown_symb()); |
return ($res->link(),$res->shown_symb()); |
Line 904 sub render_communication_status {
|
Line 904 sub render_communication_status {
|
|
|
if ($resource->getFeedback()) { |
if ($resource->getFeedback()) { |
my $feedback = $resource->getFeedback(); |
my $feedback = $resource->getFeedback(); |
foreach (split(/\,/, $feedback)) { |
foreach my $msgid (split(/\,/, $feedback)) { |
if ($_) { |
if ($msgid) { |
$feedbackHTML .= ' <a '.$target.' href="/adm/email?display=' |
$feedbackHTML .= ' <a '.$target.' href="/adm/email?display=' |
. &escape($_) . '">' |
. &escape($msgid) . '">' |
. '<img alt="'.&mt('New Email').'" src="'.$location.'/feedback.gif" ' |
. '<img alt="'.&mt('New Email').'" src="'.$location.'/feedback.gif" ' |
. 'border="0" /></a>'; |
. 'border="0" /></a>'; |
} |
} |
Line 917 sub render_communication_status {
|
Line 917 sub render_communication_status {
|
if ($resource->getErrors()) { |
if ($resource->getErrors()) { |
my $errors = $resource->getErrors(); |
my $errors = $resource->getErrors(); |
my $errorcount = 0; |
my $errorcount = 0; |
foreach (split(/,/, $errors)) { |
foreach my $msgid (split(/,/, $errors)) { |
last if ($errorcount>=10); # Only output 10 bombs maximum |
last if ($errorcount>=10); # Only output 10 bombs maximum |
if ($_) { |
if ($msgid) { |
$errorcount++; |
$errorcount++; |
$errorHTML .= ' <a '.$target.' href="/adm/email?display=' |
$errorHTML .= ' <a '.$target.' href="/adm/email?display=' |
. &escape($_) . '">' |
. &escape($msgid) . '">' |
. '<img alt="'.&mt('New Error').'" src="'.$location.'/bomb.gif" ' |
. '<img alt="'.&mt('New Error').'" src="'.$location.'/bomb.gif" ' |
. 'border="0" /></a>'; |
. 'border="0" /></a>'; |
} |
} |
Line 1126 sub render {
|
Line 1126 sub render {
|
# marker |
# marker |
my $filterHash = {}; |
my $filterHash = {}; |
# Figure out what we're not displaying |
# Figure out what we're not displaying |
foreach (split(/\,/, $env{"form.filter"})) { |
foreach my $item (split(/\,/, $env{"form.filter"})) { |
if ($_) { |
if ($item) { |
$filterHash->{$_} = "1"; |
$filterHash->{$item} = "1"; |
} |
} |
} |
} |
|
|
Line 1901 sub generate_email_discuss_status {
|
Line 1901 sub generate_email_discuss_status {
|
my %lastread = &Apache::lonnet::dump('nohist_'.$cid.'_discuss', |
my %lastread = &Apache::lonnet::dump('nohist_'.$cid.'_discuss', |
$env{'user.domain'},$env{'user.name'},'lastread'); |
$env{'user.domain'},$env{'user.name'},'lastread'); |
my %lastreadtime = (); |
my %lastreadtime = (); |
foreach (keys %lastread) { |
foreach my $key (keys %lastread) { |
my $key = $_; |
my $shortkey = $key; |
$key =~ s/_lastread$//; |
$shortkey =~ s/_lastread$//; |
$lastreadtime{$key} = $lastread{$_}; |
$lastreadtime{$shortkey} = $lastread{$key}; |
} |
} |
|
|
my %feedback=(); |
my %feedback=(); |
Line 2034 sub last_post_time {
|
Line 2034 sub last_post_time {
|
return $self->{DISCUSSION_TIME}->{$ressymb}; |
return $self->{DISCUSSION_TIME}->{$ressymb}; |
} |
} |
|
|
sub unread_discussion { |
sub discussion_info { |
my $self = shift; |
my $self = shift; |
my $symb = shift; |
my $symb = shift; |
|
my $filter = shift; |
|
|
$self->get_discussion_data(); |
$self->get_discussion_data(); |
|
|
Line 2048 sub unread_discussion {
|
Line 2049 sub unread_discussion {
|
|
|
my $prevread = $self->{LAST_READ}{$ressymb}; |
my $prevread = $self->{LAST_READ}{$ressymb}; |
|
|
my $unreadcount = 0; |
my $count = 0; |
my $hiddenflag = 0; |
my $hiddenflag = 0; |
my $deletedflag = 0; |
my $deletedflag = 0; |
my ($hidden,$deleted); |
my ($hidden,$deleted,%info); |
|
|
my %subjects; |
|
|
|
for (my $id=$version; $id>0; $id--) { |
for (my $id=$version; $id>0; $id--) { |
my $vkeys=$self->{DISCUSSION_DATA}{$id.':keys:'.$discsymb}; |
my $vkeys=$self->{DISCUSSION_DATA}{$id.':keys:'.$discsymb}; |
Line 2069 sub unread_discussion {
|
Line 2068 sub unread_discussion {
|
$deletedflag = 1; |
$deletedflag = 1; |
} |
} |
} else { |
} else { |
if (($hidden !~/\.$id\./) && ($deleted !~/\.$id\./) |
if (($hidden !~/\.$id\./) && ($deleted !~/\.$id\./)) { |
&& $prevread < $self->{DISCUSSION_DATA}{$id.':'.$discsymb.':timestamp'}) { |
if ($filter eq 'unread') { |
$unreadcount++; |
if ($prevread >= $self->{DISCUSSION_DATA}{$id.':'.$discsymb.':timestamp'}) { |
$subjects{$unreadcount}= |
next; |
$id.': '.$self->{DISCUSSION_DATA}{$id.':'.$discsymb.':subject'}; |
} |
} |
} |
|
$count++; |
|
$info{$count}{'subject'} = |
|
$self->{DISCUSSION_DATA}{$id.':'.$discsymb.':subject'}; |
|
$info{$count}{'id'} = $id; |
|
$info{$count}{'timestamp'} = $self->{DISCUSSION_DATA}{$id.':'.$discsymb.':timestamp'}; |
|
} |
} |
} |
} |
} |
if (wantarray) { |
if (wantarray) { |
return ($unreadcount,\%subjects); |
return ($count,%info); |
} |
} |
return $unreadcount |
return $count; |
} |
} |
|
|
sub wrap_symb { |
sub wrap_symb { |
Line 3117 sub next {
|
Line 3122 sub next {
|
|
|
# filter the next possibilities to remove things we've |
# filter the next possibilities to remove things we've |
# already seen. |
# already seen. |
foreach (@$nextUnfiltered) { |
foreach my $item (@$nextUnfiltered) { |
if (!defined($self->{ALREADY_SEEN}->{$_->{ID}})) { |
if (!defined($self->{ALREADY_SEEN}->{$item->{ID}})) { |
push @$next, $_; |
push @$next, $item; |
} |
} |
} |
} |
|
|
Line 3835 data was not extracted when the nav map
|
Line 3840 data was not extracted when the nav map
|
Returns a false value if there hasn't been discussion otherwise returns |
Returns a false value if there hasn't been discussion otherwise returns |
unix timestamp of last time a discussion posting (or edit) was made. |
unix timestamp of last time a discussion posting (or edit) was made. |
|
|
=item * B<unread_discussion>: |
=item * B<discussion_info>: |
|
|
returns in scalar context the count of the number of unread discussion |
optional argument is a filter (currently can be 'unread'); |
postings |
returns in scalar context the count of the number of discussion postings. |
|
|
returns in list context both the count of postings and a hash ref |
returns in list context both the count of postings and a hash ref |
containing the subjects of all unread postings |
containing information about the postings (subject, id, timestamp) in a hash. |
|
|
|
Default is to return counts for all postings. However if called with a second argument set to 'unread', will return information about only unread postings. |
|
|
=item * B<getFeedback>: |
=item * B<getFeedback>: |
|
|
Line 3850 for the resource, or the null string if
|
Line 3857 for the resource, or the null string if
|
email data was not extracted when the nav map was constructed. Usually |
email data was not extracted when the nav map was constructed. Usually |
used like this: |
used like this: |
|
|
for (split(/\,/, $res->getFeedback())) { |
for my $url (split(/\,/, $res->getFeedback())) { |
my $link = &escape($_); |
my $link = &escape($url); |
... |
... |
|
|
and use the link as appropriate. |
and use the link as appropriate. |
Line 3868 sub last_post_time {
|
Line 3875 sub last_post_time {
|
return $self->{NAV_MAP}->last_post_time($self->symb()); |
return $self->{NAV_MAP}->last_post_time($self->symb()); |
} |
} |
|
|
sub unread_discussion { |
sub discussion_info { |
my $self = shift; |
my ($self,$filter) = @_; |
return $self->{NAV_MAP}->unread_discussion($self->symb()); |
return $self->{NAV_MAP}->discussion_info($self->symb(),$filter); |
} |
} |
|
|
sub getFeedback { |
sub getFeedback { |
Line 4045 sub extractParts {
|
Line 4052 sub extractParts {
|
$self->{PART_TYPE} = {}; |
$self->{PART_TYPE} = {}; |
return; |
return; |
} |
} |
foreach (split(/\,/,$metadata)) { |
foreach my $entry (split(/\,/,$metadata)) { |
if ($_ =~ /^(?:part|Task)_(.*)$/) { |
if ($entry =~ /^(?:part|Task)_(.*)$/) { |
my $part = $1; |
my $part = $1; |
# This floods the logs if it blows up |
# This floods the logs if it blows up |
if (defined($parts{$part})) { |
if (defined($parts{$part})) { |
Line 4071 sub extractParts {
|
Line 4078 sub extractParts {
|
|
|
|
|
# Init the responseIdHash |
# Init the responseIdHash |
foreach (@{$self->{PARTS}}) { |
foreach my $part (@{$self->{PARTS}}) { |
$responseIdHash{$_} = []; |
$responseIdHash{$part} = []; |
} |
} |
|
|
# Now, the unfortunate thing about this is that parts, part name, and |
# Now, the unfortunate thing about this is that parts, part name, and |
Line 4152 the completion information.
|
Line 4159 the completion information.
|
Idiomatic usage of these two methods would probably look something |
Idiomatic usage of these two methods would probably look something |
like |
like |
|
|
foreach ($resource->parts()) { |
foreach my $part ($resource->parts()) { |
my $dateStatus = $resource->getDateStatus($_); |
my $dateStatus = $resource->getDateStatus($part); |
my $completionStatus = $resource->getCompletionStatus($_); |
my $completionStatus = $resource->getCompletionStatus($part); |
|
|
or |
or |
|
|
my $status = $resource->status($_); |
my $status = $resource->status($part); |
|
|
... use it here ... |
... use it here ... |
} |
} |