[Rt-commit] r3637 - in rtfm/branches/2.1-TESTING: . html/RTFM
alexmv at bestpractical.com
alexmv at bestpractical.com
Thu Aug 11 11:42:18 EDT 2005
Author: alexmv
Date: Thu Aug 11 11:42:17 2005
New Revision: 3637
Modified:
rtfm/branches/2.1-TESTING/ (props changed)
rtfm/branches/2.1-TESTING/html/RTFM/Topics.html
Log:
r5788 at zoq-fot-pik: chmrr | 2005-08-11 11:43:38 -0400
* Show articles with no topics on top level
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 Thu Aug 11 11:42:17 2005
@@ -47,38 +47,62 @@
}
</%perl>
-% if ($id || $showall) {
-%# TODO: Eventually it would be nice to show all for classes too. Thus
-%# the condition above.
<br/>
<%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');
- if ($showall) {
- my $kids = $currtopic->Children;
- while (my $k = $kids->Next) {
- $Articles->Limit(FIELD => 'Topic', VALUE => $k->Id,
- ENTRYAGGREGATOR => 'OR');
- }
+my @articles;
+if ($id or $showall) {
+ 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');
+ if ($showall) {
+ my $kids = $currtopic->Children;
+ while (my $k = $kids->Next) {
+ $Articles->Limit(FIELD => 'Topic', VALUE => $k->Id,
+ ENTRYAGGREGATOR => 'OR');
+ }
+ }
}
+ @articles = map {$a = RT::FM::Article->new($session{'CurrentUser'}); $a->Load($_->ObjectId); $a} @{$Articles->ItemsArrayRef}
+} else {
+ my $Articles = RT::FM::ArticleCollection->new($session{'CurrentUser'});
+ my $TopicsAlias = $Articles->Join(
+ TYPE => 'left',
+ ALIAS1 => 'main',
+ FIELD1 => 'id',
+ TABLE2 => 'FM_ObjectTopics',
+ FIELD2 => 'ObjectId',
+ );
+ $Articles->Limit(
+ LEFTJOIN => $TopicsAlias,
+ FIELD => 'ObjectType',
+ VALUE => 'RT::FM::Article',
+ );
+ $Articles->Limit(
+ ALIAS => $TopicsAlias,
+ FIELD => 'Topic',
+ OPERATOR => 'IS',
+ VALUE => 'NULL',
+ QUOTEVALUE => 0,
+ );
+ @articles = @{$Articles->ItemsArrayRef};
}
</%perl>
-% if ($Articles->Count) {
+% if (@articles) {
+% if ($id) {
<h2><&|/l&>Articles in this topic</&></h2>
+% } else {
+<h2><&|/l&>Articles with no topics</&></h2>
+% }
<ul>
-% while (my $obj = $Articles->Next) {
-% my $a = RT::FM::Article->new($session{'CurrentUser'});
-% $a->Load($obj->ObjectId);
+% for my $a (@articles) {
<li><a href="Article/Display.html?id=<% $a->Id %>"><% $a->Name || loc("(no name)") %></a></li>
% }
</ul>
% } else {
%#<i><&|/l&>No articles found in this topic</&></i>
% }
-% }
<%init>
More information about the Rt-commit
mailing list