[Rt-commit] r2594 - in rtfm/branches/2.1-TESTING: html/RTFM
lib/RT/FM
tla at bestpractical.com
tla at bestpractical.com
Wed Apr 6 22:10:54 EDT 2005
Author: tla
Date: Wed Apr 6 22:10:53 2005
New Revision: 2594
Modified:
rtfm/branches/2.1-TESTING/html/RTFM/Topics.html
rtfm/branches/2.1-TESTING/lib/RT/FM/Topic_Overlay.pm
Log:
Now the "show all" links actually show all.
Modified: rtfm/branches/2.1-TESTING/html/RTFM/Topics.html
==============================================================================
--- rtfm/branches/2.1-TESTING/html/RTFM/Topics.html (original)
+++ rtfm/branches/2.1-TESTING/html/RTFM/Topics.html Wed Apr 6 22:10:53 2005
@@ -47,10 +47,19 @@
% if ($display) {
<br/>
<& /Elements/TitleBoxStart, title => loc('Articles') &>
-% my $Articles = RT::FM::ObjectTopicCollection->new($session{'CurrentUser'});
-% $Articles->Limit(FIELD => 'Topic', VALUE => $id);
-% $Articles->Limit(FIELD => 'ObjectType', VALUE => 'RT::FM::Article');
-% if ($Articles->Count) {
+<%perl>
+my $Articles = RT::FM::ObjectTopicCollection->new($session{'CurrentUser'});
+$Articles->Limit(FIELD => 'ObjectType', VALUE => 'RT::FM::Article');
+if ($id) {
+ $Articles->Limit(FIELD => 'Topic', VALUE => $id, ENTRYAGGREGATOR => 'OR');
+ my $kids = $currtopic->Children;
+ while (my $k = $kids->Next) {
+ $Articles->Limit(FIELD => 'Topic', VALUE => $k->Id,
+ ENTRYAGGREGATOR => 'OR');
+ }
+}
+if ($Articles->Count) {
+</%perl>
<ul>
% while (my $obj = $Articles->Next) {
% my $a = RT::FM::Article->new($session{'CurrentUser'});
@@ -115,7 +124,7 @@
# List the topics.
while (my $t = pop @showtopics) {
print "<ul>";
- print &MakeLinks($t, $c, $t->HasKids);
+ print &MakeLinks($t, $c, $t->Children->Count);
if ($t->Id == $restrictid) {
&ProduceTree($Actions, $c, $restrictid, undef);
}
@@ -129,7 +138,7 @@
$topics->LimitToKids($parentid);
while (my $t = $topics->Next) {
print "<ul>";
- if ($t->HasKids) {
+ if ($t->Children->Count) {
print &MakeLinks($t, $c, 1);
&ProduceTree($Actions, $c, $t->Id);
} else {
Modified: rtfm/branches/2.1-TESTING/lib/RT/FM/Topic_Overlay.pm
==============================================================================
--- rtfm/branches/2.1-TESTING/lib/RT/FM/Topic_Overlay.pm (original)
+++ rtfm/branches/2.1-TESTING/lib/RT/FM/Topic_Overlay.pm Wed Apr 6 22:10:53 2005
@@ -129,20 +129,22 @@
# }}}
-# {{{ HasKids
+# {{{ Children
-=head2 HasKids
+=head2 Children
-Returns a true value if this topic has child topics.
+Returns a TopicCollection object containing this topic's children.
=cut
-sub HasKids {
+sub Children {
my $self = shift;
- my $kids = RT::FM::TopicCollection->new($self->CurrentUser);
- $kids->Limit('FIELD' => 'Parent',
- 'VALUE' => $self->Id);
- return $kids->Count;
+ unless ($self->{'Children'}) {
+ $self->{'Children'} = RT::FM::TopicCollection->new($self->CurrentUser);
+ $self->{'Children'}->Limit('FIELD' => 'Parent',
+ 'VALUE' => $self->Id);
+ }
+ return $self->{'Children'};
}
# {{{ _Set
More information about the Rt-commit
mailing list