Skip to content

Commit

Permalink
firehose submission discussion update
Browse files Browse the repository at this point in the history
  • Loading branch information
pudge committed Jun 19, 2007
1 parent 8c7e7dd commit 41c0c28
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 14 deletions.
22 changes: 20 additions & 2 deletions Slash/DB/MySQL/MySQL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,24 @@ sub createSubmission {

if ($constants->{plugin}{FireHose}) {
my $firehose = getObject("Slash::FireHose");
$firehose->createItemFromSubmission($subid);
my $firehose_id = $firehose->createItemFromSubmission($subid);

if ($firehose_id) {
my $discussion_id = $self->createDiscussion({
uid => 0,
kind => 'submission',
title => $data->{subj},
topic => $data->{tid},
primaryskid => $data->{primaryskid},
commentstatus => 'logged_in',
url => "$constants->{rootdir}/firehose.pl?op=view&id=$firehose_id"
});
if ($discussion_id) {
$firehose->setFireHose($firehose_id, {
discussion => $discussion_id,
});
}
}
}

return $subid;
Expand Down Expand Up @@ -7340,7 +7357,8 @@ sub createDiscussion {
$discussion->{sid} ||= '';
$discussion->{stoid} ||= 0;
$discussion->{ts} ||= $self->getTime();
$discussion->{uid} ||= getCurrentUser('uid');
$discussion->{uid} = getCurrentUser('uid')
unless defined $discussion->{uid} && length $discussion->{uid};
# commentcount and flags set to defaults

if ($discussion->{section}) {
Expand Down
12 changes: 7 additions & 5 deletions plugins/FireHose/FireHose.pm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ sub createFireHose {
$data->{popularity} ||= 0;
$data->{popularity2} ||= 0;
$data->{editorpop} ||= 0;
$data->{body_length} = length($data->{bodytext});
$data->{body_length} = $data->{bodytext} ? length($data->{bodytext}) : 0;
$data->{word_count} = countWords($data->{introtext}) + countWords($data->{bodytext});

my $text_data = {};
Expand Down Expand Up @@ -235,7 +235,7 @@ sub createItemFromSubmission {
name => $submission->{name},
};
$data->{url_id} = $submission->{url_id} if $submission->{url_id};
$self->createFireHose($data);
my $firehose_id = $self->createFireHose($data);
if (!isAnon($submission->{uid})) {
my $constants = getCurrentStatic();
my $tags = getObject('Slash::Tags');
Expand All @@ -246,6 +246,7 @@ sub createItemFromSubmission {
private => 1,
});
}
return $firehose_id;
}

}
Expand Down Expand Up @@ -982,7 +983,7 @@ sub ajaxGetAdminFirehose {
sub ajaxFireHoseGetUpdates {
my($slashdb, $constants, $user, $form, $options) = @_;

my $update_data => { removals => 0, items => 0 };
my $update_data = { removals => 0, items => 0 };

$options->{content_type} = 'application/json';
my $firehose = getObject("Slash::FireHose");
Expand Down Expand Up @@ -1317,7 +1318,7 @@ sub setSectionTopicsFromTagstring {
if ($tid) {
$data->{tid} = $tid;
}
my ($prefix, $cat) = $_ =~ /(!)?(.*)$/;
my($prefix, $cat) = $_ =~ /(!)?(.*)$/;
$cat = lc($cat);
if ($categories{$cat}) {
if ($prefix eq "!") {
Expand Down Expand Up @@ -1396,7 +1397,8 @@ sub dispFireHose {
tags_top => $options->{tags_top},
options => $options->{options},
vote => $options->{vote},
bodycontent_include => $options->{bodycontent_include}
bodycontent_include => $options->{bodycontent_include},
nostorylinkwrapper => $options->{nostorylinkwrapper}
}, { Page => "firehose", Return => 1 });
}

Expand Down
14 changes: 13 additions & 1 deletion plugins/FireHose/firehose.pl
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,22 @@ sub view {
$firehose->setFireHoseSession($item->{id});
}
my $tags_top = $firehose_reader->getFireHoseTagsTop($item);
my $firehosetext = $firehose_reader->dispFireHose($item, { mode => "full", tags_top => $tags_top, options => $options });
my $discussion = $item->{type} eq 'submission' && $item->{discussion};

my $firehosetext = $firehose_reader->dispFireHose($item, {
mode => 'full',
tags_top => $tags_top,
options => $options,
nostorylinkwrapper => $discussion ? 1 : 0
});

slashDisplay("view", {
firehosetext => $firehosetext
});

if ($discussion) {
printComments( $firehose_reader->getDiscussion($discussion) );
}
} else {
print getData('notavailable');
}
Expand Down
1 change: 1 addition & 0 deletions plugins/FireHose/mysql_dump.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid,
INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond) VALUES ('stylesheet','text/css','screen, projection','firehose.css','','','users','no','',2,0, '');
INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond) VALUES ('stylesheet','text/css','screen, projection','calendar.css','','','firehose','no','',2,0, '');
INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond) VALUES ('stylesheet','text/css','screen, projection','firehose.css','','','users','no','',2,0, '');
INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond) VALUES ('stylesheet','text/css','screen, projection','comments.css','','','firehose','no','',2,0, '');

INSERT INTO ajax_ops VALUES (NULL, 'firehose_get_admin_extras', 'Slash::FireHose', 'ajaxGetAdminExtras', 'ajax_admin', 'createuse');
INSERT INTO ajax_ops VALUES (NULL, 'firehose_get_form', 'Slash::FireHose', 'ajaxGetFormContents', 'ajax_admin', 'createuse');
Expand Down
11 changes: 8 additions & 3 deletions plugins/FireHose/templates/dispFireHose;firehose;default
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ __template__
[%
mode = mode || "fulltitle";
divwrapper = 1;
storylinkwrapper = 1;
full = 1;
bodywrapper = 1;
bodycontent = 1;
Expand All @@ -37,6 +38,9 @@ __template__
IF nodivwrapper;
divwrapper = 0;
END;
IF nostorylinkwrapper;
storylinkwrapper = 0;
END;
adminmode = 0;
IF user.is_admin;
adminmode = 1;
Expand Down Expand Up @@ -101,7 +105,7 @@ END %]
[% IF (future || item.type=="story") %]<div class="whitewash">[% END %]
[% PROCESS tagsfirehosedivtagbox id = item.id tags_top = tags_top vote = vote options = options %]
[% IF (future || item.type=="story") %]</div>[% END %]
[% IF divwrapper %]
[% IF divwrapper; IF storylinkwrapper %]
<div class="storylinks">
<div>
<ul>
Expand All @@ -124,8 +128,8 @@ END %]
%]
[% ELSIF item.type == "journal" %]
<a href="[% gSkin.rootdir %]/~[% the_user.nickname %]/journal/[% item.srcid %]/">Read More</a>
[% ELSE %]
Coming soon - Read More &amp; Discuss...
[% ELSIF item.type == "submission" %]
<a href="[% gSkin.rootdir %]/firehose.pl?op=view&id=[% item.id %]">Read More &amp; Discuss</a>
[% END %]
</b>
</li>
Expand All @@ -138,6 +142,7 @@ END %]
</ul>
</div>
</div>
[% END %]
</div>
[% END %]
[% END %]
Expand Down
5 changes: 3 additions & 2 deletions sql/mysql/upgrades
Original file line number Diff line number Diff line change
Expand Up @@ -4558,8 +4558,6 @@ UPDATE vars SET value = 'T_2_5_0_158' WHERE name = 'cvs_tag_currentcode';
# 2007-05-17
UPDATE vars SET value = 'T_2_5_0_159' WHERE name = 'cvs_tag_currentcode';

# PUDGE LAST UPDATED HERE

# 2007-05-23
UPDATE vars SET value = 'T_2_5_0_160' WHERE name = 'cvs_tag_currentcode';

Expand Down Expand Up @@ -4603,13 +4601,16 @@ UPDATE vars SET value = 'T_2_5_0_163' WHERE name = 'cvs_tag_currentcode';

# SLASHDOT LAST UPDATED HERE

# PUDGE LAST UPDATED HERE

# Turn on New Story Posted message option (for admin testing).
INSERT INTO message_codes VALUES (20, 'New Story Posted', 100, 0, 0, 'now', '', 4);

# For plugins/Bookmark
ALTER TABLE bookmark_feeds ADD feedname VARCHAR(32) AFTER feed;

# For plugins/FireHose
INSERT INTO css (rel, type, media, file, title, skin, page, admin, theme, ctid, ordernum, ie_cond) VALUES ('stylesheet','text/css','screen, projection','comments.css','','','firehose','no','',2,0, '');
ALTER TABLE firehose ADD srcname VARCHAR(32) NOT NULL DEFAULT '';
INSERT INTO vars (name, value, description) VALUES ('firehose_adminudcclout', '0.5', 'Admin clout for udc purposes (number between 0 and 1, probably');

2 changes: 1 addition & 1 deletion themes/slashcode/templates/printCommNoArchive;misc;default
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ __template__
[% ELSE %]
[%- d_nickname = Slash.db.getUser(discussion.uid, 'nickname') -%]
[%- msg = BLOCK -%]
This discussion was created by <a href="[% gSkin.rootdir %]/~[% d_nickname | strip_paramattr %]/">[% d_nickname %] ([% discussion.uid %])</a> as
This discussion was created[% IF discussion.uid %] by <a href="[% gSkin.rootdir %]/~[% d_nickname | strip_paramattr %]/">[% d_nickname %] ([% discussion.uid %])</a>[% END %] as
[%- END -%]
[% IF discussion.commentstatus == 'friends_only' %]
[% type = "Friends only" %]
Expand Down

0 comments on commit 41c0c28

Please sign in to comment.