Description:
This box displays the rdf feeds that the user chose to view in their display preferences. If you don't have use_rdf_feeds enabled in the Site Controls then this box won show. It also won't show if they have no rdf feeds chosen. If given an argument in the block directly or through the command line then it will display that rdf
Box Code:
return unless $S->{UI}->{VARS}->{use_rdf_feeds};
my $to_display = {};
if (@ARGS || $S->{CGI}->param('rdf')) {
my $rdf_arg = $S->{CGI}->param('rdf');
@ARGS = split(/,/, $rdf_arg) if $rdf_arg;
foreach (@ARGS) {
$to_display->{$_} = 1;
}
}
my $content;
my $channels = $S->rdf_channels();
my $user_feeds = $S->rdf_get_prefs() unless @ARGS;
my $item_limit = defined($S->{prefs}->{rdf_max_headlines}) ?
$S->{prefs}->{rdf_max_headlines} :
defined($S->{UI}->{VARS}->{rdf_max_headlines}) ?
$S->{UI}->{VARS}->{rdf_max_headlines} : 15;
if ($S->have_perm('submit_rdf')) {
$content = qq|<A CLASS="light" HREF="%%rootdir%%/submitrdf">Submit Feed</A><BR><BR>\n|;
}
foreach my $c (@{$channels}) {
if (@ARGS) {
next unless $to_display->{ $c->{rid} };
} else {
next unless $user_feeds->{ $c->{rid} };
}
next unless $c->{title};
unless ($S->have_perm('rdf_admin')) {
next if $c->{submitted} || !$c->{enabled};
}
if ($S->{UI}->{VARS}->{rdf_use_images} && $c->{image_url}) {
$content .= qq~<A HREF="$c->{image_link}"><IMG SRC="$c->{image_url}" ALT="$c->{image_title}" BORDER="1"></a><br>\n~;
} else {
$content .= qq~<B><A CLASS="light" HREF="$c->{link}">$c->{title}</a></b><BR>\n~;
}
my $items = $S->rdf_items($c->{rid}, $item_limit);
foreach my $i (@{$items}) {
$content .= qq~%%dot%% <A CLASS="light" HREF="$i->{link}">$i->{title}</a><BR>\n~;
}
if ($S->{UI}->{VARS}->{rdf_use_forms} && $c->{form_link}) {
$content .= qq~<FORM ACTION="$c->{form_link}" METHOD="GET">$c->{form_title}: <INPUT TYPE="TEXT" NAME="$c->{form_name}"></form><br>\n~;
}
$content .= "<BR>\n";
}
return $content;
|