Description:
This is a modification of rdf_feeds. It allows anonymous users to see the box with arguments, and logged in users to see the box with thier rdf preferences plus a link to interface preferences so they can choose feeds.
Box Code:
return unless $S->{UI}->{VARS}->{use_rdf_feeds};
my $content;
if ($S->have_perm('submit_rdf')) {
$content = qq\|<A CLASS="light" HREF="|rootdir|/?op=submitrdf">Submit Feed</A><BR><BR>\n\|;
}
if ($S->{UID} > 0){
my $to_display = {};
my $rdf_arg = $S->{CGI}->param('rdf');
my $channels = $S->rdf_channels();
my $user_feeds = $S->rdf_get_prefs();
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;
foreach my $c (@{$channels}) {
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";
}
}else{
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 $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;
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";
}
}
if ($S->{UID} > 0) {
$content .= qq\|<A CLASS="light" HREF="|rootdir|/interface/prefs">Configure Feeds</A><BR>\n\|;
}
return $content;
|