Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
6ae2fd1c
Commit
6ae2fd1c
authored
Jan 26, 2002
by
gerv%gerv.net
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quips.cgi rewrite and templatisation.
parent
779c0c0c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
27 deletions
+113
-27
quips.cgi
quips.cgi
+49
-27
quips.tmpl
template/default/info/quips.tmpl
+64
-0
No files found.
quips.cgi
View file @
6ae2fd1c
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
# Rights Reserved.
# Rights Reserved.
#
#
# Contributor(s): Owen Taylor <otaylor@redhat.com>
# Contributor(s): Owen Taylor <otaylor@redhat.com>
# Gervase Markham <gerv@gerv.net>
use
diagnostics
;
use
diagnostics
;
use
strict
;
use
strict
;
...
@@ -28,40 +29,61 @@ use lib qw(.);
...
@@ -28,40 +29,61 @@ use lib qw(.);
require
"CGI.pl"
;
require
"CGI.pl"
;
print
"Content-type: text/html\n\n"
;
# Use the template toolkit (http://www.template-toolkit.org/)
use
Template
;
PutHeader
(
"Quips for the impatient"
,
"Add your own clever headline"
);
print
qq{
# Create the global template object that processes templates
The buglist picks a random quip for the headline, and
my
$template
=
Template
->
new
(
you can extend the quip list. Type in something clever or
{
funny or boring and bonk on the button.
INCLUDE_PATH
=>
"template/custom:template/default"
,
RELATIVE
=>
1
,
PRE_CHOMP
=>
1
,
});
<FORM METHOD=POST ACTION="new_comment.cgi">
# Define the global variables and functions that will be passed to the UI
<INPUT SIZE=80 NAME="comment"><BR>
# template.
<INPUT TYPE="submit" VALUE="Add This Quip">
my
$vars
=
</FORM>
{
'Param'
=>
\&
Param
,
'PerformSubsts'
=>
\&
PerformSubsts
,
};
};
if
(
exists
$::FORM
{
show_quips
})
{
my
$action
=
$::FORM
{
'action'
}
||
""
;
print
qq{
<H2>Existing headlines</H2>
}
;
if
(
$action
eq
"show"
)
{
# Read in the entire quip list
if
(
open
(
COMMENTS
,
"<data/comments"
))
{
if
(
open
(
COMMENTS
,
"<data/comments"
))
{
while
(
<
COMMENTS
>
)
{
my
@quips
;
print
$_
,
"<br>\n"
;
push
(
@quips
,
$_
)
while
(
<
COMMENTS
>
);
}
close
COMMENTS
;
close
COMMENTS
;
$vars
->
{
'quips'
}
=
\
@quips
;
$vars
->
{
'show_quips'
}
=
1
;
}
}
print
"<P>"
;
}
else
{
print
qq{
For the impatient, you can
<A HREF="quips.cgi?show_quips=yes">view the whole quip list</A>.
}
;
print
"<P>"
;
}
}
PutFooter
();
if
(
$action
eq
"add"
)
{
# Add the quip
my
$comment
=
$::FORM
{
"quip"
};
if
(
!
$comment
)
{
DisplayError
(
"Please enter a quip in the text field."
);
exit
();
}
if
(
$comment
=~
m/</
)
{
DisplayError
(
"Sorry - for security reasons, support for HTML tags has
been turned off in quips."
);
exit
();
}
open
(
COMMENTS
,
">>data/comments"
);
print
COMMENTS
$comment
.
"\n"
;
close
(
COMMENTS
);
$vars
->
{
'added_quip'
}
=
$comment
;
}
print
"Content-type: text/html\n\n"
;
$template
->
process
(
"info/quips.tmpl"
,
$vars
)
||
DisplayError
(
"Template process failed: "
.
$template
->
error
())
&&
exit
;
template/default/info/quips.tmpl
0 → 100644
View file @
6ae2fd1c
[%# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Gervase Markham <gerv@gerv.net>
#%]
[% INCLUDE global/header
title = "Bugzilla Quip System"
h1 = "Add your own clever headline"
%]
[% IF added_quip %]
<p>
<font color="red">
Your quip '<tt>[% added_quip %]</tt>' has been added.
</font>
</p>
[% END %]
<p>
Bugzilla will pick a random quip for the headline on each bug list, and
you can extend the quip list. Type in something clever or funny or boring
(but not obscene or offensive, please) and bonk on the button.
</p>
<form method="post" action="quips.cgi">
<input type="hidden" name="action" value="add" />
<input size="80" name="quip" />
<p>
<input type="submit" value="Add This Quip" />
</p>
</form>
[% IF show_quips %]
<h2>
Existing quips:
</h2>
<ul>
[% FOREACH quip = quips %]
<li>[% quip %]</li>
[% END %]
</ul>
[% ELSE %]
<p>
Those who like their wisdom in large doses can
<a href="quips.cgi?action=show">view the whole quip list</a>.
</p>
[% END %]
[% INCLUDE global/footer %]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment