Scoop -- the swiss army chainsaw of content management
Front Page Everything News Code Help! Wishlist Project Scoop Sites Dev Notes Latest CVS changes Development Activities
Scoop Box Exchange - Show Box: hotlist_flex+diary 1.00

Author: hillct [Info]

Description:

This is a new version of the hotlist_flex box which adds the ability to view a list of diaried to which the logged-in user has subscribed. In order ot use this feature, it is nessecery to deploy the diarysub_box for management of those subscriptions.

Box Code:

# Display Hotlist, Stories and unread replies to user comments
# Version 0.3.1 by hillct

my($view,$content,$item);
my $uri=$S->{APACHE}->uri;
my $arg = $S->apache->args();
$arg =~ s/set-view=\w+//g;
$arg =~ s/;$//;

$uri .= ($arg) ? "?$arg;" : '?';

if($S->{GID} ne 'Anonymous') { # Only if we're logged in
if($S->{CGI}->param('set-view')=~/Hotlist\|Replies\|Stories\|Diaries/){
$view=$S->{CGI}->param('set-view');
$S->session('hotlist-view',$view);
} else {$view = $S->session('hotlist-view') \|\| 'Hotlist';}

$content="<center><b>\|</b> ";
for ('Hotlist','Replies','Stories','Diaries'){
$content.=(($_ eq $view)?"<b>$_ \|</b> ":"<a
href=\"$uri"."set-view=$_\">$_</a> <b>\|</b> ");
} $content.="</center><br>";

if($view eq 'Hotlist'){
if ($S->{HOTLIST} && $#{$S->{HOTLIST}} >= 0) {
foreach my $sid (@{$S->{HOTLIST}}) {
my $stories = $S->getstories(
{-type => 'fullstory',
-sid => $sid});
my $story = $stories->[0];

my $show = $S->{UI}->{VARS}->{show_new_comments};
my $num_new = $S->new_comments_since_last_seen($sid) if
($show eq "hotlist" \|\| $show eq "all");

my $end_s = ($story->{commentcount} == 1) ? '' : 's';
$content .= qq{|dot| <A CLASS="light"
href="|rootdir|/story/$sid">$story->{title}</a> ($story->{commentcount}
comment$end_s};
$content .= qq{, $num_new new} if defined($num_new);
$content .= qq{)<br />};
}
} else{ $content.="<font size=1>No Hotlisted Stories</font>"; }
}elsif($view eq 'Replies'){

my($results,$comment,$sid);
my ($rv, $sth) = $S->db_select({
WHAT => 'c1.sid,c2.cid,c2.subject',
FROM => 'comments AS c1 LEFT JOIN comments as c2 on c2.sid=c1.sid
AND c2.pid=c1.cid LEFT JOIN viewed_stories ON viewed_stories.sid=c1.sid
AND viewed_stories.uid=c1.uid',
WHERE => qq{c1.uid=$S->{UID} AND c2.sid IS NOT NULL AND c2.cid > viewed_stories.highest_idx}
});

while ($comment = $sth->fetchrow_hashref()) {
$results->{$comment->{'sid'}}.=qq{
|dot|
<a href="|rootdir|/comments/$comment->{'sid'}/$comment->{'cid'}#$comment->{'cid'}"><font size="1">$comment->{'subject'}</font></a><br /> };
}
for $sid (keys %$results){
my $story = $S->getstories({
-type => 'titlesonly',
-sid => $sid
});
$content.=qq{
<a href="|rootdir|/story/$sid"><font
size="2">$story->[0]->{title}</font></a><br />
};
}

$content.=qq{<font size="1">No New Replies to your Comments</font>} if $rv eq '0E0';
}elsif($view eq 'Stories'){

my ($results,$story);
my ($rv, $sth) = $S->db_select({
WHAT => 'stories.title,stories.sid,COUNT(comments.cid) AS commentcount',
FROM => 'stories LEFT JOIN comments ON comments.sid=stories.sid',
WHERE => qq{aid='$S->{NICK}' AND section != 'Diary'},
GROUP_BY => 'stories.sid',
ORDER_BY => 'time DESC'
});

while ($story = $sth->fetchrow_hashref()) {
my $sid=$story->{sid};
my $show = $S->{UI}->{VARS}->{show_new_comments};
my $num_new = $S->new_comments_since_last_seen($sid) if
($show eq "hotlist" \|\| $show eq "all");

my $end_s = ($story->{commentcount} == 1) ? '' : 's';
$content .= qq{|dot| <a class="light"
href="|rootdir|/story/$sid">$story->{title}</a> ($story->{commentcount}
comment$end_s};
$content .= qq{, $num_new new} if defined($num_new);
$content .= qq{)<br />};
}
$content.="<font size=1>You have written no stories</font>" if $rv eq '0E0';

}elsif($view eq 'Diaries'){
my @subscriptions=split(/,/,$S->pref('diary_sub'));
my $author_sql=join("' OR aid='", @subscriptions);
$author_sql="aid='$author_sql'"; # faster than doing a map
my ($rv, $sth) = $S->db_select({
DEBUG=> 0,
WHAT => 'stories.aid,COUNT(stories.sid) AS diarycount',
FROM => 'stories LEFT JOIN viewed_stories ON stories.sid=viewed_stories.sid',
WHERE => qq{($author_sql) AND section='Diary' AND tid LIKE 'diary\%' AND viewed_stories.sid is NULL},
GROUP_BY => 'stories.aid',
ORDER_BY => 'stories.aid'
});
my $authors;
map {$authors->{$_->{aid}}=$_->{diarycount};} @{$sth->fetchall_arrayref({})};
for(@subscriptions){
$content.=qq{[<a href="|rootdir|/diary/$_">x</a>] };
$content.=qq{<a href="|rootdir|/user/$_/diary">$_</a>};
if($authors->{$_}){$content.=qq{ ($authors->{$_} new)};}
$content.=qq{<br />\n};
}
$content.="<font size=1>You have no diary subscriptions</font>" if $#subscriptions==-1;
}else{$content.="This error should never occur.";}
return {title => "$S->{NICK}'s $view", content => $content};
}
Announcement and Discussion
Nice Post (none / 0) (#1)
by alexsam on Fri Mar 25, 2016 at 06:04:27 AM PST

Fabulous code is used in the box and we should strive to apply during working it, otherwise it is useless for us. Corporate Video Production. Usually we understand cord word is only used in programming language, but it is not correct many ways having to use it.



Education (none / 0) (#2)
by JamesCameron on Fri Jan 13, 2017 at 06:23:05 AM PST

We should try to relate amid operational it, else it is useless for us. We understand cord sound is just utilize Master Paper Writers as a part of instruction talk, yet it is not right many course by it.



Exchange Box (none / 0) (#3)
by jimms on Tue Apr 18, 2017 at 02:13:39 AM PST

Exchange Box is a project which investigates reciprocity between neighbors. It brings another motivation into the area and Custom Essay Service feeling of having a place and inclusion with the nearby group by prompting opportunities of trade and contact.



Teacher Competency case Analysis (none / 0) (#4)
by Miahal Jhon on Thu Apr 05, 2018 at 05:01:25 AM PST

I'm really impressed with your article, such great & usefull knowledge you mentioned here Theories Of Learning 4 case Analysis



Enterprise Model Database Assignment Help (none / 0) (#5)
by Miahal Jhon on Thu Apr 05, 2018 at 05:16:18 AM PST

Pretty helpful material, much thanks for this article Enterprise Model Database Assignment Help by visiting this site I found cool stuff here keep it up.



Application Project Help (none / 0) (#6)
by Miahal Jhon on Thu Apr 05, 2018 at 06:32:20 AM PST

Dissertation Guidance Provides quality Online Dissertation Help for students. Application Project Help Amazing article thanks or sharing..



Pharmacology Thesis Writing Service (none / 0) (#7)
by Miahal Jhon on Thu Apr 05, 2018 at 06:53:42 AM PST

This is really great work. Thank you for sharing such a good and useful information here in the blog for students. Pharmacology Thesis Writing Service



Master of Technology Dissertation Help (none / 0) (#8)
by Miahal Jhon on Thu Apr 05, 2018 at 07:16:05 AM PST

I appreciate your efforts in preparing this post. I really like your blog articles. Master of Technology Dissertation Help Amazing article thanks or sharing..



Shortest Paths Using Python Homework help (none / 0) (#9)
by Miahal Jhon on Thu Apr 05, 2018 at 07:32:35 AM PST

Great info! I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have Shortest Paths Using Python Homework help



Take My Strategic Management Homework (none / 0) (#10)
by Miahal Jhon on Thu Apr 05, 2018 at 07:54:17 AM PST

Such a nice post, keep providing good resources. Take My Strategic Management Homework



Financial Instruments Using Matlab Homework Help (none / 0) (#11)
by Miahal Jhon on Thu Apr 05, 2018 at 08:13:38 AM PST

I loved the way you discuss the topic great work thanks for the share Your informative post. Financial Instruments Using Matlab Homework Help Thanx for sharing such useful post keep it up :)



Web hosting service (none / 0) (#12)
by Ralson on Mon Jul 16, 2018 at 05:26:47 AM PST

Nice website to get a great content. Got Namecheap vs Godaddy Hosting service camparison to choose best service.



Paharganj Escorts (none / 0) (#13)
by vishakha366 on Tue Aug 21, 2018 at 07:44:03 AM PST

I was hoping for this awesome post and i am glad to have this post here and i think it is good to be a part of this wonderful post.You did such a great job. Paharganj Escorts



great post (none / 0) (#14)
by rao on Mon Nov 12, 2018 at 03:55:59 PM PST

Great post! Interesting information and cute writing style and i newly download shareit apk file which is best



good (none / 0) (#15)
by AnaMattice on Sat Aug 10, 2019 at 03:02:06 PM PST

You can write articles and post them online, there isn't any charge for it. I learned about it through https://fr.altoconvertjpgtopdf.com/about-us. And it was some good piece of info I got to know.



consultant (none / 0) (#16)
by AnaMattice on Tue Sep 10, 2019 at 11:20:49 AM PST

For those people that have previously consulted with this consultant to discuss a brand naming opportunity, would you recommend it to a first timer?



mtom (none / 0) (#17)
by mtom78632 on Sat Jan 04, 2020 at 01:54:58 AM PST

puppies and dogs are very cute, i always love to play with them during my spare time;; Barbers Birmingham ------------------------------------------------------ Thank you for the sensible critique. Me & my neighbor were just preparing to do some research about this. We got a grab a book from our local library but I think I learned more from this post. I am very glad to see such excellent info being shared freely out there. 먹튀



great (none / 0) (#18)
by heenacruzl on Thu Jan 16, 2020 at 09:43:47 PM PST

I like to watch blogs that are very informative. I'm glad to have found this post to be such an interesting post. Twin Shot 2



Review (none / 0) (#19)
by veenu36 on Tue Apr 07, 2020 at 12:19:08 AM PST

thanks worldforpcapp



Menu
create account
faq
search
report bugs
Scoop Administrators Guide
Scoop Box Exchange

Scoop Site Scroller: Get one yourself!
Scoop
The swiss army chainsaw of Content Managment.

Login
Make a new account
Username:
Password:

Hosted by ScoopHost.com Powered by Scoop
All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest 1999 The Management

create account | faq | search