From: gerv%gerv.net <> Date: Mon, 6 Jan 2003 15:53:11 +0000 (+0000) Subject: Bug 187837 - Unify showing and editing of quips. Patch by gerv; r=timeless, a=justdave. X-Git-Tag: bugzilla-2.17.4~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef85a567fdb1c5d58223902316351d57f062897d;p=thirdparty%2Fbugzilla.git Bug 187837 - Unify showing and editing of quips. Patch by gerv; r=timeless, a=justdave. --- diff --git a/quips.cgi b/quips.cgi index f1783cd0af..d152234ac0 100755 --- a/quips.cgi +++ b/quips.cgi @@ -45,23 +45,6 @@ if (Param('enablequips') eq "off") { my $action = $::FORM{'action'} || ""; if ($action eq "show") { - # Read in the entire quip list - SendSQL("SELECT quip FROM quips"); - - my @quips; - while (MoreSQLData()) { - my ($quip) = FetchSQLData(); - push(@quips, $quip); - } - - $vars->{'quips'} = \@quips; - $vars->{'show_quips'} = 1; -} - -if ($action eq "edit") { - if (!UserInGroup('admin')) { - ThrowUserError("quips_edit_denied"); - } # Read in the entire quip list SendSQL("SELECT quipid,userid,quip FROM quips"); @@ -83,7 +66,7 @@ if ($action eq "edit") { $vars->{'quipids'} = \@quipids; $vars->{'quips'} = $quips; $vars->{'users'} = $users; - $vars->{'edit_quips'} = 1; + $vars->{'show_quips'} = 1; } if ($action eq "add") { diff --git a/template/en/default/list/quips.html.tmpl b/template/en/default/list/quips.html.tmpl index ccb5208b78..c178c5838d 100644 --- a/template/en/default/list/quips.html.tmpl +++ b/template/en/default/list/quips.html.tmpl @@ -62,46 +62,51 @@ [% IF show_quips %] -

- Existing quips: -

- -[% ELSIF edit_quips %] -

Edit existing quips:

- - - - - - - [% FOREACH quipid = quipids %] - - - - - - [% END %] -
ActionUserQuip
- - Delete - - - [% userid = quips.$quipid.userid %] - [% users.$userid FILTER html %] - [% "Unknown" IF NOT users.$userid %] - [% quips.$quipid.quip FILTER html %]
+ [% IF !UserInGroup('admin') %] +

+ Existing quips: +

+ + [% ELSE %] +

Edit existing quips:

+ + + + + + + [% FOREACH quipid = quipids %] + + + + + + [% END %] + +
QuipAuthorAction
[% quips.$quipid.quip FILTER html %] + [% userid = quips.$quipid.userid %] + [% users.$userid FILTER html %] + [% "Unknown" IF NOT users.$userid %] + + + Delete + +
+
+ [% END %] [% ELSE %]

Those who like their wisdom in large doses can - view the whole quip list. + view + [% IF UserInGroup('admin') %] + and edit + [% END %] + the whole quip list.

- [% IF UserInGroup('admin') %] -

Edit the quip list.

- [% END %] [% END %] [% PROCESS global/footer.html.tmpl %]