/usr/share/request-tracker3.8/html/RTFM/Topics.html is in rt3.8-rtfm 2.4.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | %# BEGIN BPS TAGGED BLOCK {{{
%#
%# COPYRIGHT:
%#
%# This software is Copyright (c) 1996-2010 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
%#
%#
%# LICENSE:
%#
%# This work is made available to you under the terms of Version 2 of
%# the GNU General Public License. A copy of that license should have
%# been provided with this software, but in any event can be snarfed
%# from www.gnu.org.
%#
%# This work is distributed in the hope that it will be useful, but
%# WITHOUT ANY WARRANTY; without even the implied warranty of
%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
%# General Public License for more details.
%#
%# You should have received a copy of the GNU General Public License
%# along with this program; if not, write to the Free Software
%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
%# 02110-1301 or visit their web page on the internet at
%# http://www.gnu.org/copyleft/gpl.html.
%#
%#
%# CONTRIBUTION SUBMISSION POLICY:
%#
%# (The following paragraph is not intended to limit the rights granted
%# to you to modify and distribute this software under the terms of
%# the GNU General Public License and is only of importance to you if
%# you choose to contribute your changes and enhancements to the
%# community by submitting them to Best Practical Solutions, LLC.)
%#
%# By intentionally submitting any modifications, corrections or
%# derivatives to this work, or any other work intended for use with
%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
%# you are the copyright holder for those contributions and you grant
%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
%# royalty-free, perpetual, license to use, copy, create derivative
%# works based on those contributions, and sublicense and distribute
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
<& /RTFM/Elements/Tabs, current_toptab => "RTFM/Topics.html", Title => loc('Browse by topic'), class => $class, topic => $id &>
<& /Elements/ListActions, actions => \@Actions &>
<a href="Topics.html"><&|/l&>All topics</&></a>
% if (defined $class) {
> <a href="Topics.html?class=<%$currclass_id%>"><% $currclass_name %></a>
% }
% if ($id != 0) {
> <& /RTFM/Elements/ShowTopic, topic => $currtopic &>
% }
<br />
<h1><&|/l&>Browse by topic</&></h1>
<%perl>
if (defined $class) {
$m->print('<h2>'.'<a href="'.
$RT::WebPath."/RTFM/Topics.html?class=" . $currclass_id
.'">'.$currclass_name."</a></h2>\n");
ProduceTree(\@Actions, $currclass, $currclass_id, $currclass_name, 0, $id);
} else {
$m->print("<ul>\n");
while (my $c = $Classes->Next) {
$m->print('<li><h2>'.'<a href="'.
$RT::WebPath."/RTFM/Topics.html?class=" . $c->Id
.'">'.$c->Name."</a></h2>\n");
$m->print("\n</li>\n");
}
$m->print(qq|<li><h2><a href="$RT::WebPath/RTFM/Topics.html?class=0">Global Topics</a></h2></li>\n|);
$m->print("</ul>\n");
}
</%perl>
<br />
<%perl>
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}
} elsif ($class) {
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->Limit(
FIELD => 'Class',
OPERATOR => '=',
VALUE => $class,
);
@articles = @{$Articles->ItemsArrayRef};
}
</%perl>
% if (@articles) {
% if ($id) {
<h2><&|/l, $currtopic->Name&>Articles in [_1]</&></h2>
% } elsif ($class) {
<h2><&|/l&>Articles with no topics</&></h2>
% }
<ul>
% for my $a (@articles) {
<li><a href="Article/Display.html?id=<% $a->Id %>"><% $a->Name || loc("(no name)") %></a></li>
% }
</ul>
% }
<%init>
my @Actions;
my $Classes;
my $currclass;
my $currclass_id;
my $currclass_name;
my $currtopic;
if ( defined $class ) {
if ($class) {
$currclass = RT::FM::Class->new( $session{'CurrentUser'} );
$currclass->Load($class);
$currclass_id = $currclass->Id;
$currclass_name = $currclass->Name;
} else {
$currclass = $RT::FM::System;
$currclass_id = 0;
$currclass_name = 'Global Topics';
}
} else {
$Classes = RT::FM::ClassCollection->new( $session{'CurrentUser'} );
$Classes->LimitToEnabled();
}
if ($id) {
$currtopic = RT::FM::Topic->new( $session{'CurrentUser'} );
$currtopic->Load($id);
}
# A subroutine that iterates through topics and their children, producing
# the necessary ul, li, and href links for the table of contents. Thank
# heaven for query caching. The $restrict variable is used to display only
# the branch of the hierarchy which contains that topic ID.
sub ProduceTree {
my ( $Actions, $currclass, $currclass_id, $currclass_name, $parentid, $restrictid ) = @_;
$parentid = 0 unless $parentid;
# Deal with tree restriction, if any.
if ($restrictid) {
my $rtopic = RT::FM::Topic->new( $session{'CurrentUser'} );
$rtopic->Load($restrictid);
unless ( $rtopic->Id()
&& $rtopic->ObjectId() == $currclass_id )
{
push( @{$Actions},"Could not restrict view to topic $restrictid");
# Start over, without the restriction.
&ProduceTree( $Actions, $currclass, $currclass_id, $currclass_name, $parentid, undef );
} else {
my @showtopics;
push( @showtopics, $rtopic );
my $parent = $rtopic->ParentObj;
while ( $parent->Id ) {
push( @showtopics, $parent );
my $newparent = $parent->ParentObj;
$parent = $newparent;
}
# List the topics.
my $indents = @showtopics;
while ( my $t = pop @showtopics ) {
print "<ul>";
print &MakeLinks( $t, $currclass, $currclass_id, $currclass_name, $t->Children->Count );
if ( $t->Id == $restrictid ) {
&ProduceTree( $Actions, $currclass, $currclass_id, $currclass_name, $restrictid, undef );
}
}
print "</ul>" x $indents;
}
} else {
# No restriction in place. Build the entire tree.
my $topics = RT::FM::TopicCollection->new( $session{'CurrentUser'} );
$topics->LimitToObject($currclass);
$topics->LimitToKids($parentid);
$topics->OrderBy( FIELD => 'Name' );
print "<ul>" if $topics->Count;
while ( my $t = $topics->Next ) {
if ( $t->Children->Count ) {
print &MakeLinks( $t, $currclass, $currclass_id, $currclass_name, 1 );
&ProduceTree( $Actions, $currclass, $currclass_id, $currclass_name, $t->Id );
} else {
print &MakeLinks( $t, $currclass, $currclass_id, $currclass_name, 0 );
}
}
print "</ul>\n" if $topics->Count;
}
}
sub MakeLinks {
my ( $topic, $currclass, $currclass_id, $currclass_name, $haschild ) = @_;
my $query;
my $output;
if ( ref($topic) eq 'RT::FM::Topic' ) {
my $topic_info = $topic->Name() || loc("(no name)");
$topic_info .= ": " . $topic->Description() if $topic->Description;
if ($haschild) { # has topics below it
$query = "Topics.html?id=" . $topic->Id . "&class=" . $currclass_id;
$output = qq(<li><a href="$query">$topic_info</a>);
} else {
$output = qq(<li>$topic_info);
}
my $Articles = RT::FM::ObjectTopicCollection->new( $session{'CurrentUser'} );
$Articles->Limit( FIELD => 'ObjectType', VALUE => 'RT::FM::Article' );
$Articles->Limit( FIELD => 'Topic', VALUE => $topic->Id );
if ( $Articles->Count ) {
my $article_text = " (" . loc( "[quant,_1,article]", $Articles->Count ) . ")";
my $query = "Topics.html?id=" . $topic->Id . "&class=$currclass_id&showall=1";
$output .= qq(<a href="$query">$article_text</a>);
}
$output .= "</li>\n";
} else {
# This builds a link for the class specified, with no particular topic.
$query = "Topics.html?class=" . $currclass_id;
$output = "<li><a href=\"$query\">" . $currclass_name . "</a>";
$output .= ": " . $currclass->Description if $currclass->Description;
}
return $output;
}
</%init>
<%args>
$id => 0
$class => undef
$showall => undef
</%args>
|