Skip to content

Commit

Permalink
Merge pull request #202 from paulej72/block-update
Browse files Browse the repository at this point in the history
Block update
  • Loading branch information
TheMightyBuzzard committed Jul 14, 2015
2 parents e07c90e + c0fb3f1 commit d118db8
Show file tree
Hide file tree
Showing 21 changed files with 276 additions and 251 deletions.
2 changes: 1 addition & 1 deletion Slash/Constants/Constants.pm
Expand Up @@ -27,7 +27,7 @@ The constants below are grouped by tag.
use strict;
use base 'Exporter';

our $VERSION = '15.05.4';
our $VERSION = '15.07';
our %CONSTANTS;

constants();
Expand Down
8 changes: 5 additions & 3 deletions Slash/DB/MySQL/MySQL.pm
Expand Up @@ -1179,6 +1179,7 @@ sub createSubmission {
$data->{story} = delete $submission->{story} || '';
$data->{subj} = delete $submission->{subj} || '';
$data->{subj} = $self->truncateStringForCharColumn($data->{subj}, 'submissions', 'subj');
$data->{comment} = delete $submission->{comment} || '';
$data->{ipid} = getCurrentUser('ipid');
$data->{subnetid} = getCurrentUser('subnetid');
$data->{email} = delete $submission->{email} || '';
Expand Down Expand Up @@ -7427,7 +7428,7 @@ sub getSubmissionsMerge {

########################################################
sub setSubmissionsMerge {
my($self, $content) = @_;
my($self, $story, $comment ) = @_;
my $constants = getCurrentStatic();
my $user = getCurrentUser();
my $form = getCurrentForm();
Expand All @@ -7436,7 +7437,8 @@ sub setSubmissionsMerge {
my $subid = $self->createSubmission({
subj => "Merge: " . strip_literal($user->{nickname}) . " ($time)",
tid => $constants->{defaulttopic},
story => $content,
story => $story,
comment => $comment,
name => strip_literal($user->{nickname}),
});
$self->setSubmission($subid, {
Expand Down Expand Up @@ -8808,7 +8810,7 @@ sub getStoryList {
my $columns = "hits, stories.commentcount AS commentcount,
stories.stoid, stories.sid,
story_text.title, stories.uid, stories.tid,
time, stories.in_trash, primaryskid
time, stories.in_trash, primaryskid, notes
";
my $tables = 'story_text, stories';
my @where = ( 'stories.stoid = story_text.stoid' );
Expand Down
12 changes: 7 additions & 5 deletions plugins/Admin/admin.pl
Expand Up @@ -1129,7 +1129,7 @@ sub editStory {
my($extracolumn_flag) = (0, 0);
my($storyref, $story, $author, $storycontent, $locktest,
$extracolumns, $commentstatus_select,
$subid, $fhid, $description, $notes);
$subid, $fhid, $description);
my $extracolref = {};
my($fixquotes_check, $autonode_check, $fastforward_check) = ('','','');
my $page = 'index';
Expand Down Expand Up @@ -1187,6 +1187,10 @@ sub editStory {
#$storyref->{$field} = slashizeLinks($storyref->{$field});
$storyref->{$field} = parseSlashizedLinks($storyref->{$field});
$storyref->{$field} = balanceTags($storyref->{$field});
# This should be moved to balanceTags once that braindead POS is fixed -- paulej72 20150617
$storyref->{$field} =~ s|</p>|</p>\n\n|g;
$storyref->{$field} =~ s|</blockquote>|</blockquote>\n\n|g;
$storyref->{$field} =~ s|(</?h.>)\s*</p>|$1|g;
}

$form->{uid} ||= $user->{uid};
Expand Down Expand Up @@ -1449,7 +1453,6 @@ sub editStory {
if ($stoid || $form->{sid}) {
my $story = $slashdb->getStory($form->{sid});
$stoid ||= $story->{stoid};
$notes ||= $story->{notes};
$pending_file_count = $slashdb->numPendingFilesForStory($stoid);
$story_static_files = $slashdb->getStaticFilesForStory($stoid);
}
Expand Down Expand Up @@ -1483,7 +1486,6 @@ sub editStory {
add_related_text => $add_related_text,
pending_file_count => $pending_file_count,
story_static_files => $story_static_files,
editoral_notes => $notes
});
}

Expand Down Expand Up @@ -1842,7 +1844,7 @@ sub updateStory {
thumb => $form->{thumb},
-rendered => 'NULL', # freshenup.pl will write this
is_dirty => 1,
notes => $form->{editor_notes}
notes => $form->{notes}
};

for (qw(dept bodytext relatedtext)) {
Expand Down Expand Up @@ -2346,7 +2348,7 @@ sub saveStory {
commentstatus => $form->{commentstatus},
thumb => $form->{thumb},
-rendered => 'NULL', # freshenup.pl will write this
notes => $form->{editor_notes}
notes => $form->{notes}
};

for (qw(dept bodytext relatedtext)) {
Expand Down
4 changes: 2 additions & 2 deletions plugins/Admin/templates/editStory;admin;default
Expand Up @@ -59,8 +59,8 @@ SET txRows = 20 IF txRows < 20 %]
[% PROCESS relatedui %]

<table border="0" cellpadding="3" cellspacing="0" id="notes" style="width: 100%;">
<tr class="data_head"><td><b>Editor Notes</b></td></tr>
<tr class="data_hl1"><td colspan="5"><textarea rows="2" wrap="off" name="editor_notes">[% editoral_notes %]</textarea></td></tr>
<tr class="data_head"><td><b>Editors' Notes</b></td></tr>
<tr class="data_hl1"><td><textarea class="fullbox" rows="3" wrap="virual" maxlength="1023" name="notes" cols="[% user.textarea_cols || constants.textarea_cols %]">[% storyref.notes | strip_textarea %]</textarea></td></tr>
</table>
<br>

Expand Down
4 changes: 2 additions & 2 deletions plugins/Admin/templates/listStories;admin;default
Expand Up @@ -87,7 +87,7 @@ FOREACH story = storylistref;
<td class="admin_title">

<a href="[% gSkin.rootdir %]/article.pl?sid=[% story.sid %]">
[% IF story.in_trash == 'yes' %]<s>[% END; story.title | strip_title; IF story.in_trash == 'yes' %]</s>[% END %]&nbsp;</a>
[% IF story.in_trash == 'yes' %]<s>[% END; story.title | strip_title; IF story.in_trash == 'yes' %]</s>[% END %]</a> [% IF story.notes %]<a href="javascript:void(0);" onclick="toggle_visibility('notes_[% story.stoid | strip_attribute %]')" title="[% story.notes | strip_attribute %]">***</a>[% END %]

</td>
<td><b>[% story.aid %]</b></td>
Expand Down Expand Up @@ -125,7 +125,7 @@ FOREACH story = storylistref;
<td>[% story.td2 %]&nbsp;
[% story.time %]</td>
</tr>

[% IF story.notes %]<tr id ="notes_[% story.stoid | strip_attribute %]" class="[% class %] sub_note"><td colspan="8">[% story.notes | strip_attribute %]</td><tr>[% END %]
[% END %]
[% ELSE %]
<tr><td><b>No stories.</b></td></tr>
Expand Down
8 changes: 8 additions & 0 deletions plugins/Ajax/htdocs/images/admin.js
@@ -1,5 +1,13 @@
; // $Id$

function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'table-row')
e.style.display = 'none';
else
e.style.display = 'table-row';
}

function um_ajax(the_behaviors, the_events) {
ajax_update({
op: 'um_ajax',
Expand Down
1 change: 1 addition & 0 deletions plugins/Submit/PLUGIN
Expand Up @@ -7,6 +7,7 @@ mysql_schema=mysql_schema.sql
template=templates/data;submit;default
template=templates/displayForm;submit;default
template=templates/formatSub;submit;default
template=templates/mergeNotes;submit;default
template=templates/mergeSub;submit;default
template=templates/previewForm;submit;default
template=templates/saveSub;submit;default
Expand Down
9 changes: 7 additions & 2 deletions plugins/Submit/submit.pl
Expand Up @@ -336,11 +336,16 @@ sub mergeSubmissions {

my $submissions = $slashdb->getSubmissionsMerge;
if (@$submissions) {
my $stuff = slashDisplay('mergeSub',
my $story = slashDisplay('mergeSub',
{ submissions => $submissions },
{ Return => 1, Nocomm => 1 }
);
$slashdb->setSubmissionsMerge($stuff);
my $comment = slashDisplay('mergeNotes',
{ submissions => $submissions },
{ Return => 1, Nocomm => 1 }
);

$slashdb->setSubmissionsMerge($story,$comment);
}

# need to do this even if nothing is checked, so we update notes etc.
Expand Down
26 changes: 26 additions & 0 deletions plugins/Submit/templates/mergeNotes;submit;default
@@ -0,0 +1,26 @@
__section__
default
__description__
Generate a merged submission from other submissions

* submissions = arrayref of submissions to generate merged submission from
__title__

__page__
submit
__lang__
en_US
__name__
mergeNotes
__template__
[% fullnote = ""; count = 1;
FOREACH submission = submissions;
fullnote = fullnote _ "Sub" _ count _ ": " _ submission.comment _ "\n\n";
count = count + 1;
END;
fullnote %]

__seclev__
10000
__version__
$Id$
12 changes: 8 additions & 4 deletions plugins/Submit/templates/mergeSub;submit;default
Expand Up @@ -13,11 +13,15 @@ en_US
__name__
mergeSub
__template__
[% fullsubtext = "";
FOREACH submission = submissions;
[% fullsubtext = ""; os = ""; count = 1;
FOREACH submission = submissions;
PROCESS formatSub;
fullsubtext = fullsubtext _ "\n\n<h3>" _ submission.subj _ "</h3>\n\n" _ subtext;
END;
stripSubj = submission.subj | strip_title;
fullsubtext = fullsubtext _ "\n\n<h4>" _ stripSubj _ "</h4>\n\n" _ subtext;
os = os _ "<a href='" _ gSkin.rootdir _ "/submit.pl?op=viewsub&subid=" _ submission.subid _"'>Original Submission #" _ count _ "</a>&emsp; \n ";
count = count + 1;
END;
fullsubtext = fullsubtext _ "\n\n<hr><p><small>" _ os _ "</small></p>";
fullsubtext %]

__seclev__
Expand Down

0 comments on commit d118db8

Please sign in to comment.