Update of /cvs/scoop/scoop/lib/Scoop/Stories
In directory lithium.sabren.com:/tmp/cvs-serv4270/lib/Scoop/Stories
Modified Files:
Elements.pm List.pm Submit.pm Views.pm
Log Message:
Move story posting form into blocks. Also moves the part of the poll form where it makes sense into blocks, since it's part of story
posting. Adds an "edit_own_stories" perm that you can enable for users if you want them to be able to edit their own stuff after posting.
And finally changes admin tools semantics to allow multiple perms per admin tool. The admin tools box right now only respects the first
perm listed when it makes the tools list, to preserve the traditional behavior of that box. In the long run, this will need to be
fixed. Also, it may be advantageous eventually to add an "edit" perm category to sections, to enable editing of some sections but not
others.
--rusty
Index: Elements.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Stories/Elements.pm,v
retrieving revision 1.118
retrieving revision 1.119
diff -C2 -d -r1.118 -r1.119
*** Elements.pm 26 Jan 2005 19:24:24 -0000 1.118
--- Elements.pm 3 Feb 2005 15:48:30 -0000 1.119
***************
*** 77,85 ****
}
! if (($story->{displaystatus} == '-1' && !$S->have_perm('moderate')) ||
! ($story->{displaystatus} == '-1' && (($S->{UID} ne $story->{'aid'}) && !$S->have_perm('story_admin')))) {
!
! $page = '';
}
--- 77,88 ----
}
! if ($story->{displaystatus} == '-1') {
! unless ($S->have_perm('moderate') ||
! ($S->{UID} eq $story->{'aid'} && $S->have_perm('edit_my_stories')) ||
! $S->have_perm('story_admin')
! ) {
+ $page = '';
+ }
}
***************
*** 517,520 ****
--- 520,524 ----
}
+
=over 4
***************
*** 711,714 ****
--- 715,719 ----
while ( my $story = $sth->fetchrow_hashref() ) {
# cache them
+ delete $S->{STORY_CACHE}->{$story->{sid}};
$S->{STORY_CACHE}->{$story->{sid}} = $story;
}
Index: Submit.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Stories/Submit.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** Submit.pm 18 Feb 2004 23:03:13 -0000 1.17
--- Submit.pm 3 Feb 2005 15:48:30 -0000 1.18
***************
*** 74,105 ****
}
! if ($preview) {
!
! my $tmpsid = 'preview';
! $content .= $S->displaystory($tmpsid, $params);
! $content .= qq|
! <TR>
! <TD><FONT face="%%norm_font_face%%" size="%%norm_font_size%%" color="FF0000">$message</FONT></TD>
! </TR><TR><TD> </TD></TR>|;
! }
! my $guidelines = '%%submission_guidelines%%';
if ($section ne '' && $section eq 'Diary') {
! $guidelines = '%%diary_guidelines%%';
}
! my $form;
unless ($preview) {
! $form .= qq|
! <!-- Guidelines -->
! <TR>
! <TD>%%norm_font%%$guidelines%%norm_font_end%%</TD>
! </TR>|;
}
!
! $form .= $S->edit_story_form('public');
!
return ($content, $form);
}
--- 74,100 ----
}
! if ($preview) {
!
! my $tmpsid = 'preview';
! $content .= $S->displaystory($tmpsid, $params);
! $content .= qq|
! <TR>
! <TD><FONT face="%%norm_font_face%%" size="%%norm_font_size%%" color="FF0000">$message</FONT></TD>
! </TR><TR><TD> </TD></TR>|;
! }
!
! my $guidelines = $S->{UI}->{BLOCKS}->{submission_guidelines};
if ($section ne '' && $section eq 'Diary') {
! $guidelines = $S->{UI}->{BLOCKS}->{diary_guidelines};
}
! my $form = $S->edit_story_form('public');
unless ($preview) {
! $form =~ s/%%guidelines%%/$guidelines/g;
}
!
return ($content, $form);
}
Index: List.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Stories/List.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** List.pm 30 Jul 2004 08:12:57 -0000 1.7
--- List.pm 3 Feb 2005 15:48:30 -0000 1.8
***************
*** 53,62 ****
my $title;
if ($mode eq 'full') {
! $title = 'Current Stories';
! } else {if ($mode eq 'archive') {
! $title = 'Archived Stories';
} else {
! $title = 'Pending Stories';
! }}
#begin table
--- 53,64 ----
my $title;
if ($mode eq 'full') {
! $title = $S->{UI}->{BLOCKS}->{story_list_title};
} else {
! if ($mode eq 'archive') {
! $title = $S->{UI}->{BLOCKS}->{archive_list_title};
! } else {
! $title = $S->{UI}->{BLOCKS}->{pending_list_title};
! }
! }
#begin table
Index: Views.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Stories/Views.pm,v
retrieving revision 1.68
retrieving revision 1.69
diff -C2 -d -r1.68 -r1.69
*** Views.pm 21 Jan 2005 14:14:30 -0000 1.68
--- Views.pm 3 Feb 2005 15:48:30 -0000 1.69
***************
*** 17,21 ****
my $op = $S->{CGI}->param('op');
my $section = $S->{CGI}->param('section');
!
my $story_params = {-type => $story_type};
$story_params->{-topic} = $topic if ($topic ne '');
--- 17,22 ----
my $op = $S->{CGI}->param('op');
my $section = $S->{CGI}->param('section');
! my $disp = $S->{CGI}->param('displaystatus');
!
my $story_params = {-type => $story_type};
$story_params->{-topic} = $topic if ($topic ne '');
***************
*** 24,27 ****
--- 25,29 ----
$story_params->{-where} = $where_additions if $where_additions;
$story_params->{-from} = $from_additions if $from_additions;
+
my $params;
$params->{topic} = $topic if $topic;
***************
*** 31,37 ****
$params->{from} = $from_additions if $from_additions;
if ( $story_type eq 'main' ) {
! $params->{displaystatus} = '0';
} elsif ( $story_type eq 'section' ) {
! $params->{displaystatus} = [0,1];
$params->{section} = $section;
}
--- 33,39 ----
$params->{from} = $from_additions if $from_additions;
if ( $story_type eq 'main' ) {
! $params->{displaystatus} = $disp || '0';
} elsif ( $story_type eq 'section' ) {
! $params->{displaystatus} = $disp || [0,1];
$params->{section} = $section;
}
***************
*** 89,93 ****
$change_page =~ s/%%NEXT_LINK%%/$next_page/g;
! $page = $change_page . $page if $pp >= 1;
$page .= $change_page;
--- 91,95 ----
$change_page =~ s/%%NEXT_LINK%%/$next_page/g;
! #$page = $change_page . $page if $pp >= 1;
$page .= $change_page;
***************
*** 100,104 ****
my $edit = '';
! if ($S->have_perm('story_list')) {
$edit = qq|[<A CLASS="light" HREF="%%rootdir%%/admin/story/$story->{sid}">edit</A>]|;
}
--- 102,106 ----
my $edit = '';
! if ($S->have_perm('story_list') || ($S->have_perm('edit_my_stories') && $story->{aid} == $S->{UID})) {
$edit = qq|[<A CLASS="light" HREF="%%rootdir%%/admin/story/$story->{sid}">edit</A>]|;
}